Posts

Showing posts from July, 2015

google app engine - Asynchronous requests in AppEngine -

i'm building app following: get user enter parameters. pass params backend , start task based on params. when task complete redirect user page showing results of task. the problem here task expected take quite long. hoping make request asynchronous. appengine allow ? if not, options ? looking @ documentation task queues. while satisfies part of i'm trying do, i'm not clear on how queue notifies client when task complete, redirect can initiated. also, if results of task have returned calling client ? possible ? you can't (shouldn't really) wait completion, gae not designed that. launch task, task id (unique, persisted in app) , send id client in response launch request. the client can check, either polling (at reasonable rate) or on-demand, status page (you can use id find right task). can add progress/eta info on page, down road if desire. after task completes next status check request client can redirected results page mentioned. this...

darwin - What is '@_silgen_name' in Swift language? -

while reading darwin library in swift 2.2, found below codes. @warn_unused_result @_silgen_name("_swift_darwin_sem_open2") internal func _swift_darwin_sem_open2( name: unsafepointer<cchar>, _ oflag: cint ) -> unsafemutablepointer<sem_t> what '@_silgen_name' in 2nd line? i found below information here , want more detail information, apple developer library. if it’s specific set of swift functions want call c, can use @_silgen_name attribute override mangled name, and/or make them @convention(c) use c calling convention. @_silgen_name renamed @asmname ( see following commit ) following commit message: this reflects fact attribute's only compiler-internal use , , isn't equivalent c's asm attribute, since doesn't change calling convention c-compatible. so general swift developer, 1 wouldn't come across attribute, unless working with, say, porting swift other platform. now, @_silgen_name att...

PHP: using sub-namespace class inside a namespace -

suppose have top-level namespace \outer , have sub-namespace \outer\inner , have top-level namespace \inner and in class in \outer use inner this use inner; then inner used? \outer\inner // ( sub-namespace ) or \inner // ( top-level namespace ) i confused because php said \ optional top-level namespaces? when have namespace \outer in class use inner going using inner top-level namespace. if want use subnamespace sould \outher\inner as stated in php using namespaces lets first file was: <?php namespace outer\inner; <?php namespace outer; /* qualified name */ inner\foo(); // resolves function outer\inner\foo

dom - get element id using classname with multiple element with same class name in c# -

private void button5_click(object sender, eventargs e) { htmlelementcollection links = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement link in links) { if (link.getattribute("classname")== "input-style1 psgn-name") { textbox10.text = link.getattribute("id"); } } } result: id of 4th element id out of 4 element same class. how rest of 3 element id? your overwriting text value each iteration of loop. updated code: private void button5_click(object sender, eventargs e) { htmlelementcollection links = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement link in links) { if (link.getattribute("classname")== "input-style1 psgn-name") { textbox10.text += link.getattribute("id"); } } } if wanted put first 4 items found if exist in different t...

c++ - Regex to replace all occurrences between two matches -

i using std::regex , need search , replace. the string have is: begin foo spaces , maybe new line( text replace foo foo bar foo, keep rest ) more text not replace foo here only stuff between begin .... ( , ) should touched. i manage replace first foo using search , replace: (begin[\s\s]*?\([\s\s]*?)foo([\s\s]*?\)[\s\s]*) $1abc$2 online regex demo online c++ demo however, how replace 3 foo in 1 pass? tried lookarounds, failed because of quantifiers. the end result should this: begin foo spaces , maybe new line( text replace abc abc bar abc, keep rest ) more text not replace foo here question update: i looking pure regex solution. is, question should solved changing search , replace strings in the online c++ demo . i have come code (based on benjamin lindley's answer ): #include <iostream> #include <regex> #include <string> int main() { std::string input_text = "my text\nbegin foo 14 spaces , maybe \nnew line(\n...

javascript - jsPdf Android Stock browser error -

i'm developing script transforms html table in pdf document. use jspdf , jspdf-autotable. did testing on various brwser , works fine except android stock browser.   android stock browser error : resource interpreted document transferred mime type application/pdf: "data:application/pdf;base64,jvberi0xljmkmyawig9iago8pc9uexblic9qywdlci9qyxj…l6zsaxoqovum9vdcaxocawifikl0luzm8gmtcgmcbscj4+cnn0yxj0ehjlzgozmdk5ciulru9g". jspdf code error jspdf.debug.js line 863 case 'dataurl': return global.document.location.href = datauri; jspdf version: jspdf/1.0.272/jspdf.debug.js what's wrong? the "android stock browser error" warning don't have worry about. might old versions of android stock browser don't support datauri location href. try use save method instead pdf. doc.save('table.pdf');

python - web2py fails on importing matplotlib modules -

i don't quite understand workings of web2py's custom_import.py . attempting import modules withing mathplotlib getting inconsistent results. my controller version.py contains these statements. def import_mathlab_cbook(): import matplotlib.cbook cbook return "cbook.__file__ = %r" % cbook.__file__ def import_mathlab_figure(): matplotlib.figure import figure return "figure.__file__ = %r" % figure.__file__ def import_mathlab_backends(): matplotlib.backends.backend_agg import figurecanvasagg return "figurecanvasagg.__file__ = %r" % figurecanvasagg.__file__ the import of matplotlib.cbook works fine, others produce errors. cbook.__file__ = '/opt/anaconda2/lib/python2.7/site-packages/matplotlib/cbook.py' traceback (most recent call last): file "/site/web2py.2.13.4/gluon/restricted.py", line 227, in restricted exec ccode in environment file "/site/web2py.2.13.4/applications/plotlab/con...

javascript - automatically move to text next line if width of div is reach -

Image
i want text move next line if div width reach using echo. inside div id="chat" echo '<div style="width: auto; margin-left: 400px; margin-bottom: 5px; margin-top: 10px; padding-left:8px; padding-bottom: 10px; padding-top: 10px; padding-left: 15px; text-align:left; font-size: 0.8em; color:#015e7d;">' . '<div style="font-weight:bold;">' . "you" . "</div>message: " . $messages->msg . "<br>" . '<div style="font-size: 0.6em;">' . "send : " . $messages->dt . "</div>" . "</div>"; @squalelis suggesstion output as per assumption want text come in next line when touches width of div. have use "word-wrap:break-word" html <div class="test">aaaa sdfjdshfjsd djhsdjs aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div...

angular - Angular2/Http (POST) headers -

i'm unable change headers when doing post request. tried couple of things: simple class: export class httpservice { constructor(http: http) { this._http = http; } } i tried: testcall() { let body = json.stringify( { "username": "test", "password": "abc123" } ) let headers = new headers(); headers.append('content-type', 'application/json'); // tried other types test if working other types, no luck this._http.post('http://mybackend.local/api/auth', body, { headers: headers }) .subscribe( data => { console.log(data); }, err => { console.log(err); }, {} => { console.log('complete'); } ); } 2: testcall() { let body = json.stringify( { "username": "test", "password": "abc123" } ) let headers = new headers(); headers.append('content-ty...

linux - Parse mail's body using mailx and bash scripting -

i trying automate part of work using emails.is there method available using mailx , bash can use extract mail's body? if mail delivered local user account sendmail-like mta, can use procmail parse email it's being delivered. on system using, sendmail examine ~/.forward file, had in ~username/.forward # pipe incoming mail procmail # ref: http://www.panix.com/~elflord/unix/procmail.html # ref: http://porkmail.org/era/procmail/mini-faq.html#forward "|ifs=' ' && p=/usr/local/bin/procmail && test -x $p && exec $p -f- || exit 75 #username" then, ~username/.procmailrc contained: # procmail tutorial: http://tldp.org/ldp/lg/issue14/procmail.html path=/usr/local/bin:/bin:/usr/bin maildir=$home/mail default=$home/mail/inbox logfile=$home/procmail.`date +%y-%m`.log shell=/usr/bin/ksh my_xloop='x-loop: username@hostname.subdomain.example.com' my_recipient='mailing.list@example.com' ########################...

mysql - SQL: count progressively unique visits from table -

i have table (visits): id | fb_id | flipbook | ---- ---------- --------- 1 1123 november2014 2 1123 november2014 3 1127 november2014 4 1124 november2014 5 1126 november2014 6 1123 december2014 7 1124 december2014 8 1125 december2014 9 1123 january2015 10 1124 january2015 11 1125 january2015 12 1123 february2015 13 1125 february2015 14 1124 february2015 15 1127 february2015 16 1129 march2015 17 1123 march2015 18 1123 march2015 19 1124 march2015 20 1125 march2015 21 1126 march2015 22 1128 march2015 we have 5 flipbooks in total, , aft...

c# - Background worker issue with bluetooth socket -

i fixing bug in wpf application. application requires reading data bluetooth socket 32 feets library. current issue have when backgroundworker has been cancelled using cancelasync() , wait after few minutes, dowork event doesn't fire anymore. if stop backgroundworker within minute, dowork fire. know reason , how resolve this? here code use dowork: void startthread_dowork(object sender, doworkeventargs e) { backgroundworker worker = sender backgroundworker; try{ using (bluetoothclient cliente = new bluetoothclient()) { // bluetoothendpoint point = new bluetoothendpoint(bluetoothaddress.parse((string)e.argument), bluetoothservice.serialport); cliente.connect(bluetoothaddress.parse((string)e.argument), bluetoothservice.serialport); using (stream stream = cliente.getstream()) { while (true) { system.windows.forms.application.doevents(); ...

ruby - How to insert an array in the middle of an array? -

i have ruby array [1, 4] . want insert array [2, 3] in middle becomes [1, 2, 3, 4] . can achieve [1, 4].insert(1, [2, 3]).flatten , there better way this? you following way. [1,4].insert(1,*[2,3]) the insert() method handles multiple parameters. therefore can convert array parameters splat operator * .

javascript - AddEventListener not fireing dynamically created element -

for current project i'm injecting javascript webpage in form of safari plugin. everything working fine , process follows: intialize seperate objects load page parse page injecting dom elements when needed have interval of 1000ms re-parse live-updates now works fine, inject element buttons , working fine. now page has javascript itself, has auto-update function.(live-updates) once every second there poll server fetch new elements inject. so new elements added live-update script. now pageparser injects button elements in new element created live-update script. the buttons shown etcetera, there problem click eventlistener. it's not fireing. here part of code: class viewmanager { constructor() { this.databasemanager = databasemanager; this.injectaddons(this); setinterval(this.injectaddons, 1000, this); } injectaddons(self) { var karmabuttonimage = new image('../img/karma.jpg'); var post_elemen...

mysql - Setting SQL variables in Prepared statments in PHP not working -

situation: have junction table columns testfk , questionfk , , ordinal . testfk | questionfk | ordinal 2 14 1 2 15 2 2 16 3 _____________________________ new 2 17 4 i want add new row table testfk = 2 , questionfk = 17 , however, want ordinal automatically generated based on in table. since highest ordinal 3, want sql automatically generate 4. i've tried: $stmt = $db->prepare(' set @qordinal = (select max(ordinal) junc_test_question testfk = ?); insert junc_test_question (junc_test_question.testfk, junc_test_question.questionfk, junc_test_question.ordinal) values (?, ?, @qordinal); '); $stmt->bind_param('iii', $this->testid, $this->testid, $question_id); //var_dump($stmt); if($stmt->execute()) { return true; } else { return false; } this works if hard...

echonest - Querying by Spotify ID in Echo Nest API -

i've got songs spotify play lists , need information in en. take “all want” tania bowra example. en id(not given): soujwuh13e89d89ded spotify id: 2tpxz7jubn3uw46ar7qd6v spotify uri: spotify:track:2tpxz7jubn3uw46ar7qd6v spotify external id: aucr10410001 (isrc) if query spotify external id or spotify id in en, like $curl -x "http://developer.echonest.com/api/v4/song/profile?api_key={my_api_key}&id=aucr10410001&bucket=audio_summary" | python -m json.tool or $curl -x "http://developer.echonest.com/api/v4/song/profile?api_key={my_api_key}&id=2tpxz7jubn3uw46ar7qd6v&bucket=audio_summary" | python -m json.tool the en api returns message: "id - invalid parameter: id must echo nest id or foreign id" . or if query spotify uri, like $curl -x "http://developer.echonest.com/api/v4/song/profile?api_key={my_api_key}&id=spotify:track:2tpxz7jubn3uw46ar7qd6v&bucket=audio_summary" | python -m jso...

javascript - How to concat & minify an angular2 application? -

i concat & minify angular2 application. did first concatenating *.js files (boot.js, application.js components) in 1 file , injected index.html. deleted <script> system.config({ packages: { app: { defaultextension: 'js' } } }); system.import('app/boot') .then(null, console.error.bind(console)); </script> and replaced my <script src="js/allmyconcatfilesintoone.js"></script> but got error, require missing/unknown. how angular2 applications filled 1 file? have gather typescript files first , concat , compile via gulp? regards tenoda use gulpfile.js this: /// <binding clean='clean' /> "use strict"; var gulp = require("gulp"), rimraf = require("rimraf"), concat = require("gulp-concat"),...

javascript - Href scroll to page with offset -

how can make page scroll id using code below make pages croll want it, triggered on page load $('html,body').animate({ scrolltop: $(id).offset().top - 64 }, 'slow'); on links clickable, href="page#a" is used. scrolls div not desire. there way can offset 64pixels on href? thanks the id's css follows: #a, #b { margin-bottom: 64 px; visibility: hidden; position: absolute; left: -999em; } var top_val = $('.test'); $('html, body').stop().animate({ scrolltop: top_val.offset().top }, 'slow');

jenkins - Losing connection during continuous integration -

i'm using digitalocean droplets continuous integration. every time pushes on our github repository, droplet created. jenkins (on separated droplet) connects through ssh newly created droplet , launch shell script build , test project. github changes -> jenkins (on droplet a) -> build/tests (on new droplet x) github changes -> jenkins (on droplet a) -> build/tests (on new droplet y) github changes -> jenkins (on droplet a) -> build/tests (on new droplet z) the problem randomly, newly created droplet losing connection whatever tried connect during build. example, 2/10 droplets same content fail during "git pull" command message : "ssh: connect host github.com port 22: connection timed out" or "[composerdownloadertransportexception] "https://api.github.com/repos/symfony/symfony/zipball/d3646cc6875c214d211001e0673ec9e91b5f2da7" file not downloaded: failed open stream: connection timed out " there no iptab...

MPEG-Dash - "moof" length in Segment Templates -

specific question related dash standard. a "moof" followed "mdat" in mpeg-dash standard in segment templates. for ex segment 1 - duration 2 seconds - moof + mdat segment 2 - duration 2 seconds - moof + mdat is "moof" length across segments constant? can considered constant arrive @ mdat offset in subsequent segments. you can not assume "moof" length constant across segments - be, not have be. why assume this? "moof", each box in mp4 file, contains box size @ beginning of box, can parse. what want achieve?

Java command terminal -

alright trying run java file it's not doing want terminal. i have main directory called packagetester. packagetester contains src , bin src has packagea packageb pacakgea has helloa.java packageb has hellob.java bin has class files bin has packagea packageb pacakgea has helloa.class packageb has hellob.class to compile files used following command when in pacakagetester directory: javac -d bin -sourcepath source src/package*/* , works ! now how run hellob.class contains main method , has object of helloa. i thought when @ packagetester directory, can do: java bin/packageb/hellob not work because cannot seem find .class file. appreciated figure out how execute file correctly the root of bin should in classpath in order packageb.hellob found packageb/hellob.class while parsing classpath. the easiest way change directory bin , execute java packageb.hellob there. alternatively, can execute java -cp bin packageb.hellob packageteste...

What does this JetBrains keyboard shortcut icon mean? -

Image
i'm looking @ keyboard shortcuts code folding in phpstorm. documentation , keymapping settings these commands show weird grey symbol, see here: i have no idea refers - have idea default keyboard shortcuts these commands on osx? the "grey symbol" means numeric pad. in specific context means "star on num pad" key -- first shortcut command + num pad * , 1 .

angularjs - Angular Material Datepicker - show selected hoildays -

is possible show selected holidays in angular material datepicker. https://material.angularjs.org/latest/demo/datepicker . it can done in jquery date-picker easily. mvc datepicker both holidays , weekends please let me know can done using angular material (md-datepicker) var holidays_dates = ["11-25-2015", "11-27-2015", "11-29-2015","10-9-2015"]; you can decorate mdcalendarmonthbody directive, directive creates cells in datepicker table. in example have replaced builddatecell function own function. first thing in new function calling old function create cell , i'm adding class cell if date holiday. require('angular-material'); angular.module('myapp', []) .config([ '$provide', function($provide) { $provide.decorator('mdcalendarmonthbodydirective', function($delegate) { var originaldirective = $delegate[0]; var oldbuil...

ruby - when create note in evernote in evernote api, raise Evernote::EDAM::Error::EDAMUserException -

here full code , following code: note_store = c.note_store note_title = ::time.now.to_s note_body = ::time.now.to_s n_body = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" n_body += "<!doctype en-n system \"http://xml.evernote.com/pub/enml2.dtd\">" n_body += "<en-n>#{note_body}</en-n>" ## create n object our_note = evernote::edam::type::note.new our_note.title = note_title our_note.content = n_body i'm sure developer token can work search evernote notes, when create note, raise error the full error is: <evernote::edam::error::edamuserexception errorcode:enml_validation (11), parameter:"element type \"en-n\" must declared."> see here , following code work note_store = c.note_store note_title = ::time.now.to_s note_body = <<-content <?xml version="1.0" encoding="utf-8"?> <!doctype en-note system "http://xml.evernot...

javascript - Prepend Div Collection With No ID -

i'm trying prepend first div in collection of divs same class no id in html document javascript. parent doesn't have id. <div class="shiftslistparent"> <div class="shiftslist2"></div> <div class="shiftslist2"></div> </div> i'm looking end result looks like <div class="shiftslistparent"> <div class="shiftslist2">new div here</div> <div class="shiftslist2"></div> <div class="shiftslist2"></div> </div> document.queryselector return first element matching css selector, , can use insertbefore on element's parent: var div = document.queryselector(".shiftslist2"); var newdiv = document.createelement("div"); newdiv.innerhtml = "new div here"; div.parentnode.insertbefore(newdiv, div); live example: var div = document.queryselector(".shiftslist2"); var newd...

c# - Retrieve data from Multiple table From Ms access -

i make 2 table 1 exp_detail , 2nd exp_head . exp_detail table contain exp_id,amount_paid,sr_no , exp_description column exp_head table contain exp_id , exp_name column now using query retrieve data exp_detail table. display correctly. query select sr_no, e_date, e_paid, e_des exp_detail e_date = #" + this.dp_expdetail.value.date + "# order exp_detail.sr_no" but problem retrieve exp_name using primary key , foreign key exp_head table in above given query. how possible? you'll have use sql joins join both tables. refer below updated sql statement join statement, i.e. 3rd line select sr_no, e_date, e_paid, e_des exp_detail inner join exp_head on exp_detail.exp_id = exp_head.exp_id --this added-- e_date=#" + this.dp_expdetail.value.date + "# order exp_detail.sr_no

matlab - How do I estimate the radial distortion parameters for a given image? -

i have found camera matrix image using dlt : p = 3.8618e-03 7.1665e-04 1.9713e-03 -9.1510e-01 3.1222e-05 4.4639e-03 -7.6783e-04 -4.0317e-01 -5.9516e-07 1.1950e-06 1.7221e-06 -1.0115e-03 how proceed find radial distortion parameters. tools: opencv/octave the best thing calibrate camera. need take multiple images of planar calibration pattern, e. g. checkerboard. if have computer vision system toolbox matlab, can use camera calibrator app .

javascript - Drawing Hexagon on Canvas, testing mouseclick event vs Hexagon -

im drawing hexagon-based grid on canvas. each hexagon object holds 6 points in x/y coordinates. each hexagon object holds x/y columns/row index. var canvas = document.getelementbyid("can"); canvas.width = 200; canvas.height = 200; var ctx = canvas.getcontext("2d"); var grid = []; // array holds hex var globaloffset = 30 // not important, smoother display atm function point(x, y) { this.x = x; this.y = y; } function hex(x, y, size) { this.size = 20; this.x = x; this.y = y; this.points = []; this.id = []; this.create = function(x, y) { var offsetx = (size / 2 * x) * -1 var offsety = 0; if (x % 2 == 1) { offsety = math.sqrt(3) / 2 * this.size; } var center = new point( x * this.size * 2 + offsetx + globaloffset, y * math.sqrt(3) / 2 * this.size * 2 + offsety + globaloffset ) this.midpoint = center; this.id[0] = x; this.id[1] = ...

javascript - Assign ID's to dynamically generated elements using jquery -

in application read rss feed. using zrssfeed ( http://www.zazar.net/developers/jquery/zrssfeed/ ) elements of feed displayed. problem inside each list item, there 3 elements without id or class. i want style each of these elements differently. how can achieve this? <div> <ul> <li> <img /> <p>text1</p> <p>text2</p> <p>text3</p> </li> <li> .. next item... </li> </ul> </div> how can achieve assigning different id each of these elements? // after elements have been created $('li').find('p').each(function (i) { $(this).attr('id', 'p_' + i); }); fiddle you use css3's nth-child selectors: p:nth-child(1) { color: pink; } p:nth-child(2) { color: green; } p:nth-child(3) { color: yellow; } fiddle

javascript - AppMobi, html5 sound working on simulator and android but not in iphone -

today started in appmobi. developing small example deal sounds. i needed create handler play , stop many sounds. var audioon = new audio('sounds/11.mp3'); audioon.play(); this code working in xdk simulator, on android devices, not in iphone 5. the thing is, if use tag works on iphone, want use javascript native api deal sounds , more. i have been trying deal with appmobi player library comes without controls stop, resume etc, thats way want use native. here part of javascript code : <script type="text/javascript"> /* function runs once page loaded, appmobi not yet active */ var init = function(){ var alarmbutton = document.getelementbyid("alarmbutton"); var on = false; //var audioon = new audio('http://rpg.hamsterrepublic.com/wiki-images/3/3e/heal8-bit.ogg'); var audioon = new audio('sounds/11.mp3'); audioon.addeventlistener('ended', function() { this.play(); }, false); var = function(){ alert("but...

c++ - Having a single method in a base class able to allocate for child classes -

i'm trying have common base/helper class allocates shared_ptrs calling class, i'm having problems getting work in derived classes. #include <memory> template<typename t> struct spalloc { virtual ~spalloc() {} template<typename ...args> static std::shared_ptr<t> alloc(args&&... params) { return std::make_shared<t>(std::forward<args>(params)...); } template<class u, typename ...args> static std::shared_ptr<u> alloc(args&&... params) { return std::make_shared<u>(std::forward<args>(params)...); } }; class base : public spalloc<base> { public: virtual ~base() {}; }; class child : public base { public: virtual ~child() {}; }; typedef std::shared_ptr<base> pbase; typedef std::shared_ptr<child> pchild; int main() { pbase base = base::alloc(); pchild child = child::alloc(); } i understand class base : public sp...

Why this is causing PHP syntax error? -

the following code: $a = '?>'; is fine commented version of same code: //$a = '?>'; causes syntax error but /*$a = '?>';*/ is fine. it doesn't make sense me how //$a = '?>'; translated. from php docs : the "one-line" comment styles comment end of line or current block of php code , whichever comes first. (my emphasis) the comment comprises block of characters //$a = ' but ?> terminates comment, means have line of php reading just '; which invalid php

python - How to deploy and serve prediction using TensorFlow from API? -

Image
from google tutorial know how train model in tensorflow. best way save trained model, serve prediction using basic minimal python api in production server. my question tensorflow best practices save model , serve prediction on live server without compromising speed , memory issue. since api server running on background forever. a small snippet of python code appreciated. tensorflow serving high performance, open source serving system machine learning models, designed production environments , optimized tensorflow. initial release contains c++ server , python client examples based on grpc . basic architecture shown in diagram below. to started quickly, check out tutorial .

c - synchronizing 2 processes -

i'm trying make 2 processes start on task @ same time (count number, example). set 2 ready flags, 1 each process, , perform while loop check if both flags up. 2 processes start counting after check passed. here's not working code, don't know why: int p1ready=0; int p2ready=0; int onebil = 1000000000; int main(){ int pid; int exit_code; pid=fork(); if(pid==0){ //child1 int count1=0; p1ready=1; //signal while(!(p1ready&p2ready))'//wait until 2 processes both ready while(count1!=onebil){ count1++; } exit(0); } else{ pid=fork(); if(pid==0){ //child2 int count2=0; p2ready=1; //signal while(!(p1ready&p2ready));//wait until 2 processes both ready while(count2!=onebil){ count2++; } exit(0); } else{ //parent //do stuff } return 0; } the problem code is, in child1 , child2, own ready flag set 1. cannot see flag of other child...

vba - Add +1 to cell in same row but different column from Vlooked-up item -

i'm quite new vba apologise in advance coding mistakes ;) what i'd code is: take caption label on form lookup alphanumerical caption on workbook’s sheet add +1 number on same row of vlook part on different column . private sub submitbutton_click() 'declaring variables used vlookup on top level part number list dim passpartno1form string dim passpartno1workbook string dim failpartno1workbook string dim rowpass1 integer sheets("sheet5").activate 'if pass checkbox selected if pass1.value = true 'assign variable passpartno1form caption of partnumber1 label passpartno1form = partnumber1.caption 'look risk score in top level list passpartno1workbook = application.worksheetfunction.vlookup(passpartno1form, range("toplevellist"), 3, false) 'this should define row of code has been v looked rowpass1 = passpartno1workbook.row 'add +1 number in column 3, , row same part has been v looked cells(r...

ios - Cocoa Touch interface advice -

Image
background info i'm working on ipad application allows coach log data sports match during game. main screen features number of large "buttons" different events occur during match. due large number of different events, , limited screen real estate on tablet device, decided split events different sections. you can see wireframe below: as can see, screen shows "general", "attack" , "setpiece" sections. like, when user taps "defend" button, section hide attack section , show defend section instead, whilst keeping general , setpiece sections available @ times. question my question standard practice / best way of implementing show/hide/replace panel attack/defend panel? for example, on web, achieved divs , css "display" properties, or in java, show/hide panel objects. if point me in direction of best practice sort of control, appreciate it. thanks, chris

php - angularjs cannnot use $http.jsonp for send POST method -

please, have been using lort of examples none of them send post method. we have lot of services in angularjs posting this: $http.post(url + '/login.php?action=login_user', data).success(function(response, status) { callback(response, status); }).error(function(response, status) { callback(response, status); }); where data allways json data or more complex: var data = { username: username, password: password }; and need adap lot of calls jsonp minimum change soo try send data post json previos changing (using jsonp) $http.jsonp(url + '/login.php?action=login_user&callback=json_callback', data).success(function(response, status) { callback(response, status); }).error(function(response, status) { callback(response, status); }); but looking inspector not sending p...

magento upgrade not listing latest available upgrade in connect manager -

i want upgrade magento version. i using magento enterprise editon 1.12 when goto connect manager , use "check upgrade". no upgrade listed. magento 1.14 latest version , not listed . any reason on why didn't available not listed? for community edition can upgrade manually downloading latest files , inserting our custom modules in that. but in enterprise edition there way that? because enterprise edition not open source the same question posted in link . since not getting response, posting same here magento enterprise paid version. need login magento account able download latest version. in case, of magento community, free hence can upgraded via magento connect manager. use following steps: go www.magento.com in top horizontal navigation bar, click account. log in magento user name , password. in left navigation bar, click downloads. in right pane, click magento enterprise edition > release software or sample data optional sample data...

java - Configure Wildfly Naming subsytem on deploy with Maven plugin wildfly-maven-plugin -

i add resource naming subsystem can pull ejb through @resource annotation. ideally resource must added @ build time specific environment, (once working, set variables in maven set in settings.xml). using wildfly-maven-plugin , cannot find place add jndi references string resources anywhere. fails when run mvn wildfly:deploy with: [error] failed execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.alpha5:add-resource (add_jndi) on project project: not execute goal add-resource. reason: operation failed: "jbas014807: management resource '[ [error] (\"subsystem\" => \"naming\"), [error] (\"binding\" => \"java:global/project/key\") [error] ]' not found" [error] -> [help 1] my pom.xml looks follows: ... <plugin> <groupid>org.wildfly.plugins</groupid> <artifactid>wildfly-maven-plugin</artifactid> <version>${wildfly-maven-plugin.version}</version> ...

javascript - highlight building google maps v3 -

im trying highlight specific building within map using google maps v3 api. wondering if had idea how this. i've been looking through google api documentation , come across nothing @ moment. for example: http://goo.gl/maps/gyrdb - map of section manhattan, can see 3d building. im trying highlight specific ones on hover. thanks :d if have information building is, can use polygon highlight it. if don't have information building is, out of luck. google maps api doesn't have way of interacting map @ level. now, suppose 1 thing could is: download google maps tile, find point in image user clicked on, do flood fill of point awful colour, set clear pixels not colour, overlay image on top of map you need clever buildings lie in more 1 tile. however, might run afoul of terms of use. know disallow modifying artwork; not sure if count modifying artwork; you'd need @ tou , maybe ask lawyer. or ask google. (don't ask me, not lawyer.)

java - List of arrays to array of arrays -

i have list of arrays of integers. want convert array of arrays of integers, when using toarray() error [ljava.lang.object; cannot cast [[i what doing wrong? thanks public int[][] getcells() { list<int[]> cells = new arraylist<>(); (int y = this.y0; y <= this.y1 ; y++) { (int x = this.x0; x <= this.x1 ; x++) { cells.add(new int[]{x, y}); } } return (int[][]) cells.toarray(); } edit i've seen in case can convert with: return cells.toarray(new int[cells.size()][2]); but because integer arrays have same size (2). if don't know it? thanks you need call cells.toarray(new int[cells.size()][]) your old call cells.toarray() not work since creates array of objects object[] apparently cannot cast int[][]

vb.net - operator/operand type mismatch when update dbf file -

i have program needs update data in dbf file. keeps appear error 'operator/operand type mismatch'. here sample code : dim con oledbconnection = new oledbconnection("provider=vfpoledb;data source=c:\folder\paytran.dbf;collating sequence=machine;") try dim strsql string = "update paytran.dbf set workhr = 20 empno = 102" dim cmd oledbcommand = new oledbcommand(strsql, con) con.open() dim myda oledbdataadapter = new oledbdataadapter(cmd) dim mydataset dataset = new dataset() ' using dataadapter object fill data database dataset object myda.fill(mydataset, "mytable") ' binding dataset datagridview dgv.datasource = mydataset.tables("mytable").defaultview con.close() con = nothing catch ex exception messagebox.show(ex.message, "error select data") if con isnot nothing con.close() ...

javascript - Three js objects intersects at same place - how to tell which one to show -

lets have 2 or more object intersects @ same place, how can 1 set 1 show? otherwise flickering time. http://jsfiddle.net/gyq5v/187/ var scale = 1; var scene = new three.scene(); var camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, 100, 1000000); camera.position.x = 0; camera.position.y = 0; camera.position.z = 100 * scale; var renderer = new three.webglrenderer({ antialias: false }); renderer.setsize(window.innerwidth, window.innerheight); document.body.appendchild(renderer.domelement); var light = new three.ambientlight(0xffffff); scene.add(light); var material = new three.meshbasicmaterial({ transparent: false, side: three.doubleside, fog: false, color: 0xffff00, opacity: 1.0 }); var cubegeometry = new three.planegeometry(50 * scale, 50 * scale, 1, 1); var cubemesh = new three.mesh(cubegeometry, material); cubemesh.position.set(50, 0, 0); scene.add(cubemesh); var cubegeometry = new three.planegeometry(50 * scale, ...

python - Auto-Execute Script upon USB Mount -

my main reason learning python me ethical hacking. 1 of things i've wanted know while how can auto-start script upon mount. example, on ubuntu, default setting automatically mount usb. fear there must way execute script upon mount, i've turned off feature. know how it's done, ideally showing me example using code. not detail, it's operating system settings, on linux this , note hack , you'd have somehow hack shell first, execute these commands specific usb, , on windows have setup autoplay setting start program, , autorun.inf on usb exe files shown how here , , anyway you'd have hack directly os it, if hack os, don't need transfer scripts usb, run them directly :) so ending there :) it's not easy might think ;)

angular - Reading property names from a class in TypeScript? -

having class (e.g. wikipediasearchresult ) few properties in typescript, possible access them? maybe question bit naive, i'm wondering if write following code without duplicated property names: function mergeto(from:any, to:any={}, properties:array<string>=[]) { if (!!from) { (var property of properties) { // no deep copy here ;-) to[property] = from[property]; } } } class wikipediasearchresult /* implements iwikipediasearchresult */ { lang:string; summary:string; title:string; wikipediaurl:string; constructor(obj?:any) { mergeto(obj, this, [ // --> how avoid list? <-- 'lang', 'summary', 'title', 'wikipediaurl' ]); } } var result = new wikipediasearchresult({ title: 'zürich', wikipediaurl: 'https://en.wikipedia.org/wiki/z%c3%bcrich' }); console.log(result); of course there 3rd party libraries such underscore.js, differs e.g. _.clone(...) since wa...

Javascript named function assigned to a property -

i'm working on javascript code defines class methods defining prototype object, shown below: /** * @constructor */ function myclass() { var somefield = 'hello world'; } myclass.prototype = { getsomefield1: function getsomefield2() { return somefield; } }; i have 2 questions: what getsomefield2 , , accessible code? can give examples of scenario might advantageous use different names key , function name? have thought confuse people reading code. in other instances of similar code, either property , function names match, or function unnamed. the main benefit browsers show names of functions in stack traces. typically, people use anonymous function when assigning property or variable. chrome had been pretty @ figuring out should use property or variable name on stack trace, ie used show anonymous. also named functions have name property (function a(){}).name // (function(){}).name // ""

jsf - Change PrimeFaces DataGrid (responsive mode) behaviour -

it seems datagrid primefaces component (responsive mode) starts out stacked on small devices , becomes horizontal when resolution grows beyond 640 px. want able choose width datagrid columns stop being stacked , start positioning 1 beside other. is, change 640 px default value other value of choice. thanks. default breakpoint 35em equals 560px. need override css in primefaces default; /* responsive */ @media (max-width:35em){ .ui-grid-responsive .ui-grid-row { display:block; } .ui-grid-responsive .ui-grid-col-1,.ui-grid-responsive .ui-grid-col-2,.ui-grid-responsive .ui-grid-col-3,.ui-grid-responsive .ui-grid-col-4,.ui-grid-responsive .ui-grid-col-5,.ui-grid-responsive .ui-grid-col-6,.ui-grid-responsive .ui-grid-col-7,.ui-grid-responsive .ui-grid-col-8,.ui-grid-responsive .ui-grid-col-9,.ui-grid-responsive .ui-grid-col-10,.ui-grid-responsive .ui-grid-col-11,.ui-grid-responsive .ui-grid-col-12 { width:100%; float:none; } } sour...

elasticsearch get statistics on analyzed field -

i trying statistics on analyzed string field. i trying avg length of string field (in example title, , title can empty/none). tried: get book/_search { "facets" : { "stat1" : { "statistical" : { "script" : "_source.title?.length()" } } } } and error: query failed [failed execute main query]]; nested: nullpointerexception; }]", "status": 500 } how can accomplish that? any reason why using facets , not aggregations? unless use elasticsearch version supports facets, recommend switching aggregations. facets deprecated in 1.x , removed in 2.x. and aggregation 1 should work fine: get /book/_search { "aggs": { "stat1": { "stats": { "script": "_source.title?.length() ?: 0" } } } }

sql - Select xml nodes directly from user-defined function -

i have select xml, wich parse attributes columns this: declare @xml xml select @xml = xml_function() select tab.col.value('@fieldone','varchar(20)') fieldone, tab.col.value('@fieldtwo','varchar(20)') fieldtwo @xml.nodes('/row') tab(col) is possible make select directly xml_function without copying result @xml variable? something like: select * xml_function().nodes('/row') as far know cannot use xml returning function directly nodes() , might use cte or "sub-select" inlined: create function dbo.comebackasxml(@xmltext varchar(max)) returns xml begin declare @x xml=cast(@xmltext xml); return @x; end go declare @xtext varchar(max)= '<root> <item id="3"> <a attr="test1" /> <a attr="test2" /> <a attr="test3" /> </item> <item id="5"> <a attr="test1" /> ...

function - removing alternating elements on a list in scala -

i trying write recursive function in scala takes in list of strings , returns list alternating elements original list: for example: list = {"a","b","c"} list b = {"a","c"} the head should included. def removealt(list:list[string], str:string):list[string]=lst match{ case nil=> list() case => head::tail if(head == true) removealternating(list,head) else head::removealternating(list,head) i stack overflow error. i understand code incorrect trying understand logic on how accomplish recursion , no built in classes. def remove[a](xs:list[a]):list[a] = xs match { case nil => nil case x::nil => list(x) case x::y::t => x :: remove(t) } if list empty, return empty list. if we're @ last element of list, return that. otherwise, there must 2 or more elements. add first element alternate elements of rest of list (and omit second element)