Posts

Showing posts from June, 2012

c# - How to refresh the current page after selecting an item in ListPicker -

i'd know how refresh current page with henavigationservice.navigate(new uri(navigationservice.source + "?refresh=true", urikind.relative)); after pick element in listpicker. i suppose using mvvm light windows phone. in case, should catch event in page , trigger command on viewmodel. example: code-behind of page private void listbox_selectionchanged(object sender, selectionchangedeventargs e) { viewmodelclass vm = this.datacontext viewmoedlclass; if (vm != null) { vm.refreshcommand.execute(); } } viewmodel class viewmodelclass { public viewmodelclass { this.refreshcommand = new relaycommand(() => { navigationservice.navigate(new uri(navigationservice.source + "?refresh=true", urikind.relative)); } } public relaycommand refreshcommand { get; set;} } xaml <listbox selectionchanged="listbox_selectionchanged" /> in theory shouldn't

backup - sql server restoring back up error -

i have backed database had created on other machine runningn sql server 2012 express edition , wanted restored on witch running same , have ticked checkbox overwriting existing 1 error: backup mediaset not complete. files: d:\question.bak. family count:2. missing family sequence number:1 this happens if, when made backup, had multiple files listed in backup destination textbox. go source server , create backup again; time, make sure there's 1 destination file listed. if had more 1 file listed backup destination, backup striped across them; you'll need files perform restore. you can verify performing restore labelonly against single file copied destination server.

node.js - Mongodb toArray() performance -

i have collection 'matches' 727000 documents inside. has 6 fields inside, no arrays simple integers , object ids. doing query collection follows: matches.find({ $or: [{ hometeamid: getobjectid(teamid) }, { awayteamid: getobjectid(teamid) } ], season: season, seasondate: { '$gt': daymin, '$lt': daymax } }).sort({ seasondate: 1 }).toarray(function (e, res) { callback(res); }); results returning around 7-8 documents. query takes ~100ms, think quite reasonable, main problem is, when call method toarray(), adds ~600ms!! running server on laptop, intel core i5, 6gb ram can't believe adds 600ms 7-8 documents. tried using mongodb-native driver, switched mongoskin, , stil getting same slow results. suggestions ? toarray() method iterate throw cursor element , load them on memory, highly cost operation. maybe can add index improve query performance, and/or avoid toarray iterating throw cursor. regards, moac

javascript - document.createElement on table,tr,td tags fails IE8 -

as title says, i'm having issue ie8 (works in ff , ie9). following code doesn't produce errors, , if substitute div,ul,and li; works. did searching , didn't find on (table,tr,td) tags not being supported using document.createelement ie8. going wrong? here code: <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>my page title</title> <script> function init() { var ele = document.getelementbyid('content'); var table = document.createelement('table'); var tr = document.createelement('tr'); var td = document.createelement('td'); var txt = document.createtextnode('ie8'); td.appendchild(txt); tr.appendchild(td); table.appendchild(tr); ele.appendchild(table); } </script> </head> <body onload="init();"> <div id="cont

python - Lists of tuples paired with dictionary keys, is this a good method of data classification? -

i new python, , setting large dataset work on, , wanted check , make sure doing in optimized manner possible, right pretty sure not. have python dictionary set so. list1 = [1,2],[3,4],[4,5] list2 = [10,20],[30,40],[50,60] list3 = [100,200],[300,400],[400,500] these list created programmatically (and larger in reality), , sorted dictionary follows: l_dict = {"l1":list1,"l2":list2,"l3":list3} print l_dict `{'l2': ([10, 20], [30, 40], [50, 60]), 'l3': ([100, 200], [300, 400], [400, 500]), 'l1': ([1, 2], [3, 4], [4, 5])}` i have dicitonary set same, except different numbers , object name (call k_dict). here questions: simplest way array/list of first object in each tupple? code follows: #gets first tuple value each list listnames = ["l1","l2","l3"] i=10 while(i < len(listdict)): x,a in l_dict[listnames[i]]: return a[0] i+=1 which working should return (1,3,4,10,30,50,100,300

objective c - Need help wih references - ARC + Cocos 2d -

arc kicking arc i installed cocos 2d , unhappy seeing wanted use arc. having issue can't quite seem figure out. instruments saying have 5 references graphicsmanager object, yet can conclude 4 of them. need create , release many of these. class "rowmanager" (cclayer) calls class "graphicsmanager" (ccnode) make these objects. rowmanager calls methods move objects via selector: [self schedule:@selector(row:) interval:.01] finally, when object arrives @ point, method "row1finished" called creates 1 more reference object before calling object (die) remove it's own children. i can 3 animations stop, object detach rowmanager , disappear, yet dealloc method still not call itself. doing wrong? to convert non-arc cocos2d template followed instructions here: http://www.learn-cocos2d.com/2012/04/enabling-arc-cocos2d-project-howto-stepbystep-tutorialguide/ ///////////////// @interface rowmanager : cclayer { graphicsmanager *graphics

c# - Searching Gridview by Date, but the Calendar control picker (that is DateTime) includes the date and also the time, example: 2013-01-01 00:00:00.000 -

i have gridview should populated according selected date, made use of calendar control . the problem since calendar control's selected date datetime, unfortunately selected date in calendar seems in format : dd-mm-yyy example 2013-02-15 while date field in database of type datetime meaning : dd-mm-yyyy hh:mm:ss.ms example 2013-02-15 09:02:03.253 so there no result since calendar control , database field of different types. what tried sqldatasource1.selectcommand = "select * table1 start_date '% " & calendar1.selecteddate.date & " %' " as can see worked sqldatasource in code behind , made use of like use of like no results show due database having not date time too . i thinking change sql query itself, , precisely field start_date , omit time (hh:mm:ss.ms) possible so? edit: even if calendar control's selected date , field in database both datetime, search won't work because when searching calendar con

c# - Service layer - returning validation & functional results -

i'd know best practice or suggestions returning validation results service layer going used in asp.net mvc. option 1 public ienumberable<validationresult> foo(int userid, out videoid) { var validationresults = new list<validationresult>(); // validation logic goes here... videoid = _videoservice.addvideo(); return validationresults; } option 2 public serviceresult foo(int userid) { var validationresults = new list<validationresult>(); var serviceresult = new serviceresult(); // validation logic goes here... serviceresult.returnobject = _videoservice.addvideo(); serviceresult.validationresults = validationresults; return serviceresult; } public class serviceresult { public ienumberable<validationresult> validationresults { get; set; } public object returnobject { get; set; } } i doing option 1 because think boxing , un-boxing in option 2 pain point. ideas? if return object service

web services - Get IP Address of the requested client(Soap message) -

i working on creating soap message , need find requested client ip. have been finding way find client ip still can't. let me know steps how can find client ip when request client? so want able @ ip address of client consuming web service, within service? you create class examines of server variables, of pull data http headers. i've found looking @ http_x_forwarded_for , remote_addr trick (ex. in c#): public class ip { public static string userhostaddress { { return httpcontext.current.request.userhostaddress; } } public static string remote_addr { { return httpcontext.current.request.servervariables["remote_addr"]; } } public static string http_x_forwarded_for { { return httpcontext.current.request.servervariables["http_x_forwarded_for"]; } } public static string http_client_ip { { return httpcontext.current.request.servervariables["http_client_ip"]; } } public static string http_x_forwarded { { return httpcont

coding style - Mix of PHP functions and classes in one file? -

are there strong technical reasons not combine list of functions , classes in 1 php file? or combine several classes in single file? i have put each class in own file way keep things "clean." , if needed not-oop, maybe group related functions single file. however, i've seen code piled 1 file. aside not being organized, there other dangers practice? the technical reason not support psr-0 (autoloading). this enforces one class per file standard. not apply global, user-defined functions.

I am trying to write a simple Web App for guitar teachers using PHP, mySQL, and EXTjs -

i working on project school/myself. project description... "i thinking of starting guitar teaching business , create web app enable me keep track of students, lesson schedule, musical interests, payment history, age, e-mail address, , phone number. able create record of information went on in lesson, along list of skills student has or has developed on time. when student makes monthly payment able click process payment , e-mail copy of invoice student, , myself. upkeep of student records use edit button update information after each lesson." we have use extjs our presentation layer, php out logic layer, , mysql our database. i feel pretty confident in being able populate grids , layout of page. i worried being able make sure can generate date student supposed have next lesson (example, today april 8th, students next class april 15th, 22nd etc.) i haven't started php code yet, wondering if point me in correct direction because have no idea how want based of o

playframework - Play Framework core dependency management/exclusion -

we using play 2.1.1 (scala) , in efforts tie down our dependencies, have found there several older deps being loaded in directly play framework. specifically, oauth.signpost brings in http-components 4.0 ( , in turn commons-codec 1.3 ) whereas have other dependencies on http-componts 4.1 , commons-codec 1.6 the documentation seems pretty sparse in area - @ least in older play 1.2.x dependencies.yml more explicit, cant find references current 2.1.x release. i'd hate have futz framework's build.scala in ${play2_home}/framework/project remove dependency ( never need oauth.signpost in particular app ), far seems way. any pointers? (edit: came across this: play framework 2.1 remove core dependency related specific transitive dependency, i'd prefer able remove whole explicit dependency core framework ) i don't know how exclude core dependency, may try exclude transitive dependencies in build.scala file: val appdependencies = seq( ... (&quo

git submodules - Git: Find out which branch contains a commit and check it out? -

from i've learned here submodules, can roll submodules right commit using git submodule update --recursive however, submodules never (rarely?) in branch. think branch submodule needs not stored. anyway, can use git branch --contains head in submodule , figure out branch , switch it. there built-in way this? goal branch contains commit (if there one). by default, git doesn't track submodules branches, tracks them commits. git submodule update result in submodules being in detached head state (similar if git checkout specific commit hash). before doing work, you'll have make sure check out branch, otherwise things messy. as of git 1.8.2, can have submodules track branches. option needs specified when add submodule: git submodule add -b master <git repo url> if track submodules via branches, you'll want add --remote update call: git submodule update --remote you can read more tracking submodules via branches here , here .

html5 - countdown timer using javascript should not restart on reload -

i have timer in checkout page, have 2 step checkout after step1 web page reloads step2 , hence timer restarts. need timer continue here code this javascript <input type="hidden" id="dealcost" name="dealcost" value="${model.dealcost}"/> <script type="text/javascript"> var dealcst = document.getelementbyid('dealcost').value; if(dealcst < 53){ zi_inceput1 = new date(); ceas_start1 = zi_inceput1.gettime(); function initstopwatch1() { var timp_pe_pag1 = new date(); return ((timp_pe_pag1.gettime() + (1000 * 0) - ceas_start1) / 1000); } var tim = 1200; function getsecs1() { var tsecs1 = math.round(initstopwatch1()); if((tim-tsecs1)>=0) { var isecs1 = (tim-tsecs1) % 60; var imins1 = math.round((tsecs1 - 30) / 60); var ihour1 = math.round((imins1 - 30) / 60); var imins1 = imins1 % 60; var min = math.floor((tim-tsecs1) / 60);

ruby on rails - Modify a list of variables when passed as a string -

i have ruby instance of class (x) , list of variables string ["var1", "var2", .. , "varn" ]. have function modify these values net effect this: def modify(instance_obj, arrray_of_variables) # end net effect should be: x.var1 = modifyvar(x.var1) x.var2 = modifyvar(x.var2) .. x.varn = modifyvar(x.varn) all variables assumed strings. edit (more information): actual problem i'm trying solve 10 of model classes, have few string variables store in db json strings. have 2 functions parse_from_json (which should called after_find) , serialize_to_json (called before_save). since done quite few model classes (around 10 model classes , total of 30 variables or so), want move separate function instead of defining these functions each model class. you try this. def modify(instance_obj, arrray_of_variables) arrray_of_variables.each |variable| instance_obj.send("#{variable}=", modifyvar(instance_obj.send(variable))) end en

reporting - WPF SSRS report printing -

we have application built in wpf. reports using winforms host display , preview report. there requirement batch print ssrs reports physically printer. i.e. on click of button, should print reports on printer (default printer associated machine). problem face print dialog appears when try print report. not want print dialog, direct printing of ssrs report pinter. how can accomplished? first of all, sorry english. steps: 1. can generate ssrs report using c# (for example) 2. instead of displaying report on screen, can export pdf (in temporary folder.) 3. print pdf file using printdialog control (allow disable print dialog). probably can disable print dialog on report viewer don't know how. hope it

c - execvp - ls: fts_open: No such file or directory -

i'm struggling error. i'm writing shell emulator, using fork() executing command using execvp();. every command try parse shell working perfectly, except ls without arguments. if try execute ls -lah, works, simple ls won't, receiving following error: ls: fts_open: no such file or directory here snippet of code: (just essential) pid = fork(); if (pid==0) { puts("child"); puts(args[0]); puts(args[1]); printf("%d\n", strlen(args[1])); args[2] = null; execvp(args[0], args); } else wait(null); puts("back parent"); } and here output ls: ls child ls 0 ls: fts_open: no such file or directory parent as can see, args[0] contains ls, args[1] empty, there no arguments, length of args[1] 0, keep getting error. any idea on be? edit: kudos jonathan leffler finding out: (also, seems issue on mac) the point args[1] not empty, so, os tries open '' f

javascript - Prevent hash change from scrolling -

sorry ugly layout example below... http://www.wthdesign.net/test/test2.html i managed append id name url: function generateurl(el) { var currentid = $(el).attr('id'); document.location.hash = currentid; } and add: <a id="abc2" onclick="generateurl(this)" >this anchor btn</a> but end having same effect as: <a id="abc2" href="#abc2" >this anchor btn</a> everything fine don't want scroll when when click on link how should that? many in advance. if ids aren't necessary, href="#some-value change window location without scrolling page. if need id in document (on tags in case) location change cause scroll. can work around using history object in modern browsers or storing scroll location on link click, resetting using hashchange event. i use markup both solutions: sample markup: <div class="filler"></div> <a id="abc1" href="#

How can i set Wallpaper in android using coding? -

i developing application shows different photos server , user can set selected photos wallpaper of device used given code set wallpaper working image not set not fit screen. used code. string dirpath = getfilesdir().tostring(); string folder = mphotos.get(nextposition - 1).getcategory(); string filepath = dirpath + "/photoviewer/" + folder + "/" + mphotos.get(nextposition - 1).getfilename(); file imagefile = new file(filepath); bitmap bitmap = bitmapfactory.decodefile(imagefile .getabsolutepath()); wallpapermanager mywallpapermanager = wallpapermanager .getinstance(getapplicationcontext()); try { mywallpapermanager.setbitmap(bitmap); toast.maketext(photoactivity.this, "wallpaper set", toast.length_short).show(); } catch (ioexception e) { toast.maketext(photoactivity.this, "er

MySQLDump to local machine from remote server connected via SSH -

mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename > c:\path\to\store\file it seemed work paused while file downloading, no file appears once completes. do have wrong in command line? use this: mysqldump -p3306 -h192.168.20.151 -u root -p database > c:/my.sql hope you:) edition linux mysqldump -u root -p databasename > ~/downlaods/filename.sql

css - My Html file is not showing any style -

i starting simple static html website, realized that, reason, doesn't show css style. @ first though linking problem, realized style attribute not working in html file. here's simple example: <!doctype html> <head> <link rel="stylesheet" type="text/css" href="../style.css"> <meta charset="utf-8" /> </head> <body> <p style="text-decoration: underlined;">this body green</p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> <p>this body </p> </body> and stylesheet: body { background: #c9c9c9; } any suggestion? you have <p style="text-decoration: underlined;">this body green</p> you n

rest - Broadleaf commerce Api adding an item to shopping does not work -

i have followed setting broadleaf make running following documentation ( http://docs.broadleafcommerce.org/current/rest-tutorials.html ). setup website works fine. howver, when tested adding item shopping cart rest api, found caused me error. here input: url: localhost:8080/api/cart/2003/100?skuid=100&customerid=1101 request method: post found error:[error] 02:15:57 defaulterrorhandler - error occurred during workflow org.broadleafcommerce.core.order.service.exception.requiredattributenotprovidedexception: unable add product (100) cart. required attribute not provided: color my setup environment is: - broadleaf commerce 2.2 - mysql database data comes braodleaf demosite. you seeing because have required product options configured particular product did not pass required attributes request. try request again request this: localhost:8080/api/cart/2003/100?customerid=1101&color=blue this assumes have 'blue' product option value corresponding color pr

iphone - Why do we call doesNotRecognizeSelector: method? -

i working socket programming.i wanted clear doubt related code downloaded - mobileorchard.com - chatty . while r&d , saw function call in chatroomviewcontroller.m file [chatroom broadcastchatmessage:input.text fromuser:[appconfig getinstance].name]; when saw in room.m file, implementation of above call; - (void)broadcastchatmessage:(nsstring*)message fromuser:(nsstring*)name { // crude way emulate "abstract" class [self doesnotrecognizeselector:_cmd]; } i googled "doesnotrecognizeselector:" , according apple error handling, stating "the runtime system invokes method whenever object receives aselector message can’t respond or forward." question why developer call broadcastchatmessage:fromuser: function if none of use there , handle method's "selector not found" exception ? according stackovrflow , used create abstract class , according question , avoid "incomplete implementation" warning. i still not

Wrong math with Python? -

just starting out python, mistake, but... i'm trying out python. use calculator, , i'm working through tutorials. i ran weird today. wanted find out 2013*2013, wrote wrong thing , wrote 2013*013, , got this: >>> 2013*013 22143 i checked calculator, , 22143 wrong answer! 2013 * 13 supposed 26169. why python giving me wrong answer? old casio calculator doesn't this... because of octal arithmetic, 013 integer 11. >>> 013 11 with leading zero, 013 interpreted base-8 number , 1*8 1 + 3*8 0 = 11. note: behaviour changed in python 3 . here particularly appropriate quote pep 3127 the default octal representation of integers silently confusing people unfamiliar c-like languages. extremely easy inadvertently create integer object wrong value, because '013' means 'decimal 11', not 'decimal 13', python language itself, not meaning humans assign literal.

iphone - How to list all the users belonging to the current application, not the current account in QuickBlox for IOS? -

i'm using quick blox ios sdk. have created 2 apps in quickblox dashboard. while listing users in application showing users belonging account[users of both apps], not users of current application. how can list users belonging particular application created in account in quickblox. there checkbox named show application users

objective c - Similar method in ObjectiveC for 'java.lang.Class.getDeclaredField()' -

this question has answer here: objective c introspection/reflection 6 answers i reading text file. want check whether there variable declared in class name same text read file. method in java 'java.lang.class.getdeclaredfield()'. see http://www.tutorialspoint.com/java/lang/class_getdeclaredfield.htm details. i unable find similar method in objectivec. there any? if no, how can implement same. please give me few tips if idea. you can check this: / for properties / yourclass *arrobj=[yourclass new];//your target class wnat check nsstring *propertyname=@"samllarray";//this check in class yourclass if([arrobj respondstoselector:nsselectorfromstring(propertyname)]){ nslog(@"yes, exists"); } else{ nslog(@"no, not exists"); } edit:/ for ivars / - (nsmutablearray *)getallpropertyofclass:(class)aclass { nsm

asp.net - Set images on Pdf using itextsharp -

i working on wcf service create pad file , want set image on created pdf. below code. gives me error "object reference not set object instance" string str = system.web.httpcontext.current.request.mappath("app_data/suc.png"); image imgcheckboxchecked = image.getinstance(str); the other thing try , gives me error :could not find file 'c:\program files\common files\microsoft shared\devserver\10.0\suc.png: below other code image imgcheckboxchecked = image.getinstance("app_data/suc.png"); cell.addelement(imgcheckboxchecked); cell.colspan = 4; table.addcell(cell); any idea on how solve error , set image on pdf. thanks you can use appdomain.basedirectory directory main dll, after can use path image dll, path.combine(appdomain.basedirectory, "app_data\\suc.png") , if host service in asp.net, , dll in bin directory can use relative path path.combine(appdomain.basedirectory, "..\\app_data\\suc.png")

c - How to set register value to enable interrupt? -

i handling interrupt device in android. (android 4.2.2 kernel 2.6.29, running on mach-goldfish virtual device). so far have registered device interrupt #17. hasn't been enabled yet signals sent interrupt ignored , interrupt handler not notified. the register enables device @ offset 0x00, , memory address, returned by (char __iomem *)io_address(resource->start - io_start) starts @ 0xfe016000. i tried: (in mydevice_probe() ) writel(0x07, 0xfe016000); //0x07 mask enable 3 sub-devices @ bit 0, bit 1 , bit 2. but kernel crashed right away. following writel s did not work: writel(0x00, 0xfe016000); writel(0x01, 0xfe016000); what did miss? 1 show me how done? in case got start address wrong, point out way correctly? thanks. p/s: kernel panic: qemu: fatal: mydevice_write: bad offset fea000 r00=c02ef00b r01=00000000 r02=00000007 r03=e0808000 r04=c0340864 r05=c031e3b0 r06=c0173b6c r07=c031e3cc r08=00000000 r09=00100100 r10=00000000 r11=df827e34 r12=ff016000 r1

visual studio 2012 - TFS error Could Not Find File [ProjectName].vsmdi -

this error when doing our first checkin preventing adding solution tfs. not sure how resolve it. this error means there pending change file not exist on disk. so whatever reason, vs has told tfs is making change file [projectname].vsdmi . subsequently, file has been deleted disk. when vs goes checkin, tries check in [projectname].vsdmi doesn't exist on disk. error. either undo pending change , check in again find out whether need file (a vsdmi hile related vs unit tests projects) , try recover it.

dropbox - File sharing app via Cloud Storage -

i looking file sharing cloud storage solutions. requirements below 1. should able share contents limited users(or public availability) 2. users should able download contents shared folder private cloud storage. many cloud storage services dropbox, google cloud storage, amazone, microsoft azure allows public folders, there option copy public shared content users private cloud storage area without copying third party server? also possible copy contents on service provider other service provider without third party server?(eg: dropbox google drive) have looked @ cloudberry explorer? let's copy public public cloud (e.g. amazon constant) or public private cloud (e.g. amazon cloudian). intuitive , inexpensive.

php - from mongodb to array with objects -

it must better way this? want documents sounds collection , output them array objects in (using backbone.js). it cant object objects in! $sounds = iterator_to_array($db->sounds->find()); $a = "["; foreach ($sounds $id => $sound) { $a .= json_encode($sound) . ","; } //remove last comma... $a = substr($a, 0, -1); $a .="]"; echo $a; you try: $sounds = iterator_to_array($db->sounds->find()); echo json_encode(array_values($sounds)); array_values return values of associated array indexed array json_encode return json encoded string in format want (i.e. javascript array instead of javascript object).

c# - How to restrict some views/actions to logged in users? -

i created new controller called dashboard , view called index says, hello username. in mvc, how can make available logged in users? you can use authorize attribute: [authorize] public actionresult index() { }

javascript - Access last logged value in Chrome console -

Image
when evaluate expression directly in chrome console 1 + 1 then can reference evaluated value using $_ however, can't access value $_, when value result of console.log, coming inside of application, instead of expression typed directly console. is there way access last evaluated expression, regardless came from? after it's been logged console, can right click on , option store global function. clicking define new variable 'temp1' point variable. here's video of in action (not mine) .

algorithm - String datastructure supporting append, prepend and search operations -

i need build text editor mini project, , need design data structure or algorithm supports following operation: append : append character @ end of string. prepend : prepend character @ beginning of string. search : given search string s, find occurrences of string. each operation in o(log n) time or less. search , replace operations appreciable not necessary. maximum length of string constant. ideas how achieve this? thanks! a common data structure kind of application rope , append , prepend o(1), although depends bit on whether tree balanced. however, noted Толя, search linear. there data structures can make search faster, such suffix tree , not appropriate text editor application.

ios - Under what conditions might instancesRespondToSelector: return true, but performSelector: throw an exception -

i have code distributed in library looks this: if ([[nsstring class] instancesrespondtoselector: @selector(jsonvalue)]) { nsstring *jsonstring = [[[nsstring alloc] initwithdata: jsondata encoding: nsutf8stringencoding] autorelease]; dict = [jsonstring performselector: @selector(jsonvalue)]; } for reason -[__nscfstring jsonvalue]: unrecognized selector sent instance exception getting thrown when performselector: method gets called. code distributed in library wrote, can't reproduce or debug myself. instead third-party reporting problem. under conditions instancesrespondtoselector: while calling method using performselector: throw exception? edit there case explain why occurs, doesn't make sense. if developers this: @implementation nsstring (ourhappycategory) + (bool)instancesrespondtoselector:(sel)aselector { return yes; } @end it explain why code executing, of course very bad thing do. there way problem occur makes sense? nsstring class clu

linux - Update / download the actual file from the SVN -

i had emergency change in file without going through committing svn. is, instead of local computer make changes , commit this, changed file on server (for reason). tell me, how can download file server on computer? if your server's space working copy and local workplace working copy (and both wcs binded same repo-url) can commit server & update local if server isn't wc, have more headache around syncing diverged changes

Implementing SSL between JAVA GUI & C++ Server -

i have gui designed in java , act client, , can communicate remotely server written in c/c++. communication between them made through sockets. messages sent not encrypted , vulnerable man-in-the-middle attacks. wondering best solution protect communication , wanted implement ssl. possible so, , if yes, toolkit should into. java contains ssl implementation called jsse. see javadoc javax.net.ssl package. there tutorial, , several examples provided jdk.

Java String Format array -

i trying format string follows system.out.println("unique number :"+ number[b]); system.out.println("unique number formatted 28 :"+ string.format("%-28s",number[b]).replace(' ','0')) there no issue when "number" string shorter 28, adds 0's left, when string longer 28 dosnt shorten it, doing wrong ? its extract loop btw many thanks the formatter doesn't cut string , makes sure uses @ least 28 spaces. you have like: if (str.length() > 28) { str = str.substring(0, 28); } or maybe if (str.length() > 28) { str = str.substring(str.length() - 28, str.length()); } to limit size.

ASP.NET using class(static methods) in .aspx design form's head section -

basically trying integrate foundation 4 framework asp.net project. have made class in app_code have made static methods contains css, js links. want use in head tags in .aspx file. partial code: appcore.cs public class appcore { private static idictionary<string, string> dlink = new dictionary<string, string>(); static appcore() { //app links dlink.add("js", "~/_assets/js/"); dlink.add("css", "~/_assets/css/"); dlink.add("img", "~/_assets/img/"); } public static string link(string i) { if (!dlink.containskey(i)) return "n/a"; else return dlink[i]; } } i able use inside body tags as <% appcore.link("css")+"foundation.css";%> what want use in head like: <link rel="stylesheet" href="<% appcore.link("css");%>founda

java - hibernate: insert instance with external "id class" -

i'm using hibernate + hsql on jboss server, need saveorupdate() object has id represented class: public class rideid implements java.io.serializable { private int beginpop; private int endpop; private string requestuser; public rideid() { } public rideid(int beginpop, int endpop, string requestuser) { this.beginpop = beginpop; this.endpop = endpop; this.requestuser = requestuser; } ... so, "rideid" id of entity "ride" public class ride implements java.io.serializable { private rideid id; private user userbyrequestuser; private user userbyacceptuser; private pop pop; private boolean ridestatus; public ride() { } public ride(rideid id, user userbyrequestuser, pop pop) { this.id = id; this.userbyrequestuser = userbyrequestuser; this.pop = pop; } public ride(rideid id, user userbyrequestuser, user userbyacceptuser, pop pop, boolean ridestatus) { this.id = id; this.userbyrequestuser = userbyrequestu

c++ - Warning GDB Inappropriate IOCTL for device -

i'm using program crashes on linux (and works fine on windows) , don't know why. i've got quite strange error, : &"warning: gdb: failed set controlling terminal: inappropriate ioctl devide\n" when launch debugger. informations found on internet made me think has output. the concerned file crashes @ lign 0 , contains function : void sync_print::stdoutformat (const char* format, ...) { va_list args; va_start(args, format); locker protect (synchro); ::vprintf(format, args); va_end(args); } sync_print name class implements static void stdoutformat(const char* format, ...); , static mutex synchro; in debugger on qtcreator, says program crashed in file named /lib/ld-linux.so.2 on lign 0. program crashes immediately, can't output using std ... empty main , no include crashes. i'm kinda lost here ... don't know if accurate give more code. if need precisions i'd glad give them ... i'm under linux ubuntu 12

Selenium IDE : Not able to perform operation on new tab -

i not able perform operation on new tab.consider following scenario : add ticket,after adding ticket, page goes view tickets page ( actions performed on same tab) on page,i got 3 options view,edit , delete tickets. if click on view or edit icon new tab opened. everything performed till above after opening new tab,selenium ide doesn't recognise or not able perform operations on newly opened tab. ( note :- stick selenium ide 1.10.0 ) use waitforvisible on 1 of elements on tab. also try slowing down execution speed slider see if helps.

UIWebView. Replace css properties using javascript -

the code likes following: <style type=\"text/css\"> html{background: #000; margin: 0; padding: 0} body {padding: 30px; background: #000;width: 85;margin:0 auto;color: #000;font-family: arial, sans-serif;line-height: 1.3em;} </style> what if want replace example html.background? usual nsstring replacement not suitable because there lot of similar properties. you should consider using jquery framework this. more information on css jquery available here: http://api.jquery.com/css/

javascript - How to add external html into a div -

i have html file index.html. wanna load external files( 1.html, 2.html, 3.html) div on button click html this <div class="buttons"> <button type="button">button1</button> <button type="button">button2</button> <button type="button">button3</button> </div> <div class="mydiv"> </div> on click of button1 1.html content loaded in above div. on click of button2, 2.html.. , etc. i new java script let me know how write script this. appreciated. in advance use load() .. , data attirbutes .. try this html <div class="buttons"> <button type="button" data-url="1.html">button1</button> <button type="button" data-url="2.html">button2</button> <button type="button" data-url="3.html">button3</button> </div> jquery $("button").click

javascript - How to draw doughnut with HTML5 canvas -

Image
i draw doughnut within html5 canvas.if background color of canvas solid color, able draw it. it's gradient color, can't draw it. i know how draw doughnut, when backgroud color of canvas gradient color. like: source this code: function background(context, coordinate, properties) { var x = coordinate.x //起始点x , y = coordinate.y //起始点 y , w = coordinate.w //宽度(终点-起始点之间的宽度) , h = coordinate.h //高度(终点-起始点之间的高度) , gradientfactor, gradientcolor; //渐变因子, 渐变色 context.save(); switch( properties["background-fill-type"] ) { case "solid": context.fillstyle = properties["background-color"]; break; case "gradient": gradientfactor = properties["background-gradient-factor"]; gradientcolor = context.createlineargradient(x, y, x + w, y); gradientcolor.addcolorstop(gradientfactor, properties["background-first-color"]); gradientcolor.addcolorstop(1 - gradi

ASP.NET MVC project structure with multiple subdomains? -

Image
i have task create site contains subsites. subsites use same database , have relations. domain names should differ. example, domain www.mysite.com . subsites www.books.mysite.com www.blog.mysite.com www.sport.mysite.com i need project structure start application. can give me idea? can create mvc4 projects in 1 solution? or can domain routing? this has been answered elsewhere , not in great detail, i'll collate relevant points here. a visual studio solution has no actual relation deployment of site; it's container various projects. when deploy these projects, can define bindings them in iis. relatively straightforward process ; if you're doing simple way ui you'll this: which lets define addresses point where. during development, you'll need similar bindings in host file play part of these iis bindings local machine.

php - Joomla Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1048576 bytes) -

i'm running joomla 1.5.8 on live server. can make changes website such text content updates in articles. modification module returns titles error error reporting on. without returns generic server error 500. i've tried changing permissions of alot of different folders , have tried manipulate htaccess file still have had no luck. did not setup site , have been brought project functioning features existing, cannot make changes them or new ones. full error is: fatal error: allowed memory size of 33554432 bytes exhausted (tried allocate 1048576 bytes) in /var/www/vhosts/mydomain/httpdocs/libraries/joomla/filesystem/file.php on line 147 try setting ini_set('memory_limit', '-1');

php - what means new static? -

this question has answer here: new self vs. new static 2 answers i saw in frameworks line of code: return new static($view, $data); how understand new static ? when write new self() inside class's member function, instance of class. that's magic of self keyword . so: class foo { public static function baz() { return new self(); } } $x = foo::baz(); // $x `foo` you foo if static qualifier used derived class: class bar extends foo { } $z = bar::baz(); // $z `foo` if want enable polymorphism (in sense), , have php take notice of qualifier used, can swap self keyword static keyword: class foo { public static function baz() { return new static(); } } class bar extends foo { } $wow = bar::baz(); // $wow `bar`, though `baz()` in base `foo` this made possible php feature known late static binding ; don

Syntax error in a simple json file -

Image
i have json file : ["sylvia molloy","manuel mujica lainez","gustavo nielsen","silvina ocampo","victoria ocampo","hector german oesterheld", "olga orozco","juan l. ortiz", "alicia partnoy","roberto payro","ricardo piglia","felipe pigna","alejandra pizarnik", "antonio porchia", "juan carlos portantiero","manuel puig","andres rivera","mario rodriguez cobos","arturo andres roig","ricardo rojas"] i getting syntax error in browser console knows why ? i have edited json file : ["sylviamolloy","bassemalam"] , posted image of error please check again in console should not use new lines inside strings. fine between array elements.

Show the project folder in the Aptana's "App Explorer" to SVN update or commit my project -

aptana's app explorer shows files within project. me svn update or commit whole project need able right click on project folder instead of sub folders. project folder not shown within app explorer. what switch project explorer , right click on project folder there, easier able within app explorer. know how show project folder in app explorer or different way update or commit whole project within app explorer?

windows - Qt Creator "The program has unexpectedly finished." -

yesterday installed qt creator , qt library 5.0.1. when created new project , wanted see how looks, build , run program , got following error: starting c:\users\khaled\workspace_qt\test-build-desktop_qt_5_0_1_mingw_32bit-debug\debug\test.exe... program has unexpectedly finished. c:\users\khaled\workspace_qt\test-build-desktop_qt_5_0_1_mingw_32bit-debug\debug\test.exe exited code -1073741511 i got same error when tried build , run address book application example section. i looked other questions here, , read 1 said check g++ version , change toolchain build & run section in setting, there nothing says toolchain. read 1 said try chnage between debug , release mode, both didn't work. read post using event viewer see lacking dlls couldn't find anything. why getting error message , how can fix it? thanks if run application clicking on or using cmd (basically not through qt), windows system error informing of problem. if you're missing dll's (whi

Incorporating both changes when resolving git merge confilct -

let's have 2 development branches ( master , feature ) , both branches added code same file. when trying merge feature master run single confict: ++<<<<<<< head + //some code added in master branch ++======= + //some code added in feature branch ++>>>>>>> feature if want accept head (master) , abandon feature run: git checkout --ours path/to/file if want accept feature (master) , abandon head run: git checkout --theirs path/to/file how can accept both changes result of conflict resolution simple union of code? //some code added in master branch //some code added in feature branch you have edit file manually, , remove conflict markers (if that, result "union" want). git not because conflict resolution semantic problem program cannot offer general solution. though if or on large scale, doubtless write script (doing in automated way break code though).

php - PDO - Dynamic Query Building -

is somehow possible built dynamic query pdo? description: have following function: function savecontent($roundid,$answer,$question_de,$question_en,$files_1_1,$files_1_2,$files_2_1,$files_2_2,$files_3_1,$files_3_2) { $sql_pictures = " update ".dbprefix."pictures set file_1_static=:files_1_1, file_1_animation=:files_1_2, file_2_static=:files_2_1, file_2_animation=:files_2_2, file_3_static=:files_3_1, file_3_animation=:files_3_2 roundid=:roundid"; try { $db = self::getconnection(); $stmt_pictures = $db->prepare($sql_pictures); $stmt_pictures->bindparam("roundid", $roundid); $stmt_pictures->bindparam("files_1_1", $$question_de); $stmt_pictures->bindparam("files_1_2", $question_en);

PHP Array Merge By Date -

i have 2 array , each array has 2 attribute first array : array ( [0] => array ( [uregisterdate] => 2013-04-03 [total] => 4 ) [1] => array ( [uregisterdate] => 2013-04-04 [total] => 4 ) [2] =>; array ( [uregisterdate] => 2013-04-05 [total] => 3 ) ) second array : array ( [0] => array ( [uregisterdate] => 2013-04-03 [totalfailed] => 2 ) [1] => array ( [uregisterdate] => 2013-04-04 [totalfailed] => 4 ) ) i want final array below output |( merge between 2 array key uregistreddate: array ( [0] => array ( [uregisterdate] => 2013-04-03 [total] => 4 [totalfailed] => 2 ) [1] => array ( [uregisterdate] => 2013-04-04 [total] => 4 [totalfailed] => 4 ) [2] =>; array ( [uregisterdate] => 2013-04-05

Premade IRC bots -

i'm looking premade irc bot, can install on of channels. support channels, need able add commands give out important notices etc. all appretiated. you should have @ supybot . it's extensible , configurable irc bot written in python. find many plug-ins on official website or on github. if happen know python, best option. you try eggdrop (or windrop eggdrop version windows). many tcl scripts (extensions) available pretty everywhere. i suggest visit irc-wiki useful when need information related irc.

SQL Server 2008 select statement that ignores non alphanumeric characters -

i have interesting sql server search requirement. say have table part numbers follows: partno description ------ ----------- abc-123 first part d/12a92 second part how can create search return results if search, say, 'd12a'? i have full text search set description column, looking find parts match part no when users don't include / or - etc. i'd rather in single sql statement rather creating functions if possible have read access db. you like: select * part_table replace(replace(partno,'/', ''),'-','') '%d12a%' this work 2 characters specified , extended more character so: select * part_table replace(replace(replace(partno,'/', ''),'-',''),*,'') '%d12a%' probably not elegant of solutions unless special characters limited. otherwise i'd suggest writing function strip out non-alphanumeric characters. here example of such function: create

c# - Compare two image data using unsafe method -

i writing function difference between 2 bitmap images in visual studio 2010. have function takes 2 bitmap images parameters, use unlock bits data of each pixel,both images of equal resolution , dimensions. when use unlock bits 1 image works well, when use both simultaneously in same function gives exception bitmap region locked code : public bitmap invert(bitmap b,bitmap c) { bitmapdata bmdata = b.lockbits(new system.drawing.rectangle(0, 0, b.width, b.height), imagelockmode.readwrite, system.drawing.imaging.pixelformat.format24bpprgb); int stride = bmdata.stride; system.intptr scan0 = bmdata.scan0; // image 2 bitmapdata data2 = c.lockbits(new system.drawing.rectangle(0, 0, c.width, c.height),