Posts

Showing posts from March, 2013

javascript - Remove Matching Objects from Array While Adding them to Another Array -

i trying build 3-tiered function: first, array lists available workshops (array called 'workshops'). second, array lists workshops user has selected (this array called 'selectedworkshops'). third, have final array called 'registeredworkshops'. when function run, want objects within 'selectedworkshops' added 'registeredworkshops', want delete objects within 'selectedworkshops' both 'selectedworkshops' , matching elements 'workshops'. so, objects used exist in both 'selectedworkshops' , 'workshops', exist in 'registeredworkshops'. here's i've got far: addremoveworkshops = function(){ var numberofworkshops = selectedworkshops.length; for(var = 0; < numberofworkshops; i++ ){ registeredworkshops.push(selectedworkshops[i]); for(var j = 0, arraylength = workshops.length; j < arraylength; j++) { var searchterm = selectedworkshops[i].workshopid;

unity3d - Unity won't accept my float (JS, 2d) -

i making top down 'atari' type game , ive been having little trouble recently, using transform.position change coordinate on screen using getkey moves little fast, tried use float slow down progression , not moving @ now... here code #pragma strict var xcoor = 0; var ycoor = 0; function start () { } function update () { if(input.getkey (keycode.d)) xcoor += 0.5; transform.position = vector2(xcoor,ycoor); if(input.getkey (keycode.w)) ycoor += 0.5; transform.position = vector2(xcoor,ycoor); if(input.getkey (keycode.a)) xcoor += -0.5; transform.position = vector2(xcoor,ycoor); if(input.getkey (keycode.s)) ycoor += -0.5; transform.position = vector2(xcoor,ycoor); } as can tell im new unity if there better way, please share! thank ;) i'm not sure, believe xcoor of type int. when try add float it, doesn't change. change definition of xcoor , ycoo

c++ - Making sense of arguments to a function template -

reading code base , desperately trying understand it. template<typename selection> void run_z_p_selection(xml_config &my_config){ system::start(); std::shared_ptr<selection> = std::make_shared<selection>(my_config, machine, enable, timet); system::addselection(my); } (xml_config &my config){}. object being created address? don't understand. where (my_config, machine, enable, timet) coming if not input arguments function? that called pass reference it's hard tell without seeing whole code base, looks global variables. maybe system::start() sets them up?

Custom shaped textview, Android -

Image
i'm looking way of making custom shaped text input control on android, showed on screenshot. what need have predefined places(gray rects) not covered text. when user typing - text lays out offsets left side, or right side, depending on place of gray rect. it easy on ios, couple lines of code , all. can not find way of doing on android. note gray rects may not part of text input component. on ios put 2 uiimageview on uitextview, , set rects excluding rendering text: cgfloat margin = 8; cgrect firstpathrect = cgrectmake(0, 80, 160 + margin, 90 + margin); cgrect secondpathrect = cgrectmake([uiscreen mainscreen].bounds.size.width - 160 - 2 * margin, 280, 160, 90 + margin); uibezierpath *path1 = [uibezierpath bezierpathwithrect:firstpathrect]; uibezierpath *path2 = [uibezierpath bezierpathwithrect:secondpathrect]; self.textview.textcontainer.exclusionpaths = @[path1, path2]; i hope can me task. in advance! check out library flowing text: https://github.com/deano23

c# - MailKit Imap Get only messageId -

the title sums up. need messageid properties imap folder without downloading entire message. ... imailfolder inbox = imapclient.inbox; searchquery query = searchquery.all; ilist<uniqueid> idslist = inbox.search(query); foreach (var uid in idslist) { mimemessage message = inbox.getmessage(uid);//this gets entire message //but need .messageid, without getting other parts if (message != null) { string messageid = message.messageid; } } ... try instead: var summaries = client.inbox.fetch (0, -1, messagesummaryitems.envelope); foreach (var message in summaries) { console.writeline (message.envelope.messageid); } that should want.

java - Syntax Tree in Eclipse for C code -

i'm trying implement plug-in eclipse (using java) c programmers, in user right click on variable in his/her c code , give him sorts of information on variable (like usages or function passed ... etc.). do know how can achieve this? if - can c syntax tree ? are there open source project use reference ? not direct answer question, have heard of program doxygen (also has eclipse plugin? take , see if meets needs. easier use pre-existing plugins rather creating own.

Caesar cipher code app for android -

my question how can code 'space' empty space in coded text , because if enter text example abc'space'abc coded letters abc , instead of space # want empty space...and decode, reverse function if press space 7 want empty space..i don't want code space or decode him that's idea public class mainactivity extends actionbaractivity { textview mytext, mytext2; button mycodebutton, mydecodebutton, deletebutton; public static edittext enterededittext; public string gettext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mytext = (textview) findviewbyid(r.id.textview1); mytext2 = (textview) findviewbyid(r.id.textview2); enterededittext = (edittext) findviewbyid(r.id.edittext1); mycodebutton = (button) findviewbyid(r.id.button1); mydecodebutton = (button) findviewbyid(r.id.button2); de

java - Google Guava Cache On App Engine -

does know if there reasons not use google guava cache library on google app engine. https://code.google.com/p/guava-libraries/wiki/cachesexplained particularly using eviction listener. concern cache isn't going replicated across instances. use case creating cache thusly: loadingcache<key, graph> graphs = cachebuilder.newbuilder() .maximumsize(1000) .expireafterwrite(10, timeunit.minutes) .removallistener(my_listener) .build(); on post http servlet, using cache later posts, , taking action on removal. i'm concerned there nuance way app engine handles cache, , how there no mention of using eviction listener in app engine docs: https://cloud.google.com/appengine/docs/java/memcache/ vs way done in guava docs. update: from testing looks google guava cache not work on gae - , cache gets evicted @ end of transaction (30 seconds or so) thanks in advance. well problem caches stored on local memory, keep in mind gae in

javascript - Regex infinite backtracking in Eloquent JS -

Image
why parser jump straight b after comes out of braces, according excerpt, instead of visiting + operator first? " for example, if confused while writing binary-number regular expression, might accidentally write /([01]+)+b/ ." " if tries match long series of zeros , ones no trailing b character, matcher first go through inner loop until runs out of digits. notices there no b, backtracks 1 position, goes through outer loop once, , gives again, trying backtrack out of inner loop once more. continue try every possible route through these 2 loops. means amount of work doubles each additional character. few dozen characters, resulting match take practically forever. " from http://eloquentjavascript.net/09_regexp.html#backtracking you correct, repetion first. text bit misleading, omits part jump outer loop, first retry of outer loop before attempting match b . so happens step-by-step? let's first match /([01]+)+b/ against "01b

Trouble accessing Footnotes class Google Scripts -

i'm trying write simple script take footnote added google document , copy endnotes section. so, user use footnotes normal , run script shift them end of document when they're finished. i've got script returns array containing [footnote, footnote] test doc 2 included, cannot figure out how convert object string. function getnotes() { var doc = documentapp.getactivedocument().getfootnotes(); logger.log(doc); } i've pored on documentation, , i'm confused because can't seem find getfootnotecontents method mentioned in footnotes class. direction appreciated. getfootnotes() return array of footnote objects. need iterate on them access each one. function getfootnotes(){ var doc = documentapp.openbyid('...'); var footnotes = doc.getfootnotes(); for(var in footnotes ){ logger.log(footnotes[i].getfootnotecontents().gettext()); } }

algorithm - Running time of quicksort -

suppose b(n) , w(n) respectively best case , worst case asymptotic running times sorting array of size n using quick sort . consider 2 statements: (1): b(n) o(w(n)) (2): b(n) theta(w(n)) select 1 answer: a. both (1) , (2) true b. (1) true (2) false c. (1) false (2) true d. both (1) , (2) false i think answer not sure b(n) = o(n * lg(n)) w(n) = o(n^2) 1) b(n) < w(n) implying b(n) = o(w(n)). 2) b(n) = theta(w(n)) equals w(n) = o(b(n)). before b(n) < w(n), therefore w(n) not bounded b(n), making 2nd statement incorrect. solution b, first statement true , second false.

ios - Swift Displaying Alerts best practices -

i have various controllers in app require validation, , when validation fails, want display alert errors. there best practice/design pattern doing this? create static function in helper class so: static func displayalert(message: string, buttontitle: string, vc: uiviewcontroller) { let alertcontroller = uialertcontroller(title: "", message: message, preferredstyle: .alert) let okaction = uialertaction(title: buttontitle, style: .default, handler: nil) alertcontroller.addaction(okaction) vc.presentviewcontroller(alertcontroller, animated: true, completion: nil) } but need pass view controller..which seems bad practice. shoot off notification , observe it, seems overkill. overthinking this, or there more acceptable way go handling this? i ended creating extension uiviewcontroller , creating alert function there: extension uiviewcontroller { func alert(message: string, title: string = "") { let alertcontroller = uialertco

delphi - Call a protected method (constructor) via RTTI -

am using xe-2. is possible invoke protected method (constructor) using rtti? i searched web did not find conclusive answer. understand prior xe published methods/properties available. have write access private fields, expecting able invoke protected methods. the following code works long constructor public. function getdefaultconstructor(arttitype: trttitype): trttimethod; var method: trttimethod; begin method in arttitype.getmethods('create') begin if (method.isconstructor) , (length(method.getparameters) = 0) , (method.parent = arttitype) exit(method); end; result := nil; end; rtti information increases size of executable files. because of designers provided means developer specify how rtti information linked executable. by default, no rtti protected methods linked. have specify want rtti added. example, program {$apptype console} uses system.typinfo, system.rtti; type tmyclass = class protected constructor cr

javascript - How do I spy on methods called from one class that exist in another class using Jasmine? -

i have method thissvc.asyncoperation: function(id) { return thatsvc.getbyid(id); is possible create spy tell me if thatsvc.getbyid has been called, or design anti-pattern? afaik, spies can created on single object. you can spy on whatever want, in jasmine tests make sure service: var thissvc, thatsvc; beforeeach(inject(function(_thissvc_, _thatsvc_){ thissvc = _thissvc_; thatsvc = _thatsvc_; }); it('.asyncoperation should call thatsvc.getbyid', function(){ spyon(thatsvc, 'getbyid'); var id = 4; thissvc.asyncoperation(id); expect(thatsvc.getbyid).tohavebeencalledwith(id); })

java - Eclipse Error: Could not find or load main class -

i have interface class checked out svn project, , created interface_tester class preview interface. however, when try run in eclipse following error: error: not find or load main class interface_tester here code interface_tester class - public class interface_tester { public static void main(string[] args){ interface test = new interface(); } } i have seen similar question asked on here did not understand answer. need step-by-step guide solution beginner. thank you update: tried running interface class , had same error... classes being shown in project explorer on left why eclipse unable locate of them? on left side of eclipse have project view. try right-clicking interface_tester there , in dropdown choose run. may you trying run else

c# - NHibernate: Invalid Cast (check your mapping for property type mismatches); -

i have class productcategorymodel: public class productcategorymodel { public virtual int id { get; set; } public virtual string name { get; set; } public virtual int parentid { get; set; } public virtual iesi.collections.generic.iset<productcategorymodel> subcategory { get; set; } } and here mapping xml: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="shop.domain.model.productcategory" assembly="shop.domain"> <class name="productcategorymodel"> <id name="id" column="id"> <generator class="native" /> </id> <property name="name" not-null="true" length="50" type="string" column="name"/> <many-to-one name="parentid" not-null="true" class="productcategorymodel" co

sphinx search any variations from the initial search words -

how possible in sphinxsearch example lorem ipsum dolor find first lorem ipsum dolor then lorem ipsum ipsum dolor lorem dolor then lorem ipsum ipsum any variations initial search words use extended query , write "lorem ipsum dolor"/1 which says 1 of words required (quorum syntax). then play using different ranking modes. http://sphinxsearch.com/docs/current.html#builtin-rankers wordcount pretty this, maybe bit primitive. try matchany ranker - ranker old match mode, still pretty these types of queries.

sass - Generate sourcemap for each partial -

i'm using gulp-sass , each partials manages sourcemap , can using less did not see way sass. _partial.scss ( within have have mapfile ). _partial2.scss ( ). according specification sass-lang files starting _ not compilled. see also: https://github.com/sass/node-sass/issues/215 so rename partials gulp-rename : var sourcemaps = require('gulp-sourcemaps'); var gulp = require('gulp'); var sass = require('gulp-sass'); var rename = require("gulp-rename"); gulp.task('sass', function () { gulp.src('./scss/*.scss') .pipe(sourcemaps.init()) .pipe(rename(function (path) { path.basename = path.basename.replace(/^_/,''); })) .pipe(sass()) .pipe(sourcemaps.write()) .pipe(gulp.dest('./css')); });

sql update - Insert excel file into a temp table SSIS package -

what trying have ssis package import excel file sql update on records in excel file. tutorial great in data flow --> excel source --> ole db command (write sp create stage table (can't insert #temptable ssis, insert stage table, update table) in ole db command transformation. exec storedprocedure . want create variables in sp used insert . want map columns excel source variables inserted. sorry, don't have access ssis right unable provide screen shots.

angularjs - Offset index by 1 in ng-options -

i have selection dropdown populated object this: <select class="form-control" ng-model="nonexistantmodel" ng-options="idx idx+1 + order (idx, order) in amazon.orders"> i'm trying array indices show starting 1. (0,1,2,3 become 1,2,3,4) but of course idx+1 ends joining string , ends 01, 11, 21, 31 i've tried applying number filter no avail: (idx+1 | number: 0) or (idx | number: 0) + 1 or (idx | number: 0) + (1 | number: 0) but seem join strings same result. is there way accomplish this? simply change idx+1 idx*1+1 or idx/1+1 or idx-0+1 . see live example .

Merging JSON files using a bash script -

i new bash scripting. attempted write script merges several json files. example: file 1: { "file1": { "foo": "bar" } } file 2: { "file1": { "lorem": "ipsum" } } merged file: { "file1": { "foo": "bar" }, "file2": { "lorem": "ipsum" } } this came with: awk 'begin{print "{"} fnr > 1 && last_file == filename {print line} fnr == 1 {line = ""} fnr==1 && fnr != nr {printf ","} fnr > 1 {line = $0} {last_file = filename} end{print "}"}' json_files/* > json_files/all_merged.json it works feel there better way of doing this. ideas? handling json awk not terribly idea. arbitrary changes in meaningless whitespace break code. instead, use jq ; made sort of thing. combine 2 objects, use * operator, i.e., 2 files: jq -s '.[0] * .[1]' fil

mysql - Port Forwarding in python -

i writing python code query remote sql database. can in command line setting port forwarding and, in different shell, running mysql server. cant think of way of doing in python - there python module set port forwarding, return control python script (and better if can periodically check see if port forwarding still active!) tia, jack

elasticsearch - If I store a date in elastic search using a timestamp (e.g. 1428956853627), can I still query that record by day, without the time value? -

for example, if have mapping date field like: $ curl -xget http://localhost:9200/testing/blog/_mapping {"testing":{ "mappings":{ "blog":{ "properties":{ "posted":{ "type":"date", "format":"dateoptionaltime" }, "title":{ "type":"string" } } } } } } and insert record like: $ curl -xput http://localhost:9200/testing/blog/1 -d '{"title": "elastic search", "posted": 1428956853627}' {"_index":"testing","_type":"blog","_id":"1","_version":1,"created":true} using timestamp corresponding mon apr 13 15:27:33 cdt 2015, there way query out "plain old" date? instance, if want see posts posted on 4/13/15, try: $ curl -xget http://localhost:9200

java - Google maps mark (current location) crashes the application, how to fix it? -

i trying add current location mark android google map application in android studio. my code: private void setupmap() { location location = null; latlng loc = new latlng(location.getlatitude(), location.getlongitude()); marker marker; marker = mmap.addmarker(new markeroptions().position(new latlng((location.getlatitude()), location.getlongitude())).title("marker"));} it causes application crash. underneath there mistakes appeared while running application: http://postimg.org/image/qrxdo9dl5/full/ (i used postimage upload larger size screen-shot) before modified code, had working code set position 0,0: private void setupmap() { mmap.addmarker(new markeroptions().position(new latlng(0, 0)).title("marker")); then tried change location '0,0' read current latitude , longitude , show on google map. changed code based on post: how current location in google maps android api v2? i java beginner , appreciated. thank help. you getting

Difficulty returning junks in my C++ stack implementation -

i have implemented stack in c++, have problem returning junks. example, have: ... template<class t> t stack<t>::pop() { /* verific dacă există elemente pe stivă */ if( isempty() ) { t junk; fprintf(stderr, "no data.\n"); return junk; } ... } this not right way solving problem, because have valgrind error. how can solve it? this poor idea because (among other things) if t 's copy constructor can throw, can destroy data (removes item stack, copying return item throws, destroys copy). one way fix problem change interface this: void stack<t>::pop(t &ret) { if (!isempty()) ret = data[top--]; } or, provide indication of whether succeeded: bool stack<t>::pop(t &ret) { if (isempty()) return false; ret = data[top]; --top; return true; } this way, if copy constructor throws, top never decremented, item remains on stack. if execution gets p

visual studio 2013 - VS2013 line numbers not evenly spaced -

Image
this minorest of annoyances, nevertheless it's still annoyance. 1 day line numbers in visual studio 2013 stopped being evenly spaced... the lines of codes fine, line numbers weird. i'm guessing it's productivity power tools, life of me can't find setting fixes it. don't have other extensions installed affect that. else run this? the productivity power tools 2013 has option compress white space allow more code fit on screen. description the description on productivity power tools 2013 page says: syntactic line compression syntactic line compression enables make better use of screen's vertical real-estate. shrinks lines contain neither letters nor numbers 25% vertically, allowing more lines displayed in editor. other lines not affected. disabling setting you can turn off if bothers going to tools/options/productivity power tools/turn extensions on/off but find readability larger files.

Python Pandas Timestamp Subtraction vs. Numpy -

i having odd issue when subtracting timestamps in pandas (version 15.2) on python 3.4 incorrect y = pd.timestamp('2015-04-14 00:00:00') z = pd.timestamp('2015-04-14 00:01:01') np.timedelta64(z-y) >>>numpy.timedelta64(1000000,'us') correct w = np.datetime64(y) x = np.datetime64(z) np.timedelta64(x-w) >>>numpy.timedelta64(61000000,'us') correct y = np.datetime64('2015-04-14 00:00:00') z = np.datetime64('2015-04-14 00:01:01') np.timedelta64(z-y) >>>numpy.timedelta64(61,'s') does have explanation? seems issue pandas 0.15.2. upgrading 0.16.0 solves issue.

mongodb - `fields cannot be identical: ' ' and ' '` mongoimport error -

i'm trying import csv mongodb on local machine. used following commmand shell: mongoimport -d mydb -c things --type csv --file /users/..../agentsfulloutput.csv --headerline i following error: failed: fields cannot identical: '' , '' i can't find on means. doing wrong? csv file, way, result of mongoexport. here column headers , data: _id build_profile company_address company_name company_website created_at device _token downloaded_app email first_name last_name is_proapp modified_at mobile_phone terms_accepted_at license_number broker_id join_unique_url linkedin_profile_id billing_customer_id billing_zip mobile_phone office_phone vendors_count clients_count app_client objectid(52ab245b763f4aec448b6763) 0 california lateral test 2014-01-01t08:19:05.470z test test test 2015-04-18t05:16:37.155z (123) 123-1234 zip (123) 123-1234 10 5 objectid(52b46

Valgrind is telling me I have error and possible memory leak in this simple C program -

this question has answer here: valgrind reports errors simple c program 3 answers the challenge clear valgrind errors before going on next lesson, don't know what's wrong program. want know what's wrong before going on. thanks, appreciate help. #include <stdio.h> int main() { int age = 10; int height = 72; printf("i %d years old.\n", age); printf("i %d inches tall.\n", height); return 0; } here's valgrind report: ==41714== memcheck, memory error detector ==41714== copyright (c) 2002-2013, , gnu gpl'd, julian seward et al. ==41714== using valgrind-3.11.0.svn , libvex; rerun -h copyright info ==41714== command: ./ex3 ==41714== ==41714== conditional jump or move depends on uninitialised value(s) ==41714== @ 0x1003fbc3f: _platform_memchr$variant$haswell (in /usr/lib/system/libsystem_platform.d

How can I truncate 6.280369834735099E-16 to double in Java? -

how can 1 truncate 6.280369834735099e-16 000000000000000628 in java? have tried this? double d = 6.280369834735099e-16; numberformat formatter = new decimalformat("#.###################"); string f = formatter.format(d);

html - PHP: Echo IMG tag with two different ID -

i need print written 2 img tag different id use only 1 line echo code? example: $sql = mysql_query("select * products order pid"); while ($data = mysql_fetch_array($sql)){ echo "<div class=\"item\">\n"; echo "<div>"; echo "<img src=\"img/products/".$data['photo']."\" />"; echo "</div>"; echo "</div>\n"; } output: <div class="item"> <div> <img src="img/products/1.png" /> <img src="img/products/2.png" /> </div> </div> you need move outer html outside loop. way printed once while image tag printed each row. example: $sql = mysql_query("select * products order pid"); echo "<div class=\"item\">\n"; echo "<div>"; while ($data = mysql_fetch_array($sql)){ echo "<img src=\"img/products/".$data['photo&

javafx 8 - Apply table filter -

i have example of java table generates values every second. short example: mainapp.java public class mainapp extends application { private tableview<employee> table; private textfield txtfield; private observablelist<employee> data; myservice myservice; @override public void start(stage stage) throws exception { label lbl = new label("enter text below filter: "); initfilter(); inittable(); myservice = new myservice(); myservice.setdelay(new duration(300)); myservice.setperiod(new duration(1000)); myservice.start(); vbox container = new vbox(); container.getchildren().addall(lbl, txtfield, table); stackpane root = new stackpane(); root.getchildren().add(container); scene scene = new scene(root, 500, 400); stage.setscene(scene); stage.show(); } class myservice extends scheduledservice<void>

android - Function to Return a Buttons OnClick Listener Value -

i wondering if knew of way getting on click listener button set to. sort of like... btn1.getonclicklistner i want make if statement this... if (button.onclick == onclick1) { this... } else { this... } any appreciated i found easiest way take commonswares advice , create 1 onclick, using booleans give separate methods execute. below example in case else gets stuck trying accomplish task. thank helped , shared thoughts. public class mainactivity extends activity implements view.onclicklistener { boolean separateonclickactive; button btn1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn1 = (button) findviewbyid(r.id.button); btn1.setonclicklistener(this); separateonclickactive = false; } @override public void onclick(view v) { switch (v.getid()) { case r.id.button:

c# - Access denied Error in restoring SQL Server database WPF -

in application if application installed first time on client machine, application restore there database if database dose not exsist .. included .bak database according this artical : create folder under app in vs name e.g. "datafiles" add files folder using add link in dialog box after selecting add existing item on folder mark files copy if newer (copy output directory property) make sure build action content when publish files put in publish folder , part of application installation until every thing work fine.. the probelm when trieng restore database code, vs : "cannot open backup device, operating system error 5 (access denied.)." i tried run vs administrator not make change.. please can 1 me solve issue thanks in advance abdusalam

excel - Macro to pull data from closed workbook to another workbook -

i writing macro following: every time open workbook, pull data closed workbook on computer , copy data sheet titled "availability" starting in cell a1. currently, happens "true" put cell a1 on availability sheet. please help. sub openworkbooktopulldata() dim sht worksheet dim lastrow long lastrow = activesheet.usedrange.rows.count set sht = thisworkbook.worksheets(sheet1.name) dim path string path = "c:\users\" & environ$("username") & _ "\desktop\rc switch project\daily automation _ availability report.xlsx" dim currentwb workbook set currentwb = thisworkbook dim openwb workbook set openwb = workbooks.open(path) dim openws worksheet set openws = openwb.sheets("automation data") currentwb.sheets("availability").range("a1") _ = openws.range("a5:k" & lastrow).select openwb.close (false) end sub

linux - How to expand path containing environment variable in C++ -

is there way expand environment variables in path? example: std::string mypath = expandenv("$some_var/dir/") so when mypath printed contains absolute path result expanding $some_var ? remember seeing done somewhere, or might have implemented myself, can't remember where. i know windows have it, there in c++ stl, boost or linux headers that? i ended writing regex , expanded matches

c++ - strtok() - Why you have to pass the NULL pointer in order to get the next token in the string? -

this explanation of strtok(). #include char strtok( char* s1, const char* s2 );* the first call strtok() returns pointer first token in string pointed s1. subsequent calls strtok() must pass null pointer first argument, in order next token in string. but don't know, why have pass null pointer in order next token in string. searched 15 minutes, didn't find explanation in internet. strtok() keeps data in static variables inside function can continue searching point left previous call. signal strtok() want keep searching same string, pass null pointer first argument. strtok() checks whether null , if so, uses stored data. if first parameter not null, treated new search , internal data resetted. maybe best thing can search actual implementation of strtok() function. i've found 1 small enough post here, idea of how handle null parameter: /* copyright (c) microsoft corporation. rights reserved. */ #include <string.

java - Unable to run the javafx project using command line -

i had created javafx project in eclipse, ran in eclipse , works fine. wanted run project using command line interface. i able compile not able run , keeps on giving "error: not find or load main class main" compile command (works fine): javac -cp "c:\program files (x86)\oracle\javafx 2.2 runtime\lib\jfxrt.jar" main.java main.class created after above command. run command (doesn't work): java -cp "c:\program files (x86)\oracle\javafx 2.2 runtime\lib\jfxrt.jar;." main i know missing here in order run it. adding main.java package application; import java.io.ioexception; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.stage.stage; import javafx.scene.scene; import javafx.scene.layout.anchorpane; import javafx.scene.layout.borderpane; public class main extends application { private stage primarystage; private borderpane root; @override public void start(stage primarystage) { tr

F# Akka.NET agents performance optimization when synchronizing -

i trying solve following problem. have agents running in real-time, large heartbeat of couple of milliseconds, , order of operations process reason deterministic (as message processing not bottleneck). now, running large amount of simulations of system no longer have heartbeat (otherwise take couple of centuries) - need make sure order of operations preserved. this, adopted following solution: simulator makes sure each agent has processed message queue, posting dummy synchronization message , blocking while waiting answer. work application, time takes not intuitive - single threaded implementation order of magnitude faster (i guess - x 100 ish - although have not tested ). i have isolated small test shows issue, trying use library, akka.net type greet = | greet of string | hello of asyncreplychannel<bool> | hello2 [<entrypoint>] let main argv = let system = system.create "mysystem" <| configuration.load() let greeter = spawn system &qu

hibernate - How to combine the results of two HQL queries into one -

i have 2 hql queries need combine single set of results. both objectone , objecttwo derived same base class. objectone has the first query is... select //some things objectone objectone, objecttwo objecttwo objectone in elements(objecttwo.components) and second query is... select //some things objectone objectone left outer join objectone.parentobject parentobj parentobj.myfield null thanks in advance!

swift - Why is it that when I hit the return key in xcode when editing code it will add/overwrite lines instead of simply adding a new line? -

i brand new ios development, not programming. i've started using xcode , finding aspects of simple code editing incredibly frustrating. here problem. start out following code: func updatelabels() { targetlabel.text = string(targetvalue) scorelabel.text = string(score) roundlabel.text = string(round) } i want edit this: func updatelabels() { targetlabel.text = string(targetvalue) scorelabel.text = string(score) roundlabel.text = string(round) } instead, depending on cursor when hit return key either this: func updatelabels() { targetlabel.text = string(targetvalue) scorelabel.text = string(score) scorelabel.text = string(score) roundlabel.text = string(round) } or this: func updatelabels() { targetlabel.text = string(targetvalue) roundlabel.text = string(round) roundlabel.text = string(round) } this causing lot of frustration me. want blank new line. not copy , paste line 3 line 4 while keeping line 3. not ove

php - rewrite wordpress url from archive date to a specific page -

i trying use default archive calendar in wordpress show single page instead of archive. the default link blog/2015/04/13 , point agenda/?dato=2015/04/13 . i have tried best , stuck on following , cannot figure out why not working. function custom_rewrite_basic() { add_rewrite_rule('blog/([0-9]{4})/([0-9]{2})/([0-9]{2})/', 'agenda/?dato=$matches[1]', 'top'); flush_rewrite_rules(); } add_action('init', 'custom_rewrite_basic'); edit: not work went in direction , put following in archive.php of theme.: if(is_date()) { $year = get_query_var('year'); $monthnum = get_query_var('monthnum'); $day = get_query_var('day'); $pagelink=get_page_link (get_page_by_title( 'agenda' )) . "?dato=" . $year . "/" . $monthnum . "/" . $day; header("location: $pagelink",true,301); } that did trick , more useful if needs it..

python - Django variable from Model not outputting value in template -

the variable {{ post }} gives value in home page, , allows me redirect post page proper id; however, page redirected not display value {{ post }}. i'm not sure issue is, tried change multitude of things, can't seem find problem. how can variable {{ post }} give output on other pages? here index.html, , articles page: {% if news_posts %} <div class="row"> <div class="large-8 small-12 large-centered column" id="articles"> <ul class="article_posts"> {% post in news_posts %} <li id="article_title"><a href="{% url 'articles:post' post.id %}">{{ post.post_title }}</a></li> <li id="article_date">posted {{ post.post_date|timesince }} ago</li> <div id="arrow"></div> <hr> <li id="article_image"><img sr

vba - Create power point using excel macro -

i have interesting problem unsure of. have not worked power point , have little excel macro experience. have found many similar issues mine none of them quite fit bill. helping local charity fund raiser , need way make triva sort of game. game displayed powerpoint, , questions, choices, , answers in excel sheet. way laid our 1 question per row, , columns are: question, options, answers , category. i have managed category sorting quite easy enough, need somehow work creating power point slides in such way question title, options being content, , following slide answer question. therefore each question creates 2 slides, question , answer slide. example row (| denote column): which of these italian sculptor? | michelangelo, tintoretto, da vinci, galilleo | michelangelo | art so result side title "which of these italian sculptor?" , content a) michelangelo, b) tintoretto, c) da vinci, d) galilleo the following slide being "michelangelo"

How can I send a Java string with Unicode characters to C++ via socket, without strange characters? -

i working on application android phone can import sms, read them , reply sms. worked planned when programming server , client. if had problems, google search gave me solutions, time, first time of life, asking help. the problem: the problem is, when client(java) sends sms content contains unicode characters such "å, ä, ö" , c++ cannot read them. my program works sends packet size first make other aware of how big packet come. e.g java calculates packet 121 bytes , sends server. if packet contains few non ansi characters, c++ not receive 121 bytes, 123 bytes, , non-ansi chars become strange. i've been googling day without answers. i've tried wchar_t in c++, i've tried set in java sent using utf-8, i've been debugging hours recreate problem , try different things, without success! so going on here? how can text java c++ in correct size , representation in java? packets without unicode chars works fine. thank guys! little tired atm, hope didn'