Saturday, 15 March 2014

Solr exact search with blank character AND a wildcard -



Solr exact search with blank character AND a wildcard -

i got problem solr search. want search string blank character within , wildcard in end. way found set string in quotes. if , can´t set wildcard in end.

so there way can search "foo bar"* ?

thanks hint!

you can seek escaping white space field:foo\ bar*

wildcard queries :- note wildcards not supported within quoted phrases. treated if white space.

solr wildcard

visual studio 2012 - Why is Shadow Task not Finding Referenced DLL? -



visual studio 2012 - Why is Shadow Task not Finding Referenced DLL? -

a unit test project migrated vs2010 still uses auto-generated private property accessors.

after many hours of coding , testing solution includes class library project, unit test project class library project, , web project, error manifests. web project executed under iis express.

error 24 not load file or assembly 'the.classlibrary, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. scheme cannot find file specified. the.classlibrary.tests

facts

the.classlibrary.tests has project reference the.classlibrary. there no other build errors (checked build output not errors window) the dll physically nowadays current timestamp in bin\debug i restarted iis express i restarted visual studio cleaned / rebuilt solution

option a

work around issue. may happen again.

in add-on steps tried, necessary search , delete all occurrences of the.classlibrary.dll on disk. so, total procedure is:

stop iis express exit visual studio 2012 search , delete all instances of "missing" dll. start visual studio 2012

i hope helps someone.

option b

fix issue properly

private accessors depreciated in vs2012. instead, create private things need visible unit test internal instead, , utilize internalsvisibleto attribute in assemblyinfo.cs of project beingness tested allow test project access internal properties, methods , fields of test subject.

assemblyinfo.cs (of myproject)

[assembly: internalsvisibleto("myns.myproject.tests")]

visual-studio-2012

release - What files to ship with binaries when releasing software? -



release - What files to ship with binaries when releasing software? -

i'm college pupil , know how code in c++, c#.net , java.

the thing can create programs, set them work, etc. (sorry if sounds vague)

but, there industry-wide standard followed when shipping binaries customers? not worrying licenses, but, example, @ application (when bundled installer) in c:\program files\myapp\ , may find executable , other necessary dlls/binaries, but, @ other packages (professional) made java/c#.net,

one finds numerous files, directories well-organized.

my concern is, how create "professional" release software (and files include , why) can shipped user?

thank you.

typically distribution on net want supply single installer file unpack libraries , resources programme requires. programme quite simple , doesn't depend on multiple external modules, have no need incorporate multiple files in distribution package, executable. when begin producing applications require access 3rd party apis , such need bind them installation package.

release production

asp.net - Hide button in gridview when field is Null -



asp.net - Hide button in gridview when field is Null -

i have grid view of rows have attached pictures. when press button2 pull info sql record, folder on server has pictures. works already, can not button visible in rows have image folder attached.

i've googled long time , found different solutions similar following, can not work. doing wrong?

<asp:sqldatasource id="sqldsodinrssfeb" runat="server" connectionstring="<%$ connectionstrings:herning_brand_dk_dbconnectionstring %>" selectcommand="select pubdatetime, melding, station, photofolder odinrss "> </asp:sqldatasource> <asp:gridview id="gridview14" runat="server" datasourceid="sqldsodinrssfeb" autogeneratecolumns="false" width="500px" onrowcommand="button_rowcommand" > <columns> <asp:boundfield datafield="pubdatetime" headertext="tidspunkt" /> <asp:boundfield datafield="melding" headertext="melding udkaldet" /> <asp:boundfield datafield="station" headertext="station" /> <asp:templatefield headertext="foto" > <edititemtemplate> <asp:textbox id="textbox1" runat="server" text='<%# bind("photofolder") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:button id="button2" runat="server" text="foto" visible='<%# eval("photofolder") != "null" %>' commandname="buttonclick" commandargument='<%# eval("photofolder") %>' /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview>

my .cs

protected void button_rowcommand(object sender, gridviewcommandeventargs e) { if (e.commandargument != null) { switch (e.commandname) { case "buttonclick": { int folder = convert.toint32(e.commandargument); photolist(folder); } break; } } } void photolist(int foldernumber) { var imagepaths = directory.getfiles(server.mappath("photofolder\\" + foldernumber)); var imagenames = new string[imagepaths.length]; (int = 0; < imagepaths.length; i++) { imagenames[i] = imagepaths[i].substring(imagepaths[i].lastindexof("\\") + 1); } var dt = new datatable(); dt.columns.add("imagename", typeof(string)); dt.columns.add("imagepath", typeof(string)); foreach (var imgname in imagenames) { datarow dr = dt.newrow(); dr["imagename"] = removeextension(imgname); dr["imagepath"] = "photofolder/" + foldernumber + "/" + imgname; dt.rows.add(dr); } datalist1.datasource = dt; datalist1.databind(); } string removeextension(string imgname) { homecoming imgname .replace(".jpg", "") .replace(".png", ""); }

the sql field "photofolder" nvarchar(50). if there photos record, field has number 100 , up, refares folder containing photos. if there no photo record, field contains "null"

i have tried:

<asp:button id="button2" runat="server" text="foto" visible='<%# eval("photofolder").tostring() != "null" %>'

but button shown in rows, not ones has string(number) in "photofolder"

you can in gridview rowdatabound event. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

asp.net button gridview visible itemtemplate

ruby - Rails web server isn't starting up -



ruby - Rails web server isn't starting up -

rails version 2.3.14 ruby version 1.8.7 gem version 1.6.2

rails s gives me next output:

exists exists app/controllers ... exists tmp/cache exists tmp/pids identical rakefile identical readme identical db/seeds.rb identical config/initializers/backtrace_silencers.rb identical config/initializers/inflections.rb identical config/initializers/mime_types.rb identical config/initializers/new_rails_defaults.rb overwrite config/initializers/session_store.rb? (enter "h" help) [ynaqdh] y forcefulness config/initializers/session_store.rb overwrite config/initializers/cookie_verification_secret.rb? (enter "h" help) [ynaqdh] y forcefulness config/initializers/cookie_verification_secret.rb identical config/environment.rb .... identical config/boot.rb identical public/javascripts/controls.js identical public/javascripts/application.js identical doc/readme_for_app identical log/server.log identical log/production.log identical log/development.log identical log/test.log

my rails version old, it's not me. also, log files empty.

does have ideas?

in rails 2.x command run server

script/server

rails s in 2.x creating new rails app named "s", not starting server.

ruby-on-rails ruby

asp.net mvc 4 - Using Complex DataType in EF CodeFirst -



asp.net mvc 4 - Using Complex DataType in EF CodeFirst -

this model :

public class course of study { public int id { get; set; } public string title { get; set; } public string institute { get; set; } public string instructor { get; set; } public string duration { get; set; } public level level { get; set; } public format format { get; set; } public datetime released { get; set; } public string filesize { get; set; } public string desciption { get; set; } } public enum level { beginner, intermediate, advanced } public enum format { avi, hd, fullhd } public class coursedb:dbcontext { public dbset<course> courses { get; set; } }

when want create new controller scoffolding using ef template, it's not create both level , format fields while using ef5 what's problem? in advise

enum types not supported when scaffolding, why fields not created.

my advice utilize helper method such : working enums in asp.net mvc 3

and code manually.

update:

looks there ticket logged back upwards here: http://mvcscaffolding.codeplex.com/workitem/10

asp.net-mvc-4 ef-code-first entity-framework-5

salesforce - Too many callouts: 11 in DataBase.Batchable -



salesforce - Too many callouts: 11 in DataBase.Batchable -

i have code segment in database.batchable

if(pagetoken!=null) deleteevents(accesstoken , pagetoken,c.calendarid__c); }

and delete event function code

public static void deleteevents(string accesstoken,string pagetoken,string calendarid){ while(pagetoken != null) { string re = gcalendarutil.doapicall(null,'get','https://www.googleapis.com/calendar/v3/calendars/'+calendarid+'/events?pagetoken='+pagetoken,accesstoken); system.debug('next page response is'+ re); re = re.replaceall('"end":','"end1":'); re = re.replaceall('"datetime":','"datetime1":'); json2apex1 aa = json2apex1.parse(re); list<json2apex1.items> ii = aa.items ; system.debug('size of ii'+ii.size()); pagetoken = aa.nextpagetoken ; list<string> event_id =new list<string>(); if(ii!= null){ for(json2apex1.items i: ii){ event_id.add(i.id); } } for(string ml: event_id) system.debug('hello worlds'+ml); for(string s:event_id) { gcalendarutil.doapicall(null,'delete','https://www.googleapis.com/calendar/v3/calendars/'+calendarid+'/events/'+s,accesstoken); } } }

because there 180 event thats why getting error deleting them have alternative create custom object , text field (id of event)in , create 1 more database.batchable class deleting them , pass batch of 9 or other method able more 100 callouts in database.batchable interface??

10 max. , doesn't seem google's calendar api supports mass delete.

you seek chunking batch job (the size of list of records passed each execute() call). illustration this:

global database.querylocator start(database.batchablecontext bc){ homecoming database.getquerylocator([select id event]); // loops through events , not accounts } global void execute(database.batchablecontext bc, list<account> scope){ // deletes here } database.executebatch(new mybatchclass(), 10); // create sure work on 10 events (or less) @ time

another alternative read daisy-chaining of batches. in execute you'd deleting 10, in finish() method check 1 time again if there's still more work , can fire batch again.

p.s. don't utilize hardcoded "10". utilize limits.getcallouts() , limits.getlimitcallouts() automatically update if salesforce ever increases limit.

in trigger illustration set 10 @future methods, each fresh limit of 10 callouts... still batch sounds improve idea.

salesforce apex-code

VBScript: wait for Excel MsgBox, Click OK -



VBScript: wait for Excel MsgBox, Click OK -

i've written vbscript automates load of processing of excel workbooks.

for of these workbooks, msgbox triggered when opened. message box interrupting automation.

is there way hear msgbox in vbscript , "click" ok when pops up?

try utilize wrapper:

application.displayalerts = false application.workbooks.open ([your code]) application.displayalerts = true

this suppress warnings on opening, e.g. compatibility issues, etc.

update:

in case msgbox generated workbook code, seek utilize this:

application.automationsecurity = msoautomationsecurityforcedisable

in case late binding used, work:

application.automationsecurity = 3

read more: http://support.microsoft.com/kb/886633

excel vbscript automation msgbox

Paginating Redis data sets in Ruby -



Paginating Redis data sets in Ruby -

when info modeled activerecord, can utilize myriad of tools paginate info not need load 1,000,000 objects memory @ given time on app server. when have such big info sets redis sets, sorted sets, lists... there tools help paginate info well? understand sets, might not work there no deterministic way retrieve info incrementally. however, if you're dealing sorted sets or lists, should not issue i'd imagine. tools deal paginating redis info sets in ruby?

i created ruby gem called redis_pagination redis sorted sets , lists.

ruby-on-rails ruby redis

unit testing - NSubstitute VerifyAll equivalent -



unit testing - NSubstitute VerifyAll equivalent -

does nsubstitute have equivalent moq's verifyall call? i'd verify calls expect received across substitutes called, ideally in single teardown method. i'm verifying each received phone call individually in tests, isn't ideal. starters, calls set on substitute don't called slip through net if weren't explicitly verified individually.

nsubstitute meant aaa style tests, not record/replay. such, doesn't back upwards them.

unit-testing mocking moq nsubstitute

java - Cannot set variable by listener -



java - Cannot set variable by listener -

i'm origin gui , listeners. want take , set file pc "file zvolenysubor" in class hlavna class implementing actionlistener. can take file in listener's actionperformed method , set "file subor" fail in saving "file zvolenysubor" in main (and of ideas how failed too). should change/add there please?

here classes:

public class hlavna { public static void main(string[] args) { file zvolenysubor = null; jframe frame = new jframe("abcde"); jbutton vybersuboru = new jbutton("vyber"); vybersuboru.setbounds(220, 15, 200, 20); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(640, 480); frame.add(vybersuboru); frame.setlayout(null); vyberlistener list1 = new vyberlistener(zvolenysubor); vybersuboru.addactionlistener(list1); vybersuboru.settext("vyber subor"); } } public class vyberlistener implements actionlistener { private file subor; public vyberlistener(file subor){ this.subor = subor; } @override public void actionperformed(actionevent e) { jfilechooser chooser = new jfilechooser(); system.out.println("lol"); filenameextensionfilter filter = new filenameextensionfilter("jpg & gif images", "jpg", "gif"); chooser.setfilefilter(filter); chooser.showopendialog(null); subor = chooser.getselectedfile(); system.out.println(subor.getabsolutepath()); } }

not sure you're asking here. java passes method arguments value opposed reference, file parameter you're supplying constructor of vyberlistener updated in vyberlistener class actionperformed method, not reference in main method. you're trying accomplish here?

if you're trying update "file zvolenysubor" in main method, may worthwhile making "file subor" in vyberlistener class public, can accessed main method.

update minimise amount of chatter in comments below, i'll seek , summarise. although java supports pass reference, it's passing pointers reference. in example, pass null object reference (subor) actionlistener, overwritten in actionperformed method:

subor = chooser.getselectedfile();

thus file variable "zvolenysubor" never updated. in order update fields in hlavna class, recommend using next "container" pattern:

public class hlavna { public static void main(string[] args) { // new "filereference" container instance filereference zvolenysubor = new filereference(); jframe frame = new jframe("abcde"); jbutton vybersuboru = new jbutton("vyber"); vybersuboru.setbounds(220, 15, 200, 20); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(640, 480); frame.add(vybersuboru); frame.setlayout(null); vyberlistener list1 = new vyberlistener(zvolenysubor); vybersuboru.addactionlistener(list1); // retrieves updated file instance file updatedfile = zvolenysubor.getfile(); } } public class vyberlistener implements actionlistener { private filereference subor; public vyberlistener(filereference subor){ this.subor = subor; } @override public void actionperformed(actionevent e) { jfilechooser chooser = new jfilechooser(); filenameextensionfilter filter = new filenameextensionfilter("jpg & gif images", "jpg", "gif"); chooser.setfilefilter(filter); chooser.showopendialog(null); subor.setfile(chooser.getselectedfile()); } } // filereference container class allows file reference updated actionlistener // without re-initialising object reference public class filereference { private file _file; public void setfile(file file) { _file = file; } public file getfile() { homecoming _file; } }

java actionlistener

c# - Removing block of code from class if condition is met -



c# - Removing block of code from class if condition is met -

this question has reply here:

how delete line text file in c#? 8 answers

what i'm doing reading file line line, , comparing each line that's read pre-specified string. if it's match, want remove code class i'm inspecting, starting @ line matched pre-specified string until designated location i've identified reached. i'm struggling how implement removal. i've written methods add, subtract, adjust, etc., never remove chunk of code, don't know how procede. bet there's simple way accomplish this, it's escaping me right now.

it sounds asking "how remove middle of file?" - happens source code.

the easiest way create temp file (or in memory stream) write content want maintain , when done processing old file over-write contents take keep.

c#

c# - Custom control library file resources -



c# - Custom control library file resources -

i developing custom command includes webbrowser command within command template. creating custom command , accessing webbrowser within command template works without problem have situation onappytemplate method needs dynamically load html file within same custom command library dll. here code using @ moment when seek access file streamresourceinfo null

public override void onapplytemplate() { base.onapplytemplate(); _host = gettemplatechild("part_browserhost") webbrowser; if (_host == null) return; _host.loadcompleted += hostonloadcompleted; var uri = new uri(@"pack://application:,,,/taicodev.shark.controls;component/epubreader/resources/book.html", urikind.absolute); var streamresourceinfo = application.getcontentstream(uri); var source = streamresourceinfo.stream; _host.navigatetostream(source); }

is build action file resource or embeddedresource? latter require using getmanifestresourcestream , not pack uri. if resource have verified that right name resource? e.g. looking @ resources of assembly in reflector/ilspy.

c# wpf resources class-library

flourinefx - best practice to handle unhandled exception in WCF project? -



flourinefx - best practice to handle unhandled exception in WCF project? -

i have wcf project handles requests flex application. project has 30 methods. best practice handle exceptions? parts it's logging only. warp each method try/catch (and maybe have more info logging) or handle in 1 place?

usually want implement ierrorhandler interface handle unhandled exceptions. have lookt @ article more details ierrorhandler interface

wcf flourinefx

c# - When i set Webdriver Firefox profile to download all files by default it not working -



c# - When i set Webdriver Firefox profile to download all files by default it not working -

i set firefox profile download files default when comes images pops open dialog , asked me weather save or view . code utilize follows

var foldername = "temp"; var profile = new firefoxprofile { enablenativeevents = true }; profile.setpreference("browser.download.folderlist", 2); profile.setpreference("browser.download.manager.showwhenstarting", false); profile.setpreference("browser.download.dir", foldername); profile.setpreference("browser.download.downloaddir", foldername); profile.setpreference("browser.download.defaultfolder", foldername); profile.setpreference("browser.helperapps.neverask.savetodisk", "application/all"); _webdriver = new firefoxdriver(profile);

application/all

is not valid mime type. config entry take comma delimited list of mime types.

there no way tell "all files". need supply list of mime types.

this limitation of firefox not selenium.

c# firefox selenium webdriver selenium-webdriver

c# - Dropdownlist Databind automatically setting selected value? -



c# - Dropdownlist Databind automatically setting selected value? -

i filled dropdownlist active directory users, not big deal , works great. problem it's setting <option selected="selected" value="user">user</option> on first 1 , won't allow me alter in code behind. there way maintain automatically setting selected="selected"?

<asp:dropdownlist id="dlst" runat="server" width="200px" autopostback="true" datasourceid="dlstvalues" datatextfield="name" appenddatabounditems="true"> <asp:listitem>-- select --</asp:listitem> </asp:dropdownlist>

or should work:

protected void page_load(object sender, eventargs e) { if (!ispostback) { dropdownlist1.appenddatabounditems = true; dropdownlist1.items.insert(0, new listitem(string.empty, string.empty)); dropdownlist1.selectedindex = 0; } }

c# asp.net data-binding

how to download All File from Arraylist in android? -



how to download All File from Arraylist in android? -

i want download video , save in sdcard.i have arraylist in file.not single file.how possible .please help me.

arraylist<url_dto> list = new arraylist<url_dto>();

thanks in advance!!!

what pass param in downloadfilefromurl().i used button click event.

maindownloadbtn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub //what pass param new downloadfilefromurl().execute(); } });

may download class in below ::

class downloadfilefromurl extends asynctask<object, string, string> { int count = 0; progressdialog dialog; progressbar progressbar; int myprogress; /** * before starting background thread show progress bar dialog * */ @override protected void onpreexecute() { super.onpreexecute(); progressbar progressbar; } /** * downloading file in background thread * */ @override protected string doinbackground(object... params) { log.v("log_tag", "params :::; " + params); int count; progressbar = (progressbar) params[0]; seek { // url url = new url(f_url[0]); url url = new url((string) params[1]); log.v("log_tag", "name ::: " + url); name = ((string) params[1]).substring(((string) params[1]) .lastindexof("/") + 1); log.v("log_tag", "name substring ::: " + name); urlconnection conection = url.openconnection(); conection.connect(); // getting file length int lenghtoffile = conection.getcontentlength(); // input stream read file - 8k buffer inputstream input = new bufferedinputstream(url.openstream(), 8192); download = new file(environment.getexternalstoragedirectory() + "/download/"); if (!download.exists()) { download.mkdir(); } string strdownloadurl = download + "/" + name; log.v("log_tag", " downwards url " + strdownloadurl); fileoutputstream output = new fileoutputstream(strdownloadurl); byte data[] = new byte[1024]; long total = 0; while ((count = input.read(data)) != -1) { total += count; // publishing progress.... // after onprogressupdate called // publishprogress("" + (int) ((total * 100) / // lenghtoffile)); // writing info file progressbar .setprogress((int) ((total * 100) / lenghtoffile)); output.write(data, 0, count); } // flushing output output.flush(); // closing streams output.close(); input.close(); } grab (exception e) { log.e("error: ", e.getmessage()); } homecoming null; } /** * updating progress bar * */ protected void onprogressupdate(string... values) { super.onprogressupdate(values); log.v("log_tag", "progress :: " + values); // setting progress percentage // pdialog.setprogress(integer.parseint(progress[0])); } /** * after completing background task dismiss progress dialog * **/ protected void onpostexecute(string file_url) { log.v("log", "login ::: 4::: " + download); string videopath = download + "/" + name; string chpname = name; log.v("log_tag", "chpname ::::" + chpname + " videopath " + videopath); db.execsql("insert videostatus (chapterno,videopath) values(\"" + chpname + "\",\"" + videopath + "\" )"); } }

this link provides thought on http file download. idea, can iterate through video urls in list.

android arraylist download

java - HttpURLConnection very slow -



java - HttpURLConnection very slow -

can spot why takes ~20 sec? running code below post json request local server 192.168.1.127.

curl -h "content-type: application/json" -x post http:// 192.168.1.127:8080/bed -d '{"command":{"value":3.012,"set":"target_pressure_voltage"},"id":2002,"side":"left","role":"command"}'

curl on same box server running instant , server not complain.

a request android browser fast. have tried 2 android devices os version 4.x.

this question not help far can tell: android httpurlconnection slow

con.getinputstream() takes ~20 sec:

string httpjson(string url, jsonobject job) { string ret = null; httpurlconnection con = httpjsoncon(url); if(con!=null) httpjsoncon(con, url,job); homecoming ret; } httpurlconnection mkcon(string url) { httpurlconnection con = null; url u = null; seek { u = new url(url); con = (httpurlconnection) (u.openconnection()); con.setrequestmethod("post"); con.setusecaches(false); con.setrequestproperty("content-type", "application/json"); con.setrequestproperty("accept", "text/plain"); con.setrequestproperty("accept", "application/json"); con.setdooutput(true); con.setdoinput(true); con.connect(); } grab (exception e) { log.w(tag, " e= " + e); if(con!=null) con.disconnect(); con = null; } homecoming con; } string sendjson(httpurlconnection con, jsonobject job) { string ret = null; if(con==null){ homecoming ret; } seek { final string towriteout = job.tostring(); final author out = new outputstreamwriter(new bufferedoutputstream( con.getoutputstream()), "utf-8"); out.write(towriteout); out.flush(); //con.getinputstream() takes ~20 sec: final bufferedreader in = new bufferedreader(new inputstreamreader(con.getinputstream())); } grab (ioexception e) { log.d(tag, " e= " + e); ret = null; } { if(con!=null) con.disconnect(); } homecoming ret; }

add request header specifies post content length.

con.setrequestproperty("content-length", "" + json.length());

java android

java - How to run a junit test on a method with parameters and custom return object -



java - How to run a junit test on a method with parameters and custom return object -

i new junit , unit testing , start unit testing code. start method looks following:

public store loadstore(integer customerid, integer storeid){ //the logic of method selects store database based on parameter criteria }

from article http://www.vogella.com/articles/junit/article.html have read next assertions can made:

fail(string) asserttrue(true) asserttrue([message], boolean condition) assertsequals([string message], expected, actual) assertsequals([string message], expected, actual, tolerance) assertnull([message], object) assertnotnull([message], object) assertsame([string], expected, actual) assertnotsame([string],expected, actual)

i confused assertion utilize method. should utilize several? should utilize one? should trying prove unit testing of method?

/** * little illustration started. * illustration of test class test loadstore * assumes method defined in class called storemanager. * encapsulates tests required within same test method * expediency sake. should restrict 1 core functionality per test. * if writing functional test, can groupd core functionality together. * * provide default input data. provide info should pass * info should fail or error according possible conditions can think off. * * fine hardcode info when when starting out later need * defining test info in sort of reusable way easy maintain info changes. * * practice not run test against db databases. * * */ import static org.junit.assert.*; import static org.junit.assert.asserttrue; import static org.junit.assert.fail; import org.junit.after; import org.junit.before; import org.junit.beforeclass; import org.junit.test; public class storemanagertest { @beforeclass public void before() { //in here pre-initilization each test class if needed //database login if needed //mock objects if needed etc } @before public void beforetest() { //in here pre-initilization each test if needed } @after public void aftertest() { //in here cleanup each test if needed } @test public void testloadstore() { storemanager storemanager = new storemanager(); integer validcustomerid = new integer(9876); integer invalidcustomerid = new integer(-10); integer validstoreid = new integer(2345); integer invalidstoreid = new integer(-345); string validcustomername = new string("validname); string validstorename = new string("validstorename); //test first valid id. //expect homecoming store. if store undefined asserttrue fail. //if error fail. need invetigate why failing valid store id , valid client id. try{ store store = storemanager.loadstore(validcustomerid, validstoreid); assertnotnull(store); asserttrue(store.getstoreid().equals(validstoreid)); asserttrue("customer id match : " , store.getcustomerid().equals(validcustomerid)); //you can check other parameters exist in store object assertsame("customer name match : ", store.getcustomername(), validcustomername); assertsame("store name match : ", store.getstorename(), validstorename); }catch(exception e){ fail("testhashcode failed! " + e.getmessage()); } //test valid id , invalid customerid //expect error or null store. if store undefined asserttrue pass. //if error fail valid assume test passed can write other test test //whether error status expected. try{ store store = storemanager.loadstore(invalidcustomerid, validstoreid); assertnull(store); }catch(exception e){ asserttrue("no store matching : "+invalidcustomerid, true); } //test invalid storeid , valid customerid //expect error or null store. if store undefined asserttrue pass. //if error fail valid assume test passed can write other test test //whether error status expected. try{ store store = storemanager.loadstore(validcustomerid, invalidstoreid); assertnull(store); }catch(exception e){ asserttrue(true); } //test invalid storeid , invalid customerid //expect error or null store. if store undefined asserttrue pass. //if error fail valid assume test passed can write other test test //whether error status expected. try{ store store = storemanager.loadstore(null, null); assertnull(store); }catch(exception e){ asserttrue(true); } } }

java unit-testing junit junit4

Checking with VBScript if server has all critical updates installed -- managed by WSUS -



Checking with VBScript if server has all critical updates installed -- managed by WSUS -

i developing script gets deployed , executed on server (so if running locally , not remote).

i need check see if critical updates installed. each server has wsus server managing updates. there way me vbscript.

i looking @ post, windows update check vbscript

but don't know if help me since i'm not familiar how windows update works, need critical updates.

if follow method selected reply in post linked, will

createobject("microsoft.update.session")

work if wsus managing updates? utilize grab updates wsus deems critical?

the microsoft.update.session object query whatever update server host pointed towards, microsoft's servers or local wsus. reports approved updates apply host.

vbscript windows-update

jquery - Toggle driving me crazy in responsive design -



jquery - Toggle driving me crazy in responsive design -

i'm total beginner jquery , having lot of problem responsive website i'm designing. 2 horizontal menus on desktop site, when screen size hits 657px , less need horizontal menus become drop downwards menus.

i thought had working until realised when screen size less 657px , opened , closed(toggled?) drop downwards open , close in larger sizes well, makes perfect sense have no thought how stop doing that, need drop-down appears @ sizes 657px , less toggles only, not horizontal menus well.

i tried adding .show horizontal menus @ >=657 create sure showed, caused contents of drop downwards menus show before pressed . thought must impossible until saw many websites have done (bostonglobe.com instance).

i think question similar didn't understand solution: jquery toggle on responsive site

my html (it's standard arabic website)

<button id="categories-dd" class="unactive-main"></button> <nav id="main-navigation"> <ul id="menu"> <li class="leaf" id="dd-mainnav"> <a href="main.html">الرئيسية</a> </li> <li class="leaf1" id="dd-mainnav"> <a href="politics-html.html">سياسة</a> </li> <li class="leaf2" id="dd-mainnav"> <a href="sports-html.html">رياضة</a> </li> <li class="leaf3" id="dd-mainnav"> <a href="business-html.html">أعمال</a> </li> <li class="leaf4" id="dd-mainnav"> <a href="culture-html.html">ثقافة</a> </li> <li class="leaf5" id="dd-mainnav"> <a href="opinion-html.html">رأي</a> </li> <li class="leaf6" id="dd-mainnav"> <a href="tech-html.html">تكنلوجيا</a> </li> <li class="leaf7" id="dd-mainnav"> <a href="lifestyle-html.html">نمط الحياة</a> </li> <li class="leaf8" id="dd-mainnav"> <a href="multimedia-html.html">فيديو</a> </li> </ul> </nav> <!--end: main navigation--> <!--secondary navigation--> <button id="countries-dd" class="unactive-sec">البلد</button> <nav id="secondary-navigation"> <ul id="menu2"> <li class="subleaf"> <a href="arab-news-html.html">الإمارات</a> </li> <li class="subleaf"> <a href="arab-news-html.html">عمان</a> </li> <li class="subleaf"> <a href="arab-news-html.html">اليمن</a> </li> <li class="subleaf"> <a href="arab-news-html.html">السعودية</a> </li> <li class="subleaf"> <a href="arab-news-html.html">البحرين</a> </li> <li class="subleaf"> <a href="arab-news-html.html">قطر</a> </li> <li class="subleaf"> <a href="khalij-html.html">الكويت</a> </li> <li class="subleaf"> <a href="iraq-html.html">العراق</a> </li> <li class="subleaf"> <a href="syria-html.html">سوريا</a> </li> <li class="subleaf"> <a href="lebanon-html.html">لبنان</a> </li> <li class="subleaf"> <a href="jordan-html.html">الأردن</a> </li> <li class="subleaf"> <a href="palestine-html.html">فلسطين</a> </li> <li class="subleaf"> <a href="egypt-html.html">مصر</a> </li> <li class="subleaf"> <a href="sudan-html.html">السودان</a> </li> <li class="subleaf"> <a href="libya-html.html">ليبيا</a> </li> <li class="subleaf"> <a href="tunisia-html.html">تونس</a> </li> <li class="subleaf"> <a href="algeria-html.html">الجزائر</a> </li> <li class="subleaf"> <a href="morocco-html.html">المغرب</a> </li> <li class="subleaf"> <a href="mauritania-html.html">موريتانيا</a> </li> </ul> </nav> <!--end: secondary navigation-->

my jquery(please don't laugh):

$(document).ready(function(){ $('#countries-dd,#categories-dd').on('click', function(){ $(this).next().toggle(); }); $(document).ready(function(){ $('#categories-dd').on('click',function(){ $('#categories-dd').toggleclass('active-main'); }); }); $(document).ready(function(){ $("#countries-dd").on('click',function(){ $("#countries-dd").toggleclass("active-sec"); }); }); }); $(window).resize(function() { if($(window).width() > 657) { $('#main-navigation, #secondary-navigation').show(); } });

any help appreciated....thank you!

you have several elements same id dd-mainnav. that's not allowed. utilize multiple classes instead:

<li class="leaf7 dd-mainnav">

once (and rewrite js , css accordingly), add together test window's width within click handlers:

$('#categories-dd').on('click',function(){ if ($(window).width > 657){ $(this).toggleclass('active-main'); } });

but might easier leave js as-is , add together new styles mobile stylesheet:

#categories-dd, #categories-dd.active-main { display: block; /* or whatever */ }

jquery toggle responsive-design

memory not being released in iOS app using ARC -



memory not being released in iOS app using ARC -

i've built simple trivia game using arc. while profiling memory usage using allocations profiling tool in xcode, see memory not freed. 1 illustration of problem, have class activeplayer object:

activeplayer.h:

@interface activeplayer : nsobject @property (nonatomic, strong) nsstring * name; @property (nonatomic) nsinteger overallscore; @property (nonatomic) nsinteger questionscore; - (id) initwithname:(nsstring *)name; @end

activeplayer.m:

#import "activeplayer.h" @interface activeplayer () @end @implementation activeplayer - (id) initwithname:(nsstring *)name { self = [self init]; if (self) { self.name = name; self.overallscore = 0; } homecoming self; } /* - (void)dealloc { self.name = nil; } */ @end

and activeplayer created in createplayer method in activegame class:

[[activeplayer alloc] initwithname:name]

i'm executing next test case: start new game (which allocates 1 activeplayer), reply 1 question, , game ends (and @ point activeplayer deallocated). can start game , repeat cycle (each cycle "game", described below). while using allocations profiling tool, expect see memory has been allocated in middle of game has been deallocated after game ends (no matter how many times play game). i've found not case:

btw: each bulleted row below describes row in objects list tab of allocations tool; site won't allow me post screenshot, hence text description. rows live; i'm viewing created , still living allocations.

while game #1 in progress, see next allocations.

category=activeplayer; size=16; responsible caller=-[activegame createplayer:] category=malloc 48 bytes; size=48; responsible caller=-[activeplayer initwithname:]

after game #1 complete, see following. activeplayer object has been deallocated, 48 bytes still live.

category=malloc 48 bytes; size=48; responsible caller=-[activeplayer initwithname:]

if start game #2, see next while game in progress. there 2 new allocations in add-on 1 game #1.

category=malloc 48 bytes; size=48; responsible caller=-[activeplayer initwithname:] category=activeplayer; size=16; responsible caller=-[activegame createplayer:] category=malloc 144 bytes; size=144; responsible caller=-[activeplayer initwithname:]

and after game #2 complete, see following. again, activeplayer object has been deallocated, "malloc x bytes" allocations still exist.

category=malloc 48 bytes; size=48; responsible caller=-[activeplayer initwithname:] category=malloc 144 bytes; size=144; responsible caller=-[activeplayer initwithname:]

after that, unusual results -- if play games #3, #4, , #5, never see in-game rows category="malloc x bytes", new row category=activeplayer, freed after game ends. first 2 "malloc" rows, shown above, go on persist. i've seen other odd behavior -- while testing yesterday using iphone 6.0 simulator, live memory left behind after games #2 , #3, not games #1, #4, , #5. while memory remains allocated, times @ occurs seem vary across device , different versions of simulator.

and questions:

is understanding right shouldn't seeing live memory phone call initwithplayer after game ends , activeplayer object has been freed? if yes, what's causing it, , how deallocate it? or not need worry @ all?

notes:

these screenshots come running app on iphone 4 running ios 6.1. see similar behavior running iphone simulator 5.1, 6.0, , 6.1, , saw on iphone running ios 6.0 before upgraded. in activeplayer.m, dealloc method commented out, though i've tested while it's been uncommented , have verified it's beingness called (by system; don't straight phone call dealloc anywhere). either way, behavior same. for it's worth, nil reported leaks profiling tool. while 1 illustration results in 192 bytes of live memory believe should freed, i'm seeing many of classes, i.e. appears memory allocation grows on time, think problem.

your code listed fine. looks you're still maintaining reference original activeplayer, somewhere else in code.

as side note, pattern creating activeplayer isn't norm - class doesn't phone call alloc within init method. instead, caller should perform:

[[activeplayer alloc] initwithname:@"bob"];

and init method should work homecoming value of

[super init];

ios memory-management automatic-ref-counting

append - JQuery. Copy link attribute to a dynamic element within a div -



append - JQuery. Copy link attribute to a dynamic element within a div -

i'm still learnig jquery , i'm stuck trying have each of dynamically generated links same url previous static link within div. code seems apply same url (#1) generated links, when on sec div need #2.

code:

$(document).ready(function() { $('.sorter > div p').append('<a class="rdm">read more</a>'); $('a.rdm').each(function() { var lnk = $('.sorter > div').find('a').attr('href'); $(this).attr('href', '' + lnk); }); });

html:

<div class="sorter"> <div><a href="#1">link a</a><p>some text </p></div><br /><br /> <div><a href="#2">link b</a><p>some text </p></div> </div>

many help!

oh think need one: http://jsfiddle.net/gsgz5/

var lnk = $(this).parent().siblings('a').attr('href'); //<--get href way $(this).attr('href', lnk);

jquery append href attr

SuperCSV Dozer deep-mapping map with enum and subclasses? -



SuperCSV Dozer deep-mapping map with enum and subclasses? -

i'm trying see if possible supercsv , dozer, or if should revert map parsing. have pojo has fellow member field of map. thankfully, during csv parsing, know specific subclass of myinterface should built, , value of myenum static. how set in column mappings? thanks!

currently, cell processors have structure, , using csvmapreader.

private static final cellprocessor[] cell_processors = new cellprocessor[] { new notnull(new trim(new strregex("^\\d{10,}$"))), // phone1 new optional(new trim(new strregex("^\\d{10,}$"))), // phone2 new optional(new trim(new strregex("^\\d{10,}$"))), // phone3 new optional(new trim()), // callvar1 new optional(new trim()), // callvar2 new optional(new trim()), // callvar3 new optional(new trim()), // callvar4 new optional(new trim()), // callvar5 new optional(new trim()), // callvar6 new optional(new trim()), // callvar7 new optional(new trim()), // callvar8 new optional(new trim()), // callvar9 new optional(new trim()), // callvar10 }; private contact maprowtocontact(map<string, object> row) { contact contact = new contact(); myphonecontactmethoddata methoddata = new myphonecontactmethoddata(); list<phone> phones = new arraylist<>(); phone phone = new phone(); phone.setphonenumber((string)row.get("phone1")); phones.add(phone); phone = new phone(); phone.setphonenumber((string)row.get("phone2")); if (phone.getphonenumber() != null) { phones.add(phone); } phone = new phone(); phone.setphonenumber((string)row.get("phone3")); if (phone.getphonenumber() != null) { phones.add(phone); } methoddata.setphones(phones); list<string> callvars = new arraylist<>(); callvars.add((string)row.get("callvar1")); callvars.add((string)row.get("callvar2")); callvars.add((string)row.get("callvar3")); callvars.add((string)row.get("callvar4")); callvars.add((string)row.get("callvar5")); callvars.add((string)row.get("callvar6")); callvars.add((string)row.get("callvar7")); callvars.add((string)row.get("callvar8")); callvars.add((string)row.get("callvar9")); callvars.add((string)row.get("callvar10")); methoddata.setenterprisecallvardata(callvars); map<contactmethod, contactmethoddata> methoddatamap = new hashmap<>(); methoddatamap.put(contactmethod.phone, methoddata); contact.setcontactmethoddata(methoddatamap); homecoming contact; }

a contact has structure, many other unrelated fields:

public class contact { private integer id; private map<contactmethod, contactmethoddata> contactmethoddata; }

contactmethod enum, values phone , email. contactmethoddata interface, of superclass of myphonecontactmethoddata implements.

thanks code - much easier understand :)

you should able read each row of csv myphonecontactmethoddata instance using next bean mapping. create sure phone call configurebeanmapping() before reading (as shown on super csv website).

you have manually create contact , add together myphonecontactmethoddata contactmethoddata map, using contactmethod.phone key (as done in lastly 3 lines of code).

final string[] beanmapping = new string[]{ "phones[0].phonenumber", "phones[1].phonenumber", "phones[2].phonenumber", "enterprisecallvardata[0]", "enterprisecallvardata[1]", "enterprisecallvardata[2]", "enterprisecallvardata[3]", "enterprisecallvardata[4]", "enterprisecallvardata[5]", "enterprisecallvardata[6]", "enterprisecallvardata[7]", "enterprisecallvardata[8]", "enterprisecallvardata[9]" }; beanreader.configurebeanmapping(myphonecontactmethoddata.class, beanmapping); myphonecontactmethoddata methoddata; while( (methoddata = beanreader.read(myphonecontactmethoddata.class, cell_processors)) != null ) { // add together contact }

map enums subclass supercsv

android - app crashing while implementing lateral navigation -



android - app crashing while implementing lateral navigation -

i created new activity navigation type "tabs + swipe". made these changes in getitem() method :

@override public fragment getitem(int i) { fragment fragment ; switch(i){ case 0: fragment = new fragment1(); break; case 1: fragment = new fragment2(); break; case 3: fragment = new fragment3(); break; // default : homecoming null; } //set args if necessary //return fragment homecoming fragment; }

so each tab i've defined separate class. 1 of class :

public static class fragment1 extends fragment { /** * fragment argument representing section number * fragment. */ public fragment1() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // create new textview , set text fragment's section // number argument value. view v = inflater.inflate(r.layout.center, null); homecoming v; } }

when run app new activity starts when swipe screen sec tab app crashes... logcat :

02-16 08:48:43.328: e/androidruntime(21541): fatal exception: main 02-16 08:48:43.328: e/androidruntime(21541): java.lang.nullpointerexception 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.app.backstackrecord.doaddop(backstackrecord.java:394) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.app.backstackrecord.add(backstackrecord.java:389) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.app.fragmentpageradapter.instantiateitem(fragmentpageradapter.java:99) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.view.viewpager.addnewitem(viewpager.java:801) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.view.viewpager.populate(viewpager.java:992) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.view.viewpager.populate(viewpager.java:881) 02-16 08:48:43.328: e/androidruntime(21541): @ android.support.v4.view.viewpager$3.run(viewpager.java:237) 02-16 08:48:43.328: e/androidruntime(21541): @ android.os.handler.handlecallback(handler.java:605) 02-16 08:48:43.328: e/androidruntime(21541): @ android.os.handler.dispatchmessage(handler.java:92) 02-16 08:48:43.328: e/androidruntime(21541): @ android.os.looper.loop(looper.java:137) 02-16 08:48:43.328: e/androidruntime(21541): @ android.app.activitythread.main(activitythread.java:4575) 02-16 08:48:43.328: e/androidruntime(21541): @ java.lang.reflect.method.invokenative(native method) 02-16 08:48:43.328: e/androidruntime(21541): @ java.lang.reflect.method.invoke(method.java:511) 02-16 08:48:43.328: e/androidruntime(21541): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:789) 02-16 08:48:43.328: e/androidruntime(21541): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:556) 02-16 08:48:43.328: e/androidruntime(21541): @ dalvik.system.nativestart.main(native method)

please solve problem.

most likely, default statement returning null , tries add together null fragment.. , fails... know missing case 2 switch statement.. on purpose? if you, set break

switch(i){

and check value of i... , see if either, 0, 1 or 3... otherwise app crash becuz returning null.

android navigation

python - How to get available flags out of an ArgumentParser object? -



python - How to get available flags out of an ArgumentParser object? -

i'm using argparse module python project. i'm looking available flags out of argumentparser object before calling parse_args(). have ideas?

got source code of add_argument():

>>> import argparse >>> parser = argparse.argumentparser() >>> parser.add_argument('-v', '--verbosity', help='more debug info', action='store_true') _storetrueaction(option_strings=['-v', '--verbosity'], dest='verbosity', nargs=0, const=true, default=false, type=none, choices=none, help='more debug info', metavar=none) >>> parser._option_string_actions.keys() ['-v', '-h', '--verbosity', '--help'] >>>

python command-line-arguments argparse

qt - ui is protected, but how to use it in the reimplemented Qthread run() function -



qt - ui is protected, but how to use it in the reimplemented Qthread run() function -

i want reemplement run function creating own class of qthread.

i've created this,

class mythread : public qthread { public: void run(); }; void mythread::run() { gui w; w.listen_device(w.ui->combobox->currentindex()); exec(); }

i can't utilize qpaint outside main thread i'm giving value argument listen_device function.

i know ui gui protected, how can value?

thanks.

create public method in gui class homecoming ui->combobox->currentindex();

public: int gui::getcurrentindex() // or whatever { homecoming ui->combobox->currentindex(); }

and don't subclass qthread, utilize movetothread() on qobject instead.

qt user-interface qthread

operating system - Does select() use kernel timer( in jiffies ) or high res timer -



operating system - Does select() use kernel timer( in jiffies ) or high res timer -

i have application in have sleep short time (in order of few micro seconds ). fortunately linux kernel 2.8.* supports high res timers.

i have 2 options sleep

nanosleep select() timeout.

i take utilize select() quite portable. select() utilize normal kernel timers ( jiffies) or uses hi res timers ?

can provide sleep functionality in order of microseconds ?

linux-kernel operating-system sleep linux-device-driver

c - How to use multiple pthreads to evaluate expression from a program -



c - How to use multiple pthreads to evaluate expression from a program -

i want utilize pthread solve look breaking downwards threads.

my questions is:- if look (a+b)+(c+d)+(e+f) evaluated using pthreads such that:-

create 3 threads first look (a+b) evaluated 1st thread, (c+d) evaluated sec thread , (e+f) evaluated 3rd thread. value of above variables '1', so, final reply of look evaluation should come '6'. the 3rd thread should executed @ lastly print final output '6'.

then how this??

when parse expression, you'll abstract syntax tree following:

+ / \ + + / \ / \ + + e f / \ |\ b c d

you can partition problem threads @ nodes of syntax tree. when evaluating node, can give 2 different subproblems (left , right subtree) 2 different threads. each of subthreads can repeat pattern until have parallelized tree sufficiently. in code, might like:

int evaluate_subtree_threaded(node_t* parent_node) { int left_result, right_result; pthread_t thread; pthread_create(&thread, null, evaluate_subtree_threaded, parent_node->left); right_result = evaluate_subtree(parent_node->right); pthread_join(thread, &left_result); homecoming left_result + right_result; }

note how code snippet blatantly assumes actual evaluation logic in evaluate_subtree , ignores types.

of course, aware thread creation much more expensive evaluating expression.

c linux pthreads

Are there any major advantages to using printf() over cout in C++? -



Are there any major advantages to using printf() over cout in C++? -

this question has reply here:

printf vs cout in c++ 15 answers

there situations where, in c++ scanf() preferable cin, wondering if there situations printf() more practical cout.

what can using ostream interface (so cout) far superior old style printf(). first of all, type safe, won't segmentation violation when mistakenly utilize wrong formatting sequence.

an example. imagine have print out attributes of struct stat returned posix fstat function. types of attributes defined using scheme dependant typedefs:

struct stat { dev_t st_dev; /* id of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user id of owner */ gid_t st_gid; /* grouping id of owner */ dev_t st_rdev; /* device id (if special file) */ off_t st_size; /* total size, in bytes */ /* ... more attributes */

};

so things dev_t different types (typedefs) on different systems. may find on particular scheme dev_t equivalent to, say, int, , write this:

printf("dev_t=%d", s.st_dev);

and work on system, when compile on system, defines, example, dev_t not int but, say, long, code compile, crash in runtime.

if utilize c++ streams , overloaded << operator stuff work correctly:

cout << "dev_t=" << s.st_dev;

another of import advantage of c++ streams extensibility. not possible extend set of formatting sequences printf understands. in contrast, can overload << operator conveniently print objects of own types.

c++ printf scanf cout cin

asp.net - sorting list of custom classes using linq -



asp.net - sorting list of custom classes using linq -

i have custom class

class item public item string public descrip string public cost string public bin string public total decimal public qty integer end class

now have class

public class default3 inherits system.web.ui.page dim c int16 = 0 dim item3 new item dim item2 new list(of item)

now adding items in item2 of type item

item3.item = string.format(record(0)) ' field "item" item3.descrip = string.format(record(1)) ' field "descrip" item3.price = string.format(record(2)) ' field "price" item3.bin = string.format(record(3)) ' field "bin" item2.add(item3)

now how can sort elements in item2 according item3.bin? thanks

use orderby

item2 = item2.orderby(function(x) x.bin).tolist()

or can utilize sort

item2.sort(function(x, y) x.bin.compareto(y.bin))

asp.net .net vb.net linq

svg - XSLT sort issue - attribute wont sort -



svg - XSLT sort issue - attribute wont sort -

source

<roll> <dayquantum date="20130125"> <item index="2" value="4" product="margherita"/> <item index="3" value="2" product="capricciosa"/> <item index="4" value="2" product="quattro stagioni"/> <item index="5" value="7" product="bresola"/> <item index="6" value="1" product="gorgonzola"/> <item index="7" value="7" product="piccante"/> <item index="8" value="3" product="rosmarino"/> <item index="9" value="2" product="caprese"/> <item index="10" value="7" product="parma"/> <item index="11" value="1" product="parmigiana"/> <item index="12" value="2" product="pollo"/> <item index="13" value="2" product="hawaii"/> <item index="14" value="17" product="pepperoni"/> <item index="15" value="4" product="calzone"/> <item index="16" value="2" product="bologna"/> <item index="17" value="3" product="tonno"/> <item index="18" value="1" product="marinara"/> <item index="19" value="2" product="napoletana"/> <item index="20" value="1" product="carne"/> <item index="21" value="1" product="mascarpone"/> <item index="22" value="4" product="carpaccio"/> <item index="25" value="1" product="tartufo"/> <item index="26" value="8" product="prosciutto"/> <item index="27" value="3" product="lasagna originale"/> <item index="28" value="1" product="tortellini gorgonzola"/> <item index="29" value="1" product="tortellini tartufo"/> <item index="31" value="4" product="tagliatelle dolce vita"/> <item index="33" value="1" product="spaghetti carbonara"/> <item index="37" value="2" product="antipasta toto e pepino"/> <item index="38" value="1" product="vitello tonnato"/> <item index="41" value="4" product="bruschetta classica"/> <item index="44" value="1" product="tiramisu"/> <item index="47" value="4" product="panino al pollo"/> <item index="48" value="5" product="panino al prosciutto"/> <item index="49" value="8" product="panino al vitello tonnato"/> </dayquantum> </roll>

xslt

<svg viewbox="0 0 2400 1400" style="background: #000 ; font-family: 'racing sans one'" id="zcanvas" version="1.1" xsl:version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="http://www.w3.org/2000/svg"> <defs><link xmlns="http://www.w3.org/1999/xhtml" href="http://fonts.googleapis.com/css?family=racing+sans+one|six+caps" type="text/css" rel="stylesheet" /></defs> <xsl:for-each select="roll/dayquantum"> <xsl:sort select="@date" order="descending" data-type="number"/> <xsl:variable name="y" select="(position() * 180) - 100" /> <text fill="#fff" font-size="48"> <xsl:attribute name="x"><xsl:value-of select="80" /></xsl:attribute> <xsl:attribute name="y"><xsl:value-of select="$y - 40" /></xsl:attribute> <xsl:attribute name="transform">rotate(90, 80, <xsl:value-of select="$y - 40 " />)</xsl:attribute> <xsl:value-of select="substring(@date,7,2)" /><xsl:value-of select="substring(' janfebmaraprmayjunjulaugsepoctnovdec', number(substring(@date,5,2)) * 3, 3)" /> </text> <text fill="#ff6000" font-size="48"> <xsl:attribute name="x"><xsl:value-of select="120" /></xsl:attribute> <xsl:attribute name="y"><xsl:value-of select="$y - 10" /></xsl:attribute> <xsl:value-of select="sum(item/@value)" /> </text> <xsl:for-each select="item"> <xsl:sort select="@value" order="descending" data-type="number"/> <rect fill="green" > <xsl:attribute name="x"><xsl:value-of select="200 + (sum(preceding-sibling::item/@value) * 16)" /></xsl:attribute> <xsl:attribute name="y"><xsl:value-of select="$y - 48" /></xsl:attribute> <xsl:attribute name="width"><xsl:value-of select="@value * 16" /></xsl:attribute> <xsl:attribute name="rx">10</xsl:attribute> <xsl:attribute name="height">48</xsl:attribute> </rect> <g font-family="sans-serif"> <text fill="#fff" font-size="20" text-anchor="middle"> <xsl:attribute name="x"><xsl:value-of select="200 + (sum(preceding-sibling::item/@value) * 16) + ((@value * 16) div 2)" /></xsl:attribute> <xsl:attribute name="y"><xsl:value-of select="$y - 20" /></xsl:attribute> <xsl:value-of select="@value" /> </text> <text fill="#888" font-size="18" text-anchor="start"> <xsl:attribute name="x"><xsl:value-of select="200 + (sum(preceding-sibling::item/@value) * 16) + ((@value * 16) div 2)" /></xsl:attribute> <xsl:attribute name="y"><xsl:value-of select="$y" /></xsl:attribute> <xsl:attribute name="transform">rotate(90, <xsl:value-of select="200 + (sum(preceding-sibling::item/@value) * 16) + ((@value * 16) div 2)" />, <xsl:value-of select="$y" />)</xsl:attribute> <xsl:value-of select="@product" /> </text> </g> </xsl:for-each> </xsl:for-each> </svg>

problem:

it won't sort on attribute "value" descending - because of preceeding statement ?

source can found here: http://xmlsoap.dk/xml/crcountlog.xml

the reason it's not working way expect preceding-sibling:: looks @ items' preceding siblings in document order, not current sort order. beingness sorted, x values beingness computed though had not sorted them @ all.

the next recursive approach should accomplish trying do:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns="http://www.w3.org/2000/svg"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:template match="/"> <svg viewbox="0 0 2400 1400" style="background: #000 ; font-family: 'racing sans one'" id="zcanvas" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <link xmlns="http://www.w3.org/1999/xhtml" href="http://fonts.googleapis.com/css?family=racing+sans+one|six+caps" type="text/css" rel="stylesheet" /> </defs> <xsl:apply-templates select="roll/dayquantum"> <xsl:sort select="@date" order="descending" data-type="number"/> </xsl:apply-templates> </svg> </xsl:template> <xsl:template match="dayquantum"> <xsl:variable name="y" select="(position() * 180) - 100" /> <text fill="#fff" font-size="48" x="80" y="{$y - 40}" transform="rotate(90, 80, {$y - 40})"> <xsl:value-of select="substring(@date,7,2)" /> <xsl:value-of select="substring(' janfebmaraprmayjunjulaugsepoctnovdec', number(substring(@date,5,2)) * 3, 3)" /> </text> <text fill="#ff6000" font-size="48" x="120" y="{$y - 10}"> <xsl:value-of select="sum(item/@value)" /> </text> <xsl:variable name="topitem" select="item[not(../item/@value > @value)][1]" /> <xsl:apply-templates select="$topitem"> <xsl:with-param name="y" select="$y" /> <xsl:with-param name="remainingitems" select="item[generate-id() != generate-id($topitem)]" /> </xsl:apply-templates> </xsl:template> <xsl:template match="item"> <xsl:param name="y" /> <xsl:param name="previousitems" select="/.." /> <xsl:param name="remainingitems" /> <xsl:variable name="leadingspace" select="200 + sum($previousitems/@value) * 16" /> <xsl:variable name="width" select="@value * 16" /> <xsl:variable name="hcenter" select="$leadingspace + $width div 2" /> <rect fill="green" x="{$leadingspace}" y="{$y - 48}" width="{$width}" rx="10" height="48" /> <g font-family="sans-serif"> <text fill="#fff" font-size="20" text-anchor="middle" x="{$hcenter}" y="{$y - 20}"> <xsl:value-of select="@value" /> </text> <text fill="#888" font-size="18" text-anchor="start" x="{$hcenter}" y="{$y}" transform="rotate(90, {$hcenter}, {$y})"> <xsl:value-of select="@product" /> </text> </g> <xsl:variable name="topitem" select="$remainingitems[not($remainingitems/@value > @value)][1]" /> <xsl:apply-templates select="$topitem"> <xsl:with-param name="y" select="$y" /> <xsl:with-param name="previousitems" select="$previousitems | ." /> <xsl:with-param name="remainingitems" select="$remainingitems[generate-id() != generate-id($topitem)]" /> </xsl:apply-templates> </xsl:template> </xsl:stylesheet>

this approach selects first item no items less itself, , applies templates that, passing remaining items parameters. next top item selected , template recursively calls itself, repeatedly until of items have been used up.

xslt svg

How to read a XML file which is converted from PDF file in php? -



How to read a XML file which is converted from PDF file in php? -

am doing php code read xml file generated pdf file... couldn't able nodes, here code have used...

$xml = simplexml_load_file("sample.xml"); echo $xml->getname(); echo $xml->children();

i dint value $xml->children(), missing here...

php

android - Errors symbol is shown when importing CW Endless Adapter project -



android - Errors symbol is shown when importing CW Endless Adapter project -

i have downloaded zip file implement cw-endless adapter customlistview link. when extracted , imported eclipse, ! shown in reddish color shown in below picture. can please help me resolve this?

when rightclick on project --> java buildpath --> libraries --> when mouse hover on first reddish cross symbol shows projected 1 shown in below figure.

android cwac-endless

Local variable in each class - python timed loop -



Local variable in each class - python timed loop -

i have python file in continuous loop reading external file, have lot of different info points i'm reading , have class (fb) i'm calling feed locations of each point (m1.x, m2.x etc....) file loops every 30 seconds.

i need variable in loop not reset each instance i'm using. if define within loop it's reset , if utilize global variable can't utilize multiple variables.

so in illustration below 'test' counts 1 instance global variable , self.x reset after each loop. neither of need. attempting utilize threading causes more problems modules i'm using. if has ideas on how create local variable not reset within class looping great. thanks.

test = 0 s = sched.scheduler(time.time, time.sleep) def loop1(sc): class fb: def link(self): global test test = test + 1 print test self.x = self.x + 1 print self.x m1 = fb() m1.x = 1 m1.link() m2 =fb() m2.x = 0 m2.link() # update loop every 10 sec sc.enter(10, 10, loop1, (sc,)) # end loop s.enter(1, 1, loop1, (s,)) s.run()

i think want object y counts turns of loop, not number of instances created in each turn (= self.x), nor cumulative number of instances created since start of programme (= test)

i've got next programme obtain object y increments 1 @ each turn of loop. needs creates exclusively new class @ origin of turn. instruction

fb = type('fb',(object,),{'__init__':initer, 'link':linker, 'classies':0})

does creation of new class. evidenced display of classes created: print 'id(fb) == %d' % id(fb) identity of object place lies in memory. if not same id, not same object:

import sched,time test = 0 s = sched.scheduler(time.time, time.sleep) y = 2000 def initer(self): global test,y if self.__class__.classies == 0: y += 1 self.__class__.classies += 1 def linker(self): global test,y test = test + 1 self.x = self.x + 1 print 'y == %d' % y print 'test == %d self.x == %d' % (test,self.x) def loop1(sc): fb = type('fb',(object,),{'__init__':initer, 'link':linker, 'classies':0}) print '--------' print 'id(fb) == %d' % id(fb) m1 = fb() m1.x = 0 m1.link() print m2 =fb() m2.x = 1 m2.link() print m3 =fb() m3.x = 2 m3.link() print '--------' # update loop every 10 sec sc.enter(10, 10, loop1, (sc,)) # end loop s.enter(1, 1, loop1, (s,)) s.run()

displays

-------- id(fb) == 18976648 y == 2001 test == 1 self.x == 1 y == 2001 test == 2 self.x == 2 y == 2001 test == 3 self.x == 3 -------- -------- id(fb) == 13818640 y == 2002 test == 4 self.x == 1 y == 2002 test == 5 self.x == 2 y == 2002 test == 6 self.x == 3 -------- -------- id(fb) == 18970384 y == 2003 test == 7 self.x == 1 y == 2003 test == 8 self.x == 2 y == 2003 test == 9 self.x == 3 -------- -------- id(fb) == 18970864 y == 2004 test == 10 self.x == 1 y == 2004 test == 11 self.x == 2 y == 2004 test == 12 self.x == 3 -------- -------- id(fb) == 18971736 y == 2005 test == 13 self.x == 1 y == 2005 test == 14 self.x == 2 y == 2005 test == 15 self.x == 3 -------- -------- id(fb) == 18957224 y == 2006 test == 16 self.x == 1 y == 2006 test == 17 self.x == 2 y == 2006 test == 18 self.x == 3 -------- . . . etc

i obtain result above way. deleting fb @ end of each turn isn't sufficient, see if create next code run. code few more instructions, have y , display of id(fb). you'll see `` anid(fb)`` remains same 1 turn other.

import sched,time test = 0 s = sched.scheduler(time.time, time.sleep) y = 2000 def loop1(sc): class fb: def link(self): global test,y test = test + 1 self.x = self.x + 1 print 'y == %d' % y print 'test == %d self.x == %d' % (test,self.x) print 'id(fb) == %d' % id(fb) print '--------' m1 = fb() m1.x = 0 m1.link() print m2 =fb() m2.x = 1 m2.link() print m3 =fb() m3.x = 0 m3.link() print '--------' del fb # update loop every 10 sec sc.enter(10, 10, loop1, (sc,)) # end loop s.enter(1, 1, loop1, (s,)) s.run()

the reason why code doesn't work like, far have understand want, portion of script defines class called "definition of class" (incredible, isn't ?) , when interpretr passes on class block first time, executes it. execution of "definition of class" creates object class. class created, "definition" not re-executed if interpreter passes 1 time again on class' code block (= class definition). here 1 time again , there ambiguous word: 'definition' can understood 'the text block in script defines class' or 'the process of executing instructions define creation of class , lead object beingness class' sense used "definition of class" 1 used in doc:

class definitions, function definitions (def statements) must executed before have effect. (you conceivably place class definition in branch of if statement, or within function.)

http://docs.python.org/2/tutorial/classes.html#class-definition-syntax

so, finally, want in code, "definition of class fb" executed 1 time, it's same class modeling classes , turn after turn of loop.

python

ios - Add a new viewcontroller to a tab controller -



ios - Add a new viewcontroller to a tab controller -

i have tab bar controller created mainwindow.xib. have 4 view controllers in it. want add together 5th item programatically (because dont know class have utilize until compile time)

this code:

uiviewcontroller * login = [[loginuserviewcontroller alloc] initwithnibname:@"loginuserviewcontroller" bundle:nil]; nsmutablearray * viewcontrollersarray = [nsmutablearray arraywitharray:self.tabbarcontroller.viewcontrollers]; [viewcontrollersarray addobject:login]; [self.tabbarcontroller setviewcontrollers:viewcontrollersarray animated:yes];

but

[loginuserviewcontroller viewcontrollers]: unrecognized selector sent instance 0x95791b0'

when reach code

uinavigationcontroller *navcontroller = [tabbarcontroller.viewcontrollers lastobject]; loginviewcontroller * log = [navcontroller.viewcontrollers objectatindex:0];

where going wrong? ideas?

thanks lot

try this....

- (void) setuptabbar { firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc]init]; firstviewcontroller.title = @"first view"; firstviewcontroller.tabbaritem = [[uitabbaritem alloc]initwithtabbarsystemitem:uitabbarsystemitemsearch tag:0]; uinavigationcontroller *firstnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:firstviewcontroller]; secondviewcontroller *secondviewcontroller = [[secondviewcontroller alloc]init]; secondviewcontroller.title = @"second view"; secondviewcontroller.tabbaritem = [[uitabbaritem alloc]initwithtabbarsystemitem:uitabbarsystemitemfavorites tag:1]; uinavigationcontroller *secondnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:secondviewcontroller]; thirdviewcontroller *thirdviewcontroller = [[thirdviewcontroller alloc]init]; thirdviewcontroller.title = @"third view"; thirdviewcontroller.tabbaritem = [[uitabbaritem alloc]initwithtabbarsystemitem:uitabbarsystemitemrecents tag:2]; uinavigationcontroller *thirdnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:thirdviewcontroller]; forthviewcontroller *forthviewcontroller = [[forthviewcontroller alloc]init]; forthviewcontroller.title = @"forth view"; forthviewcontroller.tabbaritem = [[uitabbaritem alloc]initwithtabbarsystemitem:uitabbarsystemitemhistory tag:2]; uinavigationcontroller *forthnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:forthviewcontroller]; tabbarcontroller = [[uitabbarcontroller alloc] initwithnibname:nil bundle:nil]; tabbarcontroller.viewcontrollers = [[nsarray alloc] initwithobjects:firstnavcontroller, secondnavcontroller, thirdnavcontroller, forthnavcontroller, nil]; tabbarcontroller.delegate = self; [self sizeviewtoavailablewindow:[tabbarcontroller view]]; [firstnavcontroller release]; [firstviewcontroller release]; [secondnavcontroller release]; [secondviewcontroller release]; [thirdnavcontroller release]; [thirdviewcontroller release]; [forthnavcontroller release]; [forthviewcontroller release]; }

ios cocoa-touch uiviewcontroller uinavigationcontroller uitabbarcontroller

how to verify object using xpath if object is invisible in selenium webdriver java -



how to verify object using xpath if object is invisible in selenium webdriver java -

how can verify invisible objects gets enabled on wrong info entry (label before textbox eg: login scenario) using xpath in selenium webdriver.

if labels display error message (e.g. username label , password label),i able verify , capture text (error messages). xpath username: .//[@id='loginform']/p[1]/p/label xpath password: .//[@id='loginform']/p[2]/p/label

but if come in right username,webdriver go on searching xpath username(.//*[@id='loginform']/p[1]/p/label) , not respond.

html visible if error appears: label class="error" generated="true" for="username" label class="error" generated="true" for="passwordfield

can help me this?

use webdriverwait:

webdriverwait waiting = new webdriverwait(driver, 15, 100); waiting.until(expectedconditions.invisibilityofelementlocated(by.xpath("//*[@id='loginform']/p[1]/p/label")));

the above create web driver wait object wait 15 sec (checking status every 100ms) element become invisible. pass straight away if element invisible when line of code triggered.

edit based upon comments below

if trying find out if element exists of not can do:

list<webelement> labelcount = driver.findelements(by.xpath("//*[@id='loginform']/p[1]/p/label"));

if size 0 label isn't there, else there, like:

if(labelcount.size() == 0){ //get tab text } else { //enter sec field info }

java selenium-webdriver

asp.net - writing a library class properly -



asp.net - writing a library class properly -

this first library class writing , sense need load on topic cannot find best sources. have web forms project uploads pdf , creates qrcode , places in document. need create library don't know start or exact structure. every method it's own subclass in library class? or can have them in 1 , professional way of going this.

this party of web forms application need create library for:

void updatestudentsubmissiongrid() { var usr = studentliststep2.selecteditem user; var lib = assignmentliststep2.selecteditem library; if (usr == null || lib == null) return; using (var dc = new docmgmtdatacontext()) { var subs = (from doc in dc.documents doc.ownedbyuserid == usr.id && doc.libraryid == lib.id select new {docid = doc.id, assignment = doc.library.name, submitted = doc.uploaddt}) .orderbydescending(c => c.submitted) .tolist(); studentsubmissiongrid.datasource = subs; } }

how start method?

by looks of things using function single webpage. can phone call function event i.e. user hits submit button. on the. click button , create onclick event. phone call code within there updatestudentsubmissiongrid(); create sure function not nested within event or function. webforms class, placing function within class.

asp.net dll webforms

c# - How to repair an excel file? -



c# - How to repair an excel file? -

i have excel file contains 4 worksheets. outer scheme sends excel files daily , programme reads stores info db. have 3 files may have been corrupted when programme tries read files gives error "external table not in expected format." when seek open files in office interface returns me excel found ureadable content in file.xlsx want recover contents of workbook? etc...

when start programme after repaired file office excel , save again, works. need repair files before programme starts read. there way repair excel files office does?

i using microsoft.ace.oledb.12.0;

you can utilize excel interop open file , repair excel does. can't utilize programme on machine without ms office. may seek 3rd party libraries like:

http://closedxml.codeplex.com/ http://code.google.com/p/excellibrary/ http://simpleooxml.codeplex.com/

the code excel interop follows:

missing missing = missing.value; application excel = new application(); workbook workbook = excel.workbooks.open(sourcefilepath, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, xlcorruptload.xlrepairfile); workbook.saveas(savedfile, xlfileformat.xlworkbookdefault, missing, missing, missing, missing, xlsaveasaccessmode.xlexclusive, missing, missing, missing, missing, missing); workbook.close(true, missing, missing);

c# excel

configuration - Purpose of roles tags in tomcat-users.xml? -



configuration - Purpose of roles tags in tomcat-users.xml? -

in tomcat 7 tomcat-users.xml file, purpose served <role /> tags?

for xampp instance of tomcat 7, i've figured out how configure tomcat-users.xml file permit me access both tomcat web application manager , tomcat virtual host manager. more specifically, next enables aforementioned access:

<tomcat-users> <user username="uname" password="pword" roles="manager-gui,admin-gui"/> </tomcat-users>

note what's not in successful snippet of xml <role /> tags. that's crux of question: can't life of me figure out purpose role tags meant serve.

in pursuit of learning how configure access, i've read plenty of documentation , forum postings, seem go in circle: 1 can define roles, roles don't seem define useful(?)

for example, here's recurring illustration used in both tomcat-users.xml file , in numerous forum posts "explaining" utilize of roles.

<tomcat-users> <role rolename="tomcat"/> <user username="uname" password="pword" roles="tomcat"/> </tomcat-users>

okay, in "explanation" role element defines rolename attribute equal tomcat, user element contains roles attribute defines user's role tomcat. what's point?

asked way, given in role element rolename attrbute defines tomcat, roles=tomcat what, exactly? compared working user definition of manager-gui , admin-gui define roles enable tomcat web application manager , tomcat virtual host manager access.

cheers & thanks, riley sfo

the utilize of <role .../> element in tomcat-users.xml optional. tomcat builds list of roles <role .../> elements , roles named in roles="..." attribute of users.

the benefit of using <role .../> element can declare finish set of supported roles , can include description attribute describing role.

as aside, tomcat-users.xml supports groups although not shown in illustration ships default tomcat. groups sets of roles can assigned users.

tomcat configuration tomcat7

sql - Entity framework and migrations - how to update my database on remote server? -



sql - Entity framework and migrations - how to update my database on remote server? -

i enabled migrations entity framework application. now, want update database on remote server. ran command:

pm> update-database -script

so generated sql script. but, script has metadata have in database, , not changes made; so, when seek run sql script on remote server, says tables exists.

how can generate sql script, contain necessary updates?

you can target specific migration this. if have migration called foo, example:

update-database -targetmigration foo -script

it generate migration script foo migration. replace foo whatever migration need run on server.

add-migration initialmigration add-migration addcustomers add-migration addprojects

let's have above 3 migrations in project, , local database has of them applied, remote database has initialmigration. can run following:

update-database -sourcemigration initialmigration -targetmigration addprojects -script

this apply 2 migrations on remote server (addcustomers , addprojects).

sql asp.net-mvc entity-framework entity-framework-4 migration

php - Why do I get "Null" in MySQL database? Flash pro cs6 -



php - Why do I get "Null" in MySQL database? Flash pro cs6 -

i'm trying update flash film quiz records names , question answers - did not write original application. quiz works, except replaces name null when recording data. other records work fine. have deleted out res2 - res12 shorten up, work well.

im using flash pro cs6 the code in as3

thanks in advance lite can shed on this.

from name input page of quiz. participname text field input:

stop(); btn1.addeventlistener(mouseevent.mouse_up,function():void { var name:string=participname.text.tostring(); gotoandplay(3); });

from lastly page of quiz

senddata(); function senddata(){ var messages:urlrequest = new urlrequest("./insertresult.php") messages.method = urlrequestmethod.post

var posts:urlvariables = new urlvariables() posts.name = name posts.datecurrent = dtformatted posts.res01 = res01 messages.data = posts trace(posts); var loader:urlloader = new urlloader() loader.dataformat = urlloaderdataformat.text // loader.addeventlistener(event.complete, dataonload) loader.load(messages) trace(messages);

from insertresult.php:

<?php //capture info $_post array $name = $_post['name']; $date = $_post['datecurrent']; $res1 = $_post['res01']; /* if(!$name ) { echo "no input using default values <br>"; $name = 'deleteme'; }*/ $connect = mysql_connect("mydatabase"); mysql_select_db ("palogindatabase", $connect); $result = mysql_query("insert rhymeoddity1 (name,date,res1) values ('$name','$date','$res1')"); if($result) echo "writing=ok&"; else echo "writing=error"; ?>

can check actionscript reading , setting name before posting data?

php flash flash-cs6

run node.js on AppFog? -



run node.js on AppFog? -

i uploaded files appfog , went site created. seems site loads index.html.

my node.js file named server.js, maybe should name else? help?

have tried next appfog official documentation getting node , running?

node.js appfog

c# - .NET interface/constraint for object that implements certain operators -



c# - .NET interface/constraint for object that implements certain operators -

i making generic method , wondering if there way of adding constraint generic type t, such t has operator, +, +=, -, -=, etc.

public void testadd<t>(t t1, t t2) { homecoming t1 + t2; }

produces next error text:

operator '+' cannot applied operands of type 't' , 't'

i searched around on google/so while , couldn't find related.

i think cannot done

you can less fancy :

interface iaddable { void add(object item); } ... public void testadd<t>(t t1, t t2) t : iaddable { homecoming t1.add(t2); }

c# .net generics operators operator-overloading

php - Why is PJAX stopping Nestable working? -



php - Why is PJAX stopping Nestable working? -

i have 3 columns in app. each column has unordered list. using nestable drag , drop list items between lists. mark follows:

<div class="row-fluid span12"> <div class="cf nestable-lists"> <div id="pjax-content"> <div class="span4"> <div class="dd" id="nestable1"> <ul class="dd-list"> <li class="dd-item dd3-item" data-id="123"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> <li class="dd-item dd3-item" data-id="456"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> </ul> </div> </div> <div class="span4"> <div class="dd" id="nestable2"> <ul class="dd-list"> <li class="dd-item dd3-item" data-id="789"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> <li class="dd-item dd3-item" data-id="1011"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> </ul> </div> </div> <div class="span4"> <div class="dd" id="nestable3"> <ul class="dd-list"> <li class="dd-item dd3-item" data-id="1213"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> <li class="dd-item dd3-item" data-id="1415"> <div class="dd-handle dd3-handle">drag</div> <div class="dd3-content"> // list content </div> </li> </ul> </div> </div> </div> </div> </div>

this works , can drag , drop list items between each list. problem when implement pjax.

i have few links utilize pjax alter url i.e. each link update info or order of info in each list based on url. info updates within id="pjax-content" accordingly, works. snippet of server side code (using ci):

if (isset($_server["http_x_pjax"])) { echo $data['contents']; } else { // build views when not pjax }

$data['contents'] contains html string.

i have next js libraries (i have tried removing of these , problem still exists):

<script type="text/javascript" src="jquery-1.9.0.js"></script> <script type="text/javascript" src="bootstrap.js"></script> <script type="text/javascript" src="nestable.js"></script> <script type="text/javascript" src="nestable-settings.js"></script> <script type="text/javascript" src="bootstrap-editable.js"></script> <script type="text/javascript" src="jquery.cookie.js"></script> <script type="text/javascript" src='jquery.pjax.js'></script> <script type="text/javascript"> $(document).pjax('[data-pjax] a, a[data-pjax]', '#pjax-content'); $(document).on('pjax:send', function() { console.log("before send"); }); $(document).on('pjax:complete', function() { console.log("done!"); }); </script> the problem

when click on 1 of links pjax works, info updated, page doesn't reload , console shows before send , done - well. however, nestable items no longer selectable can't drag , drop them. when total page refresh works , can drag , drop.

i have compared markup before , after (as previous issue) , same.

any suggestions on going wrong? or how best debug this?

call nestable after ajax finish function

$(document).on('pjax:complete', function() { $('#nestable1,#nestable2,#nestable3').nestable(); });

php javascript jquery pjax