Wednesday, 15 July 2015

django-compressor and nginx: 404 with compressed files -



django-compressor and nginx: 404 with compressed files -

what weird error. i'm doing wrong?

all files compressed django-compressor in cache folder homecoming 404. exist in filesystem , can downloaded via ftp. they're seen when access /static/ folder via browser, when seek access them, throw 404. happens no matter if compress_enabled false or true. permissions set 755.

regular css , js files homecoming 200 ok.

the problem nginx responded huge latency (i'm not sure why). looks tried access files did not exist. after amount of time (5-20 mins) became accessible. nginx - or caching - not configured properly.

django nginx django-compressor

Spring Boot Rest Controller how to return different HTTP status codes? -



Spring Boot Rest Controller how to return different HTTP status codes? -

i using spring boot simple rest api , homecoming right http statuscode if fails.

@requestmapping(value="/rawdata/", method = requestmethod.put) @responsebody @responsestatus( httpstatus.ok ) public restmodel create(@requestbody string data) { // code ommitted.. // how homecoming right status code if fails? }

being new spring , spring boot, basic question how homecoming different status codes when ok or fails?

there several options can use. quite way utilize exceptions , class handling called @controlleradvice:

@controlleradvice class globalcontrollerexceptionhandler { @responsestatus(httpstatus.conflict) // 409 @exceptionhandler(dataintegrityviolationexception.class) public void handleconflict() { // nil } }

also can pass httpservletresponse controller method , set response code:

public restmodel create(@requestbody string data, httpservletresponse response) { // code ommitted.. response.setstatus(httpservletresponse.sc_accepted); }

please refer great blog post details: http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc

note: in spring boot using @responsebody annotation redundant - it's included in @restcontroller

spring rest spring-boot

c# - Command Binding works in designer/VS, but not build/release -



c# - Command Binding works in designer/VS, but not build/release -

i may overlooking obvious here, can't see life of me right now.

i've got interaction on user command (data grid) has item source bound icollectionview, datacontext inherited parent window:

<datagrid margin="0" itemssource="{binding itemsview}" autogeneratecolumns="false" isreadonly="true" selecteditem="{binding selecteditem, mode=twoway}"> <datagrid.columns> .... </datagrid.columns> <i:interaction.triggers> <i:eventtrigger eventname="mousedoubleclick"> <i:invokecommandaction command="{binding onnotifypeg}"/> </i:eventtrigger> </i:interaction.triggers> </datagrid>

the datacontext inherited parent window, has tabbed view:

<window x:class="configbrowser.views.configview" datacontext="{binding configviewmodel, source={staticresource locator}}"> <grid background="{dynamicresource {x:static systemcolors.controllightbrushkey}}"> <tabcontrol height="auto" width="auto" background="{dynamicresource {x:static systemcolors.controllightbrushkey}}"> <tabitem header="overview"> <controls:overview/> </tabitem>

for now, onnotifypeg command opens window (via service, messagebox debug now)

public icommand onnotifypeg { { homecoming new delegatecommand(notifypeg); } } public void notifypeg() { messagebox.show("notify peg", "clicked"); _detailservice.viewpeg(selecteditem); }

whilst running within visual studio, works fine - uc fires off command.

but when run debug or release folders, nil happens. no error, no window, nil - far can tell, it's not bound in built application?

edit: add, columns still load info fine itemsource (which uses info context).

edit 2: if move info grid out of user command , set tab directly, it's doing same behaviour. don't think it's related that.

edit 3: solved in comments - looks costura fails @ embedding system.windows.interactivity.

you have add together reference of system.windows.interactivity , utilize eventtrigger

c# wpf mvvm simple-mvvm

playframework 2.3 - Anorm's Row object no longer exists in Play 2.3 -



playframework 2.3 - Anorm's Row object no longer exists in Play 2.3 -

after upgrading play 2.3.0 compilation error on object row

not found: value row

i noticed row object no longer exists in play 2.3.0 (i've found row trait). looking @ documentation, pattern matching should still supported in play 2.3

http://www.playframework.com/documentation/2.3.x/scalaanorm

see "using pattern matching" paragraph

here's code:

def findbyid(aid: long) = { db.withconnection { implicit conn => sql(byidstmt).on("id" -> aid)().map { case row(id:integer, some(userid:string), some(description:string), some(solrcriteria:string), some(solrcriteriahash:string), some(hits:integer), some(lastperformedutc:java.sql.timestamp), some(notify:boolean) ) => new userinquiry(id.tolong, userid, description, solrcriteria, solrcriteriahash, hits, lastperformedutc, notify) }.head } }

how solve that?

as said, pattern matching restored on play master https://github.com/playframework/playframework/pull/3049 .

anorm playframework-2.3

wmi - Invalid method parameters when trying to call RequestRefresh from C# to SCCM server -



wmi - Invalid method parameters when trying to call RequestRefresh from C# to SCCM server -

i'm trying phone call requestrefresh function against sms_collection anytime new device added sccm through our application. when phone call execute next exception.

main: unrecoverable service error.|system.management.managementexception invalid method parameter(s) @ system.management.managementexception.throwwithextendedinfo(managementstatus errorcode) @ system.management.managementobject.invokemethod(string methodname, managementbaseobject inparameters, invokemethodoptions options) @ sccmproxy.adapter.refreshcollection(string collectionname) in c:\ws\development\sccmagent\main\sccmproxy\sccmproxy\adapter.cs:line 733 @ sccmproxy.testhelper.executetest(proxyconfiguration config) in c:\ws\development\sccmagent\main\sccmproxy\sccmproxy\testhelper.cs:line 144 @ sccmproxy.service.main() in c:\ws\development\sccmagent\main\sccmproxy\sccmproxy\service.cs:line 134 void throwwithextendedinfo(system.management.managementstatus)

here code

managementpath pathmethod = new managementpath("sms_collection"); using (managementclass processclass = new managementclass(this.configuration.newtargetscope, pathmethod, null)) { managementbaseobject inparams = processclass.getmethodparameters("requestrefresh"); using (managementbaseobject outparams = processclass.invokemethod("requestrefresh", inparams, null)) { logger.info(methodbase.getcurrentmethod().name, "successful collection refresh: {0}", outparams["returnvalue"]); } }

the problem when phone call getmethodparameters returns object parameter called "includesubcollections" valid 2007 sccm i'm using 2012 sccm , requestrefresh method doesn't utilize parameter anymore. how getmethodcall returning old function parameter when have pointing new 2012 sccm instance?

i couldn't above code work able phone call requestrefresh via wql using illustration http://msdn.microsoft.com/en-us/library/hh949402.aspx

public void refreshcollection(wqlconnectionmanager connection, string collectionid) { iresultobject collection = connection.getinstance(string.format("sms_collection.collectionid='{0}'", collectionid)); collection.executemethod("requestrefresh", null); }

c# wmi sccm

vim - UltiSnips not completing all the placeholders -



vim - UltiSnips not completing all the placeholders -

how write simple snippet placeholder value replaced @ both places.

snippet test "test struct" type ${1} struct { id string } func (p *${1}) id() string { homecoming p.id } endsnippet

so when type test<tab>, needs prompt entering 1 value results in (if come in xyz)

type xyz struct { id string } func (p *xyz) id() string { homecoming p.id }

there conflict other plugins in system, when trigger snippet, cursor moves sec placeholder (at func (p *${1}) id() string {), , never completes first one.

remove braces around sec {1} (and, maybe, add together default text first placeholder pointed out ingo karkat):

snippet test "test struct" type ${1:foo} struct { id string } func (p *$1) id() string { homecoming p.id } endsnippet

vim ultisnips

Drag and Drop between different tables using jquery? -



Drag and Drop between different tables using jquery? -

i not able drag , drop images 'table a' 'table b'. using sortable api dragging , dropping, problem 1 time dropped 'table a' 'table b' cannot drag , drop 'table a' table b'. can please help? here sample code...

$( "tbody.table1" ).sortable({ connectwith: ".table1a", items: "> tr td", appendto: table2, helper:"clone", start: function(){ $table1b.addclass("dragging") }, stop: function(){ $table1a.removeclass("dragging") } }) .disableselection(); $( ".table1a",".table1b" ).droppable({ accept: ".table1b tr td" }, drop: function( event, ui ) { homecoming false; } });

below sample code demonstrating drag , drop between 2 lists:

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>demo</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <script type="text/javascript"> $(function () { $(".list1, .list2").sortable({ connectwith: ".sortable" }); }); </script> <style> .sortable { list-style-type: none; list-style-position: inside;margin: 0px 12px 8px 0px; width: 60%; padding: 2px; border-width: 1px; border-style: solid; min-height: 100px;} .sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1em; height: 18px; border: 2px dashed #d3d3d3 ; background-color: #eee } </style> <div> <div"> <ul class="list1 sortable"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> </ul> </div> <div> <ul class="list2 sortable"> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> </ul> </div> </div> </body> </html>

hope help sort out issue.

click here check code implemented in jsfiddle.

jquery jquery-ui

javascript - Multipart issues with chunking -



javascript - Multipart issues with chunking -

i trying setup test implementation of fineuploader, running problem chunking. have debug set true, , seems going great until end of process next errors:

"[fine uploader 5.0.2] chunks have been uploaded 0 - finalizing...." custom.fineuploader-5.0.2.js:207 "[fine uploader 5.0.2] submitting chunks done request 0" custom.fineuploader-5.0.2.js:207 "[fine uploader 5.0.2] sending post request 0" custom.fineuploader-5.0.2.js:207 "[fine uploader 5.0.2] received response status 200 body: {"error":"server error. not multipart request. please set forcemultipart default value (true).","uploadname":null,"template":"undefined","category":"undefined"}" custom.fineuploader-5.0.2.js:207 "[fine uploader 5.0.2] finalize successful 0"

the bottom error says "server error. not multipart request. please set forcemultipart default value (true).", far can tell code setup way already. here have in code it:

var uploadhandler = $('#fine-uploader').fineuploader({ debug: true, request: { endpoint: 'server/endpoint.php', forcemultipart: true, params: // send values backend file (endpoint.php) { template:function() { homecoming $("#price_template_id").val(); }, category:function(){ homecoming $("#category_id").val(); } } }, validation: { // validation images uploaded allowedextensions: ['jpeg', 'jpg'], sizelimit: 20971520 // 20 mb = 20 * 1024 * 1024 bytes 20971520 }, editfilename: { enabled: true }, display: { //display image on upload filesizeonsubmit: true }, resume: { //enable resume on upload enabled: true }, retry: { //enable retry on upload enableauto: true }, forcemultipart: { enabled: true }, chunking: { //enable chunking on upload concurrent: { enabled: true }, enabled: true, partsize: 200000, //200kb per chunk success: { endpoint: 'server/endpoint.php' } }, template: "qq-template", autoupload: true, showmessage: function(message) { //show message if error occur during uplaod process alert(message); } })

you can see/test implementation here: http://web3.instaproofs.com/temp/fineuploaderv3/

any ideas on doing wrong this?

thanks!

your server not handling "all chunks done" post request. not multipart encoded request. sent fine uploader after lastly chunk has been uploaded server. post contains url-encoded message-body info completed chunked file. server should combine chunks associated file , respond appropriately. more info @ http://docs.fineuploader.com/branch/master/features/concurrent-chunking.html#server-side-implications.

javascript file-upload fine-uploader

multithreading - How to implement a List(of Task) functions as a queue? (VB.NET) -



multithreading - How to implement a List(of Task) functions as a queue? (VB.NET) -

as simple can:

multi-thread wpf window app. all threads query single device via ssh. device can have multiple same-users, io stack won't allow app (obviously).

trying inquire 'legal' way:

how can create queue (fifo) of tasks/actions each homecoming string function?

2014-06-21 update

this now. can create tasks on concurrentqueue.

the issue remains how modify allow task created/called, task set fifo queue, , tasks's result (string) returned variable called it, like:

dim result = task...("the command")...

the below foundation testing ways (compiles & runs):

dim tcq new concurrentqueue(of task) sub main() ' simulates programme calls enqueue tasks on tcq: = 1 20 tcq.enqueue(gettask(date.now.tolongtimestring & " - command number " & i)) next ' normally, tcq watched in loop while tcq.count > 0 dim tsk task = nil tcq.trydequeue(tsk) tsk.wait() console.writeline(date.now.tolongtimestring & " [" & tsk.id & "] post-wait(): " & tsk.id & " tcq.count: " & tcq.count) loop console.writeline("done.") console.readline() end sub

this next function creates task command string in it...

function gettask(commandstring string) task(of string) dim t task(of string) = nil dim cts new cancellationtokensource() dim ct cancellationtoken = cts.token seek t = task(of string).factory.startnew(function() homecoming getcommandresults(commandstring, ct) end function, ct, taskcreationoptions.longrunning) t.wait() console.writeline("gettask.id: " & t.id & " result: " & t.result) grab ex exception console.writeline("caught exception: " & ex.tostring) end seek homecoming t end function

this function sending command device, , storing response string well...

function getcommandresults(thecommand string, ct cancellationtoken) string console.writeline(string.format("--> starting getcommandresults({0})", thecommand)) thread.sleep(2000) console.writeline(string.format("<-- done getcommandresults({0})", thecommand)) homecoming string.format(date.now.tolongtimestring & " - getcommandresults returned {0}", thecommand) end function

and yields:

[main()] before creating tasks --> starting getcommandresults(8:14:38 pm - command number 1) <-- done getcommandresults(8:14:38 pm - command number 1) gettask.id: 1 result: 8:14:40 pm - getcommandresults returned 8:14:38 pm - command number 1 --> starting getcommandresults(8:14:40 pm - command number 2) <-- done getcommandresults(8:14:40 pm - command number 2) gettask.id: 2 result: 8:14:42 pm - getcommandresults returned 8:14:40 pm - command number 2 --> starting getcommandresults(8:14:42 pm - command number 3) <-- done getcommandresults(8:14:42 pm - command number 3) gettask.id: 3 result: 8:14:44 pm - getcommandresults returned 8:14:42 pm - command number 3 [...]

so if had write out logically:

a string variable prepared output of created task, using command string. the string command set concurrentqueue. when task dequeued concurrentqueue, run, , result of command returned calling variable.

so, i'm looking way this, described above synchronous queue:

dim result string = await task.factory.startnew(function() dim r string = functionthatreturnsstring() homecoming r end function)

...except can't seem stop tasks executing created...

hope update helps!

no improve way propose solution. since there hasn't been action on (no points tough question, even), hope moderators other way inquire how made better-but without question marks!

to sum solution effort up:

the caller either creates or uses singleton jobqsingleton().

the caller uses q creating unique guid (for looking results later), , job string:

dim jobid guid = guid.newguid dim mycommand string = "command job #" & i

the caller creates job() instance, loads above params, , submits q:

dim j job = new job() j.callerjobid = jobid j.command = mycommand j.callername = "caller #" & thejobq.jobrequest(j)

lastly, caller waits on result calling getjobresultasync() on thejobq, using guid supplied job when submitted 'index', if will, locate results:

dim jobresult string = thejobq.getjobresultasync(callerjobid).result

the working illustration here, leaves many questions in mind, big 1 beingness whether putting tasks on queue qould better, la:

dim t new task(addressof me.takefromqloop, ct, taskcreationoptions.longrunning) ...add queue; when time, pull off queue and... t.start()

for discussion: cannot find way maintain tasks attached callers pass into/out of q. doing might lot less convoluted. hinted @ in op.

luckily, wrote test/use case in 1 module easy copy/pasting. works in vs2012:

imports system.collections.concurrent module module1 dim thejobq jobqsingleton ' sub main() thejobq = jobqsingleton.getinstance ' 1 class can work (serially/synchronously) ' ' step 1: create jobs ' dim joblist new concurrentqueue(of job) ' each client comes own guid later retriece job's results dim jobidlist new concurrentqueue(of guid) ' list holds guid, can iterate @ end , results = 1 10 dim jobid guid = guid.newguid dim mycommand string = "command job #" & console.writeline("[{0}] callerjobid: {1} command: {2}", i, jobid.tostring, mycommand) joblist.enqueue(new job() {.callerjobid = jobid, .command = mycommand, .callername = "caller #" & i}) jobidlist.enqueue(jobid) next ' ' step 2: submit requests ' threading.thread.sleep(1000) each jreq job in joblist if joblist.trydequeue(jreq) thejobq.jobrequest(jreq) end if console.writeline("[{2}] {0} added {1} q via .jobrequest", jreq.callername, jreq.callerjobid, joblist.count) next ' ' step 3: results (using retrieveq created before copying joblist) ' each clientjobid guid in jobidlist '.reverse ' simulates our clients' provided guids dim jobresult string = getworkresult(clientjobid) console.writeline("result of client jobid: {0} is: ""{1}""", clientjobid, jobresult, jobidlist.count) next console.writeline("done.") console.readline() end sub ' ' step 3a: ' public function getworkresult(callerjobid guid) string dim r string = "" r = thejobq.getjobresultasync(callerjobid).result homecoming r end function ' '======================================================================== ' ' jobq() ' public class jobqsingleton #region "class vars" ' singleton instance shared myinstance jobqsingleton ' requests private q new concurrentqueue(of job) ' results private resultsdictionary new concurrentdictionary(of guid, job) private doqloop boolean #end part #region "constructor" private sub new() me.doqloop = true me.startloop() end sub public shared function getinstance() jobqsingleton if isnothing(myinstance) myinstance = new jobqsingleton end if homecoming myinstance end function private sub startloop() dim cts new threading.cancellationtokensource dim ct threading.cancellationtoken = cts.token ' (a) .start(): 'dim t new task(addressof me.takefromqloop, ct, taskcreationoptions.longrunning) 't.start() ' (b) simple addressof: dim t task = task.factory.startnew(addressof me.takefromqloop, ct, taskcreationoptions.longrunning) ' console.writeline("loop started") end sub #end part #region "(public) submit/retrieve jobs" '======================================================= ' ' step 2a: add together guid internal use/deugging ' public sub jobrequest(ajobrequest job) ajobrequest .qjobid = guid.newguid ' our internal id end me.addjob(ajobrequest) end sub public async function getjobresultasync(byval jobid guid) task(of string) homecoming await task.run(of string)(function() getjobresult(jobid)) end function ' ' callers phone call 1 of above 2 either give job, or results ' '======================================================= private function getjobresult(jobid guid) string until me.resultsdictionary.containskey(jobid) threading.thread.sleep(250) loop homecoming me.resultsdictionary.item(jobid).response end function #end part private sub addjob(j job) q.enqueue(j) end sub private sub takefromqloop() while (me.doqloop) dim j new job if q.trypeek(j) = true if q.trydequeue(j) = true j console.writeline("===> start job id {0} caller {1}", .callerjobid, .callername) threading.thread.sleep(1000) j.response = string.format("the result of command {0} {1}", j.command, date.now.tolongtimestring) if me.resultsdictionary.tryadd(j.callerjobid, j) console.writeline("<=== stop job id {0} caller {1}", .callerjobid, .callername) else console.writeline("...error...") end if end end if end if threading.thread.sleep(1000) end while end sub end class ' ' holds job & results... ' public class job public property jobname string public property qjobid guid public property callername string public property callerjobid guid public property command string public property response string end class end module

output (not using .reverse alternative commented out above)

loop started [1] callerjobid: d4a1f479-1d27-4b2f-8d9c-5db1fbacf906 command: command job #1 [2] callerjobid: 06a4a886-4054-426b-b963-88e54d4aeda7 command: command job #2 [3] callerjobid: 1415bb08-607c-4bf0-9b28-a1f33eb24c33 command: command job #3 [4] callerjobid: 18568325-ce4e-4ece-aeff-4f03b20567bf command: command job #4 [5] callerjobid: adaffd34-8c76-48eb-a9e3-dbbf3d7cfd1f command: command job #5 [6] callerjobid: fabc4ae2-681c-44fa-be83-24c185fc6a54 command: command job #6 [7] callerjobid: 7532a8f8-8f97-471a-914b-e1dd9cc88f29 command: command job #7 [8] callerjobid: 433338db-94d3-41c1-a003-f883a57059ca command: command job #8 [9] callerjobid: b1a47e95-c48c-4b36-b6eb-1c582148d564 command: command job #9 [10] callerjobid: 63707629-2140-431b-a91f-13f0b8a37239 command: command job #10 [9] caller #1 added d4a1f479-1d27-4b2f-8d9c-5db1fbacf906 q via .jobrequest [8] caller #2 added 06a4a886-4054-426b-b963-88e54d4aeda7 q via .jobrequest [7] caller #3 added 1415bb08-607c-4bf0-9b28-a1f33eb24c33 q via .jobrequest [6] caller #4 added 18568325-ce4e-4ece-aeff-4f03b20567bf q via .jobrequest [5] caller #5 added adaffd34-8c76-48eb-a9e3-dbbf3d7cfd1f q via .jobrequest [4] caller #6 added fabc4ae2-681c-44fa-be83-24c185fc6a54 q via .jobrequest [3] caller #7 added 7532a8f8-8f97-471a-914b-e1dd9cc88f29 q via .jobrequest [2] caller #8 added 433338db-94d3-41c1-a003-f883a57059ca q via .jobrequest [1] caller #9 added b1a47e95-c48c-4b36-b6eb-1c582148d564 q via .jobrequest [0] caller #10 added 63707629-2140-431b-a91f-13f0b8a37239 q via .jobrequest ===> start job id d4a1f479-1d27-4b2f-8d9c-5db1fbacf906 caller caller #1 <=== stop job id d4a1f479-1d27-4b2f-8d9c-5db1fbacf906 caller caller #1 result of client jobid: d4a1f479-1d27-4b2f-8d9c-5db1fbacf906 is: "the result of command command job #1 7:27:41 pm" ===> start job id 06a4a886-4054-426b-b963-88e54d4aeda7 caller caller #2 <=== stop job id 06a4a886-4054-426b-b963-88e54d4aeda7 caller caller #2 result of client jobid: 06a4a886-4054-426b-b963-88e54d4aeda7 is: "the result of command command job #2 7:27:43 pm" ===> start job id 1415bb08-607c-4bf0-9b28-a1f33eb24c33 caller caller #3 <=== stop job id 1415bb08-607c-4bf0-9b28-a1f33eb24c33 caller caller #3 result of client jobid: 1415bb08-607c-4bf0-9b28-a1f33eb24c33 is: "the result of command command job #3 7:27:45 pm" ===> start job id 18568325-ce4e-4ece-aeff-4f03b20567bf caller caller #4 <=== stop job id 18568325-ce4e-4ece-aeff-4f03b20567bf caller caller #4 result of client jobid: 18568325-ce4e-4ece-aeff-4f03b20567bf is: "the result of command command job #4 7:27:47 pm" ===> start job id adaffd34-8c76-48eb-a9e3-dbbf3d7cfd1f caller caller #5 <=== stop job id adaffd34-8c76-48eb-a9e3-dbbf3d7cfd1f caller caller #5 result of client jobid: adaffd34-8c76-48eb-a9e3-dbbf3d7cfd1f is: "the result of command command job #5 7:27:49 pm" ===> start job id fabc4ae2-681c-44fa-be83-24c185fc6a54 caller caller #6 <=== stop job id fabc4ae2-681c-44fa-be83-24c185fc6a54 caller caller #6 result of client jobid: fabc4ae2-681c-44fa-be83-24c185fc6a54 is: "the result of command command job #6 7:27:51 pm" ===> start job id 7532a8f8-8f97-471a-914b-e1dd9cc88f29 caller caller #7 <=== stop job id 7532a8f8-8f97-471a-914b-e1dd9cc88f29 caller caller #7 result of client jobid: 7532a8f8-8f97-471a-914b-e1dd9cc88f29 is: "the result of command command job #7 7:27:53 pm" ===> start job id 433338db-94d3-41c1-a003-f883a57059ca caller caller #8 <=== stop job id 433338db-94d3-41c1-a003-f883a57059ca caller caller #8 result of client jobid: 433338db-94d3-41c1-a003-f883a57059ca is: "the result of command command job #8 7:27:55 pm" ===> start job id b1a47e95-c48c-4b36-b6eb-1c582148d564 caller caller #9 <=== stop job id b1a47e95-c48c-4b36-b6eb-1c582148d564 caller caller #9 result of client jobid: b1a47e95-c48c-4b36-b6eb-1c582148d564 is: "the result of command command job #9 7:27:57 pm" ===> start job id 63707629-2140-431b-a91f-13f0b8a37239 caller caller #10 <=== stop job id 63707629-2140-431b-a91f-13f0b8a37239 caller caller #10 result of client jobid: 63707629-2140-431b-a91f-13f0b8a37239 is: "the result of command command job #10 7:27:59 pm" done.

...and time with .reverse uncommented:

loop started [1] callerjobid: 596de3ee-04e2-49dd-aaeb-e4a2aa41c90a command: command job #1 [2] callerjobid: cbf0ab0d-5637-4708-837b-3bf7d605f6e1 command: command job #2 [3] callerjobid: d8ba30c6-7729-4f91-8d86-51dfbf3b4b3f command: command job #3 [4] callerjobid: 292d6212-de33-471a-9fdc-dad8b4bef4d4 command: command job #4 [5] callerjobid: 992af5e4-a713-400c-9792-578ac39c6879 command: command job #5 [6] callerjobid: f87a09fa-8cba-4d56-9658-567f0ef6d63e command: command job #6 [7] callerjobid: fc7a1f0c-1a75-44ce-93bf-dc80d6c810c7 command: command job #7 [8] callerjobid: 01d6af2c-5998-4b38-9244-006e9e12f309 command: command job #8 [9] callerjobid: cae99dd9-e7e2-4614-be5b-a75d944e27bd command: command job #9 [10] callerjobid: 3f02a3bb-5667-48fb-ab22-df8d951b2b13 command: command job #10 [9] caller #1 added 596de3ee-04e2-49dd-aaeb-e4a2aa41c90a q via .jobrequest [8] caller #2 added cbf0ab0d-5637-4708-837b-3bf7d605f6e1 q via .jobrequest [7] caller #3 added d8ba30c6-7729-4f91-8d86-51dfbf3b4b3f q via .jobrequest [6] caller #4 added 292d6212-de33-471a-9fdc-dad8b4bef4d4 q via .jobrequest [5] caller #5 added 992af5e4-a713-400c-9792-578ac39c6879 q via .jobrequest [4] caller #6 added f87a09fa-8cba-4d56-9658-567f0ef6d63e q via .jobrequest [3] caller #7 added fc7a1f0c-1a75-44ce-93bf-dc80d6c810c7 q via .jobrequest [2] caller #8 added 01d6af2c-5998-4b38-9244-006e9e12f309 q via .jobrequest [1] caller #9 added cae99dd9-e7e2-4614-be5b-a75d944e27bd q via .jobrequest [0] caller #10 added 3f02a3bb-5667-48fb-ab22-df8d951b2b13 q via .jobrequest ===> start job id 596de3ee-04e2-49dd-aaeb-e4a2aa41c90a caller caller #1 <=== stop job id 596de3ee-04e2-49dd-aaeb-e4a2aa41c90a caller caller #1 ===> start job id cbf0ab0d-5637-4708-837b-3bf7d605f6e1 caller caller #2 <=== stop job id cbf0ab0d-5637-4708-837b-3bf7d605f6e1 caller caller #2 ===> start job id d8ba30c6-7729-4f91-8d86-51dfbf3b4b3f caller caller #3 <=== stop job id d8ba30c6-7729-4f91-8d86-51dfbf3b4b3f caller caller #3 ===> start job id 292d6212-de33-471a-9fdc-dad8b4bef4d4 caller caller #4 <=== stop job id 292d6212-de33-471a-9fdc-dad8b4bef4d4 caller caller #4 ===> start job id 992af5e4-a713-400c-9792-578ac39c6879 caller caller #5 <=== stop job id 992af5e4-a713-400c-9792-578ac39c6879 caller caller #5 ===> start job id f87a09fa-8cba-4d56-9658-567f0ef6d63e caller caller #6 <=== stop job id f87a09fa-8cba-4d56-9658-567f0ef6d63e caller caller #6 ===> start job id fc7a1f0c-1a75-44ce-93bf-dc80d6c810c7 caller caller #7 <=== stop job id fc7a1f0c-1a75-44ce-93bf-dc80d6c810c7 caller caller #7 ===> start job id 01d6af2c-5998-4b38-9244-006e9e12f309 caller caller #8 <=== stop job id 01d6af2c-5998-4b38-9244-006e9e12f309 caller caller #8 ===> start job id cae99dd9-e7e2-4614-be5b-a75d944e27bd caller caller #9 <=== stop job id cae99dd9-e7e2-4614-be5b-a75d944e27bd caller caller #9 ===> start job id 3f02a3bb-5667-48fb-ab22-df8d951b2b13 caller caller #10 <=== stop job id 3f02a3bb-5667-48fb-ab22-df8d951b2b13 caller caller #10 result of client jobid: 3f02a3bb-5667-48fb-ab22-df8d951b2b13 is: "the result of command command job #10 7:30:12 pm" result of client jobid: cae99dd9-e7e2-4614-be5b-a75d944e27bd is: "the result of command command job #9 7:30:10 pm" result of client jobid: 01d6af2c-5998-4b38-9244-006e9e12f309 is: "the result of command command job #8 7:30:08 pm" result of client jobid: fc7a1f0c-1a75-44ce-93bf-dc80d6c810c7 is: "the result of command command job #7 7:30:06 pm" result of client jobid: f87a09fa-8cba-4d56-9658-567f0ef6d63e is: "the result of command command job #6 7:30:04 pm" result of client jobid: 992af5e4-a713-400c-9792-578ac39c6879 is: "the result of command command job #5 7:30:02 pm" result of client jobid: 292d6212-de33-471a-9fdc-dad8b4bef4d4 is: "the result of command command job #4 7:30:00 pm" result of client jobid: d8ba30c6-7729-4f91-8d86-51dfbf3b4b3f is: "the result of command command job #3 7:29:58 pm" result of client jobid: cbf0ab0d-5637-4708-837b-3bf7d605f6e1 is: "the result of command command job #2 7:29:56 pm" result of client jobid: 596de3ee-04e2-49dd-aaeb-e4a2aa41c90a is: "the result of command command job #1 7:29:54 pm" done.

p.s. yes, did utilize terms 'job' , 'work' , 'request' synonymously... was/is frankenstein... p.s.s. did not include deleting dictionary entries contain solutions 1 time 'picked up'... not until peer feedback tidy things up...

i'm not allowed end solution post question mark, have imagine there...

vb.net multithreading

android - Trouble signing apk with desired certificate -



android - Trouble signing apk with desired certificate -

i have certificate signing app when file -> export. when install apk way, works. however, when run app off eclipse while phone plugged in, not. beingness signed certificate.

how can eclipse sign apk same certificate used when exporting apk?

this person has exact same problem me, no reply either...

you right, it's signed other certificate, it's using ~/.android/debug.keystore. don't know much eclipse in android-studio new build scheme (gradle) easy switch between signing certificates within different variants of app (e.g. debug/relese combinations free/premium). don't know if work, maybe replace in users directory debug.keystore own?

android eclipse google-play-services

Excel VBA import of various excel files to master sheet -



Excel VBA import of various excel files to master sheet -

i have master excel workbook , want create macro import info specified range 7 excel files. these files same in construction except actual data. import macro/button want open files dialogue, select files , allow macro add together info in range master 1 one. have taken inspiration post here, makes work 1 single file: adjusted code have able select 7 files , dynamically add together target range 1 one.

sub getdata() dim slavebook workbook dim filter string dim caption string dim slavefilename string dim slaveworkbook workbook dim targetworkbook workbook set targetworkbook = application.activeworkbook filter = "team file (*.xlsm),*.xlsm" caption = "please select team file" slavefilename = application.getopenfilename(filter, , caption) set slaveworkbook = application.workbooks.open(slavefilename) dim targetsheet worksheet set targetsheet = targetworkbook.worksheets("master") dim sourcesheet worksheet set sourcesheet = slaveworkbook.worksheets("interface") targetsheet.range("b5", "j8").value = sourcesheet.range("b5", "j8").value slaveworkbook.close end sub

sub getdata() dim slavebook workbook dim filter string dim caption string dim slavefilename string dim slaveworkbook workbook dim targetworkbook workbook = 1 = 1 7 set targetworkbook = application.activeworkbook on error goto errorhandler filter = "team file (*.xlsm),*.xlsm" caption = "please select team file" slavefilename = application.getopenfilename(filter, , caption) set slaveworkbook = application.workbooks.open(slavefilename) on error goto 0 on error goto err2 dim targetsheet worksheet set targetsheet = targetworkbook.worksheets("master") dim sourcesheet worksheet set sourcesheet = slaveworkbook.worksheets("interface") if = 1 targetsheet.range("b5", "j8").value = sourcesheet.range("b5", "j8").value if = 2 targetsheet.range("b9", "j12").value = sourcesheet.range("b5", "j8").value if = 3 targetsheet.range("b13", "j16").value = sourcesheet.range("b5", "j8").value if = 4 targetsheet.range("b17", "j20").value = sourcesheet.range("b5", "j8").value if = 5 targetsheet.range("b21", "j24").value = sourcesheet.range("b5", "j8").value if = 6 targetsheet.range("b25", "j28").value = sourcesheet.range("b5", "j8").value if = 7 targetsheet.range("b29", "j32").value = sourcesheet.range("b5", "j8").value slaveworkbook.close false 'wont prompt save changes (will close without saving), 'remove false if need save changes = + 1 next exit sub errorhandler: msgbox "you didn't select valid file!" exit sub err2: msgbox "error - reason required sheet not found in slave workbook" exit sub end sub

updated - have changed code should save info "master" sheet underneath eachother. simple way of doing it, , restricts opening 7 files before code ends. if wanted add together more in future extend array , range code or modify range code lastly available row paste info on (lastrow = range("j65536").end(xlup).row) place start

excel excel-vba import

javascript - ul li selector doesn't work -



javascript - ul li selector doesn't work -

i have issue using jquery. have content have become visible when click on ul li in navigation.

but i'm missing something, when click, nil happens. not sure why happens. please take @ provided fiddle near bottom

here code:

$(document).ready(function(){ $("ul.topnav > li.one").click(function() { $('.content').hide(500).fadeout(400); if ($(this).next().is(':hidden') == true) { $(this).next().show(400).fadein(500); } }); $('.content').hide(); }); class="lang-html prettyprint-override"><ul class="topnav"> <li class="one"><a href="#">test</a></li> <li>second</li> </ul> <div class="content">some content here</div>

here fiddle http://jsfiddle.net/2pbge/

here go

http://jsfiddle.net/mc92m/1/

$(document).ready(function(){ $("li.one").on("click", function() { $('.content').fadeout(400); if ($('.content').is(':hidden')) { $('.content').fadein(500); } }); $('.content').hide(); });

when used .next() targeting sec li, not content div nil shows or hides. removed .hide , .show have fade in/out

if want utilize .next() have

$(document).ready(function(){ $(".topnav").on("click", function(e) { if( $(e.target).parent().is('li.one') ) { $(this).next().toggle(); } }); $('.content').hide(); });

javascript jquery

c# - Equivalent of fflush(stdout)? -



c# - Equivalent of fflush(stdout)? -

i have long loop, prints out many lines of information. maintain 1 line overwrites previous lines. tried console.out.flush() not seem work.

use

console.setcursorposition

to cursor @ use

console.cursorleft console.cursortop

example

int = 0; console.writeline("numbers count below line"); int cleft = console.cursorleft; int ctop = console.cursortop; while (true) { console.setcursorposition(cleft, ctop); console.writeline(i); i++; }

c# console fflush

html - Why does this div have margin -



html - Why does this div have margin -

http://jsfiddle.net/6cqut/

in illustration above, logo has right margin , can't set menu near without resizing it(it should 100x100) or beingness pushed under it. did margin came , how can rid of it?

code requested.

<body> <div id="header"> <div id="logo">logo</div> <div id="menu">menu</div> </div> <div id="cont">under</div> </body> #header { width:200px; height:100px; outline:solid 1px black; } #logo { display:inline-block; width:100px; height:100px; outline:solid 1px black; } #menu { display:inline-block; width:96px; height:96px; outline:solid 1px black; } #cont { outline:solid 1px black; width:200px; height:300px; }

as mentionned in comments, dealing white-space coming html code when set element inline-boxes.

there s many ways, , 1 illustration provided remove code . logo</div><div id="menu" shown here : http://jsfiddle.net/6cqut/2/

but best, guess link tutorials understand going on (links picked search engine :) ):

http://css-tricks.com/fighting-the-space-between-inline-block-elements/

http://davidwalsh.name/remove-whitespace-inline-block

how remove space between inline-block elements?

html css

templates - Wordpress multiple pages to show posts -



templates - Wordpress multiple pages to show posts -

i don't have code or pages show yet i'll have describe question.

i have grouping of post in wordpress, no categories or taxnomoy yet.

on home page have 'view posts' link linked view_all_post.php page.

on view_all_posts.php page have simple loop shows posts.

i want show 10 posts on view_all_posts.php page , have rest of posts on next page linked on view_all_posts page.

so view_all_posts show 10 post , have links show next page rest of links on, have links next page if there more posts show.

i know how limit number of post - post_per_page

my problem how create pages rest of posts.

i'm sure don't create view_all_post page because don't know how many post there , won't dynamic.

is there template page should using single.php show actual posts.

in short, need pagination of posts in word-press. check useful function word press.

<?php echo paginate_links( $args ); ?>

see finish refrence

wordpress templates

javascript - Trying to change HTML with Jquery -



javascript - Trying to change HTML with Jquery -

this question has reply here:

creating multiline strings in javascript 30 answers

i'm trying alter html code using jquery. when utilize code works:

$('.theclass').html('hello');

but want include statemente in html. tried not work.

$('.theclass').html( "<select name='myname' id='myid'> <option value=''>-</option> <option value='a'>a</option> <option value='b'>b</option> </select>" );

any help? thanks

try concatenate strings when string input exceeds out newer line,

$('.typehidden .controls').html( "<select name='myname' id='myid'>" + "<option value=''>-</option>" + "<option value='a'>a</option>" + "<option value='b'>b</option>" + "</select>" );

javascript jquery html

Using curl to execute an HTML page on the file system -



Using curl to execute an HTML page on the file system -

i have html file acting test runner. when rendered in chrome or other browser page loads , executes needed javascript.

how same behavior using curl?

currently have command, curl "file:///c:/bb/shenanigan-api-html5/shenanigan.html" --compressed returns html source , doesn't execute page.

curl transfers info not have ability run javascript. utilize phantomjs has command line options, can read local html files , interacts javascript.

curl

c# - How to change css class in order in razor syntax -



c# - How to change css class in order in razor syntax -

i'm dealing content management scheme in mvc razor syntax , question have navigation menu , each menu has different css class megamenu1 megamenu2 megamenu3 megamenu4... , want able loop them using foreach , want them take these classes in order, long loops each div take class

<div class="megamenu1"> <div class="megamenu2"> <div class="megamenu3">

i not figure out solution , wanted ask, shares thought sutiation me.

c# css asp.net-mvc razor foreach

php chain method return variable and method calls another method -



php chain method return variable and method calls another method -

i saw different articles chain method, still don't understand difference between "return $this" , "return $this->somevariable".i want know how method phone call method within , without class too.

could kindly explain ? you!

my example, echo "bca", dont why "a" lastly display...

class validation { public function __construct($a) { $this->a = $a; } public function one($a) { echo $a = "b"; homecoming $this; } public function two($a) { echo $a = "c"; homecoming $this->a; } } $a = "a"; $nameerr = new validation($a); echo $nameerr->one($a)->two($a);

it returned two($a) since returns $this->a set in constructor "a", , method one($a) returns instance of object on called function two.

$this refers object instance. difference homecoming $this->somevariable returns variable.

also nice coding tip. declare $a in class private variable this:

class validation { private $a; }

php return-value method-chaining

php - if url is mywebsite.com/url do something -



php - if url is mywebsite.com/url do something -

i using wordpress set cookie specified page , can't done adding php code on page php, cookies set in web page header lines, before page content processed.

i found solution , it's edit index.php file , adding code in top , add together code pages .

so want php code webpage url example

if ($pageurl == 'http://website.com/another_page') { setcookie("cookie[one]","cookieone" , time()+3600*720); if (isset($_cookie["cookie"])) { header("location: http://website.com/page"); } }

ps: code above maybe broken .

if($_server['request_uri'] === "/page/1/blog"){ // code here }

request uri give current url after domain name.

php wordpress url

can't print '\' (single backslash) in Python -



can't print '\' (single backslash) in Python -

this question has reply here:

how print backslash python? 6 answers

i using python 3 , trying find ways search way insert '\' (single backslash) program.

i gettin error: syntaxerror: eol while scanning string literal

you have escape backslash:

\\

from python docs:

the backslash (\) character used escape characters otherwise have special meaning, such newline, backslash itself, or quote character.

also, @torxed mentioned in answer, can utilize prefix r or r:

string literals may optionally prefixed letter 'r' or 'r'; such strings called raw strings , utilize different rules interpreting backslash escape sequences.

r"some string \ backslash"

python-3.x

if statement - Subsetting data in R with ifelse -



if statement - Subsetting data in R with ifelse -

i attempting utilize ifelse subset info can used in plot. coding way trying create code usable layman defining 1 or 2 objects , running whole script create plot using info selected given criteria.

the problem mydataframe[mydataframe$data . ...] operation not working way within ifelse. there way work in ifelse or aware of smarter way i'm trying do? thanks!

also, sec block of code added explanation not needed see problem.

# generate info mydata<-c(1:100) mydata<-as.data.frame(mydata) mydata$checkthefunction<-rep(c("one","two","three","four","multiple of 5", "six","seven","eight","nine","multiple of 10")) # looks right mydata # create function myfunction = function(mycondition="low"){ # special criteria lowrandomnumbers=c(58,61,64,69,73) highrandomnumbers=c(78,82,83,87,90) # subset info based on mycondition mydata<-ifelse(mycondition=="low",mydata[mydata$mydata %in% lowrandomnumbers==true,],mydata) mydata<-ifelse(mycondition=="high",mydata[mydata$mydata %in% highrandomnumbers==true,],mydata) # if not "high" or "low" don't subset info mydata } myfunction("low") # returns numbers selected dataframe, not # subsetted dataframe $checkthefunction row myfunction("high") # returns: "error in mydata[mydata$mydata %in% highrandomnumbers == true, ] : # wrong number of dimensions" # additional explanation code if helps # define dataframe 1 time again mydata<-c(1:100) mydata<-as.data.frame(mydata) mydata$checkthefunction<-rep(c("one","two","three","four","multiple of 5", "six","seven","eight","nine","multiple of 10")) # outside of function , ifelse subsetting works lowrandomnumbers=c(58,61,64,69,73) itworks<-mydata[mydata$mydata %in% lowrandomnumbers==true,] # ifelse seems problem, dataframe cutting string of lowrandomnumbers 1 time again mycondition="low" noluck<-ifelse(mycondition=="low",mydata[mydata$mydata %in% lowrandomnumbers==true,],mydata) noluck # if 'else' portion returned dataframe converted one-dimensional list mycondition="high" noluck<-ifelse(mycondition=="low",mydata[mydata$mydata %in% lowrandomnumber==true,mydata) noluck

you don't want ifelse. want if , else. ifelse used if have status vector. have single status value.

myfunction = function(mycondition="low"){ # special criteria lowrandomnumbers=c(58,61,64,69,73) highrandomnumbers=c(78,82,83,87,90) # subset info based on mycondition mydata <- if(mycondition=="low") mydata[mydata$mydata %in% lowrandomnumbers==true,] else mydata mydata <- if(mycondition=="high") mydata[mydata$mydata %in% highrandomnumbers==true,] else mydata # if not "high" or "low" don't subset info mydata }

r if-statement subset

java - Placing a ListView in a Fragment Activity -



java - Placing a ListView in a Fragment Activity -

in android app, trying place listview in fragmentactivity. unfortunately there no such thing fragmentlistactivity. problem can't phone call setlistadapter() , onlistitemclick() methods.

so did lot of research , went xml file , manually added listview there. instead of getlistview(), declared listview variable phone call methods on new listview variable. unfortunately method still riddled errors method unable resolved etc.

here java code:

package com.spicycurryman.getdisciplined10.app; import android.app.alertdialog; import android.app.progressdialog; import android.content.activitynotfoundexception; import android.content.dialoginterface; import android.content.intent; import android.content.pm.applicationinfo; import android.content.pm.packagemanager; import android.net.uri; import android.os.asynctask; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.layoutinflater; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.listview; import android.widget.toast; import android.widget.adapterview.onitemclicklistener; import com.javatechig.listapps.applicationadapter; import java.util.arraylist; import java.util.list; public class installedappactivity extends fragmentactivity { private packagemanager packagemanager = null; private list<applicationinfo> applist = null; private applicationadapter listadaptor = null; //implementing listview programatically listview installedapplist = (listview) findviewbyid(r.id.installed_list); public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); packagemanager = getpackagemanager(); new loadapplications().execute(); homecoming inflater.inflate(r.layout.installed_apps, container, false); } public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.block, menu); homecoming true; } public boolean onoptionsitemselected(menuitem item) { boolean result = true; switch (item.getitemid()) { case r.id.main_text: { displayaboutdialog(); break; } default: { result = super.onoptionsitemselected(item); break; } } homecoming result; } private void displayaboutdialog() { final alertdialog.builder builder = new alertdialog.builder(this); builder.settitle(getstring(r.string.app_name)); builder.setmessage(getstring(r.string.slogan)); builder.setpositivebutton("know more", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { intent browserintent = new intent(intent.action_view, uri.parse("http://javatechig.com")); startactivity(browserintent); dialog.cancel(); } }); builder.setnegativebutton("no thanks!", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); builder.show(); } //here installedapplist.setonitemclicklistener(new onitemclicklistener()){ @override public void onitemclick(adapterview <?> arg0, view view, int index, long id){ applicationinfo app = applist.get(index); seek { intent intent = packagemanager .getlaunchintentforpackage(app.packagename); if (null != intent) { startactivity(intent); } } grab (activitynotfoundexception e) { toast.maketext(installedappactivity.this, e.getmessage(), toast.length_long).show(); } grab (exception e) { toast.maketext(installedappactivity.this, e.getmessage(), toast.length_long).show(); } } }); private list<applicationinfo> checkforlaunchintent(list<applicationinfo> list) { arraylist<applicationinfo> applist = new arraylist<applicationinfo>(); (applicationinfo info : list) { seek { if (null != packagemanager.getlaunchintentforpackage(info.packagename)) { applist.add(info); } } grab (exception e) { e.printstacktrace(); } } homecoming applist; } private class loadapplications extends asynctask<void, void, void> { private progressdialog progress = null; @override protected void doinbackground(void... params) { applist = checkforlaunchintent(packagemanager.getinstalledapplications(packagemanager.get_meta_data)); listadaptor = new applicationadapter(installedappactivity.this, r.layout.snippet_list_row, applist); homecoming null; } @override protected void oncancelled() { super.oncancelled(); } @override protected void onpostexecute(void result) { //setlistadapter(listadaptor); installedapplist.setadapter(listadaptor); progress.dismiss(); super.onpostexecute(result); } @override protected void onpreexecute() { progress = progressdialog.show(installedappactivity.this, null, "loading application info..."); super.onpreexecute(); } @override protected void onprogressupdate(void... values) { super.onprogressupdate(values); } } }

here xml file:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <listview android:id="@+id/installed_list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </linearlayout>

try this..

you have missed oncreate

listview installedapplist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.installed_apps); installedapplist = (listview) findviewbyid(r.id.installed_list); packagemanager = getpackagemanager(); new loadapplications().execute(); installedapplist.setonitemclicklistener(new onitemclicklistener()){ @override public void onitemclick(adapterview <?> arg0, view view, int index, long id){ applicationinfo app = applist.get(index); seek { intent intent = packagemanager .getlaunchintentforpackage(app.packagename); if (null != intent) { startactivity(intent); } } grab (activitynotfoundexception e) { toast.maketext(installedappactivity.this, e.getmessage(), toast.length_long).show(); } grab (exception e) { toast.maketext(installedappactivity.this, e.getmessage(), toast.length_long).show(); } } }); }

and remove oncreateview , add together itemclicklistener within oncreate

java android xml android-fragments android-listview

image - Silverstripe 3.1.2 Issue saving FocusPoint when module used with Gallery module -



image - Silverstripe 3.1.2 Issue saving FocusPoint when module used with Gallery module -

i'm using 2 great modules silverstripe 3 there conflict somewhere can't work out. i've asked developers have not found solution yet.

modules: focuspoint allows take image crops from. great! https://github.com/jonom/silverstripe-focuspoint

gallery, popular gallery module. https://github.com/frankmullenger/silverstripe-gallery

both work fine. focus points not "save" within gallery section of gallery page. can edit , take focus point after saving snaps previous position. can alter focus point in files tab of cms must how gallery saves each image. have updated template croppedfocusedimage not template issue.

it helpful addition.

can please provide details of failure? see warning or error messages if run in dev mode? little black error box on left-top when save?

if focuspoint module not work, can have @ folder permissions or maybe php libraries imagemagick, gd back upwards etc. maybe you changed during upgrade?

if both modules work individually, problem cropped image not saved in right directory, issue although still permission issue.

you can set folder needs save into, same how set in normal uploadfield. wouldn't alter because of upgrade.

image gallery crop silverstripe

c# - Close XDocument instance -



c# - Close XDocument instance -

i have been doing research on still couldn't prepare it. have function:

private void addnewservice() { string strpath = "servicestoexecute.xml"; string strservicename = tbnewservice.text; //try //{ xdocument xddocument; using (xmlreader xmlreader = xmlreader.create(strpath)) { xddocument = xdocument.load(xmlreader); xelement root = new xelement("service"); root.add(new xelement("name", strservicename)); xddocument.element("servicestoexecute").add(root); xmlreader.close(); xddocument.save(strpath); }

and error while trying save file... idea? think missing really, stupid can't see now.

i believe you're opening file named servicestoexecute.xml within xmlreader , trying save xdocument @ same path... aka trying overwrite file have open reading. per @mikez above, should simplify code using xdocument.load(string path) overload such:

private void addnewservice() { string strpath = "servicestoexecute.xml"; string strservicename = tbnewservice.text; //try //{ xdocument xddocument = xdocument.load(strpath); xelement root = new xelement("service"); root.add(new xelement("name", strservicename)); xddocument.element("servicestoexecute").add(root); // save xddocument.save(strpath);

c# xml linq-to-xml xmlreader

Which tool (gdb? xcode? pdb? etc) can I use to find a memory leak in a C-extended python program? -



Which tool (gdb? xcode? pdb? etc) can I use to find a memory leak in a C-extended python program? -

i writing python programme includes extension module written in c. extension module defines function used in programme continually.

i have memory leak somewhere in program, don't know how find it. have tried 1) installing valgrind. can't work since have osx mavericks (10.9) , valgrind supports oxs 10.7 (and 10.8 unstably). 2) using gdb. can't seem gdb run python scripts, i'd need set breakpoint in c function gets called python code. believe need install python-debuginfo in order that, have not been able to. 3) using pdb. had, however, no thought debug c code using pdb.

is there tool utilize debug memory leaks in program?

the debugger ships mac development tools lldb, replaces gdb. interface similar gdb. can install gdb using homebrew.

the way debug c extensions other shared library. debug executable (python) loads shared library (your extension), , set breakpoints become valid after executable loads shared library.

run lldb:

lldb /path/to/python -- your_python_script.py

set breakpoints (replace relevant breakpoints)

(lldb) b some_source_file.c:4343

then run, , debugger stop @ breakpoint

(lldb) r

now can debug c extension normally.

python c memory-leaks python-extensions

Capture GMOCK string parameter -



Capture GMOCK string parameter -

if have next interface fellow member function:

virtual bool print_string(const char* data) = 0;

with next mock

mock_method1(print_string, bool(const char * data));

is possible capture string passed print_string()?

i tried to:

char out_string[20]; // savearg<0>(out_string); // saves first char of sting

this saves first char of sting not whole string.

class

struct foo { virtual bool print_string(const char* data) = 0; };

mock

struct foomock { mock_method1(print_string, bool(const char * data)); };

test

struct strarg { bool print_string(const char* data) { arg = data; homecoming true; } string arg; }; test(footest, first) { foomock f; strarg out_string; expect_call(f, print_string(_)) .willonce(invoke(&out_string, &strarg::print_string)); f.print_string("foo"); expect_eq(string("foo"), out_string.arg); }

you can utilize invoke capture parameter value in structure.

gmock

sql - Is there any way to recover a stored procedure overwritten with an ALTER statement? -



sql - Is there any way to recover a stored procedure overwritten with an ALTER statement? -

i have altered stored procedure error , have no backup of database. there way of recovering work ?

try running this. gets list of queries in plan cache, may buried in there.

select execquery.last_execution_time [date time], execsql.text [script] sys.dm_exec_query_stats execquery cross apply sys.dm_exec_sql_text(execquery.sql_handle) execsql order execquery.last_execution_time desc

sql sql-server database sql-server-2008

python - list index error with numba guvectorize -



python - list index error with numba guvectorize -

i new numba / numbapro. trying run 1 of examples, 1 generalised ufuncs guvectorize:

(here link example): http://docs.continuum.io/numbapro/quickstart.html#numbapro-guvectorize

import numbapro numbapro @numbapro.guvectorize(['void(int32[:], int32[:])'], '(n)->()') def sum_row(inp, out): """ sum every row function type: 2 arrays (note: scalar represented array of length 1) signature: n elements scalar """ tmp = 0. in range(inp.shape[0]): tmp += inp[i] out[0] = tmp

i error:

indexerror traceback (most recent phone call last) <ipython-input-98-79514a184595> in <module>() ----> 1 @numbapro.guvectorize(['void(int32[:], int32[:])'], '(n)->()') 2 def sum_row(inp, out): 3 """ 4 sum every row 5 /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/npyufunc/decorators.pyc in wrap(func) 117 fty in ftylist: 118 guvec.add(fty) --> 119 homecoming guvec.build_ufunc() 120 121 homecoming wrap /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.pyc in build_ufunc(self) 149 150 sig, cres in self.nb_func.overloads.items(): --> 151 dtypenums, ptr = self.build(cres) 152 dtypelist.append(dtypenums) 153 ptrlist.append(utils.longint(ptr)) /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.pyc in build(self, cres) 167 signature = cres.signature 168 wrapper = build_gufunc_wrapper(ctx, cres.llvm_func, signature, --> 169 self.sin, self.sout) 170 ctx.engine.add_module(wrapper.module) 171 ptr = ctx.engine.get_pointer_to_function(wrapper) /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/npyufunc/wrappers.pyc in build_gufunc_wrapper(context, func, signature, sin, sout) 143 i, (typ, sym) in enumerate(zip(signature.args, sin + sout)): 144 ary = guarrayarg(context, builder, arg_args, arg_dims, arg_steps, i, --> 145 step_offset, typ, sym, sym_dim) 146 step_offset += ary.ndim 147 arrays.append(ary) /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/npyufunc/wrappers.pyc in __init__(self, context, builder, args, dims, steps, i, step_offset, typ, syms, sym_dim) 207 self.array = arycls(context, builder) 208 self.array.data = builder.bitcast(self.data, self.array.data.type) --> 209 self.array.shape = cgutils.pack_array(builder, self.shape) 210 self.array.strides = cgutils.pack_array(builder, self.strides) 211 self.array_value = self.array._getpointer() /users/adelacalle/anaconda_linux/lib/python2.7/site-packages/numba/cgutils.pyc in pack_array(builder, values) 257 def pack_array(builder, values): 258 n = len(values) --> 259 ty = values[0].type 260 ary = constant.undef(type.array(ty, n)) 261 i, v in enumerate(values): indexerror: list index out of range

i not found more documentation link. doing wrong? found happens when there empty bracket in signature. running on linux machine, , version of numbapro 0.14.1

thanks in advance,

alex

finally arrived conclusion myself. can allocate actual array of n elements, can write signature ´(n)->(n)´ instead of '(n)->()'. there must error on documentation, or outdated.

however, not efficiently have allocate whole array , waste of memory (although works!). more, utilize guvectorize sum elements across array best, neat , efficient way it, utilize @jit.

alex

python anaconda numba numba-pro

c# - ASP.NET Web API ModelState do not contains all parameters, validation do not work -



c# - ASP.NET Web API ModelState do not contains all parameters, validation do not work -

i'm using asp.net web api , have post method in controller:

[route("order/{siteid}/{orderid}")] public httpresponsemessage post(long siteid, long orderid, orderinformation orderinfo) { if (modelstate.isvalid) { ... } }

i have couple info annotations in orderinformation class (required etc.) unfortunately validation not work. because modelstate not contains key orderinfo. contains siteid , orderid.

so question why orderinfo parameter not included in modelstate. have not thought why works weird because utilize similar code on different places , works fine.

edit:

here model (orderinformation class):

public class torderinformation { [required] public string loyaltynumber; [required] public string specialinstructions; public bool sendemail; ... // few more string properties, no info annotations }

edit 2:

i'm sending complex type in body serialized json. tried signature of method:

[route("order/{siteid}/{orderid}")] public httpresponsemessage post(long siteid, long orderid, [frombody] orderinformation orderinfo)

uff found problem. there can't public fields in model, must properties.

c# asp.net asp.net-mvc asp.net-web-api web-api

css - What is the formula to convert points to em? -



css - What is the formula to convert points to em? -

the designer made adobe illustrator designs uses points instead of pixels. , utilize em's set font size across site. formula em measurements points?

i know em's pixels it's this:

<pixels>/<browser_default> // <browser_default> 16

check out link. it's simple conversion reference pixels, points , like. easy google search.

http://pxtoem.com/

css math

java - How to validate Controller method argument in Spring with JSR validations? -



java - How to validate Controller method argument in Spring with JSR validations? -

i validating form field given piece of code.

//controller method public string addbusiness(@valid @modelattribute("myform") myform myform, ...) { //logic go here. } //form @component public class myform{ @pattern(regexp = "[0-9]{3,10}", message = "should valid number") public string getzip_code() { homecoming this.zip_code; } }

now want same validation on zip_code in method of controller like,

@requestmapping(value = "${validation.url}", method = requestmethod.get) @responsebody public list<string> getcitylist(@requestparam(value = "zip_code", required = true) final string zip_code) { //logic goes here }

how possible?

it's not. @valid doesn't apply @requestparam annotated parameters. can create custom handlermethodargumentresolver or validation in method.

java spring validation controller arguments

Maven running RPM plugin before building children -



Maven running RPM plugin before building children -

i have parent pom 2 children. 2 children build mutual target folder, , parent builds rpm (with codehaus rpm-maven-plugin) folder. @ least, that's how want work. if build children before building parent, works. if clean , build parent, it'll seek build rpm before builds children, , complains files missing.

how can specify build children before running rpm plugin?

you must create separare kid contains confinguration rpm-maven-plugin , defined appropriate dependencies other childs , new kid automatically build after others.

maven

php - Calendar Management in Symfony2 -



php - Calendar Management in Symfony2 -

i given task create appointment management scheme patient appointment.

things have are: on calender link there should open calender, there b link clicking user have form appointment. on admin side, admin can approve appointments , displayed on calender on front end end . new symfony. don't know how take start calender. can please guide me follow , 1 best front end , end calender management, synchronize application.

plus necessary steps me desired result.

adsigns/calendar-bundle easy way started. uses jquery fullcalendar frontend , simple symfony listeners generate events ajaxy callbacks fullcalendar via fosjsroutingbundle. (the fosjsroutingbundle nice bundle makes possible generate urls symfony routes in javascript.)

since dealing time, troublesome, want familiarize momentjs (recently integrated fullcalendar v2) moment.php, php port of momentjs backend. i've heard things php carbon library, though have not used myself.

for more sophisticated frontends, take @ kendoui's scheduler sencha extjs calendar.

php symfony2 calendar

java - ant property conditional on another property -



java - ant property conditional on another property -

i next in ant

if javac.version >= 1.7 <property name="myproperty" value="somevalue"/> else <property name="myproperty" value="someothervalue"/> endif

looks simple plenty not familiar plenty ant this

any assistance appreciated

you can utilize the status task check if contents of java version scheme property contains version need. here example:

<project name="test" default="target"> <target name="target"> <condition property="property" value="value1" else="value2"> <contains string="${java.version}" substring="1.7"/> </condition> <echo>java version: ${java.version}. result: ${property}</echo> </target> </project>

output:

java version: 1.7.0_60. result: value1

java ant properties version

twitter bootstrap - Read more link in media class on Bootstrap3 -



twitter bootstrap - Read more link in media class on Bootstrap3 -

i have limited knowledge html/css , in next example display "read more..." link after text instead of under. help?

i made work moving link within lastly </p> tag. depending on how you're planning on generating final content, easiest way.

twitter-bootstrap twitter-bootstrap-3

git - Can't push to Github repo -



git - Can't push to Github repo -

been using git while created github account. i've setup repo maintain getting errors when seek force it.

error: failed force refs 'https://github.com/username/myrepo.git' hint: updates rejected because remote contains work do hint: not have locally. caused repository pushing hint: same ref. may want first integrate remote changes hint: (e.g., 'git pull ...') before pushing again. hint: see 'note fast-forwards' in 'git force --help' details.

i've tried doinggit pull pull not possible because have unmerged files.

any ideas?

check diff between stuff , remote repository http://git-scm.com/docs/git-diff , merge files want merged, or if don't have need in local can git checkout . remove changes , git pull pull remote repository is.

git github

mongodb - How to get sum of child entries for hierarchical documents? -



mongodb - How to get sum of child entries for hierarchical documents? -

i have document of next form:

class="lang-js prettyprint-override">{ "name": "root1", "children": [{ "name": "a", "children": [{ "name": "a1", "items": 20 }, { "name": "a2", "items": 19 }], "items": 8 }, { "name": "b", "items": 12 }], "items": 1 }

that is, each level has "name" field, "items" field, , optionally children field. run query returns total number of items each root. in example, should homecoming (since 20+19+8+12+1=60)

class="lang-js prettyprint-override">{ "_id" : "root1", "items" : 60 }

however, each document can have arbitrarily many levels. is, illustration has 2 3 children below root, other documents may have more. is, cannot like

class="lang-js prettyprint-override">db.mycollection.aggregate( { $unwind : "$children" }, { $group : { _id : "$name", items: { $sum : "$items" } } } )

what sort of query work?

there no way descend arrays arbitrary depths using aggregation framework. sort of construction need utilize mapreduce can programatically this:

class="lang-js prettyprint-override">db.collection.mapreduce( function () { var items = 0; var action = function(current) { items += current.items; if ( current.hasownproperty("children") ) { current.children.foreach(function(child) { action( kid ); }); } }; action( ); emit( this.name, items ); }, function(){}, { "out": { "inline": 1 } } )

if not want mapreduce consider construction info , things differently:

class="lang-js prettyprint-override">{ "name": "root1", "items": 1, "path": [], "root": null }, { "name": "a", "items": 8, "path": ["root1"], "root": "root1" }, { "name": "a1", "items": 20, "path": ["root1", "a"], "root": "root1" }, { "name": "a2", "items": 19, "path": ["root1", "a"], "root": "root1" }, { "name": "b", "items": 12, "path": ["root1"], "root": "root1" }

then have simple aggregate:

class="lang-js prettyprint-override">db.collection.aggregate([ { "$group": { "_id": { "$cond": [ "$root", "$root", "$name" ] }, "items": { "$sum": "$items" } }} ])

so if take different approach mapping hierarchy doing things such aggregating totals paths much easier without recursive inspection otherwise required.

the approach need depends on actual usage requirements.

mongodb mapreduce mongodb-query aggregation-framework

jquery - How to disable sorting from some specif rows in DataTables -



jquery - How to disable sorting from some specif rows in DataTables -

i've used table. need first row of tbody(which displays average number of columns) should not sorted, mean row should in top always(below thead) this: . how can this? search solution on google , find set row on thead or that. but, if seek set row on place, seems complex me. so, there way set class on row , disabling sortng on classed row? like: <tr class="average no-sort"></tr>

fiddle

i create sec tbody in table , move rows need persist in tbody so:

initcomplete: function() { var self = this; var api = this.api(); api.rows().eq(0).each(function(index) { var row = api.row(index); if (row.data()...) { // status here var $row_to_persist = $(row.node()); var $clone = $row_to_persist .clone(); $(self).find('tbody:last').append($clone); $total_row.remove(); row.remove(); api.draw(); } }); }

jquery css datatable

python - Matplotlib - tooltips on mouse hover -



python - Matplotlib - tooltips on mouse hover -

here tried:

def onpick3(event): ind = event.ind print 'onpick3 scatter:' fig.scatter(t, p, color='b', zorder=10, label='label', picker=true) fig.legend(loc=fills_legend_pos[index]) fig.canvas.mpl_connect('pick_event', onpick3)

and error

attributeerror: 'axessubplot' object has no attribute 'canvas'

edit: fig of type axessubplot, , instantiated this

fig = plt.subplot2grid((i, i), (j, 0), rowspan=1, colspan=i)

what easiest way add together tooltips on scatterplot? please note want maintain current framework, calling fig.scatter, these scatters overlaid on existing figure.

subplot2grid() returns axes object, utilize it's figure attribute figure object:

import pylab pl axes = pl.subplot2grid((2, 2), (0, 0), rowspan=1, colspan=1) axes.figure.canvas.mpl_connect('pick_event', onpick3)

python matplotlib tooltip

ASP.NET MVC 5 WEB API with individual user account authentication -



ASP.NET MVC 5 WEB API with individual user account authentication -

i'm new asp.net mvc 5 , webapi 2 technology. developing web service desktop application.

i have developed web service individual user business relationship authentication in asp.net mvc 5 web api 2. refer link :- " http://vod.com.ng/en/video/kyxclfz_cw8/8-authenticated-webapi-aspnet-mvc-5-fundamentals-5-webapi-2 ". helped me need add together layers in project i.e. web , core.

i shifted "accountbindingmodels.cs" , "accountviewmodels.cs" models folder in web poco folder in core, after running programme getting error " post /api/account/register 500 (internal server error) " , " error occurred when trying create controller of type 'accountcontroller' ".

i want add together api controllers , model classes authenticated individual user account. please help. allow me know else need know. in advance.

code unityconfig.cs file

public static void registertypes(iunitycontainer container) { container.registertype(typeof(irepository<>), typeof(repository<>)); container.registertype(typeof(dbcontext), typeof(datacontext)); }

controller

namespace desktopapp.controllers { public class studentlogincontroller : apicontroller { private irepository<studentlogin> _studentloginrepository; public studentlogincontroller(irepository<studentlogin> studentloginrepository) { _studentloginrepository = studentloginrepository; } [httppost] [route("api/studentlogin/post")] public studentlogin post(studentlogin logindata) { var studentlogindetails = _studentloginrepository.getall().where(p => p.studentname == logindata.studentname && p.studentpassword == logindata.studentpassword).firstordefault<studentlogin>(); homecoming studentlogindetails; }

solved issue creating default accountcontroller , deleting parameterized accountcontroller.

public usermanager<identityuser> usermanager { get; private set; } public isecuredataformat<authenticationticket> accesstokenformat { get; private set; } public accountcontroller() { usermanager = startup.usermanagerfactory(); accesstokenformat= startup.oauthoptions.accesstokenformat; }

asp.net-mvc-5 asp.net-web-api2

java - Eclipse RCP and Apache CXF -



java - Eclipse RCP and Apache CXF -

i'm trying utilize apache cxf in eclipse rcp application. 1 plugin (x) provide osgi service uses cxf. plugin (y) phone call service.

the "x" plugin uses cxf jar's downloaded (cxf 2.7.11) added manifest.mf. when run test cases withint plugin x goes fine i.e. can phone call webservice , response.

when seek run plugin "y" sees osgi service can call. osgi service calls same code withint project "x" in above case, doesnt work. exception is:

com.sun.xml.internal.ws.client.sei.seistub cannot cast org.apache.cxf.frontend.clientproxy

in part:

org.apache.cxf.endpoint.client client = clientproxy.getclient(myserviceport);

now when run same code within plugin (plugin x) runs fine.

so suspect has jar's , dependencies etc. im not sure. searched exception , comes when jar's missing cxf, added all jar's manifest.mf found in cxf distribution.

i'm not sure classes of cxf need, test cases seem run fine.

any ideas went wrong?

i set client way:

jaxwsproxyfactorybean mill = new jaxwsproxyfactorybean(); factory.setserviceclass(yourclass.class); factory.setaddress(endpoint); yourclass port = (yourclass) factory.create(); client client = clientproxy.getclient(port);

if have autogenerated javas have client class name_name_client.java , name_name12_client.java, , yourclass name.java (this java defines webmethods), alter this, , set endpoint. seek , allow know if works you.

java eclipse-rcp jax-ws cxf manifest.mf

objective c - Show Navigation bar when Scrolling back to top. IOS -



objective c - Show Navigation bar when Scrolling back to top. IOS -

currently have uicollection in hide uinavigation top bar when scroll downwards 40px. uinavigation top bar appears 1 time again when scroll top.

this works want able show /hide uinavigation top bar anytime user scrolls 40px , not when scroll top.

e.g when start scrolling top bar hides, scroll middle of uicollectionview , when strat scrolling top uinavigation top bar shows again.

any ideas?

#pragma mark - uiscrollviewdelegate methods -(void)scrollviewdidscrolltotop:(uiscrollview *)scrollview { if([[[uidevice currentdevice] systemversion] floatvalue] < 7.0f){ return; } cgrect frame = self.navigationcontroller.navigationbar.frame; frame.origin.y = 20; } -(void)scrollviewdidscroll:(uiscrollview *)scrollview { if([[[uidevice currentdevice] systemversion] floatvalue] < 7.0f){ return; } cgfloat offsety = scrollview.contentoffset.y; cgfloat contentheight = scrollview.contentsize.height - 300; if (offsety > contentheight - scrollview.frame.size.height) { [self.homepaginator fetchnextpage]; } cgrect frame = self.navigationcontroller.navigationbar.frame; cgfloat size = frame.size.height - 25; if([scrollview.pangesturerecognizer translationinview:self.view].y < 0) { frame.origin.y = -size; if(self.navigationcontroller.navigationbar.items.count > 0){ [uiview animatewithduration:0.25 delay:0 options:uiviewanimationoptioncurveeaseinout | uiviewanimationoptionallowuserinteraction animations:^{ cgfloat navbarheight = 25.0f; cgrect frame = cgrectmake(0.0f, 0.0f, 320.0f, navbarheight); [self.navigationcontroller.navigationbar setframe:frame]; } completion:^(bool finished) { self.navigationitem.titleview.alpha = 0; self.piccingtitleicon.alpha = 0; self.navigationitem.rightbarbuttonitem = nil; }]; } } else if([scrollview.pangesturerecognizer translationinview:self.view].y > 0) { [uiview animatewithduration:0.5 delay:0 options:uiviewanimationoptioncurveeaseinout | uiviewanimationoptionallowuserinteraction animations:^{ cgfloat navbarheight = 64.0f; cgrect frame = cgrectmake(0.0f, 0.0f, 320.0f, navbarheight); [self.navigationcontroller.navigationbar setframe:frame]; self.navigationitem.titleview.alpha = 1; self.piccingtitleicon.alpha = 1; self.btnsearch = [[uibarbuttonitem alloc] initwithcustomview:self.searchiconbutton]; [self.navigationitem setrightbarbuttonitem:self.btnsearch]; } completion:^(bool finished) { [self performselector:@selector(addiconstonavbar) withobject:nil afterdelay:-1.0]; }]; } }

get starting content offset before user scrolls.

– scrollviewwillbegindragging:(uiscrollview *)scrollview { currentoffset = scrollview.contentoffset.y; } -(void)scrollviewdidscroll:(uiscrollview *)scrollview { cgfloat scrollpos = scrollview.contentoffset.y - currentoffset; if(scrollpos >= 40 || scrollpos <= -40 /* or whatever height of toolbar */){ //fully hide toolbar [uiview animatewithduration:2.25 animations:^{ [self.navigationcontroller setnavigationbarhidden:yes animated:yes]; }]; } else { //slide incrementally, etc. [self.navigationcontroller setnavigationbarhidden:no animated:yes]; } }

ios objective-c uiscrollview uinavigationbar uicollectionview

Trying to recursively binary search strings in c -



Trying to recursively binary search strings in c -

i need utilize binary search recursively find target string. function should homecoming -1 if not found , positive integer if found returns -1. help!

int start = 0; int search; search = binary_search(strings, target, start, size-1); if(search == -1) { printf("not in dataset!"); } if(search != -1) { printf("%s in dataset", target); } int binary_search(char **strings, char *target, int start_idx, int end_idx) { if(end_idx < start_idx) { homecoming -1; } int middle = ((start_idx + end_idx)/2); int i; = strcmp(target, strings[middle]); if(i == 0) { homecoming middle; } if(i < 0) { homecoming binary_search(strings, target, start_idx, middle-1); } else { homecoming binary_search(strings, target, middle+1, end_idx); } }

input data: aden caden david erik john mark matt mycah phil susan

although binary search notoriously hard right, don't see errors in algorithm shown. can still fail (-1) due various causes can not determined based on info provided.

1) source strings list not sorted correctly -- strcmp() uses ascii comparison, not dictionary comparison, i.e., source string must ascii sorted bsearch valid.

2) source strings not well-formed nul terminated c strings.

3) target string not have exact match in source string list. i.e., searching "bill" not match "bill" or "billiard"

just note, recursive bsearch slower , uses more memory non-recursive solution

c string recursion binary-search

java - How to create clickable lines in android -



java - How to create clickable lines in android -

if utilize line :

canvas.drawline(stx,sty, spx,spy);

how can later observe illustration motionevent whether line touched or not? let's assume line not straight.

i know there things rect or rectf can handle events can't draw slope lines.

maybe suggest me alternative method draw lines object used handle events...

well after night research seems way go switch canvas opengl es api.

and yet foul trail...

but after giving sec though if have

line ( point ( x1, y1 ), point2 ( x2, y2))

like loving mother, math comes understanding , simple answare, simple line of code can determine wheather event point contained in line:

(x2 - x1)(eventy - y1) = (y2 - y1) (eventx - x1);

to blur touch area can add:

for(int = -10; i<10;i++){ for(int j=-10; j<10; j++){ if((x2 - x1)*(eventy+i - y1) == (y2 - y1)* (eventx+j - x1)) homecoming true;}}

java android canvas graphics event-handling

c++ - Strategy for simple yet effective UDP server for gaming (and other tasks) -



c++ - Strategy for simple yet effective UDP server for gaming (and other tasks) -

i'm trying implment thought of simple yet pretty effective multithreaded server working on udp. main goal gaming(-like) applications, if used in other purposes too.

i want utilize api/technologies etc

std::thread multithreading, since part of c++ standard, should future-proof , far seen it's both simple , works c++. bsdsock (linux) & winsock2 (windows). create 1 abstract class called socket , each platform (linux - bsd, windows - winsock) create derived class implementing native api. utilize api provided base of operations class socket, not native/platform api. allow me utilize 1 code whole server/client module , if want alter platform i'd have switch class type of socket , thats it.

as strategy of server-client comunication thought of this: each programm has 2 sockets - 1 listens on specified port , 1 used send info server/other clients. both sockets run on different threads can both read , send info @ same time (sort of), way waiting info won't ruin performance. there 1 main server, , other clients connect straight server. clients send info , recieve info straight server.

now have question:

is wise utilize std::thread? heard it's on linux, not on windows. pthreads much better? any other interesting ideas making 1 code many platforms (mainly linux&windows)? or mine enough? any other ideas or tips strategy how server/client work? wrote simple network apps, didn't need strategy, i'm not sure if it's best simple ideas. how should send info client server (and server client)? dont want flood network , create server load 100%?

also: should work nice 2-4 players @ same time, don't plan utilize more @ moment.

intuitively, multi-threading purposes linux + pthread nice combination. vast number of mission critical systems running on combination. however, when come std::thread, having platform dependent nature nice have feature. certainly, if bad smells in windows dialect, ms right them future. but, if you, select linux + std::thread combination. selection of linux on windows different topic , no need comment here (with respect server development perspective). std::thread provides nice set of feature,yet having powerfulness of pthreads.

regarding udp, have both pros , cons. but, i'd if going open sever public, have think network firewalls well. if can address inherent transport layer issues of udp (packet re-ordering, lost packet recovery), udp server lite weighted in of cases.

it depends on game decide how need send messages. can't comment it.

moreover, pay attending security on info communication more seriously. sooner or later sever hacked. matter of fact of time.

c++ multithreading sockets client-side

Use php and simPro API to list customers -



Use php and simPro API to list customers -

i login here account: https://sandbox.simpro.co

in setup/applications created new application. access type direct access, signature method hmac-sha1

in file "application uri" points have this:

$headers = array( 'host: sandbox.simpro.co', 'authorization: oauth,oauth_version="1.0", oauth_nonce="1d0c9d11a944b2439cf867f32d59d21b", oauth_timestamp="1355952869", oauth_consumer_key="sandbox-simpro-......", oauth_signature_method="hmac-sha1access", oauth_signature="....."', 'content-type: application/json', 'accept: application/json' ); $url = 'https://sandbox.simpro.co/api/oauth/access_token.php'; $context = array( 'http' => array( 'content' => $content, 'header' => implode("\r\n", $headers) . "\r\n", 'method' => $method, 'timeout' => 10.0, 'ignore_errors'=>false ) ); $response = file_get_contents( $url, false, stream_context_create($context)); if ($response === false){ var_dump("<hr><pre>request failed", array('url'=>$url, 'method'=>$method, 'headers'=>$headers, 'content'=>$content),'</pre>'); }

nothing works. know i'm doing wrong on https://api.simpro.co/ there no php example. don't understand how set together.

how connect simpro api php?

update:

this in on script:

warning: file_get_contents(https://sandbox.simpro.co/api/oauth/access_token.php) [function.file-get-contents]: failed open stream: http request failed! http/1.0 501 not implemented in /.../index.php on line 64 string(23) " request failed" array(4) { ["url"]=> string(52) "https://sandbox.simpro.co/api/oauth/access_token.php" ["method"]=> string(4) "post" ["headers"]=> array(4) { [0]=> string(23) "host: sandbox.simpro.co" [1]=> string(318) "authorization: oauth,oauth_version="1.0", oauth_nonce="1d0c9d11a944b2439cf867f32d59d21b", oauth_timestamp="1355952869", oauth_consumer_key="sandbox-simpro-.....", oauth_signature_method="hmac-sha1access", oauth_signature="..........."" [2]=> string(30) "content-type: application/json" [3]=> string(24) "accept: application/json" } ["content"]=> string(0) "" } string(6) "

i understand don't describe in right way problem, because i'm having problem understand api. can please give me link php script part https://api.simpro.co/ used:

request token https://buildname.simpro.co/api/oauth/request_token.php

authorization https://buildname.simpro.co/oauth/authorize.php

access token https://buildname.simpro.co/api/oauth/access_token.php

i want list customers php , simpro.

might worth taking @ illustration code provide on github:

https://github.com/simpro-software/simpro-api-php

this php illustration includes basic connection simpro api using oauth , simple request of data.

please allow me know if need farther info or assistance.

php api