Posts

Showing posts from March, 2011

linux - How to check contents of unknown .py process? -

so did fresh install of antegros (which arch easy installation) using full iso official website. ticked few additional features in installation printer support, easy firewall, firefox, etc. picked xfce de. now right after installation checked task manager , there odd process running under user called "applet.py". consumes 30.3 mib , sits @ 0% cpu usage. returns home directory cwd. i want check contents of py file couldn't find way of doing after searching. can't seem find interesting in /proc/[pid]. how can read contents of python script? what think is? isn't kinda odd py file running in fresh installation? since appear have pretty minimal (and fresh) install, recommend searching filesystem file running. try: find / | grep "applet.py" (this need superuser permission). as long installation size sufficiently small, search shouldn't take long. on 2 ubuntu installations have access to, found applet.py scripts in /usr/share/sy

python - Security considerations with server side urllib2.urlopen with url from user -

i'd users able upload images web providing url. don't think can client fetch image , upload due possible cors issues , hotlink prevention, i'm getting server it. the biggest concern user entering file:///home/user/secret_image.jpg . url gets sent server , django happily fetches it, local server side file, hosting world see. there way limit requests external resources? how can approach made safe (at least -ish)? some other concerns may user providing hostname resolves local address or providing public url redirect local address. other devices on lan wouldn't accessible. filtering url text not option. perhaps check ip gets routed gateway , destination outside subnet before allowing urllib continue. block redirects, may useful feature in cases, write redirect handler re-check ip. starting feel patch job , not nice robust takes-care-of-all-cases solution. i'm doing basic stuff read(max_size) in case file huuge, using python-magic check mimetype , pick exten

sql - adding the sum of tables into one of the tables with a new date -

i have 2 tables, examples below tblorders id quantity abc 5 xyz 25 mno -50 wwl -35 tblholdings date id quantity 2-jan abc 100 2-jan ppp 12 2-jan mno 200 2-jan wwl 35 what need take current holdings tblholdings , add data tblorders & insert results tblholdings new date. result should below. please note wwl has 0 quantity there should new record wwl new date. tblholdings date id quantity 2-jan abc 100 2-jan ppp 12 2-jan mno 200 2-jan wwl 35 3-feb abc 105 3-feb ppp 12 3-feb mno 150 3-feb xyz 25 is possible using sql? try such query: insert tblholdings (date, id, quantity) select '3-feb', h.id, h.quantity + coalesce(o.quantity, 0) tblholdings h left join tblorders o on h.id = o.id h.quantity <> o.quantity the idea use select statement data need, , use select insert data holdings table

How to add radio button in menu bar, qt 5 c++ -

i making qt gui based application demonstration of algorithms, want select 1 algorithm @ time menu bar. for have 2 approaches in mind, one make qaction checkable , loop through each , check 1 clicked , uncheck others. the other add radio button in menubar. which approach more better ? if second 1 better how do ? you can use qactiongroup , use setexclusive(true) allow 1 checkable qaction checked @ time, don't have manually.

Running a program after system startup directlly from the linux kernel -

i trying run application directly linux kernel(without usage of cron or that). if change ./init/init.c, runs early: $ dmesg ... [ 0.605657] test!!! ... my idea launch application after successful user login, can't find appropriate function use. you're jumping conclusions. why want kernel if have whole userspace running already? (you want on user login) have @ 1 of standard mechanisms (depending on what's available in system): systemd user sessions .profile / .xinit files users for advanced scenarios, maybe socket activation services.

python - How could I extract the lengthy config from my controller/main code -

in controller.py file, have lots of actions do. and need following config in dictionary format. but these configs, params_template , header , .... distracting me. how save them in python file , , load them current controller.py thanks params_template=""" { "__eventtarget": "availabilitysearchinputsearchview$linkbuttonsubmit", "availabilitysearch.searchinfo.salescode": null, "availabilitysearch.searchinfo.searchstations[0].departurestationcode": from_city, "availabilitysearch.searchinfo.searchstations[0].arrivalstationcode": to_city, "availabilitysearch.searchinfo.searchstations[0].departuredate": "11/28/2015", "availabilitysearch.searchinfo.searchstations[1].departurestationcode": null, "availabilitysearch.searchinfo.searchstations[1].arrivalstationcode": null, "availabilitysearch.searchinfo.searchstations[1].departuredate&q

php - Laravel 5.2 Eloquent hasOne relationship doesn't work -

i have relationship in chat model public function user() { return $this->hasone(user::class,'id','writers_id'); } and want use in controller. tryed many ways, no 1 worked. giving last try example (result - blank page). print_r($chat = chat::where('id', 1)->first()->user); can me? thanks! don't understand eloquent, used simple db query maker before, said should every database stuff in model. correct? sorry poor english! first mentioned @vohuman return $this->hasone('app\user', 'id', 'writers_id'); and when using it: chat::where('id', 1)->first()->user()->first()->attribute

php - Check if process is running, if not start it -

i'm using ratchet, node js application , zeromq in codeigniter based php application. in admin dashboard, want able see if socket running , if node js app running. if it's down, need able put online. i know can use php's exec putting online, script finish, command line. how can achieve this? like: ratchet: status online (stop, start, restart) node service: status online (stop, start, restart) zeromq: status online (stop, start, restart) i tried lot of solutions including fsockopen() check if port open... but working solution check if node js application process on argument application file. if not use exec run permanently (with & argument) , putting output in logfile (in same folder of node app). $node = '/usr/bin/node'; $base = '/path/to/your/app'; $appfile = 'my_app.js'; $logfile = 'my_app.log'; $proc = explode("\n", trim(shell_exec(" ps -ef | grep -v grep | grep $appfi

polymer - How to add search for contacts like demo app using iron-list -

i trying implement simple contacts list one shown here . setup data source , given in example. if want add search box or dropdown @ top of page user selects drop-down menu or types in search box, how filter results. example: if user types "gri" in search box need show contacts firstname matching "gri". ideas how implement this? let's show contacts list this: <template is="dom-repeat" items="{{filteredcontacts}}" as="contact"> <div>{{contact.name}}</div> </template> and have list looks this: ... ... <script> filteredcontacts: { type: array, value: [], } unfilteredcontacts: { type: array, value: [{name:"testcontact1"}, {name: "testcontact2"}], } //this should called when input changes on text input onfiltertextinputchange : function(){ this.filteredcontacts = []; //we empty array old results won't shown var filterstring = this.$.myfiltertext

jquery - custom Component register javascript.. getting weird Uncaught TypeError -

i working on new template.which contains api called panel actions. enables create action icons on bootstrap panel. want load thesee panels dynamically..what meant after complete page loading want add new panels these action.but when gives me error $.components.register("panel", { api: function() { $(document).on('click.site.panel', '[data-toggle="panel-fullscreen"]', function(e) { e.preventdefault(); var $this = $(this), $panel = $this.closest('.panel'); var api = $panel.data('panel-api'); api.togglefullscreen(); });}); this how panel api in javascript..and here panel in html <div class="panel is-collapse"> <div class="panel-heading"> <h3 class="panel-title">panel tool</h3> <div class="panel-actions"> <div class="dropdown">

c++ - Generate random numbers exaclty once -

i need create set of random numbers between 0 , 800. problem @ moment need fast , each number shall returned once. my current approach is: create std::vector containing numbers 0 800 pick number using numbervector[rand() % numbervector.length()] delete number vector i have , current approach slow. there way speed things here? create std::vector containing numbers 0 800 shuffle vector. should useful: c++ - how shuffle std::vector? - stack overflow take elements of vector 1 one, head tail. don't have delete element: store index of last used element.

sqlcmd on Azure SQL Data Warehouse - SqlState 24000, Invalid cursor state after INSERT statement -

i working on script reload table using sqlcmd on linux connecting azure sql data warehouse database. after insert statement completes, next statement fails (but not end sqlcmd execution) "warning" insert schema.table_temp ( ...list of columns ) select ...list of columns schema.table ; go (comment--> in script, not echoed in log.) (0 rows affected) if exists (select table_name information_schema.tables t table_type = 'base table' , table_schema = 'schema' , table_name = 'table_nox' ) drop table schema.table_nox ; go (comment--> in script, not echoed in log.) sqlstate 24000, invalid cursor state the script continues run each subsequent batch getting same sqlstate 24000, invalid cursor state "warning" if comment out insert statement, script runs without warning expected. speculate insert statement not closing cursor , subsequent commands warning should considered eror , end execution. (i have -b flag on in s

html - Facebook in Mobile Web For RTL sites showing incorrect ellipsis -

Image
facebook on mobile web browser chrome showing ellipsis in wrong direction rtl languages share story description. because of missing rtl direction description enclosing tag, see screenshot issue, after fixing issue adding "rtl" dirction enclosing tag made ellipsis works, should facebook team include change in code, post 1 take them or missing anything? thanks in advance help.

inheritance - Removing just one inherit permission using PowerShell -

i'm trying write script can remove access rights 1 (e.g. everyone) on folders have inherited permissions in place. the other inherit permissions should stay intact. can remove inherit permissions , remove access group, inheritance broken. don't want enable inheritance after action because of subfolders having no inheritance being broken. how remove group without messing rest of permissions? you cannot (by design) remove inherited permission, "without messing rest of permissions". what can disallow inheritance, preserve inherited rules remove/modify everyone ace after removing inheritance like this: $filepath = "c:\parentfolder\childitem.ext" $fileacl = get-acl $filepath # remove inheritance preserve existing entries $fileacl.setaccessruleprotection($true,$true) set-acl $filepath -aclobject $fileacl # retrieve new explicit set of permissions $fileacl = get-acl $filepath # retrieve "everyone" rule $everyonerule = $

jsf - Table doesn't want to update after input search tags -

this question has answer here: commandbutton/commandlink/ajax action/listener method not invoked or input value not set/updated 9 answers i have weird problem, i'm sure it's related h:form placement tags. have table, above table have search form can put tags, example name or lastname , after table refreshed. , worked! reasons it's stopped working , have no idea why. in order check results of searching have refresh page or change pagination in table 10 15, after results appear. here code: xhtml: <h:form> <div class="row"> <div class="panel-heading text-center"> <div class="bootstrap-filestyle input-group inn"> <div class="search-criteria" style="width: 500px"> <h:inputtext value="#{clie

amazon web services - EBS Backed Root Partition Too Small - How Do I use full EBS capacity? -

i started new instance using debian-jessie-amd64-hvm-2015-04-25-23-22-ebs (ami-0d5b6c3d) , 80gb ebs root volume. here's problem seeing: admin@ip-xxxxxx:~$ df -h filesystem size used avail use% mounted on /dev/xvda1 7.8g 1.3g 6.1g 17% / udev 10m 0 10m 0% /dev tmpfs 200m 4.3m 196m 3% /run tmpfs 500m 0 500m 0% /dev/shm tmpfs 5.0m 0 5.0m 0% /run/lock tmpfs 500m 0 500m 0% /sys/fs/cgroup admin@ip-xxxxxxx:~$ lsblk name maj:min rm size ro type mountpoint xvda 202:0 0 80g 0 disk └─xvda1 202:1 0 8g 0 part / why this? it's silly default me 8gb , not give me easy way resize partition. watch this: admin@ip-xxxxx:~$ sudo resize2fs /dev/xvda1 resize2fs 1.42.12 (29-aug-2014) filesystem 2096128 (4k) blocks long. nothing do! i've seen guides online don't seem work me. tried taking snapshot , started secondary instance different(new) primary ebs. attached vole

bioinformatics - Efficiently match multiple strings/keywords to multiple texts in R -

i trying efficiently map exact peptides (short sequences of amino acids in 26 character alphabet a-z 1 ) proteins (longer sequences of same alphabet). efficient way i'm aware of aho-corasick trie (where peptides keywords). unfortunately can't find version of ac in r work non-nucleotide alphabet (biostrings' pdict , starr's match_ac both hard-coded dna). as crutch i've been trying parallelize basic grep approach. i'm having trouble figuring out way without incurring significant io overhead. here brief example: peptides = c("fsssgggggggr","gahlqggak","ggsggsyggggsgggygggsgsr","iisnascttnclaplak") if (!exists("proteins")) { bioclite("biomart", ask=f, suppressupdates=t, suppressautoupdate=t) library(biomart) ensembl = usemart("ensembl",dataset="hsapiens_gene_ensembl") proteins = getbm(attributes=c('peptide', 'refseq_peptide'), filters='refseq_peptid

git - Github: avoid syncing/pulling README.md -

how can exclude readme.md sync/pull/push github requests? wish download/sync files except file. context: have repo streakycobra style dotfiles management . add notes readme.md (showing on github), wish avoid having file in $home on computer. working off of @kba's comment, here's solution works: you can enable sparse checkout repo following command: git config core.sparsecheckout true then edit repository's .git/info/sparse-checkout file be: /* !readme.md which says "checkout everything, except file named readme.md ". format of sparse-checkout works same .gitignore file. just tested checking out existing repository, , works. (although, there's catch-22 situation need existing repository configure sparse checkout on, used git init create one, configured it, , added existing repo new remote).

scheme recursion - power of an int -

i trying implement function tells if parameter power of 2. here have (define (powof2 x) (cond [(and (even? x) (> x 1)) ((powof2 (/ x 2)))] [else (equal?(x 1))])) but when try run parameter 12 error saying: error: 3 not function [powof2, powof2, powof2, (anon)] any help? thanks! ah parenthesis ;-) (define (powof2 x) (cond [(and (even? x) (> x 1)) (powof2 (/ x 2))] [else (= x 1)])) note in 3rd line , 4th line had pair of parenthesis, , in 4th line should use = compare numbers.

What is the best way to shift a multidimensional array in Javascript? -

i'm trying create javascript function shifts array right x units y units. must keep array size same, , must call unloadchunk elements getting shifted off multidimensional array. here current implementation: function shift(x, y) { if (x > 0) { (var = 0; < chunks.length; i++) { (var j = chunks[i].length - 1; j >= 0; j--) { if(j + x > chunks[i].length - 1 && chunks[i][j]) { unloadchunk(i, j); } if (j < x) { chunks[i][j] = null; } else { chunks[i][j] = chunks[i][j - x]; } } } } else if (x < 0) { (var = 0; < chunks.length; i++) { (var j = 0; j < chunks[i].length; j++) { if(j + x < 0 && chunks[i][j]) { unloadchunk(i, j); } if (j - x >= chunks[i].l

jenkins - Change configuration once, and gets multiple config change history -

i work jenkins server in jobconfighistory plugin installed. server has been used while, , think many other plugins installed well. on server, multiple config change history recorded when make change job configuration. don't want behavior; want single history change single configuration change. i guess jenkins server config or installed plugin cause of problem, have no clue should find out. any idea? there jenkins issue has been resolved recently: [jenkins-22224] 1 job configuration change results in 3 job config history entries . but: danny staple added comment - 20/nov/14 5:17 pm we seeing general problem here - of plugins appear (parameterizedtrigger, throttleconcurrentbuilds, nodelabel, extendedchoice current suspects) - having many 8 (!!) saves in config. plugins, seems when there no change, save no-diff config. if each doing own save in order. marc günther added comment - 20/nov/14 5:23 pm +1 we not using disk-usage plu

Java Networking - Unexpected Vector Behavior -

basically have 2d vector representing player position resting on server want increment using clients ( can move ). having no problems @ server/client communication , command interface similar bash send comprehensive , deconstruct able commands between server , client : /command -param1 value1 -param2 value2 i can connect new clients , ping server , live information server. problem comes when trying set speed of client , causes vector stutter everywhere while actual position , speed im getting server remains @ 0. try , debug weird behavior decided add line of code adding 0.0001f x position of client each server tick. works , vector moves on client screen except fact it reaches 256.0 stops moving . if increment bigger value same thing happens , time vector reaches large value before stopping. i post code here there of , have absolutely no idea causing this. could because try send numeric values using text ? because server isnt running @ constant tickrate ? because store cli

selenium - Why the debugger is not going to next line after clicking on file download button through IE Web driver c# -

i clicking on file download button in internet explorer. , open/save/cancel prompt coming. this open , save prompt in ie after clicking download button code in c# clicking on download file button. iwebdriver driver = new internetexplorerwebdriver(); driver.findelement(by.id("id_download_file_button")).click(); console.writeline("donload button clicked"); after clicking on button flow not going next line. stucks there. after few seconds throwing wedriver timeout exception. is there workaround or 1 have idea. why webdriver not going next line. that "dialog" browser specific , not html dialog. code using html dialog won't work. gets stuck there because have implicitwait() set , selenium waiting timeout , exception thrown.

amazon web services - Jenkins configuration to access in different AWS servers in same network -

jenkins installed in aws server war file in windows os environment , , want access link in aws servers of same network , ports have been opened , still not able access localhost link / system domain link in other servers. help appreciated , in advance.

npm - How to redirect PUT request to POST request in express router route handler? -

i handling put /api/checkout route express router: this.router.put('/:id/checkout', (req, response, next) => { /*...*/ }); now handling different types of payments different third party services 1 of expects post request looking way handle put request executing post request third party service endpoint. how do ? what did @ point execute post request directly request.post . the challenge @ point how handle resource moved response. request.post({ url : 'https://paymentgateway.com/charge', form : { product_id : product_id, amount : amount } }, (err, httpresponse, body) => { the response here httpresponse.statuccode === 302 , body === <html><head><title>object moved</title></head><body> . not sure how handle this. html form same request parameters automatically redirects client redirect url. returning httpresponse client requesting checkout action job. client handles redir

html5 - Restricting characters in bootstrap input field using pattern attribute -

i have following field in bootstrap framework php page. <div class="col-xs-12 col-sm-10"> <div class="form-group"> <input type="text" name="inp_field1" id="inp_field1" class="form-control input-sm" placeholder="do here..." value='<?php echo($data_text_1)?>' required data-toggle="tooltip" title="do here..." tabindex="3"> </div> </div> i need restrict few characters example /@. how can restrict specific characters. not looking can allowed cannot instead. ideally if can done using pattern attribute, great. try <div class="col-xs-12 col-sm-10"> <div class="form-group"> <input type="text" name="inp_field1" id="inp_field1" class="form-control input-sm" placeholder="do here..

amazon web services - Passing variables between EC2 instances in multi-step AWS data pipeline -

i have pipeline setup wherein have 3 main stages: 1) take input zipped file, unzip file in s3. run basic verification on each file guarantee integrity, move step 2 2) kick off 2 simultaneous processing tasks on separate ec2 instances (parallelization of step saves lot of time, need efficiency sake). each ec2 instance run data processing steps on of files in s3 unzipped in step 1, files required different each instance. 3) after 2 simultaneous processes both done, spin ec2 instance final data processing. once done, run cleanup job remove unzipped files s3, leaving original zip file in place. so, 1 of problems we're running have 4 ec2 instances run pipeline process, there global parameters each ec2 instance have access to. if running on single instance, of course use shell variables accomplish task, need separate instances efficiency. our best idea store flat file in s3 bucket has access these global variables , read them on initialization , write them if need change

javascript - Shopping list app not adding ,clearing and removing items -

[1]hello, i trying create shopping list app i've been troubleshooting , still not working .i dont know wrong code??? here html, css , jquery code in jsfiddle :[shopping list code][1] [1]: http://jsfiddle.net/rizabarone/hp01kahn/ your code missing }); $(function () { var add = $('#additem'); var newitem = $('#newitem'); var list = $('#itemlist'); add.on('click', addlistitem); list.on('click', '.checkbox', tickitem); list.on('click', '.delete', deleteitem); newitem.on('keypress', function (e) { if (e.which == 13) { addlistitem(); } }); }); // <--------------------- here

vba - Excel 2003, adding content with checkboxes -

i propulating range rows using vba, each row have own checkbox. so far code looks this: dim objcolumnheadings range, objdbsheet worksheet dim lngrow long, objcell range dim objcheckbox object set objdbsheet = getdbsheet() set objcolumnheadings = objdbsheet.range("columnheadings") objcolumnheadings.clearcontents lngrow = 1 each varexisting in objcolumns objcolumnheadings.cells(lngrow, 1).value = varexisting set objcell = objcolumnheadings.cells(lngrow, 2) set objcheckbox = activesheet.oleobjects.add(classtype:="forms.checkbox.1" _ , left:=412.8 _ , top:=objcell.top _ , height:=10 _ , width:=9.6) objcheckbox.name = "cb" & lngrow objcheckbox.appearance.caption = "" objcheckbox.appearance.backcolor = &h808080 objcheckbox.appearance.backst

node.js - What exactly does .pipe() mean in gulp? -

i relatively new gulp, , wondering .pipe() in gulp task? i've gathered runs after return , after .src , there must more that. i've been unable find on web or in gulp's documentation , want understand i'm using. edit found this , poor job of explaining it from node docs: https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options the readable.pipe() method attaches writable stream readable, causing switch automatically flowing mode , push of data attached writable. flow of data automatically managed destination writable stream not overwhelmed faster readable stream. so in gulp can chain multiple tasks using pipe() method. gulp makes use of streams. there readable , writeable streams. take following snippet example: gulp.src(config.jssrc) .pipe(uglify()) .pipe(gulp.dest(config.dest + '/js')) .pipe(size()); gulp.src(...) turns path @ config.jssrc readable stream of data piping gulp-uglify module. uglify

java - FileUploadBase does not find any multipart parts when uploading small files -

i using spring's commonsmultipartresolver process file uploads in servlet 3 environment. if uploaded file large, works fine. if uploaded file smaller, resolver fails discover parts (with no exception thrown). i have tracked down apache.commons.fileupload.fileitemiteratorimpl findnextitem() method returns false, despite there being multiple valid parts in post. results in no multipartfile object being available controller method. when in debugger @ httpservletrequest see correct number of parts ( getparts() returns correct number of parts). i use httpservletrequest , except large files (>1mb), exception thrown maximum file size (which have configured commonsmultipartresolver evidently not cross on httpservletrequest ). i looked @ attempting configure servlet 3 maximum file size, don't want add several new classes application set size. is there way upload smaller files using servlet 3 , commons-fileupload ? more i have commons-fileupload configure

hadoop - Why does YARN job not transition to RUNNING state? -

Image
i've got number of samza jobs want run. can first run ok. however, second job seems sit @ accepted state , never transitions running state until kill first job. here view yarn ui: here details second job, can see no node has been allocated: i have 2 datanodes, should able run multiple jobs. here relevant section of yarn-site.xml (the other config have in file ha config, zookeeper etc): <property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>128</value> <description>minimum limit of memory allocate each container request @ resource manager.</description> </property> <property> <name>yarn.scheduler.maximum-allocation-mb</name> <value>2048</value> <description>maximum limit of memory allocate each container request @ resource manager.</description> </property> <property> <name>yarn.scheduler.minimum-allocation-vcores</

javascript - React onClick event yields: "Uncaught TypeError: Cannot read property of undefined", despite binding -

i'm writing react script render bunch of <a /> elements defined array. ... render: ... var behaviourcomponents = this.props.myobjectarray.map(function(element) { return <a classname="crumbfile" onclick={this._myfunction.bind(this,element.value1)}>{element.value2}</a>; }); return ( ... <div>{behaviourcomponents}</div> ...) this works fine when there no function call onclick. however, when there error: "uncaught typeerror: cannot read property '_myfunction' of undefined". this strange because have component right before onclick function call works fine ( <a class="btn header" style={buttonstyle} onclick={this._onload}>load</a> ), makes me think scoping issue due map() function. however, used .bind(), not sure what's wrong here. this because context inside of function pass map() not referring react component class. default, context globa

php - Facebook loading images from another sites with given link -

i want know how facebook can extract images given link. if please me. here screen of mean. facebook screen you should read on document object model: https://en.wikipedia.org/wiki/document_object_model this extremely general question, , there many, many ways it. jquery's find() it, example, if search img tag. pretty every language has library navigating dom. looking @ tagged languages in question, you've got php's domdocument , python's xml.dom . if you're super new stuff, should graph theory , tree data structures , because that's core idea of dom.

ios - How do I cast an NSDictionary to a swift dictionary if the NSDictionary has integers for keys -

i have dictionary stored in plist has imbedded dictionary in it. if use strings keys can use code below cast swift dictionary: let namesdict = nsdictionary(contentsoffile: path!) var names = namesdict [string: [string : string]] however if try use integers keys in root dictionary can't work. code below doesn't work , returns error: "value type not bridged objective-c" let namesdict = nsdictionary(contentsoffile: path!) var names = namesdict [int: [string : string]] i have tried intvalue, doesn't work either. missing? from apple's nsdictionary reference: in general, key can object (provided conforms nscopying protocol—see below), note when using key-value coding key must string (see key-value coding fundamentals). plist key-value coding compliant

php - How to query posts by all friends of a user (stored between 3 MySQL tables)? -

so have user information, user-posted content , friends in separate tables. example data: user: id username email 1 usera myemail@testa.com 2 userb myemail@testb.com 3 userc myemail@testc.com user_content id user_id date text 1 1 2015-09-12 00:24:08 content here 2 2 2015-09-11 00:24:08 more content here 3 1 2015-09-10 00:24:08 more content here b 4 3 2015-09-05 00:24:08 more content here c friends id user_id_1 user_id_2 1 1 2 2 2 3 3 2 4 the user table store information specific user, user_content stores content posted user , friends stores 'friend' associations between users. my question is, how query data user_content friends of particular user sorted date? loop through each friend of particular user: $stmt = $mysqli->prepare("select user_id_1, user_

Creating the logic for a program that reverses an array of numbers -

i'm having little trouble homework. believe have solution problem, i'd make sure. here's question. "create logic program prompts user ten numbers , stores them in array. pass array method reverses order of numbers. display reversed numbers in main program." here's have far: start declarations num numbers[10] count = 0 9 step 1 input numbers[x] endfor reversearray(numbers[x]) count = 0 9 step 1 output nums[x] endfor stop reversearray(num nums[x]) declarations num nums[10] count = 0 9 step 1 if nums[x] > nums[x + 1] swap() endif nums[x] = nums[x + 1] endfor return nums[x] any appreciated. isn't in specific program, syntax doesn't matter much.

c++ - Cocos2d-x PhysicsContact Object Reference -

i'm trying make videogame c++ in cocos2d-x have issue physiccontact. in gamescene have contact listener check collisions character , objects' physicbody of class item. works fine, want recognize object has collided because want call method of object's class called getthrow(). class item : public cocos2d::layer { public: sprite* itemart; int itemtype; physicsbody* itemcollider; void createart(int type); void getthrow(); item(int type); }; i have tried physiccontact information, first obtain object physicbody , node, obtain object's sprite , @ point don't know how reach object call method. bool level0::oncontactbegin(physicscontact &contact) { auto bodya = contact.getshapea()->getbody()->getnode(); auto bodyb = contact.getshapeb()->getbody()->getnode(); //here want run bodyb->getthrow() return true; } i have tried getuserdata() , getuserobject() don't know how call method obje

css - How do I control the leaking of this link? -

i'm sending activation email. user must click button activate account, link boundaries extending beyond button. how fix problem without inserting a tags inside main element? then, text clickable, not parent div. <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td align='center'> <div style='border: 1px solid #ccc;width:538px;font-family:helvetica; padding: 30px'> <span style='font-size: 30px;text-align: center;color: #606060;font-weight: bold;'> 1 more step... </span> <br> <br> <br> <a href='#' style='text-decoration: none'> <div style='color: white; padding: 20px 50px 20px 50px; background: #69b8d6; border: 1px solid #69b8d6;text-align: center;width: 156px;font-size: 18px;font-weight: bold;border-radius:3px;'> activate account <

jquery - Contenteditable <div> inside a <td> becomes un-editabale after assigning text to <td> in IE -

my objective show table cells populated values database , make them editable in ie. i using contenteditable attribute explained here , cannot assign contenteditable <td> 's , have use <div> or <span> inside them. that works great long haven't assigned text <td> that, becomes uneditable. have tried wrapping whole table inside contenteditable <div> makes table headers editable , haven't found way override that. plus, tabbing goes out of whack , need add new functions handle tabbing between <td> 's. have tried explain behavior here fiddle . can please tell me best way accomplish this? needless chrome handles perfectly, ie problematic. thanks much!

javascript - js: How navigate to new url and get callBack when page is loaded? -

i trying implement js function navigates 3rd party url , call function once page loaded; document.location = "http://ww.example.com"; window.onload = function () { alert('example.com page loaded!") } can done ? you can't. the execution environment first page destroyed before 1 new page created. cannot interact. the closest come pass data (through url / cookie / local storage) other page in script runs on it.

android - Loading Images for gallery from Custom folder -

i trying load images , show them gallery in form of list. problem able default android gallery, don't know how t custom folder. e.g /pictures folder. have been trying, here code use default gallery, want other folder, e.g /pictures/col. public static list<photoitem> getalbumthumbnails(context context){ final string[] projection = {mediastore.images.thumbnails.data, mediastore.images.thumbnails.image_id}; cursor thumbnailscursor = context.getcontentresolver().query( mediastore.images.thumbnails.external_content_uri, projection, // columns return null, // return rows null, null); // extract proper column thumbnails int thumbnailcolumnindex = thumbnailscursor.getcolumnindex(mediastore.images.thumbnails.data); arraylist<photoitem> result = new arraylist<photoitem>(thumbnailscursor.getcount()); if (thumbnailscursor.movetofirst()) { { // generate tiny thumbnail version

java - Trying to get libGDX on mac -

i'm new programming , trying develop html5 game. planning use libgdx framework job done. have tried downloading on mac app has not shown up. have not having apple dev account? as far know don't need apple dev account (99$) as long not going develop application ios . you need ide develop program on. use eclipse windows. since using mac, prefer xcode 7 , free. need java jdk , java jre. can download libgdx project creator here . i suggest read documentation libgdx .

java - Use "javax.crypto" library in a .JAR file -

at beginning of code of java application, 1 class called decrypt resources (text files , images) using javax.crypto (these resources encrypted in same way). in eclipse, application works , resources decrypted. when export runnable .jar file, nothing happens when try launch it. added "jce.jar" library "external jar" in build path, still didn't work. here imports of "decrypt" class : import javax.crypto.cipher; import javax.crypto.cipheroutputstream; import javax.crypto.secretkey; import javax.crypto.secretkeyfactory; import javax.crypto.spec.deskeyspec; i use "proguard" obfuscate jar files, , when launched project, showed : -warning : library class javax.security.auth.kerberos.kerberoskey extends or implements program class javax.crypto.secretkey -warning : library class javax.security.auth.kerberos.keyimpl extends or implements program class javax.crypto.secretkey -warning : there 2 intances of library classes

Angularjs and Normal Javascript functions don't work together? -

the following code without angular association able draw file onto canvas, when write same code on view angular spa, doesn't seem work. i'm new angular. combination not allowed? or doing else wrong? apologies if question elementary. <div class ="container"> <div class="jumbotron"> <p> <h3>claim token here</h3> </p> <p> click picture of qr code: </p> <!-- <p> <input type="text" ng-model="tokenid"> </p> --> <p> <input type="file" capture="camera" accept="image/*" id="camsource" name="camsource"> </p> <p> <canvas id="qr-canvas" width="300" height="300" style="border:1px solid #d3d3d3;"></canvas> </p> <p> <button type="submit" class="btn btn-default&quo

angularjs - Exposing all dependencies to view ES6 Angular -

this question kind of asked here in 1 of comments under answer no 1 seems have commented or answered. i started converting es5 code use es6 javascript in 1 of angular projects , noticed when injecting dependencies, use syntax: constructor($http, someservice) { this.$http = $http; this.someservice = someservice; } what don't understand doesn't expose services/dependencies view controller bound to? view have access someservice , properties.

java - How to convert from Json to Protobuf? -

i'm new using protobuf, , wondering if there simple way convert json stream/string protobuf stream/string in java? for example, protostring = converttoproto(jsonstring) i have json string want parse protobuf message. so, want first convert json string protobuf, , call message.parsefrom() on it. thanks in advance help! with proto3 can using jsonformat . parses directly json representation, there no need separately calling mymessage.parsefrom(...) . should work: jsonformat.parser().merge(json_string, builder);

java - Register broadcast receiver via Application context -

my application class handles current activity's context , other stuff (like showing toast, dialogues , that). other thing, i'm using application class, registering broadcast receivers. not via activity's context, application's. want know is: broadcast receiver block ui (activity's) thread? (i'm calling receiver via application, make difference?) also, there's option can register receiver via handler (from application context). should that? or there other approach available, won't block main thread? thank you. broadcastreceiveronreceive() called within main thread of process, unless explicitly asked scheduled on different thread using [ registerreceiver(broadcastreceiver, intentfilter, string, android.os.handler) ]( https://developer.android.com/reference/android/content/context.html#registerreceiver(android.content.broadcastreceiver , android.content.intentfilter, java.lang.string, android.os.handler)). when runs on main thread should ne

c++ - New Symbolic Color in Pango Span Text -

first time poster; long time admirer of stack overflow angels. i'm having issue colors in span text controlled pango. long version: i'm updating old ui program has c++ code guts gtk, xml (written glade), , rc stylesheet handling graphics. of our colored markup text hard-coded in xml. of dynamically set in c++ code. problem is, when program runs on our older systems, color referenced span text 'green' shows #00ff00. on our newer systems, 'green' showing #008000. example of code printing label widget: gtk_label_set_markup((gtklabel *) titlebarlabel, "<span color='green'>orbital cannon positioning</span>"); i'm pango in control of span text markup. found difference between greens difference between x11 , w3c color lists ( https://en.wikipedia.org/wiki/x11_color_names#clashes_between_web_and_x11_colors ). seems our old systems using x11 , our new ones using w3c, makes sense. i replace instances of 'green'

How to let user select video thumbnail in android -

my app allows users upload videos server. presently use thumbnailutils.createvideothumbnail create thumbnail upload video. how might go allowing user select thumbnail? i understand use recyclerview or listview adapter. much. how go loading them thumbnails user choose from?