Posts

Showing posts from July, 2013

ios - Merge html files into UIWebView -

i have create uiwebview adding data i'm getting api html file have locally. it's first time have , can't find how this. my html file looks : <h1>%%%title%%%</h1> <p class="date">%%%date%%%</p> <a %%%hrefimage%%% class="link-diapo"> <div class="image"> <img src="%%%img%%%" alt="%%%title%%%"/> %%%diapo%%% </div> </a> <div id="content" style="font-size:%%%size%%%px;"> <p>%%%chapo%%%</p> <p>%%%html%%%</p> <p class="source">%%%author%%%</p> </div> and data : "title": "my title", "date": "2013-07-10", "hour": "19h45", "chapo": "blablabla", &

javascript - create three circles using D3 -

i started learning d3. tutorial website, found following code: <!doctype html> <html> <head> <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> </head> <body> <div id="viz"></div> <script type="text/javascript"> var samplesvg = d3.select("#viz") .append("svg") .attr("width", 100) .attr("height", 100); samplesvg.append("circle") .style("stroke", "gray") .style("fill", "white") .attr("r", 40) .attr("cx", 50) .attr("cy", 50) .on("mouseover", function(){d3.select(this).style("fill", "aliceblue");}) .on("mouseout", function(){d3.select(this).style("fill", "white");}); </script> </body

java - Re-Attaching detached objects in Playframework -

i have process user can create object (let's call a) , manipulate in several steps. user can add reference persisted entity object (let's call persisted entity b). not want persist in database unless last step has been finished, i'm caching after each step. i using playframework java , jpa , b gets detached retrieve database, assign , cache a. after submitting last step, need have transient object b again in order persist it. here exception [persistenceexception: org.hibernate.persistentobjectexception: detached entity passed persist: models.b] what best way archive that? thanks in advance i'm bit puzzled question. entity objects in detached state if ever been managed persistence context (eg: ever been saved / updated / retrieved database) or create new entity object , set primary key field. until entities transient. looking @ requirement why not keep transient (eg: save in http session) until last step , persist ? on side note, if i'm not

javascript - jqm panel stops opening after refresh to the page (edited) -

i using jquery mobile 1.3.1 panels. have 2 panels (one on left, 1 on right) , open panels there buttons , @ same time swipe events. working fine if user doesn't refresh page. if user refreshes page can open panel @ page when clicks link on panel , routes page can't open panels more (swipe or button both of them doesn't work). if refresh page again again starts work 1 time. way using ajax transitions in jqm. couldn't find out why. missing in usage of panels. here html; <div data-role="page"> <div data-role="panel" id="left-panel" class="panel" data-display="push" data-position="left" data-theme="a" class="ui-response"> <div data-role="fieldcontain"> <input type="search" name="password" id="search" value="" placeholder="search"/> </div> <a data-role="button" href="home"

c# - Is there any point in declaring arguments as [In] when PInvoking? -

when using platform invokes, specifying arguments [in] make difference in how runtime approaches these? for instance, when pinvoking createremotethread , lpthreadid specified out per article on msdn: handle winapi createremotethread( _in_ handle hprocess, _in_ lpsecurity_attributes lpthreadattributes, _in_ size_t dwstacksize, _in_ lpthread_start_routine lpstartaddress, _in_ lpvoid lpparameter, _in_ dword dwcreationflags, _out_ lpdword lpthreadid ); and other arguments _in_ . in c# code, handle specific function so: [dllimport("kernel32.dll", entrypoint = "createremotethread", setlasterror = true)] public static extern intptr createremotethread( intptr hprocess, intptr lpthreadattributes, uint dwstacksize, intptr lpstartaddress, intptr lpparameter, uint dwcreationflags, [out] intptr lpthreadid); adding [out] attribute lpthreadid runtime knows marshal caller.

android - IBM Worklight 5.0.6.1 - Not getting Push Notifications when phone/app is closed -

i have worklight hybrid app basic push notification working in android. if app running , in focus when notification pushed, behaves expect. notification callback in app called, , pops simpledialog. all good . if dismiss app clicking on home button, , new message arrives, see notification in android notification area, , when click on item in android notification list, item gets dismissed list (but app not come focus) if launch app apps menu, sitting left , simpledialog showing. (my notification handler called) mostly good , expected app come focus when selected notification in android notification list. if dismiss app clicking on button, , new message arrives, see notification in android notification area, , when click on item in android notification list, item gets dismissed list (but app not come focus) if launch app apps menu, launches app fresh (i have log in again) , notification handler never called. not good . if force stop app, or turn phone off while notificatio

Change edge thickness with tkplot (Igraph, R) -

Image
i wondering if there way change edge thickness when using tkplot() i know can right clicking edge , changing manually, able call attribute use edge. similar when using normal plot function in igraph can edge.width=e(g)$weight also, there way save tkplot png without use of other packages? thanks! yes, can change edge width, works same way plot() . the tk canvas not support png format, cannot save tkplot() output in png. if use tkplot() adjusting coordinates, use tkplot.getcoords() query adjusted coordinates , use plot() these coordinates create png file. library(igraph) g <- graph.ring(10) id <- tkplot(g, edge.width=1:10) ## adjust coordinates hand, , continue. ## e.g. moved vertex 7 middle co <- tkplot.getcoords(id) png("output.png") plot(g, layout=co, edge.width=1:10) dev.off()

java - Change to compiler 1.7 when creating a List produced errors throughout the entire project -

i using eclipse juno , java. i trying create new list: list mylist = new arraylist(); this had error , resolution on along lines of change compiler 1.7 accepted. errror on list creation line corrected have many errors thoughout whole project on lines working. examples are: class getaccountandcubshandler<t> implements asynccallback<list<accountandcubs>> multiple markers @ line - hierarchy of type getaccountandcubshandler inconsistent - list cannot resolved type public class accountcreationview extends composite { multiple markers @ line - hierarchy of type accountcreationview inconsistent - breakpoint:accountcreationview @suppresswarnings("unused") private string accountid; first line - multiple markers @ line - suppresswarnings cannot resolved type - attribute valie undefined annotation type suppresswarnings second line - string cannot resolved type as can imagine having whole project adversely affected in way disconcerting ad

ruby on rails - Serve Static File in Cucumber Test from an HTTP location -

i'm testing json api model carrierwave uploader, i'm allowing uploads via remote_url, need way http address file in public assets, since know those'll around. to put way: when rails server running, have static asset @ "http://localhost:3000/assets/logo.png" . need address of file while cucumber running - aka, need serve static file while running cucumber, different part of rails app can "download" file. edit: these test not run browser, although (as of recently), run session. may using cucumber, have written no code use or start capybara. if i'm understanding question correctly. may want fakeweb or webmock serve back/mock external requests.

bash - Filling in gaps with awk or anything -

i have list such below, 1 column position , other columns aren't important question. 1 1 2 3 4 5 2 1 2 3 4 5 5 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5 i want fill in gaps such list continuous , reads 1 1 2 3 4 5 2 1 2 3 4 5 3 0 0 0 0 0 4 0 0 0 0 0 5 1 2 3 4 5 6 0 0 0 0 0 7 0 0 0 0 0 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5 i familiar awk , shell scripts, whatever way can done fine me. help.. this one-liner may work you: awk '$1>++p{for(;p<$1;p++)print p"  0 0 0 0 0"}1' file with example: kent$ echo '1 1 2 3 4 5 2 1 2 3 4 5 5 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5'|awk '$1>++p{for(;p<$1;p++)print p" 0 0 0 0 0"}1' 1 1 2 3 4 5 2 1 2 3 4 5 3 0 0 0 0 0 4 0 0 0 0 0 5 1 2 3 4 5 6 0 0 0 0 0 7 0 0 0 0 0 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5

c# - AppDomain Execute Assembly -

i trying load assembly (dll) appdomain , call entry point. (essentially bootstrap package azure environment) have been following article ( how create application domain , run application in it? ) , think doing right, i'm having issues. i have used several articles on here me far am, keep running filenotfoundexception described in unable load executing assembly new appdomain, filenotfoundexception . problem solution doesn't work. assembly trying execute exists in different location. applicationbase needs folder of assembly trying execute. var othertype = typeof(bootstrapproxy); var domaininfo = new appdomainsetup { configurationfile = executingassembly + ".config", applicationbase = _root }; evidence adevidence = appdomain.currentdomain.evidence; _domain = appdomain.createdomain(_type.tostring(), adevidence, domaininfo); _domain.assemblyresolve += (sender, args) => { var lookuppath = path.getdirectoryname(assembly.g

Where/how can I whitelist access to my Google Apps API? -

in https://developers.google.com/console/help/ page there instructions "whitelisting ip address (server-side applications)". directions click "configure traffic filters" on quotas page yet link/button doesn't exist in view. options see set per-user limits , request higher api limit. are instructions out of date or not seeing that's right in front of me? nevermind. page @ least year out of date. i think solution edit allowed referers list on api access pane. source: https://groups.google.com/d/msg/google-ajax-search-api/-/txnfhpkxfimj

javascript - Change background image based on URL parts -

i trying add site capability, background change based on part of url using stylesheets. example: address/shop/index.php = background image 1 address/shop/index.php?cpath=22 = background image 2 address/shop/index.php?cpath=23 = background image 3 address/shop/index.php?cpath=24 = background image 4 any ideas? have looked @ javascript , jquery not sure on 1 choose or how go it. it looks using php, should able without javascript. need use php's server variables. something like $cpath = $_get['cpath']; //this allows access query part of url if($cpath == 24){ //set background url }

Exact axis ticks and labels in R Lattice xyplot -

i'm creating many plots (each separate image) must have identical axis limits. when using ylim, tick marks awkwardly placed @ extreme edges , tick labels omitted extreme values. library(lattice) x=1:100 y=10+20*(runif(100)) xyplot(y~x) # case 1 - automatic ylim xyplot(y~x, ylim=c(10,20)) # case 2 - specified ylim in case 1, axis ticks , labels automatically generated @ (y=10,15,20,25,30). tick marks labeled, , there vertical padding extreme tick marks (y=10 , y=30) in plot rectangle. in case 2, when specify ylim values, tick marks generated @ (y=10,12,14,16,18,20) labels appear (y=12,14,16,18). tick labels missing @ extremes. also, there no vertical padding extreme tick marks in plot rectangle. is there way specify ylim , still have tick marks , labels come out case 1? more generally, when specifying ylim: 1. how can specify each tick mark goes? 2. how can specify tick marks labeled? to tick marks , labels want, can along lines of: xyplot

Python mechanize detect downloaded file extension -

i'm trying retrieve websites , save them on local disk using python mechanize. problem many websites redirect links other html/asp/php. there accurate method detect extension url has , type of files retrieve? for instance: http://www.yahoo.com should saved html file. http://www.microsoft.com/en-us/download/confirmation.aspx?id=3745 should saved .exe file redirects , downloads exe file. content-type declared text/html not reliable method guess. how can accurately detect a file extensions way browsers while saving file? thanks heaps http://www.microsoft.com/en-us/download/confirmation.aspx?id=3745 should saved .exe file redirects , downloads exe file. content-type declared text/html not reliable method guess. that's not quite correct. doesn't use http redirect. problem microsoft uses javascript cause browser download file. actual file is: http://download.microsoft.com/download/4/4/9/449b0038-ac27-4b24-bf11-dd8ebdf5cca6/sonar_setup.exe s

python's datetime.timedelta for bash -

is there in bash similar construction in python: start_time = time.time() target() print datetime.timedelta( seconds= int(time.time() - start_time) ) ? i'm looking wrapper datetime.timedelta . i mean, easy construction: one/two line, give same result, days/hours:minutes:seconds running below time execution of script wish time. time script for example: time python my_script.py will time how long script runs, independant of python itself. time ls -la . , time cat a_long_file , time du -h etc... source

php - Laravel - Custom validation for file doesn't work -

i trying use custom validation rules file inputs in laravel. file input name "photo". trying apply rule called "validate_art", file input. know there's "image" validation rule, want apply own customized rule file input. here's code : $rules = array('name'=>'required|unique:user,name','startyear'=>'numeric','endyear'=>'numeric' ,'photo'=>'validate_art'); validator::extend('validate_art',function($attribute,$value,$parameters){ // returning false testing purpose return false; }); what happens is, doesn't apply rule field @ all. when try use rule other field testing purposes, works without failure. doing wrong? or custom validation cannot applied file inputs? please someone, throw light @ this. appreciate that. first should modify input data foreach ($inputs $k=>$input){ if($input instanceof \symfony\compone

shell - Python Script not running in crontab calling pysaunter -

i have read multiple posts , many articles detailing scipts in cron job need keep environment variables necessary run inside script due opening of shells within cron. situation unique in path variables being set discussed, in turn call pysaunter python egg using subprocess.call() , seems break down there. causes whole process break in cron job. for clarity, here steps refer to: 1) cronjob calls run_test.py -n foo 2) run_test.py sets environment variables correctly (cur_shell_path=sys.path (converted proper path string, not shown here) my_env= os.environ.copy() my_env["path"] = my_env["path"] + cur_shell_path) 3) run_test.py calls subprocess.call("pysaunter -m foo -v", env=my_env, shell=true) the output of step 3 shows finding egg , starts load necessary modules pysaunter, breaks when attempting find directory used modify pysaunter. error reads : importerror: no module named helpers i have attempted adding path environment multiple times ne

ajax - Grails dynamic drop down Using remoteFunction is not working -

i'm trying make dynamic drop down menu in grails work. second drop down not populated after select on first drop down. here's code on _form gsp: <g:select name="department" from="${mcm.mgdepartment.list(sort:'dep')}" values="${mgmatricessrfapproversinstance?.department?.id}" optionkey="id" noselection="${[null: 'select one...']}" onchange="${remotefunction (controller: 'mgmatricessrfapprovers', action: 'findjobtitlefordepartment', params: '\'department.id=\' + this.value', update: 'jobtitleselection')}"/> <td id="jobtitleselection"> <select> <option>select one...</option> <g:select name="jobtitle.id" from="${mcm.mgjobtitle.list()}" optionkey="id"/> </select> </td> code in controller: def findjobtitlefordepartment =

c# - Error on live server and not on local server -

i error cs0122: 'resources.brakeshoe' inaccessible due protection level on line line 12: <asp:panel defaultbutton="btnsearchpart" id="divsearch" clientidmode="static" runat="server" cssclass="form-horizontal divsearch"> line 13: <div class="control-group"> line 14: <label class="control-label"><%=resources.brakeshoe.bs_drumdia %></label> line 15: <div class="controls"> line 16: <span>from:</span> i'm getting after publish project , upload server. on development computer work fine. tried delete files , upload them again , it's dosen't work. error states brakeshoe not accessible, make brakeshoe public rebuild , deploy may help. you can revere engineer existing dll find if brakeshoe has proper access specifier.

c# - Make DataGridView Show Properties of Derived Class Objects when Using List of Base Class Objects -

is there way have datagridview show properties of derived class if members held in list of base class type, in properties don't exist? have following: public class mybaseclass { public int mypropertybase { get; set; } //... } public class myderivedclass : mybaseclass { public int mypropertyderived { get; set; } //... } // create list of type mybaseclass, holding myderivedclass objects list<mybaseclass> list = new list<mybaseclass>(); list.add(new myderivedclass(1)); list.add(new myderivedclass(2)); list.add(new myderivedclass(3)); // declare datagridview datagridview datagridview = new datagridview(); datagridview.autogeneratecolumns = false; // create display column datagridview datagridviewtextboxcolumn col = new datagridviewtextboxcolumn(); when bind list datagridview , show mypropertybase property works fine: // select mypropertybase display in column col.datapropertyname = "mypropertybase"; datagridview.columns.add(col); datagridview.dat

cocoa - Using multiple NSSliderCell in a single NSSlider -

i'd create nsslider has 3 knobs, not one. i'm thinking can subclass nsslidercell , override tracking methods ensure 1 slider cell doesn't pass 1 next it. that's easy enough do, i'm not sure how tell nsslider should have 3 cells show up, instead of one. why not use 3 sliders? remove text , tick marks make them small , put them closely each other. using single slider 3 knobs give problems retrieving slider values.

How to initialize new DOM contents using javascript and keep previous DOM somewhere else? -

i have 2 pages: page1.html page2.html page1.html : <html> <head>some css , js goes here</head> <body><a href="page2.html"></a></body> </html> page2.html : <html> <head> few more css , js goes here</head> <body><a href="page3.html"></a></body> </html> my plan is: when user clicks on <a href="page2.html"></a> i grab content of page2.html via ajax , store contents of page1.html in javascript variable now how can insert content of page2.html in dom , initialize $(document).ready events in javascripts of page2.html must triggered.

jquery - how to remove p tag (not empty) found after table -

from live url dragging data work. working fine want data of p tag before table , not after it. mean data have following structure. <p>some data</p> <p>some data</p> <table> data </table> <p>some data</p> <p>some data</p> <p>some data</p> now want retain first 2 p tags along table , no p tags or data after table. how can using jquery. tried doing finding p tag after table , using remove no avail. help/suggestions welcome. in advance. try following $("table").nextall("p").remove();

android - How to create a file of specific size on sd card programatically -

can 1 please let me know how create file of specific size on sd card programatically. did tried shell command of no use, try { process p = runtime.getruntime().exec("dd of=/mnt/extsdcard/output.dat bs=1 seek=1m count=0"); } catch (ioexception e1) { } i did try same command in shell script , not able create file. guess since device not rooted, command did not work. any regarding highly appreciated. -regards, manju you can use randomaccessfile shown here .

Xamarin iOS - Binding Project - Warning -

am using xamarin studio - 4.0.4 (build 2) mono - 2.10.11 xamarin.ios - 6.3.5.43 mac os x - 10.8.2 when building wrapper binding class, warning saying 'system.runtime.compilerservices.extensionattribute' present in multiple assemblies. warning, builds .dll file. target generatebindings: tool /developer/monotouch/usr/bin/btouch execution started arguments: /unsafe /d:debug apidefinition.cs /s:structsandenums.cs /tmpdir:obj/debug/ios/ /sourceonly:obj/debug/ios//sources.list warning cs1685: the predefined type system.runtime.compilerservices.extensionattribute' defined in multiple assemblies. using definition from mscorlib' /developer/monotouch/usr/lib/mono/2.1/mscorlib.dll (location of symbol related previous warning) /library/frameworks/mono.framework/versions/2.10.11/lib/mono/2.0/system.core.dll (location of symbol related previous warning) but when using created binding class in project, gives error saying compiling native code - 'error m

drupal 6 theming: wrong layout on window hosting -

i made theme , works on linux hosting. have reason change windows hosting , got minor issue: on linux host, link css in correct place head tag http://coffeeplus.vn/test/linux.jpg http://coffeeplus.vn/test/right_headtag.jpg on windows host, link css go body tag http://coffeeplus.vn/test/window.jpg http://coffeeplus.vn/test/wrong_headtag.jpg anyone know how fix it?

user interface - trisurf doesn't work in my MATLAB GUI code -

i trying write code plots convex hull of points generated convhulln. have triangle data (n 3 matrix), , cartesian coordinates of points (m 3). normally, when i'm not dealing gui, can following, , have no problems: a=rand(20,3); t=convhulln(a); trisurf(t,a(:,1),a(:,2),a(:,3)); this works fine. when try same thing within code of gui, not work. here's have: tt=convhulln(cluster); trisurf(handles.trisurf_area,tt,cluster(:,1),cluster(:,2),cluster(:,3)); trisurf_area tag of plot area. i should note following code works fine: scatter3(handles.trisurf_area,cluster(:,1),cluster(:,2),cluster(:,3)); i use matlab 2012a. try trisurf(tt,a(:,1),a(:,2),a(:,3),'parent',handles.trisurf_area) .

c# - How to add multiple bytes and get a byte array? -

given byte array byte[] somebytes = { 0xff, 0xfe, 0xfe, 0xff, 0x11, 0x00 ,0x00 ,0x00 ,0x00} what's best add bytes? manually adding of bytes hand hex numbers yield 40b on above example preferably i'd end like: byte[] bytesum = { 0x04, 0x0b } actually, need 0x0b part (used checksum). checksum calculated 0x0b xor 0x55 (which yields 0x5e) in case. i understand isn't normal addition of bytes, how checksum calculated. manually looping through byte array , adding them results in integer sum. what's concise way of doing this? erm, byte checksum; foreach (var b in somebytes) { checksum = (byte)((checksum + b) & 0xff); }

android - can't modify layout defined in layout.xml at runtime (nullPointerException) -

i can't add sub-layout main layout of activity @ runtime. more precisely null pointer exception when call setcontentview(layout) or layout.add(mysublayout) , layout retrieved findviewbyid(r.id.idlay) . below here there xml code. <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/idlay" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true" tools:context=".trainingacty" > seems not possible modify layout created statically. see answers on stack overflow seems possible doing want, , i've never read in documentation of android nothing impossibility of it. it possible modify layout @ runtime regardless of how created. here's example of how it. assume in example layout posted in file main.xml . @override protected void oncreate(bundle

Spinner with custom layout doesn't show nothing Android -

in application must use spinner should show 3 items (it,en,pr). must use personalized layout. code in adapter in oncreate method: holder.spinnerlenguage = (spinner) convertview .findviewbyid(r.id.spinnerlenguage); arraylist<string> spinnerarray = new arraylist<string>(); spinnerarray.add("it"); spinnerarray.add("en"); spinnerarray.add("pr"); final lenguagespinneradapter lenguageadapter = new lenguagespinneradapter( convertview.getcontext(), spinnerarray); holder.spinnerlenguage.setadapter(lenguageadapter); holder.spinnerlenguage .setonitemselectedlistener(new onitemselectedlistener() ... ... the adapter class is: private class lenguagespinneradapter extends arrayadapter<string> implements spinneradapter { private arraylist<string> lenguages; public lenguagespinneradapter(context context, ar

c# - passing json values to highcharts from .net code behind -

var javascriptxvalue= $.parsejson($("#hdnxaxis").val()); var javascriptyvalue= $.parsejson($("#hdnyaxis").val()); $(document).ready(drawmygraph1); function drawmygraph1() { chart = new highcharts.chart( { chart: { type: 'column', renderto: 'container3', defaultseriestype: 'area' }, title: { text: '' }, subtitle: { text: '' }, xaxis: { categories: javascriptxvalue, labels: { enabled: false } }, yaxis: { title: { text: 'no of patients' } }, credits: { enabled: false }, tooltip: { formatter: function () { return this.series.name + ' - ' + highcharts.numberformat(this.y, 0); }

c# - How return Tuple<T1,T2> -

i create method anonymous types. want return tuple. how implement this? public ienumerable<tuple<t1, t2, t3>> getfiles() { using (testentities context = new testentities()) { var query = pf in context.t1 join pfext in context.t2 on pf.id equals pfext.processedfilesid join st in context.t3 on pfext.wfstatusid equals st.wfstatusid select new { pf.id, pf.recordcount, pf.name, pfext.packageid, statusname = st.name, pfext.protocolstatus }; } } something following should work: public ienumerable<tuple<t1, t2, t3>> getfiles() { using (testentities context = new testentities()) { var query = pf in context.t1 join pfext

javascript - remove all calendar icon for input disabled -

i use in page datepickers each input needs it, but sometimes, somefields disabled. i remove calendar , there datepicker icon if inputs disabled i've tried that if($(".datepicker").prop('disabled')){ $(this).removeclass('datepicker'); } in document.ready function, etc... but not work also, datepicker icon has a specific class <img class="ui-datepicker-trigger" src="images/calendar-day.png" alt="..." title="..."> all need remove picture input disabled because, icon users can open datepicker , change date. anykind of appreciated. use css rule: input.hasdatepicker[disabled] + img.ui-datepicker-trigger { display: none; }

php - Javascript - CSS style for an element does not show when appended -

Image
i have problem in javascript regarding appending of values element's innerhtml (specifically div element). problem is, everytime append value element's innerhtml, css style appended value not show. example, when run script: <script> var content=<?php echo json_encode(" <table> <tr> <td>hello</td> </tr> "); ?>; document.getelementbyid("div").innerhtml=content; </script> //followed script appends values //the script below not show css style <script> var content=<?php echo json_encode(" <tr> <td>hi</td> </tr> </table> "); ?>; document.getelementbyid("div").innerhtml+=content; </script> i added picture further elaborate i'm talk

ssl - SpringLdap 2 over ldaps -

i've followed interesting webinar springldap , i'm planning migrate current ldap interface springldap. haven't seen easy way connect ldaps server. in current implementation had like: string nexttoken = stcc.nexttoken(); properties envp = initializeenv(nexttoken, userpassword); try { ldapcontext ctx = new initialldapcontext(envp, null); //system.out.println(nexttoken + " validation"); return ctx; } and private properties initializeenv(string username, string userpassword) throws ioexception { properties envp = new properties(); envp.setproperty(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); envp.put(context.provider_url, (string) properties.get("ldap.server.url")); if (username != null) envp.setproperty(context.security_principal, username); if (userpassword != null) envp.setproperty(context.security_credentials, userpassword); envp.setproperty(context.security_authentication

c# - how to exchange selected item in a list box winform -

i'm trying change 'selecteditem' in list box, 'selecteditem' staying though create new item different data. appreciate help this.listbox1.selecteditem = new listboxitem(m_currentitem); //next line operate event list item changed this.listbox1.items[index] = this.listbox1.selecteditem; i think you're doing operations in reverse order ^^ you should first add new item in list box with this.listbox1.items.add(yournewitem); then can select newly inserted item with this.listbox1.selecteditem = yournewitem; or, since .add method adds element in last position of items array, can use this.listbox1.selectedindex = this.listbox1.items.count - 1 see article reference on listbox.selecteditem property: http://msdn.microsoft.com/it-it/library/system.windows.forms.listbox.selecteditem(v=vs.110).aspx :)

excel - Error in finding last used cell in VBA -

Image
when want find last used cell value, use: dim last_row integer dim lastrow long lastrow = range("e4:e48").end(xldown).row debug.print lastrow i getting wrong output when put single element cell. when put more 1 value cell, output correct. what's reason behind this? note : intend make "one stop post" can use correct way find last row. cover best practices follow when finding last row. , hence keep on updating whenever come across new scenario/information. unreliable ways of finding last row some of common ways of finding last row highly unreliable , hence should never used. usedrange xldown counta usedrange should never used find last cell has data. highly unreliable. try experiment. type in cell a5 . when calculate last row of methods given below, give 5. color cell a10 red. if use of below code, still 5. if use usedrange.rows.count get? won't 5. here scenario show how usedrange works. xldown equally unreliabl

ios - NSOperation remains in an NSOperationQueue after cancellation -

i perform downloading images using nsoperation , nsoperationqueue. every operation retains storethumbrequest object encapsulating request specific data including target view, waiting image. @ same time view retains nsoperation object cancel operation during reusing or deallocations. retain loop broken @ 'cancel' , 'main' methods in appropriate times. i found nsoperation remain in nsoperationqueue when set limit on maxconcurrentoperationscount. reaching limit prevented 'main' method of new nsoperations being called. nsoperation remains in queue when it's cancelled. if managed finish task, gracefully removed nsoperationqueue. my nsoperations non-concurrent , have no dependencies. any suggestions? thanx in advance #import "storethumbloadoperation.h" #import "storethumbcache.h" @interface storethumbloadoperation () <nsurlconnectiondelegate> { storethumbrequest *_request; nsmutabledata *_downloadeddata; nsurlcon

sip - FreeSwitch voice delay on Android -

currently, building mvoip service android. chose freeswitch sip server, , there no problem talking through pc. however, android open source make voice delay. here data faced far. case 1 - freeswitch + pc freeswitch 1.2 stable version linux centos 6.5 xlite softphone pc windows8 voice delay - less 50ms case 2 - freeswitch + android sipdroid freeswitch 1.2 stable version linux centos 6.5 sipdroid android voice delay - 80 ~ 200 ms case 3 - freeswitch + android csipsimple freeswitch 1.2 stable version linux centos 6.5 csipsimple android voice delay - 150 ~ 400 ms case 4 - freeswitch + android sipdroid ==> pc freeswitch 1.2 stable version linux centos 6.5 sipdroid android xlite softphone pc windows8 voice delay - 50 ~ 100 ms some of android mvoip applications, such skype, make less 50ms voice delay. we've tried many sip open sources android, of them make horrible delay. looking open source make less 50ms android. there can solve issue? thank you. is maybe a

connection - Problems with Ethernet shield + arduino -

i trying simple (ready) programs arduino examples regardin ethernet shield. still getting no result. receiving not connected or blank serial monitor. knows why? think connected dhcp since on dhcp list of router <#include <spi.h> #include <ethernet.h> #include <ethernetudp.h> // enter mac address controller below. // newer ethernet shields have mac address printed on sticker on shield byte mac[] = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed }; unsigned int localport = 8888; // local port listen udp packets ipaddress timeserver(192, 43, 244, 18); // time.nist.gov ntp server const int ntp_packet_size = 48; // ntp time stamp in first 48 bytes of message byte packetbuffer[ ntp_packet_size]; //buffer hold incoming , outgoing packets // udp instance let send , receive packets on udp ethernetudp udp; void setup() { // open serial communications , wait port open: serial.begin(9600); while (!serial) { ; // wait serial port connect. needed leonar

Android crashes while using telnet command -

Image
i new android. trying change battery level of emulator . saw following battery charging link it opening telnet client , "open localhost 5554" working. power working , when trying execute "power status discharging" command emulator crashes close dialog shown below. i found out answer question. in config.xml of android emulator hw.battery=no , should hw.battery=yes. problem why android emulator crashing.

java - Trouble using AsyncTask outside of Activity -

i've created asynctask inner class of activity. , works good. but now, since want reuse asynctask inside many other activity, i'm trying use separate class asynctask. the problem lost context reference. so, example code: @override protected void onpreexecute() { pdialog = progressdialog.show(myactvity.this, "wait...", "sending data ...", true); pdialog.setcancelable(false); super.onpreexecute(); } can't work, since context in show method cannot resolved. how can solve problem? create asynctask class in following way :- public class mytask extends asynctask<void,void,void>{ private context mcontext; // context reference private progressdialog pdialog; public mytask(context context){ //constructor this.mcontext = context; } @override protected void onpreexecute() { pdialog = progressdialog.show(mcontext, "wait...", "sending data ...", true);

java - Is it safe to return 0 as hashcode -

i have class has list of article (or want). safe implement/override hashcode() function in class : class place{ list <article> list = new list<article>(); public int hashcode() { if(list.isempty()) return 0; //is safe return 0 else return list.get(0).hashcode(); } } public class main{ private hashset<place> places = new hashset<>(); //this function must donne public boolean isarticlein(article article){ place place = new place(); place.add(article); return places.contains(place); } } is there possibility have list not empty , return 0. if want store objects of class in container uses hashcode, should make sure "if 2 objects equal should return same hash code" (otherwise container may store duplicates / confused). objects of class compare equal if both have empty list? best advice on how implement equals , hashcode capture information wan

php - Oracle connect three tables in SQL query -

i using oracle database , php.i have 3 tables: | users | | user/group | | groups | ---------- -------------- ----------- | u_id | | gr_id | | gr_id | | u_name | | u_id | | gr_name | |u_status| | | | | i need names of users in group has gr_name , has status...say 'ok'; have tried using join so: select u_name users join user/group on user.u_id = user/group.u_id join groups on user/group.gr_id = groups.gr_id u_status = 'ok' the query return users in groups.. how , can insert like: where gr_name = 'blah-blah' try where u_status = 'ok' , gr_name = 'blah-blah'

Setting up Visualization Toolkit (VTK) as project dependency in sbt? -

i'm on ubuntu 13.10 . i'd run visualization toolkit (vtk) in sbt project. i've installed libvtk on synaptic package manager. can run class vtk example without problems. when try run on sbt via run command, unsatisfiedlinkerror . i tried several things. means adding vtk.jar lib folder of project , trying several sbt dependencies vtk artenum. i run whole stuff in sbt, because use other stuff testing , on. compiling class vtk dependency inside no option me. setting paths , on tried also. mean, can install whole lot of other dependencies without setting paths in os. an alternative find working graphical tool vtk run dependency in java/scala. this build.sbt: name := "selfoo" version := "1.0" scalaversion := "2.10.3" scalacoptions ++= seq("-unchecked", "-deprecation", "-feature") resolvers ++= seq( "sonatype oss" @ "https://oss.sonatype.org/content/repositories/releases"

java - Need to set an adapter to a ListView inside a DialogFragment but I get a null pointer exception with the getView() method? Why? -

i have dialog extends dialogfragment: public class mycustomdialogfragment extends dialogfragment { static mycustomdialogfragment newinstance() { return new mycustomdialogfragment(); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.institutional_info_custom_list, container, false); return view; } } and use dialog (it inside onclick listener): mycustomdialogfragment newfragment = mycustomdialogfragment.newinstance(); view dialogview = newfragment.getview(); detaillistview = (listview) dialogview.findviewbyid(r.id.custom_dialog_list); final masterdetailarrayadapter adapter = new masterdetailarrayadapter(comehainvestito.this, masteranddetailstatisticsinfolist); detaillistview.setadapter(adapter); newfragment.show(getfragmentmanager(), "master_detail_dialog"); master

regex - Time complexity of regular expression with backreferencing -

what time complexity of regular expression (to operated on string): "(.{5})\1\1" the implementation having is: reps <- function(s, n) paste(rep(s, n), collapse = "") # repeat s n times find.string <- function(string, th = 3, len = floor(nchar(string)/th)) { for(k in len:1) { pat <- paste0("(.{", k, "})", reps("\\1", th-1)) r <- regexpr(pat, string, perl = true) if (attr(r, "capture.length") > 0) break } if (r > 0) substring(string, r, r + attr(r, "capture.length")-1) else "" } please out. thanks! :) it depends on implementation. not regular expression in strict definition of word because of backreferences, looks worst case o(15 * length(string)) explanation: regex engine try match starting position 0,1,2,3,4..last position in string. since there no constraint (dot character) match first 5 characters , try match them again twice, wo

dataset - SAS, handle Macro output -

i took sas macro sas website, in order list file in folder. thit full reference: http://support.sas.com/kb/25/074.html . and that's code: %macro drive(dir,ext); %let filrf=mydir; /* assigns fileref of mydir directory , opens directory */ %let rc=%sysfunc(filename(filrf,&dir)); %let did=%sysfunc(dopen(&filrf)); /* returns number of members in directory */ %let memcnt=%sysfunc(dnum(&did))