Posts

Showing posts from September, 2012

javascript - How do I call a server side VB.net function from jquery in an asp.net form? -

i trying call method in server-side vb code jquery. import system.web.services ... 'my vb.net code <webmethod()> _ public shared function submitreport_click() 'this code go return nothing end function in javascript code alert being called submitreport_click not being called. <asp:scriptmanager id="scriptmanager1" runat="server" enablepagemethods="true"></asp:scriptmanager> <script type="text/javascript"> $("#<%= fileinput.clientid%>").on('filebatchselected', function (event) { alert("file input"); pagemethods.submitreport_click(); }) </script> i'd make function fires on click event , calls on web method using ajax, , use json pass relevant data. $(".clickme").click(dowebmethod); function dowebmethod () { var data = { 'name': 'jessikwa' , 'location&#

ruby - Iterating through JSON data from external API in Rails -

i have function return_summoner_champion_list(name) return following json data when called [ { "id"=>"1", "name"=>"a" }, { "id"=>"2", "name"=>"b" }, , on... ] how iterate through json array , print out ids? i tried return_summoner_champion_list(name).each |list| puts list["id"] end but still returns same json data above without changes. i think you're looking array#collect not array#each : return_summoner_champion_list(name).collect{|l| l['id']} => [1,2, ...]

php - $_POST limitations in terms of number of fields -

my php version 5.4.16 i have form 2500 fields. sounds weird, have excel sheet. read sheet , display data in html table each cell has hidden field able post data , further. issue: $_post remains empty when post form 2500 fields. when delete fields or remove columns excel sheet results in less number of fields in $_post,then works fine. question: there limit in $_post number of fields being posted? its of these: max_input_nesting_level , max_input_vars , max_input_time , post_max_size increase them all, try like max_input_nesting_level = 9999 max_input_vars = 9999 max_input_time = -1 post_max_size = 9999m in php.ini

Route with out parameter works fine, but with parameter view is not working properly in Laravel 5 -

routes.php route::get('/viewprofile/{uid?}','usercontroller@viewprofile'); usercontroller.php public function viewprofile($uid){ if ($uid <> null) { $getuser = user::where('id','=',$uid)->first(); return view('user.profile')->with('getuser',$getuser); } } inbox.blade.php <a href="{{ url::to('viewprofile',[$msg->user->id]) }}"> {{$msg->user->username }} </a> when use route parameter profile.blade.php page design collapses, when use simple route route::get('/viewprofile','usercontroller@viewprofile'); it works fine. need help! in advance.

ios - iAd Banner takes up unnecessary space -

Image
i have table view iad banner @ bottom. when open page in app, iad expands take unneeded space. unsure of how rid of banner expansion wastes space in app. go storyboard , cant rap in iad , click height, make constraint height. way doesn't expand upwards.

c# - Better 64-bit byte array hash -

i need hash algorithm produces 64-bit hash code ( long ) fewer collisions string.gethashcode() , fast (no expensive calls cryptographic functions). here's implementation of fnv still shows 3% of collisions after testing 2 million random strings. need number way lower. void main() { const string chars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!#@$%^&*()_+}{\":?><,./;'[]0123456789\\"; const int n = 2000000; var random = new random(); var hashes = new hashset<long>(); int collisions = 0; for(int = 0; < n; i++) { var len = random.next(chars.length); var str = new char[len]; (int j = 0; j < len; j++) { str[j] = chars[random.next(chars.length)]; } var s = new string(str); if(!hashes.add(get64bithash( s ))) collisions++; } console.writeline("collision percentage after " + n + " random strings: " + ((doubl

selenium webdriver - How to find xpath from javascript href -

the scenario need check default elements present on web page. trying check headers available on web table. able find headers except 1 name ip address / host name <div id="ctl00_contentplaceholder1_radgrid1_gridheader" class="rgheaderdiv" style="overflow: hidden;"> <table id="ctl00_contentplaceholder1_radgrid1_ctl00_header" class="rgmastertable rgclipcells rgclipcells" style="border-color:#6788be;border-width:1px;border-style:solid;width:100%;table-layout:fixed;overflow:hidden;empty-cells:show;"> <colgroup> <thead> <tr> <th class="rgheader rgsorted" style="font-weight:bold;font-style:normal;text-decoration:none;text-align:left;" scope="col"> <a href="javascript:__dopostback('ctl00$contentplaceholder1$radgrid1$ctl00$ctl02$ctl01$ctl05','')" title="click here sort" onclick="telerik.web.ui.grid.sort($find('ctl00_

java - When I search listview item and then click desire item, it does open first position of List View -

i have searchable country listview. when click country list item without search, it's works properly. when type brazil in search box , click brazil, open country_details.java activity , pass afganistan details. when type brazil in search box , click brazil, want ot pass brazil details in webview. full source code : https://drive.google.com/open?id=0b46bpr7lkljpzfrhcv9ddmiwetq here code. package com.nasir.search; import java.util.arraylist; import java.util.arrays; import android.app.activity; import android.app.listactivity; import android.content.intent; import android.os.bundle; import android.text.editable; import android.text.textwatcher; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.baseadapter; import android.widget.edittext; import android.widge

c# - Getting handle of hidden form -

i need open form hidden, need form handle able send messages it. currently using following code prevent form show up: protected override void setvisiblecore(bool value) { if (!ishandlecreated && value) { base.createhandle(); value = false; } base.setvisiblecore(value); } it's working fine. problem when request handle form, shows , no longer hidden: string handle = this.handle.tostring(); of course can set this.hide() , short moment, form showing. is there way start , keep form hidden, while still able handle it?

Javascript error [object HTMLParagraphElement] -

i`m begginer in javascript , need help. so, need that, when push button, paragraph "leftside" appear <div id="content"> <script> function myfunction() { document.getelementbyid("contentp").innerhtml = leftside; var x = document.getelementbyid("leftside") x.style.display = "normal"; } </script> <button id="buttoni" type="button" onclick="myfunction()">show left side!</button> <p id="leftside" style="display: none">left side</p> <p id="contentp"></p> you have append leftside contentp , set display property block . normal not valid option <script> function myfunction() { document.getelementbyid("contentp").appendchild(document.getelementbyid("leftside"));

php - Pure JSON? Error: Value <br of type java.lang.String cannot be converted to JSONObject -

this error: 07-05 23:27:47.883: e/log_tag(2657): connection success 07-05 23:27:47.890: e/log_tag(2657): error parsing data <br /> 07-05 23:27:47.890: e/log_tag(2657): <font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> 07-05 23:27:47.890: e/log_tag(2657): <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> fatal error: call member function prepare() on non-object in c:\wamp\www\sample\insertorders.php on line <i>23</i></th></tr> 07-05 23:27:47.890: e/log_tag(2657): <tr><th align='left' bgcolor='#e9b96e' colspan='5'>call stack</th></tr> 07-05 23:27:47.890: e/log_tag(2657): <tr><th align='center' bgcolor='#eeeeec'&g

java - encrypting mysql database used by spring mvc app -

a spring mvc app on web server interacts mysql database hosted on same server. spring mvc app needs able search database. is there way can encrypt mysql database protect external malice, while retaining ability of spring mvc app query database? how? i want make sure other app unable use contents of database, need app able records name, id, etc. no, mysql not support encryption of entire database. have have pick 1 of these solutions: encrypt columns you don't need of data encrypted, sensitive data. can @ application level , insert blobs database. requires updating code - aka not transparent. use encrypted partition/disk another solution encrypt @ os level. long user permissions set correctly, no malicious processes able read data when system running, , no 1 @ able read when system offline. require remembering enter password every time start machine/unlock partition. use database supports encryption natively h2 1 such database. database written in p

c - How to understand dereferences and generic pointer in order to see the output? -

why output: aa b ee f ii j ? did line: void (*pfunc)(void*); create function pfunc similar function print ? know void pointer generic pointer still, how did output come way is? arguments @ command line: aaa eee iii void print (void *a) { char**p=(char**)a; printf("%s",(*p+1)); putchar(''); putchar(**p+1); putchar(''); } int main(int argc, char *argv[]) { int i; void(*pfunc)(void*); pfunc=print; for(i=1; i< argc;i++) pfunc(argv+i); return 0; } did row: void (*pfunc)(void*); creates function pfunc similar function print? yes. void (*pfunc)(void*); declare pfunc pointer function return type void , expects argument of type void * . why output: aa b ee f ii j ? the snippet for(i=1; i< argc;i++) pfunc(argv+i); passes of strings aaa , eee , iii function print . there casting a char ** . first string aaa , *p pointer first char , *p+1 second char. statement p

c++ - gcc - compile x386 assembly code error -

when use 'gcc -m32 -o stack temp.s' compile x86 assembly code, got errors below: /usr/bin/ld: cannot find crt1.o: no such file or directory /usr/bin/ld: cannot find crti.o: no such file or directory /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so when searching -lgcc_s /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so when searching -lgcc_s /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find crtn.o: no such file or directory collect2: error: ld returned 1 exit status i think it's because of lack of 32-bit lib, dont know how install it... thank you... i had similar issue ,

Tag SQL Server instance as DEV, TEST, STAGING, PRODUCTION etc -

we have few sql server boxes , instances running, wish our code identify if running on development, test or production server instance of sql server. based on code take path. we have few choices of hard coding sql server name , instance case when @@servername= abc/xyz dev , on. check specific letters in name or instance when (charindex('dev', @@servername, 1) > 0 ) dev , on. select type table: select @vcservertype = vcservertype master.dbo.tbl_serverdetails when @vcservertype = 'dev' , on. but rely on assumption dev found or server name contains letters, creating table in database exist in instances.. should have been easier if there exists property set/identify @ instance level.. suggestions (apart above) is there way in sql server, can set property or tag them dev, test or production? there tab named "extended properties" on database level in it's properties. you can set them sys.sp_addextendedproperty and read the

php - Merge two associative arrays by pushing their values into a new array -

i have following 2 arrays: $arrfoo = array( 'a' => 12, 'b' => 17, ); $arrbar = array( 'a' => 9, 'c' => 4, ); and want resulting array this: $arrresult = array( 'a' => array ( 12, 9 ), 'b' => array ( 17 ), 'c' => array ( 4 ), ); is there smart way achieve without using foreach? <?php $arrfoo = array( 'a' => 12, 'b' => 17, ); $arrbar = array( 'a' => 9, 'c' => 4, ); $arrresult = array_merge_recursive($arrfoo, $arrbar); var_dump($arr); ?> with array_merge_recursive can merge arrays in way you're asking for. http://php.net/manual/en/function.array-merge-recursive.php

php - Symfony2 ignores routing defaults cache control -

in routing.yml file have following definition according the doc here : webservice_resources: path: /webservice/resources defaults: _controller: foobarcogsbasebundle:resources:getresourcesbytags maxage: 3600 sharemaxage: 3600 but response headers indicate these settings ignored: cache-control: private i expecting see more along lines of this: cache-control: public,max-age=3600,s-maxage=3600 why symfony2 ignore cache defaults? what doing based purely around static templates. example in symfony2 docs (you not using template, rendering dynamic page appears though): acme_privacy: path: /privacy defaults: _controller: frameworkbundle:template:template template: 'static/privacy.html.twig' maxage: 86400 sharedage: 86400 what want (from http://symfony.com/doc/current/book/http_cache.html ): use symfony\component\httpfoundation\response; $response = new response(); //

php - How to generate a USING clause in JOIN queries with Laravel's Query Builder? -

postgresql supports using clauses in join statements, , want use simplify query. example: select * join b using (x, y, z) ... order x; how express laravel's query builder or eloquent? db::table('a') ->select('*') ->join('b', function($join)) ->where(...) ->orderby('x'); note question different https://stackoverflow.com/questions/31465918/how-to-generate-a-natural-join-query-with-laravels-query-builder asking natural join, not join using. also, i'm aware can have same effect multiple $join->on(...) statements, have duplicate columns , must quality columns in both a , b . is, i'd have write 'a.x' instead of 'x' though doesn't matter, because join query ensures both equal anyway. using clause solves problem neatly, generating single result column x , knowing there 1 value. so, answer - it's impossible. i continued question on laravel 5, , it's still imposs

javascript - JSHint with ECMAScript6: method is not defined -

i'm implementing client-side application using ecmascript6 , use jshint static code analysis. use following pattern in code: class myclass { constructor() { //this how call mymethod mymethod(); //this how should call mymethod make jshint analysis pass this.mymethod(); } mymethod(){ //implementation } } my primary language java expect calling mymethod() should ok. without adding this method call i'm getting "'mymethod' not defined" warning jshint. questions are: is correct make calls without this in such situation? (e.g. in php need add $this-> non-static method call) if that's correct make calls without this there way (any .jshintrc flag) turn off warning in jshint? no, , never correct in javascript. methods need called on receiver explicitly make this work , , need referred using property access notation because methods functions on properties in javascript. they&

node.js - 401 error on Analytics API using public access api key -

not how test other way, using public access api key results in result: login required error. can google analytics not called public access key? var google = require('googleapis') var analytics = google.analytics('v3') var c = require('./config.json') analytics.data.ga.get({ key: c.key, 'ids': c.ids, 'start-date': '2015-07-15', 'end-date': '2015-07-24', 'metrics': 'ga:sessions' }) not if google analytics api supports calls using public_api key, able achieve access using service account. var google = require('googleapis'), analytics = google.analytics({ version: 'v3'}) key = require('./key.json'), var jwtclient = new google.auth.jwt( key.client_email, null, key.private_key, ['https://www.googleapis.com/auth/analytics.readonly'], null) analytics.data.ga.get({ 'ids': 'ga:xxxxxxx', 'start-

c - why select report read file descriptors are ready constantly? -

in order test select system call, wrote program receive data client: #include <sys/types.h> #include <sys/socket.h> #include <sys/select.h> #include <sys/time.h> #include <unistd.h> #include <arpa/inet.h> #include <libgen.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <assert.h> #include <errno.h> #define backlog 5 int main(int argc, char *argv[]) { if (argc <= 2) { printf("usage: %s ip_address port_number\r\n", basename(argv[0])); return 1; } const char *ip = argv[1]; int port = atoi(argv[2]); int ret = 0; struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_family = af_inet; inet_pton(af_inet, ip, &address.sin_addr); address.sin_port = htons(port); int listenfd = socket(af_inet, sock_stream, 0); assert(listenfd != -1); ret = bind(listenfd, (struct sockaddr *)&

javascript - Is it possible to access a cookie and not have it sent in request headers? -

is possible set cookie in client's computer, use javascript access cookie, not have sent in http request header, like: cookie: phpsessid=r6osuqd20m72ho45lf5lohohe6; sum=csfftak5jf8gjffsp3el93g2a2 no, can use html5 local storage achieve goal. whatever goal is. :)

CodeLite clang code completion greyed out -

i'm on arch linux , i'm using codelite. id enable clang code completion, option greyed out, though clang installed. do? you must have clang installed during codelite building (for libs), otherwise greyed out. i faced same issue , had compile codelite several times.

Android 4.3: How to connect to multiple Bluetooth Low Energy devices? -

Image
task: i developing android application need simultaneously connect multiple (identical, can differentiated via id) ble chip devices in order send , receive updates. have used tutorials on google's official web page: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html this has helped me create devicescanactivity java class allows me scan , list of available ble devices in close proximity, applications of type do. found out 7 external slaves can connected same master device simultaneously. however, implementing communication still unclear me. useful link is: android 4.3: how connect multiple bluetooth low energy devices however, not provide enough detail me understand how such implementation works. i have been researching topic while , not able find example implementations. aware question has been asked lot of times there not seem working solution/ demo available online make things more clear me. appreciate lot if can point me resource/ working

python - Having Trouble Installing iPython -

well, python working perfectly. of sudden, gave me this: -bash: ipython: command not found i did play around bash profiles, i'm beginner don't know did. need help. anyway, tried doing , got this: eddy-lopez-torres-computer:~ eddylopez-torres$ pip install ipython -bash: pip: command not found eddy-lopez-torres-computer:~ eddylopez-torres$ sudo python setup.py install python: can't open file 'setup.py': [errno 2] no such file or directory eddy-lopez-torres-computer:~ eddylopez-torres$ sudo python setup.py install python: can't open file 'setup.py': [errno 2] no such file or directory eddy-lopez-torres-computer:~ eddylopez-torres$ cd downloads/ eddy-lopez-torres-computer:downloads eddylopez-torres$ cd labtools-0.2.2 eddy-lopez-torres-computer:labtools-0.2.2 eddylopez-torres$ python setup.py install running install checking .pth file support in /library/python/2.7/site-packages/ /usr/bin/python -e -c pass test passed: /library/python/2.7/site-p

java - Is it possible to customize JVM architecture for changing main() method name? -

can change name of main() method using customization of java virtual machine architecture? no not possible configuration. method name , signature defined @ language level. see this section java language specification: the method main must declared public , static , , void . must specify formal parameter (§8.4.1) declared type array of string .

php - MySQL Doctrine YAML -

what want product , product should this: { idproduct: 1, maincategory: 1, // 1 of categories main one. categories: [1, 2, 3], name: "john" //and on.. important thing maincategory... } im using doctrine (at work) yaml, , know use this: product: type: entity manytomany: groups: targetentity: category jointable: name: products_categories joincolumns: product_id: referencedcolumnname: id inversejoincolumns: category_id: referencedcolumnname: id that create 3 tables (use imagination xd): **product** id **category** id **category_product** id_product id_category but need maincategory in product too: **product** id main_category #this important , problem. what can achieve this... put object example in json because easy understand... im using php @ work, doctrine.. guess doctrine2, im not sure that. at work have in production category , product working in 1 one rela

How wordCount mapReduce jobs, run on hadoop yarn cluster with apache tez? -

as github page of tez says, tez simple , @ heart has 2 components: the data-processing pipeline engine, and a master data-processing application, where-by 1 can put arbitrary data-processing 'tasks' described above task-dag well first question is, how existing mapreduce jobs wordcount exists in tez-examples.jar, converted task-dag? where? or don't...? and second , more important question part: every 'task' in tez has following: input consume key/value pairs from. processor process them. output collect processed key/value pairs. who in charge of splitting input data between tez-tasks? code user provide or yarn (the resource manager) or tez itself? the question same output phase. in advance to answer first question on converting mapreduce jobs tez dags: any mapreduce job can thought of single dag 2 vertices(stages). first vertex map phase , connected downstream vertex reduce via shuffle edge. there 2 ways in mr jobs can run on te

java - ResultSet getFetchSize() doesn't seem to work? -

i'm having trouble getfetchsize() function. i need know if sql query has returned 0 rows. i've tried simple statement: if (rs.getfetchsize()==0) system.out.println("headline"); where rs of resultset type. above code doesn't seem work. prints message whether rs empty or not. i checked sql query , correctly returned non-empty result when rows existed. any thoughts on how can determine whether query has returned 0 rows? googled , couldn't find answer. resultset.getfetchsize() doesn't return number of results! here : standard jdbc enables specify number of rows fetched each database round-trip query, , number referred fetch size you can iterate across result set , if don't have entries, can determine got no results. why can't result size ? because database returning pointer results , it's relying on iterate through (going server each row).

go - golang failed exec command that works in terminal -

i getting error when try use exec package run mv command. here example of trying do: cmd := exec.command("mv", "./source-dir/*", "./dest-dir") output, err := cmd.combinedoutput() cmd.run() err returns following exit status 1 output returns mv: rename ./source-dir/* ./dest-dir/*: no such file or directory i can script work when change line: cmd := exec.command("mv", "./source-dir/*", "./dest-dir") to following: cmd := exec.command("mv", "./source-dir/file.txt", "./dest-dir") the command works , moves file using wildcard doesn't work. appears asterisk isn't being used wildcard in command. why that? there way use wildcards in go? if not how else able recursively move files source-dir dest-dir ? thanks when type command @ shell, shell takes ./source_dir/* , replaces list of of files match, 1 per argument. mv command sees list of filenames, not wildcard.

css - Tabs in Accordion not styling properly -

so when there's 1 accordion dd (item content, lack of better term) , code active when page loads, functions expected , active tab-title highlighted. but when there's more 1 accordion dd , they're loaded unactive, clicked on, active tab-title doesn't highlight until clicked on again. here's solution think need: in foundation.css, when accordion content active, want make first tab tab-title , content active. thoughts? <div class="row"> <div class="small-12 small-centered columns"> <dl class="accordion" data-accordion> <dd id="mealrow_55" class='active'> <a href="#meal_55">sweet , sour chicken &nbsp;&nbsp; <span class='secondary round label'>shared</span> <span class="tag-right">&nbsp; tags: asian, chicken</span></a> <div id="meal_55" class="content ac

node.js - EMFILE, too many open file -

[info] system - { codeblock: 'catch copy image', error: { [error: emfile, many open files './uploads/54f911bad366ed/document/document_559dfb750f15617.png'] errno: 20, code: 'emfile', path: './uploads/54f911bad366ed/document/document_559dfb750f15617.png', syscall: 'open' } } regret don't have enough reputation make comment in thread ( node , error: emfile, many open files ) have create new 1 ask question. my application has above error. checked log , error occurred during copying process (of template user's login account , admin account) when users first login. i don't know idea why because occurred on users account user did not login. can help?

c# - Use EF to delete a record by id, if id does not exist, an exception is thrown -

the code looks this: try { student stu = new student() { id = id }; db.entry(stu).state = entitystate.deleted; int result = db.savechanges(); } catch (dataexception e) { } the exception is: store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. see http://go.microsoft.com/fwlink/?linkid=472540 information on understanding , handling optimistic concurrency exceptions. ...but don't want exception, want number of affected rows, 0 . try this try{ var student= db.students.first(x => x.id== 1); db.students.deleteobject(student); db.savechanges(); } catch(exception ex) {return 0;}

Selenium: How to disable image loading with firefox and python? -

i have read similar questions, 1 supposed answer, when tried it gave partial solution. i refer question: disable images in selenium python my problem tried solution , of images not appear images arrive from: <img href="www.xxx.png"> are being loaded. there way tell firefox/selenium not it? if not, there way discard dom element back, via self._browser.get(url) content=self._browser.page_source for example doing kind of find replace on dom tree? the browser configuration same browser previous question: firefox_profile = webdriver.firefoxprofile() # disable css firefox_profile.set_preference('permissions.default.stylesheet', 2) # disable images firefox_profile.set_preference('permissions.default.image', 2) # disable flash firefox_profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so', 'false') # set modified profile while creating browser object self._browser = webdriver.fi

json - How to make request and send response on the network? -

i working on json project , want hit on specified url request , response back. want know if there sites available can provide me request, response on json? any sort of welcome! back when "ajax" being coined (and before), used xml http request object ( w3 schools ) web development more mature now. libraries such jquery wrap functionality easy use ( jquery ajax )

javascript - hubot-slack with js - how to handle several questions with only one command? -

i making hubot-slack fun. the thing want implement let hubot several questions @ once. instance, below: user : @hubot: add job hubot : job ? user : jobless hubot : workplace ? user : home hubot : job has registered. as can see, user trigger event once command add job . following javascript source handle it. calling part : robot.respond(/register me/igm, function(msg){ //var promptconsole = new prompt(msg); var questions = [ {'question' : 'what name ?', 'dataname' : 'name'} , {'question' : 'what job ?', 'dataname' : 'job'} ]; var promptconsole = new prompt(msg, questions); promptconsole.init().startprompt(robot); }); and prompt object : var prompt = function (msg, questions) { console.log(msg); this.msg = msg; this.user = msg.message.user; this.room = msg.message.room; this.results; this.questions = questions; //console.log(user +'

bluetooth - Possible to control garage door with Garmin IQ? -

i'd fenix 3 following: trigger = hold down start button (i.e. shortcut) send message via bt or wifi server (linux or windows or arduino or whatever) i'll take care of message , open/close garage door. after bike tour i'd , safely open garage door. have vmware server running @ home. use 1 of machines on server listen messages or set arduino or similar. the main question is: can write iq app utilizes shortcut concept on clock, i.e. triggered long click on start or lap button? clarification : there seems kind of global actions long press. can example assign "save position" long press on start/stop. works inside of other apps. can clock communicate sensors (i.e. arduino or other bt client) if not in training mode? clarification : need communicate directly arduino via bluetooth, i.e. not via iphone. thanks in advance. short answer: yes long answer: if record time keydown event comes in, , check "long" press when key let based

vba - Word Macro - Log changes made by a find and replace -

i have below code search through word document replacing ids finds masked version of number using regex (e.g. 412345678900 becomes 4123####8900). each document have multiple ids in it. ids scattered throughout document text , not in tables (so excel not option). i want able write each of replaced versions of text found out log file file path , file name. sub auto_masking() 'start @ beginning. it's place start. selection.homekey unit:=wdstory selection.find ' locate , mask 12 digit ids .text = "<([4][0-9]{3})([0-9]{4})([0-9]{4})>" .replacement.text = "\1####\3" .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchallwordforms = false .matchsoundslike = false .matchwildcards = true end selection.find.execute replace:=wdreplaceall 'put user @ beginning of document selection.homekey unit:

php - Parsing XML Fail -

i have old site uses xml path, reads , shows desired content. i used create new page, different xml-url. <?xml version="1.0" encoding="utf-8" ?> <items> <item> <link>http://www.url.to/image.html</link> <itemname>teapot</itemname> <city>munich</city> <countryid>de</countryid> <desc> <![cdata[here comes item description]]> </desc> <imageurl>http://www.url.to/image.jpg</imageurl> </item> </items> thats how items created. plain , simple. the php code generates site looks simple this: <?php //###################config start######################### $maxanzahl = 50; $zaehler = 4; //###################config end######################### $feed = simplexml_load_file('http://www.domain.tld/path-to-xml.php&filter1=rule1&filter2=rule2'); $items = $feed->items;

javascript - Choosing a value from each of n identical arrays, get all combinations -

let's have 3 identical arrays, each looks this: [1,2,3,4] . by choosing value each array, want exhaust combinations, in example, desired result be: [1,2,3], [1,2,4], [1,3,4],[2,3,4] order doesnt matter. i'm iterating on every possibility, , that's waaaay slow. thought first doing check make sure iterator greater 1 left of it, in case of 1,4,... fail because 3rd array doesn't have bigger 4. additionally i'd need check make sure max of each column no greater column length - (# of repeating columns - column position . example column 2 not exceed 3. think i'm going down rabbit hole. any clever ways desired result in fewest iterations possible? modifying arrays fair game, too.

html - Showing 4 boxes on the same line within a div -

Image
i'm attempting create 'popular products' bar @ bottom of page. here example: however, i've run problem multiple divs don't appear on same line. i've read different ways of doing including display:inline-block(everywhere says bad idea), display:table-cell(this creating new line still), , using spans display:inline-block(also still creating new line.) i've tried removing 'display' in .productbox class, doesn't show box @ all. here's code productbox: .productbox { width: 168px; height:135px; display:inline-block; background-color: #b2b2b2; } how using flex box ? here's html & css .wrapper { display: flex; } .wrapper div { width: 100px; height: 100px; background-color: blue; margin: 10px; } <div class="wrapper"> <div>div 1</div> <div>div 2</div> <div>div 3</div> <div>div 4</div> </div> note depe

node.js - Execute mocha tests through proxy or not with grunt -

i'd configure mocha tests performed behind proxy or not. example, grunt test would execute tests have defined in test folder on localhost (no proxy). and export http_proxy=proxy:port grunt test mywebsite.com would execute tests through proxy. is possible?

Houghlines in android with opencv -

Image
i trying make perspective correction quadrilateral objects using opencv3 . managed show lines , implemented houghlines using imgproc.houghlinesp() , tried highlight lines using imgproc.lines() output no success. below code , have attached output image. please let me know wrong happening , should done... mat initimg; // initial image mat greyimg; // converted grey mat lines = new mat(); int threshold = 50; int minlinesize = 20; int linegap = 10; initimg = imgcodecs.imread(imgloc, 1); greyimg = new mat(); imgproc.cvtcolor(initimg, greyimg, imgproc.color_bgr2gray); bitmap bitm = bitmap.createbitmap(greyimg.cols(), greyimg.rows(),bitmap.config.argb_8888); imgproc.blur(greyimg, greyimg, new size(3.d, 3.d)); imgproc.adaptivethreshold(greyimg, greyimg, 255, imgproc.adaptive_thresh_mean_c, imgproc.thresh_binary_inv, 15, 4); imgproc.houghlinesp(greyimg, lines, 1, math.pi/180, threshold, minlinesize, linegap); // lines returns rows x columns , rows 1. dont know why please

javascript - Fire ng-click on dynamic element -

i want create dynamic elements can fire ng-click event , want datatables rows obtained through ajax , dynamically created. problem ng-click isn't fired on row elements. have recreated problem in jsbin situation (the datatables part doesn't matter). html <div id="elements" ng-controller="testcontroller controller"> <button ng-click='dosomething()'>this button work</button> </div> <button class="click">create element</button> when create element button clicked, button added dom in #elements div . button within div clicked, console output something. has when click created button in #elements div doesn't dynamically created button. js app.controller('testcontroller', ['$http', '$scope', function ($http, $scope) { //the ng function. $scope.dosomething = function(){ console.log('function fired!'); }; }]); //c

parse.com - iOS Parse Push Notifications in Adhoc exported ipa - [Solved] -

i've application uses parse.com push notification service. when run app on iphone xcode notifications received when install app exported ipa itunes notifications aren't received. problem ? it sounds provisioning profile problem. when export .ipa, uses particular provisioning profile, , profile different xcode , ad-hoc. to enable push ad-hoc builds, can find detailed list of steps here: enabling apple push notifications ad hoc distribution environment

javascript - Receiving messages without port forwarding -

i want server able send client message @ time. there may no messages several days, yet if 1 sent, want received (ideally within 1 second or less). how go without setting client server , using port forwarding? an example of push notifications on mobile device. apple can send push notification iphone instantly. however, iphone isn't acting server. furthermore, iphone may moving network network, , networks aren't forwarding ports iphone. how work? assuming there's sort of persistent connection, how solution scale hundreds of millions of devices connected @ same time? this question doesn't depend on particular language. i'm working in js. i'm looking conceptual answer, feel free answer in context of language if helps. remember that, once network connection has been established, data can flow on in either direction. there no requirement peer on "receiving" end of connection receive data! in presence of non-cellular network*, iphone push n

jsonschema - Validate property against another with JSON Schema -

in model below, "category_id" property should required if "detail" array empty. if "detail" array not empty, "category_id" property not required. how can json schema? { "description": "expense model validation.", "type": "object", "properties": { "description": { "type": "string" }, "category_id": { "type": "string" }, "detail": { "type": "array", "items": { "description": "expense detail", "type": "object", "properties": { "description": { "type": "string" } }, "req