Posts

Showing posts from January, 2015

ruby - Rails Date.today is reflecting Date of Deployment of Server -

i have rails application displays active events (events on or after today). scope :active, where("event_date >= ?", date.today).order("event_date asc") it coming fine on local. on production server , query taking date of deployment comparison. this log select "events".* "events" "events"."school_id" = 32 , (roster_id in (45) or roster_id null) , (event_date >= '2014-09-18') order event_date asc but if check console on production, showing correctly 1.9.3-p448 :001 > date.today => fri, 19 sep 2014 server on aws ec2 any appreciated. try putting in lambda: scope :active, -> { where("event_date >= ?", date.today).order("event_date asc") } probably date.today being evaluated @ time when code loaded(i.e. deployed).

javascript - Default input number value -

i'm new angularjs , i've created simple input box want default value. here's input: <input id="fieldwidth" min="10" type="number" value="10" ng-model="set.width"> however, value doesn't show default. when try set though scope in controller $scope.set.width = "10"; it says "cannot set property 'width' of undefined" what missing? if haven't already... should set $scope.set before trying set it's child: $scope.set = {width:10}; or $scope.set = {}; $scope.set.width = 10; or can without set object if don't have other values associating it. $scope.width = 10; <input id="fieldwidth" min="10" type="number" ng-model="width">

jquery - NuGet Limit max major version of a package -

Image
is possible tell nuget want use latest version of package with particular major version , never above major version? for instance, let's take example jquery: can't use 2.x version if need support of old browsers. we're limited use latest 1.x version. we know available (and offered default in manage nuget packages dialog) version of jquery 2.1.1. rather using version, need use latest major version of jquery 1.x branch, currently, 1.11.1. i know how install 1.11.1 version. 1 simple solution manually edit packages.config file replace value of version attribute 1.11.1 : <packages> <package id="jquery" version="1.11.1" targetframework="net451" /> </packages> and build project. what don't know how tell nuget keep track of releasing new versions of 1.x branch offer me updating them same way when new 2.x version released: by default, nuget try update latest 2.x version, not latest 1.x. in other words, wh

c - Calculating facing arc between two 3d rotational matrixes -

i working on space-ship simulator, , having trouble facing arcs between 2 space objects. each object has rotation matrix defined follows: //top row rotation[0][0] = cos(pitch)*cos(yaw); rotation[0][1] = -sin(yaw)*cos(pitch); rotation[0][2] = sin(pitch); //middle row rotation[1][0] = cos(yaw)*sin(pitch)*sin(roll) + sin(yaw)*cos(roll); rotation[1][1] = -sin(yaw)*sin(pitch)*sin(roll) + cos(yaw)*cos(roll); rotation[1][2] = -cos(pitch)*sin(roll); //bottom row rotation[2][0] = -cos(yaw)*sin(pitch)*cos(roll) + sin(yaw)*sin(roll); rotation[2][1] = sin(yaw)*sin(pitch)*cos(roll) + cos(yaw)*sin(roll); rotation[2][2] = cos(pitch)*cos(roll); as having xyz coordinates. using information, need able decide 90 degree arc facing between object1 , object1: forward, starboard, port, aft, dorsal (upper) , ventral (lower) trying use following formula: arc = acos( sum(a*b) / ( sqrt(sum(a * a)) * sqrt(sum(b * b)) ) ) where |a| vector direction of |object2| - |object1| , |b| row1 (forward arc), r

asp.net - Performance degrades as multiple tabs are opened SignalR -

i creating chat application. due browser limitation open 5-6 concurrent tabs 1 connection, used sub domian concept open multiple tabs. but facing problem that, when multiple tabs opened, chat process slows down. it works fine when 4-5 tabs opened if more 5 tabs opened, overall process slows down , messages received receiver in different order send. when start closing tabs, signalr issue starts behaving earlier. one more issues faced related performance when open tabs 1 after other performance degrades. sends messages after minute or takes long time send message. can suggest me solution performance issue of signalr? thanks in advance

sql server - SQL Query to Select by String ID -

i have below line of code in asp.net page var strselect = string.format("select emailaddress dbo.master stringid='", values["stringid"], "'"); this results in error unclosed quotation mark after character string ''. incorrect syntax near ''. what's wrong syntax? source error: line 65: cmd.connection.close(); line 66: if (!mvcfunctions.handleerror()) line 67: throw e; line 68: return null; line 69: } you're not using string.format correctly: var strselect = string.format("select emailaddress dbo.master stringid='", values["stringid"], "'"); should be var strselect = string.format("select emailaddress dbo.master stringid='{0}'", values["stringid"]); additional information: http://msdn.microsoft.

jquery appending directly after each closing tag before any unwrapped text -

i having trouble getting image link appear directly after closing tag each players names here snippet of script if (shouldaddpopupicon()) { var bodyid = $('body').attr('id'); if (bodyid === 'body_options_02') { $.each($('a[class^="position_"], td.cbsplayername ,td.playertd a'), function (index, value) { var id = getplayeridfromhref($(this).attr('href')); _playerpopupids.push(id); }); _playerpopupids = getuniquearray(_playerpopupids); $.ajax({ type: 'get', url: getplayerprofileapiurl() }).done(function (data) { $.each($('a[class^="position_"], td.cbsplayername a, td.playertd a'), function (index, value) { try { if(!$(this).nextall('a').hasclass('playerpopupnewsicon')) {

osx - CSS text alignment with Mac browsers -

i've created css top bar menu uses | character separators. it's rendering should on browser try linux or windows. but, on mac, browser, | characters drop down line or so, , render below menu bar. css #menu { position:relative; width:80%; min-width:800px; margin-left:auto; margin-right:auto; margin-top:1%; text-align:center; border-top:1px solid #666666; border-bottom:1px solid #666666; padding: 12px 12px; height:1.6em; font-family: 'geometria-medium'; } #menu ul { display:inline-block; margin: 0; margin-left:auto; margin-right:auto; text-align:left; padding: 0px; line-height: 1.2em; } #menu li { list-style:none; } #menu>ul>li { float: left; margin-right: 1px; position:relative; } #menu>ul>li ul { position:absolute; } #menu>ul>li ul>li { bottom:0px; display:none; width:15em; float:left; } #menu>ul>li:hover ul>li { display:block } #menu { display:block; padding: 0px 5%; text-decoration: none; text-transform: uppercase; color:#6

java - Tarsos dsp Android AudioTrack plays static or too fast -

this problem has been frustrating me while. i'm trying use tarsos dsp perform basic signal processing on project i'm working on android. audio comes standard wav file 44.1k, 16bit stereo. when set , run tarsos audiodispatcher using audioprocessor uses android's audiotrack output sound static or audio plays way fast. here code sets audio dispatcher public void play(string source, double starttime, final double endtime){ inputstream wavstream; try { wavstream = new fileinputstream(source); universalaudioinputstream audiostream = new universalaudioinputstream(wavstream, audioformat); dispatcher = new audiodispatcher(audiostream, buffersize, overlap); androidaudioplayer player = new androidaudioplayer(audioformat, buffersize); dispatcher.addaudioprocessor(player); dispatcher.skip(starttime); new thread(new runnable() { @override public void run() { while (dispatc

android - Wrap OpenGL Matrix translation -

let's have opengl 4x4 matrix use transformation, inside call use "translate" many times then, @ end, want "wrap" translation around specific size, so, in 2d terms, let's translate x 210, want wrap translation "50 width" box, resulting in translation of 10 (210 % 50). since need convert coordinates screen pixels init matrix in way: private float[] mscreenmatrix = { 2f / width, 0f, 0f, 0f, 0f, -2f / height, 0f, 0f, 0f, 0f, 0f, 0f, -1f, 1f, 0f, 1f }; so, if width "50" , call matrix.translatem(210,0,0) how can "wrap" matrix final translation on x 10? you can't (without doing work) because wrap introduces modulo arithmetic (or toroidal topology) doesn't match way opengl's ndc space (which translate volume can see in window) laid out. when primitive reaches out of ndc space gets clipped remains within ndc space. so in order toroidal topology have duplicate primitives cl

Swift class doesn't like self.view.addSubview() -

i've built custom button , i'm trying put in class. the code below throws error line " self.view.addsubview(button) " - used when code running under viewdidload . any suggestions? class mybutton { var buttonlabel:string var buttonradius:cgfloat = 90 var button = uibutton.buttonwithtype(uibuttontype.system) uibutton init(buttoncolour:cgcolorref, buttonlabel:string){ self.buttoncolour = buttoncolour self.buttonlabel = buttonlabel } func drawbutton() { button.frame = 100, 100, buttonradius * 2, buttonradius * 2) button.layer.bordercolor = buttoncolour button.settitle(buttonlabel, forstate: uicontrolstate.normal) button.addtarget(self, action: "pressed:", forcontrolevents: uicontrolevents.touchupinside) self.view.addsubview(button) // error: 'viewcontroller.mybutton' not have member named 'view' } you doing wrong. class not have view property. gu

jboss - NetBeans: create Entity from Database -

Image
need reverse engineer database tables entity run java ee project on jboss 7. i've added services jboss application server , added resources mysql datasource. however, when try run wizard create entity database can see option default exampleds database. there no other option create new datasource or use mysql datasource i've installed on jboss. i wonder if it's netbeans bug, or i'm missing something. i'm using netbeans 8.0.1 version. i think it's issue plugin using connecting application server. remember had issue when first tried generate entity classes database using datasource on wildfly. sure target application server jboss 7 , not wildfly ? if so, try connect application jboss 7 /eap 6 instead , see if works. hope helps edit: i've included jboss netbeans tutorial shows steps reverse engineering database tables entity classes (and jsf pages).

oledb - Updating Image on database MSAccess Database Vb.net? -

i want update images in database when press button won't update , don't have errors on code. added code in "com.executequery" block try if errors, , messagebox result "error" private sub updatebtn_click(byval sender system.object, byval e system.eventargs) handles updatebtn.click if agetxt.selecteditem = nothing or gendertxt.selecteditem = nothing or yrlvltxt.selecteditem = nothing or picturebox1.image nothing msgbox("please not leave required fields blanks.", vbexclamation, "warning!") else dim memstream new memorystream dim datapic_update byte() me.picturebox1.image.save(memstream, imaging.imageformat.jpeg) datapic_update = memstream.getbuffer() memstream.read(datapic_update, 0, memstream.length) 'to check if connection open if con.state = connectionstate.open con.close(

ios - Termination because of NSEexception? -

this in .m file, xcode. main goal have button play sound(not @ same time) when has 2 sound files attached , randomizer doesn't play same sound twice or wouldn't twice. run code , when click on yes button lldb nsesception error occurs. ive looked around lldb exception error solution found go view-controller delete yellow exclamation mark;which didn't not solve issue.. #import "viewcontroller.h" #import <avfoundation/avaudioplayer.h> @interface viewcontroller () @end @implementation viewcontroller : uiviewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (ibaction)yes{ nsmutablearray *array=[nsmutablearray arraywithobjects: @"yes.mp3", @"yes 3.mp3",

c++ - Conditioning for the four cases of the signs of two numbers -

i have 2 numbers , b. condition 4 cases of signs of these 2 numbers. do if ((a >= 0) && (b >= 0)){ // }; if ((a >= 0) && (b < 0)){ // }; if ((a < 0) && (b >= 0)){ // }; if ((a < 0) && (b < 0)){ // }; one produce function outputs different values in each case , use switch{ case:} statement. functions have thought doesn't improve number of comparisons, there no gain. which way recommended doing conditioning? well, guess of if -s put inside else -s of others not conditions have evaluated always. if (a >= 0) { if (b >= 0) { } else // b < 0 { } } else // < 0 { if (b >= 0) { } else // b < 0 { } }

java ee - How can I get real system file path from within a WebSocket Endpoint -

while within servlet context can real system file path calling on request.getservletcontext().getrealpath(upload_path). please friends how can equivalent within websocket endpoint in java ee 7. in advance. you can path information serverendpointconfig#getpath() . difference between results of method , servletcontext#getrealpath() gives relateive path; prefix results of method root context name. results, need implement onopen (from javax.websocket.endpoint class) //called when client first negotiates opening of websocket connection public void onopen(session session, serverendpointconfig config){ string path = config.getpath(); }

ruby on rails - Controller spec and default_url_options -

i'm using rails 3.1.3 rspec-rails 2.8.1. have scope ':locale' in routes.rb , want run controller , routing specs. i'm aware of problem setting default_url_options in application.rb controller apply solution found in last comment on rspec issue #255 ( https://github.com/rspec/rspec-rails/issues/255 ) #./spec/support/default_locale.rb class actionview::testcase::testcontroller def default_url_options(options={}) { :locale => i18n.default_locale } end end class actiondispatch::routing::routeset def default_url_options(options={}) { :locale => i18n.default_locale } end end #./spec/controllers/categories_controller_spec.rb require "spec_helper" describe categoriescontroller describe "get index" "assigns categories @categories" category = factory :category :index assigns(:categories).to_a.should eq([category]) end end end this test fails routing error if use "get :index, local

qt - Android back button press doesn't trigger keys.onreleased qml -

i creating program in qt5.3 , qtquick2.1. trying capture button press on android in code using keys.onreleased. event not getting triggered. have set item focus true. still no success. here code sample import qtquick 2.1 import qtquick.controls 1.2 import qtquick.controls.styles 1.2 import qtquick.layouts 1.1 import qtquick.window 2.1 rectangle { id: main2 focus: true width: screen.width height: screen.height keys.enabled: true keys.priority: keys.beforeitem property string load_page: "" signal deskconnected() loader{ id: pageloader anchors.fill: parent source: "qrc:/qml/resources/firstpage.qml" } ondeskconnected: { pageloader.item.ondeskconnected() } function loadpatwin(){ pageloader.source = "qrc:/qml/resources/secondpage.qml"; } keys.onreleased: { console.log("back"); if (event.key === qt.key_back) { even

mysql - Joins: Incorrect result when SUM() is used and only one record is displayed -

please have @ below sql query select client_portfolio.*, client.name "client name", provider.name "provider name", initial_fees.*, portfolio.vat, portfolio.invest_amount, portfolio.cash_value, sum(ongoing_fees.fee) client_portfolio left join client on client.idclient = client_portfolio.idclient left join portfolio on portfolio.idportfolio = client_portfolio.idportfolio left join provider on provider.idprovider = portfolio.idprovider left join initial_fees on initial_fees.idportfolio = portfolio.idportfolio left join ongoing_fees on ongoing_fees.idportfolio = portfolio.idportfolio order client_portfolio.idclient this query generates incorrect results, if remove " sum(ongoing_fees.fee) " part, generates correct result. ongoing_fees table, , portfolios might have ongoing_fees , while others don't. trying sum total ongoing_fees belong each portfolio seperatly , result above query. went wrong.. gave me ongoing_fees sum of entire table,

pdf - Extra space getting added while reading the text in TJ operator -

0.99 0 0 -1 1409 77 tm [(filer) -48.4848 (os) -33.3333 (earche) -47.4747 (xpres) -36.3636 (si) -44.4444 (on_bp) -37.3737 (:)] tj 0.99 0 0 -1 1827 77 tm [(bp)] tj the actual sentence "filerosearchexpression_bp:bp" if take xposition (filerosearchexpression_bp:) + length(filerosearchexpression_bp:), nower nearest xposition of second tj operator , because of space getting added. does -1 in textmatrix have significance?

salesforce - Getting heap size error while serializing collection of records in apex -

i suffering salesforce apex limitexception issue. fetching thousands of records few objects , putting collection map. have requirement generate json same records used mobile devices download data salesforce. when tried serialize records using system.json.serialize() method; generating huge json string , getting system.limitexception error because there more memory required available space. tried catch issue using try/catch block here reference available says system.limitexception can’t caught catch block. referral url: http://www.salesforce.com/us/developer/docs/apexcode/content/apex_classes_exception_methods.htm i know can check heap size limit through limits.getheapsize() method. there work around can handle issue apex side. code sample or reference in regard highly appreciated. in advanced. an alternative use batches in apex code. apex batches you can send records in start() method , process json serialization in execute() method.

sbt 0.13.1 multi-project module not found when I change the sbt default scala library to scala 2.11.2 -

i use sbt 0.13.1 create 2 modules, , create project/mybuild.scala compile 2 modules. mybuild.scala: import sbt._ import keys._ object mybuild extends build { lazy val task = project.in(file("task")) lazy val root = project.in(file(".")) aggregate(task) dependson task } when change scala library 2.11.2 set scalahome . go maven download task.jar , failed, that's strange. sbt bug? there github test project address: test-sbt-0.13.1 i'd recommend move sources of root project root subfolder (task2), , add them aggregated. remove aggregating , depending on same project: object mybuild extends build { lazy val task = project.in(file("task")) lazy val task2 = project.in(file("task2")) dependson task lazy val root = project.in(file(".")) aggregate(task, task2) } this works me, it's strange such non-standard project structure works fine default scalahome. seems problem i

installshield - How to set registry value when cancel button is pressed in installscript project? -

i using installshield installscript project. my problem want set registry key when cancel button pressed in "preparing install" dialog. i have placed below code in oncanceling() event. deletes registry key. regdbsetdefaultroot( hkey_local_machine ); szkey = "software\\test\\uniinst"; szname = "cancel" ; szvalue = "1"; regdbsetkeyvalueex ( szkey, szname, regdb_number , szvalue, -1 ); please let me know doing wrong??? after searching lot came know "abort" keyword in oncanceling() event calls silent uninstallation. delete registry entry. to prevent deletion of registry uninstallation used disable(logging)... it should used before registry don't want delete during uninstallation. after have use enable(logging)... finally, using these 2 statement code this... disable(logging); //prevent registry deletion during uninstallation szkey = "software\\test\\uniinst"; szname = "cancel" ; szvalu

php - Cakephp - Cannot set Model->id in KeyValue Behavior::beforeSave -

i'm trying implement key/value behavior based on https://github.com/josegonzalez/cakephp-keyvalue my behavior insert new rows database each new key form submission, regardless number of keys, , update existing records if user_id , key found in keyvalue table. have linked user model keyvalue model, behavior. when database has no record of user_id/key, insert new records correctly. found if trying update existing key-value pairs of same user, first 2 values updated correctly last value submitted produce new record. after investigation found in saving loop in beforesave() , if assign id model in beforesave() $model->id before returning true, not passed model->save() class. i'm using cake 2.5.4 model->id in beforesave not pass model->save() in lib/model/model.php:# 1841 if ($count > 0) { $cache = $this->_prepareupdatefields(array_combine($fields, $values)); **pr($this->id); //this value empty** if (!empty($this->

c - Can malloc be relied on to return contiguous memory, and how do I properly call it? -

before started, yes have read a possible duplicate , malloc being weird in linux , cplusplus.com on malloc , done searching on google. i have scientific computing problem requires large 2d array. i'm following code found in copy of "numerical recipes in c", , having problem unallocated memory in middle of 2d array. working in windows, , using c++ msvc 2012. here 2d array allocation unsigned long nrl=0; unsigned long nrh=749774; unsigned long ncl=0 unsigned long nch=250657; unsigned long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; double **m; if((size_t)(nrow*ncol)<(size_t)nrow){ m=null; return m; } /*allocate pointers rows*/ m=(double **)malloc((size_t)(nrow)*sizeof(double*)); if (!m){ m=null; return m; } /*allocate rows , set pointers them*/ m[nrl]=(double *) malloc((size_t)((nrow*ncol)*sizeof(double))); if(!m[nrl]){ free(m[nrl]); free(m); m=null; return m; } for(i=nrl+1;i<=nrh;i++)m[i]=m[i-1]+n

sql - Show column value of one of left joins -

in query shows 1 row if sal.id_amenaza exists in mft or mfa schemas, want show mft.id_amenaza or mfa.id_amenaza (if exist in table) in resulting row. in actual query dont require id_amenaza. how can show? select sal.id_salvaguarda, sal.descripcion, sal.eficacia agr_salvaguardas sal left join agr_mit_frec_tipo mft on sal.id_salvaguarda = mft.id_salvaguarda , mft.id_amenaza = 5043 left join agr_mit_frec_act mfa on sal.id_salvaguarda = mfa.id_salvaguarda , mfa.id_amenaza = 5043 mft.id_salvaguarda not null or mfa.id_salvaguarda not null group sal.id_salvaguarda, sal.descripcion, sal.eficacia i need obtain table this: id_salvaguarda | descripcion | eficacia | id_amenaza 5061 | pre-01 | 100 | 5043 thank in advance. this should work you: select sal.id_salvaguarda, sal.descripcion, sal.eficacia, 5043 id_amenaza agr_salvaguardas sal left join agr_mit_frec_tipo mft on sal.id_salvaguarda = mft.id_salvaguar

r - RStudio empty on startup - No windows, no menus, no rendering -

when start rstudio, none of windows inside main frame come up, , none of menu options display menu options when clicked. it's blank page. it feels kind of graphics rendering or window management problem. i'm running windows 7. have latest version of r, 3.1.1. have latest rstudio, 98.1062. how fix it? reset rstudio state. this: close rstudio if open. go directory: %localappdata%\rstudio-desktop rename directory type of backup. start rstudio. rstudio see configuration directory missing , regenerate correct values. everything should work after that. other threads found helpful here are: https://support.rstudio.com/hc/en-us/articles/200534577-resetting-rstudio-s-state https://support.rstudio.com/hc/communities/public/questions/200666647-rstudio-096-16-windows-7-gives-empty-screen?locale=en-us thanks!

java - Incompatible int to String (getLast() method) -

i have string array string[] names; lets there given number of elements in array i make getlast method returns string public string getlast() { return names.length - 1; } this gives me error it's incompatible. how return string? also same add method public void add(int index, string element){ i'm curious how work without using linkedlist or arraylist, rather array-based list. get last element: public string getlast() { return names[names.length - 1]; } add string element array public void add(int index, string element) { int len = names.length; if (index < len) names[index] = element; else { names = arrays.copyof(names, len + (index - len + 1)); names[index] = element; } }

labeling - Labelling files with spaces in ClearCase -

we have script labels files recursively. here command executes label command. cleartool ls -recurse -vob_only -visible -short | \ xargs cleartool mklabel -replace -follow vpceum_9.0.0.99 > label.txt 2>&1 when encounter files spaces name such /directory/d1/my file here.doc , command errors off. how clearcase/unix accept space? you have tow approaches cleartool mklabel : you can use mklabel directly, -recurse option. label files (with or without space) you. can label files not in current view. cleartool mklabel -recurse -replace -follow vpceum_9.0.0.99 or, mentioned in " cleartool: how apply label files in current view only? ", use cleartool find: # windows syntax cleartool find . -cview -exec "cleartool mklabel -replace test_label \"%clearcase_xpn%\"" # unix syntax cleartool find . -cview -exec 'cleartool mklabel -replace test_label "$clearcase_xpn"' the "$clearcase_xpn" part all

android - Does Chromecast MediaRouteButton have a production bug? -

* -- issue app id not waste anybody's time. on off chance helps other noob real problem forgot check the: "send serial device # google when checking updates" checkbox below fold on chromecast device setup application. i had reboot chromecast device take effect. now naddaf's github works fine! before beginning: have no problem casting examples use actionbaractivity chromecast configuration not issue. in reference to: https://github.com/googlecast/mediarouter-cast-button-android there seems bug in mmediarouter.addcallback(mmediarouteselector, mmediaroutercallback, mediarouter.callback_flag_request_discovery); located in: mediarouterbuttonactivity.java never receives callback. this reported 4 days ago: https://github.com/googlecast/mediarouter-cast-button-android/issues/5 the long version: i have mature beta of video based android app uses fragmentactivity , targets sdk 14+. i have set chromecast device development ,

javascript - How to delay executing of called function? -

i'm making api application, using modules. place each module in corresponding .js file, , after push .js's in page head: app.loadmodule = function (src) { var script = document.createelement('script'); var appendto = document.getelementsbytagname('head')[0]; script.src = app.prefs.domain + '/js/mods/' + src + '.js'; appendto.appendchild(script); }; app.printloadedmodule = function (name) { console.log(name + '.js'); }; app.moduleloader = (function () { var modules = app.modulestoload; (var = 0, len = modules.length; < len; i++) { app.loadmodule(modules[i], app.init); } })(); after client can call api functions situated in modules. so, calls must executed after scripts appear in head. i have: app.init = function() { if (app.isfunc(callback)) { callback(); } }; the client calls api this: app.init(function () { app.api('user.get', {user_ids: '1'}, function (data) {

python - Map not returning anything -

i have following code: def upload_to_s3(filepath, unique_id): # print s3_url # <-- confirming `s3_url` variable not none return s3_url threads = [] num, list_of_paths in enumerate(chunked_paths_as_list): filepath in list_of_paths: t = threading.thread(target=upload_to_s3, args=(filepath, self.unique_id)) t.start() threads.append(t) results = map(lambda t: t.join(), threads) print results unfortunately, returning none every item: [none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none] >>>>> time: 13.9884989262 what need return statement in above map ? t.join() always returns none . that's because return value of thread target ignored. you'll have collect results other means, queue object : from queue import queue results = queue() def upload_to_s3(filepath, unique_id): # print s3_url # <-- confi

Git Shell ignores the custom prompt in my powershell profile -

my powershell profile customizes prompt , background color. $host.ui.rawui.backgroundcolor = 'red'; function prompt { write-host ("ps >") -nonewline -foregroundcolor magenta return " " } when open powershell, both customizations work: ps > when open git shell, background color customization works background red, prompt isn't short. c:\users\bigfont\documents\github> ...and then, if run . $profile explicitly import profile, entire customization work. ps > how can make git shell change prompt without having explicitly import profile? edits # 1 running $profile | select * results in allusersallhosts : c:\windows\syswow64\windowspowershell\v1.0\profile.ps1 alluserscurrenthost : c:\windows\syswow64\windowspowershell\v1.0\microsoft.powershell_profile.ps1 currentuserallhosts : c:\users\bigfont\documents\windowspowershell\profile.ps1 currentusercurrenthost : c:\users\bigfont\documents\windowspowersh

show opposite of "more like this" in elasticsearch -

i'm using elasticsearch pull logs. when use api search (say, "where log_status=error"), lots of results. i'd show nice smattering of entries- opposite of "show more this ". cardinality gives great aggregation of returned results, doesn't score every result. what i'm after more complicated fuzzy search ; want know uniqueness of documents each other, not accuracy of match query. in fact, current _score s 1.0 because actual query * . it's okay if solution expensive (say, script or function_score query). don't know how it.. or if out of scope. i don't see way in es. sounds might need cluster documents prior loading them es. query entry point essentially, , want see pairwise similarity between returned docs... correct? if so, complicated, because if use kmeans or something, know docs in same cluster, might not score between them. may consider using kmeans dimensionality reduction mechanism pairwise similarity processing.

substitute in r together with anova -

i tried run anova on different sets of data , didn't quite know how it. goolged , found useful: http://www.ats.ucla.edu/stat/r/pages/looping_strings.htm hsb2 <- read.csv("http://www.ats.ucla.edu/stat/data/hsb2.csv") names(hsb2) varlist <- names(hsb2)[8:11] models <- lapply(varlist, function(x) { lm(substitute(read ~ i, list(i = as.name(x))), data = hsb2) }) my understanding of above codes creates function lm() , apply each variable in varlist , linear regression on each of them. so thought use aov instead of lm work me this: aov(substitute(read ~ i, list(i = as.name(x))), data = hsb2) however, got error: error in terms.default(formula, "error", data = data) : no terms component nor attribute i have no idea of error comes from. please help! the problem substitute() returns expression, not formula. think @thelatemail's suggestion of lm(as.formula(paste("read ~",x)), data = hsb2) is work around. alternatively

wix - How to resolve warning "◦Value Install Location missing " in windows 7 software logo kit? -

hi doing certification first time exe .report generated warnings . 1. clean, reversible, installation test case: write appropriate add/remove program values: pass warnings • warning: applications expected create these registry entries displayname, installlocation, publisher, uninstallstring, versionmajor*, , versionminor*. application did not create following registry entries: ◦value installlocation missing or invalid program service. • impact if not fixed: user might remove application not free disk space, return computer state prior application being installed. failure restore machine original state poor user experience. applications not create above registry entries not found enterprise inventory tools, , may experience issues in os migrations , or upgrades scenarios. windows telemetry tools may not accurately report information application. • how fix: can supply of information needed configure add/remove programs in control panel setting values of installer

g++ - Undeclared variable error during gcc 4.9.1 compilation -

i've opensuse os , want compile gcc scratch. want compile 4.9.1 version because of c++11 support. following guide here . using gcc version 4.8.3 compilation. after executing make, following errors; libtool: compile: /mnt/disk2/gccwork-ozgur/4.9.1-objdir/./gcc/xgcc -shared-libgcc -b/mnt/disk2/gccwork-ozgur/4.9.1-objdir/./gcc -nostdinc++ -l/mnt/disk2/gccwork-ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src -l/mnt/disk2/gccwork-ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -l/mnt/disk2/gccwork-ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -b/mnt/disk2/gccwork-ozgur/4.9.1-install/x86_64-unknown-linux-gnu/bin/ -b/mnt/disk2/gccwork-ozgur/4.9.1-install/x86_64-unknown-linux-gnu/lib/ -isystem /mnt/disk2/gccwork-ozgur/4.9.1-install/x86_64-unknown-linux-gnu/include -isystem /mnt/disk2/gccwork-ozgur/4.9.1-install/x86_64-unknown-linux-gnu/sys-include -d_gnu_source -d_debug -d__stdc_constant_macros -d__stdc_format_macros -d__stdc

javascript - End Date should be greater than Start Date in Yii Bootstrap datepickerRow -

i using yii bootstraps datepickerrow : check this i want end_date depending on start_date. i.e. end_date should greater start date. i've spent couple of hours on google check whether in-built solution available didn't found solution. after written own js code which's think fine not working. i've achieved thing cjuidatepicker , booming. check working code yii cjuidatepicker but don't know why not working yii bootstrap datepickerrow. any appreciated. following code: <?php echo $form->datepickerrow( $identitycard, 'date_of_issue', array( 'onchange' => 'setenddate("passport_date_of_expiry", this)', 'class' => "input-small", 'labeloptions' => array('label' => 'date of issue <span class="required">*</span>'), 'value' => $passportarr['date_of_issue'], 'name' => 'passport[date_of_

Is there an elegant way to represent a map containing different types in C++? -

i'm building class want configure using various parameters may 1 of: int , double , string (or const char * matter). in language ruby, build initialization function takes hash keyed string. example: class example def init_with_params params puts params end end e = example.new e.init_with_params({ "outputfile" => "/tmp/out.txt", "capturefps" => 25.0, "retrydelayseconds" => 5 }) how can create similar behavior in c++? looking around found several posts talking boost::variant . rather avoid using boost if limiting different types 3 types mentioned above rather clean solution can made. edit : agree using designed , tested code such boost.variant better re-implementing same idea. in case, problem reduced using 3 basic types, looking simplest possible way of implementing it. here cut down version of regularly use store program configuration properties, maybe find useful: #include <map> #include <

optaplanner - When constraintMatchEnabled (false) is disabled, this method should not be called -

i trying use score director in optaplnner : solver solver = solverfactory.buildsolver(); scoredirectorfactory scoredirectorfactory = solver.getscoredirectorfactory(); scoredirector guiscoredirector = scoredirectorfactory.buildscoredirector(); (constraintmatchtotal constraintmatchtotal :guiscoredirector.getconstraintmatchtotals()) { } but getting following exception when call getconstraintmatchtotals method: when constraintmatchenabled (false) disabled, method should not called.. stacktrace follows: message: when constraintmatchenabled (false) disabled, method should not called. line | method ->> 140 | getconstraintmatchtotals in org.optaplanner.core.impl.score.director.abstractscoredirector - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 57 | solve in com.volcare.optaplanner.taskplanningcontroller | 97 | index . . . . . . . . . in '' | 200 | dofilter

php - Decode G2A search results (json) to array -

help me grab name of games url this page output json format. try convert array, code not work. please me! $url = 'https://search.g2a.com/items/select?json.wrf=jquery111003403934023808688_1411464896728&q=not+type%3aindividual+and+(-type%3agaming+and+wholesaleqty%3a%5b1+to+*%5d+and+wholesaleminprice%3a%5b0+to+198%5d)&wt=json&start=0&rows=10000&sort=sortorder+desc&_=1411464896757'; $content = file_get_contents($url); $json = json_decode($content, true); echo "<pre>"; print_r($json); echo "</pre>"; you should remove jsonp parameter json.wrf url first: https://search.g2a.com/items/select?q=not+type%3aindividual+and+(-type%3agaming+and+wholesaleqty%3a%5b1+to+*%5d+and+wholesaleminprice%3a%5b0+to+198%5d)&wt=json&start=0&rows=10000&sort=sortorder+desc&_=1411464896757 this return proper json result.

Password protected form with HTML and PHP -

i'm making html form , need people validate are. how i'm planning on doing password field. password sent them email. 1 password eneugh, no need dozens of different passwords. the html <form action="contact.php" method="post"> <!--entire form here--> <input type="password" name="pwd" placeholder="password" required /> <input type="submit" value="submit" id="button"/> </form> so question is: how select password (i think in contact.php, not sure) how process password in contact.php thanks in advance! your form sends data page contact.php here's write in contact.php you'll value input: <?php if (isset($_post['pwd'])) { //comparing user input password if ($_post['pwd'] == 'the_good_password_goes_here') { echo 'password good'; } else { echo 'wrong password'

iphone - Is it possible to connect a SceneView to a GameScene without storyboard? [iOS SWIFT] -

i have 2 scenes. first (presentscene) connected presentsceneview second scene (gamescene) not connected gamesceneview. presentsceneview created on storyboard not gamesceneview , don't want create it. is possible connect gamescene gamesceneview without create on storyboard? here gamesceneview code(doesn't work) import uikit import spritekit import avfoundation var backgroundmusicplayer:avaudioplayer = avaudioplayer() class gameviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() } override func viewwilllayoutsubviews() { var skview:skview = self.view skview skview.showsfps = true skview.showsnodecount = true skview.showsphysics = true var scene:skscene = gamescene.scenewithsize(skview.bounds.size) scene.scalemode = skscenescalemode.aspectfill skview.presentscene(scene) var bgmusicurl:nsurl = nsbundle.mainbundle().urlforresource("fond", withextension: "mp3")! ba

webforms - Upgrading SQL authentication EF database first to Identity 2 -

we're using old sql membership (forms authentication) web forms project, uses ef 6 database first. we'd upgrade our membership identity 2.0, have not managed find walks through migration our scenario of existing db-first model forms authentication. i have tried approach in http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity doesn't work code-first , seems identity 1. if knows how or has resources might help, hugely appreciated. there youtube video tutorial may idea in order achieve task. isn't migrating membership identity 2.0, video illustrates use identity 2.0 existing database. hope can work current resources (the given link). part 1: https://www.youtube.com/watch?v=elfqejow5hm part 2: https://www.youtube.com/watch?v=jbsqi3amatw hope helps.

security - Securing Bluetooth LE Messages -

i have requirement communicate custom bluetooth le device. communication needs be secure (plain text cannot read) not vulnerable replay attacks contained within 20 or 22 bytes per message bluetooth le restrictions (or phone api implementation restrictions) trusting bluetooth le's native encryption alone seems poor choice based on this: https://github.com/mikeryan/crackle/ so come implementing our own encryption. in normal client / server communication (tcp example) no message size restriction, aes-128 in cbc mode pre-shared private key might choice. however bluetooth le there's not enough space transmit initialization vector each characteristic read / write it seems error prone keep track of changing ivs based on last block of last message received / transmitted, given multiple characteristics being broadcast etc. have missed other way of making bluetooth le secure? ...fragment data 20 bytes , multiple write ble characteristic stored in gatt. n