Posts

Showing posts from February, 2014

Special Character(Unicode character ) in i/p file, R v 3.2.0. considers it as End of file -

i have csv file contains special character in utf-8 bom. issue here while reading file in r considers "special character" end of file , file in not read completely. have attached screen shot of special character line. help highly appreciated. thanks attached image containing special character

jquery - Converting inline Javascript to an onclick event -

i'll blunt. of skill in pure html , css. i'm trying more , more expand javascript , jquery , have experience, enough understand many simple tutorials , implement them own changes, not enough on own without cheatsheet or similar example work from. anyway: i wanted try this tutorial found use ajax replace contents of div, implementation requires poor markup (inline js). doesn't suggest way utilize onclick event instead, , prefer inline js. this "ajax engine" provides, choose import/link because feel it's silly dump in html: <script type="text/javascript"> // version 1.1 of may 16, 2013 function requestcontent(url,id) { var http; if (window.xmlhttprequest) { try { http = new xmlhttprequest(); } catch(e) {} } else if (window.activexobject) { try { http = new activexobject("msxml2.xmlhttp"); } catch(e) { try { http = new activexobject("microsoft.xmlhttp"); } catch(e) {} } } if(! ht

scala - Mocked service class is not working as expected while testing controller with Guice -

i have controller uses dependency injection , looks that: class formfieldvalues @inject() (ffvaluesrepo : formfieldvaluerepository) extends controller classlogger { /** * gets formfieldvalue obejct checllist revision id * * @param revid * @return */ def getall(revid: muid) = action { implicit request => db.withtransaction { implicit connection => logger.info("injected repo: " + ffvaluesrepo) val values = ffvaluesrepo.getallforchecklistrevision(revid) logger.info("values: " + values) // forse json ok(json.tojson(values)).as("application/json") } } } the actual execution of controller works expected. however, when trying build test with mocked repository, mocking not seem picking properly. this current test: class formfieldvaluesspec extends specification mockito{ lazy val mockffvaluerepo = mock[formfieldvaluereposit

webforms - asp.net button appears enabled but does not react to mouse hover or click -

i have cmdcancel , cmdlaunchreport buttons appear enabled, not react mouse hover nor mouse click. can tab these buttons focus there , press keyboard [enter]-key send postback server. there similar code (nearly identical div rather asp.panel surrounding 2 buttons), , other pages work expected. have checked code-behind , server-code , there no code referencing panel nor buttons nor div(s). what else uncover fault rather routine set of code? comments welcome. here aspx: <div id="pagingdiv" class="rpt_pagingdiv" > <asp:panel id="divrptactionbuttons" runat="server" style="float: left; margin-left: 0em;" enabled="true" > <asp:button id="cmdcancel" runat="server" skinid="cmdbutton" text="close" style="margin-left: 0.5em;" enabled="true" /> <asp:button id="cmdlaunchreport" runat="server" skinid="cmdbutt

android - How to get Environment.getExternalStorageDirectory().getAbsolutePath() from libGDX class? -

Image
i have game flappy bird. want save highscore in text file. first need directory path. here can see unable call environment external storage directory. why happening? is because calling environment core directory? if how can directory class? thanks in advance... yes, because calling environment core directory. can in android directory have: public static string foo="bar"; and access core class classname.foo . edit: in case, try use libgdx data write/read instead of calling android. please check this: libgdx documentation

xcode - Service (OS X) won't start automatically on demand, says my OS version is too old -

Image
i have text-inserting os x service ( created mark aufflick , i've been hacking on it ) that's giving me odd problem. the service .service application, installed in ~/library/services. pbs has been duly run rehash services list. the problem is, if choose service while isn't running, error message: i'm on 10.7.5. mark's original version required 10.8, changed deployment target 10.7, cleaned, , built, , build of service on system built 10.7 setting (which info.plist in project uses value of lsminimumsystemversion , can see there). if launch service manually, finder, don't problem. service launches , runs , can invoke other applications. aside possibilities of salesman having driven on cpu board, computer room being moved , our systems being down weekend, or system having consumed paper paging, causing this? perhaps it's not approved fcc?

php - PHPUnit error call to undefined method on mock -

i getting error: call undefined method mock_simpleinterface_8a93e777::mymethod() when call mymethod() on simple class mock. class playgroundtest extends \phpunit_framework_testcase { public function testmock() { $class = $this->getmockbuilder('\playground\simple')->getmock(); $class->mymethod(); } } the simple class implementation namespace playground; class simple { public function mymethod() { print "hey!"; } } according phpunit docs ( https://phpunit.de/manual/5.1/en/test-doubles.html ), states "by default, methods of original class replaced dummy implementation returns null (without calling original method)." shouldn't able call mymethod() , null return value? want avoid specify class methods. phpunit should clever enough know methods can called on mock or not. is bug? i'm using phpunit 5.1.4 your assumptions correct, have error somewhere else or did not sho

python - PassEnv variable OPENSHIFT_POSTGRESQL_DB_HOST was undefined at Openshift -

for python 3.3 cartridge , postgresql 9.2 on openshift. when ssh openshift app can see content of openshift_postgresql_db_host: echo $openshift_postgresql_db_port 5432 however wsgi script env vars not passed - see part python.log: [fri jan 15 16:27:33 2016] [notice] sighup received. attempting restart [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_cron_dir undefined [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_postgresql_db_password undefined [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_postgresql_db_socket undefined [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_postgresql_db_host undefined [fri jan 15 16:27:33 2016] [warn] passenv variable pguser undefined [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_postgresql_ident undefined [fri jan 15 16:27:33 2016] [warn] passenv variable pgdatabase undefined [fri jan 15 16:27:33 2016] [warn] passenv variable openshift_postgresql_db_pid undefined [fri jan 15

java - Methodology to evaluate any change in android aimed at performance gains -

when making change in android application , wanting evaluate if improves in performance, standard steps do? there must standard things check using either android studio or mat. main interest checking memory usage has been improved. update: clarify. not running big issue memory need improve. interested in testing believe optimize memory usage not sure how verify it android studio device monitor first step go. 1) check how memory using before , after change via android monitor(memory tab) 2) mat, check if there can code can cause oom/memoryleak, check before , after change hprof files understand. for memory these 2 options can checked, other these, can check cpu/gpu usage well.

ios - Enterprise app installing but immediatelly dissapears -

i'm trying install enterprise app after alert on webpage says install app icon changes 1 selected on device , after dissappears. i search , found caused different bundle id on manifest , app not seems problem. deleted , re make certificates , provisioning profiles distribution on house. and of course have enterprise developer account. when try install app console log of device thing doesn't gives significant information: jan 15 16:36:52 iphone-de-sergio itunesstored[108] <warning>: launchservices: installing placeholder <lsapplicationproxy: 0x137985e30> com.company.product <(null) *not found in database*> jan 15 16:36:52 iphone-de-sergio installd[46] <notice>: 0x16e1bb000 -[miclientconnection installpath:withoptions:completion:]: install of "/var/mobile/library/caches/com.apple.itunesstored/appplaceholders/2472169525513059198.app" type placeholder (lsinstalltype = 1) requested itunesstored (pid 108) jan 15 16:36:52 iphone-de-sergio

sql - How to "collapse" rows? -

so, if current resultset is: set | label | val ------------------------ | "laba" | null | "laba" | 1 | "labb" | null | "labb" | 2 b | "laba" | null b | "laba" | 3 b | "labc" | null what want is: set | label | val ------------------------ | "laba" | 1 | "labb" | 2 b | "laba" | 3 b | "labc" | null how can "collapse" rows desired resultset? you need max() aggregate group by on set , label columns: select set, label, max(val) val yourtable group set, label order set, label

wix - Don't install if a program is running -

i have wix installer. how can prevent install if program running? don't want have installer close program. may not in state safe close. want tell user need close application , either wait user close it, or exit install. i removed <dialogref id="msirmfilesinuse" /> , appears prevent installer prompting close application. however, default fileinuse dialog allows ignore fact files in use. tried find way remove ignore option unable to. best option come remap "ignore" button "exit". <publish dialog="filesinuse" control="ignore" event="enddialog" value="exit">1</publish> i first tried map "ignore" "retry". worked first time filesinuse dialog appeared, not after retried once. this hack, best option i've found far.

scroll - specify parent for .position() jquery? -

is possible specify parent .position()? i'm trying make smooth scrolling work towards anchor points inside scrollable div , can't use .offset() since uses document offset instead of parent. my problem anchors nested inside other elements , need relative position of anchor towards scrollable div in order use scrolltop in animation correctly. should write script check whether it's nested , add each parent element's position().top till scrollable div parent? or there easier way it? if it's not yet possible, should propose feature request @ jquery? think proof useful others aswell having same sort of problem. edit: here example of meant not being able use .offset(): http://codepen.io/anon/pen/rxgrnj click on few links , see how responds... example: home -> contact -> us. i'm should getting relative position top of main instead of document offset. html: <nav> <ul> <li><a href="#home">home</a></l

regex - Python: Why do raw strings require backslash to be escaped? -

this question has answer here: can't escape backslash regex? 5 answers this explanation python documentation: both string , bytes literals may optionally prefixed letter 'r' or 'r'; such strings called raw strings , treat backslashes literal characters. result, in string literals, '\u' , '\u' escapes in raw strings not treated specially. given python 2.x’s raw unicode literals behave differently python 3.x’s 'ur' syntax not supported. if raw strings treat backslashes char literals, why backslash need escaped in expression: re.compile(r"'\\'") instead of being able write: re.compile(r"'\'") to capture single backslash when using re module? because '\' has special meaning in re means escape character after in language use define re if want match '+'

msbuild - TFS build step WriteCustomSummaryInfo with Replace -

Image
how run "replace" within writecustomsummaryinfo step. i'm trying display link html report on build summary: get drop location do: \tfsbuild03\temp\dev-deployment\dev-deployment_20160115.22 replace \ / , append report.html @ end i assume way it. i've tried following doesn't work: string.format("dotcover [coverage results]file:({0})/{1}", replace(droplocation,"\","/"), "report.html") edit i figured out. it's suppose this: string.format("dotcover [coverage results]file:({0})/{1}", droplocation.replace("\", "/"), "report.html")

MySQL Query: GROUP BY without loosing rows in result -

i have written mysql query, not quite happy output. the query looks this: select f.id, s.time, f.name, f.value entries s, entry_details f f.id = s.id , (f.name = 'fruit' or f.name = 'vegetable'); and produces result: id | time | name | value ---|------------|-----------|-------- 4 | 2016-01-14 | fruit | banana 4 | 2016-01-14 | vegetable | carrot 5 | 2016-01-14 | fruit | apple 5 | 2016-01-14 | vegetable | corn while info required in there, wondering if there way results f.id 1 row? using group f.id achieved wanted, vegetable rows disappears. is possible mysql alone? yes, need combine(aggregate) rest columns: select f.id, max(s.time) `time`, group_concat(f.name) `name`, group_concat(f.value) `value` entries s join entry_details f on f.id = s.id f.name in('fruit', 'vegetable') group f.id; avoid using old comma join syntax, use newer join instead. output: ╔════╦═════

objective c - NSDecimalNumber from NSString not equal? -

i've got weirdest thing happening. code: nsstring *input = @"357835487953487345879345897345897345897534"; nslog(@"%@", input); nsdecimalnumber *number = [nsdecimalnumber decimalnumberwithstring:input]; nslog(@"%@", number); output: 357835487953487345879345897345897345897534 357835487953487345879345897345897345890000 so number's aren't same, has accuracy of floating point numbers. can these equal? why replacing last few digits zero? check documentation nsdecimalnumber nsdecimalnumber, immutable subclass of nsnumber, provides object-oriented wrapper doing base-10 arithmetic. instance can represent number can expressed mantissa x 10^exponent mantissa decimal integer 38 digits long, , exponent integer –128 through 127. when run code same until 38th digit: 357835487953487345879345897345897345897534 357835487953487345879345897345897345890000

C# Socket Exception : an attempt was made to access a socket in a way forbidden by its access permissions -

this code using. code got internet, said working fine. comments don't understand why not working me. , 1 more thing using application user mode not in administrator mode. private void btnstart_click(object sender, eventargs e) { if (cmbinterfaces.text == "") { messagebox.show("select interface capture packets.", "mjsniffer", messageboxbuttons.ok, messageboxicon.error); return; } try { if (!bcontinuecapturing) { //start capturing packets... btnstart.text = "&stop"; bcontinuecapturing = true; //for sniffing socket capture packets has raw socket, //address family being of type internetwork, , protocol being ip console.writeline("1"); mainsocket = new socket(addressfamily.internetwork,

javascript - FullCalendar Scheduler : Parallelogram Shaped Events -

Image
i change event shape square parallelogram, see image below example: i tried changing css .fc-event-container{ background-color:rgba(2,2,2,0.9); float:left; skew -webkit-transform: skew(-60deg); -moz-transform: skew(-60deg); -o-transform: skew(-60deg); transform: skew(-60deg); } but distorted event container, see image using info here how skew element keep text normal (unskewed) .fc-content { skew -webkit-transform: skew(60deg); -moz-transform: skew(60deg); -o-transform: skew(60deg); transform: skew(60deg); } seems work https://jsfiddle.net/qjls3tfa/ the float: left may cause shrink event though seen in month view in fiddle

c++ - Using Cmake, how do I prevent library sources from being included in my IDE? -

Image
using bunch of different libraries in project (from github sources, not precompiled), add them target in root cmakelists.txt file: add_subdirectory(lib/glew-1.13.0/build/cmake) include_directories(system ${project_source_dir}/lib/glew-1.13.0/include/) ... target_link_libraries(myapp glew ${glew_libraries} ... ) however, can see screenshot below xcode includes of sources libraries in project, makes insanely long list have scroll through find my code. i have tried exclude_from_all flag in add_subdirectory command, removes library sources xcode project, cannot compile project because xcode doesn't compile library @ all. additionally, xcode gives me tons of warnings libraries don't care about. using system flag include_directories command doesn't fix it. what's best way solve this? should compiling libraries separate part of build process rather compiling them executable? i'm not sure how work, try this: turn on use_folders in root cm

iis - Enable cross site access in OK Hosting? -

i'm trying download bootsrap fonts container have in site hosted ok hosting. can download font manually when using in css on page hosted in server, fails because cross site access disabled. i know ok hosting uses iis give web based control panel. how enable cross site access? ok, have add file called web.config @ root of site following: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" /> </customheaders> </httpprotocol> </system.webserver> </configuration>

javascript - Why my numbers are not updating by themselves? -

so, using jquery-calx calculate price of items. have different price depending on base choise , quantity. if user chooses 100 peaces of full color base price different 100 pieces of 1 side monochromatic pattern. working in code, there thing; if choose 1 side monochromatic , them 100 pieces, price in total area ok, if change base full color, example, price doesn't update. in case, if click again in quantity price update. know if possible make update smoothly. maybe create button update, don't know. appreciate help! below follows code: <form class="form-horizontal" id="meishi" data-calx-identifier="calx1452836013763"> <div class="form-group"> <label class="col-lg-1 topic text-left">base</label> <div class="col-lg-2"> <label class="radio-inline"> <input type="radio" name="design" data-cell="a1" value="10800&

c++ - QT - No default version found Visual Studio 2015 -

Image
this question has answer here: how fix qt vs add-in qt 5.6 beta , vs2015? 1 answer i have problem qt in visual studio 2015. open qt project, when press on file.ui, recive following error:no default qt version found, if have path setted correctly. can me, please? since working in visual environment, kindly download qt installer: http://caesar.ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/5.9/5.9.0/qt- moreover, must have installed qt visual studio extension. environment visual studio 2015, vstoolqt extension located on menu navigated directory qt installed, navigate c:\qt\qt5.9.0\5.9\msvc2015_64. it solve issue.

xml - Android - DataBinding with Preference activity -

i set data binding in xml when go preference activity set binding cant. file data binding xml in called preference.xml assume there should generated class called preferencesbinding instead there not. should not auto generated ? code in preferenceactivity.java wont compile following: override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); preferencesbinding binding = databindingutil..... //what put here ??? preferenceactivity not activity admin user = new admin(true); binding.setuser(user);//this want addpreferencesfromresource(r.xml.preferences);//this not necessary if can databinding work //..rest of code not important } i starting think data binding not work preference screens, can ? the preferences.xml file if neseccary looks this: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/andr

hadoop - how to set spark RDD StorageLevel in hive on spark? -

in hive on spark job , error : org.apache.spark.shuffle.metadatafetchfailedexception: missing output location shuffle 0 thanks answer ( why spark jobs fail org.apache.spark.shuffle.metadatafetchfailedexception: missing output location shuffle 0 in speculation mode? ) , know may hiveonspark job has same problem since hive translates sql hiveonspark job, don't how set in hive make hiveonspark job change storagelevel.memory_only storagelevel.memory_and_disk ? thanks help~~~~ you can use cache/uncache [lazy] table <table_name> manage caching. more details . if using dataframe's can use persist(...) specify storagelevel. @ api here. . in addition setting storage level, can optimize other things well. sparksql uses different caching mechanism called columnar storage more efficient way of caching data (as sparksql schema aware). there different set of config properties can tuned manage caching described in detail here (this latest version documentation.

php - Trying to setup LAMPy -

i new using (ubuntu) linux platform web design, , attempting install lamp allow me view work locally. have installed - running few problems , not know route take since newish linux well. i trying access phpmyadmin via http://localhost first of problems popped up. don't know login , password should - didn't setup during installation of lamp server. after testing few different probable account/password combinations see gives me error message saying "#1045 can't log in mysql server" so, opened terminal see if mysql running, , error 1045 (28000) access denied user 'root'@'localhost' (bla bla bla) you should try username root , no password. by default mysql installed username root , blank password the password set password in versions. if still not able login please share installation procedure lamp stack.

ios - How to set AutoLayout constraint of UIimageView with UIButton? -

Image
this tree include cicle uiimageview's image, text in circle uibutton. when device changed, iphone5 change iphone6 plus, image scale big. button move circle's outside. how solve problem? autolayout has feature called propotion. means selecting 2 ui objects can set propotion between them constraint such width, height, etc.. in tour case select imageview , button move constraints view, double click on objects width constraint i.e either button width or image width. there can find option called propotion. per requirement want have button inside image view, means buttom propotion should less imageview propotion. can set 2:3, means button width 2/3rd part of imageview. button part of imageview irrespective of device run.

database - MapReduce: How to join 2 tables: R(a,b) x S(c,d) where b<c -

given in each record, have table_name(r/s) | attribute_1(a/c) | attribute_2(b/d) . . . for example can content of input file: r|$a_1$|$b_1$ r|$a_2$|$b_2$ s|$c_1$|$d_1$ r|$a_3$|$b_3$ s|$c_2$|$d_2$ an output lines of: $a_i$|$b_i$|$c_j$|$d_j$ ,where $b_i < c_j$ (this exercise in book "mining of massive datasets". on page 22 of link: http://infolab.stanford.edu/~ullman/mmds/ch2.pdf (exercise 2.3.5). book freely available) i've spend half day , on internet , still have no clue how solve it...

java - how to sort String array Number and bind in array list in android -

list<string> list2 =new arraylist<string>(); int iarr[] = new int[ja.length()];//{"846001","846005","846000","846002","846009"} arrays.sort(iarr); (int = 0; < ja.length(); i++) { _jobject = ja.getjsonobject(i); iarr[i] = integer.parseint(_jobject.getstring("pincode")); } for(int k=0;k<iarr.length;k++) { list2.add(string.valueof(iarr[k])); } i want sort , bind in array list. want {"846000", "846001", "846002" ,"846005", "846009"} but not sorting according given logic please suggest me doing wrong. i think issue sorting array before manipulating it. should move arrays.sort(iarr) after for loop. list<string> list2 =new arraylist<string>(); int iarr[] = new int[ja.length()];//{"846001","846005","846000","846002","846009"} (int = 0; < ja.length();

unix - Moving all matching files containing spaces and appended different text with wildcards in bash -

i have directory generates report daily , i'm writing script move old report trash , rename before generating next report. e.g. directory file report - sat 16-01-2016.txt as files generated same constant 'file\ report - ' e.g. file report - tue 12-01-2016.txt file report - wed 13-01-2016.txt file report - thur 14-01-2016.txt file report - fri 15-01-2016.txt i thought use bash code e.g. mv -f ~/desktop/file\ report\*.txt ~/.trash/"old file report".txt however add word "old" front of file whilst keeping whatever day , date comes after. e.g. file report - tue 12-01-2016.txt would become old file report - tue 12-01-2016.txt i thought use variable , store file name in it. i'm not sure how code this. old=$(echo ~/desktop/'file report - '*.txt) mv -f ~/desktop/file\ report\*.txt ~/.trash/"old "$old.txt i know wrong syntax. i'm reading few of man pages including find see if better grabbing file name store

Python splinter. How to select dropdown list which doesn't have name in option section -

i try select "local host" dropdown list has following html code: <select id="server_select"> <option></option> <option> local host </option> <option> ah005 </option> </select> here python code use splinter module select ah005 dropdown list failed. server_list = browser.find_by_xpath('//select[@id="server_select"]//option[@selected="local host"]').first server_list.click() and got error: traceback (most recent call last): file "splinter_test.py", line 22, in <module> server_list = browser.find_by_xpath('//select[@id="server_select"]//option[@selected="local host"]').first file "/users/bibo_mbpr/anaconda/lib/python2.7/site-packages/splinter/element_list.py", line 53, in first return self[0] file "/users/bibo_mbpr/anaconda/lib/python2.7/site-packages/splinter/element_list

css - html on tumblr div height not behaving -

Image
i've got html css, in fact: <html> <head> <title>{title}</title> </head> <style> html { background-image: url('http://i.imgur.com/9svrabs.jpg'); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } header { width: 100%; height: 100%; position: relative; background-image: url('http://i.imgur.com/5rvc2sw.png'); } h1 { font-family: 'montserrat', 'helvetica neue', "arial", sans-serif; } #title { margin: auto; display: inline-block; width: 100%; text-align: center; } #navigation { display: inline-block; } </style> <body> <header> <div id='navigation'> <a href='/art'>art</a><br><br> <a href='/music'>music</a>

c - Visual Studio 2015 shows Debug Assertion Failed -

i have made simple file reading program runs in dev c gcc compiler, shows error debug assertion failed . searched , has asked same question 12 days ago, answer shows error on statement if (file = fopen (name, "w+") == null) { ... } and says separate 2 statements as file = fopen(name, "w+"); if (fp == null) { ...} my code #include<stdio.h> #include<conio.h> #include<stdlib.h> int main() { int nos = 0, noc = 0, nol = 0; char ch; file *fp; fp = fopen("sarju.txt", "r"); while (1) { ch = fgetc(fp); if (ch == null) { printf("the file didn't opened\n"); break; } if (ch == eof) break; noc++; if (ch == ' ') nos++; if (ch == '\n') nol++; } if (ch != null) fclose(fp); printf("number of space : %d\nnumber of charact

javascript - How to replace undefined values with empty string in an array object? -

array object: var jsonlist= { "list": [{ "column_name": "control_master_id", "referenced_column_name": "control_master_id", "referenced_table_name": "tbi_controls_master", "table_name": "tbi_widget_controls" }, { "column_name": "authorization_id", "referenced_column_name": "authorization_id", "referenced_table_name": "tbi_authorization_master", "table_name": "tbi_controls_master" }, { "column_name": undefined, "referenced_column_name": undefined, "referenced_table_name": undefined, "table_name": "tbi_widget_controls " }] } expected solution: var jsonlist={ "list": [{

swift - how to fix this dictionaryValue -

alamofire.request(.get, "https://maps.googleapis.com/maps/api/place/details/json", parameters:["placeid": x , "key":"aizasyaasdaxw-j8diggjy58_hdrasdaqqa"]) .responsejson { (responsedata) -> void in //debugprint(responsedata) switch responsedata.result{ case .success(let req): let response = json(req) let items = response["result"]["geometry"]["location"].dictionaryvalue let lat: double = double(items["lat"]!.doublevalue) let lng: double = double(items["lng"]!.doublevalue) print(lat,lng) item in items{ self.mapresult.append(mapmodel(json:item)) // *this error cannot convert value of type '(string:json)' expected argument type 'j

c++ - Stream while serializing with Cap'n'Proto -

consider cap'n'proto schema this: struct document { header @0 : header; records @1 :list(record); // large number of records. footer @2 :footer; } struct header { numberofrecords : uint32; /* fields */ }; struct footer { /* fields */ }; struct record { type : uint32; desc : text; /* more fields, relatively large in total */ } now want serialize (i.e. build) document instance , stream remote destination. since document large don't want build in memory before sending it. instead looking builder directly sends struct struct on wire. such additional needed memory buffer constant (i.e. o(max(sizeof(header), sizeof(record), sizeof(footer))). looking @ tutorial material don't find such builder. mallocmessagebuilder seems create in memory first (then call writemessagetofd on it). does cap'n'proto api support such use-case? or cap'n'proto more meant used messages fit memory before sending? in example, document struct omitted , 1

c++ - How to link an unreferenced variable in a separate cpp file in a static lib? -

here class definition below in "init. cpp ": //-------------------init.cpp----------------- // ... class cnetinit { public: cnetinit(){::wsastartup();} ~cnetinit() {...} }; static cnetinit s_initor; // ... //--------------------------------------------- i added cpp static library , , reference lib project, cnetinit's constructor can never executed because no there no reference cpp. how can make work without adding useless reference cpp importing unit? comment: infact sample, code compiled in xcode , gcc, there standard or non-standard way(like compiler options) this? you must compile file , link output other object files. way adding variable defined in application.

Is there an Windows 8 API that we can leverage to read barcodes? -

i looking html/javascript sample can use on windows 8 app read barcodes. there couple apps can read barcodes in store. however, must using c# because not able find sample uses html/javascript able read barcodes. know barcodes have specific requirements, looking sample here. does know can find simple sample? thank reading. yes - zxing open source library reading 1d , 2d barcodes. there few ports including 1 winrt can found here: http://zxingnet.codeplex.com/ . should able reference in application component , call winjs.

cmake - cmake_current_source_dir used as avariable -

please check below scenerio : cmakelists_1.txt set( variable_name ${cmake_current_source_dir}/sub_folder1 ${cmake_current_source_dir}/sub_folder2 ) cmakelists_2.txt include_directories( ${variable_name} ) now when cmakelists_2 executes doesn't include files present in sub_folders. works if give absolute path sub_folders in cmakelists_1. please point me if missing something. cmake_current_source_dir current source directory cmakelists.txt mentions lives. expands different depending on directory used from. expanding you, , how different hard-coded path works? once see difference you'll know how fix it, in both files this: message(${variable_name}) then re-run cmake , see prints.

magento - mysql drop statement with -- -

what difference between drop table , --drop table in mysql for example: i'm getting error if use -- in other places of magento using -- before drop. --drop table if exists {$this->gettable('faq/dinkchika')}; create table if not exists {$this->gettable('faq/dinkchika')} ( `faq_id` int(11) not null auto_increment, `faq_question` varchar(255) default null, `faq_answer` varchar(255) default null, primary key (`faq_id`) ) engine=innodb default charset=utf8; "); use white space after -- ,if not using whitespace after -- not count comment.after whitespace query this. -- drop table if exists {$this->gettable('faq/dinkchika')}; create table if not exists {$this->gettable('faq/dinkchika')} ( `faq_id` int(11) not null auto_increment, `faq_question` varchar(255) default null, `faq_answer` varchar(255) default null, primary key (`faq_id`) ) engine=innodb default charset=utf8; "); or may use #(hash) , tr

java - How to create my own custom Dropwizard bundle? -

in documentation there short note bundles : a dropwizard bundle reusable group of functionality, used define blocks of application’s behavior. and that's all. know there's interface called bundle, configuredbundle , managedbundle, there's neither example nor tutorial how use these interfaces. can show example? possible duplicate of looking dropwizard bundles addons dropwizard make easy add small pieces of functionality. example, if use assets bundle, can attach ui api testing purposes , run on same port , easy use. example migrations bundle ties liquibase dropwizard can run database migrations same jar. works since api accessing sql database has connection parameters defined in yml file, migrations able run on same database. i highly suggest looking this git repository, there 2 or 3 examples there might give better idea on dropwizard bundles are.

c++ - llvm function pass ReplaceInstWithInst malloc -

#include "llvm/pass.h" #include "llvm/ir/module.h" #include "llvm/ir/function.h" #include "llvm/support/raw_ostream.h" #include "llvm/ir/legacypassmanager.h" #include "llvm/ir/instrtypes.h" #include "llvm/transforms/ipo/passmanagerbuilder.h" #include "llvm/ir/irbuilder.h" #include "llvm/transforms/utils/basicblockutils.h" using namespace llvm; namespace { struct replacepass : public functionpass { static char id; replacepass() : functionpass(id) {} virtual bool runonfunction(function &f) { allocainst* insttoreplace = ??? basicblock::iterator ii(insttoreplace); replaceinstwithinst(insttoreplace->getparent()->getinstlist(), ii, new allocainst(type::int32ty, 0, insttoreplace)); return true; } }; } char replacepass::id = 0; static void registerreplacepass(const passmanagerbuilder &, legacy::passmanagerbase &pm) { pm.add(new re

Concatenating strings in HAProxy -

i'd have throttling rule in haproxy limits rate @ user can load particular path, don't know of way concatenate strings in haproxy (at least, in context of generating key stick table). i'd is tcp-request content track-sc1 concat(req.cook(user), path) tcp-request content reject if {sc1_http_req_rate gt 10} haproxy manipulate string prior map lookup suggests using regsub similar, think can constant manipulations that. the best i've come far track path , req.cook(user) separately, , reject if each of them high, isn't actual behavior i'm looking for.

java - ComboBox cannot be cast to TextField? -

i have arraylist of javafx.scene.control.control (arraylist) 2 different underclasses of control(combobox, textfield). so want update list new input (example) in both of them. but when try it, eclipse makes error this: exception in thread "javafx application thread" java.lang.classcastexception: javafx.scene.control.combobox cannot cast javafx.scene.control.textfield @ application.documentbuildup.aktualisiereliste(documentbuildup.java:34) @ application.mainstage$2.handle(mainstage.java:99) @ application.mainstage$2.handle(mainstage.java:1) @ com.sun.javafx.event.compositeeventhandler.dispatchbubblingevent(unknown source) @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(unknown source) @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(unknown source) @ com.sun.javafx.event.compositeeventdispatcher.dispatchbubblingevent(unknown source) @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(unknown sour