Posts

Showing posts from April, 2012

ios - Create a crossfader with AvAudioPlayer -

how can create crossfader between 2 sound track avaudioplayer? i must use avaudiomix ? but... how should use? avaudioplayer not support using avaudiomix. try fade out playing directly setting playback volume getting timing right between 2 avaudioplayers difficult avaudioplayer known have high , unpredictable latency when starting play. one way accomplish use avplayer , avplayeritem , avcomposition . can setup composition overlay 2 audio files desired amount , setup avaudiomix fade out first , fade in second. method let have precise control on when audio files play relative 1 another.

ios - Why use NSRange on strings when there appears to be a perfectly good substring method? -

i'm learning native ios development first time, , came across struct nsrange. come java background don't see reasoning using range struct when can use substring methods part of nsstring class. advantage of using range structs on using non-range nsstring substring methods. thanks! edit: looks considering substring methods: substringfromindex: , substringtoindex: . considering inflexibility of these methods (ie. not being able choose both start , end point) makes range struct instances more necessary. though guess nest 2 methods achieve same result. edit 2: examples. non-range substring method examples: nsstring *str = @"this string."; nsstring *substr = [str substringtoindex:7]; nsstring *substr2 = [str substringfromindex:7]; ranges substring method example: nsstring *substr3 = [str substringwithrange:nsmakerange(5, 5)]; because range based methods offer lot more flexibility, , usable of nsstring search methods (which use ranges heavily

android - google play sevice mainactivity -

i've implemented google play services demo code found @ url: https://github.com/kpbird/google-play-service/blob/master/src/com/kpbird/googleplayservice/mainactivity.java and works. if function getaccountnames() called within oncreate, application momentarialy flashes before loading set content view. it's there 2 activity views being initiatied. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); txtaccount = (textview) findviewbyid(r.id.txtaccount); txttoken = (textview) findviewbyid(r.id.txttoken); getaccountnames(); } why placing getaccountnames() in oncreate create visual effect when application launches.

javascript - How to make tooltip display beside every image -

i have several images applied jquery tooltip effect on..it works, problem irrespective of image click tooltip displays @ top of page. there way can make tooltip appear beside each image clicked. the jquery have far looks : $('.image').hover(function () { $('.tooltip').fadein(1000); }, function () { $('.tooltip').fadeout(1000); }); $('.tooltip').css({ top: e.pagey, left: e.pagex }) css .tooltip { display: none; height: auto; position: absolute; background-color: #d1c585; color: black; border: 2px solid rgba(128, 0, 32, 0.3); padding: 5px; border-radius: 5px; font-family: actor; } html <img src="image.jpg" class="image"> it needs have position: absolute , parent has position: relative . inside hover function do: $('.tooltip').css({ top: e.pagey, left: e.pagex })

android - my button does nothing (launch new activity clicking in my button) -

when click in button id "faouzi", doesn't work! can me? target show activity named changepassword doesn't launch activity & nothing.. public class mainactivity extends activity { sharedpreferences pref; sharedpreferences prefs; sharedpreferences preferences; sharedpreferences.editor editor; @override protected void oncreate(bundle savedinstancestate) { pref = getsharedpreferences("mypassword",0); string password = pref.getstring("passwordretrieve", "8888"); super.oncreate(savedinstancestate); //supprimer la barre de titre de l'activité requestwindowfeature(window.feature_no_title); setcontentview(r.layout.activity_main); //je change la couleur de fond du bouton en bleu button button = (button)findviewbyid(r.id.connection); //button.getbackground().setcolorfilter(color.blue, porterduff.mode.multiply); button.s

ruby - Running a simple rack app with SSL on localhost? -

i have simple rack app serving static file. need use ssl locally development purposes. way with rack? i'd grab tunnels gem, fire ssl proxy using that: sudo tunnels 443 9292

c# - Passing Longitude and Latitude in Twitter Streaming API of Pakistan -

Image
i having problem in passing longitude , latitude format of pakistan in twitter streaming api . api provides sample examples of passing longitude , latitude of cities. location san fransisco in api location example given below , works in program. -122.75,36.8,-121.75,37.8 but trying use following location tweets pakistan server rejects location. 71.69,32.01,70.69,33.01 kindly me 4 values separated commas should pass allow me tweets pakistan. each bounding box should specified pair of longitude , latitude pairs, with southwest corner of bounding box coming first. your co-ordinates of 71.69,32.01,70.69,33.01 give (which seems small part of pakistan, might want have larger box): so think box isn't being formed correctly because you're not giving bottom left (south west) corner of first. in order give box co-ordinates correctly need have them in format bottom-left-longitude, bottom-left-latitude, top-right-longitude, top-right-latitude

php - How to set document root to be a subdirectory using .htaccess and not VHost -

on local machine following works perfect: <virtualhost *:80> ##serveradmin postmaster@dummy-host2.localhost documentroot "c:/xampp/htdocs/website_1" servername testpage.com/website_1 ##serveralias www.recruitement.localhost ##errorlog "logs/dummy-host2.localhost-error.log" ##customlog "logs/dummy-host2.localhost-access.log" combined </virtualhost> howerver im hosting website hosting company called justhost.com , not allow me modify httpd-vhosts.conf or httpd.conf . entire site coded files under website_1 reference other files under website_1 using simple slash "/" meaning website_1 treated document root. works on local machine when uploaded host gives me server errors because cant find files since trying locate files in public_html for example: public_html - website_1 - script.php - style.css inside script.php : <a href="/style.css">

Vulnerability testing in ASP.NET MVC -

i have been involved in test based development on asp.net mvc , asp.net webapi using nmock unit test, of unit tests write revolve around testing functionality. from point of view of unit testing : are there frameworks test vulnerability of access points actions on controllers (or other components) from point of view automated/manual qa testing are there (prefer open source) tools testing vulnerability of website built on asp.net mvc , manual or automatic , can used quality assurance ? i go testing asp.net mvc application in same manner test other web application built on other platform. essentially attack vectors web pages , server(s) hosting application. think attackers point of view. have no way see code in controllers , models can following. scan server(s) os version , web server version, db version may contain vulnerabilities. scan webpages vulnerable javascript, input forms, query string parameters, etc. attempt exploit web application through discover

Python networking with UDP for action games -

okay, please don't kill me asking this. i'm developing 2d online multiplayer platformer shooter. yeah, it's cool. have of game written couple of bugs , unoptimized, i'm stuck when comes networking. used pygame, , tried using bunch of python libraries networking. name it, think i've looked @ primary ones. here pyenet - thought had internal congestion control, ugh mastermind - not asynchronous podsixnet - udp? legume - stuck server giving me exception, waiting response @ mailing list. looks absolutely gorgeous otherwise. can't remember other ones tried. anyways, need udp (trust me, need udp) , reliable protocol chat, masterserver, new player info, , packets can't afford lose. read somewhere tcp , udp used simultaneously wasn't idea, tried finding reliable udp implementations in python, therefore wandering these obscure libraries. along way i've learned fool around sockets myself, have 2 clear paths. 1) when people asked if udp , tcp bad idea, ma

linux - GNU sort - What is the default algorithm used for comparison? -

i need understanding default algorithm gnu's sort. assumed did lexicographic sort, found out behavior not correspond that, example take following strings: alex. alex.a alex.z alexa alex0 alexz alex.~ alex alex.| alex.} alex.abc and sort them on shell using sort echo 'stuff' | sort this result get: alex alex. alex.~ alex.| alex.} alex0 alexa alex.a alex.abc alexz alex.z and can't figure out why alex0 , alexa appear in between alex.} , alex.a can explain me? sorting , large depends on locale settings: $ sort sort alex alex. alex.~ alex.| alex.} alex0 alexa alex.a alex.abc alexz alex.z $ lc_all=c sort sort alex alex. alex.z alex.a alex.abc alex.| alex.} alex.~ alex0 alexz alexa

android - Inflate context menu in a SherlockListFragment -

how create contextmenu xml in sherlocklistfragment . know (see in examples) @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) { menu.add("one"); menu.add("two"); menu.add("three"); menu.add("four"); } this work sherlocklistfragment wanna inflate menu/context_menu.xml after while found solution @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { getsherlockactivity().getmenuinflater().inflate(r.menu.context_menu, menu); }

php - Display list items in columns versus rows -

my current wordpress page has following relevant code: <?php $attorneys = get_posts(array( 'post_type' => 'attorney', 'numberposts' => -1, 'orderby' => 'meta_value', 'meta_key' => '_attorney_last_name', 'order' => 'asc' )); $number_of_attorneys = count($attorneys); ?> <ul> <?php foreach($attorneys $attorney) : ?> <li> <a href="<?php echo get_permalink($attorney->id); ?>"> <?php echo $attorney->post_title; ?> </a> </li> <?php endforeach; ?> </ul> this displays results follows: attorney attorney b attorney c attorney d attorney e attorney f attorney g attorney h attorney etc. what correct procedure display results in 3 columns versus rows? like... attorney attorney d attorney g attorney b attorney

ruby - Explain structure of site.categories -

jekyll supplies site.categories variable accessible liquid templates. in site have 2 categories 1 post each. looking @ jekyll bootstrap categories.html know: {% category in site.categories %} {{ category[0] }} i know renders category's name. if do: {% item in category %} {{ item }} it seems category has 2 items: name , post. makes no sense me. category[0] name , array of posts starts @ index 1? why make sense? wonder if comes ruby somehow, don't know ruby. (since jekyll written in ruby i'm adding tag, since suspect of syntax derivative.) how determine structure of site.categories ? don't know how debug , don't understand liquid syntax enough know why behavior makes sense. site.categories multi-dimensional array of categories. each category consists of it's name first element, , list of posts contained in category. posts consist of name, content, permalink , more (the same info in site.posts entries).

python - Django testing not getting connected to the database -

i newbie django. in first django app, testing 1 of view check login. here view: from testprjct.testapp.forms import loginform_form django.contrib import auth def check_login(request): if request.method == 'post': form = loginform_form(request.post) if request.post , form.is_valid(): username = request.post.get('username', '') password = request.post.get('password', '') # hard-coding credentials here testing user = auth.authenticate(username = 'test123', password = 'qwerty') if user not none , user.is_active: auth.login(request, user) ..... this view working fine when running server , trying login front-end. failing when executing test case view. here test code view: from testprjct.testapp.models import loginform class viewtests(testcase): def setup(self): loginform.objects.create(username='test123', password='qwerty') def te

c# - Is it possible to textchanged event to occur only when textBox is focused? -

i have method this. public void checkemployee() { connectionstringsettings myconnectionstring = configurationmanager.connectionstrings["librarysystem.properties.settings.libraryconnectionstring"]; using (sqlconnection mydatabaseconnection = new sqlconnection(myconnectionstring.connectionstring)) { mydatabaseconnection.open(); using (sqlcommand mysqlcommand = new sqlcommand("select * employee employeeid = '" + employeeidtextbox.text + "' ", mydatabaseconnection)) using (sqldatareader sqlreader = mysqlcommand.executereader()) { if (sqlreader.read()) { string employeeid = sqlreader.getint32(0).tostring(); string name = sqlreader.getstring(1); string address = sqlreader.getstring(2); employeeidtextb

jenkins - Handling headless exceptions in Cucumber -

i encountered following message while running cucumber tests through jenkins. please see console message below. previously, able run job couldnt run second run. + cd bin + make rm -f override.so gcc -wall -o2 -fpic -shared -ldl -o override.so override.c + cd .. <cucumber command> not find available display (headless::exception) /var/lib/gems/1.9.1/gems/headless-1.0.1/lib/headless.rb:141:in `pick_available_display' /var/lib/gems/1.9.1/gems/headless-1.0.1/lib/headless.rb:128:in `attach_xvfb' /var/lib/gems/1.9.1/gems/headless-1.0.1/lib/headless.rb:78:in `initialize' /var/lib/jenkins/workspace/zalora_my/features/support/env.rb:40:in `new' /var/lib/jenkins/workspace/zalora_my/features/support/env.rb:40:in `<top (required)>' /var/lib/gems/1.9.1/gems/cucumber-1.2.5/lib/cucumber/rb_support/rb_language.rb:137:in `load' /var/lib/gems/1.9.1/gems/cucumber-1.2.5/lib/cucumber/rb_support/rb_language.rb:137:in `load_code_file' /var/lib/gems/1.9.1/gems/c

osx - Sandbox NSOpenPanel Error 1000 -

i'm pretty ready release first sandbox-enabled mac application. entitlement need user selected file . user clicks on toolbar button select 1 or more image files, doesn't cause trouble. user clicks on button select folder. when do, xcode output window indicates following error message. cgssetignorescycle: error 1000 setting or clearing window tags . if user cancels select-folder operation without selecting one, additional error message on top of first one. says pssetwindowlevel, error setting window level (1000) . application not crash. these error messages things need worry? if ask google, don't many search results. anyway, following code used when user clicks on button select folder. - (ibaction)system1selected:(id)sender { nsopenpanel *panel = [nsopenpanel openpanel]; [panel setallowsmultipleselection:no]; [panel setcanchoosedirectories:yes]; [panel setcanchoosefiles:no]; nsstring *currentpath = systempath1.stringvalue; if ([self f

R - Convert this nested for loop (MATLAB) to R -

this question has answer here: r - conditional , nested loop take long. how vectorize? 1 answer i need convert loop r for ii = 100:(size(start,1)-n) if start(ii) == 1 && mean(start(ii-11:ii-1)) == 0 count = count + 1; sif(count,:) = s(ii:ii+n-1); time(count) = ii*1/fs; end end the start vetor single dimension vector of true , false values 3 million elements in total. as loops in r take long time, take 3 hours execute code, needs vectorized. if really appreciate it. edit here r code simple count (which takes hours execute) for(ii in 100:sp) { if(start(ii) == 1 && mean(start(ii-11:ii-1)) == 0) { count = count + 1 } } edit-2 here dummy values: start : [1] true true true true true true true true true true true true [13] true true true false false false

Jabber/XMPP protocol in pure Clojure -

i'm looking jabber/xmpp protocol implementation in pure clojure. i'm find xmpp-clj wrapper around smack jabber/xmpp library. it's impossible know whole of net, though i'm comfortable saying there no mature or used xmpp library written entirely in clojure of may 2013. i wouldn't mind such library if volunteering or course ;)

cuda - I get malloc 3906 error when i try to fill my array -

this code using namespace std; #include <iostream> #include <stdio.h> #include <stdlib.h> #define n 8000 void fillarray(int *data, int count){ for(int =0; < count; i++) data[i] = (int) rand() / ((int) rand_max); } __global__ void add(int* a, int *b){ int add = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if(tid < n){ add = a[tid] + b[tid]; } } __global__ void subtract(int* a, int *b){ int subtract = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if(tid < n){ subtract = a[tid] - b[tid]; } } float duration(int *deva, int *devb, int blockspergrid, int threadsperblock){ cudaevent_t start, stop; cudaeventcreate(&start); cudaeventcreate(&stop); cudaeventrecord(start,0); cudaeventrecord(stop,0); cudaeventsynchronize(stop); cudamalloc((void**) &deva, n * sizeof(int)); cudamalloc((void**) &devb, n * sizeof(int)); add<<<blo

node.js - NodeJs, Express, Socket.IO authentication -

i want people login using standard loginform , join socket.io chatroom if authentication successful. dont know how retrieve session when setting socket.io part. far have setup session using: app.use(express.cookieparser()); app.use(express.session({secret:'my-no-longer-secret-secret'})); app.post('/login', function(request, response) { // lookup credentials database var login = true; if(login) { request.session.authorized = true; request.session.room = request.body['room']; console.log("sessino authorized: " + request.session.authorized); console.log("session room " + request.session.room); } else { routes.login(request, response); } routes.index(request, response); }) i want able retrieve request.session .someinfo here in socket part understand it, not possible. instead have use cookiesession not sure how that. thank in advance

wso2esb - Does wso2 BPS has class mediator type feature? -

in esb have class mediator can write custom logic through java code. likewise how can same thing in wso2 bps? if done through creating jar file of custom logic code, put jar , how access jar while creating bpel process? sample great me. in advance. yes, in bps can write custom extension activities. using extension activity can execute java code. please refer blog post more information.

java - Date does not match in different programming language with System date -

hi having problem date. date returned java , php not matches system date. here system settings date , time date = 05-13-2013 10:58 time zone info = (utc+05:00) islamabad, karachi java dateformat df = new simpledateformat("mm-dd-yyyy hh:mm a"); system.out.println(df.format(new date())); timezone zone = timezone.getdefault(); system.out.println(zone.getdisplayname()); system.out.println(zone.getid()); result: 05-13-2013 12:58 central standard time america/mexico_city php echo ini_get('date.timezone')." ======= ".date_default_timezone_get()."<hr>"; echo date("m-d-y h:i:s a", mktime()); result utc ============== utc 05-13-2013 06:02:21 i tried every thing unable fix issue, people have suggested set time zone in php.ini fix issue, want programming languge should pick system timezone , date & time. i need solution java possible java code pick date , time(timezone) of system, ins

web - An unhandled exception occurred in webdev.webserver.exe -

it happens when i'm trying open page using it. (page contains css , js, nothing special). ideas how fix this? this happens when disk path passed server (the path parameter) contains double slash. (i.e. d:\somedir1\\somedir2 )

php - convert date to T Z format -

this question has answer here: format of 2013-04-09t10:00:00z in php [closed] 2 answers my date format this 2013-05-07 18:56:57 (yyyy-mm-dd hh:mm:ss) i want output following. 2013-05-07t06:17:55.827z is there simple way using big functions ? this should give proper iso8601 date/time in z(ulu) timezone: str_replace('+00:00', 'z', gmdate('c')) to date conversion: str_replace('+00:00', 'z', gmdate('c', strtotime('2013-05-07 18:56:57'))) to have additional .000 (which useless imho): str_replace('+00:00', '.000z', gmdate('c', strtotime('2013-05-07 18:56:57')))

javascript - Fade in/out div scrollTop -

i have floating menu want fade in when start scroll down page, fade out when @ top of page. have got working without fade, im not sure how add fades. appreciated. thanks. $(document).scroll(function() { $('#floatingnav').toggle($(this).scrolltop()>250) }); css #floatingnav { position:fixed; display:none; } you can use fadetoggle duration argument(just incase want) instead of plane toggle.that job. $(document).scroll(function() { $('#floatingnav').fadetoggle($(this).scrolltop()>250) });

android - Can we show the dialog after finish the Activity? -

i have tried dialog box dismiss when activity finish because dialog takes context of activity.is there way it? you can. create separate activity show dialog box. define dialog activity in manifest following: <activity android:name=".dialogactivity" android:theme="@android:style/theme.dialog" android:excludefromrecents="true" android:taskaffinity="" android:launchmode="singleinstance"> </activity> define dialog box or whatever want show in activity. start dialogactivity when finish activity.

xamarin.ios - Simplest an fastest C# Expression that always evaluates to false and does not generate a compiler warning -

i have rather esotheric case need have piece of code never execute still needs part of compilation output. although come own, i'm asking community: simplest , fastest c# expression evaluates false , not generate compiler warning , preserves enclosed block of code in final build output? update: since explaining rationale behind question requested: monotouch linker performs static code analysis in order strip unreferenced symbols out of final build decrease size of generated binaries. poses problem properties accessed through reflection. i'd go simple... public static bool false() { return false; } public static void foo() { if (false()) { ... } } if need convince jit (inlining), add [methodimpl(methodimploptions.noinlining)] false()

Magento - Save shipping rate outside of the collectRates Method -

i trying calculate shipping price based on dimensions, post code , type of parcel(regular/express). able calculate using auspost api problem save shipping rate outside of collectrates method in magento. if this... $result = mage::getmodel('shipping/rate_result'); $method = mage::getmodel('shipping/rate_result_method'); $method->setcarrier("excellence_excellence"); $method->setmethod("excellence_excellence"); $method->setcarriertitle(""); $method->setmethodtitle(""); $method->setprice($myvalue); $method->setcost($myvalue); $result->append($method); it not work because $result has saved in quote. can me on this?

c++ - LibVLC tutorial without SDL? -

i trying write video frame frame *.yuv file , found this tutorial rendering video sdl surface. now i'm not sure how use code without sdl library. example, lock function: static void *lock(void *data, void **p_pixels) { struct ctx *ctx = data; sdl_lockmutex(ctx->mutex); sdl_locksurface(ctx->surf); *p_pixels = ctx->surf->pixels; return null; /* picture identifier, not needed here */ } how can write function without struct ctx , sdl_lockmutex , sdl_locksurface ? as can imagine, not experienced programmer please patient me ;) in advance! i don't know libvlc, here how go removing sdl based on particular example. removing sdl in example, there couple of different functions have pass through libvlc callback function ... libvlc_video_set_callbacks(mp, lock, unlock, display, &ctx); now, understand lock function doing, need understand little of multi-threading , how image stored in memory. essentially, make sure not

html - a tag breaks in two lines in chrome, why ? -

im expierencing kindda funny problem - if take @ page: http://www.cinemaxx.dk/koebenhavn/events/date-night/ and @ breadcrumb, link/word "date night" breaks in 2 lines, however, there not defined fixed width of element, , set display:inline-block it works fine in ff, ie, safari, not in chrome, , cant figure out why, hoping bit help? :) you can give white-space:nowrap; css link, try , work fine.

javascript - How to get news_id in alert on item click -

how item id on item click, able display data on in listview want click on item show particular news_id on alert. this html page : <body> <div data-role="page" id="taxmanhomepage" data-theme="e"> <div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme="e"> <h4 align="center">taxmann demo app</h4> </div> <div data-role="content" data-theme="e"> <a data-role="button" onclick="callservice()">webservice</a> todays headlines: <div class="content-primary"> <ul id="newlist" data-role="listview" data-inset="true"data-filter-theme="e" data-divider-theme="e"> </ul> </div> </div> </div> </body> this javascript code: var url="http://www.taxmann.com/ta

regex - Replace custom tags with <a href> tags -

in asp.net application have plain text field. want allow user able enter url's in following format: [url="http://www.google.com"]google[/url] these saved database directly entered. on retrieveal however, i'd convert above following html format make active on-screen: <a href="http://www.google.com">google</a> the reason approach avoid tampering built-in asp.net validation routines, trigger error when sees <a in form input string. i've seen other examples on stackoverflow regex used parse string, however, cannot find can follow multiple occurrences of [url...] may exist in single string. can please offer me example of how parse such string, say... try funky new search engine: [url="http://www.google.com"]google[/url] or older 1 in day: [url="http://uk.altavista.com"]altavista[/url] ...to convert each occurrence desired format? regex isn't strong-point sadly. thanks. followin

javascript - backbone model cannot fetch any data -

here're simplified codes var playermodel = backbone.model.extend(); var playerprofileview = backbone.view.extend({ model : new playermodel({url: "http://mysite.com/api/getpalyer.php"}), render: function(){ this.model.fetch(); } }); the system keeps giving me error message uncaught error: "url" property or function must specified i totally have no idea what's wrong code. here's backbone#model 's constructor: var model = backbone.model = function(attributes, options) { so see, options should given second argument. here you're passing url attribute (try this.get('url') verify that). change to: model : new playermodel(null, {url: "http://mysite.com/api/getpalyer.php"}); another thing: also, declaring new object in class definition ( new playermodel({url: "http://mysite.com/api/getpalyer.php"}), ) result in having single instance of object shared objects (ie playerprofileview share

Seek-for-android. Connection refused ! Android -

i'm using library seek-for-android develop same application. when try run test app hellosmartcard https://code.google.com/p/seek-for-android/wiki/usingsmartcardapi take error: "connection refused !!!" i'm using samsung s iii , following code: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linearlayout layout = new linearlayout(this); layout.setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); button = new button(this); button.setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); button.settext("click me"); button.setenabled(false); button.setonclicklistener(new onclicklistener() { public void onclick(view v) { try { log.i(log_tag, "retrieve available readers..."); reader[] readers = seservice.getreaders()

linker - What is the correct Xcode setting for Position Independent Executables -

just started getting post appstore submission email following advice. please ensure build settings configured create pie executables. however setting in xcode appears correct, in linking section found "don't create position independent executables" set no. (double negatives yuk). you may receiving apple warning not because application itself, because 3rd party library not compiled pie. example, if using marmalade sdk engine receive warning (they fix in september). but can try adding more compiler flags in build settings: in other c flags may put flag: -fpic in other warning flags may put: -wl,--emit-relocs , -wl,--warn-shared-textrel to see if app pie: otool -hf /path/to/your/app.app/app reference: https://developer.apple.com/library/ios/qa/qa1788/_index.html

javascript - Shell command execution -

i'm trying implement shell command execution found here: node.js shell command execution so i'm trying second answer (by chris eineke) working. no output. here try: run_cmd = (cmd, args, done) -> spawn = require('child_process').spawn child = spawn(cmd, args) result = { stdout: '' }; child.stdout.on \data ! (buffer) -> result.stdout += buffer child.stdout.on \end !-> done() result dir = run_cmd( 'ls', ['-a'] , !-> console.log('done') ) console.log dir.stdout it compiles to: run_cmd = function(cmd, args, done){ var spawn, child, result; spawn = require('child_process').spawn; child = spawn(cmd, args); result = { stdout: '' }; child.stdout.on('data', function(buffer){ result.stdout += buffer; }); child.stdout.on('end', function(){ done(); }); return result; }; dir = run_cmd(&

javascript - Trigger.io copy link to iPhone clipboard -

is there way using javascript or trigger.io native method copy value iphone clipboard ? i tried lot of solution cross browser copy clipboard not worked iphone if you've tried javascript-only methods, make trigger.io native plugin backs onto uipasteboard .

ios - How do you give cells in a TableView a unique reference -

i'm still new ios development, bear me. i've got tableview using static cells contain options (click check), able select cells fine. i'd assign value (identifier) each cell, when cell selected or de-selected can add/remove array. then, once editing has finished, use references stored in array update respective coredata attributes. my google skills have failed me today, push in right direction appreciated. thanks. nsindexpath best tool that! unique selected cell. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nslog(@"%i", indexpath.row); nslog(@"%i", indexpath.section); } and think need this: [yourarray objectatindex:indexpath.row]; to reference .

operators - What does ~~ in perl do? -

i saw code , couldn't understand doing compiled succesfully.i searched ~~ operator no luck. unless ($1 ~~ @tables) { push @tables, $1; } reference: http://perldoc.perl.org/perlop.html#smartmatch-operator first available in perl 5.10.1 (the 5.10.0 version behaved differently), binary ~~ "smartmatch" between arguments. the ~~ operator compares operands "polymorphically", determining how compare them according actual types (numeric, string, array, hash, etc.) equality operators shares same precedence, ~~ returns 1 true , "" false. best read aloud "in", "inside of", or "is contained in", because left operand looked inside right operand. makes order of operands smartmatch operand opposite of regular match operator. in other words, "smaller" thing placed in left operand , larger 1 in right.

linux - How can I echo the status of compilation? -

i've written small command compile every c file in every directory , have: find $1 -type f -name '*.c' -exec sh -c 'gcc {} -o $(dirname {})/$(basename {} .c)' \; and compiles everything, display status of each file being compiled, , display when each 1 finished, i'm out if ideas. if love that! this academic issue, using {} multiple times in argument find not portable. similarly, expecting {} expand filename when not string in argument not portable. (that is, entire argument must {} ). also, using gcc explicitly rather make wrong approach. said, can echo each path compiles: find $1 -type f -name '*.c' -exec sh -c 'gcc $0 -o $(dirname $0)/$(basename $0.c) && echo $0' {} \; also, if can simplify bash: find $1 -type f -name '*.c' -exec bash -c 'gcc $0 -o ${0%.c}.o && echo $0' {} \;

windows - Redirect of output to file not working when process/command is -

i redirect ouput .exe file txt-file. this enter: app.exe -options -moreoptions > "c:\logs\log.txt" afterwards, given log file created not written...at first. if terminate app.exe after minutes or hours log file filled output process since beginng - however, if terminate process. app.exe process listens port , takes incoming messages , forwards process. means, needs run time , can't terminate see logs. also, need logs in real time written file... because logs written exe seems write stdout. redirected every output channel 2 (error) 9 (customs) stdout testing same result. does windows redirect output when command (here: exe) finished? there way write output file if command still running? i guess, output buffered , therefore not written file, till buffer full or command exits. there way disable buffer? (i don't have access source code!) thank in advance!

c# - Alteration Color Change for Listbox -

i have listbox , want change color of every other row. have tested following code, colors not changing. missing something? <listbox height="250" borderthickness="0" itemssource="{binding path=results}" alternationcount="2"> <listbox.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> </grid.columndefinitions> <textblock grid.column="0" fontfamily="sagoe ui" fontsize="14" text="{binding firstname, stringformat='user: {0}'}" padding="2" />

Eclipse gradle and maven tooling - local resolution -

i want gradually migrate multi-module maven build multi-module gradle build. i'm using m2e maven tooling in eclipse , 1 feature if projecta depends on projectb , both projects in eclipse workspace, m2e smart enough use local .class files projectb instead of using .jar file maven repository. let's call feature "local resolution". so, can eclipse gradle tooling , m2e play nicely together? if gradle project depends on maven project, can maven project locally resolved if maven project depends on gradle project, can gradle project locally resolved if gradle project depends on gradle project, can dependent gradle project locally resolved? resolving local gradle projects blocked until gradle-2750 resolved. current state this: local resolution works gradle project depending on maven project (fixed in version 3.1.0.m1) local resolution fails maven project depending on gradle project local resolution fails gradle project depending on gradle projec

Python Subprocess: Too Many Open Files -

i using subprocess call program , save return values variable. process repeated in loop, , after few thousands times program crashed following error: traceback (most recent call last): file "./extract_pcgls.py", line 96, in <module> selfe.append( calselfenergy(i) ) file "./extract_pcgls.py", line 59, in calselfenergy p = subprocess.popen(cmd, stdout=subprocess.pipe, shell=true) file "/usr/lib/python3.2/subprocess.py", line 745, in __init__ restore_signals, start_new_session) file "/usr/lib/python3.2/subprocess.py", line 1166, in _execute_child errpipe_read, errpipe_write = _create_pipe() oserror: [errno 24] many open files any idea how solve issue appreciated! code supplied comments: cmd = "enercharmm.pl -parram=x,xtop=topology_modified.rtf,xpar=lipid27_modified.par,nobuildall -out vdwaals {0}".format(cmtup[1]) p = subprocess.popen(cmd, stdout=subprocess.pipe, shell=true) out, err = p.communicat

asp.net mvc - Date format not maintained in jquery post -

in mvc 4 project developed in vs2010, have screen has dropdown shows date dd-mmm-yyyy display text, underlying value dd-mm-yyyy. in function posts data, can see selected value in dd-mm-yyy when alert out. alert($("#dropdwn_birthdateval").val()); this line above shows date desired in dd-mm-yyyy format. however in same method when try post value controller $.ajax({ type: "post", url:"@url.content("~/home/getuserdetails")", async:false, datatype: "json", data: { //.....other string , integer values //.....that go thru "mydto.dob": $("#dropdwn_birthdateval").val() }, error: function (error) { alert(error); }, ..... remaining code here ...the date comes in 1/1/0001 12:00:00 am the controller action posting to, 'getuserdetai

javascript - Find window previously opened by window.open in new tab in chrome -

i have following code (from related) works finding reference opened windows , closing them. var playerurl = 'http://my.player...'; var popupplayer= window.open('', 'popupplayer', 'width=150,height=100') ; if(popupplayer.location == 'about:blank' ){ popupplayer.location = playerurl ; } popupplayer.focus(); this works across tabs in firefox, in chrome seems if each separate tab unaware of happening in other tabs. i'd suspect due each tab being different process there anyway bypass this? so basically, if open window page in tab a, can reference window page b in tab b, , close in chrome? related to: find window opened window.open https://stackoverflow.com/a/16525481/1688441 edit: i found may useful messaging other tabs close action, though haven't tested in chrome: sending message open windows/tabs using javascript i've used pubsub functionality of jstorage before this. it's dependent on jquery, may

python - How to set NULL for IntegerField instead of setting 0? -

i'm uploading data excel file using xlrd , turning data models (with integerfield values) in django. excel file has bunch of missing data. unfortunately, these missing data converted value of 0 in models, instead of null. means when person model doesn't have age, age gets recorded 0, instead of null. what's best way change this? i've tried doing this: age = models.integerfield(blank=true, null=true) but blank fields still set 0 default. instead of using age = models.integerfield(blank=true, null=true) use age = models.integerfield() when donot specify blank=true, null=true it store null in column

asp.net mvc - Can one MVC Edit Template delegate to another? -

i have strongly-typed razor 2 editor template. when view model meets conditions, want view delegate alternative template of same type. use templatename argument editorfor helper select alternative template: @model mytype @if (model.isspecialcase) { @html.editorfor(m => m, "specialcasetemplate") } else { @* default markup *@ } problem is, razor not call alternative template; passes on editorfor method. if change type of second template, shows correctly. can work around using partial view, rather not, have scheme going editor templates want stick to. anyone know how can work? edit looks has behaviour described here: asp.net mvc - using editorfor same model type twice . in short, mvc not support using editorfor method on same object twice. the best way this, returning different view controller: public actionresult someaction(){ var model = ...; if (model.isspecialcase){ return view("specialcasetemplate"); } el

java - How to display custom message on Maven build failure -

when run clean maven profile build ("mvn clean install -pmyprofile"), want ability present custom, static text message user if build fails. for example, this: [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 2:54.666s [info] finished at: mon may 13 10:44:48 mdt 2013 [info] final memory: 27m/81m [info] ------------------------------------------------------------------------ to this: [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 2:54.666s [info] finished at: mon may 13 10:44:48 mdt 2013 [info] final memory: 27m/81m [info] ------------------------------------------------------------------------ [info] [info] troubleshooting steps build, go http://www.somewhere.com [in

sql server - TSQL - Merge two tables -

i have following task: have 2 single column tables in procedure , both of them have same amount of rows. i'd "merge" them resulting table 2 columns. there easy way this? in worst case try add primary key , use insert ... select join requires quite big changes in code have decided ask guys. just explain answer below, here's example. have following tables: tablea col1 ---- 1 2 3 4 tableb col2 ---- b c d resulting table: col1 | col2 1 | 2 | b 3 | c 4 | d you can this: select t1.col1, t2.col1 col2 newtable ( select col1, row_number() over(order (select 1)) rn table1 ) t1 inner join ( select col1, row_number() over(order (select 1)) rn table2 ) t2 on t1.rn = t2.rn this create brand new table newtable 2 columns 2 tables: | col1 | col2 | --------------- | 1 | | | 2 | b | | 3 | c | | 4 | d | see in action here: sql fiddle demo.

login - Error when trying to log into ESPN Masher API -

i'm long time user of mashery, when try sign espn api following message: login failed must click on link in user confirmation email before can login. this seems solvable - however, i've never received confirmation email. any espn api staff appreciated. //md i took @ this, it's difficult see user account yours without more information. see 1 account in "waiting" status, i'll presume yours. see account using gmail address has same first , last name 1 waiting confirmed. email address of account waiting confirmation .co account. i don't see option resend confirmation email, perhaps requesting password reset on login screen help. i'll see else can do, try reset first.

javascript - What is the correct way to call a validation Jscript function when there is a DB call? -

sorry if title doesn't explain much. i have page textbox, button , error message. i need validate if text entered in textbox not null or empty, has length, there no weird characters in , last not least, username doesn't exists in database. part done , working. my question is, what's best way call jscript function validate asp:textbox username type. right see 3 different ways. using .blur call when focus lost on textbox using .keyup or .keydown call whenever key pressed using timer validate every x seconds now problem .blur doesn't validate without loosing focus on thing worth of focus on page. problem .keyup , .keydown call db way many times. , problem timer i'm not sure if there problem timer, why i'm asking. i have validation server side cannot go throught. for more information, here jscript .blur have right now. <script type="text/javascript"> var name; var namevalid = false; $(document).ready(function () { name

c# - understanding streamreader and internalbuffer? -

i have .txt file has 3 lines following: a50 b25 c25 this code: filestream fs = new filestream(@"e:\1.txt", filemode.open); streamreader sr = new streamreader(fs); textbox1.appendtext(sr.readline() + "\r\n"); textbox1.appendtext(fs.position.tostring()); now after running above code,the output be: a50 14 my question why position value 14? why it's not 4 pointer of stream point '\n' character @ end of first line a50?is related internalbuffer?and what's internalbuffer in detail , how work streamreader? sorry bad english. my question why position value 14? the streamreader has "overread" in order perform relatively few read operations on underlying stream. yes, it's related internal buffer - idea perform "chunky" read operations on underlying stream, reading more strictly needs in order satisfy current operation - preventing lots of single-byte reads. to read line @ time no risk of over-rea