Posts

Showing posts from May, 2014

html - How to login with Google Account from my PHP application? -

i need help. have been create php application , has sign in authentication access it. user table : =========================================================== username | password | email | e_pass =========================================================== admin | admin | mymail@google.com | mygooglepassword =========================================================== username , password column local authentication, email , e_pass google authentication. so, how can that? both local , google authentication done @ same step? because google calendar , google drive embedded in php application , need google authentication access them. here authentication code php code : <?php if (empty($_post['userid']) or empty($_post['passwd'])) { // jika file diakses secara langsung ?> <script type="text/javascript"> alert("you can't access file directly!"); </script>...

svn - allowing remote access to subversion -

we have default install of subversion running on redhat. i've created repository , added users in "passwd" file , updated "svnserve.conf" point this. now want allow these new users connect remote netbeans installation (using built-in svnkit). i can connect using ssh username/password, want connect new accounts i've added (as explained above). currently, i've tried: svn+ssh://myhost/path/to/repo , (svn://myuser@myhost/path/to/repo) - , explained, ssh accounts work. so need create proper linux accounts users? if so, whats point of svnserve.conf options setup users? any ideas? the answer split username , password out of repository url follows: repository url: svn://myhost/repo user: myusername password: mypassword note: didn't take 2 years solve this. hadn't noticed had left question open long , wanted close off.

html - Margin-top not working when an image is centered horizontally - Phonegap -

i new webdesign, using phonegap (html5) centered image horizontally way: .html <div id="loginholder" > <img id="image_person" src="img/icon_login.png" /> ... .css #image_person { display:block; margin-left:auto; margin-right:auto; margin-top: 30px; } ... #loginholder{ background-color: #29aae1; height: 200px; width: 70%; margin: 0 auto; } ... please why margin-top not working? you need trigger layout. add overflow:hidden #loginholder

Javascript/jQuery [object Object] when trying to find great-grandparent class name -

i'm trying great-grandparent div class name using .closest method of jquery. when test make sure correct div class name being passed, [object object] alert, appears sort of error. code meant able find div class name beginning 'form-container' regardless of number of div's between (this) , desired div. insight appreciated. thank you! <script type="text/javascript"> jquery(document).ready(function ($) { $('input').bind('blur', function () { var classname = $(this).closest('.form-container'); alert(classname + "classname"); var newclass = classname.replace('.form-container', ''); alert(newclass); alert("hello"); var name = $(this).attr('name'); var pathname = window.location.pathname; ga('send', ...

javascript - I want to pull a variable from a jscript file to provide the href value in an <a> tag -

i'm front-end web designer, dabble in javascript etc. i've been googling (i'm not @ jscript, can figure out 75% of time); i've been able find how create variables within html, isn't helpful. i've defined variable makes use of value function in linked jscript file has created. so ideally: <script src="myjscriptfile.js" language="javascript"></script> <a href="nameofvarfromfile" >the file!</a> i'm trying pull url of pdf file, , use url in object embedded in page. figured simpler way ask question , same result. you'll need reference javascript variable from javascript, , set link's href there. <a href="#" id="linktoset">the file!</a> <script src="myjscriptfile.js" language="javascript"></script> <script> document.getelementbyid('linktoset').href = nameofvarfromfile; </script>

asp.net - How is the User property generated when authenticating with bearer tokens in Web Api? -

the documentation sparse in area, means can't find clear answer anywhere. if i'm not mistaken, when using cookie authentication in mvc app, cookie contains encrypted info decrypted , seeded principal on each request. same thing happening bearer tokens? token contain info goes principal? how work behind scenes? i'm sorry if dumb question, find current authentication/authorization implementation in asp.net mvc , web api confusing, , there not lot of documentation out there. from understanding, pretty correct. when authenticating user's credentials, extend oauthauthorizationserverprovider class overriding grantresourceownercredentials method; create claimsidentity instance , pass authenticationticket. the claimsidentity (and assigned claims , data) encrypted , sent part of "access_token" section of response. microsoft's owin authentication middleware looks after plumbing of encrypt/decrypt , serialization process. iis hosted scenarios encr...

perl - Not able to generate the code coverage result using Devel::Cover -

i tried find code coverage c4rgr.pl test file devel::cover . have .pm module sitting in same area. using perl -mdevel::cover c4rgr.pl , generates cover_db , has runs subdirectory inside. inside runs subdirectory, versionated directory created every time run cover command , cover.13 obtained. cover.13 file (i think) has raw data code coverage results. still, unable test results in html output format or on terminal screen. this do: run perl -mdevel::cover c4rgr.pl here, c4rgr.pl uses .pm module sitting in same area. when run above command, runs test file no test coverage output shown in devel::cover html output obtained. nevertheless, cover.13 file created every time. cover.13 <- 1401378982.24872.12631 <- runs <- cover_db . can tell me how html file, please? able run dummy test same features , generate html file. actual test, not. or there way convert cover.13 file html not being done in case? after running perl -mdevel::cover c4rgr.pl...

java - do <= and >= relational operators work with Integer objects -

this question has answer here: how compare 2 integers in java? 6 answers i understand can't use == or != compare values of numeric objects , have use .equals() instead. after fair amount of searching haven't been able find statement whether or not can use other comparison operators, other suggestions use .compare() or .compareto() feel inefficient because require 2 comparisons: b, result of zero. despite == , != comparing addresses of objects, other comparison operators appear compare numeric values. instance following code snippet: integer = new integer(3000); integer b = new integer(3000); system.out.println("a < b " + (a < b)); system.out.println("a <= b " + (a <= b)); system.out.println("a == b " + (a == b)); system.out.println("a >= b " + (a >= b)); system.out.println("a > b " +...

scala - Compress Output Scalding / Cascading TsvCompressed -

so people have been having problems compressing output of scalding jobs including myself. after googling odd hiff of answer in obscure forum somewhere nothing suitable peoples copy , paste needs. i output tsv , writes compressed output. anyway after faffification managed write tsvcompressed output seems job (you still need set hadoop job system configuration properties, i.e. set compress true, , set codec sensible or defaults crappy deflate) import com.twitter.scalding._ import cascading.tuple.fields import cascading.scheme.local import cascading.scheme.hadoop.{textline, textdelimited} import cascading.scheme.scheme import org.apache.hadoop.mapred.{outputcollector, recordreader, jobconf} case class tsvcompressed(p: string) extends fixedpathsource(p) delimitedschemecompressed trait delimitedschemecompressed extends source { val types: array[class[_]] = null override def localscheme = new local.textdelimited(fields.all, false, false, "\t", types) ove...

C# Exception thrown for when class isn't fully initialized -

what exception should raise tell caller class isn't initialized? exception found typeinitializationexception, didn't seem appropriate. it's impossible class not initialized upon use, unless you're doing manual init() type method call. if you're using constructors , initializer syntax, it's guaranteed c# lang spec initialized. if need throw something, use invalidoperationexception note saying "call init first!"

c# - How do you specify which program you want to stop in visual studio? -

Image
i got 2 programs pretty simple programs. here 1: static void main(string[] args) { pipeclient client = new pipeclient(); client.send("hello world"); client.send("hello world 2"); console.readline(); } here 2 static void main(string[] args) { using (var server = new pipeserver()) { server.start(); console.writeline("press enter end"); console.readline(); } } i go solution properties , under common properties set configuration this: i start debugger. both programs start, want use break functionality because want inspect 1 of 2 programs; however, when use break icon, can inspect 1 of 2 projects. how allow myself view both if possible , if not how toggle program i'm inspecting? this source says "on debug location toolbar, choose process view process list box. select process want designate current process. switch between processes"

Learning Zookeeper - Help me with example -

i'm trying wrap head around zookeeper , does. point, experience zookeeper has been through other libraries require zookeeper (solr , kafka) , basic understand vague "you better use zookeeper keep configuration straight". so me think through simple example problem. let's build own service "stuff". there 2 things want protect: i want have little downtime possible (gotta keep doing stuff). i can not have more 1 server doing stuff because bad things happen. so, how set in zookeeper? zookeeper responsible starting stuff server if 1 goes down? or subscribe zookeeper "stuff doer status" callback? if erroneously start 2 stuff servers, how zookeeper me keep bad things happening? zookeeper distributed lock manager . these systems provide features coordinator election (aka "master election" or "leader election") distributed system, provide consistent, distributed access small amounts of critical information used conf...

arrays - Find regular intervals in a set of unordered numbers -

i have set of not-unique real numbers read file. all these numbers generated linear space, is, difference between numbers multiple fixed value, "step" or "grid size" of linear space, say. each existing value tipically appear many times in file. my goal find how values spaced, put each (unique) value in array , access value index. you looking greatest common divisor of numbers. here in python: def gcd( a, b ): "greatest common divisor" while true: c = % b if c < 1e-5: return b a, b = b, c def gcdset( a_set ): "use pairwise gcd find gcd of set" x = a_set.pop() total = x u in a_set: x = gcd( u, x ) # following step optional, # sort of stabilization improved accuracy total = total + u x = total / round(total/x) return x # list want find gcd inputlist = [2239.864226650253, 1250.4096410911607, 1590.1948696485413, 810.0...

RVM Ruby Installation Fail on OS X 10.9.3? -

i receiving error when running rvm command install ruby on osx machine. output below: thiscomp:~ *************$ \curl -l https://get.rvm.io | bash -s stable --ruby % total % received % xferd average speed time time time current dload upload total spent left speed 100 184 100 184 0 0 330 0 --:--:-- --:--:-- --:--:-- 330 100 20511 100 20511 0 0 18860 0 0:00:01 0:00:01 --:--:-- 9.7m downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz upgrading rvm installation in /users/************/.rvm/ rvm path line found in /users/*************/.profile /users/*************/.bashrc /users/***********/.zshrc. rvm sourcing line found in /users/*********/.bash_profile /users/**********/.zlogin. upgrade of rvm in /users/*************/.rvm/ complete. # msutyak, # # thank using rvm! # sincerely hope rvm helps make life easier , more enjoyable!!! # # ~wayne, michal & tea...

javascript - Creating Bars in D3js -

Image
i following example of book, interactive data visualization web deals using rect create bar. issue facing origin of each bar , it's sliding down. code given below: <!doctype html> <meta charset="utf-8"> <html> <head> <title>census</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript" src="../d3/d3.min.js"></script> </head> <body> <style> div.bar { display: inline-block; width: 20px; height: 75px; /* we'll override height later */ background-color: teal; margin-right: 5px; margin-bottom: 320px; } rect{ margin-right: 5px; } </style> <script> //var dataset = [ 5,10,15]; var dataset = [ 5, 10, 13, 19, 21, 25, 22, 18, 15, 13, 11, 12, 15, 20, 18, 17, 16, 18, 23, 25...

wso2is - Recommendation for integrating WSO2 API Manager, Identity Server and Shibboleth -

what current, recommended way setup wso2 api manager use sso against shibboleth idp? our organization has existing sso infrastructure built around shibboleth’s idp integrate our api manager installation. ideal use case: user navigates api manager store. user redirected shibboleth idp login page. if 1 doesn’t exist, api manager account created , assigned subscriber role. user returned api manager , logged in. “signed-in-as:” renders reasonable user name (i.e. not guid). i’m aware there included saml2 authenticator component api manager limited in features, not handle encrypted assertions, using specific attributes username/display name , automatic user creation. i understand write custom authenticator, rather avoid creating code base needs maintained , doesn’t have community support. if simpler solution cannot determined do. what investigating delegating user management api manager wso2 identity server. delegate authentication shibboleth , auto provision users bef...

objective c - Random number generator method -

so have method returns letter (from a-z) creating random number between 1-26 , indexing string array pull out letter. problem not generate new letter when method called. how can generate new letter every time method called, in while loop. here code: -(nsstring *)alphagenerator{ nsuinteger randomletterinteger = arc4random_uniform(26); nsarray *alphabet = @[@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o",@"p",@"q",@"r",@"s",@"t",@"u",@"v",@"w",@"x",@"y",@"z"]; nsstring *alpha = alphabet[randomletterinteger]; return alpha; } also, how convert number returned count method number can plug arc4random_uniform method? receive 'incompatible integer pointer inversion initializing......

elasticsearch - Trouble with spaces in query to elasticsearh -

i'm experiencing trouble requesting fileds making requests on field spaces. mapping looks this: "myindexname": { "mappings": { "mytype": { "properties": { "mypropertywithspaces": { "type": "string", "analyzer": "analyzer_keyword" } } } } } there "analyzer_keyword" cutom analyzer keyword tokenizer , lowercase filter. when i'm sending "_analyze" request "analyzer_keyword" analyzer , query "firstword secondword" token "firstword secondword" - works expected. querystring request returns nothing if don't change space character "?" wildcard; interesting, lowercasing still works , such behaviour doesn't change if i'm telling elasticsearch use "analyzer_keyword" explicitly. "query...

slick - how do I make a tiled map base64 -

hello making game in java using slick library. first time doing , need help. map using tiled. , whenever try call tmx file error : thu may 29 16:17:57 edt 2014 error:unsupport tiled map type: base64,zlib (only gzip base64 supported) so best guess needs gzip base64. makes no sense me, can me out? you need either choose option when you're creating map in tiled , or can click, on menu bar, map >> map properties >> , select compression want .

c# - linq magic, delete all rec where -

user has list of userclaims. i sending user claimtype , claimvalue parameters. based on params want delete user claims if any. user has list of claims , every claim has it's user , type , value. public void removeclaim(user user, string type, string value) { var claimsrepository = repository.findall().tolist(); } once again want delete users claims has type , value sent params in method. this work if "repository" list , ienumerable isn't enough, doesn't have add/remove functions. if meet criteria, removeall : repositiory.removeall(c => c.type == type && c.value == value); otherwise, use where remove (again, needs support remove function): foreach (userclaim c in repositiory.where(c => c.type == type && c.value == value).tolist()) repository.remove(c);

unix - Shell: How to append characters at the end of a string? -

i need write shell script append characters each line in text make lines same length. example, if input is: line 1 has 25 characters. line 2 has 27 characters. line 3: lines must have same number of characters. here "line 3" has 58 characters (not including newline character) have append 33 characters "line 1" , 31 characters "line 2". output should like: line 1 has 25 characters.000000000000000000000000000000000 line 2 has 27 characters.0000000000000000000000000000000 line 3: lines must have same number of characters. we can assume max length (58 in above example) known. here 1 way of doing it: while read -r; # read file 1 line @ time printf "%s" "$reply" # print line without newline (( i=1; i<=((58 - ${#reply})); i++ )); # find difference in length iterate printf "%s" "0" # pad 0s done ...

javascript - jSLint with Angular causes Unexpected '$scope' error -

i'm receiving "unexpected '$scope'" error when run jslint against angular based app building. below reduced version of code causing error. can input code jslint.com website reproduce problem. i don't understand why first function declaration (downloadfile) doesn't cause error second (buildfile). /*jslint browser: true*/ /*global angular */ angular.module('testapp') .controller('filectrl', ["$scope", function ($scope) { "use strict"; $scope.downloadfile = function () { window.location = '/path/to/file'; } $scope.buildfile = function () { } }]); lack of semicolons after function causing error $scope.downloadfile = function () { window.location = '/path/to/file'; }; //<-- add semicolon $scope.buildfile = function () { }; //<-- add semicolon

knockout.js - Knockout select list value on change show/hide second select list -

i using mvc 5 , knockout create page names listed , against each name there selection list (uniform data rows). on 'applybinding' visible-binding , css-binding works on subsequent change of selection of list item modified rows not respect either binding. script is... function names(data){ var self = this; self.id = ko.observable(data.id); self.name = ko.observable(data.name); self.reqstatus = ko.observable(data.reqstatus); self.rejreason = ko.observable(data.rejreason); self.showreason = ko.observale(false); self.reqstatus.subscribe(function(newvalue){ if (newvalue == 2){ self.showreason = true; } }); self.statuscss = ko.computed(function(){ if (self.reqstatus() == 2) { return "rejected"; }else if (self.showreason() == true){ return "rejected"; }else{ return "accepted"; } }); } function reason(data){ v...

excel vba - Unrelated Pivot Tables slowing loops to a crawl -

a change of scope project means 2 workbooks must become 1 workbook. workbook has 3 sheets: output (viewed end users,) data (used drop small sql queries onto sheet , run logic below,) , data2 has active connection db bigger queries on server via pivot tables. this code (without data2 sheet in workbook) can loop through ~15k lines in less 5 seconds for = sheets("data").range("a" & rows.count).end(xlup).row 1 step -1 if not (range("d" & i).value > qs) , (range("d" & i).value < qe) range("d" & i).entirerow.delete end if next upon adding new sheet (which has 2 pivot tables querying sql db, several fliters, , slicer each) single loop (which 1 of 8) takes long run haven't let finish. dropping break on "end if" , iterating through holding f5 shows code working properly. nothing on data2 sheet references outside of sheet. feel reason pivot tables refreshing through each iteration of ...

javascript - Monitor status of pouchdb replicate -

if user loses internet or server goes offline, how can notifiy user live sync stopped? var localdb = new pouchdb('localdb') var remotedb = new pouchdb('http://localhost:5984/xyz'); localdb.replicate.to(remotedb, {live: true}); localdb.replicate.from(remotedb, {live: true}); solved on irc, in case anyone's curious, db.replicate(...).on('error') seemed missing key.

sprite kit - SKSpriteNode removeFromParent in touchesEnded -

i have issue removing skspritenode it's parent when touch detected on skspritenode. here code: -(void)touchesended:(nsset *)touches withevent:(uievent *)event { (uitouch *touch in touches) { cgpoint scenelocation = [touch locationinnode:self]; if ([_tabledonebutton containspoint:scenelocation]) { nslog(@"here"); [self removeitemsfromview]; _headernode.portlabel.text = [ipgamemanager sharedgamedata].world.player.port.name; [_portnode show]; } sknode *nodeinport = [_portnode nodeatpoint:[touch locationinnode:_portnode]]; if ([nodeinport.name isequaltostring:@"marketbutton"]) { [self showmarket]; } } } in showmarket function, 'done' skspritenode added user can leave market when he/she wants to. can see above, if _tabledonebutton contains touch location, should call removeitemsfromview function contains [_tabledonebutton removefr...

c# - Fluent Validator missing SetCollectionValidator() method -

i'm new fluent validation , got version 5.3 nu yesterday. i'm trying apply existing validator (phonevalidator) collection property (icollection) of class (employee). fluent validator documentation says use: rulefor(x => x.orders).setcollectionvalidator(new ordervalidator()); // example usage however setcollectionvalidator() method not available on version have. instead there setvalidator() marked [deprecated] . i've seen other posts regarding same situation , have learned setcollectionvalidator() extension method , need sure have fluentvalidation imported. do. what missing here? using fluentvalidation; using fluentvalidation.validators; public class employeevalidator : abstractvalidator<employee> { public employeevalidator() { // setcollectionvalidator doesn't show in intellisense , won't compile rulefor(e => e.phonenumbers).setcollectionvalidator(new phonevalidator()); } } public class phonevali...

jquery - Manage AJAX request data in a CakePHP controller -

i'm trying access ajax request's data cakephp controller, failing understand form's data once i'm in controller. inside view, between form tags, have following code: echo $this->js->submit( 'proceed', array( 'url' => array( 'controller' => 'json', 'action' => 'itemselection' ), 'datatype' => 'json', 'id' => 'proceed', 'success' => 'onsuccessfunct( data )' )); this results following code: $(document).ready(function (){ $("#proceed").bind("click", function(event){ $.ajax({ data:$("#proceed").closest("form").serialize(), datatype: "json", success:function (data, textstatus) { onsuccessfunct( data ) }, type:"post", url:"\/koro\/json\/items...

java - Transaction Managment Spring framework -

while learning spring framework i'm on transaction management topic , while i'm not 100% against using xml i've been trying using annotations. along comes transaction management thing , instructor plops right xml file , references datasource bean created annotations ... below ... package com.udemy.learning.main; import java.sql.sqlexception; import javax.sql.datasource; import javax.annotation.*; import org.apache.commons.dbcp.basicdatasource; import org.springframework.beans.factory.annotation.value; import org.springframework.stereotype.component; @component("connect") public class connections extends basicdatasource{ @value("${jdbc.user}") private string username; @value("${jdbc.password}") private string password; @value("${jdbc.driver}") private string driverclassname; @value("${jdbc.url}") private string url; public datasource connect() throws sqlexception{ sup...

seo - Add multiple domains for the same website in google webmasters -

i have 3 domains these 2 http://www.janhendrikx.be http://www.standenbouw-jan.be redirect http://www.ontwerpbureaujan.be/ in google webmasters added ontwerpbureaujan have add others too? or duplicate content have use canonical urls? how? 'standenbouw' main seo keyword, maybe should add http://www.standenbouw-jan.be webmasters, not ontwerpbureaujan ? ... i'm sure janhendrikx.be & standenbouw-jan.be have 301 redirects ontwerpbureaujan.be if not, please done web host else google consider them 3 different websites , crawl them all. if have 301 redirects, add others , google know same site , hence wouldn't crawl of them. still add of them , may increase pagerank keyword , in case mention http://www.ontwerpbureaujan.be/ preferred domain on site settings area. here few recommendations google itself: https://support.google.com/webmasters/answer/139066?hl=en#4 good luck!

java - Problems with Autowired and Spring Injection -

this question has answer here: why spring @autowired field null? 10 answers solved lately i've been having problems spring mvc application i'm trying develop. main problem don't know why @autowired annotation not working , that's because have wrong. i'm going post here code can me issue! lot guys: web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>helloworld application</display-name> <description> simple web application source code organization based on recommendations of application develop...

c# - Index was outside the bounds of the array -

i "index outside bounds of array" error below code. occurs after music stops , try click song. how solve issue? private void button1_click(object sender, eventargs e) { if (openfiledialog1.showdialog() == system.windows.forms.dialogresult.ok) { files = openfiledialog1.safefilenames; paths = openfiledialog1.filenames; (int = 0; < files.length; i++) { listbox1.items.add(files[i]); } } } private void listbox1_selectedindexchanged(object sender, eventargs e) { axwindowsmediaplayer1.url = paths[listbox1.selectedindex]; } not clearing old items listbox when new files selected. use clear method remove old items before adding new ones. the error describing occurs because have more items in listbox in paths variable. this new code: private void button1_click(object sender, eventargs e) { if (openfiledialog1.showdialog() == system.windows.forms.dialogresult.ok) { files ...

Anaphora resolution example requested with python-nltk -

i have been looking howto nltk-drt , module definitions nltk.sem.drt having hard time trying understand how achieve basic functionality using these packages. an example of task achieve following: given sentence google 1 of largest tech companies. employees many people. i able write small function parses sentence such this, , return sentence such google 1 of largest tech companies. google employees many people. a more realistic test case can like tom, dick , harry invited party, declined. made sherry angry. being resolved to tom, dick , harry invited sherry party, declined. made sherry angry. i don't think drt (discourse representation theory) deals anaphora resolution , wanted. deals representing meaning of sentence in formal logic. also, there name "more realistic test case", called " cataphora ". anaphora resolution difficult, can try stanford dcoref and see examples here: anaphora resolution using stanford ...

php - multiple stream select with proc_open receive responses from slow process -

i'm calling slow python script child process (echonest remix code) wp plugin using proc_open , variation on code found here @ this question . the (python) script takes minute process (a bunch of audio), , i'm hoping find way display output browser printed python script. stands, output of entire function not display until proc_open , stream_select processes end. includes echo statement @ start of function. <?php echo "why wait before printing me out?"; $description = array ( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "w") // stderr ); $application_system = "python "; $application_name .= "glitcher/glitchmix.py"; $application = $application_system.$application_name.$separator; $argv1 = 'a variable'; $argv2 = 'another variable'; $separator = " "; $pipes = array(); $proc = proc_...

javascript - What's the connection between console.log and HTML? -

Image
this question has answer here: inserting html div 4 answers beginner here, might not using correct terms describe this. have loop, else if statement produces result via console.log . what want have results (basic fizzbuzz problem) display on html page. have been reading high , low, , getting little discouraged can't figure out on own. guess should .append don't know if that's right, or event(?) should be. (e.g.; .click, .hover, etc.) let me know if need more info. head jumbled code i've gone through. appreciated! here js code: var choice = prompt("what number should count to?"); (var = 1; <= choice; i++) { if (i % 15 === 0) { console.log('fizzbuzz'); } else if (i % 3 === 0) { console.log('fizz'); } else if (i % 5 === 0) { console.log('buzz'); } else { cons...

How to Manage Google API Errors in Python -

i'm doing lot of stuff bigquery, , using lot of try... except... . looks every error bigquery apiclient.errors.httperror, different strings attached them, i.e.: <httperror 409 when requesting https://www.googleapis.com/bigquery/v2/projects/some_id/datasets/some_dataset/tables?alt=json returned "already exists: table some_id:some_dataset.some_table"> <httperror 404 when requesting https://www.googleapis.com/bigquery/v2/projects/some_id/jobs/sdfgsdfg?alt=json returned "not found: job some_id:sdfgsdfg"> among many others. right way see handle these run regexs on error messages, messy , not ideal. there better way? bigquery rest api... errors uses follow standard http error conventions. in python, httperror has resp.status field returns http status code. show above, 409 'conflict', 404 'not found'. for example: try: ... except httperror err: # if error rate limit or connection error, # wait , try again. if ...

session - How to use AutoExpireFlashBag in Symfony? -

with current configuration, inside controller $this->getrequest()->getsession()->getflashbag() returns flashbag instance. i see in documentation there autoexpireflashbag class automatically expires messages, whether consumed or not. how symfony use class instead of regular flashbag class ? thanks! it set global parameter in config file. need rename class flashbag in session.flashbag.class parameter. defined in https://github.com/symfony/symfony/blob/master/src/symfony/bundle/frameworkbundle/resources/config/session.xml#l9 . can override in configs.

Javascript: Random Element From Array, Do While -

i have button displays quote , author array. need button display new quote/author each time button clicked. no 2 same quotes/authors in row! window.onload = function() { //assign var quotetext id contents var quotespan = document.getelementbyid("quotetext"); //assign var authortext id contents var authorspan = document.getelementbyid("authortext"); var oldquoteindex = -1; var submitbutton = document.getelementbyid('submit'); var quotes = [ {'text': 'i milk!', 'author': '-biff'}, {'text': 'milk nasty.', 'author': '-jonn'}, {'text': 'what mean?', 'author': '-jay'}, {'text': 'milk. mmm.', 'author': '-don'}, {'text': 'milk bad.', 'author': '-denny'} ]; //function determining random quote function nextquote() { ...

android - java.lang.RuntimeException with Facebook Login example -

i'm following facebook guide make login app android. after: install facebook app (unnecessary) on virtual device import facebook sdk android studio module import previous module project and modify code guide says the project compiles. when run machine , try open application crash showing: unfortunately, application has stopped. i couldn't find solution after read similar posts this , this . i'm using android 0.5.8, oracle jdk 7 , api 16 target , min , max . the main files activity_main.xml , mainactivity.java , mainfragment.java . here latest logcat output: 05-30 03:15:54.127 647-664/com.jdk8.minifacebookloginapp.app e/androidruntime﹕ fatal exception: asynctask #1 java.lang.runtimeexception: error occured while executing doinbackground() @ android.os.asynctask$3.done(asynctask.java:299) @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) @ java.util.concurrent.futuretask...

winapi - If PostMessage Succeeded, is the message guaranteed to be processed by the window? -

i have background thread process data , want send result main window, window may destroyed before background thread exits. i use postmessage deliver newly created objects (created in heap), if succeed, message processed main window surely? if not, best practice kind of situation? ps: concern when posting messages, window valid, destroyed before message delivered. if so, cannot delete objects. i use postmessage deliver newly created objects (created in heap), if succeed, message processed main window surely? if call postmessage succeeds, message placed in queue. message processed when thread pumps message queue. if thread fails pump queue, or if recipient window no longer exists when message processed, not delivered.

jquery - Secure form using PHP -

i have simple form 3 input fields posting messages specific group: input text hidden field group id hidden field token the submiting done using ajax , sending input text , hidden fields what do: text send user validated. check if token match session token created form. the problem: hidden id (group id) can changed user , post insert wrong group. i can remove hidden id , group id session. i'm not sure if secure yes secured, session variables reside on server not on client side. although, if user can under group, query or in database upon submitting instead of saving in session. if have other form or page user can access , change his/her group, group id in session invalid.

javascript - Dropdown menu, call one function when an item selected, call another when another item selected -

i have drop down menu, shows values database. , can see, have called function callfunc() onchange of select elements. initially, 'choose me show page1' kept selected default. when selects else, callfunc() called. value of selected item passed onto function. function shows contents page using ajax. works fine. want implement else. want call function when 'choose me show page1' selected. wasn't able successfully. so, scenario. when user selects other select other 'choose me show page1'item dropdown, callfunc() called. if 'choose me show page1' isselected, call function, say.. abc(); <select name="selectme" onchange="page2(this.value)"> <option value="anothervalue" selected="selected">choose me show page1</option> <?php foreach($val_array3["from_db"] $key3=>$value3) { $vvv=$value3['val_from_db']; ?> <option value="<?php e...