Posts

Showing posts from June, 2013

amazon web services - Is it possible to set up an AWS API Gateway endpoint for a Lambda function, using the AWS API? -

i exposing aws lambda function public http requests setting aws api gateway endpoint pointing it. there 2 parts this: create , upload aws lambda function set api gateway point http endpoint lambda function i want both parts using api calls instead of web interface. can first part using aws sdk , aws cli. however, second part, i'm stuck. haven't found mention of api gateway when looking through aws sdk node.js , or aws cli is there way set api gateway endpoint lambda function, programatically using aws api? yes, it's possible via aws's api set amazon api gateway endpoints aws lambda functions. while aws sdk javascript in node.js , aws cli haven't supported amazon api gateway yet, can set them using amazon api gateway rest api without official sdk. in case, use these apis: restapi:create resource:create method:put integration:put integrationresponse:put methodresponse:put you might want use 3rd party libraries integrate amazon a

java - GUI not updating after calling GUI method in another thread -

edit: simplified code. this main class initialises gui , server threads. public class main { public static void main(string args[]) throws classnotfoundexception, instantiationexception, illegalaccessexception, unsupportedlookandfeelexception, unknownhostexception { runnable tgui = new transceivergui(); runnable server = new server(tgui); new thread(tgui).start(); new thread(server).start(); } } now, in public class transceivergui extends javax.swing.jframe implements runnable class, have method following: protected boolean incomingfilerequest(string filename, long filesize, string user) throws interruptedexception, invocationtargetexception { /* .... code logic executes .... */ /* update gui here not work */ labelprogress.setforeground(color.red); labelprogress.settext("receive progress"); } whenever incomingfilerequest called within gui class (from eventlistener) works , gui updated. however, when

jquery - Javascript/CSS slideshow: Using transparencies highlights flaws I don't know how to fix -

as i'd love have broad possible future coders, rather specific problem. as can see in this jsfiddle , slideshow seems have issue pictures transparencies. transparencies, there jarring transition. if possible, i'd have old picture fade out new picture fading in. and note: slideshadow div there reason, box-shadow uses greater control on z-index. html: <div id="slideshow"> <img class="active" src="http://i.imgur.com/tqmy9wn.png" alt="" /> <img src="http://i.imgur.com/vnyefb0.png" alt="" /> <div id="slideshadow">&nbsp;</div> </div> css: #slideshow { position:relative; float:left; height:245px; width:200px; } #slideshow img { position:absolute; top:0; left:0; z-index:8; opacity:0.0; } #slideshow img.active { z-index:10; opacity:1.0; } #slideshow img.last-active { z-index:9; } #slideshadow { posi

python - Django not connecting to RDS Mysql -

i trying deploy django app on ec2 , using rds(mysql) backend. however when try run gunicorn this, server not respond, , if run python manage.py dbshell error: commanderror: appear not have 'mysql' program installed or on path. it seems trying connect local server of mysql when have changed host setting database dict rds deployment things have done solving , trouble shooting: 1. have changed database settings point rds database. both ec2 , rds instance in same zone of aws(read might have been issue) permission have been problem, checked trying login local machine, , able access mysql commandline on server. checked database settings django picking @ runtime,they correct. install mysql-python, not install without local installation of mysql, googled , people suggested install libmysqlclient-dev first , should able install mysql-python. has face similar problem? doing wrong here?

node.js - Sinopia(Local NPM registry)-Database -

sinopia seems cool having local npm registry. have couple of questions in terms o f module: sinopia documentation says "sinopia keeps own small database"; database being used? on other hand mentioned "if want use database instead, ask it, we'll come kind of plugin system." database being used or not? there plugin uses database , mentioned now? seems info being saved in config.yaml opposed db, right? sinopia saves repositories directly in filesystem can see here , tokens/users saved in json file. so, no, there not sql or nosql database know it. but don't need it, i'm using 30 devs on small server , haven't got issue far.

apache - Why do my url rewriting rules throw me a 500 Internal Server Error on my localhost? -

note: have uncommented line loading rewrite_module i have following .htaccess : setenv php_ver 5_4 options +followsymlinks rewriteengine on rewriterule ^lang/(.+)/(.+)$ index.php?mod=lang&lang=$1&url=$2 [l] rewriterule ^(.+)/(.+)/(.+)/(.+).html$ index.php?mod=$1&var=$2&svar=$3&tvar=$4 [l] rewriterule ^(.+)/(.+)/(.+).html$ index.php?mod=$1&var=$2&svar=$3 [l] rewriterule ^(.+)/(.+).html$ index.php?mod=$1&var=$2 [l] rewriterule ^(.+).html$ index.php?mod=$1 [l] it works fine on remote server in local 500 internal server error. using uwamp (portable version of wamp server) php 5.4. used work on old computer not on new 1 (both on windows 7) can ?

html - CSS div changes position on specific pages -

i'm having strange css problem main div container on website shifts right when visit pages. happens though there no specific css rule move it i've uploaded temp version of site here: http://myawesometestsite.ddns.net/ when go publications , contact page entire container shifts right few pixels. position appears correct , unshifted on other pages this full css i'm using: body { background-color: #dcd8cf; font-family: raleway, arial, sans-serif; font-size: 1em; } h1 { font-size: 1.5em; color: #832c00; margin-bottom: 30px; } h2 { font-size: 1.2em; color: #832c00; margin-top: 30px; } h3 { font-size: 1em; margin-bottom: 5px; margin-top: 20px; } h4 { font-size: 1em; font-style: italic; margin-top: 0px; margin-left: 10px; margin-bottom: 5px; } .container { position: relative; left: 50%; margin-left: -470px; width: 940px; border: 1px solid black; } /* header */ header {

Is there a PHP function that can escape regex patterns before they are applied? -

is there php function can escape regex patterns before applied? i looking along lines of c# regex.escape() function. preg_quote() looking for: description string preg_quote ( string $str [, string $delimiter = null ] ) preg_quote() takes str , puts backslash in front of every character part of regular expression syntax. useful if have run-time string need match in text , string may contain special regex characters. the special regular expression characters are: . \ + * ? [ ^ ] $ ( ) { } = ! < > | : - parameters str the input string. delimiter if optional delimiter specified, escaped. useful escaping delimiter required pcre functions. / commonly used delimiter. importantly, note if $delimiter argument not specified, delimiter - character used enclose regex, commonly forward slash ( / ) - not escaped. want pass whatever delimiter using regex $delimiter argument. example - using preg_match fi

swift2 - Swift 2 API Availability Check for storyboard -

i have existing ios application supports ios 8. want add new features ios 9. i have created new storyboard ios 9 using ios 9 features uistackview. appropriate storyboard file instantiated based on device os version. func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { let storyboard: uistoryboard if #available(ios 9, *, *) { storyboard = uistoryboard(name: "main", bundle: nil) } else { storyboard = uistoryboard(name: "mainold", bundle: nil) } let mainviewcontroller = storyboard.instantiateinitialviewcontroller() window?.rootviewcontroller = mainviewcontroller window?.makekeyandvisible() return true } but getting compilation error on main.storyboard "uistackview before ios 9.0" i using xcode 7 beta 5. how use ios 9 related features on ios 8 supported projects using swift 2 #availability check you cannot use such

Facebook Meta Tag og:image PHP condition -

i used php code og:image meta tag doesn't work, it's right doesn't call right source of image. <?php jfactory::getdocument(); $document->addcustomtag('<meta property="og:image" content="http://www.sell4masari.com/images/com_adsmanager/ads/<?php.$img->image?>" />');?> so appreciate anyone. you're putting <?php tags inside quotes, not being processed: content="[...]/ads/<?php.$img->image?>" />'); you need build string through concatenation, so: <?php jfactory::getdocument(); $document->addcustomtag('<meta property="og:image" content="http://www.sell4masari.com/images/com_adsmanager/ads/' . $img->image . '" />');?>

bash - How can I get the hostname from a file using awk and regex or substring -

the file name in format this: yyyy-mm-dd_hostname_something.log i want hostname filename. hostname can length, has _ before , after. current awk statement. worked fine until hostname length changed. can't use anymore. awk 'begin { ofs = "," } fnr == 1 { d = substr(filename, 1, 10) } { h = substr(filename, 12, 10) } $2 ~ /^[ap]m$/ && $3 != "cpu" { print d, $1 "" $2, h, $4+$5, $6, $7+$8+$9}' *_something.log > myfile.log echo 'yyyy-mm-dd_hostname_something.log' | awk -f"_" '{print $2}' output: hostname i suppose hostname contains no _ .

php - Magento v1.9.2.1: rwd theme onepage checkout to display grandtotal -

for rwd theme, v1.9.2.1, there way display subtotal, shipping , grand total, last review block, before submit order? according to: app/design/frontend/rwd/default/layout/checkout.xml: <!-- 1 page checkout order review block --> <checkout_onepage_review translate="label"> <label>one page checkout overview</label> <!-- mage_checkout --> <remove name="right"/> <remove name="left"/> <block type="checkout/onepage_review_info" name="root" output="tohtml" template="checkout/onepage/review/info.phtml"> <action method="additemrender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/onepage/review/item.phtml</template></action> <action method="additemrender"><type>grouped</type><block>checkout/cart_item_renderer

android - Can't get view to set elements of LISTVIEW -

have problem 'listview'. searched everywhere problem not arise none. let me explain: i have classic 'listview' in 'layout': <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/roza" android:tilemode="repeat"> <listview android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#80ffffff" android:alpha="200"> </listview> <textview android:id="@android:id/empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_todos" /> </linearlay

android - Application needs to restart every time it's entered -

i have application splash screen. shows first time run never shows again. there anyway of making application reset every time start it? your problem activity not been destroyed, when goes background. instead app continues @ place left it. imagine switch between 2 activities don't want show in cases splash screen been shown again. default continue application until terminated in background e.g. when memory gets low. however if want behavior (which not suggest) call in onpause() the method finish() . terminate current instance, when activity background. if want show splash screen on app launcher icon click should use android:launchmode="singleinstance" option in manifest, lal pointed out in answer. detect application got started launcher icon can check intent. on first start oncreate() been called, on second start (via launcher) onnewintent(intent intent) been called there can check intent.category_launcher.equal(intent.getaction()) if app opened laun

python - Tkinter: gridding canvas objects and buttons together -

i display 9 set cards in frame. under each card it's own button. i'm using setcard.deal_card(position) method place card in frame in 3x3 grid (position 0-8). when run program, buttons appear. when comment out pickbutton.grid() method, cards appear. don't know why can have 1 , not both. from tkinter import * import random class setcard(canvas): def __init__(self,master,number,color,shape,shading): # create 60x60 white canvas 5-pixel grooved border canvas.__init__(self,master,width=100,height=160,bg='white',\ bd=5,relief=raised) #also relief = sunken # store valuelist , colorlist self.number = number self.color = color self.shape = shape self.shading = shading self.selected=false self.pickbutton=button(self,text="pick me!", command=self.toggle_card) def deal_card(self,position): '''puts given card position on 3x3 grid of

controller - Javascript ERROR, undefined, not an object -

i new in javascript, , trying map controller's buttons , leds mixxx application. object, array? var missing. behringercmdmm1.leds = [ // master { "shiftbutton" : 0x12 }, // deck 1 { "sync" : 0x30 }, // deck 2 { "sync" : 0x33 } ]; i have error here, behringercmdmm1.shiftbutton = function (channel, control, value, status, group) { // note there no 'if (value)' here executes both when shift button pressed , when released. // therefore, behringercmdmm1.shift true while shift button held down var deck = behringercmdmm1.grouptodeck(group); behringercmdmm1.shift = !behringercmdmm1.shift // '!' inverts value of boolean (true/false) variable behringercmdmm1.setled(behringercmdmm1.leds[deck]["shiftbutton"], behringercmdmm1.shift); } about "shiftbutton" undefined. also have function behringercmdmm1.setled = function(value, status) { status = status ? 0x7f : 0x00; midi.sendshortmsg(

jquery - How do i use the mongo query and traverse the mongo(JSON)document and fetch the element by key -

how use mongo query , traverse multiple array , fetch value of key. here json { "_id" : "t5zcjquysxcshodjg", "original" : { "name" : "images (1).jpg", "updatedat" : isodate("2015-03-18t11:48:33.124z"), "size" : 10881, "type" : "image/jpeg" }, "uploadedat" : isodate("2015-08-16t13:13:35.392z"), "copies" : { "uploads" : { "name" : "images (1).jpg", "type" : "image/jpeg", "size" : 10881, "key" : "uploads-t5zcjquysxcshodjg-images (1).jpg", "updatedat" : isodate("2015-08-16t13:13:35z"), "createdat" : isodate("2015-08-16t13:13:35z")

datetime - Matlab: Add Milliseconds to time vector hh:mm:ss -

i have matrix m = hh:mm:ss ms '12:00:01' 1 '12:00:02' 2 '12:00:03' 3 '12:00:04' 4 '12:00:05' 5 now want add array of milliseconds ms time vector. like n = hh:mm:ss '12:00:01.001' '12:00:02.002' '12:00:03.003' '12:00:04.004' '12:00:05.005' how can this? tried was: for k=1:length(m) t1 = datenum(m{k,1},'hh:mm:ss'); c = num2str(m{k,2}); t2 = datenum(c,'fff'); time = t1+t2; n{k,1} = datestr(time,'hh:mm:ss.fff'); end but did not job right. is: n = hh:mm:ss '12:00:01.100' '12:00:02.200' '12:00:03.300' ... '12:00:04.100' '12:00:05.110' '12:00:05.120' i think problem simple solve. @ moment not know how solve it. it's string formatting problem. in code, instead of c = num2str(m{k,2}); use c = sprintf('%03d',m{k,2}); in above usage, sprintf pads

Ionic: Cordova GetPicture FileURL contain Number at the place of file name -

i selecting image galary , saving app directory, facing issue when image selected file name in url random number like: "/media/external/images/media/26183" i not getting exact file name, reason when file going copy file not found error throwing code fetching , saving are: $scope.changeprofile = function() { var options = { quality: 30, destinationtype: camera.destinationtype.native_uri, sourcetype: camera.picturesourcetype.photolibrary, encodingtype: camera.encodingtype.jpeg, mediatype:camera.mediatype.picture }; navigator.camera.getpicture( oncamerasuccess, oncameraerror, options); }; function oncamerasuccess(imageuri) { console.log(imageuri); window.resolvelocalfilesystemurl(imageuri,onsucessfilepath, onerrorfilepath); } function onerrorfilepath(error){ console.log(error); } function onsucessfilepath(fileentry){

.htaccess - Laravel 5.1 | Post requests don't work without the "/public" in the URL -

as title says, post requests don't work without "/public" in url in laravel 5.1 for example, in login form if action url /auth/login it not work , redirects me login page again after submitting it, if change action url to /public/auth/login it works correctly. same other forms. here .htaccess file located in laravel root folder <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri} !^public rewriterule ^(.*)$ public/$1 [l] </ifmodule> and here .htaccess file located in public folder options +followsymlinks rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] btw, app published on godaddy shared hosting account. problem not exist on local server ( wamp ) how solve ? in advance. the problem existed because of using url() method. for example in login.blade.php file => login form when changed action="{{url('auth/login')}}"

java - javafx: How to bind the Enter key to a button and fire off an event when it is clicked? -

basically, have okaybutton sits in stage , when clicked , performs list of tasks. want bind enter key button such when clicked or enter key pressed , performs list of tasks. okaybutton.setonaction(e -> { ......... } }); how can ? have read following post already. however, did not me achieve want do. fist, set hanlder on button : okaybutton.setonaction(e -> { ...... }); if button has focus, pressing enter automatically call handler. otherwise, can in start method : @override public void start(stage primarystage) { // ... node root = ...; setglobaleventhandler(root); scene scene = new scene(root, 0, 0); primarystage.setscene(scene); primarystage.show(); } private void setglobaleventhandler(node root) { root.addeventhandler(keyevent.key_pressed, ev -> { if (ev.getcode() == keycode.enter) { okaybutton.fire(); ev.consume(); }

c# - Port checking tool causes infinite packet received loop on TcpClient server -

i've written relatively basic asynchronous server boots task accept clients , each client boots task accept incoming packets, code follows: messagelisteningtask = new task(async () => { while (true) { byte[] buffer = new byte[256]; try { await tcpclient.getstream().readasync(buffer, 0, buffer.length); } catch { break; } string data = encoding.utf8.getstring(buffer).trim('\0', '\n', '\r', '\t', ' '); onmessagereceived(data); } }); this seems work pretty things, , after routing through class splits tokens based on token @ start, quite effective listener. except, given naivety topic, seem have done stupidly somewhere in implementation, , checking tool: http://www.yougetsignal.com/tools/open-ports/ seems break loop , cause trigger onmessagereceived no data.

javascript - Ng-options to show name but record id -

i have model, $scope.beer , , want user able select list of breweries ( $scope.breweries ) beer belongs. however, want display names of beer have model record id of brewery can reference in database. so far have this: <select name="brewery" ng-model="beer.brewery" ng-options="breweries.id breweries.name brew in breweries"></select> however, <options> element printing undefined name. using ng-options incorrectly? you should modify ngoptions part use brew.id , brew.name : ng-options="brew.id brew.name brew in breweries" since have brew iteration item.

shell - How to select files in a directory begins with explicit names in bash? -

i have shell script below dcachedirin="/mypath/" files in `ls $dcachedirin | grep txt` ..... done i have .txt files in directory, of them begins data2012*.txt , of data2011*.txt. how can choose "data2012" files? edit: bad mixed python file. shell script sure. you can try this dcachedirin="/mypath/" files in `ls $dcachedirin | grep data2012` echo $files done to avoid directories name, try ls $dcachedirin -p | grep -v / | grep data2012

javascript - WebGL textures distort as I move around them -

i'm working on voxel engine uses webgl directly. textures great within voxel-engine game (which uses three.js), horrible in engine. here's example simple grass texture on plane. http://greaterscope.net/ugly-textures/ if click on canvas , grant permission hide mouse cursor, can see texture tears , distorts move around (using wasd keys). ideas why? i've read using 0.5 pixel offsets somewhere, i'm not whether pertains problem. your textures distorting because rendering resolution low. example looks fine me when size down window whole bunch. note when size canvas via css, doesn't change amount of pixels in canvas, scales canvas. default size of html canvas 150x300 , resolution demo rendering at. pretty low-res full screen demo! make canvas higher resolution, need set width , height attributes of canvas element itself, rather through css. if still feels jaggy after using javascript set canvas width , height attributes match window size, can se

Unicode Regex with regex not working in Python -

i have following regex ( see in action in pcre ) .*?\p{l}*?(\p{l}+-?(\p{l}+)?)\p{l}*$ however, python doesn't upport unicode regex \p{} syntax. solve i read use regex module (not default re ), doesn't seem work either. not u flag. example: sentence = "valt nog zoveel zal kunnen zeggen, " print(re.sub(".*?\p{l}*?(\p{l}+-?(\p{l}+)?)\p{l}*$","\1",sentence)) output: < blank > expected output: zeggen this doesn't work python 3.4.3. as can see unicode character classes \p{l} not available in re module. doesn't means can't re module since \p{l} can replaced [^\w\d_] unicode flag (even if there small differences between these 2 character classes, see link in comments). second point, approach not 1 (if understand well, trying extract last word of each line) because have strangely decided remove not last word (except newline) replacement. ~52000 steps extract 10 words in 10 lines of text not acceptable

version control - "Best" svn to hg conversion tool for my specific purposes -

when comes converting svn hg seems there million pages devoted (both in stackoverflow , web in general), seem have laundry lists tools available, , maybe recommendation (though vary, , don't why it's recommended) no real information factors make tool best requirements. bad of info comes 2010 or so, notes or other pages saying "that tool outdated and/or not maintained". hg being rapidly developed 2010 might stone age. i want convert svn hg largely purposes of simplifying serious merges. i'd love convert whole team hg, various reasons isn't going happen yet. it'll i'll use hg sometime, while rest of team continues svn. therefore it's important me able round trip, i.e. convert svn repo hg, work on hg, push changes svn. it's important able sync hg repository svn repo since ongoing changes made svn repo. while local hg repo serve of purposes, i'd keep central 1 on server can convince other people try it. i understand main reason dvcs'

ios - CreatedAt,UpdatedAt not working after Azure,mobile service .Net backend database migration -

we created new schema , database use existing schema in .net azure mobile service backend, used migration that. after migration creates new schema successfully, populated data test our ios app. right now,i facing trouble having createdat,updatedat,version update through ios native app keeps being null. when use post,patch request mobile service page, write values these fields without problem. migration created id primary key, , createdat, updatedat datetimeoffest. createdat implementation of itabledata default getter , setter public datetimeoffset createdat{get;set;} if blackened issue how can fix it?

arrays - C: Program to delete characters other than alphabetical -

so i'm trying create program looks @ string defined in main, , deletes non-alphabetical characters (excluding \0). far code: /* write code considers string saved * in 'name' array, removes spaces , non-alphabetical * chars string, , makes alphabetical characters * lower case. */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #define namelen 30 int main (void) { char name[namelen]; strcpy(name, " william b. gates"); int i, length, check; length = strlen(name); ( = 0; < length; i++ ) { check = isalpha(name[i]); if ( check == 0 ) { ( ; < length; i++ ) { name[i] = name[i+1]; } } } printf("the length %lu.\n", strlen(name)); printf("name after compression: %s\n", name); return exit_success; } so test data, " william b. gates", output should "williambgates", unfortu

c - How to get in Linux application statistics about Ethernet? -

is possible retrieve various statistics errors (such rx_crc_error ) in c application, similar given in ethtool ? i've searched time how this, did not find whether possible done c application. you should use /proc/ , read proc(5) ; perhaps read (sequentially) file under /proc/sys/net/ (or, commented nominal animal , /proc/net/dev )

python - Include link in html output -

i using following code print error messages {% if error %} <div class="alert alert-dismissable alert-danger login-fail"> <button type="button" class="close" data-dismiss="alert">&times;</button> {{ error }} </div> {% endif %} where error provided template flask code ... return render_template('register.html', error="this test error message.") i include hyperlink in error message. if do return render_template('register.html', error="this test error message <a href="http//example.com" </a>.") it prints string. how can make sure html recognizes html code? carl normally flask escapes html tags. if want disable replace {{ error }} {{ error | safe}}. prevents autoescaping.

ios - UITableViewCell Looks Correct on Simulator but is Off-Center on Device -

Image
i have created custom uitableviewcell own xib , subclass. when view uitableview on ios simulator, cells appear expected. but when run same code on physical device (have tried on several devices), cells appear far off-center. i using nslayoutconstraints in interface builder set up. please let me know if have idea might problem here.

Python futures : How do I get the json from a future object in Tornado? -

this post handler : handler.py from imports import logic @gen.coroutine def post(self): data = self.request.body.decode('utf-8') params = json.loads(data) model_id= params['model_id'] logic.begin(model_id) the logic object imported imports.py instantiated imported class logic imports.py : import models import logic class persist(object): def getmodel(self, model_id): model = models.findbymodelid(model_id) return model persist = persist() logic = logic(persist) logic.py class logic(object): def __init__(self, persist): self._persist = persist def begin(self, model_id): model = self._persist.get_model(model_id) print ("model persist : ") print (model) the get_model method uses models makes db query , returns future object : model.py : from motorengine.document import document class models(document): name = stringfield(required=true) def findbymo

php - How do i show the last 5 users who have visited a userpage? -

im new php appricate if explain simplified :d i use php mysqli the question rather broad. but there (at least!) 3 possible approaches: you can parse http server's "access" logs you can parse http request header . example: you can use session , log each new session.

javascript - How to force loop to wait until user press submit button? -

i have simple function checks if entered pin code valid. don't know how force for-loop wait until enter code again check again it's validity. how should - type pin code, click ok button , checks whether it's correct (if is, can see account menu; if it's not have type again , have 2 chances left). code fails, because pin when code wrong program should wait until type new code , press ok button again . tried settimeout(), callback(), doesn't work. have - function for-loop runs 3 times (as suppose to, not instantly) without giving chance correct pin code. that's whole, unfinished yet, code: http://jsfiddle.net/j1yz0zuj/ only function for-loop, checks validity of pin code: var submitkey = function(callback) { console.log("digit status" + digitstatus); if (digitstatus == 0) { correctpin = 1234; var onscreen = document.getelementbyid("screen"); (i=0; i<3; i++) { if (onscreen.in

Is there any python (numpy) synonym to i-variables (e.g., irow, iradius, itheta, etc.) in DM scripting? -

i work electron microscopy image processing digital microscopy (dm) scripting, , start learn python because of wider versatility, rich open libraries, , cross-platform ability. does know if there similar tools in python (numpy) index 2d (image), or 3d (spectrum image) arrays similar dm's i-variables? the i-variables briefly introduced on page 11 of tutorial dm-scripting: http://portal.tugraz.at/portal/page/portal/files/felmi/images/dm-script/dm-basic-scripting_bs.pdf they easy way index image-like 2d or 3d object, convenient image processing, e.g., generate mask functions for example, following dm-script image t1 := realimage ("test1", 4, 5, 5) image t2 := realimage ("test2", 4, 5, 5) image t3 := realimage ("test3", 4, 5, 5) t1 = irow // value in each pixel equals row index t2 = iradius // value in each pixel equals radius // (i.e., distance center pixel) t3 = itheta // value in each pixel quals angle (radian) // center pixel (i.e

ruby - How to modify to_json method and add a dynamic property to it - Rails 4 -

so have controller , want add dynamic attribute along other data in @events instance variable i have search , tried things @events.attributes.merge(appointment: true) appointment = true want add events object. def find params = event_params current_user = 2 @events = event.where('date ?',"%#{params[:month]}%") def @events.as_json(options = { }) h = super(options) h[:appointments] = false # or combine above h[:appointments] = self.appointments? h end respond_to |format| if current_user == 1 if @events format.json { render json: @events.to_json } else render 'index' end else format.json { render json: @events.to_json } end end end ajax code here function retrieve(date_partial) { var jsondata = { events: { month: date_partial, } } $.ajax({ cache: false, type: "post", url: "/events/find", data:

C# not recognizing my variable -

i'm trying load code exe file create new .exe file. it's not recognizing variable "sourcecode". says name "sourcecode" not exist in current context private void button1_click(object sender, eventargs e) { using (filestream sourcecode = new filestream("thecode.exe", filemode.open, fileaccess.readwrite, fileshare.none)); string output = textbox3.text; string[] assembly = { "system.dll", "system.drawing.dll", "system.windows.forms.dll" }; codedomprovider codecompiler = codedomprovider.createprovider("csharp"); compilerparameters parameters = new compilerparameters(assembly, ""); parameters.outputassembly = output; parameters.generateexecutable = true; parameters.generateinmemory = false; parameters.warninglevel = 3; parameters.treatwarningsaserrors = true; parameters.compileroptions = "/optimiz

Xcode 5.02 crash on opening any xib - Yosemite -

i running yosemite 10.10.4 on macbook air. have number of xcode projects worked under xcode 6.4. however, downloaded xcode 5.02 apple in order use big nerd ranch book "ios programming" written xcode 5. time open xib file, xcode crashes. suggested, opened console app,found crash log, , copied it. process: interface builder cocoa touch tool [1370] path: /applications/xcode 2.app/contents/developer/platforms/iphonesimulator.platform/developer/library/xcode/overlays/interface builder cocoa touch tool identifier: interface builder cocoa touch tool version: 4.3 (141) code type: x86 (native) parent process: xcode [1315] responsible: xcode [1315] user id: 501 date/time: 2015-08-16 17:49:29.223 -0500 os version: mac os x 10.10.4 (14e46) report version: 11 anonymous uuid: efe6107d-fc8b-4f16-13cf-5078ba3a872d sleep/wake uuid: ac708070-a2ad

Plotly map projection types -

trying find list of different types of projects available in plotly projection types different sample: projection = list(type = "equirectangular") projection = list(type = 'azimuthal equal area'), projection = dict(type = 'mercator') any online documentation helpful here's dropdown of supported projections: https://plot.ly/python/dropdowns/

urllib - python can't read website html code -

i can't read html code of website using urllib def tests(url): response = urllib.urlopen(url) soup = beautifulsoup(response.read()) universities=soup.findall('a',{'class':'pin-link'}) print universities if __name__ == '__main__': tests("https://pinshape.com/shop?page=3&is-free=true&type=-streamable") possible read page source ? you try using urllib.request. taking snippet of part of code using, works follows import urllib.request urllib.request.urlopen('https://pinshape.com/shop?page=2') f: data = str(f.read()).replace('\n', '') myfile = open("testfile.txt", "r+") myfile.write(data)

mongodb - Use #each with argument in Meteor -

i'm new meteor framework , i'm trying show data meteor + mongo + spacebars. problem might need use 1 argument spacebar, #each, , not allow it. my code: $ file.js template.home.helpers({ places: function() { return places.find(); } }); template.content.helpers({ images: function() { return images.find({}); } }); $ file.html <template name="home"> {{#each places}} {{>content}} {{/each}} </template> <template name="content"> <li>{{name}} - {{date}}</li> {{#each images}} <img src="{{this.url}}"> {{/each}} </template> what want - , didn't work - use argument in template.content.helper function, below: template.content.helpers({ images: function(arg) { return images.find({place: arg}); } }); and in html file be <template name="content"> <li>{{na

javascript - Uploading a CSS id to a database -

i have javascript / jquery creates 145 squares. can clicked on , change class of square. squares have id each one, going 1 - 145. this script making buttons: var number = 1 function makebutton() { var button1 = "<div id=\"number\" class=\"inner\" style=\"display:inline-block; margin-top:5px; margin-right: 5px;\"><p>!</p></div>" var button2 = button1.replace("number", number) $("#buttonz").append(button2); // append new elements number += 1 }; this script creating squares: (the slots variable 145) function addbuttons(){ (i = 0; < slots; i++) { makebutton(); $(document).ready(function(){ $('.inner').click(function(){ $(this).addclass("selected"); $(this).removeclass("inner"); }); }); } } $(document).ready(function(){

javascript - Possible to play a sound twice in a row in html 5? -

i'm trying build simon game user must remember sounds being played in right sequence. i've wired audio , fires correctly when element clicked. however, audio not play same sound twice in row unless click twice. in other words, cannot have computer simulate pressing button 2 times in row. this simplified except js file: attempt 1 (calling function twice): ... var redbutton = document.getelementbyid("red"); var audiored = document.getelementbyid("audio-red"); redbutton.addeventlistener("click", function() { createnewseq(); }); ... var createnewseq = function () { audiored.play(); audiored.play(); }; audiored fire 1 time. attempt 2 (trying force reload calling load function): var createnewseq = function () { audiored.play(); audiored.load(); audiored.play(); }; same issue - plays single time. attempt 3 (re-building element): attempt thought of literally re-building , re-loading audio tag on every firing o

Adding a parameter to function in Java Bytecode -

i've got compiled .jar plugin x.class file. x.class file contains method y parameters y(string s1, string s2....). need pass 1 more string - launched rej , dirtyjoe, edited descriptor of y method, changed maximum local variables count 8 9, added new local variable, set same previous variables, gave index, edited code , saved method. packed .jar file , tried compile in unity new version of plugin. unfortunately - gave me error saying new variable invalid - exception simulation: local 0008: invalid ...at bytecode offset 00000036 locals[0000]: ljava/lang/string; locals[0001]: ljava/lang/string; locals[0002]: ljava/lang/string; locals[0003]: ljava/lang/string; locals[0004]: ljava/lang/string; locals[0005]: [b locals[0006]: landroid/net/uri; locals[0007]: landroid/content/intent; locals[0008]: <invalid> stack[0001]: landroid/content/intent; stack[top0]: string{"android.intent.extra.text"} ...while working on block 0036 ...while working on method startshareintent