Posts

Tensorflow Incompatable Shapes Error in Tutorial -

i've been trying create convolutional network tensorflow tutorial , i've been having trouble. reason, i'm getting errors size of y_conv 4x larger size of y_, , have no idea why. found this question , appears different problem mine, though looks similar. to clear, batch size in below code 50, error it's coming is tensorflow.python.framework.errors.invalidargumenterror: incompatible shapes: [200] vs. [50] and when change batch size 10, get tensorflow.python.framework.errors.invalidargumenterror: incompatible shapes: [40] vs. [10] so it's related batch size somehow, can't figure out. can tell me what's wrong code? it's pretty straight tutorial linked above. from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('mnist_data', one_hot=true) import tensorflow tf sess = tf.interactivesession() def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.var...

Pass javascript variables into PHP use AJAX -

i have 1 javascript variable , want pass php file. search , find use ajax don't know how use ! here code . wrong ? .js file : var message1 = message.message; var jq = document.createelement('script'); jq.src = "https://code.jquery.com/jquery-1.10.2.js"; document.queryselector('head').appendchild(jq); $(document).ready(function() { $.ajax({ type: "post", url: 'http://localhost/a.php', data: { newmessages : message1 }, success: function(data) { alert("success!"); } }); }); my a.php file : <?php if(isset($_post['newmessages'])) { $uid = $_post['newmessages']; echo $uid; } ?> listen onload event of asynchronously loa...

javascript - Are AWS server-side TemporaryCredentials usable for client-side S3 upload? -

using client-side version of aws javascript sdk v2.2.29 (e.g. bower aws-sdk-js ) possible (though unacceptable because exposes real aws credentials client): var region = 'us-east-1', accesskeyid = 'az12341234', secretaccesskey = 'abcde1fghij2klmnopqr3tuvwx4yz'; var creds = new aws.credentials(accesskeyid, secretaccesskey); creds.get(function() { s3location = new aws.s3({ region: my.region, credentials: creds }); ready(); // presents upload form, binds events, etc.. }); the dream split process 2 parts, 1 secure server-side , following client-side. part 1. use nodejs server-side version of aws javascript sdk (e.g. aws-sdk ) this: var creds = new aws.temporarycredentials(accesskeyid, secretaccesskey); creds.get(function() { var aws = { accesskeyid: creds.accesskeyid, sessiontoken: creds.sessiontoken, region: my.region, }; // e.g. makes aws var available client res.render('form', { aws: aws })...

How should I go about finding a string within two chars in c++? -

hello been trying find way of finding string of characters within 2 characters. how should go doing in c++? sdfgkjr$joeisawesome$sdfeids -> joeisawesome edit: other answer looking if string exist within string. i'm looking string within 2 characters , outputting sting within 2 chars. thank looking pox. okay, when 2 characters, i'm assuming referring delimiters. in case have use string.find() find position of delimiters. after finding positions of delimiters, can can use string.substr(index1,index2-index1) return substring. example: #include <iostream> #include <string> int main() { std::size_t index1,index2; std::string mystring = "sdfgkjr$joeisawesome$sdfeids"; std::string sub= ""; index1 = mystring.find('$'); //string::npos -1 if unaware if(index1!=std::string::npos&& index1<mystring.length()-1) index2=mystring.find('$',index1+1); if(index2!=std::string:...

javascript - Linking to specific twitter bootstrap tabs from URL on same page -

i'm javascript noob , i'm wondering how implement answer question? twitter bootstrap tabs: go specific tab on page reload or hyperlink i want use code on same page tabs located.... <script type="text/javascript"> // javascript enable link tab var url = document.location.tostring(); if (url.match('#')) { $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ; } // change hash page-reload $('.nav-tabs a').on('shown', function (e) { window.location.hash = e.target.hash; }) </script> where inside page containing tabs should plugg in. again, sorry being such noob. try wrapping code in $(document).ready() function $(document).ready(function() { //your code here... }); what have above won't work dom won't ready when runs. using $(document).ready() function delay execution until dom has loaded. can go pretty anywhere in pa...

elixir - Ecto association to more than one schemes -

let's have these schemas: defmodule sample.post use ecto.schema schema "post" field :title has_many :comments, sample.comment end end defmodule sample.user use ecto.schema schema "user" field :name has_many :comments, sample.comment end end defmodule sample.comment use ecto.schema schema "comment" field :text belongs_to :post, sample.post belongs_to :user, sample.user end end my questions how can use ecto.build_assoc save comment? iex> post = repo.get(post, 13) %post{id: 13, title: "foo"} iex> comment = ecto.build_assoc(post, :comments) %comment{id: nil, post_id: 13, user_id: nil} so far it's ok, need use same function set user_id in comment struct, since return value of build_assoc comment struct, can not use same function iex> user = repo.get(user, 1) %user{id: 1, name: "bar"} iex> ecto.build_assoc(user, :comment, comment) ** (undefinedfunctione...

javascript - How to specify location of image on hover -

i have code display image directly on hyperlinks. unfortunately, if image populates directly on cursor, there seems conflict: website you can see code works small images. large images flicker. how can images stop flickering. think location of displayed image needs away hyperlink. jquery(document).ready(function() { jquery("<div id='player-image-hover'></div>").appendto("body").css("position", "absolute").css("z-index", "1000").css("padding", "2px").css("backgroundcolor", "#666"); jquery("a[href^='http://thepoolscene.com/player-profile']").each(function() { var title = jquery(this).attr("title"); title = title.tolowercase(); title = ucwords(title); var url = "http://" + window.location.host + "/wp-content/gallery/playerphotos/" + escape(title) + ".jp...