Posts

Showing posts from September, 2014

android - Proximity Marketing API -

currently i'm using aws-s3 create url's documents & shorten url's suit eddystone format. i'm using kontakt beacons & use ui edit beacons shortened url's. works fine, displayed link (as seen using physical web app) long & there no link description. i'm hoping above & more using proximity marketing api, trouble i'm api newbie & looking guidance. i've created project & browser key & have beacon, not sure to next (sorry). i'm guessing i'll have input beacon details somewhere required url & link description. is there idiots guide doing or can advise? the way physical web app , chrome's physical web support work is: the app discovers eddystone-urls nearby. the app sends url physical web service . the physical web service fetches web page url (following redirects, e.g., introduced link shorteners). the physical web service extracts title, description, icon, , linked data web page. the...

xml - How to remove and add select elements via XSLT? -

i have following xml document (just excerpt): <osm> <node id="1" version="1" timestamp="2016-02-29t01:33:20z" lat="0.0" lon="0.657002"> <tag k="stat_nr" v="40045"/> <tag k="ortsgr_kl" v="0"/> <tag k="town_id" v="0000"/> <tag k="name2" v="city2"/> <tag k="name1" v="city1"/> <tag k="id" v="8942835"/> </node> <node id="2" version="1" timestamp="2016-02-29t01:33:20z" lat="0.93198" lon="0.000"> <tag k="land" v="d"/> <tag k="id_ref" v=""/> <tag k="stat_nr" v="40045"/> <tag k="name1" v="examplecity"/> <tag k="id" v="0000"/> </node...

php - String to array or object -

actually string, how can convert object or array .. {"kind": "delivery_quote", "fee": 750, "created": "2016-02-28t19:13:38z", "expires": "2016-02-28t19:18:38z", "currency": "usd", "duration": 60, "dropoff_eta": "2016-02-28t20:18:38z", "id": "dqt_khc5sbjq00jn6f"} i tried $array=explode(' ',$result); $json = json_encode($result); print($json); it giving me result this "{\"kind\": \"delivery_quote\", \"fee\": 750, \"created\": \"2016-02-28t19:13:38z\", \"expires\": \"2016-02-28t19:18:38z\", \"currency\": \"usd\", \"duration\": 60, \"dropoff_eta\": \"2016-02-28t20:18:38z\", \"id\": \"dqt_khc5sbjq00jn6f\"}" but how can can take results like echo $json->fee; here eval of h...

php - JWTAuth getToken give false result when tried to call it in laravel 5 -

i'm new in laravel , stuck jwtauth service in laravel. i'm developing mobile app using ionic , try make request generate jwt token. turn out able generate token, when try request compare token, cannot token using jwtauth::gettoken() in laravel. here script signin (generate token) public function signin(request $request){ $request = [ 'email' => urldecode($request->request->get('email')), 'password' => urldecode($request->request->get('password')) ]; if(auth::attempt($request)){ $user = auth::user(); auth::login($user, true); $custom = ['id' => $user->id, 'email' => $user->email, 'fullname' => $user->name]; $newtoken = jwtauth::fromuser($user,$custom); $return = array('success' => true, 'token' => $newtoken); }else{ $return = array('success' => false,...

How do I run a EXE Go executable from within IntelliJ IDEA? -

i have go program i'm working on in intellij idea on windows machine. program's structure little unconventional (don't want go detail here besides point) because of first have compile program using following command: go build -o cli.exe and can run cli.exe directly in command prompt. but how configure run configuration in intellij idea doesn't mind running windows executable ? because if try tell run exe file it's run configuration, gives me error "main file invalid" how solve ? make sure have file name (not folder name) in field file on run/debug configuration window (in intellij idea go menu run->edit configuration...-> your_configuration ). case.

swift - Detect collision between 3 objects? -

Image
i'm trying create enemy ai, , i'm trying check if enemy's ai range collides wall before colliding player, enemy stops chasing player when happens. but seems can detect collision between , b, , not c. best way this?

In Ext.net, I want to put a gridpanel inside a panel and refresh it programmatically -

in ext.net, want put gridpanel inside panel , refresh programmatically code: <ext:tabpanel runat="server" region="center"> <items> <ext:panel runat="server" title="center" border="false" bodypadding="6"> <items> <ext:gridpanel id="gridpanel1" runat="server" title="array grid" width="500" height="350" /> </items> </ext:panel> </items> </ext:tabpanel> when explore page, blank, when remove gridpanel, other stuff showe normally! any ideas wrong?

algorithm - Distribution strategy to minimize the maximum value in an array -

recently, come across problem in solving problem. have solution myself. i'm not quite satisfied time complexity. so, i'm turning guys possible better solution. problem follows: suppose there integer array int arr[n] . have integer value val in hand distribute arr . example, can increase arr[0] val , or arr[2] 1 , arr[3] val - 1 , , on. goal minimize maximum value in arr after distribution. there may multiple solutions, , do. my current solution follows. it's trivial , takes o(val) time. have feeling better solution exists. for (int = 0; < val; ++i) { // increase minimum value in arr 1 } here's linear-time algorithm. first try increase current max. if have keep going, distribute rest evenly possible. in untested python: def distribute(arr, val): maxarr = max(arr) x in arr: val -= min(maxarr - x, val) return maxarr - (-val) // len(arr) the double minus silliness ceiling division.

Running a Cron job daily 8 PM EST for Magento -

could please me run cron job daily 8 pm est magento in following format <schedule><cron_expr>* * * * *</cron_expr></schedule> if simple cron expression can refer cron documentation directly. 1 thing though think restricted local machine time zone of machine task running. the explanation of 5 stars here:- field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 sunday, or use names) so daily 8 p.m. 0 20 * * * reference: http://man7.org/linux/man-pages/man5/crontab.5.html

php - namespace error in cakephp -

this sample page files of app namespace cake\controller; use cake\controller\appcontroller; both of these lines shows red in dreamweaver in cakephp controllers in namespace app\controller , use app\controller\appcontroller , since appcontroller default , other controllers extend it. namespace app\controller; use app\controller\appcontroller; /** * users controller * * @property \app\model\table\userstable $users */ class userscontroller extends appcontroller { /** * index method * * @return \cake\network\response|null */ public function index() { $users = $this->paginate($this->users); $this->set(compact('users')); $this->set('_serialize', ['users']); } }

linux - Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so -

i new mongodb. installed mongodb on our development (linux) server: i got mongodb work on console , load , save data, when wanted install php driver , altered php.ini got error: unable load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so i searched internet , find 32bit , 64bit differences between php , file far know computer installed on 32bit on 32bit far know. i installed driver using pecl install mongo also tried pecl download mongo phpize , set -m32 found somewhere on internet, make , still didn't work. below more info might need in order able me out here. uname -m i686 file /opt/lampp/bin/php-5.3.5 /opt/lampp/bin/php-5.3.5: elf 32-bit lsb executable, intel 80386, version 1 (sysv), dynamically linked (uses shared libs), gnu/linux 2.2.0, stripped file /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: elf 32-bit lsb shared object, intel 80386...

loops - how to make this php code shorter? -

i have following php code works long , cumbersome reading... // row if ($taktarticle[0]['t1position3'] > 3 , $taktarticle[0]['t1position3'] < 7 ) { $row = "row1"; } if ($taktarticle[0]['t1position3'] > 7 , $taktarticle[0]['t1position3'] < 12 ) { $row = "row2"; } if ($taktarticle[0]['t1position3'] > 12 , $taktarticle[0]['t1position3'] < 17 ) { $row = "row3"; } if ($taktarticle[0]['t1position3'] > 17 , $taktarticle[0]['t1position3'] < 22 ) { $row = "row4"; } if ($taktarticle[0]['t1position3'] > 22 , $taktarticle[0]['t1position3'] < 27 ) { $row = "row5"; } // columns if ($taktarticle[0]['t1position3'] == 3 or $taktarticle[0]['t1position3'] == 8 or $taktarticle[0]['t1position3'] == 13 or $taktarticle[0]['t1position3'] == 18 or $taktart...

function - Sum Rows based on a condition -

Image
i'm using db2 database (not sure of version). script functional i'm not producing results expect. need separate aggregate totals in 3 groups based on conditions in case statement every project under same project_name/id , building_name/id, need sum total under each bucket having 1 row per project_name/id , building_name/id. assume group of sort or recursive function solution i'm not quite sure. appreciate push in right direction. here script. select dp.dim_project_id, dp.project_name, dm.dim_building_id, dm.building_name, case when ( dj.groups3 in ('33.3% <= x <= 100%', '16.7% <= x < 33.3%') , da.type_name = 'sales') cast(sum(cast(fat.transaction_amount real)) integer) when (dj.groups3 in ('60% <= x <= 100%', '20% <= x < 60%') , da.type_name = 'sales') cast(sum(cast(fat.transaction_amount real)) integer) else '0...

php - Javascript Error "Null is not an Object" with a dynamically created html table -

i have dynanamically created html table picture in last cell of each row (like.png). achieve after user has clicked on picture 1 diplayed (like1.png). keep getting "null not object", there maybe wrong javascript code ... thank :) here php creates table : <?php $pictureid = 1; while($results = mysql_fetch_array($raw_results)){ // $results = mysql_fetch_array($raw_results) puts data database array, while it's valid loop echo '<tr>'; echo'<td>'. ucfirst($results['song_name']).'</td>'; echo'<td>'. ucfirst($results['song_artist']).'</td>'; //echo'<td>'. ucfirst($results['song_album']).'</td>'; echo '<td>'; echo '<img src="images/like.png" id="artist'.$pictureid.'" onclick="action(arti...

How to use HTML conditional statements with jQuery Mobile -

i have jqm web app uses features not available prior ie 10. while know jqm supports earlier browsers, want alert users app not. i put following first lines inside <body> tag in index.html file: <!--[if lt ie 10]> <div class="browsehappy"> using <span class="bold">outdated</span> browser. please <a href="http://browsehappy.com/">upgrade browser</a> improve experience. </div> <![endif]--> but doesn't seem working. i'm wondering if jqm's page ajax system preventing working properly. example: http://jsbin.com/ogiroce/1/edit as far know, cannot done jqm.

ldap filter work on JXeplorer, but no in php -

i have filter: (&(domainlogin=ara*)(&((!(domainlogin=ara_test_7))(!(domainlogin=ara_test_8))(!(domainlogin=ara_test_10))(!(domainlogin=ara_test_11))))) if use filter on jxplorer work fine , find result, if use php ldap_list have error: warning: ldap_list() [function.ldap-list]: search: bad search filter <? $f="(&(domainlogin=ara*)(&((!(domainlogin=ara_test_7))(!(domainlogin=ara_test_8))(!(domainlogin=ara_test_10))(!(domainlogin=ara_test_11)))))"; $g=ldap_list($conn,$page->ldap_search_dn,$f,array(),false,10); print_r(ldap_get_entries($conn,$g)); ?> why? try filter: (&(domainlogin=ara*)(&(!(domainlogin=ara_test_7))(!(domainlogin=ara_test_8))(!(domainlogin=ara_test_10))(!(domainlogin=ara_test_11))))

node.js - fs.readFile().toString terminated by empty string -

the following node script, (wc.js) return value wich different unix utility wc; fs = require('fs'); //console.log(fs.readfilesync(process.argv[2]).tostring().split('\n') ); console.log(fs.readfilesync(process.argv[2]).tostring().split('\n').length ); the output on itself, is: vagrant@precise32:~/stuff$ wc -l wc.js 3 wc.js vagrant@precise32:~/stuff$ node wc.js wc.js 4 and printing array, seems file get's terminated empty string: vagrant@precise32:~/stuff$ node wc.js wc.js [ 'fs = require(\'fs\');', 'console.log(fs.readfilesync(process.argv[2]).tostring().split(\'\\n\') );', '//console.log(fs.readfilesync(process.argv[2]).tostring().split(\'\\n\').length );', '' ] is expected behavior? cannot see reported in node documentation. are sure don't have trailing newline character @ end of file? $ node wc.js wc.js [ 'fs = require(\'fs\');', 'console.log(fs.rea...

javascript - How to dynicamlly center the center of a div based on screen size -

i thought simple i'm losing mind! simple want center div in div of screen. not top left of div center of screen center of div in center. here div css .box { padding-top:20px; padding-left:5px; background-color: #ffffff; background-color: rgba(221,221,221,0.5); border: 1px solid black; border-radius: 25px; filter: alpha(opacity=90); height: 125px; width: 250px; z-index: 1; } <form id="form1" runat="server"> <div id="box"><div> </form> thanks! couldnt figure out how html side in code block. center horizontally , vertically. use position:absolute if need centred both horizontally , vertically: #box { position:absolute; top:0; left:0; right:0; bottom:0; margin:auto; /* etc */ } http://jsfiddle.net/wcfmw/

html - Link to id element with offset -

i have fixed title div on top height 80px. have link "how" pointing div. <div id="how"> <!-- description here --> </div> however, when click link, because header div out of flow, covers top portion of #how div. how can set offset when click link, brings me down #div link offset of 80px? unless willing add anchor somewhere (which not first choice), need use js. window.scrollto() place start.

networking - Is a subnet's broadcast address required to be the highest address in the subnet? -

for example, consider following network: ip address: 192.168.0.1 subnet mask: 255.255.255.0 is broadcast address required 192.168.0.255? broadcast address defined rfc 919 yes, required. (direct) broadcast address "all-ones-address" in local network defined rfc 919 , last address in network range. since local network layer can map ip address data link layer address, choice of ip "broadcast host number" arbitrary. simplicity, should 1 not assigned real host. number bits ones has property; [...] examples for network example, 192.168.0.255, expressed in binary: 11000000 10101000 00000000 11111111 for network 10.0.0.32/248 (thus subnet mask 255.255.255.248), 10.0.0.39 (next subnet starts @ 10.0.0.40). 00001010 00000000 00000000 00100 111 exemptions exemptions exist /31 , /32 networks. /31 networks (p2p-networks) not have broadcast address, have 2 hosts , used connect networks. /32 networks reference single host ded...

java - Imported library is marked as an error right after i close propperties -

so, i've started having weird errors when i'm import android support library v7 using eclipse, follow steps on android site , working fine. working towards 4.0.3 changed target sdk on v7 library 4.0.3 , built before exported jars. on project properties looks great: dropbox image but when apply settings, close dialog , re-open without doing else looks this: second dropbox image i've tried reinstalling library , clean , build several times still same wierd error. also, when hover on apperantly faulty library there no error mentioned. copy project , support library workspace using eclipse. both should in same folder.

python - Database error from manage.py: "TypeError: invalid postgreSQL type: bigint" -

one of servers started having error when trying use of south related commands manage.py $ python ./manage.py migrate typeerror: invalid postgresql type: bigint $ python ./manage.py syncdb typeerror: invalid postgresql type: bigint $ python ./manage.py shell typeerror: invalid postgresql type: bigint the setup: django, postgis, south, ubuntu. the confusing part nothing has changed on server recently, , 3 other servers should exact same setup working correctly. i turned on postgres statement logging, i'm not seeing obvious errors there: 2013-09-24 16:33:14 utc log: statement: show default_transaction_isolation 2013-09-24 16:33:14 utc log: statement: set default_transaction_isolation default 2013-09-24 16:33:14 utc log: statement: set time zone 'america/chicago' 2013-09-24 16:33:14 utc log: statement: set default_transaction_isolation 'read committed' 2013-09-24 16:33:14 utc log: statement: begin 2013-09-24 16:33:14 utc log: statement: select postgi...

What decides columns in Azure queues? -

Image
i'm using azure queue storage. upgraded using microsoft.windowsazure.storageclient microsoft.windowsazure.storage. i've changed on using lokad cloudfx. @ point in process, started getting more columns in queue storage, including duplicate dequeue count. i can't figure out how columns getting created. why there 2 dequeue count columns? the columns have nothing internal schema of message. display management metadata specific queue. "dequeue count" indicates how many times clients have attempted dequeue message. the duplicate column issue looks me ui bug in management tool.

asp classic - Issue with XML / SelectNodes using ASP VBScript -

got issue displaying information xml. think has selecting correct node (company name). need fresh opinion... got feeling overlooking simple. code follows xml <govtalkmessage> <envelopeversion>1.0</envelopeversion> <header> <messagedetails> <class>companydetails</class> <qualifier>response</qualifier> <transactionid>9999999999999</transactionid> <gatewaytest>true</gatewaytest> <gatewaytimestamp>2013-09-24t17:51:41-00:00</gatewaytimestamp> </messagedetails> <senderdetails> <idauthentication> <senderid>******</senderid> <authentication> <method>chmd5</method> <value></value> </authentication> </idauthentication> ...

Javascript recursive parent -> child -> parent -> child references, do I need to use an alternative? -

Image
it's encountered on journey learning javascript , making application simultaneously. var = function (parent) { this.parent = parent; }, b = new object(); b.a = new a(b); this simple piece of code produces rather interesting. console.log(b.a.parent.a.parent.a); cause problems? because planning on using similar in application. the reason use because need reference variable belonging parent. it's same problem here . however, can't use closure here, since don't have outermost function! a stripped down version of code follows: var scratchpad = function (canvas) { var ctx = canvas.getcontext('2d'); ctx.childmustaccessthis = 3; ctx.brush = new brush(ctx); return ctx; }, brush = function (parent) { this.parent = parent; // other vars }; brush.prototype.getcontext = function () { return this.parent.childmustaccesthis; } i need making multiple of these scratchpads (modified context objects) res...

css - CSS3 Animation polyfill -

i'm looking css3 animation work; works fine in major browsers ie9 , older (no surprise there). without further ado, here's css : #grosse_photo { /*...*/ -webkit-animation: photofade 12s infinite; -moz-animation:photofade 12s infinite; -ms-animation: photofade 12s infinite; animation-iteration-count:1; -moz-animation-iteration-count:1; -webkit-animation-iteration-count:1; -o-animation-iteration-count:1; } @-webkit-keyframes photofade { 0% { opacity: 0.0; } 100% { opacity: 1.0; } } @-moz-keyframes photofade { 0% { opacity: 0.0; } 100% { opacity: 1.0; } } @-o-keyframes photofade { 0% { opacity: 0.0; } 100% { opacity: 1.0; } } @keyframes photofadee { 0% { opacity: 0.0; } 100% { opacity: 1.0; } } i used -ms prefix thinking react -webkit , ie (lte 9) didn't cooperate. i need elements slide in, since ie won't cooperate, i'm thin...

jquery - know the element you are over while dragging -

i faced problem identical thread: jquery droppable - receiving events during drag on (not on initial drag over) the difference need know element i'm on , it's not "droppable" element. it's element inside droppable. so if have parent div (that droppable) has 3 child divs, while i'm dragging item on 3 child divs, want know if, when dropped, item should dropped above or below 1 of child elements. the same problem exists in post above (mouseover, etc., events not firing on child elements of droppable div). thoughts? you mouse x & y coordinates or offset x & y of item when dropped - plus it's height & width etc. calculate boundaries of object , accurate drop position. $(this).offset().top / $(this).offset().left $(document).mousemove(function(event) { currentmousepos.x = event..pagex; currentmousepos.y = event.pagey; }); then iterate on objects sit below , compare coordinates / boundaries object ones. can have lo...

knockout.js - Dynamically esponsive attribute in knockoutJS -

i'm new knockoutjs , it. problem can't figure out how include sort of validation in binding. i'm trying disable button unless there text in text field. <input type="text" name="answer" id="txtanswer" placeholder="answer..." data-bind="value: newanswer" /> <button data-inline="true" data-bind="click: addanswer, enable: newanswer() != ''" >add</button> in viewmodel have self.newanswer = ko.observable($("#txtanswer").val()) i've tried can think of, can't make button responsive. seems evaluate once, on page load, nothing changes. any appreciated. your observable looks funky. don't need jquery selector inside of call observable . link observable element via data-bind attribute: self.newanswer = ko.observable(''); //replace '' default value want then markup: <input type="text" name="answer"...

How required my class to Rails -

i have class in file.rb want require class in project, put file project/lib when call create new object, rails raises error. class absent. may not right assigned file? files in lib folder not auto-required. have put requirement initializer (just check of existing initializers see how it).

Qunit test not recognizing defined object -

i have js method i'm looking test: domediation: function() { var state, = this, mediation_rule = "asdf"; mediation.getrules(mediation_rule, function () { [blah blah] }); }, my mediation object defined above method in class. qunit test: test('domediation: testing mediation', 1, function(){ var proto = $.extend({}, my.prototype, { mediation: { getrules: function(rule, cb){} } proto.domediation(); }); the problem i'm getting error: died on test #1: cannot call method 'getrules' of undefined - {} yet, defined right there in test. thanks. turns out previously, mediation defined such: var mediation = anotherclass.mediation. in qunit test, had define anotherclass.mediation = {} instead of mediation{}

matlab - Undefined function 'readlas' for input arguments of type 'char' -

i bought student version of matlab 2013. have 3 log files ( .las ) , have downloaded them onto computer. when open matlab think has deal either retrieving .las file, or setting path functions. when try type help readlas gives me error: "undefined function 'readlas' input arguments of type 'char'." where set path? how let matlab access 3 log .las files? matlab not have built-in capability read las log files. there no function readlas supplied matlab. if have program uses command readlas , need contact author of program obtain code readlas , , add directory containing readlas path. if have readlas , add directory path. there freely available third-party tools can read las files matlab - 1 of common seislab, available here matlab central file exchange. however: it's way seislab reads in las data differs way readlas reads in, , doubt can replace readlas seislab's read_las_file without changing quite few other things. seisl...

jquery - How to take a snap of the final result after dropping an item on an image using javascript? -

i'm working on project need develop system people can create own design choosing given list of symbols , images , choose background. have completed parts regarding dragging , dropping etc. i'm stucked previewing final result in single image. i'm assuming need positions of elements in drag-and-drop container (or canvas) , pass php script (i can work php) , create new image using php's image library. clumsy , frustrating me. i'm here advice , suggestion experts. so question is- "is there other ways regarding php or js can use desired result?" thanks in advance. you sir, right on target. optimization suggestions though pass dimensions json object, way array in php , can have multiple objects supplying each images source url. there plenty of libraries handle actual generation. consider here http://php.net/manual/en/refs.utilspec.image.php theres plenty of tutorials available on subject. can tell you, using function imagecopymerge() gd, , ...

array not reading data from file in c++ -

i have program uses 2d array store values. have 2 questions. first program isnt reading data text file correctly. when prints out numbers in array, zeros. wrong code? #include "stdafx.h" #include<iostream> #include<fstream> using namespace std; int ary [][13]; ofstream outfile; ifstream infile("nameavg.txt"); //function prototype void readit (int [][13]); // function call readintoarraybyrows(ary); void writeprintoutarray (int [][13]); int main() { //open/creates file print outfile.open ("myoutfile.txt"); // title , heading outfile << "\nname , grade average\n"; cout << "name , grade average.\n\n"; // open , reads .txt file array readit(ary); outfile<<"\n-----------------------------"<<endl; cout<<"\n-----------------------------"<<endl; writeprintoutarray(ary); outfile<<"\n---------------------------...

javascript - Why can't I delete this cookie from the dev tools console? -

i have cookies control column layout in grid. set javascript on page , server has/had nothing them. i'd clear them using button in js (reset defaults). problem seem impossible delete unless use browser gui it. i've read numerous posts, tried of them, https://developer.mozilla.org/en-us/docs/web/api/document.cookie , doccookies library. here transcript dev tools console, shows how tenacious these cookies are: >document.cookie="food=hotdog" "food=hotdog" >doccookies.keys() ["food", "ext-history-results", "ext-today-summaries", "csrftoken"] >doccookies.removeitem("ext-history-results") true >doccookies.keys() ["food", "ext-history-results", "ext-today-summaries", "csrftoken"] >doccookies.removeitem("food") true >doccookies.keys() ["ext-history-results", "ext-today-summaries", "csrftoken"] >doc...

javascript - function example in text does not make sense to me -

reading through eloquent javascript in attempt wrap head around functions, read example code: function makeaddfunction(amount) { function add(number) { return number + amount; } return add; } var addtwo = makeaddfunction(2); var addfive = makeaddfunction(5); show(addtwo(1) + addfive(1)); i gist of it, having examined code , read accompanying text several times on few hours, hasn't clicked me: exacly code doing? add function acquire number parameter? come show command? if so, how passed around? don't see it... the function makeaddfunction takes number ( amount ) , returns function adds number passed in paramter number passed outer function. function makeaddfunction(amount) { function add(number) { return number + amount; } return add; } calling var addtwo = makeaddfunction(2); equivalent writing following function: var addtwo = function(number) { return number + 2; // function returned makeaddfunction } yo...

Twitter data content JSON parsing Issue -

i have script took link http://tareq.wedevs.com/2009/05/playing-with-twitter-json-using-php/ the script below <?php $json = file_get_contents("http://twitter.com/status/user_timeline/saswatroutroy.json?count=10", true); $decode = json_decode($json, true); echo "<pre>"; $count = count($decode); //counting number of status for($i=0;$i<$count;$i++) { echo $decode[$i]."<br>"; } echo "</pre>"; ?> it throws me error a php error encountered severity: warning message: file_get_contents(http://twitter.com/status/user_timeline/saswatroutroy.json?count=10) [function.file-get-contents]: failed open stream: http request failed! http/1.0 404 not found filename: views/recipy_detail.php line number: 116 can solve me it looks me url throwing 404, , file_get_contents accurately throwing error. could try replacing url 1 returns successful json request.

javascript - Removing just position attribute in jQuery -

i set code have traits: the navigation items-texts- hidden behind divs i'll call them navigation divs when mouse move on of pixels-navigation divs-, text behind this, slide right , left , in cases, of them move top , bottom 15 px animate() method... when mouse move div, other text reset first position next action , did with: $(document).on('mouseover', '.pixel#p18', function(){ $('.submenus').not("this div's text").fadeout('fast').removeattr('style'); });/* div's text example*/ and wrote kind of navigation texts.. now problem is: when hover mouse on 1 of navigation divs, of texts did not animated, become visible because of removeattr('style')!!! don't want that... is there alternative way can slide texts or other elements left, right, top , down optional values of move...??? example 23px left or 17px top... etc???- i'm familiyar slideup , down , toggle not sure enough code... do hav...

linux - Multi-threaded VPN application - multiple tun/tap interfaces, or? -

i'm developing linux based vpn application. application establishing customized tls based connections multiple destinations. client machines routing traffic linux box running vpn application. i intend use tun/tap device grab traffic. have substantial load, intent use multi-threaded approach, multiple worker threads handling vpn connections different locations. my question regarding tun interface side of things. more efficient (or possible), have each worker thread allocate tun interface, use kernel route table route appropriate traffic each tun interface? or... use master worker thread, pull packets off single tun interface, , distribute packets each worker thread sent off appropriate vpn? i think second approach lead bottleneck, simpler use multiple interfaces regarding setup. the first approach, however, avoids passing messages between master thread worker thread, , routing source tun interface automatic. suggestions?

URI templates in WSO2 API Publisher -

is possible register endpoints uri templates in api publisher ships wso2 api manager version 1.4.0? example, register endpoint such as: /jobs/{jobid}/pems after saving api, can see bit in api config file: <resource methods="get" url-mapping="/jobs/{jobid}/pems"> i have tried manually changing xml file url-mapping uri-template, i.e., to: <resource methods="get" uri-template="/jobs/{jobid}/pems"> but still "no matching resource found in api given request". in case, not work around since need developers able register these endpoints publisher application. whenever changes saved api within api publisher interface, 'uri-template' gets reverted 'url-mapping'. thanks in advance. this due apipublisher app supports url-mappings when defining api resources. if want define uri-template ,instead of url-mapping,you can achieve changing api xml manually. but before make sure,when creating ...

sql - Sum a column that corresponds a aggregate from a column of another table -

Image
sorry title, couldn't think of better subject issue. i've 2 tables in many-to-one relationship between them , other many-to-one relatioshop in same table. need sum column corresponds aggregate column of first table. here image illustrate want: have no idea how proceed this. this should do: select isnull(e.idparent,e.id) id, sum(i.value) [sum] expense_table e left join invoice_table on i.idexpense = e.id group isnull(e.idparent,e.id) for updated requirement: select isnull(e.idparent,e.id) id, e2.[description], sum(i.value) [sum] expense_table e left join invoice_table on i.idexpense = e.id inner join expense_table e2 on isnull(e.idparent,e.id) = e2.id group isnull(e.idparent,e.id), e2.[description]

sql - Check if a varchar column can be convert to and int or a float -

what's easiest test check if varchar(500) column can turned float or interger? if use parse int . , there non numeric in string output non. check http://msdn.microsoft.com/en-us/library/f02979c7.aspx

ruby on rails - What's the difference between sending :include to class and directly defining method in second class definition? -

recently had add method redmine's core class. unable use inheritance, i've done this: require_dependency 'time_entry_query' class timeentryquery < query def my_new_method(foo, bar) end end and works - method added new objects. however, i've seen declaring new method in own module instead , sending :include class, become mixin. here's example: module patches module someclasspatch def my_new_method end end and somewhere in app's initialization: someclass.send(:include, patches::someclasspatch) unless someclass.include? (patches::someclasspatch) what's difference between these 2 methods , 1 should use? there 2 differences: when use mixin, there clear place "patch" methods can live. if wonder "hmm, where's my_new_method " coming from, , at, say, timeentryquery.ancestors or timeentryquery.instance_method(:my_new_method).owner , return patches::someclasspatch . know have file named lib/p...

delphi - Code sample for freeing advantage database server table -

i have set of tables included in advantage database data dictionary. dictionary no longer available, , tables not open. i free tables using code (not advantage data architect). the reference can find function listed in called adsddfreetable. the documentation function @ link: http://devzone.advantagedatabase.com/dz/webhelp/advantage11.1/index.html?ace_adsddfreetable.htm but not offer code sample, , cannot understand how use it. would kind enough show code sample of how function used (with variables, not literals, file names, etc) thanks much! ace.pas defines adsddfreetable as function adsddfreetable( puctablename: pacechar; pucpassword: pacechar ):unsigned32; {$ifdef win32}stdcall;{$endif}{$ifdef linux}cdecl;{$endif} the same ace.pas defines pacechar : type pacechar = pansichar; therefore, call function should straightforward: var tablename: ansistring; begin tablename := 'c:\data\mytable.adt`; if adsddfreeta...

java - Randomly "shaking" an array to assign new random spots -

what im trying take array coins[]. , rearrange each coin different position. have far. when though, nothing happens. meaning values stay same. except last one. 1 changes. public void shake() { (int = 0; < coins.length; i++) { int index = coin.random.nextint(coins.length); coin temp = coins[index]; coins[index] = coins[i]; coins[i] = temp; system.out.print(coins[i] + ", "); } } i instantiate random this: public static long seed = system.currenttimemillis(); public static random random = new random(seed); as using swap index swapping current value can edit random number generator generate random numbers between range (say 0 - coins.length ) , can change implementation this public void shake() { coin temp; (int = 0; < coins.length; i++) { //int swap = coin.random.nextint(coins.length); temp = coins[swap]; coins[swap] = coins[i]; coins[i] = temp; ...

php - CakePHP - field named 'login' automatically gets converted to asterisks in $Model->find() -

i've been using cake quite time, , noticed strange first time today while writing simple search behavior. i'm not doing complex, using $model->find() s on different models after initializing $model classregistry::init('model') . works great, except have database field named login in 1 of tables. value of field returns ***** rows perform search on! not happen while using find() s in controller or model, in behavior. below code: ... ... $model = classregistry::init('user'); $fields = array('user.login', 'user.name', 'relatedmodel.field1', 'relatedmodel.field2'); $contain = array('relatedmodel'); if($searchby === "name") { //some code , set $conditions } else { //else other code , set $conditions } $model->behaviors->load('containable'); $results = $model->find('all', array('conditions' => $conditions, 'fields' => $fields, 'contain' => $...

c - Fatal Signal 11 on android music streaming app -

i using project code music streaming-application on android devices: https://github.com/spotify/psyonspotify unfortunately, app crashes randomly. have tried debug c-code ndk-stack. according output problem lies in following line: assert(sl_result_success != result); (l.92 in sounddriver.cpp). have tried change and/or comment line out, error still remains... it seems kind of problem related incorrect memory allocation doesn't seem have buffer size, there seems enough storage size left (see logging output) 09-03 20:00:50.556: i/debug(4356): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 09-03 20:00:50.556: i/debug(4356): build fingerprint: 'samsung/p4notewifixx/p4notewifiww:4.1.2/jzo54k/n8010xxucmh2:user/release-keys' 09-03 20:00:50.556: i/debug(4356): pid: 2103, tid: 2204, name: network thread >>> com.masterarbeit.wheel4tunes <<< 09-03 20:00:50.556: i/debug(4356): signal 11 (sigsegv), code 1 (segv_maperr), fault addr deadbaad...

c# - Path not found error -

i installed signalr 2.0-rc1, and: 1: created hub: public class socials : hub { public void publicchat(string message) { clients.all.publicchat(new { message }); } } 2: created startup class: public class startup { public void configuration(iappbuilder app) { app.mapsignalr(); } } 3: registered in web.config: <add key="owin:appstartup" value="scyk.startup, scyk"/> //scyk main namespace, project name, placed startup class in there. now, https://myhost.com/signalr/hubs generating javascript file properly, when open developer console in browser, see has not connected, but: there asp error saying path /signalr/connect not found (why trying access /signalr/connect? normal? if so, must purely routing problem, how solve it?) in console, see there eventsource's response has mime type ("text/html") not "text/event-stream". aborting connection. error. not sure if related, started show...

mysql - SSH connection frozen on "enter password" after "watch mysqladmin" -

the server we're using linode running debian 7. i'm using terminal on os x connect via ssh. while connected box via ssh, typed "watch mysqladmin -u root -p password" , prompted me "enter password:". , it's stuck there. typing password , pressing enter nothing. control-c didn't work. console unresponsive. any ideas on how can exit prompt? i'm relatively new command line appreciated. if try running mysqladmin directly, using mysqladmin -u root -p password then you'll see half problem password isn't getting passed mysqladmin. try removing space: mysqladmin -u root -ppassword the watch command not intended running interactive code - hence doesn't read type @ prompt - , isolates command terminal. i can't imagine reason runnning mysqladmin via watch - doing do, account on box able see root mysql password - safer use user options file set password. as terminating existing process, if sigint (ctrl+c) doesn...

How can I format user input into a neat table for output in C++ -

i having problems getting table line correctly, cout statement table. problem how can format different things in 1 line without messing next entry in line. example, when use setprecision(2) goldweight, goldvalue gets messed , gives me weird number 5656e+02 cout << " value analysis" <<endl; cout << "gold: " << setw(6) << "" <<goldweight<< " oz @ "<<costgold<<" ("<<setw(1)<< ""<<carats<<" carats) $"<<goldvalue<<endl; yes, setw() , setprecision() , etc mess stuff. can use temporary std::ostringstream . #include <sstream> ... std::ostringstream oss_goldweight ; std::ostringstream oss_goldvalue ; std::ostringstream oss_goldcarats ; oss_goldweight << setw(6) << goldweight ; oss_goldvalue << setprecision(2) << goldvalue ; oss_goldcarats << setw(1) ...

c# - Optional params[] array being named, can i do this? -

this question has answer here: named arguments call in c# variable parameter number 2 answers here logging signature public static void debug(string message,exception exception = null,object model = null,object userid = null,[callermembername] string membername = "",params object[] formatparams) and trying use like logger.debug("my message: {0} {1}", formatparams:1,2) how can this? cannot find on net, hope possible. tried anon type didnt work. logger.debug("my message: {0} {1}", formatparams: new{1,2}) resolution: ended using example below. getting different errors other syntax wanted make sure saved here. logger.debug("my message: {0} {1} {2}", formatparams: new object[] { 1, "string", 123.12m }); edit: issue having ended being related dynamic being passed in formatparams, fixed casting type before lo...

gmail - PHPMailer from Google users blocked by my Server? -

hi im using phpmailer in order receive messages websites contact form. email required field. messages, fake email addresses, except gmail. when user insert gmail address in email field contact form responds message sent user receives error below in spam gmail folder: the original message received @ tue, 24 sep 2013 12:08:21 -0700 localhost [127.0.0.1] ----- following addresses had permanent fatal errors ----- <info@mywebsitename.com> (reason: 553 sorry, mail administratively denied. (#5.7.1)) ----- transcript of session follows ----- ... while talking relay-hosting.secureserver.net.: mail from:<usernamemail@gmail.com> size=1543 body=8bitmime <<< 553 sorry, mail administratively denied. (#5.7.1) 501 5.6.0 data format error reporting-mta: dns; xxxxxxx.xxx.xxxx.xxxx.secureserver.net received-from-mta: dns; localhost arrival-date: tue, 24 sep 2013 12:08:21 -0700 final-recipient: rfc822; info@mywebsitename.com action: failed status: 5.1.3 diagnostic...

directx 11 - Specifying the target layer of a 3D rendertarget in vertex shader? [HLSL] -

when working in hlsl/directx11 see there 2 methods binding 3d rendertarget: either bind entire target or bind while specifying layer. if bind entire target how 1 specify layer in hlsl code output color applied? i have suspicion requires geometry shader ... correct? is there other approach allow done in vertex shader or elsewhere? if bind whole volume texture (or texturearray), indeed need use geometry shader write specific slice. your gs output structure this: struct gsoutput { float4 pos : sv_position; uint slice : sv_rendertargetarrayindex; //add else need triangle }; please not slice not interpolated, if need emit several slices need push 1 primitive per slice. second case not want use geometry shader. create rendertargetview description same parameters previous one, each slice, change parameters (this texture2darray, it's same if use texture3d) : d3d11_render_target_view_desc rtvd; rtvd.viewdimension = d3d11_rtv_dimension_texture2darr...

java - Struts 2 type converter issue -

i trying use custom type conversion property file action. action class implementing modeldriven bean properties. public class welcomeaction extends actionsupport implements modeldriven<mybean>{ public string execute(){ return success; } private mybean bean = new mybean(); @override public mybean getmodel() { return bean; } } bean class is: public class mybean{ private rectangle rectangle; public rectangle getrectangle() { return rectangle; } public void setrectangle(rectangle rectangle) { this.rectangle = rectangle; } } and have welcomeaction-conversion.properties file parallel action class converter config as: bean.rectangle=struts2.typeconverters.rectangletypeconverter i tried putting key bean, rectangle etc not working, not using converter class. if use @typeconverter annotation or global converter working fine. my struts 2 version 2.3.15.1, idea issue. update: created issue https://issues.apache.org/jira/browse/ww-4249 got cor...

android - How to set a minimum sdk version for a widget -

in widget, use collections (supported in android >= 4.x). is there way set widget appear in android >= 4.x versions (without creating 2 apks)? therefore, works in normal android app. <uses-sdk android:minsdkversion="10" <!-- android gingerbrand --> android:targetsdkversion="14" /> <!-- android ics--> with android 2.3 device widget not shown on app tray.

Python: dictionary comparisons in splitting lists by first character -

here exercise stumping me: implement function partition() splits list of soccer players 2 groups. more precisely, takes list of first names (strings) input , prints names of soccer players first name starts letter between , including , m. >>>partition([''eleanor'', ''evelyn'', ''sammy'', ''owen'', ''gavin'']) eleanor evelyn gavin >>>partition([''xena'', ''sammy'', ''gavin'']) >>> here attempt: def partition(): names=[''eleanor'', ''evenlyn'', ''sammy'', ''owen'', ''gavin''] name in names: if name[0]==''abcdefghijklm'': print (name) i know i'm going wrong in defining letters, i'm hitting blank, because professor suggested use dictionary comparisons. there way use comparisons split names? ...