Posts

Showing posts from May, 2014

xsbt web plugin - SBT hook into incremental compilation -

is there way hook incremental compilation? need start process once when user start task, , stop when task stopped. if started "~", important point process should not restarted on each recompilation. to more precise, want start webpack dev server once ~container:start . , not restart webpack on each container restart.

python - Error with calais.py -

i tried use calais.py library , run following code api_key ='token' calais = calais(api_key=api_key, submitter="my app") print calais.analyze_url('https://www.python.org/download/releases/2.5.1/') i following error: *valueerror: invalid request format - request has missing or invalid parameters* calais.py here: """ python-calais v.1.4 -- python interface opencalais api author: jordan dimov (jdimov@mlke.net) last-update: 01/12/2009 """ import httplib, urllib, re import simplejson json stringio import stringio params_xml = """ <c:params xmlns:c="http://s.opencalais.com/1/pred/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <c:processingdirectives %s> </c:processingdirectives> <c:userdirectives %s> </c:userdirectives> <c:externalmetadata %s> </c:externalmetadata> </c:params> """ strip_re = re.compile('&

Why do Polymer's computed properties need explicit property arguments? -

i digging bit polymer 1.0 elements , little curious computed properties. for example, in paper-drawer-panel.html , <dom-module id="paper-drawer-panel" …> … <div id="main" style$="[[_computedrawerstyle(drawerwidth)]]"> … </div> … </dom-module> <script> polymer({ is: 'paper-drawer-panel', … _computedrawerstyle: function(drawerwidth) { return 'width:' + drawerwidth + ';'; }, … </script> drawerwidth property of paper-drawer-panel , why important explicitly include in parameters of computed property? is [[_computedrawerstyle()]] … _computedrawerstyle: function () { return 'width:' + this.drawerwidth + ';'; } is bad practice? explicit arguments in computed bindings serve important purpose: telling polymer properties computed binding depends on. allows polymer know when recalculate , update computed binding. take [[_computedrawerst

excel - EPPlus formula not running - no result -

i trying calculate sum of column using code , not displaying anything. ws.cells["c51"].formula = "sum(c3:c50)"; am missing something? there place needs put? (such after populating cells) maybe post more of code. shouldnt need equal sign , have looks good. works fine if comment out loop (shows 0 in c51): [testmethod] public void sum_formula_test() { var newfile = new fileinfo(@"c:\temp\temp.xlsx"); if (newfile.exists) newfile.delete(); using (var package = new excelpackage(newfile)) { //http://stackoverflow.com/questions/30650055/epplus-formula-not-running-no-result var ws = package.workbook.worksheets.add("sheet1"); (var = 3; <= 50; i++) ws.cells[string.format("c{0}", i)].value = i*10; ws.cells["c51"].formula = "sum(c3:c50)"; package.save(); } } maybe overwriting cell value in later in logic.

sqlite - How do I count distinct combinations of column values? -

i use sqlite log every user's every access server. every time user uses function, append record database. the database looks like: usr_id fun_id 3 1 // user_3 used function_1 2 13 // user_2 used function_13 3 11 // user_3 used function_11 2 1 // user_2 used function_1 7 2 // ... usr_id stands user, fun_id stands functions login / send_text / logout... i want know each function's usage, used , how many times, plot gnuplot. in short, need plotting: fun_id usr_id used_count 1 2 1 // user_2 used function_1 once 1 3 1 // user_3 used function_1 once 2 7 1 // user_7 used function_2 once 13 2 3 // user_2 used function_13 3 times how generate sql query? just use count(*) along grouping: select fun_id, usr_id, count(*) used_count tablename group fun_id, usr_id order fun_id, usr_id;

python - Calling a function not working -

i have blackjack game working great (first project, still beginner). keep looping once game finished need implement functions , classes think. without copying on of code, skeleton of project far. split 2 functions because think makes little neater... if shouldn't that, let me know. (couple of imports) (couple of variables declared) class game: def newgame(self): (code) (game.choices) def choices(self): (code) (game.newgame) game.newgame() shouldn't call first function, in turn call second function? newgame needs object before can called (that's why self parameter) this: x = game() x.newgame() or (as pointed out in comments): game().newgame()

Can't generate javadoc for file in Android Studio -

Image
as seen image below. generating javadoc via tools->generate javadoc produces following window. cannot press ok seen below. you have not entered location output directory, in middle of dialog menu. directly above slider javadoc package visibility.

mysql - LOAD DATA INFILE file not found error -

i have newbie mysql question: keep getting error 29 says file not found following syntax , cannot figure out why: load data infile 'c:/users/rkartj2/desktop/loincsunquestv2.txt' table xiao fields terminated '\t' lines terminated '\n' ignore 1 rows; fyi - table xiao has been created in mysql 5.7 , loincsunquestv2.txt excel spreadsheet created on windows machine. while have not used version 5.7 of mysql yet, error receiving same in previous versions. error 29 (hy000): file 'c:/users/rkartj2/desktop/loincsunquestv2.txt' not found this may seem bit misleading newb since can go desktop , see lionsunquestv2.txt file there. i see 1 of 2 possibilities here either mysql not have permissions access file current directory or not know file on local server. you can try using load data local infile . dev.mysql if not work, need move file location mysql has access to, such mysql data directory. in version 5.6 of stock vanilla install in dir

python - my code is always printing "COMPLETED" and dont exit the while loop -

i have mapreducejob define jobid: jobid = emr.run_jobflow(name="data processing" after mapreduce job want show message "completed job" when mapreduce job status == "completed" . im trying code below, im having status like: starting starting .... running ... completed completed completed completed the problem is printing "completed" , dont exit while loop. , want exit shows message "completed job". do see issue is? status = emr.describe_jobflow(jobid) while status.state != 'completed' or status.state != 'failed': status = emr.describe_jobflow(jobid) print status.state print "job status:" + str(status.state) print "" print "completed job" while status.state != 'completed' or status.state != 'failed': this line evaluates true. when state "completed", evaluates false or true , true. when state "failed", evalua

Use dc.js seriesChart .seriesAccessor() to pick specific (not all) series -

i trying show detailed data 6 series. example http://dc-js.github.io/dc.js/examples/scatter-series.html need need small tweak. show 3 charts 2 items each. can use single rungroup example somehow limit chart.seriesaccessor() display 2 specific series in 1 chart. use same rungroup in second chart , change .seriesaccessor() use 2 different series, etc., etc. setting multiple separate dims , groups works fine seems overkill when have single crossfiltered dataset in not use single dimension , group drive different charts. (the dataset has 40 series in need display specific ones, grouped in several charts). this tufte calls "small multiple". i'm not sure adding dimensions , groups, because don't want charts affected each others' choose-series filters. and seriesaccessor function extracts subkey, doesn't have way filter. looks yet case "fake groups" . modifying scatter-series example: function filter_keys(source_group, f) {

sorting - python spark sort elements based on value -

i new python spark , need help, in advance that! so here go, have piece of script: from datetime import datetime pyspark import sparkcontext def getnormalizeddate(dateofcl): #the result in [0,1] dot=datetime.now() od=datetime.strptime("jan 01 2010", "%b %d %y") return (float((dateofcl-od).days)/float((dot-od).days)) def addition(a, b): a1=a b1=b if not type(a) float: a1=getnormalizeddate(a) if not type(b) float: b1=getnormalizeddate(b) return float(a1+b1) def debugfunction(x): print "x[0]: " + str(type(x[0])) print "x[1]: " + str(type(x[1])) + " --> " + str(x[1]) return x[1] if __name__ == '__main__': sc = sparkcontext("local", "file scores") textfile = sc.textfile("/data/spark/file.csv") #print "number of lines: " + str

laravel 5 update in database -

i created row in 'movies' table called 'slug' want store slug of titles of movies.the problem have 250 movies , don't want manually enter slug each 1 of them trying make script automatically update slugs.but failed that: this code in filmcontroller.php: class filmcontroller extends controller { public function film() { $title = db::table('movies')->select('title'); $slug = str_replace(" ","-",$title); db::table('movies')->update(array('slug' => $slug)); } } and in routes: route::get('update','filmcontroller@film'); this error pops when go localhost/update: object of class illuminate\database\query\builder not converted string can tell me how change code can put in slug field in movies title of movie '-' insted of space between words? $title object containing titles, , not string,so str_replace not work on can try using loop update eac

xsd - Add comment with type of XML element above element -

i want know if can add comment similar <!--optional:--> type of element. this actual xsd structure: <xsd:complextype name="datos_registrapago_type"> <xsd:sequence> <xsd:element name="numservicio" nillable="false" type="tns:numservicio_type" /> <xsd:element name="tipnegocio" nillable="false" type="tns:tipnegocio_type"/> <xsd:element name="mtodeudor" nillable="false" type="tns:mtodeudorstring_type"/> <xsd:element name="fecemision" nillable="false" type="tns:fecemision_type"/> </xsd:sequence> </xsd:complextype> <xsd:simpletype name="tipnegocio_type"> <xsd:annotation> <xsd:documentation>tipo negocio</xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:string&quo

osx - Deployment of multiple Jenkins slaves on a Mac -

i have read lot running multiple slaves on host machine has jenkins master running on it, however, bit confused on how move forward. want jenkins server call slaves whenever possible in order distribute workload. in case, each jenkins slave building scripts unity3d projects. have installed ubuntu vm on mac master jenkins server , know how set up. would use os on slave vm? in addition, running vm on virtualbox, best option or vm better fit job? finally, if knows how set up, possible them state how set slave on same machine server , connect both of them through ssh?

c# - LDAP connection only works on localhost -

i have login page verifies credentials active directory , redirects next page. when run locally works perfect, when put out on our webserver gives error trying create group principal: (system.directoryservices.directoryservicescomexception (0x80072020)) i need find out why work on 1 , not other. input appreciated. principalcontext ctx = new principalcontext(contexttype.domain, "domain.com"); groupprincipal grp = groupprincipal.findbyidentity(ctx, identitytype.name, "building webmasters"); userprincipal = userprincipal.findbyidentity(ctx, identitytype.samaccountname, txtusername.value); bool auth = ctx.validatecredentials(txtusername.value, txtpassword.value); bool groupauth = grp.members.contains(up); i figured out throwing error on creating user principal. changed grab group principal , contains overload can pass in username form. worked me. bool auth = ctx.validatecredentia

Building executable for android -

i trying build hello world executable android. test.c: #include <stdio.h> #include <stdlib.h> int main() { printf("hello world\n"); return 0; } my android.mk: local_path := $(call my-dir) include $(clear_vars) # give module name local_module := hello_world # list c files compile local_src_files := test.c # option build executables instead of building library android application. include $(build_executable) my application.mk: app_abi := i ran ndk-build , got 7 executables each in individual directory in libs - arm64-v8a armeabi armeabi-v7a mips mips64 x86 x86_64 when ran file command, got hello_world: elf 32-bit lsb executable, arm, eabi5 version 1 (sysv), dynamically linked (uses shared libs), stripped but when pushed adb shell , execute it, error: not executable: magic 7f45. what should working? ndk stands native development kit. term used in refer tools used interface platform independent code, eg: java, n

c - Issues with libdc1394 -

i trying images point grey firewire 1394 camera using libdc1394. here code. #include <stdio.h> #include <stdint.h> #include <dc1394/dc1394.h> #include <stdlib.h> #include <inttypes.h> #ifndef _win32 #include <unistd.h> #endif #define image_file_name "image.ppm" /*----------------------------------------------------------------------- * releases cameras , exits *-----------------------------------------------------------------------*/ void cleanup_and_exit(dc1394camera_t *camera) { dc1394_video_set_transmission(camera, dc1394_off); dc1394_capture_stop(camera); dc1394_camera_free(camera); exit(1); } int main(int argc, char *argv[]) { file* imagefile; dc1394camera_t *camera; unsigned int width, height; dc1394video_frame_t *frame=null; //dc1394featureset_t features; dc1394_t * d; dc1394camera_list_t * list; dc1394error_t err; d = dc1394_new (); if (!d) return 1; e

c# - How to test a WebApi service? -

i'm new webapi , i've been reading information don't know how start application. i had project many wfc services .net 3.5. so, updated project 4.5.1. created controller visual studio 2012 wizard. then, when controller created, see class template get, post, put, delete methods. place post method , want test service httpclient. i tried apply solution in green following forum: how post xml value web api? i'm gonna receive xml string structure of contract model. i run project visual studio development server. but have troubles url test service. i saw many pages people http://localhost:port/api/contract . don't still know how works. how can test service? path or url test service? webapi, mvc, based on routing. default route /api/{controller}/{id} (which could, of course, altered). found in ~/app_start/webapiconfig.cs file of new project, given you're migrating don't have likely. so, wire can modify application_start include: globa

VBA Outlook TypeLib.GUID "Object required" -

i'm trying run simple code in outlook 2013. it's simple copy/paste the scripting guys website . sub testguid() set typelib = createobject("scriptlet.typelib") wscript.echo typelib.guid end sub running code throws "object required" exception. typelib.guid method doesn't seem known. runs excel. why ? br, nico you need declare local variable first, example: sub testguid() dim typelib object set typelib = createobject("scriptlet.typelib") wscript.echo typelib.guid end sub

java - SignalR Android access localhost -

for reason cannot make make android app connect server (on localhost) the problem (probably) not in code,the exact same code runs fine in simple java application i invalidhttpstatuscodeexception bad request - invalid hostname http error 400. request hostname invalid. i tried using emulator ,genymotion(i changed ip http://192.168.56.1 ... ) java.util.concurrent.executionexception: microsoft.aspnet.signalr.client.transport.negotiationexception: there problem in negotiation server i exception in httpclientransport.java ,line 76 @override public signalrfuture<negotiationresponse> negotiate(final connectionbase connection) { log("start negotiation server", loglevel.information); string url = connection.geturl() + "negotiate" + transporthelper.getnegotiatequerystring(connection); request = new request(constants.http_get); get.seturl(url); get.setverb(constants.http_get); connection.preparerequest(get);

ruby - Rails check if an array exists -

sorry noobish question; started developing rails. checked through api, documentation, , did bunch of searches not find for. is there method check see if specific array exists? for example, array = [] array = [2,3,4] if array.exists? puts "array exists!" else puts "no such thing!" end thanks like so: if defined?(array) instance variables (eg @array) default nil, can test them if @array

performance - MySQL Select with Offset is Faster Than no Offset -

i've been messing around query performance system pagination make data selection fast possible, i've come across don't quite understand. knowledge, when limit offset used, mysql has iterate through each row before offset , discard them, in theory query offset of 10,000 slower 1 without, true in case select sql_no_cache * `customers` `networkid`='\func uuid()' order `datetimeadded` desc limit 0, 100; /* finishes in 2.497 seconds */ select sql_no_cache * `customers` `networkid`='\func uuid()' order `datetimeadded` desc limit 10000, 100; /* finishes in 2.702 seconds */ but, if use inner join join table userid column doing sorting , limiting, it's consistently faster offset of 10,000 without one, stumps me. example here be select sql_no_cache * `customers` inner join (select `userid` `customers` `networkid`='\func uuid()' order `datetimeadded` desc limit 100) `results` using(`userid`) /* finishes in 1.133 se

c# - WinApi and work with several domains -

i have got: asp net app , application pool in domain a several domain (a, b, c) users , password connect domains a, b, c what functions of winapi can use, members of domain groups using login , password domain? will whether function "netgroupenum" or "netlocalgroupenum" working domains b , c if app working in domain a? thanks!

React Native: How to disable scrolling in ListView? -

is possible disable scrolling of listview? i've tried noscroll : <listview noscroll={true}> </listview> but doesn't seem make difference. i think should be scrollenabled={false} http://facebook.github.io/react-native/docs/scrollview.html#props

java - JComboBox Option Selected Not Imposing Change -

in code have simple jcombobox used turn feature on or off. jcombobox code is: public static jcombobox geterrorloggingonoroff(){ string[] options = { "on", "off" }; jcombobox combo = new jcombobox(options); return combo; } the issue returns value being on regardless of when click "off." jcombobox called here: note have included system.out.println()'s (and check null) check output . string option = combo.getselecteditem().tostring(); .... if(option.equals("on")){ system.out.println("on selected"); return; } else if(option.equals("off")){ system.out.println("off selected"); return; } else { system.out.println("null value option.... :-/"); } any pointers appreciated, genuinely baffled why occurring, no doubt simple on sight. regards, reg. edit here full exerpt of code final jmenuitem enableerrorlogging = new jmenuitem("enable error logging");

ios - Facebook graph-API OAuthException Code:368 Misusing this feature by going too fast -

i try publish comments on pages photos posts using following code : nsdictionary *params = @{@"message" : @"new comment"}; fbsdkgraphrequest *request = [[fbsdkgraphrequest alloc] initwithgraphpath:[nsstring stringwithformat:@"/%@/comments", objectid] parameters:params httpmethod:@"post"]; [request startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { if(error){ nslog(@"error comment %@", [error description]); } else{ nslog(@"result comment %@", [result description]); } }]; it works (worked) when used nsdictionary *params = @{@"message" : @"new comment"}; but when tried use attachment_url parameters value error : error = { message:"(#1705) there error p

text classification - Multinomial Naive Bayes Classifier sliding window (MOA implementation, weka) -

i facing following problem: trying implement mnb classifier in sliding window. implemented linkedlist of size of window , store instances of stream have considered in it. when new instance arrives doesn't fit in window anymore first instance removed. remove corresponding word counts implemented following method same trainoninstanceimpl() moa backwards: private void removeinstance(instance insttoremove) { int classindex = insttoremove.classindex(); int classvalue = (int) insttoremove.value(classindex); double w = insttoremove.weight(); m_probofclass[classvalue] -= w; m_classtotals[classvalue] -= w * totalsize(insttoremove); double total = m_classtotals[classvalue]; (int = 0; < insttoremove.numvalues(); i++) { int index = insttoremove.index(i); if (index != classindex && !insttoremove.ismissing(i)) { double laplacecorrection = 0.0; if (m_wordtotalforclass[classvalue].getvalue(index) == w*instt

presentation - How to put a big centered "Thank You" in a LaTeX slide -

Image
i want "thank you" displayed @ center of slide in latex big font size. i this: \begin{frame}{} \centering \large \emph{fin} \end{frame} if want larger, try 1 of \large , \huge , or \huge . here sample of how looks montpellier theme in orchid colour theme.

What's the easiest way to check nuget package platforms? -

i know name of nuget package in official nuget gallery. how can check on platforms it's avaibale, e.g full .net, silverlight, windows store apps, universal platform, etc..? on windows use nuget package explorer download nuget package , show contents. frameworks supports shown in lib directory inside nuget package. you can download nuget package nuget , unzip it.

matlab - Plotting arrays from a cell list of strings -

suppose have different rows loaded .mat file (using load filename.mat ) containing float numbers following same naming convention, e.g: file_3try = [ 2.4, 5.2, 7.8 ] file_4try = [ 8.7, 2.5, 4,2 ] file_5try = [ 11.2, 9.11 ] to plot of these in 1 plot using automation (i have many more rows in example above) created cell containing names of arrays using: name{l} = sprintf('%s%02i%s','file_',num,'try'); inside loop num numbers in names , l counter starting 1. but when try plot arrays using example: plot(name{1}) i error: error using plot invalid first data argument is there way solve this, or going wrong? there built in solve this data = load ( 'filename' ); % load data , store in struct fnames = fieldnames ( data ); ii=1:length(fnames) plot ( axhandle, data.(fnames{ii}) ); end axhandle handle axes want plot on. not required practice use it. if not provided plot command plot on current axes, e.g. gca .

Need help on CAS authentication with Spring integration -

i deleting content problem facing solved. you need change per follow: <bean name="authenticationfilter" class="org.jasig.cas.client.authentication.authenticationfilter"> <property name="casserverloginurl" value="https://localhost:8443/cas/login"></property> <property name="renew" value="false"></property> <property name="gateway" value="false"></property> <property name="service" value="https://my.local.service.com/cas-client"></property> </bean>

android - Incorrect package imports -

i trying automated ui testing, followed this , strange thing observed google code snippet shows different package imports mine. like uiobject class, google imported this android.support.test.uiautomator.uiobject however, in code com.android.uiautomator.core.uiobject which results unidentified method.i have no idea, doing wrong, please me. my build.gradle apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "23.0.0 rc1" defaultconfig { applicationid "example.com.automatinguitestingsample" minsdkversion 19 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar'])

c# - MSpec Json.NET deserialization test fails in ReSharper but passes in NCrunch -

i have following 2 unit tests: 1 using mstest , 1 using machine specifications. far can see should behave identically. however, while first 1 passes in both ncrunch , resharper test runners, second 1 fails in resharper. using machine.specifications; using microsoft.visualstudio.testtools.unittesting; using newtonsoft.json; public class testmodel { public string name { get; set; } public int number { get; set; } } // mstest [testclass] public class deserializationtest { [testmethod] public void deserialized_object_is_the_same_type_as_the_original() { testmodel testmodel = new testmodel() {name = "john", number = 42}; string serialized = jsonconvert.serializeobject(testmodel, new jsonserializersettings { typenamehandling = typenamehandling.objects }); object deserialized = jsonconvert.deserializeobject(serialized, new jsonserializersettings { typenamehandling = typenamehandling.objects }); // passes in both test runn

c# - Binding error when binding CollectionViewSource to custom ItemsSource -

i have written control having issues binding collectionviewsource itemssource property. if bind observablecollection itemssource property works expected. collectionviewsource bound following binding error in output. error: converter failed convert value of type 'windows.ui.xaml.data.icollectionview' type 'ibindableiterable'; bindingexpression: path='jobview.view' dataitem='app.viewmodel.mainviewmodel'; target element myspecialcontrol.myspecialcontrol' (name='null'); target property 'itemssource' (type 'ibindableiterable'). public sealed class myspecialcontrol: control { public ienumerable itemssource { { return (ienumerable)getvalue(itemssourceproperty); } set { setvalue(itemssourceproperty, value); } } public static readonly dependencyproperty itemssourceproperty = dependencyproperty.register("itemssource", typeof(ienumerable), typeof(myspecialcontrol), new propertym

php - Magento 1.8.0.0 - Worldpay payment response receiving 301 error -

good morning, i have been handed magento site functions fine, callback integration between worldpay , magento seems fail. e-mails sent me stating server responding 301 error (i believe redirection error). the url worldpay posting http://www.[ourdomain].com/worldpay/processing/response/ however understand worldpay not allow this? used work fine until recently. have orders payment status's "pending" though have been successful. can provide advice? if wondering, fixed upgrading installation 1.8.0.0 latest magento 1.9.1.1 security patches.

c++ - dhcp client failure in latest version -

to configure dhcp ipv6 in application using below mentioned command. same command getting executed in dhcp version 4.2.5-p1 . application has dhclient version 4.3.0. , command cause failure execution. can 1 guide me on this? difference there in both version? dhclient -6 -pf /var/run/udhcpc6.eth0.pid eth0 -e hostname:"ubuntu" -nw

How would I print out certain values of an Array with booleans in Java? -

i made program prints out manipulated arrays, reprint values in pass[i] array has length equal 7 java seems reprint entire set. guessing doing wrong handling of booleans... string[] pass = new string[cnt]; int[] range = new int[cnt]; int[] arr = new int[cnt]; boolean valid; (int = 0; < cnt; i++) { pass[i] = afname[i] + asname[i]; if (pass[i].length() == 7) { system.out.println(pass[i]); valid = true; } else { valid = false; if ((7 - pass[i].length()) >= 3) { range[i] = (int) math.pow(10, (7 - pass[i].length())) - 100; system.out.println(pass[i] + range[i]); } else { if ((7 - pass[i].length()) == 2) { range[i] = 99; system.out.println(pass[i] + range[i]); } else { range[i] = 9; system.out.println(pass[i] + range[i]); } } } } if(valid){ for(int i=0; i<cnt; i++){ system.out.

tsql - What All Should I do If I find a deadlock occurring in SQL server 2012? Are there a set of rules/steps I can follow to come out of it -

i identified couple of update statements on large partitioned table deadlock victims extended events. how should proceed fixing this? this table doesn't have index. using uniqueidentifier (refguid) in clause of both these update statements. sql server execution plan suggesting create non clustered index on column. prevent/alleviate deadlocks? thanks in advance. solution alleviated deadlocks in case. created non clustered index on column being checked in clause. column being used in partition function not used in clause , hence not useful. if deadlocks because there update , select statements same table @ same time, should first focus on getting both update , select statements touch small amount of pages possible. easy way started run statements using "set statistics io on" , see number of logical reads (or writes, lot smaller). lower i/o, less deadlock happen. if there's several different columns in clause, should try focus on column(s) have highe

ruby - Strange results with model scope -

i have following scope on model. class programmeinstance < activerecord::base # more code scope :published, -> { where(published: true) } scope :order_by_start_date, -> { order(:start_date) } scope :future_with_offset, -> { where("start_date >= ?", date.today - 7.days) } scope :upcoming_with_offset, -> { future_with_offset.published.order_by_start_date } # more code end i used scope query list returned rails programme_instances.upcoming_with_offset this returns empty result set. however, if make call contents of scope instead of scope so programme_instances.future_with_offset.published.order_by_start_date i results returned. there must don't know scopes. can explain why? thanks. class programmeinstance < activerecord::base scope :future_with_offset, -> { where(condition) } scope :published, -> { where(published: true) } scope :order_by_start_date, order('start_date') end you can call i

javascript - sort list divs doesn't work -

i have sort multiple divs (which have "alldiv" class) according text in class "employe-name". multiple divs inside dive have "teamtablecontainer" id. i got text sore according "asc" , when click on icon "desc" sort must done , vice versa×¥ the js code use is: $('.formemployee .sort-arrow').click(function(){ if ($('.formemployee .sort-arrow').hasclass('down')) { $('.alldiv').sort(function(a,b) { $('.formemployee .sort-arrow').removeclass('down') $('.formemployee .sort-arrow').addclass('up') console.log($(b).find('.employe-name').text().touppercase()) return $(b).find('.employe-name').text().touppercase() >$(a).find('.employe-name').text().touppercase(); }).each(function( _, alldiv){ $(alldiv).appendto('#teamtablecontainer'

python - Authentication failed in Django test -

in django tried create user , tried login user using selenium , when run test failed , showing authentication error. here code : class loginfunctionaltest(unittest.testcase): def setup(self): self.browser = webdriver.firefox() self.browser.implicitly_wait(3) # self.browser.get('http://localhost:8000') def teardown(self): self.browser.quit() def test_login_page(self): self.browser.get('http://localhost:8000') self.assertin('hiren->login', self.browser.title) def test_login_form(self): self.browser.get('http://localhost:8000') user = user.objects.create_user('testhiren', 'myemail@test.com', 'testpass') user.save() username = self.browser.find_element_by_id('username-id') password = self.browser.find_element_by_id('password-id') submit = self.browser.find_element_by_id('login-button')

amazon web services - Why japanese file names throwing exception with php Aws sdk -

i'm uploading files remote using aws s3 sdk, when uploading files japanese names sdk throwing exception , stops working.. fatal error: uncaught exception 'guzzle\service\exception\commandtransferexception' message 'errors during multi transfer (aws\s3\exception\invaliduriexception) .\aws\common\exception\namespaceexceptionfactory.php line 91 i can't find fix, please appreciated..

Gradle How can i specify the cacheResolutionStrategy for the SNAPSHOT version in my buildscript block? -

i having problems resolutionstrategy.cachechangingmodulesfor. my project build.gradle looks similar this apply plugin: 'base' apply plugin: 'maven' apply plugin: 'maven-publish' apply from: "gradle/mixins/cachestrategy.gradle" configurations.all { resolutionstrategy.cachedynamicversionsfor 5, 'minutes' resolutionstrategy.cachechangingmodulesfor 0, 'seconds' } buildscript { repositories { maven { url artifactoryurl } } dependencies { classpath (group: 'com.myorg', name: 'acustomplugin', version: '1.5.0-snapshot') { changing = true } } } allprojects { apply plugin: 'base' apply plugin: 'com.myorg.acustomplugin' } my question is: how can specify cacheresolutionstrategy snapshot version in buildscript block? specifying outside block, doesn't work ( since buildscript block evaluated first, in order build scripts... ) cache strategy

wordpress - Node.js Express not rendering html view -

so trying follow tutorial use node.js front end of wordpress site this 1 http://www.1001.io/improve-wordpress-with-nodejs/ here code server.js var frnt = require('frnt'); var fs = require("fs"); var path = require("path"); var express = require('express'); var app = express(); var dot = require('express-dot'); // define public files are, in example ./public app.use(express.static(path.join(__dirname, 'public'))); // make sure set before frnt middleware, otherwise won't // able create custom routes. app.use(app.router); // setup frnt middleware link internal server app.use(frnt.init({ proxyurl: "http://localhost:8888/frnt-example/wordpress", // link wordpress site layout: false // simplify example not using layouts })); // define rendering engine app.set('views', path.join(__dirname, "views")); app.set('view engine', 'html' ); app.engine('html', dot.__express

c# - Converting datetime from UICulture -

i have sql db various datetime fields stored in pst time zone. users multiple regions across world use db display data. i need able convert sql db datetimes specific settings, hope system.threading.thread.currentthread.currentuiculture . my question is, how convert datetime current user's locale in c# using currentuiculture variable. maybe tostring? datetime date=new datetime(); var str = date.tostring(system.threading.thread.currentthread.currentculture);

php - Inserting Wordpress Post via External Script -

i'm trying insert bulk posts via external php script: <?php require_once '/full/path/to/wp-load.php'; require_once abspath . '/wp-admin/includes/taxonomy.php'; $title = "some post title"; $content = "some content"; $tags= "tag1,tag2,tag3"; $user_id = 1; // create post object $my_post = array( 'post_title' => $title, 'post_content' => $content, 'post_status' => 'publish', 'post_author' => $user_id, 'post_type' => 'post', 'tags_input' => $tags, ); $id = wp_insert_post($my_post,true); ?> $id returns 0 , wp_error empty. post inserted db right title , content without tags. fails use wp_insert_terms() insert tags or other custom taxonomies. did miss file include or there didn't set right work functions properly? you don't need load taxonomy.php.. functionality handled wp-load.php also sugg

c# - Don't split the string if contains in double marks -

i have text delimeted file need convert datatable. given text : name,contact,email,date of birth,address john,01212121,hehe@yahoo.com,1/12/1987,"mawar rd, shah alam, selangor" jackson,01223323,haha@yahoo.com,1/4/1967,"neelofa rd, sepang, selangor" david,0151212,hoho@yahoo.com,3/5/1956,"nora danish rd, klang, selangor" and how read text file in c# datatable table = new datatable(); using (streamreader sr = new streamreader(path)) { #region text csv while (!sr.endofstream) { string[] line = sr.readline().split(','); //table.rows.add(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]); if (isrowheader)//is user want read first row header { foreach (string column in

pygtk - Python Gtk3: "mark-set" signal of a Gtk.Textbuffer -

i trying understand strange behaviour of mark-set signal emitted gtk.textbuffer in python program. in fact signal emitted (in case) multiple times single user action. sounds not logical me , didn't find reference in documentation. well, reference find unresolved question on website. the question i'm talking one: gtk3 python, textview rising multiple 'mark-set' signals i'm trying same code in question , same result. has idea what's going wrong? thank clue or piece of advice. ps: gtk3 used. i've tried run under both linux , osx , got same behavior. change test function to: def test (buffer, location, mark, user_data=none): print(mark.get_name()) so can see names of marks, marks builtin in buffer gtk

xml - maven-jar-plugin includes vs excludes -

i've got existing pom file includes maven-jar-plugin section. runs test-jar goal , excluding few directories: <excludes> <exclude>...</exclude> <exclude>...</exclude> <exclude>somedir/**</exclude> </excludes> i need include file in somedir directory leave out rest of files in somedir directory. i've read includes have precedence on excludes added following (there no includes section before): <includes> <include>somedir/somefile.xml</include> </includes> this ends creating jar file test few files in (just stuff in meta-inf). file included not in jar either. i'd expect jar identical jar created before includes change 1 additional file. what missing here? first, if don't specify includes , maven jar plugin use **/** default pattern (see o.a.m.p.j.abstractjarmojo ) i.e. include everything. if override default pattern, plugin include tell him include. second,

ruby on rails - unable to install java gem for jruby -

i need install java gem jruby package. below error gives me. c:\users\abcd>jruby -v jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on java hotspot(tm) 64-bit server vm 1.8.0_31-b13 +jit [windows 7-amd64] c:\users\abcd>jgem install java io/console not supported; tty not manipulated error: error installing java: java requires ruby version >= 2.1.0. from irb console when require 'java' gives me 'false' always if @ https://github.com/vanruby/java/blob/master/java.gemspec you'll see ruby version must >= 2.1.0 this same error got. jruby 1.7.19 has 2 modes: 1.8 , 1.9 modes. if want ruby modes >= 2.x, need move jruby-9k, not yet released pre-2 version available tests: http://jruby.org/2015/04/28/jruby-9-0-0-0-pre2.html jruby 9k pre2 has ruby mode 2.2.2 , installation work nicely: jruby -v jruby 9.0.0.0.pre2 (2.2.2) 2015-04-28 2755ae0 java hotspot(tm) 64-bit server vm 25.45-b02 on 1.8.0_45-b14 +jit [windows

c# - unable to convert uploaded image to byte array -

i trying convert uploaded image byte array can store in database table. the code below used perform conversion image byte array: public byte[] converttobytes(httppostedfilebase image) { binaryreader reader = new binaryreader(image.inputstream); var imagebytes = reader.readbytes((int)image.contentlength); return imagebytes; } when place breakpoints on code see being returned imagebytes variable displays {byte[0]}. the code shown below receiving actionresult in controller view using upload image (currently using file input select , upload image): [httppost] public actionresult newsmanager(newsmanagerviewmodel model) { var newsmanagerrepository = new newsmanagerrepository(); var currentuser = user.identity.name; if (modelstate.isvalid) { httppostedfilebase file = request.files["imagedata"]; var fileisimage = file.isimage(); if (fileisimage) { model.author = currentuser; var n