Posts

Showing posts from August, 2010

c++ - lvalue required as left operand of assignment - LOBYTE / HIBYTE -

i'm receiving lvalue required left operand error on lobyte/hibyte/lodword lines in function below: typedef dword _dword; typedef byte _byte; typedef word _word; signed int __stdcall checkserial(int serial, int seriallength) { int v2; // ecx@1 int v3; // ecx@3 int v4; // ecx@5 int v5; // ecx@7 int v6; // dx@9 signed int v7; // ecx@10 char v8; // dl@11 __int16 v9; // cx@13 signed int result; // eax@21 v2 = 0; { *(_dword *)(v2 + serial) ^= 0x1234567u; *(_byte *)(v2 + serial) &= 0xeu; v2 += 4; } while ( v2 != 8 ); v3 = 0; *(_byte *)(serial + 8) += *(_byte *)(v3++ + serial); while ( v3 != seriallength ); v4 = 0; { *(_dword *)(v4 + serial) ^= 0x89abcdeu; *(_byte *)(v4 + serial) &= 0xeu; v4 += 4; } while ( v4 != 8 ); v5 = 0; *(_byte *)(serial + 9) += *(_byte *)(v5++ + serial); while ( v5 != seriallength ); lobyte(v6) = *(_byte *)(serial + 9); hibyte(v6) = *(_byte *)(serial + 8); if ( v

ruby on rails - Deformed text in chrome -

Image
we have weird behavior in our application, sorry can't give examples it's closed. we see extremely deformed texts, example: which should have been edit columns, can see happens, when clicking inspect element, shows fine, , fixes self. few notes: we running little bit old ruby on rails (1.9.3 ruby, 3.2.17 rails). script rendered angular happen in plain hamls (but more rarely). it doesn't happen time. it's possible happens on chrome (since it's not persistent it's hard make sure didn't happen). any ideas or suggestions or event hints extremely valuable, @ complete loss here.

ios - Can't get movie to finish within loop -

i want movie play there objects in array, want make sure movie has finished playing each time. here's -simplified- code i'd expect that: - (void)loopthrougharray { [array enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { nslog (@"index = %i", idx); movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:movieplayercontroller]; [movieplayercontroller play]; }]; }]; } - (void) movieplaybackdidfinish:(nsnotification*)notification { movieplayercontroller = [notification object]; [[nsnotificationcenter defaultcenter] removeobse

rust - Can I mark a function as deprecated? -

i'd mark functions/methods deprecated. tried apply deprecated attribute: #[deprecated] fn old_way_of_doing_it() { but yields error: error: stability attributes may not used outside of standard library is there way in can have compiler warn consumer of library function deprecated? i have no experience, i'm considering experimenting compiler plugins , custom attributes, guess require consumer use plugin, maybe unreasonable (or may unreasonable amount of work me implement?) as side question out of curiosity, why deprecated attribute applicable standard library? since rust 1.9.0 (2016 may 26th) can use #[deprecated] attribute in own crates ( rfc 1270 ). syntax is: #[deprecated(since="0.5.0", note="please use `new_method` instead")] pub fn old_method() { ..; } it throw following warning whenever use old_method : <anon>:6:5: 6:15 warning: use of deprecated item: please use `new_method` instead, #[warn(deprecated)] on defa

java - I made a function that uses graphics and I wanted to call it in the main it did not work -

the main: public class appmain { public static void main(string[] args) { // todo auto-generated method stub app a1 = new app(); jframe f2 = new jframe(); f2.getcontentpane().add(a1); f2.addwindowlistener(new windowadapter() { public void windowclosing(windowevent we) { a1.stop(); a1.destroy(); system.exit(0); } }); f2.setvisible(true); f2.setsize(200, 200); a1.setbackground(color.white); //the function //a1.drawbow(null, 40, 40, color.black); a1.drawbow(a1.getgraphics(), 40, 40, color.black); } the app class: public class app extends applet{ int x1,y1,x2,y2; public void paint(graphics g1) { g1.setpaintmode(); g1.setcolor(color.blue); g1.drawstring("hello!", 50, 50); g1.setcolor(color.red); g1.drawstring("hello!", 51, 51); g1.setcolor(color.red); g1.draw3drect(80, 70, 20, 20, tru

hadoop - Importtsv command does not work in Hbase1.0.1.1 -

i trying import tsv file hbase table. using following command: hadoop jar /usr/local/hbase-1.0.1.1/lib/hbase-it-1.0.1.1.jar importtsv -dimporttsv.columns=hbase_row_key,a,b '-dtable_name.separator=\t' table-name /path-to-input-file it gives me following error: exception in thread "main" java.lang.classnotfoundexception: importtsv @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ java.lang.classloader.loadclass(classloader.java:358) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:274) @ org.apache.hadoop.util.runjar.run(runjar.java:214) @ org.apache.hadoop.util.runjar.main(runjar.java:136) have added guava jar

javascript - Expanding search bar does not search after closing and reopening it, Jquery -

i'm creating expanding search bar. i'm using demo base : http://codepen.io/nikhil/pen/qcygf/ the searchbar works if open it, write in input , click on button again but if open it, write in input, close clicking outside of search bar open again; clicking on button close searchbar again. how can change code in way if close , reopen searchbar it'll search on click on button ? html: <div class="container"> <form class="searchbox"> <input type="search" placeholder="search......" name="search" class="searchbox-input" onkeyup="buttonup();" required> <input type="submit" class="searchbox-submit" value="go"> <span class="searchbox-icon">go</span> </form> detailed tutorial on thecodeblock css: body{ background:#475f77; } .container{ width:600px; margin:50px auto; } .searchbox{ po

Managing an enum within a PFObject - iOS Swift/Parse -

i'm new parse , swift. i have app people play against each other. i want create activity feed game results, cheers, heckles (anything really) can show in list. my thought create activity class subclasses pfobject , i'd have enum activitytype determine kind of activity being created. can set activity object in parse , pfobject in swift each activity set correct activitytype? my thinking need "type" column in parse that's number , init method reads number , sets correct type. does sound right? thanks you use type column in parse, though i'd expect each of different kinds of feed item different classes in parse have different data , relationships, use class type (name). in either case way identify type coming server. once have want organised , common approach displaying feed items. should have protocol defines feed item needs provide in order displayed on feed. have set of classes, each conforming protocol, , each dealing 1 of differ

mysql - Best Practice for synchronized jobs in Application clusters -

we have got 3 rest-applications within cluster. each application server can receive requests "outside". now got timed events, analysing database , add/remove rows database, send emails, etc. the problem is, each application server start timed events , happens 2 application server starting analysing job @ same time. we got sql table in back. our idea lock table within sql database, when starting job. if table locked, exit job, because other application started analyse. what's practice insert kind of semaphore ? any ideas ? don't use semaphores, on complicating things, use message queueing, queue tasks , them executed in row. make 1 separate node/process/child_process consume queue , task done.

Verifying XML Signature in Powershell with PEM Certificate -

i trying create powershell script consume data in xml document. however, prior doing work need verify xml hasn't been tampered verifying signature. i have copy of public key cert used sign xml in pem format, can not figure out how powershell use cert. the closes have come getting work following code... $path = "data.xml" $xmldata = new-object xml.xmldocument $xmldata.preservewhitespace = $true $xmldata.load($path) add-type -assemblyname system.security $signedxml = new-object system.security.cryptography.xml.signedxml -argumentlist $xmldata $xmlnodelist = $xmldata.entitiesdescriptor.signature $xmlnodelist $signedxml.loadxml($xmlnodelist) $certpath = "cert.pem" $check = $signedxml.checksignature($certpath, $true) however, when runs following exception... exception calling "checksignature" "2" argument(s): "signaturedescription not created signature algorithm supplied." @ line:34 char:1 + $check = $signed

redirect - Nginx redirecting before HSTS certificate error -

so issue i'm having seems cert cacert.org , hsts set if visit www.domain.com error, while if visit domain.com (no-www) certificate fine. what i'd redirect www no-www (you can't have wildcard certs cacert) seems being interrupted because browser's been website hsts enabled before, loads www.domain.com website , throws lovely great error onto page. , of course because hsts in use there's no way bypass certificate error! informs issue should temporary. respectively in firefox , chromium: this site uses http strict transport security (hsts) specify firefox connect securely. result, not possible add exception certificate. and you cannot visit www.domain.com right because website uses hsts. network errors , attacks temporary, page work later. i'm open suggestions! thought redirecting www no-www best answer, if can suggest else i'm listening (second certificate www perhaps? seems little overdoing it).

ios - ScrollView unable to display image which passed from another VC -

i need display image pass in viewcontroller first,i have tested using imageview display image , works below: thanks. appreciated. class viewcontroller: uiviewcontroller, uiscrollviewdelegate { @iboutlet weak var tempimgview: uiimgeview! var passinimg: uiimage? override func viewdidload() { super.viewdidload() tempimgview.image = passinimg! } when use uiscrollview ( scrolling large passinimg) , below code not working probelm: error : fatal error: unexpectedly found nil while unwrapping optional value but have tested pass in image in above code. what need done scrollview? should used in viewdidload? class viewcontroller: uiviewcontroller, uiscrollviewdelegate { @iboutlet weak var myuiscrollview: uiscrollview! var myimgview: uiimageview! var passinimg: uiimage? override func viewdidload() { super.viewdidload() self.myuiscrollview.maximumzoomscale = 10.0 self.myuiscrollview.min

c# - Can PagedList be used to automatically switch pages? -

i using asp.net-mvc , have pagelist https://github.com/troygoode/pagedlist in project, works fine able switch pages automatically on set time interval. pages using have set number of accordion items , wanted know how switch page number without human interaction. use slideshow pagedlist. there better use or possible? my index.cshtml @model pagedlist.ipagedlist<computerdowntimetracker.models.dashboardticketlistvm> @using pagedlist.mvc; <body> <div class="list1"> <div id="accordion"> @foreach (var item in model) { <div class="header"> <b> equipment: </b>@item.computername <br /> <b> location: </b>@item.location @switch (item.runningstatus) { case 1: imagepath = down; break; case 2: imagepath = running; break

c# - Why does using .Date with EF work sometimes, but not others? -

vs 2013, ef6 code first i'm using code , works fine: var timeslots = vehicle.vehicletimeslots.where(t => t.createdate.date <= currentdate.date && (t.deletedate == null || t.deletedate.value.date > currentdate.date) && t.dayofweek == dayofweek).orderby(t => t.starttime); however, if try runtime error "the specified type member 'date' not supported in linq entities. initializers, entity members, , entity navigation properties supported." ( db instance of dbcontext): var previousreservation = db.reservationtimeslots.singleordefault(t => t.reservationdate.date == reservationtimeslot.reservationdate.date && t.vehicletimeslotid == reservationtimeslot.vehicletimeslotid); there's many other questions issue , know can use dbfunctions.truncatetime() in latter bit of code (which doing). guess difference first bit of code operating against vehicle entity object while second bit of code operating dir

php - where clause returns empty set even when using trim -

i have tried on , on simple query work. part of login sequence, time use 'where' clause returns empty set. example select email, password `users` will work. fails : select email,password `users` email='stevebushe@gmail.com' using trim or using replace() make sure there no spaces,line breaks or returns. i'd appreciate help, little problem has held me days. solved it. issue quotation marks. used concat , trim change values in 'email' column , works.

angularjs - How to bind ng-model to the "value" of selected item for ui-select -

please check out following plunk: http://plnkr.co/edit/fc9xcyyygtak0agvv35t?p=preview <ui-select ng-model="fm.countrycode" id="countrycode"> <ui-select-match placeholder="select country...">{{$select.selected.label}}</ui-select-match> <ui-select-choices repeat="item in countries | filter: $select.search" value="{{$select.selected.value}}"> <div ng-bind-html="item.label | highlight: $select.search"></div> <small ng-bind-html="item.value | highlight: $select.search"></small> </ui-select-choices> </ui-select> i'm trying ui-select set fm.countrycode value of selected item. it's setting fm.countrycode whole country item. example if select afghanistan, fm.countrycode set {"value":"af","label":"afghanistan"}. want "af". do have set $watch achieve or ther

angularjs - Number filter filters number down to two decimals, but does not display it that way -

Image
this see: the value set @ 160.90 , displays 160.8999999999 etc. <input class="form-control" ng-model="imprint.total" value="{{imprint.total | number:2}}" readonly> it goes through filtering of inputs total, it's price multiplied quantity. the value in value attribute overridden ng-model directive when sets viewvalue renders. have readonly textbox remove ng-model it. <input class="form-control" value="{{imprint.total | number:2}}" readonly> with ng-model , format live data entry need create directive , use parsers/formatters format value. angular.module('app', []).directive('format', ['numberfilter', function(numberfilter) { return { restrict: 'a', require: 'ngmodel', link: function(scope, elm, attr, ngmodel) { var decplaces = attr.format || 2; function formatter(value) { if

asp.net mvc 5 - EditorTemplates Where or Groupby on Questionnaire -

Image
at moment, have working prototype questionnaire multiple questions , each question having multiple choices answer. displays , saves great. however, group question/answers 'sections' on edit view. have tried couple different methods nothing seems work correctly. working code without sections follows: edit view progress report: <div class="form-group"> @html.labelfor(model => model.reportanswers, htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.reportanswers) </div> </div> reportanswers.cshtml (editor template) <h3> question </h3> <p> @html.displayfor(x => x.question.questiontext) </p> @html.hiddenfor(model => model.questionid) @html.hiddenfor(model => model.reportid) @foreach (var answer in model.question.possibleanswers) { var id = string.format("answer-{0}", an

angularjs - Compile angular directive dynamically -

if add angular material directive md-button : angular.element( document.body ).append( '<md-button> material' ) it not recognize it's angular directive. question - how recompile scope/element not sure if should doing this, right way use $compile function: angular.element(document.body).append($compile('<md-button> material')($scope)) working plunker .

sql server 2008 - Writing date to SQL from php, date is changed -

i have code in php 5.4 creating record in sql server 2008 r2. php code creates date: $date = date("y-m-d"); which yeilds: '2015-06-23' that date used in query sql server: $insert = 'insert adattend (adenrollschedid, adenrollid, date, starttime, attend, absent, unittype, status, comment, excused, modflag, userid, dateadded, datelstmod, adclassattendid, type) values ('.$adenrollschedid.','.$adenrollid.','.$date.',\'1899-12-30 07:00:00.000\','.$present.','.$absent.',\'m\',\'a\',\''.$comment.'\',0,\'a\','.$instructorid. ','.$date.','.$date.','.$adclassattendid.',\'a\')'; the query seems work fine. record inserted should be. when check record in table dates are: '1905-06-23 00:00:00.000' so question is, why altering 2015 1905? insert escape quotes or use double quotes in single quotes

css3 - CSS backgroudn transition, what's wrong here? -

i feel cursed never background color transition correct , it's making me feel inadequate... it not transition between background colors, "blips" 1 next without transition @ all. doing wrong? <div class="flowitem"> test </div> .flowitem { -webkit-transition: background 1000ms linear; -moz-transition: background 1000ms linear; -ms-transition: background 1000ms linear; -o-transition: background 1000ms linear; transition: background 1000ms linear; } .flowitem:hover { background-image: -moz-linear-gradient(top, #e0ffff, #87ceeb); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, #e0ffff), color-stop(1.0, #87ceeb)); } jsfiddle background images can't “transitioned” other properties: should intermediate value of background-image during transition? as workaround apply background pseudoelement, position: absolute , negative z-index . can show pseudoelement animating

python - What is the correct way to solve this circular import error with a Flask blueprint? -

i had problem circular import, moved blueprint import below app definition. however, i'm still having import error. traceback (most recent call last): file "/applications/pycharm ce.app/contents/helpers/pydev/pydevd.py", line 2217, in <module> globals = debugger.run(setup['file'], none, none) file "/applications/pycharm ce.app/contents/helpers/pydev/pydevd.py", line 1643, in run pydev_imports.execfile(file, globals, locals) # execute script file "/users/benjamin/documents/projects/website/server/app/app.py", line 15, in <module> views import site file "/users/benjamin/documents/projects/website/server/app/views.py", line 2, in <module> models import user file "/users/benjamin/documents/projects/website/server/app/models.py", line 3, in <module> database_setup import db file "/users/benjamin/documents/projects/website/server/app/database_setup.py", line

How to prevent Google Forms from converting form input to scientific notation format -

i have simple script set sends emails based on google form entries using script-based vlookup contact emails. in cases, google forms converts longer numbers entered form field scientific notation. workaround have been using enter apostrophe before number - reason keeps cell formatted plaintext. find solution not require step. the sheet has form single field, egcs. egcs field can contain combination of letters , numbers , may multi-line string. script sends email user onformsubmit egcs field entry in body of email. problem arises when try submit long string numbers , form entry variable converted scientific notation. i need whatever user enters in egcs field appear entered on both responses 1 sheet , in body of email sent. here code: function onformsubmit(e) { var egcs = e.values[1]; var email = session.getactiveuser().getemail(); //replace google sheets formatted line breaks html line breaks display in email: egcs = egcs.replace(/\n/g, '<br>'); //sen

javascript - LinkButton.Text coming undefined in js -

i want configure hyperlink close/open related div in asp.net. basically, when user clicks sign x, panel should closed , sign + should appeared. when + clicked, panel should showed again. not manage , believe main problem "document.getelementbyid('<%= lb_closepanel.clientid %>').value" coming undefined. here code until now. appreciate helps! <!doctype html> .... <div class="appheader"> <h1 class="appheadercontent">search client</h1> <div id="checkbox"></div> <div id="closepanel"><h2 id="lblclosepanel">close panel</h2> <div id="xbutton"> <asp:linkbutton onclientclick="closeopenpanel('search')" runat="server" text="x" style="text-decoration:none; color:white" id="lb_closepanel"></asp:linkbutton> </div> &

android - Httpclient execute always fails after second time (IOExpception, socket timeout) -

anyone sees reason? there doesn't seem problems server, can send curl requests time. socket timeout exception after second time try query server. if restart application starts working first time , stops. string params = string.format(params); httpparams httpparameters = new basichttpparams(); defaulthttpclient httpclient = new defaulthttpclient(httpparameters); int connectiontimeout = 1000; httpconnectionparams.setconnectiontimeout(httpparameters, connectiontimeout); int sockettimeout = 1000; httpconnectionparams.setsotimeout(httpparameters, sockettimeout); httppost httppost = new httppost("http://example.com"); httppost.setheader("content-type", "application/json"); httppost.addheader("cookie", cookie);; try { httppost.setentity(new stringentity(parameters, "utf-8")); } catch (unsupportedencodingexception e) { return ("error_unsupportedencodingexception"

get textbox id and value from serialize() jQuery -

it possible textbox id , value serialize() form using jquery? i have code: var datastring = jquery('#form_name').serializearray(); var id = ''; txtcalrev_list = ''; jquery.each(datastring, function(i, field){ id = field.attr('id'); txtcalrev_list = txtcalrev_list + (field.value + "_" + id + ","); }); alert(txtcalrev_list); // values all suggestions welcome , appreciated, thanks. i'm not sure version of jquery you're using, if you're wanting comma delimited string entries in format [value]_[id], try code: var datastring = $('#form_name').serializearray(); txtcalrev_list = ''; $.each(datastring, function (i, field) { if (field.name.indexof('txt') == 0) txtcalrev_list = txtcalrev_list + (field.value + "_" + field.name + ","); }); alert(txtcalrev_list); try approaching using name property. weed out other objects not prefixed 't

python - Trying to download data from URL with CSV File -

i'm new python , have question why following code doesn't produce output in csv file. code follows: import csv import urllib2 url = 'http://www.rba.gov.au/statistics/tables/csv/f17-yields.csv' response = urllib2.urlopen(url) cr = csv.reader(response) row in cr: open("auscentralbank.csv", "wb") f: writer = csv.writer(f) writer.writerows(row) cheers. edit : brien , albert solved initial issue had. however, have 1 further question. when download csv file have listed above in " http://www.rba.gov.au/statistics/tables/#interest-rates " under zero-coupon "interest rates - analytical series - 2009 current - f17" , f-17 yields csv see has 5 workbooks , want gather data in 5th workbook. there way this? cheers. @albert had great answer. i've gone ahead , converted equivalent python 2.x code. doing bit work in original program; since file csv didn't need special work turn csv. import ur

c# - How to successfully implement WPF textbox validation? -

i'm trying implement should simple textbox validation wpf application, i'm having problems. i used guide: http://www.codeproject.com/tips/690130/simple-validation-in-wpf my textbox in mainwindow.xaml: <textbox x:name="textbox1" horizontalalignment="left" height="23" margin="93,111,0,0" textwrapping="wrap" verticalalignment="top" width="120" style="{staticresource textboxinerror}" validation.errortemplate="{staticresource validationerrortemplate}"> <textbox.text> <binding path="name" updatesourcetrigger="propertychanged"> <binding.validationrules> <local:namevalidator/> </binding.validationrules> </binding> </textbox.text> </textbox> my namevalidator class in mainwin

swift - How can I implement the scrolling found in Transit on the App Store? -

i'd implement way scroll content similar this ios app in app store, i'm not sure how type of scrolling called. specifically, i'd able have view can drag on view, how can drag list of transit options on map view. need start off using uiscrollview accomplish this?

Primefaces datatable header alignment with scrollbar -

Image
i'm facing strange behaviour of primefaces (v.5.1) datatable. have datatable srollable=true: <p:datatable var="_udf" value="#{unitadifornituralist}" scrollheight="350" livescroll="true" scrollrows="20" scrollable="true" id="risultati" widgetvar="risultati"> when there lots of items scrollbar shown , header correctly aligned: when there 5 items scrollbar doesn't appear , header correctly hide gap on right scrollbar: the strange thing when have more 5 items not enough show scrollbar. in case header shows gap , it's not aligned: any ideas? thank you

AngularJS populating an object in a factory that is accessible throughout the website -

i have user factory has object called userproperties populate when user logs in system. function named login() called calls function named set() "sets user", or populates userproperties object. user.factory.js (function () { 'use strict'; angular .module('app') .factory('user', user); /* @nginject */ function user($http, authtoken, $q, $state) { var userproperties = {}; return { login: login, logout: logout, set: set, isset: isset, get: get, isloggedin: isloggedin }; function login(email, password) { return $http.post('/api/login', { email: email, password: password }).then(function (response) { authtoken.settoken(response.data.jwt); set(response.data.user); return response; });

javascript - How to append data to dynamic array and use the array in dropbox saver api? -

i created few buttons , onlick of button url , filename send dynamic array , when click dropbox saver button want saver function uses dynamic array send files dropbox. current code gives me error: missing files.see documentation. its seems didnt save data correctly array , didnt pass correctly saver funciton. 1 me fix problem.thanks note: want use dynamic array instead of hardcoded url , filenames shown here: edited: add options.files = files; before calling dropbox.save , declared array outside addtoarray function . error:g undefined @ dropins.js(line 1). files: [ {'url': '<?php echo $imagepath1_value; ?>', 'filename': '1.jpg'}, {'url': '<?php echo $imagepath2_value; ?>', 'filename': '2.jpg'}, {'url': '<?php echo $imagepath3_value; ?>', 'filename': '3.jpg'}, ], dropbox api js: <script type="text/javascript" src

navbar - [CSS]How to make it move to the top? -

i'm sorry, newbie designer. want ask something, how make background color move top? still split white space(the top of background color) <!doctype html> <html> <head> <style> body{ margin: 0px; padding: 0px; } #navbar{ position: relative; background: #004f6b; height: 100px; color: white; } li{ list-style-type:none; display:inline; } #navbar > ul > li#title{ position: absolute; left: 5px; } #navbar > ul > li#homeicon{ position: absolute; left: 610px; } #navbar > ul > li#search{ position: absolute; right: 300px; } #navbar > ul > li#profile{ position: absolute; right: 5px; } </style> </head> <body> <div id="navbar"> <ul> <li id="title">title</li> <li id="homeicon">icon</li> <li id=&

social networking - getting email from javascript API in VKontakte -

i working on javascript sdk implement vk connect on website. everything working except i'm not able user's email. here call make : vk.auth.login(function(response) { console.info(response); }, 4194304); the number "4194304" bit maks of email mentionned here : https://vk.com/dev/permissions in response didn't manage receive email. didn't find method can return email in vk documentation. is has faced problem? thanks lot! it possible email oauth token. it's complicated reason. https://vk.com/dev/auth_sites email auth permission code: email (+4194304) user e-mail access. available sites. so question: how email address vk.api? if understand russian: https://toster.ru/q/94065

asp.net mvc 5 - MvcSiteMapProvider MVC5 External URL Re-routing to Home Controller / Index Method -

i'm using mvcsitemapprovider 4.6.18. many of menu items link external sites; however, "url" attribute of mvcsitemapnode not being carried on menu. is, can see url in source, link referring parent mvcsitemapnode controller , action , not url specified. here's relevant code: <?xml version="1.0" encoding="utf-8" ?> <mvcsitemap xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://mvcsitemap.codeplex.com/schemas/mvcsitemap-file-4.0" xsi:schemalocation="http://mvcsitemap.codeplex.com/schemas/mvcsitemap-file-4.0 mvcsitemapschema.xsd"> <mvcsitemapnode title="home" controller="home" action="index"> <mvcsitemapnode title="about" url="http://www.amazon.com"/> </mvcsitemapnode> </mvcsitemap> and here's see when viewing source: <li> <a href="/"><span class="menu-text"&

wcf - Update individual instance of Azure Cloud Service -

i have cloud service hosted out in azure. due amount of data uses, have hourly process tells service cache data memory. update cache, use exposed method called "refreshdata" invoke on scheduled task on local server. recently updated cloud service run on 2 instances (meaning running on 1 vm, running on 2). what im noticing our data no longer automatically refreshing current data. seems happening here is: a scheduled task run command executable triggered @ top of hour on local server the exe calls out http://mycloudservice.cloudapp.net/service.svc , gets response, , kicks off refreshdata method the instance received refresh request "random", meaning 1 of 2 instances told refresh data. therefore, user using our service gets current data, can few hours stale. so if have cloud service responds ip, there 2 instances running "behind it" individual ip's, how can invoke request , ensure both getting updated needed? ps - i'm aware azure

Android countdown timer in service -

i have count down timer in service. when stop service, countdown timer still count? mean onfinished method called if service has been stopped? countdown timer runs in different thread , callbacks executed on ui thread. hence need manually cancel timer whenever service stopped. can follow hiren's answer.

osx - How can I customize the behavior of the green 'expand window' button so that it only maximizes (instead of taking over the entire screen)? -

Image
i upgraded macbook pro yosemite , new behavior of green window button driving me nuts. want expand window maximum size (and keep menu bar showing). new default behavior totally take on screen, much, find disorienting. want go way mavericks did it. try doing alt+shift+maximise . also pixelfairy finding [bettertouchtool](http://www.boastr.de/) change zoom button maximize behavior.

java - javaBegginer - how to counts from 10 to 0 using while/do while -

i started learning java , can't solve this: i want code program counting 10 0 using "do while" , show numbers 9 1. did this: public class exwhile { public static void main(string[] args) { int = 10; { --a; system.out.println(a); } while (a==1); } } why wont working? your loop saying "while equals 1" stuff. since isn't initialized 1, it's going through do-while loop once. what want while(a != 0) or can while (a > 0) print 10 thru 0.

resources - How to make Puppet track TCP ports to avoid conflicts? -

my puppet master has modules many different services (mysql, redis, jenkins, beanstalk, etc.). each module seems have own way of defining port(s) service listens on. there unified way track tcp ports across puppet modules? think there should resource type, file , enforces global uniqueness, don't see appropriate in puppet docs the idea if accidentally configure 2 different services listen on same port, should error conflict when compiling catalog, not when second service restarts on node , gets eaddrinuse. if want catch conflicts, can create defined type . example: define port ( $port = $name ) { } you can use signal port being used (eg port { 8080: } ) , puppet fail compile catalog if same port defined twice.

android - Share info between two processes - what's the safest way? -

i have app 2 processes - mainactivity , background service . need same information in both, , info comes server (a json response). loading json both processes, json may bigger it's pretty inefficient load twice. what safest or best practice share info? broadcast , copy json mainactivity service - assume safe practice , broadcast won't lost use sharedpreferences store locally , both consume "local" json until app closed. according this question sharedpreferences works fine between processes. any other suggestion/recommendation appreciated. thanks in advance! most common way sending broadcast , should avoid using singletons, more information see link android , restful services it's better take @ event bus as doc says : simplifies communication between components decouples event senders , receivers performs activities, fragments, , background threads avoids complex , error-prone dependencies , life cycle issu

vba - Inserting, searching, copying, pasting across 2 spreadsheets in Excel -

i thought i'd able figure out based off analysis of similar code had written else, code isn't forte. diving vba without guidance has proved daunting me proceed. forgive terminology if use wrong language, i'm happy learn , corrected. this shouldn't difficult knows they're doing, don't @ all. i'm trying create macro enabled workbook following: open "data.csv" folder called "data" in same directory macro. we'll call workbook - wba. insert column on wba after column c titled "group image name." column d want data end up. open "groups.csv" folder called "groups" in same directory macro. we'll call workbook b - wkb. (this next part needs loop starts @ c1 on wba , proceeds down column until end of spreadsheet) copy value selected cell in column c on wba search column c on wbb copied value. when found, move selection on corresponding cell in column a. (if c2, a2) copy contents of col

python - How do I get flask-cor to return Access-Control-Allow-Origin on Google App Engine? -

my python app not throw errors on google app engine, allow-control-access-origin header never sent. how can ensure sending flask-cors? import mysqldb import os import webapp2 import json import flask flask import flask, jsonify, render_template, request flask.ext.cors import cors, cross_origin app = flask(__name__) @app.route('/') @cross_origin() def do_search(): if (os.getenv('server_software') , os.getenv('server_software').startswith('google app engine/')): db = mysqldb.connect(unix_socket='/cloudsql/my-instance-name:storeaddressdb', db='store_locator', user='myuser', passwd='password') else: db = mysqldb.connect(host='localhost', user='root') cursor = db.cursor() query = 'select * stores 1 limit 5' cursor.execute(query) resp = jsonify(data=cursor.fetchall()) return resp db.close() it appears code work, although not see allow-control-access-orig

angularjs - trying to use ng-class with multiple conditions -

i'm trying set ng-class work on div 2 conditions: ng-class="(accounts.length == 1 && account.cardname =='cash') ? 'one-dash-cash' : ''" and ng-class="(accounts.length == 1 && account.cardname =='points') ? 'one-dash' : ''" what's best way accomplish this? i've read shouldn't have logic in html, i'm not sure how this. thanks in advance.. ng-class="{'one-dash-cash':accounts.length == 1 && account.cardname =='cash','one-dash':accounts.length == 1 && account.cardname =='points'}"

node.js - Passing variables into a query in mongoose in the first argument -

i using mean stack, have entry in mongodb { "_id" : objectid("5577467683f4716018db19ed"), "requestmatrix" : { "1698005072" : { "rideid" : "641719948", "status" :"accepted" },"1698005073" : { "rideid" : "641719545", "status" :"rejected" } }, "partners":[ { "customernumber" : 1698005072 }, { "customernumber" : 1698072688 } ]} i want query db return me entire document based on whether status accepted or rejected. when run below query in command prompt, expected answer db.joinedrides.find({'requestmatrix.1698005072.status':"accepted"}) but when want same nodejs, stuck number 1698005072 in above query variable, not able write query that. tried this var criteria = "'requestmatrix.'"+customernumber+"'.status'"; joinedride.find({criteria:"accepted"},

Rails route: redirect to external url -

this question has answer here: creating rails route external url 2 answers how can redirect home root external url? have backend website , want redirect index website (and on domain). i'm using rails 4: root to: redirect('http:xxxx') works? the following line redirect external url. root to: redirect("http://www.stackoverflow.com/")

F# I want to filter my output -

i have problem have simplified purpose of question. let's have 2 lists. first actually represents list of classes but purpose, let's represents list of ints (2,4,6,8,10). have list of ints represents flags, indicating if wish include/exclude corresponding values first set. (it's not best example should suffice helping me solve real problem.) let set1 = [2;4;6;8;10] let set2 = [1;0;0;1;1] my desired output set is: [2;8;10] this code: let solution = list.map2 (fun b -> match b | 1 -> | _ -> 0 ) set1 set2 this renders following output: val solution : int list = [2; 0; 0; 8; 10] how can filter out these undesired zeros? instead of | _ -> 0 ideally want return null , filter out nulls. your appreciated! this 1 seems reasonable easy: let filterwith set2 set1 = list.zip set1 set2 |> list.filter (fun (_,x) -> x=1) |> list.map fst usage: let set1 = [2;4;6;8;10] let set2 =

multithreading - Return from asynchronous request in for loop -

i’m trying data restapi, i’m getting array of integers (which id’s other users), want loop through array , download data other customers. simplified version of code show below. func asyncfunc(completion: (something:[int])->void){ //get json array asynchonous restapi let jsonarray = [1,2,3,4,5] var resultingarray:[int] = [] mything in jsonarray{ anotherasyncfunc(mything, completion: { (somethingelse) -> void in resultingarray.append(somethingelse) }) } } func anotherasyncfunc(data:int, completion: (somethingelse:int)->void){ //get more jsondata restapi/data let myloadeddata:int = data*13356 completion(somethingelse: myloadeddata) } how make asyncfunc return array items has gotten second (inner) async request. i have tried getting count of array first requested rest api , “blocking” ui thread using while loop see if “new” array has collected data (the count equal count of first requested array). has 2 major disadvantages, blocks ui thr