Posts

Showing posts from April, 2015

Installing socket.io C++ -

Image
i try work socket.io in c++ can't seem example running. first asked me convert project visual studio (which 2015). did that. missing libraries offcourse (boost, websocket++, rapidjson). added them additional libraries in project settings. searching boost.lib. boost.lib doesnt exist in boost library installed on pc, deleted dependency list. figured included boost, why search lib doesn't exist. ran bjam.exe , b2.exe etc boost, if there boost.lib should there guess , isn't. i got error: https://msdn.microsoft.com/en-us/library/f6xx1b1z.aspx added msvcrt.lib , msvcmrt.lib linker's additional dependencies property. caused errors in included image.. now steps seemed fix problems had, create more errors in process. not understand how run project , can't find explanation of steps need take. can explain doing wrong? https://github.com/socketio/socket.io-client-cpp that try run, included siochatexample thanks in advance! current errors..... :( i th...

java - Andriod add header and footer programmicatlly -

i have following code need add programmatically "simple" fixed header ( image) , footer (with button) using relative layout: /* sample application create items, need header image , footer button*/ import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.app.activity; import android.graphics.typeface; import android.os.bundle; import android.view.view; import android.view.viewgroup.layoutparams; import android.view.window; import android.widget.button; import android.widget.checkbox; import android.widget.imageview; import android.widget.compoundbutton; import android.widget.compoundbutton.oncheckedchangelistener; import android.widget.linearlayout; import android.widget.scrollview; import android.widget.toast; public class mainactivity extends activity { scrollview scrollview; button dynamicbtn; @override protected void oncreate(bundle savedinstances...

vb.net - Populating 2D-Arrays from CSV (without m*n-Loops) -

while migrating excel-vba project visual basic 2010, came across problem when populating arrays. in excel-vba like function mtxcorrel() variant mtxcorrel = wscorr.usedrange end function to read m*n -matrix (in case n*n ), conveniently stored in worksheet, array further use. in vb2010 won't use excel-worksheet storage. csv-files (see below) seem decent alternative. i want populate 2d-array csv-contents without looping n*n -times. let's assume know n=4 demonstration purposes. this suggests want cant done. nevertheless still hope following work: function mtxcorrel() object dim array1(4, 4) string using ioreader new microsoft.visualbasic.fileio.textfieldparser("c:\cm_koma.csv") ioreader .textfieldtype = fileio.fieldtype.delimited .setdelimiters(";") ' here want to... ' a) ...either populate whole 2d-array array1 = .readtoend() ' b) ... or...

android - How do I get data from HashMap to pass to next Activity? -

i wish pass data 1 listview activity next activity, i.e. when item clicked in list, data such title or thumb_url (an image remote database) can passed detail activity. in example below, these items set out in hashmap . what code pass above data activity, using intent? i'm puzzled because these data items laid out in hashmap . public class customizedlistview extends activity { // static variables static final string url = "http://padihamcars.com/music.xml"; // xml node keys static final string key_song = "song"; // parent node static final string key_id = "id"; static final string key_title = "title"; static final string key_artist = "artist"; static final string key_duration = "duration"; static final string key_thumb_url = "thumb_url"; listview list; lazyadapter adapter; @override public void oncreate(bundle savedinstancestate) { super.onc...

html - link working on localhost, not on live -

i not understand why link "back portfolio" working on localhost, , not on live domain. links there not working, portfolio button. can see why? my portfolio link <span class="col-xs-12"> <a href="portfolio.php" class="btn btn-border"> <i class="fa fa-rocket"></i> portfolio /a> <a href="contact.php" class="btn btn-border"> <i class="fa fa-comment-o"></i> work me? </a> </span> <span class="col-xs-12"> <a href="portfolio.php" class="btn btn-border"> <i class="fa fa-rocket"></i> portfolio /a> <a href="contact.php" class="btn btn-border"> <i class="fa fa-comment-o"></i> work me? </a> </span> its case sensitive change fine name o portfo...

user interface - How to position a view right above the keyboard? -

i'm writing forms app. how position view right @ bottom of screen , when entry focused , keyboard visible, view right above keyboard? on android, possible set window.setsoftinputmode(softinput.adjustresize) , make content resize every time keyboard appearing/disappearing. however, need status bar transparent , softinput.adjustresize doesn't work windowmanagerflags.translucentstatus . question is, how position view right above keyboard without setting softinput.adjustresize ? take example: public page1() { initializecomponent(); var al = new stacklayout { horizontaloptions = layoutoptions.fillandexpand, verticaloptions = layoutoptions.fillandexpand }; var button = new boxview {color = color.red, verticaloptions = layoutoptions.endandexpand}; var entry = new entry {horizontaloptions = layoutoptions.fill}; al.children.add(entry); al.children.add(button); conten...

c# - log4net strange file name behavior -

Image
i have asp.net application using log4net, have daily log file, config looks like: <appender name="rollingfile" type="log4net.appender.rollingfileappender"> <file type="log4net.util.patternstring" value="log\log_%property{log4net:hostname}_" /> <appendtofile value="true" /> <staticlogfilename value="false" /> <rollingstyle value="date" /> <datepattern value="yyyymmdd'.txt'" /> <maxsizerollbackups value="7" /> <maximumfilesize value="10mb" /> <lockingmodel type="log4net.appender.fileappender+minimallock" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%-5level] (%logger)(%thread) %message %newline" /> </layout> </appender> sometime, there strange naming pattern file appear, looks no reason (at least not due maxi...

bash - Imagemagick caption text with shadow on top of resized image in one command -

Image
i'm making quick bash/imagemagick script that takes image crops , resizes image overlays shadow of caption text sized box overlays white caption text sized same back and puts final image. i able resized image background , shadow of text on top. however, haven't been yet able white text on top of shadow text. how can achieve desired output in single imagemagick command (and without png offset gimp complains when open result image)? the code: #!/bin/bash text="beef meatball filet mignon, andouille biltong sausage kielbasa. landjaeger pancetta shankle, ham hock beef corned beef kevin meatball beef ribs short ribs. landjaeger biltong shoulder, salami brisket shank bresaola leberkas tail corned beef jowl ham pig. venison pork loin capicola ham hock pastrami, turducken ground round prosciutto landjaeger bacon t-bone." image="abstract-waves-on-a-blue-background.jpg" width=1024 height=768 padding=100 text_width=$(( $width-$padding )) text_h...

apply rbind for all column of a data frame in r -

i have data frame : a <- 1:5 b <- c("a","b","c","d","e") c <- c(15,49,41,29,7) df1 <- data.frame(a,b,c) i want make single column doing r bind. doing : x <- as.data.frame(df1$a) y <- as.data.frame(df1$b) z <- as.data.frame(df1$c) colnames(x)[1] <- "x" colnames(y)[1] <- "x" colnames(z)[1] <- "x" e <- rbind(x,y,z) but problem if number of column huge 50-60 difficult same. need help... you can use unlist coerce vector, i.e. unlist(df1) have make sure don't have factor columns , keep in mind doing coercing numeric columns characters. for example above, not work df1$b factor. have convert character first.

ruby on rails - How set cookie sent from server to a client on a different port -

i have backend server (powered rails), apis used html5 frontend runs on node simple development server. both on same host: machine. when login frontend backend, rails sent me session cookie. can see in response headers, problem browsers not save it. policies right, if serve same frontend directly rails app cookies set right. the difference can see when frontend run on node server, runs on port 8080 , rails on port 3000 . knew cookies not supposed port specific, missing happening here. any thoughts? solutions? (i need able keep setup way, have frontend served node , backend on rails on different ports) you're correct cookies domain agnostic, , browser send same cookies myapp.local:3000 myapp.local:8080-- except not through xmlhttprequest (a.k.a., ajax) when doing cors. make sure set withcredentials true on xmlhttprequest object. ( https://developer.mozilla.org/en-us/docs/web/api/xmlhttprequest/withcredentials ). also, since tagged webpack-dev-server ...

javascript - SVG Inject file to DOM from scope variable -

i'm working on app svg map. installed module svginjector https://github.com/iconic/svginjector . works static url like: <img class="inject-me" src="data/maps/building1.svg"> i change map based on variable url ($stateparams). controller looks this: function mapsinglectrl( $scope, $stateparams, userservice, $ionicpopup, $state, $log ) { var vm = this; var mapsingle = {"id": $stateparams.id, "building": $stateparams.building, "floor": $stateparams.floor, "roomid": $stateparams.roomid, "room": $stateparams.room}; $scope.svgmap = "data/maps/building1.svg"; $scope.mapsingle = mapsingle; // inject svg var mysvgstoinject = document.queryselectorall('img.inject-me'); //console.log(mysvgstoinject); svginjector(mysvgstoinject); } and when use: <img class="inject-me" src="{{svgmap}}"> file load ...

javascript - Element trigger click event doesn't work with ionic -

i need pass click event controller used code: angular.element(document.queryselectorall('#cal')).triggerhandler('click'); in browser works when put ionic serve didn't work on mobile you can write in way in controller. angular.element(document).ready(function () { angular.element(document.queryselectorall('#cal')).triggerhandler('click'); //or angular.element(document.queryselectorall('#cal')).trigger('click'); });

java - Relations among the methods to access parts of URL in HttpServletRequest object -

on httpservletrequest object, assuming calling url not encoded, can assume that: getcontextpath()+getservletpath()+getpathinfo()==getrequesturi() true? i'm pretty sure answer yes getrequesturi somehow obscure in describing is.

java - How to map the marshalled object values(reader) to hibernate entity object(writer) in spring batch -

i new spring batch, after extensive search didn't clue on how map xml marshalled object value hibernate entity object. specific, think follows same approach fieldsetmapper not sure how marshallobject instead of flatfieldset. please help. fyi: should use hibernate , not jdbctemplate or preparedstatementsetter etc. the batch config file: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema...

wmi - Connecting DC Remote HyperV server in c# -

i trying connect hyperv server remotely part of same domain controller local system is. works if give username without ad, fails every time(with error "invalid parameter") when username ad.e.g. ad\administrator. // works impersonation = impersonationlevel.impersonate; authority = "ntlmdomain:" + _domain; options.username = "administrator"; options.password = _authpas; //but doesn't work impersonation = impersonationlevel.impersonate; authority = "ntlmdomain:" + _domain; options.username = "testad\\administrator"; options.password = _authpas; any highly appreciated. why giving domain name in username after provided domain name in "authority" already domain mentioned in authority the username should username without domainname giving multiple times not work

php - exec() is not working -

i doing conversion youtube link gif image ,but faced problem while executing exce() function. echo $ret = exec("youtube-to-gif -u https://www.youtube.com/watch?v={$vidid} -b $start_second -d $different_second -s 480x? -o {$filepath}{$filename} -f 10", $out, $err); i using exec() ,but not returning value .here not getting why not working. thanks ,any suggestion highly appreciate. first, store command in variable , try echoing , runnining in terminal see if it's valid @ all: $command = "youtube-to-gif -u https://www.youtube.com/watch?v={$vidid} -b $start_second -d $different_second -s 480x? -o {$filepath}{$filename} -f 10"; echo $command . php_eol; echo $ret = exec($command, $out, $err) . php_eol; if works fine when run manually, try full path youtube-to-gif. assuming running php on linux, should able command: which youtube-to-gif now replace youtube-to-gif full path in $command .

scala - sbt-android: IntelliJ marks usages of android support resources red -

Image
i using sbt-android plugin develop android applications scala , sbt. i have written little project sample code, runs great. but intellij marks "pointers" library resources red - can define them, not use them. it says, e.g. : 'cannot find symbol theme.appcompat'. here pictures: here build.sbt: name := "scalandroid" import android.keys._ import android.dependencies.{apklib,aar} androidbuild javacoptions ++= seq("-source", "1.7", "-target", "1.7") scalaversion := "2.11.7" resolvers += "bugsense repository" @ "http://www.bugsense.com/gradle/" librarydependencies ++= seq( aar("com.android.support" % "appcompat-v7" % "24.2.0"), aar("com.android.support" % "cardview-v7" % "24.2.0"), aar("com.android.support" % "support-v4" % "24.2.0"), aar("com.android.support" %...

javascript - Override the default pagination template of ui-bootstrap -

i using angularjs show pagination. making changes on default pagination template. html: <ul uib-pagination ng-model="source_pagination.current" template-url="pagination.html" total-items="source_pagination.total_pages" items-per-page="1" max-size="source_pagination.max_items" class="pagination-sm" force-ellipses="true" direction-links="false" ng-change="source_page_changed()"></ul> ... <script id="pagination.html" type="text/ng-template"> <ul class="pagination"> <li ng-if="boundarylinks" ng-class="{disabled: noprevious()}"> <a href ng-click="selectpage(1)" title="first page"> <span class="glyphicon glyphicon-fast-backward"></span> </a> </li>...

sql - Converting datetime variable format -

i need in converting datetime variable format mmm dd yyyy datetime variable format yyyy-mm-dd i'm assuming datetime variable varchar - can directly cast via convert : declare @yourvariable varchar (15) = 'jan 01 1996' select convert(date, @yourvariable) 1996-01-01

jquery 3.1.0 and jquery-ui autocomplete are not compatible, what's the workaround? -

i having trouble getting jquery 3.1.0 work jquery ui's autocomplete feature. the workaround know replacing jquery 3.1.0 1 prepackaged jquery ui installer. unfortunately, wouldn't work me version in installer package of jquery ui doesn't allow me use tags-input , other modern features require website. <input type="email" id="tags" class="form-control" placeholder="any criteria" data-role="tagsinput"> <script type="text/javascript" src="external/jquery/js/jquery-3.1.0.min.js"></script> <script type="text/javascript" src="external/jquery-ui/js/jquery-ui.min.js"></script> <script> $( function() { var availabletags = [ "actionscript", "applescript", "asp", "basic", "c", "c++", "clojure", ...

python 3.x - How to install Anaconda on RaspBerry Pi 3 Model B -

i know how install latest anaconda version continuum on raspberry pi 3 model b. appreciated... on raspberry pi 3 model b - installation of miniconda (bundled python 3) go , latest version of miniconda raspberry pi - made armv7l processor , bundled python 3 (eg.: uname -m) wget http://repo.continuum.io/miniconda/miniconda3-latest-linux-armv7l.sh sudo md5sum miniconda3-latest-linux-armv7l.sh sudo /bin/bash miniconda3-latest-linux-armv7l.sh when installing change default dir installation /root/miniconda3 to: /home/pi/miniconda3 edit .bashrc file sudo nano /home/pi/.bashrc ...and add following line end of file export path="/home/pi/miniconda3/bin:$path" save , close file & reboot raspberry pi sudo reboot -h after reboot enter following command "python --version" should give you: python 3.4.3 :: continuum analytics, inc.

How to refactor this logic in the template/view to use a single line if statement (AngularJS 1.x) -

i fixing small issues within our angularjs application - i've come across logic below displays one link. in pseudocode style.. if (data.serviceid exists in dom) { display link & populate href data.serviceid value } elseif(commentreply.sender.serviceid exists in dom) { display link & populate href commentreply.sender.serviceid value } the code in template looks follows, how can amend code below cleaner , not duplicating line using form of single line tertiary statement? <a ng-if="data.serviceid" ng-href="/#/profile/{{data.serviceid}}">view</a> <a ng-if="commentreply.sender.serviceid" ng-href="/#/profile/{{commentreply.sender.serviceid}}">view</a> for example: <a data-ng-href="/#/profile/{{data.serviceid && !commentreply.sender.serviceid ? data.serviceid : commentreply.sender.serviceid}}">view</a> or <a href="/#/profile/{{data.serviceid ...

javascript - How to get if a player presses the TAB key in a forum -

so, i'm making school project (a game of sorts), , mail address school. record mail address in database , want add little feature. if 'player' presses tab key in third forum box, fourth gets automatically filled number entered in third box (student number) @... after it. how can fire event when tab key pressed in third box? have: <script> function automail() { if (event.keycode == 9) { console.log("mail automatisch ingevuld!"); event.preventdefault(); } } </script> <td style="color: white; font-weight: bold;" onkeypress="automail()">leerlingnummer:</td> this doesn't work, however. has idea? (btw: have onkeypress event somewhere else in site, wich work. can't figure out why 1 doesn't...) first of need pass event function this <td style="color: white; font-weight: bold;" onkeypress="automail(event)">leerlingnummer...

javascript - I can't setup socket.io -

so decided use socket.io, send data serverside client side, giving me error : vm134:3511 http://[url]/socket.io/?eio=3&transport=polling&t=ls52pfm 404 (not found) and : failed load resource: server responded status of 404 (not found) and here app.js : var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var routes = require('./routes/index'); var login = require('./routes/login'); var facebook = require('./routes/facebook'); var dev = require('./routes/dev'); var users = require('./routes/users'); var ux = require('./routes/ux'); var session = require('express-session'); //maziar added var addplaces = require('./routes/addplaces'); // socket.io stuff : var app = express() , http = req...

angularjs - cors request failing in sails.js while doing res.redirect() -

cors request failing xmlhttprequest cannot load http://eampple.net/api/transactions?asset_id=76cb0099&payment_id=pay_6g28anqus6wkbk&plan_name=undefined . request redirected ' http://eampple.net/api/subscriptions/events?transaction_token=0364 …8af7b4d98ee1f66d7ca0fbfd81b7e627781b6b81ba187e8e3d72ef49&asset_id=76cb0099', disallowed cross-origin requests require preflight. in side cors.js have set allroutes:true ,origin:'*' for request working. when redirect failing. how doing redirecting in angular? $window.location.href = href; was way work sails.

Finding multiple strings in directory using linux commends -

if have 2 strings, example "class" , "btn", linux command allow me search these 2 strings in entire directory. to more specific, lets have directory contains few folders bunch of .php files. goal able search throughout .php files prints out files contain "class" , "btn" in 1 line. clarifies things better. thanks, i use following search strings inside source codes. searches string , shows exact line number text appears. helpful searching string in source code files. can pipes output grep , filter outputs. grep -rn "text_to_search" directory_name/ example: $ grep -rn "angular" menuapp $ grep -rn "angular" menuapp | grep some_other_string output be: menuapp/public/javascripts/angular.min.js:251://# sourcemappingurl=angular.min.js.map menuapp/public/javascripts/app.js:1:var app = angular.module("menuapp", []);

vue.js - Access router instance from my service -

i create auth service ( src/services/auth.js ), functions , properties .. export default { login() { ... } ... } inside login function, need redirect user router.go(redirect) how can retrieve router instance ? context in src/main.js file, create router .. import vuerouter 'vue-router' vue.use(vuerouter) import route './routes' const router = new vuerouter({ history: false, linkactiveclass: 'active' }) route(router) const app = vue.extend(require('./app.vue')) in src/routers.js map routes export default function configrouter (router) { router.map({ .. }) } you should export router instance , import auth.js service. here workaround improvements: src/routes.js export default { '/': { component: {...} }, '/about': { component: {...} }, ... } src/router.js import vue 'vue' import vuerouter 'vue-router' import routes './routes' vue.use(vu...

python - Rolling sum in subgroups of a dataframe (pandas) -

i have sessions dataframe contains e-mail , sessions (int) columns. i need calculate rolling sum of sessions per email (i.e. not globally). now, following works, it's painfully slow: emails = set(list(sessions['e-mail'])) ses_sums = [] em in emails: email_sessions = sessions[sessions['e-mail'] == em] email_sessions.is_copy = false email_sessions['session_rolling_sum'] = pd.rolling_sum(email_sessions['sessions'], window=self.window).fillna(0) ses_sums.append(email_sessions) df = pd.concat(ses_sums, ignore_index=true) is there way of achieving same in pandas , using pandas operators on dataframe instead of creating separate dataframes each email , concatenating them? (either or other way of making faster) np.random.seed([3,1415]) df = pd.dataframe({'e-mail': np.random.choice(list('ab'), 20), 'session': np.random.randint(1, 10, 20)}) df.groupby('e-mail').sess...

linux - Bash. Variable visibility and lifetime -

i'm not experienced in bash , i've met case makes me perplexed. it's example of such case: f1() { ar+=(1) ar+=(3) ar+=(2) var="var value" echo "0" } f2() { res=$(f1) echo -------point 1-------- in ${ar[@]}; echo "el $i" done echo $var echo -------point 2-------- f1>/dev/null in ${ar[@]}; echo "el $i" done echo $var } f2 this script produces following result: -------point 1-------- -------point 2-------- el 1 el 3 el 2 var value as can see, function f1 called in 2 different ways , give different implications. in first call array , variable declared in f1 apparently destroyed. in second way array , variable saved. does can explain me or give me link appropriate manual? when this: res=$(f1) you create subshell, execute f1 inside subshell , store output variable $res . variables created within subshell lost after has closed. when this: f1>/d...

Cannot write .csv file to StringGrid in C++ Builder -

edit: codeblock edited, problem last line of .csv file printed in each row of stringgrid. can reason? in advance. basically , 1 module of project create output file toushands of point coordinates in comma seperated format shown below : #pt, x , y ,z 124,4500003.833,3499999.500,0 125,4500003.833,3499999.833,0 126,4500003.833,3500000.167,0 what i'm trying reading .csv module , put stringgrid. file *coord; //some other things here while (fgets(line,100,dosyagiris)!=null) { sscanf(line,"%d,%lf,%lf,%lf",&number,&x,&y,&z); (col = 0; col < 4; col++) { stringgrid1->cells[0][row] = inttostr(number); stringgrid1->cells[1][row] = floattostr(x); stringgrid1->cells[2][row] = floattostr(y); stringgrid1->cells[3][row] = floattostr(z); } } please constructive , have one. it not working because of unnecessary loop, works. ...

Python, how to insert value in Powerpoint template? -

i want use existing powerpoint presentation generate series of reports: in imagination powerpoint slides have content in such or similar form: date of report: {{report_date}} number of sales: {{no_sales}} ... then python app opens powerpoint, fills in values report , saves report new name. googled, not find solution this. there python-pptx out there, creating new presentation , not inserting values in template. can advice? i tried on ".ppx" file had hanging around. microsoft office power point ".pptx" file in ".zip" format. when unzipped file, got ".xml" file , 3 directories. ".pptx" file has 116 slides comprised of 3,477 files , 22 directories/subdirectories. normally, not workable, since have 2 short changes figure out change , zip files make new ".ppx" file. warning: there xml blobs of binary data in 1 or more of ".xml" files.

python - Ansible: printing out JSON first level keys names -

example : { "fw1": { "ipv4": { "rtr": { "ip": "1.2.3.4", "net": "1.2.3.4", } } }, "fw2": { "ipv4": { "rtr": { "ip": "4.3.2.1", "net": "4.3.2.1", } } } } i need list first level keys of json file. using 'from_json).keys()' strange syntax --> [u'fw1', u'fw2']. where 'u' characters come , how rid of them ? there way list keys instead of getting them in array ? you don't need use from_json here: --- - hosts: localhost gather_facts: true vars: my_json: "{{ look...

vba - Object required with Access Combobox in With statement -

this separate issue previous 1 had submitted , got with. i'm trying work code checks numeric id field on form (record set originates query of complex joins) , compares combobox of values, unbound form originates query , fills in combo box, based on numeric id on form. query combo box has 2 columns bound "name" , "id" id field hidden. i keep getting "object required" error when attempting run code , i've tried debug it. strange thing is: while debugging, each line of code returns/contains values should, access seeing combobox valid object, continues return error. first shot @ code: dim parid dim integer parid = me.parentid.value combo217 = 0 .listcount - 1 if .column(1, i).value = parid .value = .itemdata(i) exit end if next end this didn't work so tried putting combobox variable , declaring combobox: private sub command223_click() dim parid dim combo combobox set combo = combo217 parid = me...

user interface - how can i make the unity gui window dragable -

i trying make window dragable i'm making multiplayer game , status shown has window public bool finishsession = false; public bool showhelp = false; private arraylist messages = new arraylist(); private string currenttime = ""; private string newmessage = ""; private vector2 windowscrollposition; private smartfox smartfox; private guistyle windowstyle; private guistyle usereventstyle; private guistyle systemstyle; public rect rctwindow; public float windowpanelposx; public float windowpanelposy; public float windowpanelwidth; public float windowpanelheight; public statuswindow() { smartfox = smartfoxconnection.connection; } public void addsystemmessage(string message) { messages.add(new statusmessage(statusmessage.statustype.system, message)); windowscrollposition.y = 100000; } public void addstatusmessage(string message) { messages.add(new statusmessage(statusmessage.statustype.status, message)); windowscrollposition.y = 100000;...

python - Plotting multiple graphs does not work using pylab -

Image
i want visualize birthday problem different n . aim plot multiple graphs in same figure not work. plots last graph , ignores others. using jupyter notebook. code: from decimal import decimal def calc_p_distinct(n): p_distinct = numpy.arange(0, n.size, dtype=decimal) in n: p_distinct[i] = decimal(1.0) in n: person in range(i): p_distinct[i] = decimal(p_distinct[i]) * decimal(((decimal(365-person))/decimal(365))) return p_distinct # n number of people n = numpy.arange(0, 20) n2 = numpy.arange(0, 50) n3 = numpy.arange(0, 100) # plot probability distribution p_distinct = calc_p_distinct(n) pylab.plot(n, p_distinct, 'r') p_distinct2 = calc_p_distinct(n2) pylab.plot(n2, p_distinct2, 'g') p_distinct3 = calc_p_distinct(n3) pylab.plot(n3, p_distinct3, 'b') # set labels of axis , title pylab.xlabel("n", fontsize=18) pylab.ylabel("probability", fontsize=18) pylab.title("birthday problem...

php - Mysql code working in browser but not working when running page in mobile -

i have php file mysql code in it, problem when run in chrome browser file runs , mysql code update table when run same file in mobile php file runs mysql table not updated php code given below site <body> <?php require 'req.php'; if ($_server["request_method"] == "post") { $post_trans=$_post["farm_option"]; mysql_select_db('abc'); $sql2 = "update table set act_st='1' transaction='$post_trans'"; $sqlste = mysql_query($sql2, $conn); if($sqlste){ echo "<h1>account activated</h1>"; } }else{ $sql ="select transaction, email `trans` act_st='0'"; mysql_select_db('abc'); $sqlst = mysql_query($sql, $conn); if($sqlst){ echo '<form name="farm" method="post" action="nis.php">'; echo '<label>transaction </label>'; echo '<select name="farm_option">...

rabbitmq - The best way to create php rabbit worker -

assume have rabbit queue filled data (e.g. user provides action need analyse later). 30 till 50 new items added each second. need create worker through queue , perform tasks on data. can this: class worker { public function run() { $queue = new queue('exchange', 'queue'); while (true) { $queue->processqueue(); } } } and run worker.php on server , seems working. but wonder, if infinite loop add load rabbit instance, if there no data proceed? maybe better way smth class worker { const idle = 5; private $start = 0; public function run() { $this->start = time(); $queue = new queue('exchange', 'queue'); while (true) { $queue->processqueue(); //don't allow worker working lot if (time() - $this->start >= 60 * 60 - self::idle) { break; } ...

python - List comprehension of 2+ variables in R -

what's best r equivalent of python 2-variable list comprehension [datetime(y,m,15) y in xrange(2000,2020) m in [3,6,9,12]] the result [datetime.datetime(2000, 3, 15, 0, 0), datetime.datetime(2000, 6, 15, 0, 0), datetime.datetime(2000, 9, 15, 0, 0), datetime.datetime(2000, 12, 15, 0, 0), datetime.datetime(2001, 3, 15, 0, 0) ... ] this produce equivalent results in r with(expand.grid(m=c(3,6,9,12), y=2000:2020), isodate(y,m,15)) we use expand.grid combinations of year , month, , use vectorized isodate function values.

azure - Bing Voice Recognition API Output - Number vs Text -

i'm seeing odd behavior voice recognition api return words , return numbers. example, given audio input of "fifteen dollars , 7 cents" return "fifteen dollars , 7 cents" , others "$15.07". there way ensure 1 or other returned? or, need parse , convert words numbers on own. thanks! i looked similar issues, , found bingstt api returns both versions in different fields. tried example example code here: https://github.com/microsoft/cognitive-speech-stt-javascript , got response: [{ "lexical": "fifteen dollars , 7 cents", "display": "$15.07.", "inversenormalization": null, "maskedinversenormalization": null, "transcript": "$15.07.", "confidence": 0.9474185 }] so guess choice yours field use, lexical or display. hope helps.

datatables: how to repopulate table after data changed? -

my goal repopulate/redraw/refresh table after aadata:'data' changed: $(tableid).datatable({ "aadata": data, "destroy": true, "aocolumns": columns }); i suceed tricky: $(tableid).datatable().fncleartable(); $(tableid).datatable().fndestroy(); $(tableid).datatable({ "aadata": data, "destroy": true, "aocolumns": columns }); which looks horrible. guess there must cleaner way ? i've had struggle datatables also. my solution: var data = [json loaded ajax] function loadtable(data){ if($.fn.datatable.isdatatable('#testslisttable')){ if(data.testrunreports.length == 0) $('#testslisttable').datatable().fncleartable(); else $('#testslisttable').datatable().fnadddata(data); return; } $('#testslisttable').datatable({ data: data, ....

Writing to a specific dictionary inside a json file Python -

i have .json file information {"items": [{"phone": "testp"}, {"phone": "test2"}]} i want add dictionary next available slot in array more information. have tried many ways no of them work, has got ideas? dictionary["items"].append(new_dictionary) you access key "items" in dictionary, list of dictionaries, list append new dictionary

objective c - UIScrollView change subview position -

i have uiscrollview resized depending on context. subviews repositioned based on context. when loads, goes fine. but, when touch scrollview, subviews go original position. that messes layout. i specified: self.automaticallyadjustsscrollviewinsets = no; without result. does know why? here code position subview , resize scrollview. btnsave button goes it's original position when scroll. float more = 0; float height = 900; if (is_iphone_6) { height = 1050; } else if (is_iphone_6p) { more = 200; height = 1100; } status = [avcapturedevice authorizationstatusformediatype:avmediatypevideo]; if (appdelegate.driverfisrtname != nil && ![appdelegate.driverplateimage isequaltostring:@""]) { height = 1300; self.scrollview.contentsize = cgsizemake(self.view.frame.size.width, height); self.btnsave.frame = cgrectmake(self.btnsave.frame.origin.x, self.btnsave.frame.origin.y - more, ...

python - Inserting an element before each element of a list -

i'm looking insert constant element before each of existing element of list, i.e. go from: ['foo', 'bar', 'baz'] to: ['a', 'foo', 'a', 'bar', 'a', 'baz'] i've tried using list comprehensions best thing can achieve array of arrays using statement: [['a', elt] elt in stuff] which results in this: [['a', 'foo'], ['a', 'bar'], ['a', 'baz']] so not want. can achieved using list comprehension? in case matters, i'm using python 3.5. add loop: [v elt in stuff v in ('a', elt)] or use itertools.chain.from_iterable() zip() , itertools.repeat() if need iterable version rather full list: from itertools import chain, repeat try: # python 3 version (itertools.izip) future_builtins import zip except importerror: # no import needed in python 3 = chain.from_iterable(zip(repeat('a'), stuff))

scala - how to divide nested array using RDD in spark -

i trying divide nested array using rdd in spark. example, there textfile contains 4 sentences, this: "he good", "she good", "i good", "we good" i used val arr = sc.textfile("filename").map(_.split(" ")) command , got this: array[array[string]] = array(array(he, is, good), array(she, is, good), ... ) i want use each array elements (i.e. array(he, is, good) ) don't know how divide this. how can divide this? it unclear mean 'divided', typically in functional programming languages, when want each element of collection (or 'iterable'), can use map function. map converts each element based on function passed it. example, in worksheet can this: val sentences = array(array("he", "is", "good"), array("she", "is", "very", "good")) def y...

scala ide - getting java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus while opening class file -

this happens scala ide 4.3.0 i getting below error while opening class file maven dependencies jar using eclipse decompiler plugin. hint: trying open compiled jar of scala project. java.lang.classcastexception: org.eclipse.core.runtime.status cannot cast org.eclipse.jdt.core.ijavamodelstatus error details eclipse.buildid=4.3.0-vfinal-2015-12-01t15:55:22z-typesafe java.version=1.8.0_102 java.vendor=oracle corporation bootloader constants: os=win32, arch=x86_64, ws=win32, nl=en_us command-line arguments: -os win32 -ws win32 -arch x86_64 org.eclipse.ui.workbench.texteditor editor not initialized. stacktrace java.lang.classcastexception: org.eclipse.core.runtime.status cannot cast org.eclipse.jdt.core.ijavamodelstatus @ org.eclipse.jdt.internal.core.classfile.getbuffer(classfile.java:367) @ org.eclipse.jdt.internal.core.classfile.getsource(classfile.java:509) @ org.sf.feeling.decompiler.editor.javadecompilerclassfileeditor.doopenbuffer(javadecompilercl...

VBA: Nested For/Loop -

i creating macro copy data 1 workbook/multiple sheets workbook/multiple sheets. first spreadsheet has 7 worksheets named sun-sat. second worksheet has 10 worksheets 3 worksheets irrelevant , other 7 worksheets named sunday-saturday. i tested each loop separately , work needed. when trying combine them inner statement repeats , cycles through dates before backing out. have tried incorporating exit jump out of inner when going inner not increment +1 go next date. there simple way add +1 outer statement? enter code here dim wsshortdays, wsfulldays variant dim wsshortdayscrnt, wsfulldayscrnt long dim sd, fd long wsshortdays = array("sun", "mon", "tue", "wed", "thu", "fri", "sat") wsfulldays = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday") fd = lbound(wsfulldays) ubound(wsfulldays) wbk1.worksheets(...