Posts

Showing posts from April, 2014

android - Credentials are changed from other device -

i newbie android. working on application user supposed login use application , application can run on different devices (like multiple phones) simultaneously. there feature user can changes password. how know if user has changed login credentials on device device, user automatically logged out devices. same gmail. how achieve in optimal/feasible way. can implemented using sync adapter or account authenticator. if yes, please let me know. any tutorial or snippet appreciated. thanks in advance.

javascript - How can I make a function that calls another function every 60 seconds? -

i have function: isauthenticated = (): boolean => { xxx }; i using angularjs , know how can make function such keepcheckingauthentication() that call authenticated() function every 60 seconds? you can use $interval function (wrapper of window.setinterval() in angularjs)? the documentation of $interval function here in case keepcheckingauthentication() function , can adjust other parameters accoding needs? help? example: $interval(myfunctionatinterval, 5000) // scheduled every 5 seconds, instance funtion myfunctionatinterval() {...}

Failing to install android studio on windows 8.1 -

Image
i have downloaded android studio exe file several times , while installing gives error enter image description here i have tried several times don't know problem.can't use android studios in windows 8.1? dev work stuck.. please help you should try , install android sdk manager first. run administrator , download latest build tools. install android studio , provide location of android sdk folder during or after install.

jquery ui - Knockout and JQueryUI binding does not call update callback -

when creating foreach binding custom one, "update:" callback not being called when pushing new element view model. however, new span(not accordion) item creating. <div data-bind="foreach:items, koaccordion: {}"> <div> <span data-bind="text: id"></span> </div> <div> <span data-bind="text: name"></span> </div> </div> the script: ko.bindinghandlers.koaccordion = { init:function(element, valueaccessor, allbindingsaccessor, viewmodel,bindingcontext) { console.log("initialization callback"); $(element).accordion(); }, update:function(element, valueaccessor, allbindingsaccessor, viewmodel, bindingcontext) { console.log("updating callback"); $(element).accordion('destroy').accordion(); } }; function item(id,name,description){ this.id = ko.observab

ruby on rails 4 - How to query ActiveRecord with having and group -

i have simple appointment model storing start_time , user_id. i'd appointments starting in next 7 days in ascending order , grouped day. ideally result hash or multidimensional array such as { '30 march' => [appt1,appt12, appt3], '31 march' => [appt5,appt2, appt7,appt8], '1 april' => [appt10,appt11,appt9, appt6,appt4], '2 april' => [appt15,appt21] } the query below gets desired results not in format want. appointment.order(start_time: :asc).where("start_time <= ?", 7.days.from_now.end_of_day) is there way structure query or need format result separately? one way group_by appointments = appointment.order(start_time: :asc). where("start_time <= ?", 7.days.from_now.end_of_day). group_by { |a| a.start_time.to_date }

Python Class __init__ Confirmation -

im trying understand python classes. little confused around defining __init__ . if have 4 functions created taking various input variables. have assign each variable in __init__ ? class thing: def __init__(self, arguments, name, address, phone_number, other): self.arguments = arguments self.name = name self.address = address self.phone_number = phone_number self.other = other def first(self, name): print self.name def arguments(self, arguments): print self.arguments def address(self, address, phone_number): print self.address + str(self.phone_number) def other(self, other): print self.other the above made please excuse pointlessness (arguably point illustrate question guess not pointless). no doubt im going loads of down marks question reason have been reading various books (learning python hard way, python beginners) , been reading various tutorials online none of t

php - warning in swiftMailer default time zone -

i using swiftmailer , working fine after sending mail gmail account, following warning message : warning: date(): not safe rely on system's timezone settings. *required* use date.timezone setting or date_default_timezone_set() function. in case used of methods , still getting warning, misspelled timezone identifier. selected timezone 'utc' now, please set date.timezone select timezone in /home/jaydeepkanada/public_html/ramienterprise.com/swiftmailertest/swiftmailer-5.x/lib/classes/swift/mime/headers/dateheader.php on line 119 can please assist me message, thank in advance...

java - Spring RestController - jQuery PUT works only when changing certain values -

hello , thank in advanced: i'm using spring 4 , jquery trying put data restcontroller. have 3 values passed controller: id, name, genre. reason, put request works every time change name field, if try update genre field, request never hits controller , fails 400: bad request. i'm totally stumped. get, post, , delete methods working fine too. i'm going include config stuff since there's possibility may issue... manage-artist.js (knockout , jquery): ... //update artist self.updateartist = function(artist){ self.clearmessages(); //put database $.ajax({ url: "../artist/" + artist.id(), method: "put", data: "id="+artist.id()+"&name="+artist.name()+"&genre="+artist.genre(), datatype: "json", success: function (data) { console.log("artist succesfully updated.")

javascript - html form - getting value from selected radio button -

i have created form , looking data user entered. javascript have, far pulls in data. having issue pulling data of selected radio button. read articles , 'name' needs sames doesn't work , if give unique 'id's selecting 1 or other radio buttons doesn't work. can't use jquery js var mynodelist = document.getelementsbyname('cf'); var myarray = []; // empty array (var = 0; < mynodelist.length; i++) { if(i<4) ( i; < 3; i++) { var self = mynodelist[i].value; myarray.push(self); } else if(i==4) myarray.push(document.getelementbyid('status').value); else if(i==5) myarray.push(document.getelementbyid('subscribe').value); else if(i==6) myarray.push(document.getelementsbyname('support')[i]); else if(i==7) ( i; < mynodelist.length; i++) { var self = mynodelist[i].value; myarray.push(self); } } cons

.htaccess - htaccess redirect with domain masking for Wordpress site not working -

the below .htaccess configuration not working on wordpress site achieve domain redirection masking: directoryindex index.php options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?redir2$ [nc] rewriterule ^ http://redir1%{request_uri} [l,ne,p] this .htaccess of redir2 redirecting redir1 masking. goal have user type in example redir2/sub , served content of redir1/sub , shown url of redir2/sub . it working fine on local installation. on shared hosting redirects without masking. assume problem might somewhere in server configuration. any ideas problem? just records here similar question asked when had problem index file when redirecting masking: htaccess redirect domain masking not working when requesting root directory wordpress canonical url functionality designed this. although plugin not actively supported anymore, might work. <?php /* plugin name: disable canonical url redirects plugin uri: http://www.

Why create a pointer in C when you can just point directly to the variable as a pointer? -

i'm learning c , came across example kind of seems creates unecessary step, again i'm new this. he created variable, , dedicated pointer point variable. understanding simple put * in front of variable , serve pointer it...so why use line of code create pointer? i'm talking why created pointer "*p" refer "x" vs saying *x point it. below sample code: #include <stdio.h> int main() { int x; /* normal integer*/ int *p; /* pointer integer ("*p" integer, p must pointer integer) */ p = &x; /* read it, "assign address of x p" */ scanf( "%d", &x ); /* put value in x, use p here */ printf( "%d\n", *p ); /* note use of * value */ getchar(); } that's right don't need pointer object. you program equivalent in behavior to: int x; scanf("%d", &x); printf("%d\n", x); getchar(); the

Laravel Elixir version rev-manifest incomplete on gulp default task -

i have gulpfile (using laravel elixir) set create 4 files. app.css app.js vendor.css vendor.js when run either gulp , or gulp default app.js not created. yet if run gulp watch , created perfectly. here elixir method: elixir(function(mix) { // register html watcher mix.templates() // compile app css .sass('app.scss', null, { includepaths: require('node-bourbon') .with(require('node-neat').includepaths) }) // concatenate vendor css .styles([ ... ], 'public/css/vendor.css', 'public/css/vendor') // minify & concatenate vendor js .scripts([ ... ], 'public/js/vendor.js', 'public/js/vendor') // minify , concatenate app js .scriptsin('resources/assets/js', 'public/js/app.js') // version compiled resources .version([ 'css/app.css', 'js/app.js', 'css/vendor.css

java - Where do I input values? -

java gurus, working on class assignment , given set of 2 programs. 1 calls on calculate interest rate, balances, etc bank account. having problems with, figuring out supposed input variables given successful compile our program. below 2 java files given. made adjustments correct purposeful errors in code compiles nicely far. public class bankaccount { private double balance; // account balance private double interestrate; // interest rate private double interest; // interest earned /** * constructor initializes balance * , interestrate fields values * passed startbalance , intrate. * interest field assigned 0.0. */ public bankaccount(double startbalance, double intrate) { balance = startbalance; interestrate = intrate; interest = 0.0; } /** * deposit method adds parameter * amount balance field. */ public void deposit(double amount) { balance += amount; } /**

Preferred way of patching multiple methods in Python unit test -

i need patch 3 methods ( _send_reply , _reset_watchdog , _handle_set_watchdog ) mock methods before testing call fourth method ( _handle_command ) in unit test of mine. from looking @ documentation mock package, there's few ways go it: with patch.multiple decorator @patch.multiple(mbg120simulator, _send_reply=default, _reset_watchdog=default, _handle_set_watchdog=default, autospec=true) def test_handle_command_too_short_v1(self, _send_reply, _reset_watchdog, _handle_set_watchdog): simulator = mbg120simulator() simulator._handle_command('xa99') _send_reply.assert_called_once_with(simulator, 'x?') self.assertfalse(_reset_watchdog.called) self.assertfalse(_handle_set_watchdog.called) simulator.stop() with patch.multiple context manager def test_handle_com

Is it possible to rotate shadow map in Three.js? -

i have plane ground rectangle rotated 90 degrees. , have directionallight cast shadow on plane. @ simple code example: var 3 = new function () { var scene = new three.scene() var camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, 1, 1000) camera.position.set(-380, 252, 420); camera.rotation.order = 'yxz'; camera.rotation.y = -math.pi / 4; camera.rotation.x = math.atan(-1 / math.sqrt(2)); var renderer = new three.webglrenderer() renderer.setsize(window.innerwidth, window.innerheight); renderer.shadowmapenabled = true var light = new three.directionallight(0xffffff, 1) light.position.set(150, 100, 100) light.castshadow = true light.shadowdarkness = 0.3 light.shadowcameravisible = true light.shadowcameraright = 50; light.shadowcameraleft = -50; light.shadowcameratop = 50; light.shadowcamerabottom = -50; scene.add(light); var ground = new three.mesh( new t

multithreading - Java - Stop thread with shared object -

i want use shared object stop threads. code wrote simple. the main method creates , starts threads, waits 800 ms, after that, sets attribute of shared object "false". the threads in busywait if attribute of shared object "true". the code doesn't work (an infinite loop occurs), seems there mutual exclusion problem can't explain, threads read attribute. can explain me this, please? :) main public class sharedresthreadext { public static void main(string args[]) { bodythread[] my_threads = new bodythread[5]; sharedrsrc sh_resource = new sharedrsrc(true); // shared object dec , alloc (int = 0; < my_threads.length; i++) { // creation , start threads my_threads[i] = new bodythread(sh_resource); my_threads[i].start(); } try{ thread.sleep(800); // wait 800 millisec sh_resource.setflag(false); //sets shared object attribute false } catch(interr

ios - Cant use Fast enumeration to fill sqlite table -

i have messages object called mastermessages. looks this: self.messages = ( "<lean: 0x7fcf98665140, objectid: vgle1uj5ki, localid: (null)> {\n messagebody = jj;\n recipientid = xvvxetqjph;\n senderid = xvvxetqjph;\n timestamp = \"1424991590106.210938\";\n}", "<lean: 0x7fcf98667940, objectid: rgbfybmklu, localid: (null)> {\n messagebody = \"test 3 ian\";\n recipientid = xvvxetqjph;\n senderid = hoy7ujlzoh;\n timestamp = \"1424631667110.638184\";\n}", "<lean: 0x7fcf98667f30, objectid: hb5uhwsysu, localid: (null)> {\n messagebody = \"test 2 user1\";\n recipientid = xvvxetqjph;\n senderid = vqzxwbdnal;\n timestamp = \"1424630904935.162109\";\n}", "<lean: 0x7fcf986685b0, objectid: doe2b9oq5b, localid: (null)> {\n messagebody = \"test 1\";\n recipientid = xvvxetqjph;\n senderid = xvvxetqjph;\n timestamp = \"1424630

arrays - Preferred way to break a forEach method in JavaScript -

this question has answer here: how short circuit array.foreach calling break? 23 answers i using foreach method in javascript sum elements in array. felt need break out of loop on conditions, example putting limit on sum calculated. have come following solution. point me if wrong. small edit this function foreach(a) { var sum = 0; var breakexception = {error:"stop it"}; try { a.foreach(function (v) { sum += v; console.log(sum); if(sum>5) throw breakexception.error; }); return sum; } catch(e) { if(e!=breakexception){ throw e; } } } foreach not supposed break. if 'd break foreach -like loop, try every or some , let break out of loop. a possible way re-write code be var sum = 0; yourarray.some(function (item) { if (sum > 5) { return true; } sum += item; })

calling perl script in bash to execute -

below how call perl script in bash function: getting: c:\cygwin\home\cmccabe\bashparse.sh: line 156: c:\users\cmccabe\desktop\annovar\ matrix.pl: command not found so must calling incorrectly. i provide full path .pl , input , output perl -e 'c:\users\cmccabe\desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt > "l:\ngs\3_business\matrix\torrent\matrix_"${id}".txt" the overall goal use ${id}.txt.hg19_multianno.txt input file , after perl script run on file (which adds columns , text , new file saved path l:\ngs\3_business\matrix\torrent\matrix_${id}.txt . path static path , never change, there better way not expert enough know. thank :). here perl script #!/bin/perl # format matrix import use warnings; use strict; ($debug); $debug = 0; $debug = 1; while (<>) { chomp; if ( $. == 1 ) { s/$/ index/; if ( $. == 2 ) { s/$/ chromosome position/; if ( $. == 3 ) { s/$/ gene/; if ( $. == 4 ) { s/$/ inhe

android - What does this log message mean? -

i trying connect google-plus using googleapiclient.when using sign-in-example. week ago worked, after installing 5.1, getting following error-message: could not find method android.content.pm.packagemanager.getpackageinstaller, referenced method com.google.android.gms.common.googleplayservicesutil.zzg what mean? take @ android open source tracker, known issue. https://code.google.com/p/android/issues/detail?id=91424 these warnings , harmless. regardless, of them fixed in next release.

android - How to nullify setColorFilter method? -

hey have image make black when activity starts using code img.setcolorfilter(new porterduffcolorfilter(color.rgb(0, 0, 0), porterduff.mode.src_atop)); want change normal when user clicks on button. idea on how nullify method? thanks you can remove colorfilter nulling it setcolorfilter(null); specify optional color filter drawable. pass null remove existing color filter. parameters cf color filter apply, or null remove existing color filter

php - foreach loop not giving required result -

i'm performing api request using php's curl library. output xml follows: <xml> <urlnext> <list> <list1> <list2> <list3> after getting output, i'm calling url inside urlnext again curl , similar output , on, if keep on getting urlnext in response call new url curl library. but loop calling first response urlnext not next ones. it's giving response first urlnext doesn't go next loop. please tell me how can modify loop. here's code: $dat1 = httpget($url); $xml2 = new simplexmlelement($dat1); foreach ($xml2 $array) { $url = $array->urlnext; $data = httpget($url); $xml2 = new simplexmlelement($data); foreach ($xml2 $array) { doing operations..... } } the httpget function performing curl request , returning xml expected. <?php function getdata($url){ // $dat1=httpget($url); $ch = curl_init(); curl_setopt($ch,curlopt_url,$url); curl_setopt(

android - Can't close Drawe in OnClickListener in my Adapter -

i can't close drawer in onclicklistener in adapter here onclicklistener private view.onclicklistener click=new view.onclicklistener(){ @override public void onclick(view v) { intent = new intent(); drlay.closedrawers(); // error !!! switch(getposition()) { case 1: i.setcomponent(new componentname(contxt,top.class)); i.setaction("android.intent.action.main"); i.addcategory("android.intent.category.launcher"); i.addcategory("android.intent.category.default"); v.getcontext().startactivity(i); break;} here logcat fatal exception: main java.lang.nullpointerexception @ com.example.myapplication.myadapter$viewholder$1.onclick(myadapter.java:77) @ android.view.view.performclick(view.java:4240) @ android.view.view$performclick.

java - Eclipse builds very slow -

hi using jar of hibernate,jersey , extended js framework in dynamic web project. every time build , takes lot of time. always hangs on 23%, , take time complete. please me speed up. here configuration file -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835 -product org.eclipse.epp.package.jee.product --launcher.defaultaction openfile --launcher.xxmaxpermsize 256m -showsplash org.eclipse.platform --launcher.xxmaxpermsize 256m --launcher.defaultaction openfile --launcher.appendvmargs -vmargs -dosgi.requiredjavaversion=1.6 -xms256m -xmx1g speed of build depends on parameters of computer, cpu working hard job done. if want faster build, need better hardware. recommend not use eclipse has no support anymore , swithing android studio

javascript - So is string object type or primitive type? -

this question has answer here: strings not object why have properties? 5 answers from javascript: definitive guide david flanagan javascript types can divided 2 categories: primitive types , object types. javascript’s primitive types include numbers, strings of text (known strings), , boolean truth values (known booleans). it states string primitive type. later on there example code var s = "hello, world" // start text. s.charat(0) // => "h": first character. s.charat(s.length-1) // => "d": last character. s.substring(1,4) // => "ell": 2nd, 3rd , 4th characters. s.slice(1,4) // => "ell": same thing s.slice(-3) // => "rld": last 3 characters s.indexof("l") // => 2: position of first letter l. s.lastindexof("l") // => 10: position of last letter l. s.in

c++ - Pthread Argument Passing -

i try create pthread , record time after running readin function when print time in main comes out incorrect value . i'm new threads , don't know if i'm passing arguments correct way. insight appreciated. int main(int argc, char **argv){ int read; pthread_t readerthread; readwrite arglist; arglist.filename= inputfile; arglist.rval=(retval *) malloc(sizeof(struct retval)); read= pthread_create(&readerthread, null, readin, (void *) &arglist ); cout << "total time reading: "<< (arglist.rval)->timeused << endl; } struct readwrite { string filename; retval * rval; } ; struct retval{ int frequency; double timeused; }; void * readin(void *arg) { struct timeval now, later; gettimeofday(&now, null); readwrite* alist = static_cast<readwrite *>(arg); retval *rval = alist->rval; string filename = alist->filename; ..... ..... ..... rval->frequency = dataset.size

debugging - C# Exceptions Not Being Handled -

the following code called via browser , if exception occurs exception never caught 'try catch' instead exception reported screen. have tried running without debug turning off clr errors. suggestions appreciated: public string geturl(string url) /*grab remote page */ { string target = string.empty; httpwebrequest httpwebrequest = null; httpwebresponse response = null; streamreader streamreader = null; try { httpwebrequest = (httpwebrequest)webrequest.create(url); response = (httpwebresponse)httpwebrequest.getresponse(); streamreader = new streamreader(response.getresponsestream(), true); target = streamreader.readtoend(); } catch (webexception e) { console.writeline("error:geturl()"); console.writeline("\n{0}", e.message); console.writeline("\n{0}", e.status); }

javascript - Nested foreach binding not displaying correctly -

i'm trying display observablearray within observablearray . it's simple todo list tasks assigned people , want display each persons tasks in there own div. i'm using knockoutjs 3.3.0 why aren't tasks showing under person? here's html: <div> <form data-bind="submit: addperson"> <p>new person: <input data-bind='value: persontoadd, valueupdate: "afterkeydown"' /> <button type="submit" data-bind="enable: persontoadd().length > 0">add</button> </p> </form> <form data-bind="submit: addtask"> <p>new task: <input data-bind='value: tasktoadd, valueupdate: "afterkeydown"' /> <select data-bind="options: people, optionstext: 'name', value:selectedperson"></select> <button type="submit" data-bind="en

c# - How to Retrieve Assembly information from within DLL -

i have asp.net asmx web site service, has assemblyinfo.cs inside properties folder. having trouble accessing information inside file. my assumption should able call assembly.getexecutingassembly(); and information file, other assembly. solve issue moved assembly attributes file global.asax.cs page. after doing calling above line returned me expected values. 1. have way or have on looked regarding assemblyinfo.cs file? this website has dll trying use information same assemblyinfo.cs. cannot figure out how information need within dll. assembly.getentryassembly() = null assembly.getcallingassembly() = mscorlib assembly.getexecutingassembly() = dll assembly 2. how can assembly information of site? using system.runtime.interopservices; using gatewayprotocol; using steno; [assembly: guid("3d5900ae-aaaa-bbbb-cccc-d9e4606ca793")] //if remove above line, below debug line **does not** return expected guid namespace gws { public class global : system.web.httpapplic

class - java generate th list of objects from database -

i have 2 classes: public abstract class entry { private static string list_query = "select * \"%s\""; . . . protected static <t extends entity> list<t> all(class<t> cls) { /*here want load whole database. each row create own object. example article(class below)*/ } } class article extends entry { . . . public static list<article> all() throws sqlexception { return entry.all(article.class); } } question how inside entry.all() method create article objects or object inherited entry? variants wrong: cls<t> instance_of_entity = new cls<t>();//wrong cls instance_of_entity = new cls();//wrong

angularjs - New to Protractor and difficulty with collecting Select options -

self teaching protractor , fighting issues of non angular web app , getting list of values out of select control. here html can't seem validate list. (first weight select box @ site) http://halls.md/body-surface-area/bsa.htm and failed syntax. script executes referencing element , option can't correctly evaluate capture of option values in list: var tempstr = browser.driver.findelement(by.xpath('//select[@name="wu"]')); //get options var tempstrs = tempstr.findelements(by.tagname('option')); console.log(tempstrs[1]); first of all, use element notation - @ least cleaner. if want see option text or value on console, need resolve promises: var weightunitselect = element(by.name("wu")); var options = weightunitselect.all(by.tagname("option")); options.first().gettext().then(function (text) { console.log(text); }); also, recommend abstract select->option html constructions of answer: select ->

pdo - PHP Custom Class, PayPal API, Mailgun API, Easypost API. Can they work together -

i have ecommerce site building client. site had worked fine using procedural functions , curl make calls paypal. download mailgun , easypost api manual , installed manually. down road, wanted update site utilize pdo & oop. have done fair job @ getting foundation laid. time start making calls various api's.i installed using composer , run dual autoloader. composer autoload , beneath custom autoload load classes. now, when call on paypal api, following error: fatal error: class 'paypal\rest\apicontext' not found in /var/www/html/myla-dev/shoppingcartfinalize.php on line 18 i think happening autoloader trying load rather composers autoloader. here autoloading occurring: init.php require __dir__.'/core/functions/general.php'; function autoloader ($class) { if (file_exists(__dir__.'/core/classes/'.$class.'.php')) { require __dir__.'/core/classes/'.$class.'.php'; } } spl_autoload_register('autoloader'); requ

oracle - no rows selected error after importin data into sql developer from excel ..csv file -

after importing data excel sql developer when type: select * table_name it says no rows selected whereas excel file has huge data (around 1000 records). please

sql - Can't save result set into variable in MySQL -

Image
i have problem saving result set data variable in mysql. expect select @var shows me result set show me last 1 row. here screenshot: is mistake or incomprehension of variable concepts in mysql? the value of variable @id changing every record. having last changed value. for saving id's product table can use group_concat this: select @id := group_concat(id) products; select @id;

python - How to pull information from a Json -

i wondering how use requests library pull text field in json? wouldn't need beautiful soup right? if response indeed json format, can use requests .json() access fields, example this: import requests url = 'http://time.jsontest.com/' r = requests.get(url) # use .json() json response data r.json() {u'date': u'03-28-2015', u'milliseconds_since_epoch': 1427574682933, u'time': u'08:31:22 pm'} # access field r.json()['date'] u'03-28-2015' this automatically parse json response python's dictionary: type(r.json()) dict you can read more response.json here. alternatively use python's json module: import json d = json.loads(r.content) print d['date'] 03-28-2015 type(d) dict

bash - Is there an advantage to using env for setting variable for a subshell? -

i came across samples set environment variable , launch subprocess in same command: $ test="test" sh -c 'echo $test" previously, had used env that: $ env test="test" sh -c 'echo $test" can point me @ explanation of first example? there advantage using env this? there few reasons use env . of time can (and should) use simpler syntax: var=value ... command which posix standard, , should available in posix compatible shell (including /bin/sh ). here few cases in env useful: the above syntax not work in csh (or derivatives), nor work in fish . in these non-posix shells, env required local environment modifications. the -i argument env starts indicated command environment containing only specified environment variables. can used run untrusted command without leaking information through environment variables. (but careful: environment variables must set normal functioning, starting path .) env resolves name of comma

grails - How to fix the totalCount of the list returned by the list method of the GORM query for a specified Criteria? -

i getting wrong result totalcount property of list returned list function of gorm query. i think due issue includes duplicate results. results returned in list correct count seems wrong. how can fix it? i tried following not work: trace.setresulttransformer(criteriaspecification.projection) following gorm query: def trace = trace.createcriteria() def results = trace.list(max:max, offset:offset) { createalias('module','mod', criteriaspecification.left_join) createalias('symbol','sym', criteriaspecification.left_join) createalias('fault', 'fault',criteriaspecification.left_join) createalias('fault.report', 'report', criteriaspecification.left_join) createalias('fault.tgmap', 'tg', criteriaspecification.left_join) createalias('tg.tracegroup16','tr', criteriaspecification.left_join) projections {

javascript - Prevent page scroll in angular model update -

i had interval refresh model in angular: $interval(function(){ itemsdata.getitemsdata().then(function(data){ $scope.items = data; }); }, 1000); data getted json api. , elements added page ng-repeat. on each second page scroll top. question is: how prevent it.

c++ - How can I enumerate available voices and languages using espeak API? -

i using espeak api c++ simple text speech synthesis embedded app. currently, have copied line basic example on how started: espeak_setvoicebyname("default"); this seems work fine, know espeak comes several voices in several different languages. how can enumerate , later select them using espeak api? the documentation espeak api headerfile itself. can find here . to enumerate existing voices, can use this: const espeak_voice **list=espeak_listvoices(0); espeak_voice *voice=0; for(;*list!=0;++list){ voice=*list; if(0!=voice){ //look @ voice parameters such has voice->name here } } later when have found voice want use, can set this: if(0!=voice){ espeak_setvoicebyproperties(voice); } the espeak_voice struct defined this: typedef struct { const char *name; // given name voice. utf8 string. const char *languages; // list of pairs of (byte) priority + (string) language (and dialect qualifier) cons

html - Set an initial value for a Javascript Count Down Timer -

i trying make countdown timer starts click of button. i have gotten work minutes , seconds cannot seem figure out how static time display prior button click. what wondering how time display on webpage above start button (in case 59 min 59 sec) , start countdown function once button hit? <head> <input type="button" onclick="countdown('countdown');" value="start" /> <script type="text/javascript"> var cdtime; var minutes = 59; var seconds = 59; function countdown(element) { cdtime = setinterval(function() { var timer = document.getelementbyid(element); if(seconds == 0) { if(minutes == 0) { alert(timer.innerhtml = "countdown's over!"); clearinterval(cdtime); return; } else { minutes--; seconds = 60; } } if(minutes > 0) {

html - Jquery scrolling on multiple hyperlink -

i'm working on singlepage website, choose keep header , footer fixed , got trouble while using hyperlink hashtag. got 4 links 4 parts of page, i want display content in middle, avoid datas hidden both header , footer. i have found code: jquery(document).ready(function($) { $(".scroll").click(function(event){ event.preventdefault(); $('html,body').animate({scrolltop:$(this.hash).offset().top}, 500); }); }); i can't make work own site. i put id <a name="timeline" class="anchor_title"><center><h1>our progress</h1></center></a> <a name="map" class="anchor_title"><center><h1>our gathering data</h1></center></a> does explain me how example catch name of each hyperlink , place on jquery code. the script found have make of href attribute : <a href="#timeline" class="anchor_title&qu

php - Every requests should contain a server IP -

i have file hosted on external web service - url: http://external-service.com/file.flv this file can download ip of web service. every visitor should can download file how while every visitor has other ip address ip of server? i use curl request curl going server, not visitor. can't use: echo $response_from_curl; because file large. server has max_execution_file - 450 seconds. it's not enough. i use: header("location: http://external-service.com/file.flv"); but in example, file can't downlaod because redirect visitor ip it's bad idea too. can hide real user ip in example , make request user browser using server ip? maybe know how can solve problem. thanks. your server has download file , show user correct headers. little example: <?php header("content-type: video/flv"); $file_url = "http://external-service.com/file.flv"; echo file_get_contents($file_url); ?> i recommend use curl. example curl:

php - Ignore some letters in a postcode search. e.g Database contains DT11 but user searches DT11 0QD. -

i have code below postcode search. table in database holds area postcode values such [dt11] user search complete postcode [dt11 0qd]. how modify below code ignore information , display result? <?php mysql_connect ("localhost","user","password") or die ("could not connect"); mysql_select_db("commun91_pres128") or die ("could not find database"); $output = ''; //collect if (isset($_post['search'])){ $searchq = $_post['search']; $searchq = preg_replace("#[^0-9a-z]#i","",$searchq); $query = mysql_query("select * ps_pcsearch firstname '%$searchq%' or lastname '%$searchq%'") or die ("could not search"); $count = mysql_num_rows ($query); if ($count == 0){ $output = 'there no search results'; }else{ while ($row = mysql_fetch_array ($query)) { $a = "your delivery day . . . ";