Posts

Showing posts from April, 2014

c# - Stop executing code when return null on Page_load -

i have page has few properties in .cs, properties later on used in .aspx instance: .cs public string person { get;set; } .aspx <a href="<%= person.website %> >my website</a> the problem here if person null, framework still try run .aspx , end throwing null-exception.. , if make simple check in page_load if(person == null) return it still try execute .aspx, again throw exception so.. question is.. there anyway prevent .aspx getting loaded if persons null if(person == null) //dont run aspx,code response.write("something went wrong!"); thanks in advance! first, can write code : <a href="<%= person != null? person.website : null %> >my website</a> but results in producing unclickable link. propably not desired, isn't it? but such requirements far more easier fulfill using databinding. asp.net has been design mimic windows forms behavior. doing here, "legacy" asp code-style,

Linked List in C error -- Invalid Initalizer error -

i attempting create linked list using c (not c++). linked list initialized through function llinit() should return list struct. however, when compile code error stating "error: invalid initializer" in lltester.c file. why this? this function used initialize linked list in llist.c file: list llinit() { list* ll = malloc(sizeof(list)); ll->head = null; ll->tail = null; return *ll; } this list struct in llist.h file: typedef struct { node *head; node *tail; } list; this main function in lltester.c file attempt initialize list: int main() { list mylist= llinit(); //this line error occurs on! return 0; } your code leaking memory, since it's allocating list malloc() returning structure's content by value . if want have function returns empty list value, should that: list llinit() { list ll; ll.head = null; ll.tail = null; return ll; } the above fine, there's no risk of value "di

c# - How to add CheckBox, Label and DDL to ASP.NET page programmatically? -

i trying add check box, label , ddl asp.net page (aspx) class in c#. have been using literalcontrol _litext = new literalcontrol(); attach label can show them using this.controls.add(_litext); in createchildcontrols() method. how add ddl , check box asp.net page c# code label in same line ddl , checkbox? i have made ddl using syntax: list<dropdownlist> _ddlcollection=new list<dropdownlist>(); (int = 0; < 5; i++) { _ddlcollection.add(new dropdownlist()); } problem not in this.controls.add() call createchildcontrols(). onprerender() method fill ddl , check box. literalcontrol class this? here have tried in onprerender(): foreach (splist list in web.lists) { if (!list.hidden) { _litext.text += @<input type="checkbox">; _litext.text += list.title + "<br />"; } } firs

rubygems - bundle update FileOverflow - file too large -

i don't have lot of experience building gems (the workflow, etc). anyway, when try reinstall local gem, error: gem::package::tarwriter::fileoverflow: tried feed more data fits in file. this after uninstall gem, repackage gem build , update bundler. can enlighten me error means? i'm assuming gem large. currently, it's 148k. is possible may including gem on in files list? check issue , code provide better error text still not released in rubygems >= 2.2

c++ cli - C++ CLI Wrapper -

i’ve question creating c++ cli wrapper native c++ class used in c#. here example code: #include "stdafx.h" #pragma once using namespace system; namespace wrapper { class nativeclass { public: nativeclass() {} int add(int a, int b) { return a+b; } }; public ref class wrapper { public: wrapper() {pnative = new nativeclass();} int add(int a, int b) { return(pnative->add(a,b)); } ~wrapper() { delete pnative; pnative = 0; } !wrapper() { this->~wrapper(); } //my problem here. nativeclass* getnative() { return pnative; } private: nativeclass* pnative; }; } this code works fine. need retrieve pointer refers native class use in other wrapper classes. however, don’t want function “getnative” visible in c# when

oracle - SQL Database, ERD, crows foot notation, -

i have erd diagram have crows foot on customer going dotted line straight line membership. mean members must customers , customers may hold membership? regards i'm not sure whether understood correctly. have like customer >- - - - - ----membership correct? if that's case means membership can owned multiple customers, it's compulsory customer have membership (mandatory relationship - if optional you'd have 0 @ membership table line), , dotted line means it's non-identifying 1 (i.e: foreign key not part of members primary key - or customer not identified membership)

tomcat - how to set jsession id with http -only flag on sun one webserver -

may duplicate question far searched above question related tomcat. , few of methods tried using set http-only flag in web.xml doesn work sun 1 webserver. please suggest me how add http-only jsessionid web application runs on sun 1 webserver. thanks the configuration related version of web-app , not related tomcat or webserver 6.0. configuration below possible in version="3.0": <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd" version="3.0"> <!-- configuration below possible in version="3.0" --> <session-config> <cookie-config> <http-only>true</http-only> </cookie-config> </session-config> </web-app>

How to make a folder in python? -mkdir/makedirs doesn't do this right -

i have little problem. i'm kinda new in python need here. i'm trying make folder should independent on location. the user can on desktop , make on desktop , if in directiory there , so. i mean: os.mkdir('c://program files//....') is not good it's not possible do: os.mkdir('//just folder') ? why have meantion way there? yes can pass folder name os.mkdir it'll create folder in current working directory. may have change current working directory again , again user or pass whole path os.mkdir if don't want that. in [13]: import os in [14]: os.getcwd() out[14]: '/home/monty' in [15]: os.mkdir("foo") #creates foo in /home/monty in [17]: os.chdir("foo") #change current working diirectory `foo` in [19]: os.getcwd() out[19]: '/home/monty/foo' in [18]: os.mkdir("bar") #now `bar` created in `/home/monty/foo`

c# - Parsing any valid DateTime format to SQL Server compatible format? -

i india , here follow dd-mm-yyyy date format. my problem that, our various client needs date time displayed in above format. sql server use our backend,does not recognizes dd-mm-yyyy valid date time format. convert given date mm-dd-yyyy using cultureinfo either using convert.todatetime() or datetime.parse or datetime.tryparse() also, came accross situation, when input date in correct format mm-dd-yyyy or mm/dd/yyyy or yyyy-mm-dd , local system date other above, it throws exception, input string in not in correct format . not able figure out how resolve automatically. exisitng custom method: fails times in of scenarios. /// <summary> /// parses string value supplied value datetime. /// usage: var = common.parsedate(yourdatestring); /// </summary> /// <param name="value"></param> /// <returns></returns> private static datetime parsedate(string value) { datetime i; if (!datetime.trypar

sql - Not able to get the stored procedure's result in variable? -

i have hierarchy of stored procedures calling 1 in below: 1 2 3 now doing is: first of showing 3rd level sp least level. create proc [dbo].[proc_tbluserschedulenewupdateonly] ( @scheduleid bigint=258, @contactid uniqueidentifier='ede3e474-02ca-49c7-86dd-aa97794ecf8a', @scheduledate datetime= '2012-07-16 00:00:00.000', @starttime varchar(20)='12:03:00.0000000', @endtime varchar(20)='15:00:00.0000000', @location bigint=8, @area bigint=7, @room bigint=9, @enddate datetime='2012-07-16 00:00:00.000', @currenttime datetime='2012-07-16 12:00:35.900', @modifiedby uniqueidentifier='0bf84a77-fac2-44e5-af9b-39740415dbd2',

How to check if all inputs are not empty with jQuery -

i need validate form jquery. can check inputs 1 one, it's not practical solution. how can check if inputs non-empty more efficiently? in form can have input elements of different types: text, several groups of radio, select etc. just use: $("input:empty").length == 0; if it's zero, none empty. to bit smarter though , filter out items spaces in, do: $("input").filter(function () { return $.trim($(this).val()).length == 0 }).length == 0;

model view controller - How to bind AngularJS Calendar to a REST resource using MVP -

i’m failing implement binding between rest resource , angluarjs calendar control. seems i’m missing or don’t logically since components working long there separate. used plunker example of calendar implementation: http://plnkr.co/edit/vbydnk?p=preview inside view: ... <div ng-controller="calendarctrl" dev-calendar="uiconfig.calendar" class="span8 calendar" ng-model="eventsources" style="padding-top: 30px;"></div> ... inside controller: xyz.controller('maincontroller', function($scope, $location, $rootscope, mainmodel) { ... // rest call - getpendingobjectsbyuser $scope.pendingobjects = mainmodel.pendingobjectsbyuser.get( {userid : $rootscope.currentuser.userid}, function(response) { // }, function(response) {

android - layout accessed from another APK could'nt access its drawable resources -

i accessed layout of apk accessing applicationinfo service , getting resources via packagemanager. works fine if textview , buttons specified in layout. throws resource not found exception if drawable resource used in accessed layout. this code access layout applicationinfo info = packagemanager.getapplicationinfo( packagename, 0 ); resources res = packagemanager.getresourcesforapplication( info ); xmlresourceparser xres = res.getlayout( 0x7f030000 ); hello friend please try this. packagemanager manager = getpackagemanager(); resources = manager.getresourcesforapplication(packname); int resid = resources.getidentifier("image1", "drawable", packname); log.d(tag, "resid = " + resid); drawable image = getresources().getdrawable(resid); log.d(tag, "resid = " + resid);

c# - How to get selected drop down values from Controller MVC -

the following view : <div class="editor-label"> select currency : </div> <div class="editor-field"> @html.dropdownlist("currencyid", new selectlist(viewbag.currencyid, "value", "text")) </div><div class="editor-label"> select gametype : </div> <div class="editor-field"> @html.dropdownlist("gametypeid", new selectlist(viewbag.gametypeid, "value", "text"), new { style = "width:100px" }) @html.validationmessagefor(model => model.gametypeid) </div> <div class="editor-label"> select category : </div> <div class="editor-field"> @html.dropdownlist("categorybygametype", enumerable.empty<selectlistitem>(), "select category")

How do I enable a "contextual" editor in Visual Studio? -

Image
a number of ides , editors offering "contextual" editing tools: a simple example assistant editor in xcode. secondary edit windows automatically loads relevant secondary file depending on context in. instance, if open header ( foo.h ) in primary window, automatically opens implementation ( foo.m ) in assistant window, , on. brackets has quick edit pressing ctrl + e allows edit css selector points current html element. light table has inline documentation , drafting tables: microsoft has debugger canvas project similar want, it's debug mode , limited visual studio ultimate. tool looking tool coding, not debugging. i normal editor, , secondary editor shows me context of editing. if on class implements interface, secondary editor show interface if on class member instance of class, secondary editor switch class source if on method, secondary editor point method body and on… is there way (*) have similar experience in visual studio 20

c# - Sort Issue on Databound Grid -

my datagridview bound datatable, after binding datagridview datatable, adding new row datatable @ 0 index, row serve grandtotals row, row frozen, working fine except when user click on 1 of column headers sort grid, top grand totals row gets sorted , row appears grand totals row result of sort operation, discovered when grid binded datatable, cannot access sortcompare event of grid, tried make copy of top row when user click on column header can add in sorted event (this event firing up) columnheadermouseclick event not firing up. any advice on situation, goal keep grand totals row on top.

html - TD width - the minimum needed using CSS -

consider table: <table style="width: 100%"> <tr> <td>static length</td> <td>static length</td> <td><div>length varies</div></td> <td>space filler</td> </tr> <tr> ... </tr> </table> how can make 3rd column take minimum width (depending on content) , 4th column take rest? use this td:nth-child(3){ background:red; width: 1px; white-space: nowrap; } demo

asp.net - No Multiple Login on Same machine but same browser allowed -

i have simple requirement of not allowing user log multiple browsers @ time. same browser fine. what simplest thing can done? technlogy : .net 4.0 , sql sever 2008 r2 see advices below: store lastactivitydate each user. if using asp.net sqlmembershipprovider - field exists there, if use authentication mechanisms - need create , update each request of user. add additional boolean field loggedin each user. field set true when user login. if using asp.net sqlmembershipprovider can store value in comment field. when user closes browser send request server 'logout' user, means set loggedin field false . use window.onbeforeunload javascript event that. on user login should check loggedin field user, if false - process operation. if not - should check lastactivitydate value, , if older timeout define (lets 3 minutes) process operation. if not - reject , show error message. additinal check required because cannot guarantee window.onbeforeunload execute

c# - Move the line in canvas - problems -

hi tryied move line object in app. xaml: <canvas x:name="canvas" height="300" width="350" mousedown="canvas_mousedown" mousemove="canvas_mousemove" mouseup="canvas_mouseup" background="transparent" /> code behind: private void canvas_mousedown(object sender, mousebuttoneventargs e) { startpoint = e.getposition(canvas); if (e.originalsource line) { linia = (line)e.originalsource; if(!linefocus) linefocus = true; return; } else linefocus = false; } private void canvas_mousemove(object sender, mouseeventargs e) { var pos = e.getposition(canvas); translatetransform ruch = new translatetransform(pos.x - startpoint.x, pos.y - startpoint.y); linia.rendertransform = ruch; } it works fine line moved, when try move again moving oryginal place (the place when draw them @ first time). when checked messagebox() this: ... l

sublimetext2 - Sublime text comment indentation issue with Ruby -

i use sublimetext since few months ruby, , have issue comment auto-indentation. indentation uses comment's indentation, , indent following code using indentation. expect auto-indentation ignore(at least) or set indent of previous code (at best), not take comment's indentation @ : all colleagues use editor have same issue here's sample code re-indented sublimetext class test def method1 end #bad indentation def method2 somecode end def method3 somecode end end wanted : class test def method1 end #bad indentation def method2 somecode end def method3 somecode end end i did quickfix on ~/.config/sublime-text-2/packages/default/indentation rules - comments.tmpreferences replacing <key>scope</key> <string>comment</string> <key>settings</key> <dict> <key>preserveindent</key> <true/> </dict> with <key>scope</key&

python - Paramiko hangs when running on 150+ servers while running simple commands -

i'm trying run multiple commands on bunch of remote servers using python's paramiko module. the commands i'm trying run simple commands, such cat, lspci(with grep) , small script 1 line output. the thing is, if provide few machines (~50), works fine. problem starts when try run script on many machines. try: ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect(host, username='root', password='pass') transport = ssh.get_transport() channel = transport.open_session() stdin, stdout, stderr = ssh.exec_command(cmd) line in stdout.readlines(): line = line.strip() sheet1.write(row_line,0,host,style_cell) # writing xls file sheet1.write(row_line,1,line,style_cell) # writing xls file while channel.recv_ready(): channel.recv(1024) ssh.close() expect: print stdout print stderr this stdout,stderr get: paramiko.channelfile paramiko.chan

javascript - Bootstrap Dropdown with Hover -

ok, need straightforward. i have set navbar dropdown menus in (using class="dropdown-toggle" data-toggle="dropdown" ), , works fine. the thing works " onclick ", while prefer if worked " onhover ". is there built-in way this? the easiest solution in css. add like... .dropdown:hover .dropdown-menu { display: block; margin-top: 0; // remove gap doesn't close } working fiddle

Ruby on Rails - recover password on email NoMethodError -

i'm setting reset password feature. upon submission email sent reset password link. i'm doing scratch described in railscast episode 274 . however, when submit email error. nomethoderror in passwordresetscontroller#create undefined method `password_reset_sent_at=' # <user:0xa9fd828> app/models/user.rb:26:in `send_password_reset' app/controllers/password_resets_controller.rb:7:in `create' request parameters: {"utf8"=>"✓", "authenticity_token"=>"hnub/j15xztz3mtcd25mcwm06m3g2abcrh+cfxzdj+8=", "email"=>"cauterise@gmail.com", "commit"=>"reset password"} the development log says same thing above ^ app/models/user.rb def send_password_reset generate_token(:password_reset_token) self.password_reset_sent_at = time.zone.now save! usermailer.password_reset(self).deliver end def generate_token(column) begin self[column] = securerandom.urlsafe_base6

javascript - How to Display Text along with JQuery Progressbar and forward to some other JSP page after completing? -

i have progress bar. t working fine need display text along progress bar & when reaches 100% should forward jsp page. program increases 10% & want print text like: 10% -> uploading personal details 20% -> checking email id. 30% -> generating user id. .... , important after reaches 100% must forward some.jsp. how achieve this. please suggest. program: <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> <script type='text/javascript'> var progress = setinterval(function() { var $bar = $('.bar'); if ($bar.width()==400) { clearinterval(progress); $('.progress').removeclass('active'); } else { $bar.width($bar.width()+40); } $bar.text($bar.width()/4 + "%"); }, 800); </script> </head> <body> <script src="http://code.jq

sql - Select max visual studio 2010 -

i'm updating program visual basic 6 visual studio 2010 and, of course, have founded lot of problems solve. i'm using access database 4 tables same key (indice). if use code follow, can last record coddekafix table: private sub cmdlast_click(byval sender system.object, byval e system.eventargs) handles cmdlast.click dim con new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=c:\dekafix\consulta dekafix\dekafix.mdb") dim cmd new oledbcommand() con.open() sql = "select * indice coddekafix=(select max(coddekafix) indice)" but if want results tables same key (indice) change showed below program doesn't work. sql = "select * indice, dekafix1, dekafix2, dekafix3" _ & " coddekafix=(select max(coddekafix) indice) and" _ & " indice.coddekafix = dekafix1.coddekafix and" _ & " dekafix1.coddekafix=dekafix2.coddekafix and" _ & " dekafix2.c

php - Pagination with $_GET - in AJAX - is it posible -

i'm developing php class pagination using $_get. standart, found web. here works : page.php : <form method ="get"> <?php $pages = new pagination(); echo "<br/>"; ?> </form> i want use page.php in index.php ajax / jquery , staying in index.php <!doctype html> <body> <div id ="result"></div> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script> $(document).ready(function() { $.post('./page.php', function (data) { $('#result').html(data); } ); }); </script> </body> </html> is possible way ? is possible instead of using jquery's $.post, can replace $.post $.get?

My Facebook Game App is not appearing in users' 'Games Collection' -

a few weeks/months ago, facebook has introduced new 'games section' (or 'collection') user profiles. while ago noticed our game not listed there among other games played particular user. our game has been available on facebook , in app center several months, , intends , purposes average ranked , used arcade game, approved facebook , all. according facebook's developer description no special code change needed game listed in user's games collection ( http://developers.facebook.com/blog/post/2013/03/27/platform-updates--operation-developer-love/ ), @ loss reason our game not being listed may be. not experienced facebook developer, may missing crucial. searched web , asked in facebook developer group, without success. a while ago noticed game app setting set category 'other', result of facebook removing 'action & arcade' category game categorized app center. have since changed app's category 'games - arcade', has been submitt

java - how to make my android app sign in by facebook and get friends list like foursquare -

i working on android app , need sign in facebook , user friends list invite them use app , publish on there timeline foursquare any stable method ? https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ just read this, has need know

cordova - is it possible to fix phonegap inappbrowser to load in landscape? -

i want use phonegap inappbrowser should load in landscape. whole app shoud run in portrait mode autorotation deactivated. another thing want deactivating tabbar on bottom in inappbrowser , have little x close fullscreen view of browser. way this? i know possibility of android plugins main device developing iphone

preprocessor directive - Token pasting in c using a variable that increments -

i have set of arrays : msg1[] msg2[] .... msgn[] . , need use values in while loop. msgi[] . when define #define msg(a) msg##a , put in loop , increment i , expands msgi ? you can't way. instead create new array, contains pointers actual arrays: int array1[...]; int array2[...]; int *all_arrays[] = { array1, array2 };

Getting data from forecast_io using Ruby on Rails -

i'm pretty new ruby , use in project in school. i've done blog tutorial , have little understanding of how works. the question: can give me tip on how start data forecast_io api? simple request data page. should start? thanks! the forecast_io gem helps here. first need api key. can api key through registering here . forecast_io github readme helps you. forecast::io.api_key = 'this-is-your-api-key' forecast = forecast::io.forecast(37.8267, -122.423) # params are: latitude, longitude forecast.currently # gives current forecast datapoint forecast.currently.summary # =>"mostly cloudy" you can read forecast.io api docs more details.

NoSQL databases in offline mode and forward compatibility -

after doing research, seems when people ask schema migration in couchdb, rebutted concept not compatible nosql ideology. understand how nosql meant schema-less , feels counter-intuitive. nevertheless, in such situation not see how schema migration can totally avoided. use nosql mobile devices. here's big lines of set-up , needs. each mobile device has own replicated database. the mobile device can work offline. mobile devices replicates database on cloud server share data. the data replicates when possible multiple users on different devices can work on same data. a newer version of client decide change value type stores particular key (i.e. equivalent of schema change) the users might not update app update available. a user not updated should able still work on same data users updated. edit: the application 100% native code. my problem here user client old version of software not expect new data string instead of int per se. thus, handling client-side can not

android - Start Animation from zero visibility to full? -

i using startanimation method produce fadein effect on image. want fadein effect work after few seconds of delay, , before don't want image visible. cannot use setalpha method animation takes current state of image. should here? imageview= (imageview)findviewbyid(r.id.imgfade); fadeinanimation = animationutils.loadanimation(this, r.anim.fadein); new handler().postdelayed(new runnable() { @override public void run() { imageview.startanimation(fadeinanimation ); } }, 8000); put imageview.setvisibility(view.visible); after imageview.startanimation(fadeinanimation );

change environment variable in child process - bash -

hi have following example. a.sh script sets environment variable can see in b.sh (child) script, if change still have old value in a.sh a.sh #!/bin/bash export a=1 ./b.sh echo parent $a b.sh #!/bin/bash echo child $a a=2 export echo child $a test: bash-3.00$ ./a.sh child 1 child 2 parent 1 child 1 child 2 in a.sh source b.sh instead of ./b.sh a.sh should : #!/bin/bash export a=1 source b.sh echo parent "$a"

php - Save html on database and titles with quotes -

this question has answer here: how can prevent sql injection in php? 28 answers if try save text on db i'm getting error. lets this: $name = "bob's pizzaria"; $description = "<b>tes, test</b>"; // color, size formats when save database use this: $a_name = mysql_real_escape_string($_request["name"]); $a_desc = mysql_real_escape_string($_request["description"]); then insert database. i error on $a_name because there apostrophe ( ' ) and on description doesn't retain text format bold, color, size etc. what best or right way this? replace ' ' str_replace("'","&apos;",$name);

oop - Python checking account simulator -

i have been working on oop program in python 3.0 simulates checking account , ran bug can't figure out. here is: in main part of program gave user multiple options such , exit, withdraw , deposit , , create new account. when user selects "create new account " program creates object , variable name has variable , im not sure how access atributes object labeled variable.basically asking is, how make variable name variable computer can keep track of , use access attributes of object? here program have far(if helps?): class checking(object): """a personal checking acount""" def __init__(self , name, balance): print("a new checking acount has been created") self.name = name self.balance = balance def __str__(self): rep = "balance object\n" rep += "name of acount" + self.name + "\n" rep += "balance " + self.balance + "\n&qu

Enable BCMath using php.ini? -

i need enable bc math, don't want using --enable-bcmath, because don't understand route. is there way using php.ini only? to best of knowledge must compile php --enable-bcmath option. without it, required code won't exist in binary. therefore, there nothing can set in php.ini

javascript - objects unable to change its own member's values -

i have created object type has member x , y, functions changing members' value. have seen members been changed in debugger. none of members changed. can explain? there difference in behaviour of x , y? 1 local variable , other parameter. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <div id="debug"></div> <script src="scripts/jquery-2.0.0.min.js"></script> <script> function a(y) { var x = 0; return { x: x, y: y, getx: getx, gety: gety, processx: processx, processy: processy, } function getx() { return x; } function gety() { return y; } function processx() { this.x =

Using the time to retrieve specific content from a database through php -

am trying display information on website based on local time. each element has 3 elements. 1. start time 01 - 24 2. end time 00 - 60 3. day of week mon - sun what want load specific element database, based on day , time. how go it? there scripts in php/mysql? i've managed elements database load based on day, using script below; <? $day = date('l'); // weekday name (lower-case l) $time = (int)date("gi"); $getdays = mysql_query("select * pages title = '".$day."'"); $getdays = mysql_fetch_array($getdays); $getonair = mysql_query("select * pages subnav '%".$getdays['id']."%' , type = '10'"); while ($goa = mysql_fetch_array($getonair)) { ?><? echo $goa['id']; ?> - <? echo $goa['content']; ?></div> <? } ?> this display elements in database today start , end times i.e. item 1 start time: 1700 end time: 1730 content: content here

php - How should I separate the value of array as even, odd? -

question currently output coming pnl testing 1,10,pnl testing 2,55, want manipulate , store in 2 different variables string like: $teams = "pnl testing 1, pnl testing 2"; $amount = "10, 55"; please let me know how should split in above format. code while ($row1 = mysql_fetch_assoc($result)){ $profit = 0; $total = 0; $loss = 0; $final_array = ''; $final_array .= $teams = $row1['t_name'].","; $teams = explode(",", $teams); $transact_money = $row1['pnl_amount']; $pnl_results = $row1['pnl']; $transact_money = explode("|", $transact_money); $pnl_results = explode("|", $pnl_results); for($i=0; $i<count($transact_money); $i++){ if($pnl_results[$i]=='profit'){ $profit = $profit + $transact_money[$i]; }else{ $loss = $loss + $transact_money[$i]; }//end if }//end for.. $team_p

html5 - How can I change a CSS gradient via JavaScript? -

i have div following gradient applied it: /* mozilla firefox */ background-image: -moz-linear-gradient(top, #2e2e28 0%, #4d4c48 100%); /* opera */ background-image: -o-linear-gradient(top, #2e2e28 0%, #4d4c48 100%); /* webkit (safari/chrome 10) */ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #2e2e28), color-stop(1, #4d4c48)); /* webkit (chrome 11+) */ background-image: -webkit-linear-gradient(top, #2e2e28 0%, #4d4c48 100%); /* ie10+ */ background: -ms-linear-gradient(top, #2e2e28 0%,#4d4c48 100%); /* w3c */ background: linear-gradient(top, #2e2e28 0%,#4d4c48 100%); how change "#2e2e28" number, still avoid cross-browser nightmare? with jquery it'll : $('.gradient').css({'background-image': 'linear-gradient(to top, #2e2e28 0%, #4d4c48 100%)'}); for safari : $('.gradient').css({'background-image': '-webkit-linear-gradient(top, #2e2e28 0%, #4d4c48 100%)'}); see

build - Items not visible after building or events not working -

i have simple app : http://www.senchafiddle.com/#arebj . consists of view, displays links. after clicking each of them, popup target value appears. works fine before building app, after building links not displayed @ all. showing links i'm using dataview component. i've tried tackling ext.component, dunno why events not fired when of items tapped on (and 'paint' event well). here's second version of iconsscreen view i'd prefer use, without events it's useless : ext.define('sf.view.iconsscreen', { extend: 'ext.component', xtype: 'icons-screen', require: [ 'sf.store.mainmenu' ], config: { tpl: new ext.xtemplate('<ul class="menu-icons-list">', '<tpl for=".">', '<li class="icon">', '<a target="{url}" style="background: url({icon})">',

asp.net mvc 4 - Mvc: Create method to populate dropdown list from a class and call from controller -

the code below works in index controller action populates dropdownbox using database data. i don't want use directly in controller because using dropdown in multiple places on page. var db = new storemanagerentities(); var query = db.categories.select(c => new { categoryid = c.categoryid, categoryname = c.categoryname, isselected = c.categoryid.equals(0) }); var model = new selectviewmodel { list = query.tolist() .select(c => new selectlistitem { value = c.categoryid.tostring(), text = c.categoryname, selected = c.isselected, }) }; return view(model); i want able put code in method , call method controller here class want method go. public class northwinddatacontext { storemanagerentities mydb = new s

python - Labels for scatterplot-matrices -

Image
i have been trying plot scatterplot matrix using great example given joe kington: however, add xlabels , ylabels on subplots have displayed ticks. when change positions of ticks, associated x/ylabel not follow. have not been able find option change location of label; hoping find ax.set_xlabel('xlabel',position='top') not exist. this finally, example x axis4 above ticks. if want change x-label bottom top, or y-label left right, can (provided specific suplot called ax ) calling: ax.xaxis.set_label_position('top') ax.yaxis.set_label_position('right') if example want label "x label 2" stay don't overlap other subplot, can try add a fig.tight_layout() just before fig.show() .

c++ - Using an inline function for an API -

i want create api which, on call of function, such getcpuusage() , redirects getcpuusage() function windows or linux. i'm using glue file api.h : getcpuusage() { #ifdef win32 getcpuusage_windows(); #endif #ifdef __gnu_linux__ getcpuusage_linux(); #endif } so wonder if using inline better solution, since have, call bigger. my question following : better use inlined function every call in situation ? it depends on use-case of program. if consumer still c++ - inline has sense. assume reuse inside c, pascal, java ... in case inline not case. caller must export someway stable name on lib, not header file. lib linux rather transparent, while on windows need apply __dllexport keyword - not applicable inline