Posts

Showing posts from January, 2010

python - Seq2seq model tensorflow -

i'm working on tensorflow project , trying use seq2seq model given in tutorials. problem is, doesn't seem work. removed errors myself don't know why 1 not seem remove. i'm working on python 3.5.2 tensorflow 1.2.1 code follows. (can followed on github in tensorflow tutorials) https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py (couldn't post here due exceeding number of lines. sorry that) the error is: attributeerror: 'bool' object has no attribute 'output_size' and pointing line 761 is if output_size none: output_size = cell.output_size does know error is? thanks

html - Scale an SVG element using a transform origin -

<html lang="en-us"> <head> <link rel="stylesheet" href="https://codepen.io/basement/pen/oepkxy.css"> </head> <body> <iframe src="https://s.codepen.io/basement/debug/zdpvyv/pnavylzmjrqr"></iframe> <div class="wrp"> <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="100" height="100" class="canvas" > <defs> <style type="text/css"> polygon { fill: none; stroke-width: 0.5; stroke: #f00; } </style> </defs> <g transform="translate( 0 12.5 ) scale( 1 )"> <polygon points=" 75,6.7 75,93.3 0,50 "

17 characthers Facebook user id gets stored with a different value in MYSQL using Facebook php SDK v2.10 -

$user = $response->getgraphuser(); $fid = $user['id']; echo($fid); //10155784607879101 //in mysql table 2147483647 in fid column following query $stmt = $dbh->prepare("insert users(fid) values (:fid)"); $stmt->bindparam(':fid', $fid); $stmt->execute(); //in case $fid not equals $stmt->bindparam(':fid', $fid); i read in facebook developers documentation: id numeric string id of person's user account. id unique each app , cannot used across different apps. our upgrade guide provides more information app-specific ids core i cannot identify users when return on site , login using facebook. has suggestion? thanks in advance, adam to store facebook id number need field unsigned bigint. however, facebook lists data type of id string , should store alphanumeric type avoid breaking app in future (thanks cbroe pointing out).

vsts - Visual Studio Team Service build UWP app for x64 error -

i tried build uwp app on visual studio team service (visual studio 2017 host) , got missing reference vcmeta.dll error error c1108: unable find dll: 'vcmeta.dll' when building x64 version of app. due project or due version of vs2017 on vsts?

java - Bad status returned from Mockito test -

i test example method controller @getmapping("/checkusernameatregistering") public httpentity<boolean> checkusernameatregistering(@requestparam string username) { return responseentity.ok().body(!userservice.existsbyusername(username)); } which returns status ok. i created test in mockito public class checkuserdatarestcontrollertest { @mock private userservice userservice; @injectmocks private checkuserdatarestcontroller checkuserdatarestcontroller; private mockmvc mockmvc; @before public void setup() { mockitoannotations.initmocks(this); mockmvc = mockmvcbuilders.standalonesetup(checkuserdatarestcontroller).build(); } @test public void testcheckusernameatregistering() throws exception { mockmvc .perform(get("/checkusernameatregistering") .param("username", "jonki97")) .andexpect(status().isok()); } } i expect status ok. know makes no sense, want test done corre

c - Converting Functions Windows API -

just need help, wondering how convert following heapalloc rtlcreateheap. code is #define thing2 1048 byte *firstheap; firstheap= heapalloc(getprocessheap(), 0, sizeof(thing2)); //do stuff firstheap heapfree(getprocessheap(), 0, firstheap); writefile ntwritefile handle handletofile = null; dword oflen; dword zeroed = 0; writefile(handletofile, firstheap, oflen, &zeroed, null); //do other stuff closehandle(handletofile); i doing own personal education. appreciated. thanks!

php - Showing units sold in product page OpenCartv3 -

i'm trying show units sold each product in product page in opencart v3 keep getting following error fatal error: uncaught error: call member function getunitssold() on null in /applications/xampp/xamppfiles/htdocs/store/catalog/controller/product/product.php:157 stack trace: #0 /applications/xampp/xamppfiles/htdocs/store/system/engine/action.php(79): controllerproductproduct->index() #1 /applications/xampp/xamppfiles/htdocs/store/catalog/controller/startup/router.php(25): action->execute(object(registry)) #2 /applications/xampp/xamppfiles/htdocs/store/system/engine/action.php(79): controllerstartuprouter->index() #3 /applications/xampp/xamppfiles/htdocs/store/system/engine/router.php(67): action->execute(object(registry)) #4 /applications/xampp/xamppfiles/htdocs/store/system/engine/router.php(56): router->execute(object(action)) #5 /applications/xampp/xamppfiles/htdocs/store/system/framework.php(168): router->dispatch(object(

android - React native notifications -

i working on react-native project (using crna) , point want develop push notifications various features. have suggestions on library should use. i've been told typically rather difficult , running light-weight out of box solution great. btw, using expo dev environment. thanks! if using expo think push-notifications configured . otherwise suggest using react-native-fcm . it's easy implement, works fine in project both android , ios. tried other libraries 1 worked me.

multithreading - How to use java multi-threading properly? -

i many examples in internet there same: public class test extends thread { public synchronized void run() { (int = 0; <= 10; i++) { system.out.println("i::"+i); } } public static void main(string[] args) { test obj = new test(); thread t1 = new thread(obj); thread t2 = new thread(obj); thread t3 = new thread(obj); t1.start(); t2.start(); t3.start(); } } so why call same task (in run() method) 3 times different threads? e.g. if want upload file, why call 3 times? assume if need multithreading then: thread t1 task1, e.g.: - update database info thread t2 task2, e.g.: - upload file server thread t3 task3, e.g.: - bring message user is there example work described above. you can create multiple threads code given below start thread , don't need call multiple times same method. can see, once started, 3 child threads share cpu. notice call slee

r - Short code to extract fitted value from tbl_df objects -

i have data set containing groups of data , performed regression on on each group of data. used dplyr regression , tbl_df object results. want extract fitted value vector each group of regression , put them in data frame. used use summarise() extract relevant information conveniently. works scalars. here sample code lapply used extract information , feel kind of cumbersome: library(dplyr) library(reshape2) df1 = data.frame(type1 = c(rep('a',5),rep('b',5)), x = 1:10, y = 11:20) df1 %>% group_by(type1) %>% do(model = lm(y~x,.)) -> model1 names(model1$model) = model1$type1 lapply(model1$model,function(mod) mod$fit) %>% melt library(broom) model1 %>% augment(model) # tibble: 10 x 10 # groups: type1 [2] type1 y x .fitted .se.fit .resid .hat .sigma .cooksd .std.resid <fctr> <int> <int> <dbl> <dbl> <dbl> <dbl>

html - Not writing (or even opening file) in php -

i read many of other questions on site revolving around error, none of able me, below php code takes data input html file , sends php file, after printing "hello name" on page, should open file called my_file.txt, created, , write it, have been unable so, great, here code: index.html file: <html> <head><title>hello friend</title></head> <body bgcolor="black"> <p style="text-align:center"> <font color="white"> <form action="data.php" method="post"> <input type="text" name="myname" id="myname"> <input type="submit" value="submit"> </form> </body> </html> data.php file: <html> <head> <title>hello friend, php</title> </head> <body bgcolor="black"> <font color="white"> <code> <?php $name = $_post["myna

c# - VSTS build task fails on a .NetFramework4.6.1 project references .NetStandard2.0 -

⚠️ created issue in dotnet/standard 🚨 question has been updated simplified code reference may reproduce on own environment. (screenshots of vsts settings available in readme file) a .net framework 4.6.1 project references .netstandard2.0 (not preview) project visual studio 2017 update 3 (not preview, visualstudio.15.release/15.3.0+26730.3) so far working fine in local environment. when run build on visual studio team services throws error/s below error message [error]src\ninja.dojo\fight.cs(18,19): error cs0012: type 'iserviceprovider' defined in assembly not referenced. must add reference assembly 'netstandard, version=2.0.0.0, culture=neutral, publickeytoken=cc7b13ffcd2ddd51'. projects libraries .net standard 2 projects create nuget file upon build. host .net framework 4.6.1 project references libraries 1st project. build log vsts 2017-08-18t14:59:35.5041535z ##[section]starting: build solution **\*.sln 2017-08-18t14:59:

automation - Error in python script, written using pexpect modul -

i wrote script in python using pexpect module, used run installer , find text , press enter, when run script, exits without errors, messages , no results. please see script below: import pexpect rt ='/opt/installer/setup.bin -i console' child = pexpect.spawn(rt, cwd=os.path.dirname(rt)) child.expect("press <enter> continue:") print(child.before) can me solve mystery, highly appreciated.

dds - OpenDDS - DCPSInfoRepo is killed but the publisher and subscriber are communicating -

i'm exercising opendds dcps examples opendds-3.11/examples/dcps/introductiontoopendds on ubuntu 16 . per aaa_readme.txt found in same location, first started dcpsinforepo opendds-3.11/bin/dcpsinforepo -orbendpoint iiop://localhost:12345 followed subscriber , publisher respectively. i publisher publishing , subscriber receiving subscribed topics. understand dcpsinforepo creates repo.ior contain participant's entry. but if kill dcpsinforepo , see publisher , subscriber continue communicate not add participant dcpsinforepo not running. i know why publisher , subscriber continue communicate in absence of dcpsinforepo . don't need dcpsinforepo server after participants added? please clarify. the dcpsinforepo used discovery, @ moment publishers/subscribers know of each other keep communicating without dcpsinforepo. i recommend use rtps discovery coming dds standard. removes need dcpsinforepo (which single point of failure).

image - PHP EXIF Manipulation -

i working on image upload website, trying ensure works mobile device well.however have been looking @ of metadata being stored in photos , not fan of gps locations going along simple photos. i decided create new photo using: html: <form id="frmimageupload" action="uploadim.php" method="post" enctype="multipart/form-data"> <label for="filetoupload">file::</label><br> <input type="file" name="filetoupload" id="filetoupload"><br> <input type="submit" value="submit" name="submit" onclick=" return validatedata(**this returns true , submits form**)"> uploadim.php php: <?php $imageobject = imagecreatefromjpeg($_files["filetoupload"]["tmp_name"]); imagejpeg($imageobject, $target_file, 75); ?> all works point , image created. there no more exif data. gps info gone, great. orientation value

ionic2 - Photo Viewer not working -

.html <img *ngif=new.preview_image1 src="{{new.preview_image1}}" (click)="zoomimage(new)"/> ionic document( ionic documentation ) show me, src="path" , data form service, if use src="{{new.preview_image1}}" error showing. .ts zoomimage(imagedata) { this.photoviewer.show(imagedata); } i try use this, when build in ios device when click image, loading no responing. change (click)="zoomimage(new)" (click)="zoomimage(new.preview_image1)" . <img *ngif=new.preview_image1 [src]="new.preview_image1" (click)="zoomimage(new.preview_image1)"/>

java - Server client application in javafx hanging at uncertain point in time -

following code of controller of javafx file of client , main.java of server. program hang @ different time intervals , not sure why or start. if 1 of in way, highly appreciated. ******controller.java***: public class controller { private static socket socket; @fxml public textarea text_area1; bufferedreader br; bufferedwriter bw; stage stage1; @fxml textfield friends_id; @fxml textfield user_text; @fxml textfield login_user_id; @fxml textfield register_user_id; @fxml passwordfield register_user_pass; @fxml passwordfield confirm_pass; @fxml passwordfield login_user_password; public void logtheuser(actionevent e) { if (socket == null) makeconnectiontoserver(); system.out.println("log in pressed"); senddatatoserver("login"); senddatatoserver(login_user_id.gettext()); senddatatoserver(login_user_password.gettext()); i

php - Laravel 5.4 Auth Change table for all Auth processes -

i have created custom login (not using default laravel auth) business design forced reason need adjust. there way auth procedures (checking session, login, logout, etc..) table? google research points me config/auth.php change table value there when opened it, there no 'table' value in config added manually 'table' => 'user_admin', ..unfortunately, nothing has changed. session checking still checks in users table. thanks inputs. go to config/auth.php /* |-------------------------------------------------------------------------- | user providers |-------------------------------------------------------------------------- | | authentication drivers have user provider. defines how | users retrieved out of database or other storage | mechanisms used application persist user's data. | | if have multiple user tables or models may configure multiple | sources represent each model / table. these sources may | assigned authentication

javascript - only new records using firebase -

i´m using firebase list of messages. problem need see messages sent after opened page. don´t need store messages in database need broadcast connected devices. ref.limittolast(1).on('child_added', function(snapshot) { console.log(snapshot.name(), snapshot.val()); }); the code above returns last child correctly i´m filling database messages don´t need. when right time delete "old" messages? i don't recommend delete old messages, instead of makes every user take care of reading new. if data structure messages working need add 1 attribute model. each time message sent add timestamp in attribute. here doc how use servervalue.timestamp . now every message node can ordered timestamp. "messages": { "chat_1": { "push_key_usually":{ "message": "hello", "owner": "maybe uid or email", "chat_key": "chat_1", "

c++ - SCardTransmit returns error 0x000005aa -

i trying connect , send command smart card through windows smart card api , below code have msdn. here scardtransmit function returns me 0x000005aa , can 1 let me know doing wrong. int _tmain(int argc, _tchar* argv[]) { scardcontext hcontext; long lreturn; scardhandle hcardhandle; dword dwap; const dword buf_len = 512; dword dwrecv; byte pbrecv[buf_len]; byte sendcommand[]={0x00,0x0a4,0x00,0x00,0x02,0x3f,0x00}; lreturn = scardestablishcontext(scard_scope_user, null,null,&hcontext); if ( scard_s_success != lreturn ) { printf("failed scardestablishcontext\n"); scardreleasecontext(hcontext); return 0; } lreturn = scardconnect( hcontext, "omnikey cardman 3x21 0", scard_share_shared, scard_protocol_t0 | scard_protocol_t1, &hcardhandle, &dwap ); if ( scard_s_success != lreturn ) { printf("failed scardconnect\n"); scardreleasecontext(hcontext); return 0; } switch ( dwap ) { case sca

Laravel upload - Any address must be copied and not? -

i have made website @ localhost , hosting. need edit code. upload hosting. not need upload addresses there no changes. example: vendor, maybe storage. need copy addresses address , not copy address? this basic laravel .gitignore ommit vendor , storage. ### laravel ### vendor/ node_modules/ npm-debug.log # laravel 4 specific bootstrap/compiled.php app/storage/ # laravel 5 & lumen specific public/storage public/hot storage/*.key .env.*.php .env.php .env homestead.yaml homestead.json # rocketeer php task runner , deployment package. https://github.com/rocketeers/rocketeer .rocketeer/ the vendor folder updated when call composer update / install . editing files bad practice. storage use related user data, system logs... daily usage data. so don't need them both on code host since aren't neccesary deploy app

c# - Custom location for custom Project template with extension in VS 2017 -

i in process of upgrading extension vs 2015 vs 2017. according upgrading custom project templates , have changed how custom project templates handled in vs 2017. i rather confused @ present. let me explain how our extension worked in vs 2015, explain i've tried in upgrade. our extension internal use technical consultants of our company. loads bits , pieces of calculations database , puts source files. these source files loaded c# solution can compiled , debugged technical consultant , adjusted/rewritten , saved db necessary. the extension has tool window, tool window allows connect database, when database connection established, solution created , source files (made form bits , pieces) loaded. so our template blank class library project receives these source files. let's call calctemplate.zip. calctemplate.zip included in extension project, added file. cstemplatepath = soln.getprojecttemplate("calctemplate.zip", "csharp"); // create

How to hide html source & disable right click and text copy? -

the following website has both right click , view source disabled. http://www.immihelp.com/visitor-visa/sponsor-documents.html can shine light on how possible? the following website has both right click , view source disabled. they fooled you. scroll down in view-source. furthermore, employing such tactics marks unprofessional. don’t it.

android - when to use the relative layout and constrain layout with real time example -

could please me out letting me know when use relative layout , when use constrain layout example in android. first need know why constraintlayout introduced later in android sdk. why constraintlayout introduced? using relative , other layouts, need create hierarchy of different views. these hierarchy can long multiple nested view groups. when android renders layout, views rendered going level below in nested layouts. more levels, requires more time. so according android documentation, constraintlayout allows create large , complex layouts flat view hierarchy (no nested view groups). which can take lesses time other nested views. what difference between constraintlayout , relativelayout ? constraintlayout similar relativelayout in views laid out according relationships between sibling views , parent layout, it's more flexible relativelayout. when choose layout? if screen has design such can using no nested relativelayout, use relative or else

Apache httpd version for Red Hat Enterprise Linux 4 -

can suggest appropriate version apache httpd rhel 4 ? know not supported rhel anymore application demands version. so, leads highly appreciated. if you're going stick rhel 4 or of downstream rebuilds centos 4, have 2 choices: use version of httpd package came os, 2.0.52. despite name, apache. build whatever you'd prefer use source. assuming build current version , keep date, better security, resulting combination can't said "rhel 4" more, may bother application demands rhel 4.

Adding interactive legend in d3.js for vijuly weighted tree -

i new d3,this may seem silly question using d3 . trying implement http://vizuly.io/product/weighted-tree/ . trying make interactive legend filters tree when legend clicked. not able figure out tree data structure ,how pass viz object in legend ,how make filtering work. i want collapse nodes except 1 legend have clicked. function onclicklegend(g,d){ // filtering or collapsing node , corresponding branches legend clicked switch(d) { case 0: viz.togglenode(data.values[0]); break; case 1: viz.togglenode(data.values[1]); break; case 2: viz.togglenode(data.values[2]); break; case 3: viz.togglenode(data.values[3]); break; case 4: viz.togglenode(data.values[4]); break; case 5: viz.togglenode(data.values[5]); break; case 6: viz.togglenode(data.values[6]); break; case 7: viz.togglenode(data.values[7]); break; case 8: viz.togglenode(data.values[8]); break; case 9: viz.togglenode(

wordpress - WC_Order does not return the product id by get_items() -

this question has answer here: order items , wc_order_item_product object in woocommerce 3 2 answers i have tried product id , product name following code: if ( $query->have_posts() ) { $order_id = $query->posts[0]->id; $order = new wc_order( $order_id ); $items = $order->get_items(); } foreach ( $items $item ) { $product_id = $item['product_id']; $product = wc_get_product( $item_id ); $product_name = $item['name']; } in above code got product name, return 0 $product_id. there other method this? i can't find solution this. my edited version: when tried this: $order_id = $query->posts[0]->id; $order = new wc_order( $order_id ); $items = $order->get_items(); foreach ( $items $item ) { $item_id = $item['product_id']; $product_name = $item['name'];

python - How to fix this? RuntimeError: dictionary changed size during iteration -

when added item dictionary in a function, it's giving error: inv = { "rope": 1, "torch": 6, "gold coin": 42, "dagger": 1, "arrow": 12 } dragonloot = ['gold coin', 'dagger', 'gold coin', 'gold coin', 'ruby'] def addinventory(invloop, lst): item in lst: k,v in invloop.items(): if item == k: v += 1 else: invloop[item] = 1 return(invloop) inv = addinventory(inv, dragonloot) indeed should not add items inventory while looping on it. what's more, don't need inner loop, because advantage of dictionary have direct access via keys: can test whether has key or not in operator. so instead: def addinventory(invloop, lst): item in lst: if item in invloop: invloop[item] += 1 else: invloop[item] = 1 return(invloop)

prediction - How can I use machine learning to predict temperature from the simple data set of temperature -

i storing cpu temperature in database (after every 10 sec - huge data set) , want predict temperature of device , want prediction accurate on time normal condition such anomaly can detected. i relatively new machine learning, please direct soul :-d

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

python - CSV to Django models Date format in Django Models -

Image
in models.py from_date = models.datefield(auto_now=false,auto_now_add=false) to_date = models.datefield(auto_now=false,auto_now_add=false) my csv has in views.py im inserting data csv reader = csv.dictreader(csvf) row in reader: csv.objects.create(from_date=row['from'],to_date=row['to']) django throwing me error,"the date should must in yyyy-mm-dd format." there way change date format in django models directly out django model forms ? the error message clear, should change eg: 01/05/17 2017-05-01 def format_date(date): date = date.split('/')[0] month = date.split('/')[1] year = date.split('/')[2] return '20%s-%s-%s' % (year, month, date) # eg: '2017-05-01' reader = csv.dictreader(csvf) row in reader: _from = format_date(row['from']) _to = format_date(row['to']) csv.objects.create(from_date=_from, to_date=_to)

node.js - How add keyword Nullable (or allowNull) into Ajv? -

i wrote following code. var ajv = new require('ajv'); ajv.addkeyword('allownull', { type: 'null', metaschema: { type: 'boolean' }, compile: function(allownullenable, parentschema) { return function(data, datapath, parentdata) { if (allownullenable) { return true; } else { if (parentschema.type == 'null') { return true; } else { return data === null ? false : true; } } } } }); var schema = { type: "object", properties: { file: { type: "string", allownull: true } } }; var data = { file: null }; console.log(ajv.validate(schema, data)) // expected true but not work. how write such validator? even if compile function returns true, still not pass validation. the code can tested in node-sandbox: https://runki

machine learning - Convolutional GAN with MNIST data not converging -

i have been working on trying convolutional gan working on mnist data (which should easiest thing in world) reason having convergence issues. if discriminator , generator connected nns have no problem in convergence, when try , change these functions use conv. nets of sudden bad convergence issues (discriminator driven 0 rapidly, generator tends infinity). i cannot life of me figure out going wrong @ moment, wondering if on here me pinpoint issue (and if see else wrong don't hesitate - let me know anyway). here code discriminator , generator: ################## discriminator ################### tf.name_scope("weights_discriminator"): d_w1 = tf.get_variable(initializer = xavier_init([2, 2, 1, 128]),name='d_w1') d_w2 = tf.get_variable(initializer = xavier_init([2,2, 128,256]),name='d_w2') d_w3 = tf.get_variable(initializer = xavier_init([7*7*256,1]),name='d_w3') theta_d = [d_w1, d_w2, d_w3] # stuff optimised def discri