Posts

Showing posts from February, 2011

java - Compilation effects of declaring method parameters "final" -

this question has answer here: is there performance reason declare method parameters final in java? 8 answers marking method parameter final needed allow variable access inner anonymous classes , useful coding-tool enforcing variable use conventions within method. apart that, there other compilation-related motivation use final -keyword? specifically, give compiler hints facilitate specific optimization otherwise not performed? or compiler smart enough recognize if variable never modified anyways? for example, i'm thinking whether there difference how variables passed method. e.g. variable of primitive type (int, byte, etc.) needs copied when passed method prevent modifications trickle out calling code, whereas if parameter marked final , "passed reference" without such concerns, i.e. no copy-operation needed. but let's keep question more gen

sorting - Ranking diagonal values of matrix in ascending order and other than diagonal values depending on diagonal values in matlab -

this question has answer here: ranking matrix values in ascending order in matlab 1 answer input matrix: 1.0000 0 0.2173 0.2585 0.3764 0 0 0 0 0 0.2173 0 0.2173 0.2173 0.2173 0.2585 0 0.2173 0.2585 0.2585 0.3764 0 0.2173 0.2585 0.3764 expected output matrix: 5 1 2 3 4 1 1 1 1 1 2 1 2 2 2 3 1 2 3 3 4 1 2 3 4 for given matrix r={r(i,j)} following 2 operations done input matrix: 1.we rank diagonal values in ascending order.(i.e small value rank 1 given , next small value rank2 , on) ex: 0-1st rank 0.2173-2nd rank 0.2585-3rd rank 0.3764-4th rank 1.0000-5th rank 2.other diagonal cell sort rest values rowise depending on diagonal value.

c - How to correctly use a startup-ipi to start an application processor? -

my goal let own kernel start application cpu. uses same mechanism linux kernel : send asserting , level triggered init-ipi wait... send deasserting , level triggered init-ipi wait... send 2 startup-ipis vector number (0x40000 >> 12) (the entry code application processor lies there) currently i'm interested in making work qemu. unfortunately, instead of jumping 0x40000 , application cpu jumps 0x0 cs register set 0x4000 . (i checked gdb). the intel multiprocessor specification (b.4.2) explains behavior noticed valid if target processor halted after reset or init. shouldn't apply code of linux kernel? sends startup-ipi after init-ipi. or misunderstand specification? what can have application processor jump 0x000vv000 , not 0x0 cs register set 0xvv00 ? can't see, linux changes behavior. it seems misunderstood specification: since application cpu started in real mode 0x000vv000 equivalent 0xvv00:0x0000 . not possible represent address in

d3.js - D3 Force Directed Map Source and Target Properties -

is possible use names other source , target d3 force directed map? connecting api provides me needed information supplying 'src-port' , 'dst-port'. if change names in static json file 'source' , 'target' links on map appear. if leave is, following error message: e.source undefined is there way can specify property names instead of using defaults, 'source' , 'target'? here complete code work with: function buildmap(node, ids, mode) { d3.select("svg").remove(); width = 960, height = 500; svg = d3.select(node).append("svg") .attr("width", width) .attr("height", height) .attr("id","chart") .attr("preserveaspectratio","xmidymid") .attr("viewbox","0 0 960 500"); var color = d3.scale.category20(); var force = d3.layout.force() .charge(-220) .linkdis

javascript - json_encode putting empty array on the end of json -

i'm writing ajax application , have function in php script: public function expire_user() { $r=array("return"=>'ok'); echo json_encode($r); } that gets called javascript: $.getjson("/users/expire_user",function(data){ alert('success'); }); the problem alert never displays. think due json_encode returning invalid json, because when go url directly, displays {"return":"ok"}[] which not valid json due '[]' on end. why json_encode putting empty array on end , how rid of can receive valid json? wild guess, maybe should set correct headers json in php function this: public function expire_user() { $r=array("return"=>'ok'); header("content-type: application/json"); echo json_encode($r); } or send content x-json headers this: public function expire_user() { $r=array("return"=>'ok'); $json_data = json_enc

php - Is it possible to submit your own admin forms in Wordpress? -

i'm wondering if possible , how it, create own page in wordpress, after want submit form, info , save it. sounds simple, find no results. i saw can use do_settings_sections create custom form easily, auto-saves, want refer function , later show screen. far @ moment, close, calling function y form this: function edit_university() { echo " *test* "; } add_action( 'admin_post_edit_university', 'edit_university' ); i submit form , see echo test, out of wordpress admin page. it's simple page echo test; how can resend later page?

java - Gradle projects vs. Eclipse projects? -

i found interesting open-source layout library on github i'd incorporate android project i'm working on in eclipse. however, noticed library in question seems have been developed using gradle, don't have. i'm not sure ide used develop library, in case, i'm not familiar gradle @ all... gradle-d projects compatible non-gradle-d eclipse? depend on ide used? (in case, how can 1 tell used develop it?) what steps (if any) need take incorporate library? need install & run plugins, example? thank help. gradle build system android studio uses (the new ide being developed google android development). can use gradle eclipse plugin load gradle projects eclipse.

vb.net - MediaPlayer.MediaPlayer: How do I use the Volume property? -

the volume property mediaplayer.mediaplayer confusing me. googled definition , found this think right class. says volume property double excepts number between 0 , 1, , it's default 0.5. however, when set 0.5 or other number within 0 , 1, says not fall within expected range. here how defined , how tried adjust volume. have event mouseup because not valuechanged or scroll work properly. tips on appreciated. dim player1 mediaplayer.mediaplayer = new mediaplayer.mediaplayer private sub sndmasterslider_mouseup(sender object, e eventargs) handles sndmasterslider.mouseup player1.volume = sndmasterslider.value / 100 debug.print(player1.volume) end sub

java - How to find the list of user stories under a given iteration and a given project using rally rest api -

i able iterations under project object. how iteration need under project , drill down stories in iteration using java toolkit? https://sandbox.rallydev.com/slm/webservice/v2.0/project/7191194697/iterations given project: string projectref = "/project/1234"; you may scope requests follows: iterationrequest.setproject(projectref); or storyrequest.setproject(projectref); if scoped story request project, may query on stories traversing iteration.name if know iteration already: storyrequest.setqueryfilter(new queryfilter("iteration.name", "=", "my iteration 1")); here more complex example returns stories assigned iterations fall within timbox of specific release. if, example, have 4 iterations per release, code return stories assigned 4 iterations. if code against sandbox, replace value in host variable accordingly. public class finditerationsbyreleasedateandstories { public static void main(string[] args) throw

pass javascript var to php -

this question has answer here: how can use javascript variable php variable? [duplicate] 7 answers i have crono app in js need pass var modal in php, have (its embed table) <table> <thead> <th>project</th> <th>task</th> <th>tieme</th> <th><th> </thead> <tbody> <tr> <td>".$res[0]."</td> <td>".$res[1]."</td> <td > <form name='crono' class='large-6'> <input type='text' name='face' title='cronomet'> <script type='text/javascript'> var timecrono; var hor = 0; var min = 0; var seg = 0; var starttime = new date(); var start = starttime.getseconds(); var start

Select column from data frame based on dynamic value in R -

i've been banging head against problem , feel there must efficient way in r doesn't involve writing loop. suggestions appreciated! i'd create new column in data frame contains values existing columns in dataframe, column value selected dynamically specified. example clarify: > mydata <- head(mtcars) > mydata mpg cyl disp hp drat wt qsec vs gear carb mazda rx4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 mazda rx4 wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 hornet 4 drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 hornet sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 > myquery <- c("cyl","cyl","gear","gear","carb", "carb") at point, i'd know if there's simple r functio

C language and shared memory -

how memory segment pointer copy file type pointer data. this ptr pointer attach memory segment created. , fp file pointer .by using fp=fopen("file name",w+(mode)); . , have write inside fp this. fprintf(fp,"hello vishnu"); by using shared memory want send server end. how possible this? how can take data @ server end? to share memory between processes can use file mapping .

c - Shared Memory and semaphores for (multiple) client and server game -

i have program little game course in c , has done using shared-memory, semaphores , client/server architecture can handle multiple clients (the exact requirement game 2). the 2 clients need turns in turns , represented same program (no fork() involved here - both started ./client) the server has create resources when starts up. main problem regarding semaphores. (the shared memory , game-logic stuff works or isn't difficult implement.) to decide if server or client has access shared-memory need 1 semaphore. need second 1 decide of clients has access. right? so got hint done assigning ids clients. shared-memory has 3 additional variables so: struct game { int id_needed, client_id, id_ready; ... // additional stuff needed game logic }; as server boots i'm initializing 1 semaphore 0 , other 1 1. when first client appears checks if id still 0 (it's initialized zero) if so, tries this: while(my_id == 0) { if(semaphore_down(semaphore_1) == 0) // che

java - Is there any way to find out the extensions of the Images stored in a database as binary data? -

i have product details including product image(binary data) mssql database , store locally on android device image files, don't know type of images. think when we're storing images files extension matters, if matters there way find out image extensions? thanks , regards. you can use bitmapfactory.options.outmimetype that. contain string image/png or image/jpg after image decoded. sample: inputstream in = getassets().open("image.file"); bitmapfactory.options opts = new bitmapfactory.options(); bitmapfactory.decodestream(in, null, opts); log.d(tag, "mime type: " + opts.outmimetype); in case writes in log: 05-31 15:20:34.131: d/test(3803): mime type: image/jpeg

function - Golang packet strcuture returning buffer -

i have made packet package packet structure inside so: //a packet buffer object package packet import ( "bytes" "encoding/binary" ) type packet struct { buffer bytes.buffer } func (p packet) getbytes() []byte { return p.buffer.bytes() } func (p packet) addstring(s string) { p.buffer.write([]byte(s)) } func (p packet) addint(i_ int) { //convert int byte b := make([]byte, 2) binary.littleendian.putuint16(b, uint16(i_)) //push byte buffer p.buffer.write([]byte(b)) } func (p packet) addbyte(b []byte) { p.buffer.write(b) } this session package uses packet structure form packets , send them client package session type maplesession struct { connection net.conn encryptiv, decryptiv []byte isconnected bool } func (session *maplesession) run(conn net.conn) { //display new connection coming session.connection = conn fmt.println("client connected from:", session.connection.remoteadd

Color blindness helper algorithm -

what algorithms accessibility colorblind people? i'm guessing color reduction help, can't find information on internet other smartphone apps (not papers). rationale : recently, crt monitor stopped outputting magenta, after little research seems bit similar how tritanopia sees. basically, in red spectrum output shades of blue. although buy new monitor, i'd know software-based fix; situation has got me interested in building accessible applications. the best way solve legibility problems folks color blind increase color contrast ratio. web content accessibility guidelines require minimum contrast of 4.5:1 (3:1 large text). there handful of contrast analyzers out there. google's accessibility developer tools includes algorithms checking contrast , recommending alternatives . if inclined, use library create browser extension dynamically changes css on page make content meet required contrast ratio.

Android Custom Adapter - ArrayAdapter requires resource ID to be a Textview error -

i created custom adapter in order have title, description , image list items, keeps throwing this: java.lang.illegalstateexception: arrayadapter requires resource id textview i understand why throw if using standard android adapter, thought making own adapter can pretty avoid this. there i'm missing? here adapter class: package homepage; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview; import java.util.arraylist; public class adapter_homepage extends baseadapter { private final context context; private final arraylist<string> titles; private final arraylist<string> descriptions; static class viewholder { public textview title, description; public imageview image; } public adapter_homepage(context context, arraylist<string> titles, arra

low latency data link pc to android -

can recommend method low latency bi-directional com link between pc app , android slave app. app have works via wifi latency slow (about 300ms), i'm looking down 10ms or so. the android acting glorified remote control game on pc. apk displays low res image , sends button presses game , round trip need quick i'm thinking option beside network, connect usb cable don't see lot of support path , not sure lower latency wifi any ideas please? usb have lower latency, , there's plenty of usb support in android. check out http://developer.android.com/guide/topics/connectivity/usb/accessory.html bluetooth may option, i'm not sure if latency want- usb can.

python - Create new list in for loop -

this question has answer here: list of lists changes reflected across sublists unexpectedly 13 answers i'm trying create new list changing other in loop, using append method. have trouble it. my simple code: l1=[] l2=[0,0] in range(4): l2[0]+=1 l1.append(l2) print l2 print l1 return: [1, 0] [2, 0] [3, 0] [4, 0] [[4, 0], [4, 0], [4, 0], [4, 0]] but expected list l1 this: [[1,0], [2,0], [3,0], [4,0]] made mistake? you appending reference list. , since, @ end of loop, value of l2 [4,0] , each list inside l1 [4,0] you can append copy of list of list() built-in method or, using slicing notation shown below l1=[] l2=[0,0] in range(4): l2[0]+=1 l1.append(list(l2)) # or l1.append(l2[:]) print l2 print l1 if not able understand idea, can use viz mode of codeskulptor , run code line line, understand properly.

Server Library [Glassfish 3.1.2.2] (unbound) -

any ideea how edit error?from load server library? using glassfish-tools-bundle-for-eclipse-1.2 if kind of bundle should first download normal eclipse java ee www.eclipse.org . you should install glassfish tools specific eclipse version (probably kepler) via eclipse marketplace. click help -> eclipse marketplace , search glassfish . after installing can add server instance via servers tab in eclipse.

How to get the user who initiated the process in IBM BPM 8.5? -

how user initiated process in ibm bpm 8.5. want reassign task user initiated process. how can achieved in ibm bpm? there several ways initiated task , initiated process instance different. can perform 1 out of following : add private variable , assign tw.system.user_loginname @ post of start. can access variable user initiated process.(it null or undefined scenario if task initiated rest api or uca.) place tracking group after start event . add input variable username , assign value same tw.system.user_loginname. whenever process started entry inserted db table.you can retrieve value view in performancedb. also there might table ,logging process instances details , can find user_id directly.

playframework - play 2.3.0 and Scala 2.10.4 -

can use play framework version 2.3.0 scala 2.10.4? i know version of play has 2.11.1 default have lib 2.10.4 support only. i errors these: [error] (*:update) sbt.resolveexception: unresolved dependency: com.typesafe.play#play_2.10;2.3.0: not found [error] unresolved dependency: com.typesafe.play#play-iteratees_2.10;2.3.0: not found [error] unresolved dependency: com.typesafe.play#play-test_2.10;2.3.0: not found [error] unresolved dependency: com.typesafe.play#play-ws_2.10;2.3.0: not found [error] unresolved dependency: com.typesafe.play#play-docs_2.10;2.3.0: not found there problem typesafe repository (many developers have same problem ). you can temporarily add resolver in build.scala/build.sbt. "typesafe maven repository" @ "http://repo.typesafe.com/typesafe/maven-releases/"

c# - Nested SQL to LINQ -

i have 3 tables as documents(documentid, documentname) subjects(subjectid, subjectname) documentsubjects (documentid,subjectid) i want documents form documents table subjectid id provided input sql query select * documents documentid in ( select documentid documentsubjects subjectid= 2 ); i want query in linq , please can me , in advance. :) context.documents.where(d=>d.subjects.any(s=>s.subjectid == 2)) or context.subjects.where(s=>s.subjectid == 2).selectmany(s=>s.documents).distinct()

java string split based on new line -

i have following string string str="aaaaaaaaa\n\n\nbbbbbbbbbbb\n \n"; i want break on \n @ end should 2 string aaaaaaaa , bbbbbbbb . dont want last 1 contain white space. if split based on new line character using str.split() final array should have 2 entry only. i tried below: string str="aaaaaaaaa\n\n\nbbbbbbbbbbb\n \n".replaceall("\\s+", " "); string[] split = str.split("\n+"); it ignore \n , give single string aaaaaaaaaa bbbbbbbb . delete call replaceall() , removing newlines too. do: string[] split = str.split("\n\\s*"); this not split on spaces - split must start @ newline (followed optional further whitespace). here's test code using sample input edge case enhancement: string str = "aaaaaaaaa\nbbbbbb bbbbb\n \n"; string[] split = str.split("\n\\s*"); system.out.println(arrays.tostring(split)); output: [aaaaaaaaa, bbbbbb bbbbb]

c# - resizing pictureBox proportionally to Form resizing -

Image
i want everytime , user resizes form , image in picturebox , resizes same values ( proportionally ) , i searched on internet codes , found answer in stackoverflow https://stackoverflow.com/a/6501997/3264464 static public bitmap scaleimage(image image, int maxwidth, int maxheight) { var ratiox = (double)maxwidth / image.width; var ratioy = (double)maxheight / image.height; var ratio = math.min(ratiox, ratioy); var newwidth = (int)(image.width * ratio); var newheight = (int)(image.height * ratio); var newimage = new bitmap(newwidth, newheight); graphics.fromimage(newimage).drawimage(image, 0, 0, newwidth, newheight); bitmap bmp = new bitmap(newimage); return bmp; } i added function code , , not sure maxheight,maxwidth thing , mean why need send via parameters and in form1_resize event handler wrote: private void form1_resize(object sender, eventargs e) { bitmap newimg = scaleimage(picturebox1.image, 1000, 1000); picturebox1.ima

Drupal Module Development im using hook_form, How do I use Javascript -

i'm creating first module in drupal. have created .module file following function, hook_menu : $items['admin/config/module'] = array( 'title' => 'module', 'description' => 'module management', 'page callback' => 'drupal_get_form', 'page arguments' => array('module_form'), 'access arguments' => array('administer module other applications'), 'weight' => 9999, 'file' => 'module.admin.inc', ); return $items; javascript works in .module file this code links file module.admin.inc form rendered, form rendered correctly. when want display data using ajax can't. it seams drupal_add_js('path') not work. how do this? use #attached property on form add css or js form to add css, $form['#attached']['css'] = array( drupal_get_path('

C/C++: Multiply, or bitshift then divide? -

Image
this question has answer here: is multiplication , division using shift operators in c faster? 15 answers where it's possible so, i'm wondering if it's faster replace single multiplication bitshift followed integer division. i've got int k , want multiply 2.25. what's faster? int k = 5; k *= 2.25; std::cout << k << std::endl; or int k = 5; k = (k<<1) + (k/4); std::cout << k << std::endl; output 11 11 both give same result, can check this full example . the first attempt i defined functions regularmultiply() , bitwisemultiply() follows: int regularmultiply(int j) { return j * 2.25; } int bitwisemultiply(int k) { return (k << 1) + (k >> 2); } upon doing profiling instruments (in xcode on 2009 macbook os x 10.9.2), seemed bitwisemultiply executed 2x faster regularmulti

c# - Custom Control in VS Designer: Avoid serialization of Collection properties -

i made new winforms control public class jwgraph inherits control this control has bindinglists(of foo) in them. in order avoid other visual studio errors in regards serialization (error messages) added serializable attribute foo , other tags bindinglist(of foo) . example: foo declaration <serializable> _ public class freemarker bindinglist(of foo) declaration: <system.componentmodel.browsable(false)> <editorbrowsable(editorbrowsablestate.never)> <system.componentmodel.designerserializationvisibility(system.componentmodel.designerserializationvisibility.hidden)> public withevents freemarkers bindinglist(of freemarker) when use control, visual studio adds base64 data ressources form's resx file , lines like me.jwgraph1.freemarkers = ctype(resources.getobject("jwgraph1.freemarkers"), system.componentmodel.bindinglist(of jwtoollib.jwgraph.freemarker)) to designer. problem is, can't change in control's code af

mysql - HQL: Subquery returns more than 1 row -

i'm new hql , need on error. query: string hqlsearchselect = "select new com.eteligent.core.loans.paging.loansappcustomerpageitem(" + "main.loanno, (select acct.id.clientid lmsaccountinfo acct acct.loanno = main.loanno), (select acct.name lmsaccountinfo acct acct.loanno = main.loanno), main.acctsts, " + "main.loanbal, (select acct.matdt lmsaccountinfo acct acct.loanno = main.loanno) )"; i think query can't identify record going return. constructor(loansappcustomerpageitem): public loansappcustomerpageitem( final string acctno, final string cifno, final string customername, final integer acctstat, final bigdecimal acctbal, final date acctduedate ) { super(); this.acctno = acctno; this.cifno = cifno; this.customername = customername; this.acctstat = acctstat; this.acctbal = acctbal; this.acctduedate = acctduedate; } if wanna 1 row subquery use

gruntjs - grunt-contrib-copy error (Error code: ENOENT) -

i searched internet , looks me had problem grunt-contrib-copy. project gruntfile.js ->app ->img ->pic1.png ->pic2.png result expected: project gruntfile.js ->app ->dist ->img ->pic1.png ->pic2.png ->img ->pic1.png ->pic2.png in word, copy files in /project/app/img /project/app/dist/img. here copy config, not working: copy: { main: { src: ['*.*'], expend: true, cwd: 'app/img/', dest: 'app/dist/img/' } }, here error message: warning: unable read "download.png" file (error code: enoent). use --force continue. (download.png name of picture file) how should config copy option? thank you! it looks have typo, should expand instead of expend . cwd property being ignored. try following config instead: copy: { main: { src: ['**/*'], expand: true, cwd: 'app/img/

python - Most efficient way to filter for lowest values in queryset -

given: some_list = someclass.objects.filter(something=something).order_by('-x','-y') in english: some_list filtered list of someclass objects, ordered 2 values, first x , y . if want limit number of entries in list value z , can this: final_list = some_list[:z] but if want limit number of entries value, randomize "cut-off entries" before do? i'm having hard time describing, example: sc x y 2 3 b 1 2 c 1 1 d 1 1 e 1 1 f 1 0 g 0 3 if z=3 then, using method, final_list = (a,b,c) . want final_list include , b because above others(a has greater x others, , b tied second x has greater y), seeing cut-off @ c x=1,y=1 , , there 2 other objects "tied" c, third slot c, d, or e. i pull some_list apart hand , examine values , start putting them final_list until hit z, hoping there better way don't know of. in, less lines of code, less processing power, etc. so example, expect 1 of these outputs, @ ran

android - Getting Longitude and Latitude using Google maps v2 -

how longitude longitude of current phone location using google maps v2? i use method zoom on device place: googlemap.getuisettings().setmylocationbuttonenabled(true); now how coordinates? i know method area: double left = vr.latlngbounds.southwest.longitude; double top = vr.latlngbounds.northeast.latitude; ... you can center lat , lng values google maps via code latlng latlng = map.getcameraposition().target; double lat = latlng.latitude; double lng = latlng.longitude;

cassandra - Stream error during end-stage of decommission -

i got following exception during end-stage of node's decommission: exception in thread "main" java.lang.runtimeexception: java.util.concurrent.executionexception: org.apache.cassandra.streaming.streamexception: stream failed @ org.apache.cassandra.service.storageservice.unbootstrap(storageservice.java:2946) @ org.apache.cassandra.service.storageservice.decommission(storageservice.java:2903) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ sun.reflect.misc.trampoline.invoke(methodutil.java:75) @ sun.reflect.generatedmethodaccessor11.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @

c# - How to use stored procedure in EF by using uow pattern? -

i have interface name iunitofwork in datalayer : public interface iunitofwork { idbset<tentity> set<tentity>() tentity : class; int savechanges(); ilist<tentity> sqlqueries<tentity>( string _sql ) tentity : class; } and context : public class context : dbcontext, iunitofwork { public dbset<slider> myslider { get; set; } public new idbset<tentity> set<tentity>() tentity : class { return base.set<tentity>(); } public ilist<tentity> sqlqueries<tentity>( string _sql ) tentity : class { return base.database.sqlquery<tentity>(_sql).tolist(); // use 'tolist()' here or not?? } } and in service have: public interface islider { ilist<domainmodel.slider> slidergetall(); } and : public class slider:islider { iunitofwork _uow; idbset<domainmodel.slider> _slider; ilist<domainmodel.slid

linux - Connecting Windows to NAS - Samba server -

i trying connect windows 7 nas server (using samba on raspberry pi, running arch linux). i've clicked on "adding new network drive" -> \192.168.0.22\mnt\usb\data path external drive partition. there authentification window, i'm typing user , password samba knows. then there a few seconds waiting time windows computing/searching. got message says windows can not reach \192.168.0.22\mnt\usb\data on server: ps aux |grep sm root 1166 0.0 3.0 30464 5800 ? ss 11:16 0:00 /usr/bin/smbd -d root 1167 0.0 1.6 29948 3056 ? s 11:16 0:00 /usr/bin/smbd -d arkon 1189 0.0 0.3 2336 648 pts/0 s+ 11:20 0:00 grep sm my configuration file is: [global] workgroup = workgroup server string = samba server netbios name = arkonberry security = user guest account = user force user = user username map = /etc/samba/smbusers name resolve order = hosts wins bcast read = no #wins support = no [data] comment = pub

ios - Fetching recursive NSDictionaries and NSArray form JSON -

i new xcode , trouble find solution fetch nsarray , nsdictionaries json. please me. here json: [ { "categoryid": "1", "category_parentid": "0", "category_name_english": "telivision", "category_name_arabic": "واعتلاء ثم. حاول المضي عن أخر", "category_date_edited": "2013-02-16 06:55:02", "sub": [ { "categoryid": "2", "category_parentid": "1", "category_name_english": "sharp", "category_name_arabic": "واعتلاء ثم. حاول المضي عن أخر", "category_date_edited": "2013-02-16 06:55:02", "sub": [] }, { "categoryid": "5", "category_parentid

java - how do we get the span value -

below html code <div class="form-row"> <div class="label-column"> renewal charges</div> <div class="ctrl-column"> <span data-bind="html: displayyourrenewalcharges"> <span class="currencysymbol">usd</span> 95.00 </span> i want scrap renewal amount (i.e usd 95.00) my xpath: string renewalcharge = driver .findelement( by.xpath("//div[contains(@data-bind,'html: displayyourrenewalcharges')]")) .gettext(); my question value available in span class, above xpath not fetching value so please suggest how re-frame xpath, getting value try this. driver.findelement(by.xpath("//span[@data-bind='html: displayyourrenewalcharges']")).gettext()

c# - What is the correct way to create a single-instance application? -

using c# , wpf under .net (rather windows forms or console), correct way create application can run single instance? i know has mythical thing called mutex, can find bothers stop , explain 1 of these are. the code needs inform already-running instance user tried start second one, , maybe pass command-line arguments if existed. here article regarding mutex solution. approach described article advantageous 2 reasons. first, not require dependency on microsoft.visualbasic assembly. if project had dependency on assembly, advocate using approach shown in accepted answer. is, not use microsoft.visualbasic assembly, , i'd rather not add unnecessary dependency project. second, article shows how bring existing instance of application foreground when user tries start instance. that's nice touch other mutex solutions described here not address. update as of 8/1/2014, article linked above still active, blog hasn't been updated in while. makes me worry

asp.net mvc - @Html.Action post state model not doesn't affect partialview -

in bookscontroller [childactiononly] public actionresult commentform(int bookid) { var model = new commentsurrogate(); model.bookid = bookid; model.date = datetime.now; return partialview("_commentform", model); } [httppost] [childactiononly] public actionresult commentform(commentsurrogate model) { if (modelstate.isvalid) { if (session["commentsec"] string == model.securitycode) { model.date = datetime.now; commentrepository repo = new commentrepository(); repo.save(model); viewbag.commentmessage = "yorumunuz başarıyla kaydedilmiştir. editörlerimiz tarafından incelenip onaylandıktan sonra yayınlanacaktır."; return partialview("_commentform", new commentsurrogate {date = datetime.now, bookid= model.bookid }); } else mo

java - Counting rows sql table with jdbc -

i have trouble counting rows of sqltable. using query in ms studio works fine when try in java sql exception: connection con = null; statement stat = null; int result = 0; int i; try { con = drivermanager.getconnection("jdbc:sqlserver://localhost:1433;user=sa;password=123456; databasename=rpa;"); stat = con.createstatement(); result = stat.executeupdate("select count(*) rpa_users"); }catch (sqlexception e) { system.out.println("cannot connect!"); e.printstacktrace(); } { if (con != null) { try { con.close(); } catch (sqlexception e) { e.printstacktrace(); } } } return result; could explain me i'm doing wrong? in advance edit: nevermind found guys, usual help! solution if interested: result = stat.executequery("select count(*) /tablename/"); result.next(); rowc