Posts

Showing posts from January, 2012

r - How to put the actual data points on the contour plot with ggplot? -

Image
the code below produces contour plot using ggplot. xgrid <- seq(min(mtcars$wt), max(mtcars$wt), 0.3) ygrid <- seq(min(mtcars$hp), max(mtcars$hp), 0.3) data.fit <- expand.grid(wt = xgrid, hp = ygrid) data.loess <- loess(qsec ~ wt * hp, data = mtcars) mtrx3d <- predict(data.loess, newdata = data.fit) mtrx3d[1:4, 1:4] require(reshape) mtrx.melt <- melt(mtrx3d, id.vars = c("wt", "hp"), measure.vars = "qsec") names(mtrx.melt) <- c("wt", "hp", "qsec") require(stringr) mtrx.melt$wt <- as.numeric(str_sub(mtrx.melt$wt, str_locate(mtrx.melt$wt, "=")[1,1] + 1)) mtrx.melt$hp <- as.numeric(str_sub(mtrx.melt$hp, str_locate(mtrx.melt$hp, "=")[1,1] + 1)) ggplot(mtrx.melt, aes(x = wt, y = hp, z = qsec)) + stat_contour() i wonder how show acutal data points contour lines. have tried ggplot(mtrx.melt, aes(x = wt, y = hp, z = qsec)) + stat_contour() + geom_point(mtrx.melt, ae

android - how to re decorate recyclerView items below an item that is removed -

i have decorator added recyclerview, , on initial load , when orientation changes decorator works great. when remove item want redecorate based on new positions of items after delete not working. i have tried adding new decorators, failed; now i thought calling on recyclerview force re draw: executing code background not change. @override public void onitemrangechanged(int positionstart, int itemcount) { super.onitemrangechanged(positionstart, itemcount); log.e(tag, "range start: " + positionstart + " count: " + itemcount ); runnable pendingremovalrunnable = new runnable() { @override public void run() { mrecyclerview.invalidateitemdecorations(); log.d(tag, "run"); } }; pendingremovalrunnable.run(); } }); this decorator code: @override public void getitemoffsets(rect outre

Longest and Shortest word in a file C programming -

hello , evening, so i'm writing program in c, accept file.txt input , read text. program should read text file, find longest , shortest word within file, , print them out when reaches end. i'm close i'm getting seg fault and, not not know why, i'm @ loss how fix it. here's code: #include <stdio.h> #include <string.h> file *fp; char str[60]; char *largest; char *smallest; char *word; int i, j; int main (int argc, char **argv) { // check there 2 arguments if (argc == 2) { fp = fopen(argv[1], "r"); } // if not throw error else { perror("argument error."); return (-1); } // check if file exists if (fp == null) { perror("error opening file."); return (-1); } // set largest first string , smallest second largest = strcpy(largest, strtok(str, " ")); smallest = strcpy(smallest, strtok(null, " ")); word = strcpy(word, strtok(str, " ")); // while lines of file whil

hive - Parquet creation Conversion from pandas dataframe to pyarrow table not working for object dtype -

i want create parquet file csv file. test purposes, i've below piece of code reads file , converts same pandas dataframe first , pyarrow table. table stored on aws s3 , want run hive query on table. inputfile contents: year|word 2017|word 1 2018|word 2 code: dataframe=pd.read_csv(inputfile, sep='|') print(dataframe) print(dataframe.dtypes) print(dataframe.columns) dataframe['c1'] = dataframe['c1'].astype('str') print(dataframe.dtypes) table=pa.table.from_pandas(dataframe)#,schema=pa.string()) pq.write_table(table, outputfile) after writing pyarrow table, queried parquet file make sure data stored in s3. results weird: +--------+--------------+ | year | word | +--------+--------------+ | 2017 | [b@60716d4f | | 2018 | [b@36bf8f00 | +--------+--------------+ somehow int values show fine, object/str value doesn't converted fine. appreciate this. thanks. this replicated fine me roundtripping. please speci

sprite kit - At what point will "draws" start slowing down your frame rate? -

Image
i have spritekit game have created, , have been trying improve frame rate while (currently drops down around 45). have been checking number of "draws" have has been recommended me. doing setting variable showsdrawcount true when present scene. currently, scene has 55 draws. will slow down frame rate? if how many draws there need to start slowing down frame rate? , how should decrease draws? in advance. edit: have fixed part of problem moving draw functions scenedidload didmovetoview , has reduced draws to by way thing taking majority of draws (18 believe) this: note: phone testing on iphone 5s, , has powervr series 6 gpu

php - Need help ! cant log in in phpMyAdmin, i Just installed Error #2002 -

hi install phpmyadmin , im having issues, have been looking lot of threads , nothing work me out. 2002 - php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known — server not responding (or local server's socket not correctly configured). mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known mysqli_real_connect(): (hy000/2002): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known. this 3 errors appear when im trying log in phpmyadmin. this config.inc.php : /* server: localhost [1] */ $i++; $cfg['servers'][$i]['verbose'] = ''; $cfg['servers'][$i]['host'] = ’localhost’; $cfg['servers'][$i]['port'] = ‘’; $cfg['servers'][$i]['socket'] = ''; $cfg['servers'][$i]['auth_type'] = 'cookie'; $cfg['servers'][$i]['

caching - Is it safe to delete Fabric contents in ~/Library/Caches in iOS APP -

there're 2 folders in ~/library/caches in our ios app: com.crashlytics.data io.fabric.sdk.ios.data it seems they're used fabric? i want add feature delete contents in caches folder, , i'm wondering if it's safe delete these 2 folders? if delete 2 folders when app running, happen if there're crashes in app? crash reports still sent fabric? any advice appreciated. todd fabric here. not safe delete these programmatically contain our crash report data. folder library/caches/com.crashlytics.data/ crashes uploaded when app relaunches. thanks!

osx - Mac OS Sierra 10.12.4 GDB debugger -

i curious whether gdb works @ on mac os sierra 10.12.4. know there fixes mac os sierra 10.12.3 here: gdb os x sierra 10.12.3 not working any ideas on how gdb working on 10.12.4 appreciated. thanks it has been recommended must use lldb mac os. avoid using gdb mac. debug activities can lldb.

node.js - how to use pug-bootstrap module in nodejs? -

i installed pug-bootstrap module in nodejs project. trying create menu navbar. i have done files: layout.pug: include /node_modules/pug-bootstrap/_bootstrap.pug index.pug: extends layout block head +navbar("menu") +nav_item("#", undefined, true) string test block body h1= title p welcome #{title} the _bootstrap.pug contains bootstrap css file : https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css . not loaded on webpage. someone know why? , how fix that? any appreciate. when extend part of template block , you're replacing code in block, before. in case, assume head included reference css file, you're overwriting. generally speaking, use append instead of block head section (see this page docs). way, previous content of parent templates not overwritten. in usecase, doubtful whether should placing @ in head block, since reserved meta-tags, not actual visible content. in other words: you&

javascript - Building an API -

i've built api delivers live data @ once when user submits search content. i'd take api next level delivering api content user content received instead of waiting of data received before displaying. how 1 go this? easiest way in django using django endless pagination

jquery - Thumbnail from video using javascript, converting to dataurl showing solid white image -

i trying capture thumbnail using following js function. canvas drawing image correctly canvas.todataurl() giving solid white image "data:image/png;base64,ivborw0kggoaaaansuheugaaaoaaaafocayaaadhmkpraaadleleqvr4no3bmqeaaadcopvpbqwfoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

c - unsigned char[], bits or bytes? -

i'm writing kind of protocol transmit nrf24 module so, procotol declared this: unsigned char protocol[16]; that protocol have 16bits or 16bytes size? 16 bytes. 1 char 1 byte on systems.

angular - nginx or apache how to serve content from /subfolder no matter what url you are at -

i have frontend app, written in angular, hosted @ http://localhost/subfolder/myapp when go app, redirects route1, url appears as: http://localhost/subfolder/myapp/route1 but when refresh browser, 404 not found error. think that's because there no physical index.html in /subfolder/myapp/route1 , /subfolder/myapp/route1 not physical folder. so wrote rewrite rule rewrite ^/subfolder/myapp/.+$ /subfolder/myapp last; but since when go http://localhost/subfolder/myapp redirected http://localhost/subfolder/myapp/route1 , , rule redirecting me http://localhost/subfolder/myapp , in infinite redirect state (too many redirect problem) what can in nginx solve problem? or apache? figured out: location /subfolder/myapp/ { try_files $uri /subfolder/myapp/index.html; } location /subfolder2/myapp/ { try_files $uri /subfolder2/myapp/index.html; }

javascript - Phantom Bottom Border Around Script -

Image
i trying find source of bottom border in small personal website. have processing sketch in background i'm trying stretch full size of page. want body element render top bottom. this issue: i made html background garish yellow high-visibility. i have div holding sketch absolute positioning no margin , no padding. inspect element doesn't reveal space coming , i've tested in ff , in safari. here page: my personal page (http://asperw.me) my research on question turns results top margins had collapsed or there random top padding i'm sure neither of culprit. thank you. edit: should mention don't think problem sketch height of equal height of body element. can right-click , view image , doesn't have bottom border there.

How to Disable OK button when there is a text change in Editbox in MFC -

how disable ok button when there text change in editbox control? when following code used,it results in exception begin_message_map(lockinginfo, cdialog) //{{afx_msg_map(lockinginfo) on_en_change(idc_info,onenchangeedit1) //}}afx_msg_map end_message_map() void lockinginfo::onenchangeedit1() { getdlgitem(idok)->enablewindow(false); } and exception is: "access violation reading location..." in line assert(::iswindow(m_hwnd) || (m_pctrlsite != null)); of function cwnd::enablewindow(bool benable) in winnocc.cpp thanks in advance

amazon web services - I want to access AWS-IoT accounts from a common AWS Lambda -

i connecting aws iot things via rest apis using end points aws lambda. want make dynamic, i.e. each different user requesting alexa, want request apis of corresponding aws-iot account. assuming there different aws-iot account each user, every user can have thing named water pump. i can making 1 lambda per user. want common lambda function yes, can , should use single, common lambda of users. each user has unique id created amazon when yoour skill installed on device. each request send lambda contain userid skill can save user's preferences, state, etc.: { "version": "string", "session": { "new": true, "sessionid": "string", "application": { "applicationid": "string" }, "attributes": { "string": {} }, "user": { "userid": "string", ... refer alexa documentation understand e

Translit xor crypting c++ to php -

i want translit xor crypting c++ php. use function crypting. want decrypt file php. wchar_t* encryptdecrypt(const wchar_t* toencrypt, int length, wchar_t* ebkey) { const wchar_t* key = ebkey; wchar_t* output = new wchar_t[length]; (int = 0; < length; i++) { output[i] = toencrypt[i] ^ key[i % wcslen(key)]; } return output; } i read xls file binary , crypt encryptdecrypt void encryptandsave(char *src,ansistring key) { wchar_t *content; wchar_t buffer[255]; wchar_t *result; long size; long fsize; file *f=null; f=fopen(src,"rb+"); fseek(f, 0, seek_end); size = ftell(f); fseek(f,0, seek_set); content = (wchar_t *) malloc(size * sizeof (wchar_t)); fread(content, size, 1, f); fclose(f); content=encryptdecrypt(content,size,strtowchar_t(key)); f=fopen(src,"wb+"); fwrite(content, size, 1, f); fclose(f); } i use function convertion key in wchar_t wchar_t*

java - How can I ensure correct padding in DES encryption? -

i trying implement basic diffie-hellman protocol , code succeeds point when needs decrypt sent value using des. have looked @ lot of examples in matter of keys not matching up, printing values on both ends of connection , both same. have tried multiple padding schemes changing how keys generated. my last attempt in adding parameter ivparameterspec cipher init, solved 1 of errors. i running on single machine socket connecting on localhost , have been checking issues on either side sent data not matching received data, nothing altered in sending. did notice, however, when printing each of byte arrays on either side of socket client side longer server appears padding(?) the error getting saying final block padded incorrectly , decryption fails my server code (the side not working intended): public static void main(string[] args) { serversocket welcomesocket = null; // creates connectable socket on port 6789 try { welcomesocket = new serversocket(6789);

Is there any way to move individual entity from one server to another in Master data services? -

i have master data model entity , deployed on production server. have created 2 more new entity in development server , wanted move these 2 entity. if has idea please share me. ! you have 2 options. web-app(easiest): on dev server, go system administration. click on deployment , create package. deploy package going on production server, follow same steps, choose deploy instead of create under 'deployment' button. the alternative use mdsmodeldeploy.exe. can find on server going appropriate folder. it's in path: c:\program files\microsoft sql server\130\master data services\configuration. recommend use method, have more control. can choose deploy data, or without or clone model. can read more here ([ https://docs.microsoft.com/en-us/sql/master-data-services/deploy-a-model-deployment-package-by-using-mdsmodeldeploy][1] ) i can recommend consider modelpackageeditor when model starts getting big. have control on need deploy, in entities, views, business rules

javascript - Gigya Socialize ShareBar API get provider name on click providers -

Image
i using gigya socialize sharebar api in project. want provider name on provider click in sharing popup. i can't use onsenddone function ref in project. there callback provider name on click it? here gigya documention link: http://developers.gigya.com/display/gd/socialize.showsharebarui+js you can use onsharebuttonclicked event name of provider. note not work native login buttons (google/facebook on mobile) if doing on web should need. attaching working example (requires gigya api key on page). // create div widget (or use existing div on page) var newsharediv = document.createelement('div'); newsharediv.id='sharediv'; newsharediv.setattribute('style', 'position: absolute; z-index: 1000; margin: 0px auto; margin-top: 10px !important; width: 200px; height: 20px; background-color: yellow; border: 2 px solid red;') document.body.appendchild(newsharediv); // // create useraction sharing var gigyashareaction = new gigya.socialize.user

java - Source not found,Edit Look up path and now debug is running into exception after clearing first two issues -

please check issue completely,as there many solutions problem,but none worked out. but stepping new problems.i messed issue few days,which not clearing. initially,i got source not found issue fixed using answers in so,after got edit path,even got fixed , attached source rt.jar.which shown in source not found. 1 more thing when fetching request browser working fine,only when getting request ionic app or other client issue rising. without clue code stepping exception. , clueless,any appreciated. logincontroller public void contextinitialized(servletcontextevent arg0) { httpserver server; try { server = httpserver.create(new inetsocketaddress(5558), 0); myhandler handler = new myhandler(); server.createcontext("/", handler); server.setexecutor(null); server.start(); system.out.println("server up.!!!"); } catch (ioexception e) { system.out.println("problem starting server.!!!"+e);

android - Edittext.settext() Don't show text in onActivityResult() -

i trying add text in edittext on activityresult , doesn't work. here have done: private view getnumber() { layoutinflater inflater = layoutinflater.from(getbasecontext()); viewnumber = inflater.inflate(r.layout.stepper_layout, null, false); number_edittext = (appcompatedittext) viewnumber.findviewbyid(r.id.pic_edittext_number); relativelayout numberpickerlayout = (relativelayout) viewnumber.findviewbyid(r.id.numberpickerlayout); relativelayout pic_number = (relativelayout) viewnumber.findviewbyid(r.id.pic_number); button numbernext = (button) viewnumber.findviewbyid(r.id.numbernext); numberpickerlayout.setvisibility(view.visible); pic_number.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent contactpickerintent = new intent(intent.action_pick, contactscontract.commondatakinds.phone.content_uri);

java - How to access classes and methods of vb.net native dll file from jna or other library -

what have a) have used jna library. b) dll vb.net native dll file. c) can check link more dll link my source code following interface package com.dll.lib; import com.sun.jna.library; import com.sun.jna.native; public interface browsecontrol extends library { browsecontrol instance = (browsecontrol)native.loadlibrary("vertex fxboapi10.5.9", browsecontrol.class); } class package com.dll.main; import com.dll.lib.browsecontrol; public class maintest { public static void main(string[] args) { browsecontrol control=browsecontrol.instance; system.out.println("brwoser: "+control.getclass()); } } } this code working. what want a) how access classes , method dll in java programming language? b) how reference {vertexfx backoffice api} dll, define object of type cvertexfxboapi class, after call methods object.setlogininfo , object.login thanks yo can use native code shared library via jni.

python - tensorflow map_fn TensorArray has inconsistent shapes -

i playing around map_fn function, , noticed outputs tensorarray, should mean capable of outputting "jagged" tensors (where tensors on inside have different first dimensions. i tried see in action code: import tensorflow tf import numpy np num_arrays = 1000 max_length = 1000 lengths = tf.placeholder(tf.int32) tarray = tf.map_fn(lambda x: tf.random_normal((x,),0,1),lengths,dtype=tf.float32) #should return tensorarray # starttensor = tf.random_normal(((tf.reduce_sum(lengths)),),0,1) # tarray = tf.tensorarray(tf.float32,num_arrays) # tarray = tarray.split(starttensor,lengths) # outarray = tarray.concat() tf.session() sess: outputarray,l = sess.run([tarray,lengths],feed_dict={lengths:np.random.randint(max_length,size=(num_arrays))}) print outputarray.shape, l however got error: "tensorarray has inconsistent shapes. index 0 has shape: [259] index 1 has shape: [773]" this of course comes surprise me since under impression tensorarrays should ab

php - how to properly use the like system twitter style button -

Image
i created system user can post of user.. data inserted db. problem dont have idea on how stay button if user post.. cause happen when user post , refresh page button refresh/back unlike this looks default icon of button gray. when user hover button runs animation , when user hit should turn red. since when user hit button run reload page button returns gray.. think im missing dont have idea how it..... css .coracao{ background: url("https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png"); height: 50px; width: 50px; background-size: 2900%; background-position: left center; top: -30px; left: 0px; position:absolute; } .coracao.ativo{ background: url("https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png"); height: 50px; width: 50px; background-size: 2900%; background-position: right center; top: -30px; left: 0px; position:absolute; animation: none 0s !important; -moz-animation: none 0s !important;

visual studio - Label text not displaying correctly -

private sub btnfind_click(sender object, e eventargs) handles btnfind.click lblnumber.text = "" strlttrinput = inputbox("please enter letter or phrase:", "find corrresponding number letter(s)") strlttrinput .tolower() .trim() end intphraseindx = strlttrinput.length - 1 dim strword(intphraseindx) string dim stroutput string = string.empty intcount = 0 intphraseindx strword(intcount) = strlttrinput.substring(intcount) next intcount = 0 intphraseindx select case strword(intcount) case "a", "b", "c" lblnumber.text = lblnumber.text & "2" case "d", "e", "f" lblnumber.text = lblnumber.text & "3" case "g", "h", "i" lblnumber.text = lblnumber.text & "4" case "

java - String cannot be converted to char, how to fix it? -

Image
it says "incompatible types: string cannot converted char" how fix it? here example. this solution : public class newmain { public static void main(string args[]) throws parseexception { scanner s = new scanner(system.in); char yes; { system.out.println("hi"); yes = s.next().charat(0); } while (yes == 'y'); // if u enter 'y' continue } } to exit enter thing other 'y'

autohotkey - AHK Grepping an Array from Text File -

i wrote ahk script prompts user input through inputbox, navigates through text file based on user input line line , copy output clipboard. example: if "4max" given userinput, should copy output "sleep" clipboard. if "3ben" given userinput, should copy output "jog" clipboard. sample text file : max:eat:drink:sleep:play jerry:eat:play:drink:jog laura:drink:eat:sleep:play ben:sleep:jog:eat:drink can please enhance below script? also when run script blank notepad open, pasting current item in clipboard notepad. :(. script: #singleinstance, force #include c:\users\mpechett\desktop\ahk\tf.ahk inputbox, searchtext, search name x = %searchtext% regexmatch(x, "(\d*)(\w*)", y) searchtext:= % y2 ptext = % tf_find("c:\users\mpechett\desktop\ahk\test.txt", "","", searchtext, 1, 1) stringsplit, word_array, ptext, :, . ;msgbox % word_array%y1% clipboard = % word_array%y1% msgbox, %clipboard%

Laravel Error: MethodNotAllowedHttpException in RouteCollection.php line 233 -

route::post('posts/delete/{id}', 'postcontroller@destroy'); error: methodnotallowedhttpexception in routecollection.php line 233 change this: route::delete('posts/delete/{id}', 'postcontroller@destroy');

inheritance - python calling a super class method in a subclass method with arguments=None -

i want create class called shoppingcart method remove_item(self, item_name, quantity, price). i want create subclass shop of superclass shoppingcart , in shop class, override remove_item method, such calling shop's remove_item no arguments decrements quantity one. class shoppingcart(object): def __init__(self): self.total = 0 self.items = {} def add_item(self, item_name, quantity, price): self.total += price * quantity self.items[item_name] = quantity def remove_item(self, item_name, quantity, price): if quantity> self.items[item_name]: quantity = self.items[item_name] del self.items[item_name] else: new_quantity = self.items[item_name] - quantity self.items[item_name] = new_quantity self.total-=quantity*price def checkout(self, cash_paid): if cash_paid < self.total: return "cash paid not enough" balance = cash_paid - self.total return ba

Forward responce to servlet from jsp -

i using google oauth web application. when logging in returns state , code , redirects index.jsp same page. my index.jsp <body style="background-color: #ffa;"> <div class="container" style="width: 100%;"> <div class="row"> <div class="col-md-6"> <h3> integrationez<br /> <span style="color:#808080;"><i>we make "integrations" easy</i></span> </h3> </div> <div align="right" class="col-md-6"><br> <% /* * googleauthhelper handles heavy lifting, , contains "secrets" * required constructing google login url. */ final googleauthhelper helper = new googleauthhelper(); if (request.getparameter("code") == null || request.getparameter(&

Defined Spark Permanent UDF which can see in metastore but can not use in hive SQL on Spark -

create function hello 'com.dtstack.main.udf.helloudf' using jar 'hdfs:///172.16.1.151:9000/user/spark/sparkudf.jar' and used select hello(xcval) xctable error: org.apache.spark.sql.analysisexception: undefined function: 'hello'. function neither registered temporary function nor permanent function registered in database 'default'.; line 1 pos 7 can me? for creating permanent function in hive, need have jar placed on hive.auxiliary.path. hive.auxiliary.path default location hive read udf, if jar file not available on location won't able access it. because when create function, hive know's location of jar "hdfs:///172.16.1.151:9000/user/spark/sparkudf.jar" make available spark have deploy on auxiliary path because once hive session closes, hive stores definition of function not location , location go auxiliary path. for more information around udf deployment please have @ https://www.cloudera.com/docum

python - Neural Network not learning for any value of momentum, learning rate etc -

i'm building neural network play noughts , crosses (tic-tac-toe). takes in board configuration (e.g. [0, -1, 1, 1, 0, 1, 0, 0, -1] -1 opponent , 1 itself) , outputs optimum move on board, e.g. [0, 0, 0, 0, 0, 1, 0, 0, 0]. i'm doing demonstration on backpropagation in few days, need nn able @ least draw. however, doesn't appear willing learn. rate of error decrease slows down extremely quickly, sticking @ same error. run training 10,000 times, seems happen regardless of iterations. the higher learning rate (i've tried 0.01, 0.05, 0.1, 0.5, 0.9, 2), lower error gets stuck at, output still not related @ desired output. changing momentum (i've tried 0.01, 0.1, 0.5, 0.9) makes absolutely no difference change in rate of error or correctness of output. changing number of hidden nodes (i've tried 4, 5, 9, 10) same above: no change. class network(object) : def __init__(self, input, desired, hiddennodes) : self.input = input self.desired = desired

php - How can I maintain multiple open queries? -

i have php file needs use sql. in sql multiple results , use here while($stmt->fetch()){} loop inside need use sql. can accomplished or need store result of first sql query , after closing can open new sql query. here's code: function compute_production($local_id, $gameid) { global $mysqli, $m, $q; $sql = "select `x`, `y`, `building`, `tier` `god_battlefields` `owner`=? , `game_id`=?"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("ii", $local_id, $gameid); $stmt->execute(); $stmt->bind_result($x, $y, $building, $tier); while($stmt->fetch()) { $ab_triggered = array(); foreach(tech_get_value($building, "abilities") $ability_name => $required_tier) { if ($tier >= $required_tier) { switch($ability_name) { case "auto_production": $ab_triggered[$ability_name]

How to get webview's title instantly in android -

after couple hours researched. found out can webview's title in 2 ways, onpagefinished , onloadresource . however, if use webview.gettitle() in onpagefinished , title not fast enough. use onloadresource . it's fast, dont know when see log, request webview's title many time. can let me know how prevent this? i'm mean, how can shop request webview title when got @ first time.

python - ImportError: No module named 'scrapy' -

i new python using 3.6 on windows. i have installed scrapy using anaconda: > c:\users\user.name>conda install scrapy fetching package metadata > ............. solving package specifications: . > > # requested packages installed. > # packages in environment @ c:\users\user.name\appdata\local\continuum\anaconda3: > # scrapy 1.3.3 py36_0 however, when try import n python ide get: importerror: no module named 'scrapy' i tried pip confirmed requirements satisfied. have searched answer , think may because have installed 1 interpreter/environment , trying use in another. although, not sure if correct, or how tackle it. first time have used anaconda (previously i'd been using pycharm , pip) i'm going spend time today getting grips it, appreciate if able point me in right direction! try create new virtual environment in conda , install scrapy there, , don't forget activate environment. i

javascript - Jquery display "yes" when a file has been uploaded from an input -

i display in "yes" id if file loaded input type file (warning when file selected automatically saved without clicking send) my input <div class="customizationuploadbrowseimg"> <input type="file" name="file{$field.id_customization_field}" id="img{$customizationfield}" class="file_upload form-control customization_block_input {if isset($pictures.$key)}filled{/if}"/> </div> the id or message must appear <li> <strong>- couverture personnalisée :</strong> <span id="is_covert_show"></span> </li> thanks

mysql - Datatables response 500 error internal server when return from multiple tables -

Image
i error when use search box i have joined tables query $query = loginquarter::join('wholesalers','login_quarter.username','=','wholesalers.user_id') ->select('wholesalers.id wholesaler_id','wholesalers.name name', 'login_quarter.quarter','login_quarter.years', 'login_quarter.target', 'login_quarter.updated_at'); and return function i not error if comment in line wholesaler_id (line 82) , name (line 83). how can display these without error?

amazon web services - DynamoDB scan error with ComparisonOperator CONTAINS in python -

i'm using pynamodb access dynamodb. work except scan comparison contains in setstring. code: class dynamoentity(model): class meta: table_name = 'entity_record' region = 'us-east-1' read_capacity_units = 1 write_capacity_units = 1 doc_id = unicodeattribute(hash_key=true) topics = unicodesetattribute(null=true) def scan_by_topics(topics, **filters): return dynamoentity.scan(topics__contains=topics, **filters) _topics = ['aa', 'bb', 'cc', 'dd', 'ee'] _ in range(10): add_record(random.choice(_topics) + '_id', topics=set([random.choice(_topics)])) t in _topics: query_by_topics(t) and got this: one or more parameter values invalid: comparisonoperator contains not valid ss attributevalue type i try in boto3 got same issue: client = boto3.client('dynamodb') response = client.scan( tablename="entity_record", scanfilter=

sql - ibm db2: insert strings into database in anonymous block -

i trying insert string data db2 table anonymous pl/sql block. what works; set sqlcompat plsql; begin ... set id_city = 0; set city = chr(39) || 'berlin' || chr(39); set country_id = 83; set revname = chr(39) || 'create-script' || chr(39); set revcreator = chr(39) || 'create-script' || chr(39); set statement = 'insert fk_city (id_city, city, country_id, is_europe, revname, revdate, revfirst, last_visit, revcreator ) values ( ' || id_city || ', ' || city ||', ' || country_id || ', true, ' || revname || ', current date, current date, current date, ' || revcreator || ' )'; execute immediate statement; ... end my question : there way insert table oneliner? example: execute immediate "insert fk_city (id_city, city, country_id, is_europe, revname, revdate, revfirst, last_visit, revcreator ) values ( 0, 'berlin', 83, true, 'create-script', current date, current date, current date, 'cre

linux - How to split data into two new record in Unix? -

i have data need separate record 2 new record. sample data this: id country place 1 mall park 2 b beach 3 c hotel resort 4 d museum 5 e garden i want data become this: id country place 1 mall 1 park 2 b beach 3 c hotel 3 c resort 4 d museum 5 e garden the data tab delimited. tried using sed , awk , can't correct syntax. there other command can use can have desired output? awk -v ofs="\t" ' fnr==1{ # read first line max=nf # save no of fields print # print header next # go next line } nf>max{ # if no of fields greater max fields split($0,fd) # split record fields sep, , store in array fd

CakePHP 3 - Make a copy of bin/cake executable? -

i wonder if there way make copy of bin/cake , name bin/cake.live run in production? when did that, error comes up: exception: shell class "cake.live" not found. in [/home/bravier/builderslink-invoice.staging2.abweb.com.au/vendor/cakephp/cakephp/src/console/shelldispatcher.php, line 324]

How to make a POST call to bamboo server using OAuth -

i had application links in bamboo.also have access token bamboo. stuck no go. my params: headers = { "accept" : "application/x-www-form-urlencoded", "authorization": "bearer "+access_token['oauth_token'], "data" : '{"name":"kalav"}' } data: data = '{"name":"kalav"}' my post call: response=requests.request("post",callurl+"?access_token="+access_token['oauth_token'],data=data,headers=headers) print ("got status: %s" %(response.status_code)); print ("got text: %s" %(response.text)); am doing correct ..or there way of doing it.

wordpress - Cannot use $this as parameter in contact-form.php -

i trying run wordpress using xampp theme 'total' themeforest. it says fatal error: cannot use $this parameter in /applications/xampp/xamppfiles/htdocs/wp-content/themes/total/framework/3rd-party/contact-form-7.php on line 38 i referred this link , other websites outside of stack overflow too. the code contact-form-7.php follows, <?php /** * contat form 7 configuration class * * @package total wordpress theme * @subpackage 3rd party * @version 3.6.0 */ if ( ! class_exists( 'wpex_contact_form_7' ) ) { class wpex_contact_form_7 { /** * start things * * @version 3.6.0 */ public function __construct() { // remove css - theme adds styles add_filter( 'wpcf7_load_css', '__return_false' ); // remove js add_filter( 'wpcf7_load_js', '__return_false' ); // conditionally load js add_action( '

detecting bluetooth headset call button press in android -

i developing calling app. need pick/hangup call bluetooth device . can not key press event bluetooth headset. have tried broadcast , audio manager getting play/pause, pre , next button callbacks . public class mediabuttonintentreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if (intent.action_media_button.equals(intent.getaction())) { keyevent event = (keyevent) intent .getparcelableextra(intent.extra_key_event); if (event == null) { return; } if (event.getaction() == keyevent.action_down) { //context.sendbroadcast(new intent(intents.action_player_pause)); } } } } menifest is <receiver android:name=".net.mediabuttonintentreceiver"> <intent-filter> <action android:name="android.intent.action.media_button" /> </intent-filter> </receiver> i need event whe

php - Symfony, how can I make the credential from an in_memory provider private in a public code base? -

i setup symfony project use credential in_memory provider: providers: in_memory: memory: users: user1: password: password1 roles: 'role1' now code application going released on github , want keep credentials private. is there way load configurations different (non-versioned) file? i'm looking solution allows me edit code little possible and, if possible, avoid changing security provider used. you can define password parameter in security.yml : providers: in_memory: memory: users: user1: password: "%your_parameter_key%" roles: 'role1' in parameters.yml : parameters: your_parameter_key: your_secret_password usually, parameters.yml should ignored git.

xaml - C# - UWP: Load different view in one base views -

i software developer student , schoolproject searching solution loading different views in base view. got uwp application, runs on raspberry pi. application need te navigatie between 2 users (regular- , expert user). so question? how switch between 2 users, without reload views(pages)? views cannot refresh because content real-time , has run when switch between user views. it c# uwp application. have files: baseview.xaml (this (main)view want load aview or bview) aview.xaml bview.xaml maby can me it? thanks. you can place contentpresenter baseview. wrap aview , bview data templates. can use converter select template contentpresenter shows. <page> <page.resources> <datatemplate x:key="aviewtemplate"> <views:aview /> </datatemplate> <datatemplate x:key="bviewtemplate"> <views:bview /> </datatemplate> <conv:modetotempl

python - ImportError when starting django server on centos -

i have installed python virtualenv , django on virtual private server running on centos 6.5. assigned python version 2.7 alias python command ( because have python 2.6.6 installed previously ). then run: django-admin startproject mysite cd mysite after django creates new project, try run web-server typing python2 manage.py runserver 0.0.0.0:8000 when try connect website shows me err_connection_time_out error in browser. have checked whether firewall blocking port or not, doesn't. when type python manage.py runserver 0.0.0.0:8000 (difference previous call call python, not python2) it shows me output: traceback (most recent call last): file "manage.py", line 8, in <module> django.core.management import execute_from_command_line importerror: no module named django.core.management what solution problem?