Posts

Showing posts from April, 2013

android - Is there a way to side load an APK on a nexus 5 without google play and without enabling developer mode? -

there no file explorer comes nexus 5, , when try copy apk downloads folder not see on nexus 5 ui. send email address associated device, attachment. able open attachment , install apk. developer mode doesn't need on, may need enable installing non-trusted sources.

Select2 Loading remote data Example not working -

Image
this example not working @ all.. can please create in jfiddle???? here example site. https://select2.github.io/examples.html thank help!!! found answer this. see below example. hope helps others! here fiddle here script : function formatrepo (repo) { if (repo.loading) return repo.text; var markup = '<div class="clearfix">' + '<div class="col-sm-1">' + '<img src="' + repo.owner.avatar_url + '" style="max-width: 100%" />' + '</div>' + '<div clas="col-sm-10">' + '<div class="clearfix">' + '<div class="col-sm-6">' + repo.full_name + '</div>' + '<div class="col-sm-3"><i class="fa fa-code-fork"></i> ' + repo.forks_count + '</div>' + '<div class="col-sm-2"><i

css - Flicker effect on hover transform -

i'm trying make cube 2 sides, 1 image container , other text container. here working plunker i'm rotating text container using: .page__text { transform: rotatey(-90deg) translatez(75px); } and on hover i'm rotating wrapper doing: .wrapper:hover { transform: rotatey(90deg) translate3d(0, 0, 0); } the hover works fine, problem when move mouse without moving outside wrapper transform makes flicker effect , if leaving element , transformation canceled any suggestion appreciated. regards when wrapper rotated, no longer has area on can hover (it @ 90 deg view) change hover state parent, still .cube-page__item:hover .cube-page__item-wrapper { -webkit-transform: rotatey(90deg) translate3d(0, 0, 0); transform: rotatey(90deg) translate3d(0, 0, 0); } plunker

iis - Sitecore publishing stuck initializing 6.4 -

i facing issue while doing publishing site/publishing content in sitecore. publishing window stuck @ initializing. sitecore version : sitecore 6.4 (rev. 110720) log error getting : warn long running operation: rendercontenteditor pipeline[id={fbd9e5f6-d571-487f-ba27-2b95e9f51022}] id in log current item id on doing publishing. for item in sitecore getting same issue. restart iis , recycle app-pool. please suggest me answer issue. regards, deepak narwal take @ following 3 database tables in master database. if have more few hundred entries, clear tables: history eventqueue publishqueue after that, recycle authoring instance's app pool , try again.

xaml - Drawing Parallel Lines in C# -

Image
sorry if has been asked before, couldn't find valid response or response understand currently have code draws line joint joint in kinect, forms bone: drawingcontext.drawline(drawpen, jointpoints[jointtype0], jointpoints[jointtype1]); in picture aboe shows parallel lines joining circle cirlce, can please explain me or show me create these lines? if have line point p0 point p1 , , want create parallel line / offset line, need use either trigonometry or vector math. to using vector math: find direction vector of line find vector perpendicular that use perpendicular vector offset p0 , p1 pseudo code: vector vline = ( p1 - p0 ).normalized(); vector vperp = new vector( -vline.y, vline.x ); point newp0 = p0 + vperp * offset distance point newp1 = p1 + vperp * offset distance drawline( newp0, newp1 ); reverse offset or negate vperp line on other side. how depends on have available. system.windows.vector , system.windows.point should work fine since

html - Changing the css path wordpress localhost -

i creating wordpress theme. have style.css style.scss in css/sass directory. wrodpress theme automatically links style.css want use style.scss file. how can force theme use style.scss theme located in template/css/sass/style.scss? i appreciate help

mysql - sql query comparing values -

it's sql question found when i'm preparing interview. how can efficiently find records value bigger previous one's? id 1 2 3 4 5 value 6 5 10 8 30 you use self join this. long question compare current record previous record (and not previous records). select t1.* table t1 inner join table t2 on t1.id = t2.id + 1 t1.value > t2.value

How can I turn an inputed string into a list in python? -

how can have user enter string , have string made list? have tried following code: original=input("enter message encode: ") originallist = list(original) print originallist i keep getting error though: nameerror: name 'whatever input' not defined i don't understand mean, if want whole string put inside list, do: a = list(raw_input()) or a = [raw_input()] # `split()` can take argument — character (or string) @ split # i.e.: "jim , tim; bob , rob".split(";") -> ["jim , tim", "bob , rob"] if wanted string split tokens, use built-in split method. a = raw_input().split() note: of course, python 3, raw_input() replaced input() . hope helps! :)

mdm - Established Linux processes -

we running ibm mdm server (initiate) connects through pooling mechanism oracle db server. configuration of pooling has been set 32. have custom java process submits data mdm server through api mdm server exposes. once our custom java process (which not open db connections directly) terminates, see number of processes between mdm server , db server has risen number greater 32. after each nightly run, see number of processes keeps on increasing , reached limit set oracle db (700) , db wont let more connections opened , our process fails on night. trying figure why arent processes getting terminated , why being still in established mode (as per netstat command) there several reasons number of processes increase , sockets in established state. typical mistake spawning child process each message/connect/register , not reusing existing connection. there timer callbacks involved e.g., c - register timer callback -> server c -> spawn process receive reply , listen on r

c++ - Does std::move on std::string garantee that .c_str() returns same result? -

i want provide zero-copy, move based api. want move string thread thread b. ideologically seems move shall able pass\move data instance new instance b minimal none copy operations (mainly addresses). data data pointers copied no new instance (constructed via move). std::move on std::string garantee .c_str() returns same result on instance before move , instance created via move constructor? no, but if needed, option put string in std::unique_ptr . typically not rely on c_str() value more local scope. example, on request: #include <iostream> #include <string> #include <memory> int main() { std::string ss("hello"); auto u_str = std::make_unique<std::string>(ss); std::cout << u_str->c_str() <<std::endl; std::cout << *u_str <<std::endl; return 0; } if don't have make_unique (new in c++14). auto u_str = std::unique_ptr<std::string>(new std::string(ss)); or copy whole implemen

Elasticsearch on multiple fields with partial and full matches -

our account model has first_name , last_name , ssn (social security number). i want partial matches on first_name, last_name' exact match on ssn . have far: settings analysis: { filter: { substring: { type: "ngram", min_gram: 3, max_gram: 50 }, ssn_string: { type: "ngram", min_gram: 9, max_gram: 9 }, }, analyzer: { index_ngram_analyzer: { type: "custom", tokenizer: "standard", filter: ["lowercase", "substring"] }, search_ngram_analyzer: { type: "custom", tokenizer: "standard", filter: ["lowercase", "substring"] }, ssn_ngram_analyzer: { type: "custom", tokenizer: "standard", filter: ["ssn_string"] }, } } mapping [:first_name, :last_name].e

javascript - Maintaining an array of ints representing option indices in Angularjs -

i have array of ints in model meant represent indices of list of options user pick using select list. idea there's list can expand , keep picking things select list. have code along these lines: <ul> <li ng-repeat="item in model.arrayofints"> <select ng-model="item" ng-options="choice.id choice.name choice in common.options"> <option value="">---</option> </select> <button ng-click="model.arrayofints.splice($index, 1)" type="button"> delete </button> </li> </ul> <button ng-click="model.arrayofints.push(null)" type="button"> add </button> i have 2 problems seem related: the ng-model not seem bind properly; if inspect scope can see newly-pushed members of arrayofint still set null after select select menu representing

objective c - CLLocation services. Added plist keys and request permission, yet still not working for IOS 8 -

Image
i've checked other topics on stack overflow , done same changes. apple docs doesn't seem have i've missed either. copied plist file: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> ... <key>nslocationusagedescription</key> <string>used finding users in area. &quot;stealth mode&quot; can used if not users see location on map</string> <key>nslocationwheninuseusagedescription</key> <string>used finding users in area. &quot;stealth mode&quot; can used if not users see location on map</string> ... </dict> </plist> my code: +(asyncbackgroundupdatemanager*)getinstance { if (instance == nil) { instance = [[asyncbackgroundupdatemanager alloc] init]; } re

android - Real-time image processing with Camera2 -

i tried searching in ton of places doing this, no results. did read (as far know) way obtain image frames use imagereader, gives me image work with. however, lot of work must done before have nice enough image (converting image byte array, converting between formats - yuv_420_888 argb_8888 - using renderscript, turning bitmap , rotating manually - or running application on landscape mode). point lot of processing made, , haven't started actual processing yet (i plan on running native code on it). additionally, tried lower resolution, no success, , there significant delay when drawing on surface. is there better approach this? appreciated. im not sure doing images, lot of times grayscale image needed (again depending on exact goal) if camera outputs yuv, grayscale information in y channel. nice thing,is don't need convert numerous colorspaces , working 1 layer (as opposed three) decreases size of data set greatly. if need color images wouldn't help

python - How to differentiate endevent of music and channel? -

in pygame can use pygame.mixer.music load , play long audio files (by streaming), or pygame.mixer.sound & pygame.mixer.channel shorter ones (that loaded entirely memory) - understand correctly. i'd use both of these methods. i'd know, when playback of given channel or music has finished. there methods that: set_endevent() - on both music , channel. when use pygame.locals.userevent type of event, when channel's playback finished receive event code == <channel_id> . when music's playback finished, code 0. cannot tell difference, whether music stopped, or channel id 0. is there way tell them apart? -.- misunderstood documentation. there said: the type argument event id sent queue. can valid event type, choice value between pygame.locals.userevent , pygame.locals.numevents. if no type argument given channel stop sending endevents. and understood should choose either userevent or numevents . looking way use new event types thought impos

sql - wordpress log in using www.mywebsite.co.uk/wp-admin -

i used edit site using lamp going onto localhost/wp-admin i migrated site live importing/exporting database , changing urls using filezilla phpmyadmin cpanel etc etc(what supposed normally) realised there no way edit site live now. example www.mywebsite.co.uk/wp-admin instead of going through whole procedure again editing site localhost. edit live. im sorry cant seem find answers anywhere. see how migrate yes how edit after again??? live! please thank in advance siteurl , home fields not edited properly. sure not write www.mywebsire.com rather way > http://www.mywebsite.com , duplicate both fields correctly

apache - How to write RewriteCond base on directory name character length? -

i trying learn how apply rewritecond based on length of "request uri", or directory name. so 3 letter directories (/ark/, /pit/, /dyn/, etc), want apply rewritecond. doing this: rewritecond %{request_uri} !(ark|pit|dyn) [nc] which works, list can long , seems easier use regex or select 3 letter directories. any ideas? try this: rewritecond %{request_uri} !([a-z]{3}) [nc] this match folder name has lower case letters , in length of 3

sql server - How to retrieve XML that contains CDATA, from Database -

i need retrieve xml in following format <mv> <v>!cdata[[some_inner_xml_1]]</v> <v>!cdata[[some_inner_xml_2]]</v> </mv> i learned data in <v /> other xml. when thought data integer, wrote , worked select identifiertext 'v' ipmruntime.recordstoexport batchid = 5 xml path(''), root('mv') i trying use syntax 'v!cdata' - doesn't it. don't know stick cdata in it i tried syntax select 1 tag, null parent, identifiertext 'mv!1!v!cdata' ipmruntime.recordstoexport batchid = 5 xml explicit, root('mv') it results in need <mv><mv><v><![cdata[47f81be4-b54f-4703-840b-62b306c40842]]></v></mv><mv><v><![cdata[3ba36a1f-bf75-4ed9-911e-26f10fba5587]]></v></mv></mv> or, if use 'v!1' in same query, give me <mv><v></v><v></v></mv> goes cdata? but has each

How can I use PHP to grab files from different directories -

i understand in html, can use ../../../ include content included in other folders. i have php code , i'm wondering how can use ../../../ before header.php? <?php ob_start(); include("../../../header.php"); $buffer=ob_get_contents(); ob_end_clean(); $buffer=str_replace("%title%","homepage",$buffer); echo $buffer; ?> you can use chdir() php function , getcwd() . im suggest use constant source path location.. try this: <?php ob_start(); chdir("../../../"); $cwd = rtrim(str_replace("\\", "/", getcwd()), '/').'/'; include($cwd."header.php"); $buffer=ob_get_contents(); ob_end_clean(); $buffer=str_replace("%title%","homepage",$buffer); echo $buffer; ?>

android - Dynamically insert images into a GridView -

i making small game. want put images in grid view using dynamic array. accomplish this, have declared array random size. how can insert images in dynamic array , show images in grid view? random rnd = new random(); public int randomnumber=rnd.nextint(10); public int[]mthumbids=new int[randomnumber]; this project in github use show bunch of images net https://github.com/pablorr18/tiflexigrid

python - Add pandas Series to a DataFrame, preserving index -

i have been having problems adding contents of pandas series pandas dataframe. start empty dataframe, initialised several columns (corresponding consecutive dates). i sequentially fill dataframe using different pandas series, each 1 corresponding different date. however, each series has (potentially) different index. i resulting dataframe have index union of each of series indices. i have been doing far: for date in dates: df[date] = series_for_date however, df index corresponds of first series , data in successive series correspond index 'key' not in first series lost. any appreciated! ben if understand can use concat : pd.concat([series1,series2,series3],axis=1)

linux - What is the simplest way for my C program to receive some file paths from configuration? -

i have application configurable via command line arguments myprog -foofile 'foo.txt' -barfile 'bar.txt' command line parameters bit cumbersome want allow other avenues these configurations bit disappointed looking more complicated taught should be. solution 1: use environment variables i make program myprog_foo_file , myprog_bar_file envorinment variables. implementation getenv env variables global , add clutter , hard configure. specially gui apps because many window managers don't source ".profile" during initialization. solution 2: use configuration file since foofile , progfile kind of static configuration values, seems better put in configuration file somewhere: foofile = /home/hugomg/foo.txt barfile = /home/hugomg/bar.txt but afaik there no easy way in c read arbitrarily long string file. need make loop keeps reallocing buffer this? alternatively, since values file names, there #define somewhere specifying maximum size of p

arrays - Trouble with Basic Python exercise involving lists and indexes -

working on checkio exercises stuck here. need design function that'll find sum of elements indexes (0th, 2nd, 4th...) multiply summed number , final element of array together. input array, output number. oh, , empty array, result has zero. def checkio(array): sum = 0 if len(array) == 0: return 0 else: in array: if array.index(i) % 2 == 0: sum = sum + final = sum*(array[len(array)-1]) return final for instance, array [-37,-36,-19,-99,29,20,3,-7,-64,84,36,62,26,-76,55,-24,84,49,-65,41] , function returning -1476 when should giving out 1968 . here working program made. def checkio(array): listsum = 0 if array: in range(0, len(array), 2): listsum += array[i] finalvalue = listsum * array[-1] return finalvalue else: return 0 first, checks see if array has values. can this: if array: . if array empty, return 0 wanted. now, checks eve

r - How can I find out what proportion of values fall outside range? -

v <- c(1,2,3,4,5,6) and mention max=4,min=2 so, want know how many values fall outside range. i can (v < 2 & v > 4) but not sure how count... after create percentage respect total number of values (here 6). you can do: sum(v < 2 | v > 4) / length(v) [1] 0.5 you want use | instead of & because no number both less 2 , greater 4.

java - smbFile setLastModified not working on Windows share -

i'm using jcifs library copy jpg phone windows share. file copy works fine, setlastmodified method doesn't have effect. have full write permissions share in question. there other way of setting last modified date on file have created? smbfile sfile = new smbfile(destfilename, auth); fileinputstream fileinputstream = new fileinputstream(new file(ssourcefilepath)); byte[] buf = new byte[16 * 1024 * 1024]; int len; while ((len = fileinputstream.read(buf)) > 0) { sfos.write(buf, 0, len); } fileinputstream.close(); sfos.close(); sfile.setcreatetime(file_modified_date); sfile.setlastmodified(file_modified_date);

java - UML - How would you draw a try catch in a sequence diagram? -

Image
is there standard way of drawing try catch sequence diagrams? i've made attempt based on this feel end result doesn't feel right. code diagram based around: public static void save () { try { filehandle filehandle = gdx.files.external(file); filehandle.writestring(boolean.tostring(constantshandler.soundenabled)+"\n", false); (int = 0; < 5; i++) { filehandle.writestring(integer.tostring(constantshandler.highscores[i])+"\n", true); } } catch (throwable e) { } } my attempt note: know still need add loop. that's ok. fragments meant show conditional control flow in sequence diagram. superstructures puts limitations on use of fragments (see pp. 467 of ss2.1.1). should use critical region try part above. , option catch . however, keep telling can take quite freedom in using uml. it's language , such changes in life time. long reader ge

drop down menu - make Zurb Foundation dropdown the same width as their button -

is there zurb foundation variable can enable width of dropdown same width button clicked? if not, what's best foundation way of addressing issue? hoping add fix scss file. in documentation page dropdown , under "advanced" says can define maximum width dropdown adding classes " tiny, small,medium or large ". if button follows same structure both should have same width, or @ least define button's width same 1 dropdown class has.

php - How to change pdf tab title in browser -

my pdf file open in browser tab. in title of pdf tab instead of name shows url how can changed .i using codeigniter framework , using mpdf library pdf. your pdf document should have title metadata set. afterwards, browser use rendering tab title. http://www.w3.org/tr/wcag20-techs/pdf18.html

javascript - Manipulate widget loaded asynchronously -

i embedding widget html <div class="widget-hr-content"> <div class="widget-hr-header"> </div> <div class="widget-hr-facts"> <img> </div> </div> the script calls widget this <script async src="https://somewebsitesscript"></script> how use jquery manipulate anchor elements generated inside div class="widget-hr-facts" , know can use $('.widget-hr-facts').find('a').each use it, not understanding this. tried create new script tag add defer attribute it, didn't me. <script async src="https://somewebsitesscript"></script> <script async> $('.widget-hr-facts').find('a').each(function(){ $(this).attr("href","redirectsomewherediffthanwidget");}); <script> but jquery failing out uncaught referenceerror: $ not defined it timing issue, script taking lon

android - Cant cancel Notification using NotificationListenerService -

this service: public class listener extends notificationlistenerservice { context context; @override public void oncreate() { super.oncreate(); context = getapplicationcontext(); } @override public void onnotificationposted(statusbarnotification sbn) { string pack = sbn.getpackagename(); string ticker = sbn.getnotification().tickertext.tostring(); bundle extras = sbn.getnotification().extras; string title = extras.getstring("android.title"); string text = extras.getcharsequence("android.text").tostring(); log.i("msg",pack); log.i("msg",ticker); log.i("msg",title); log.i("msg",text); intent msgrcv = new intent("msg"); msgrcv.putextra("package", pack); msgrcv.putextra("ticker", ticker); msgrcv.putextra("title", title); ms

memory - Why does Python produce a MemoryError when I open this file -

i trying remove empty lines file. method reading file line line , writing lines not newlines new file. works great small files, reasons don't understand, i'm getting memoryerror on larger ones. problem file on 1gb, since i'm reading line line, don't think i'm storing more 1 line in memory. or i? with open(output_path, "ab+") out_file: open(input_path, "rb") in_file: line = in_file.readline() while line: if line != "\n": out_file.write(line) line = in_file.readline() when split file chunks, works fine, that's step i'd rather not do. want understand happening here. thanks! it turns out problem elsewhere in code. wasn't explicitly closing file, led issue. help.

How to make Prolog depth-first-search algorithm go deeper into the tree? (Applied to Sokoban) -

i'm trying solve sokoban puzzle in prolog using depth-first-search algorithm, cannot manage search solution tree in depth. i'm able explore first level. all sources @ github (links revision when question asked) feel free explore , test them. divided rules several files: board.pl : contains rules related board: directions, neighbourhoods,... game.pl : file states rules movements, valid positions,... level1.pl : defines board, position of boxes , solution squares sample game. sokoban.pl : tries implement dfs :( i know need go deeper when new state created instead of checking if final state , backtracking... need continue moving, impossible reach final state 1 movement. any help/advice highly appreciated, i've been playing around without improvements. thanks! ps.- ¡ah! i'm working swi-prolog, in case makes difference ps.- i'm newbie prolog, , maybe i'm facing obvious mistake, reason i'm asking here. this easy fix: in sokoban.p

How to open results in excel when clicked on a link from web page created using perl cgi script -

i have perl cgi script displays results (50 rows) database query on web page. at end of each row, have column html href link. when link clicked, have open particular record in excel , allow saved. i tried using spreadsheet::writeexcel , no luck. can please give me link or thread regarding this? code: while(my $row = $query->fetchrow_hashref){ $html .= "<tr>"; $html .= "<td style='border-bottom:1px solid #cccccc' nowrap>$row->{promoter}</td>"; $html .= "<td style='border-bottom:1px solid #cccccc' nowrap>$row->{company}</td>"; $html .= "<td style='border-bottom:1px solid #cccccc' nowrap>$row->{bunit}</td>"; $html .= "<td style='border-bottom:1px solid #cccccc' nowrap>$row->{sub}</td>"; $html .= "<td style='border-bottom:1px solid #cccccc' nowrap>$row->{region}</td>";

c# - Using Simple Injector with Unit Of Work & Repository Pattern in Windows Form -

i'm trying implement ioc in windows form application. choice fell on simple injector, because it's fast , lightweight. implement unit of work , repository pattern in apps. here structure: dbcontext : public class membercontext : dbcontext { public membercontext() : base("name=membercontext") { } public dbset<member> members { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.conventions.remove<pluralizingtablenameconvention>();\ } } model : public class member { public int memberid { get; set; } public string name { get; set; } } genericrepository : public abstract class genericrepository<tentity> : igenericrepository<tentity> tentity : class { internal dbcontext context; internal dbset<tentity> dbset; public genericrepository(dbcontext context) { this.co

ruby - Rails: route helpers for nested resources -

i have nested resources below: resources :categories resources :products end according rails guides , you can use url_for set of objects, , rails automatically determine route want: <%= link_to 'ad details', url_for([@magazine, @ad]) %> in case, rails see @magazine magazine , @ad ad , therefore use magazine_ad_path helper. in helpers link_to, can specify object in place of full url_for call: <%= link_to 'ad details', [@magazine, @ad] %> for other actions, need insert action name first element of array: <%= link_to 'edit ad', [:edit, @magazine, @ad] %> in case, have following code functional: <% @products.each |product| %> <tr> <td><%= product.name %></td> <td><%= link_to 'show', category_product_path(product, category_id: product.category_id) %></td> <td><%= link_to 'edit', edit_category_product_path(product, category_id:

android - SQLite elements in CREATE VIEW duplicating -

this view puts columns 3 tables db.execsql("create view " + viewcomps + " select " + company + "." + colcompid + " _id," + " " + accounts + "." + colname + "," + " " + company + "." + colcompclass + "," + " " + payments + "." + colgroupid + "," + " " + payments + "." + colpaydue + "," + " " + payments + "." + coldatedue + "" + " " + payments + ", " + company + " join " + accounts + " on " + payments + "." + colgroupid + " = " + accounts + "." + colid ); problem i have 3 companies a, b , c acc 1 assigned a, 1 acc = 1 company only acc 1 inserted , assigned a, problem if assign it duplicated b , c well. the result:

network programming - Directed Graphs in Julia, need some function like "has_edge" -

i have initialize directed graph in julia , searching procedure testing, if node has specific neighbour. in python have graph class can call function like: directedgraph.has_edge(i, j) -> true if , j connected i have not found s.th. similar in julia. can show me way, how implement in julia? using graphs.jl, think extensively package. just wanted follow here - has_edge exists in lightgraphs.jl both directed , undirected graphs. edited add: of post, graphs.jl has been moved "juliaarchive" organization indicating development has stagnated. lightgraphs.jl preferred graphs package julia.

Network access denied to external node.js socket -

i have 2 servers running on amazon's ec2. 1 standard web server running lamp (this behind elastic load balancer), other node.js server express , socket.io installed. on node server have server.js file (this file automatically loaded on server start). var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server); server.listen(8080); io.on('connection', function (socket) { socket.on('join', function() { console.log('joined'); } } on lamp server, clients connect external server by: <script src="https://cdn.socket.io/socket.io-1.3.4.js"></script> var socket = io.connect('http://url_here:8080'); socket.on('connect', function() { socket.emit('join', room_id); }); the problem, though, console spits out err_network_access_denied continuously, suggesting access port blocked. however, inbound rules node server

multithreading - Why does my C++ program crash with exit code 11 when I remove a cout statement? -

in c++ project, encounter strange issue. crashes exit code 11 when remove log statement ( cout ). this answer points source explains exit code 11 (actually eagain ) following statement: the system lacked necessary resources create thread, or system-imposed limit on total number of threads in process pthread_threads_max exceeded. but pretty sure don't create additional threads in code (at least not explicitly). why error occur , why go away when use log statement? for reference, post code it's of course out of context , relevant line 1 log statement. payloadregionmapper(string mappingtechniquename, string configpath = "") : payload(payload), config(config(configpath)) { cout << "construct payloadregionmapper" << endl; // if commented out, program crashes.... frames = generateframes(); setmappingtechnique(mappingtechniquename); } run program using debugger , backtrace once crash happens. using bt

javascript - jquery a href conflict with handlebars link -

i have a href when hover on shows correct link. using handlebars. {{#each tabs}} <li><a href="/tabs/{{this.tabid}}" data-toggle="tab">{{this.tabname}}</a></li> {{/each}} when click a uncaught error: syntax error, unrecognized expression: /tabs/1 if removed jquery page works fine, need jquery rest of page. any ideas? edit: <div id="content"> <div id="content-container"> <div class="tabbable"> <ul class="nav nav-tabs"> {{#each tabs}} <li><a href="/{{this.tabid}}" data-toggle="tab">{{this.tabname}}</a></li> {{/each}} </ul> <div class="tab-content"> {{#each tabs}} <div id="{{this.tabid}}" class="tab-pane"> <h4>{{this.tabname}}</h4> </div&

ruby on rails - Add custom field from foreign table and validate it -

i have 2 models, user model , agent model. user has one/zero agent. each agent has "code" promo code. when user signs up, can optionally enter agent code. when checking form, if user enters code, have check based on table "agents." if code wrong, form not validated , error appears, if code correct associate user agent. user model ( user.rb ) class user < activerecord::base enum role: [:user, :vip, :admin] after_initialize :set_default_role, :if => :new_record? has_one :agent def set_default_role self.role ||= :user end devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable end agent model ( agent.rb ) class agent < activerecord::base belongs_to :user end migration between user , agent class addagenttousers < activerecord::migration def change add_ref

javascript - jquery library needs to be loaded just before the script and conflicts with another library -

i can't figure out how use both javascript codes on same page. <script id="script" type="text/javascript"> jquery(document).ready(function(){ jquery("#menuzord").menuzord({ align: "right", effect: "slide", animation: "stretch" }); }); </script> i'm using code menu resize in header on every page. working when i'm using endless_pagination (django) javascript code stops working. {% block js %} {{ block.super }} <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="/static/endless_pagination/js/endless-pagination.js"></script> <script> $.endlesspaginate({ paginateonscroll: true, paginateonscrollmargin: 20 }); </script> {% endblock %} if delete library () resizing works endless_pagination not. i

c - How do I identify the source of a UDP packet in an access point? -

i'm creating kind of access point. i capture packets, of types, machine, in order prioritize them before forwarding them, according default quality of service (qos) classes. by calling socket eth_p_all parameter , can incoming packets of protocol type: if ((sockfd = socket(af_packet, sock_raw, htons(eth_p_all))) == error) { perror("socket"); exit(1); } by using ethhdr , iphdr , tcphdr , udphdr structs can't retrieve information on application sent each packet. however, both voip , snmp use udp, , don't know of 2 sent me udp package. i'd know applications sending udp packets, may follow qos classes , forward packets (e.g. conversational voice) before others (e.g. e-mail). in order recognize protocol, should use list of tcp , udp port numbers? you cannot tell for sure application sent packet - sender knows this. if understand correctly, want detect protocol being used. have 2 possibilities: assume appli

android - How to pass data between activities and perform arithmetic operation on that data -

i new android have learned how pass data between activites putextra,getextra in app,when pass data activity1 , activity2 main_activity , add both data , pass third activity ( output ) instead of addition ,only value of either activity1 or activity2 passing output (value being passed 1 entered last during running app) here code of app mainactivity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); intent j = getintent(); a= j.getdoubleextra("double1",0.0); intent k = getintent(); b = k.getdoubleextra("double2",0.0); result = a+b; } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsit

javascript - Why we cannot access the 'this' inside the inner function? -

this question has answer here: iife invocation in javascript 1 answer how “this” keyword work? 18 answers in code below, there 2 functions, outer function, , inner iife function. the output code below is: outer func: this.foo = bar outer func: self.foo = bar inner func: this.foo = undefined inner func: self.foo = bar i not understand why in inner iife function, this cannot used access foo variable while self still can. understand var self global varible inner function , can still accessed. this ? var myobject = { foo: "bar", func: function() { var self = this; console.log("outer func: this.foo = " + this.foo); console.log("outer func: self.foo = " + self.foo); (function() { conso

iOS OpenGL: Why has scaling my renderbuffer for retina shrunk my image, and how do I fix it? -

Image
i'm working on augmented reality project using retina ipad 2 layers - camera feed , opengl overlay - not making use of high resolution screen. camera feed being drawn texture, appears being scaled , sampled, overlay using blocky 4 pixels scale up: i have looked through bunch of questions , added following lines eaglview class. to initwithcoder, before calling setupframebuffer , setuprenderbuffer: self.contentscalefactor = [[uiscreen mainscreen] scale]; and in setupframebuffer float screenscale = [[uiscreen mainscreen] scale]; float width = self.frame.size.width; float height = self.frame.size.height; glrenderbufferstorage(gl_renderbuffer, gl_depth_component16, width * screenscale, height * screenscale); ... glteximage2d(gl_texture_2d, 0, gl_rgba, width*screenscale, height*screenscale, 0, gl_rgba, gl_unsigned_byte, 0); the last 2 lines being modified include scale factor. running code gives me following results: as can see, image fills lower left quarter