Posts

Showing posts from September, 2015

objective c - iPhone - application displays a blank screen when loaded on a real device (sometimes) -

i have iphone application runs fine on simulator , runs fine on real device when connected mac , attached xcode debugger. i can close app , open again no problem. however when remove device mac usb , try use application tries load , gets stuck on blank black screen. other times load , if press home button , launch app again launches fine. the device setup debugging , place app on running on xcode, problem? need change apps settings run on device without issue release version or along lines? edit: i have additional info seems reproduce everytime. it happens if push app background pressing home button, leave device lying there around 5 minutes , when click on icon launch app again see app split second , black screen

http - My application on Glassfish 3.1 won't perform client authentication -

i have application consuming soap service uses transport-level authentication. trying move application tomcat glassfish 3.1. unfortunately, glassfish seems reticent perform client authentication needed soap service. ssl stacktrace results in message "uknown_ca". i have glassfish server configured use keystore contains each of 3 entrust certificates in auth chain (stored -trustcacerts) having imported soap destination server's certificate too. i have tried several from-scratch rebuilds of glassfish server , resorted trying tomcat server's keystore file no luck. does know going on, or else how glassfish provide me more useful information regarding handshake , keystores involved (beyond -djava.net.ssl.debug flag). a co-worker of mine came solution. points andrew. the destination turned out sending unknown_ca message, did not understand ca of key glassfish sending during authentication process. removing jvm argument -dcom.sun.enterprise.security.ht...

javascript - Calling jquery plugin functions on JS callback -

i've searched answer question haven't had success. using audio.js plugin audio playback , stream files with: // within index.html.erb audio.load($('.track_info a', clicked_node).attr('data-src')); audio.play(); when placed in script block on html page, works perfectly. problem i'm having involved attempting call audio plugin through js callback. nothing happens when following: // callback.js.erb audio.load('<%= "#{@song.sample_url}" %>'); audio.play(); even when wrap with: $.getscript('/javascripts/audio.js', function(){ alert("successfully loaded audio."); )}; any ideas? p.s. - other jquery within callback.js.erb work properly. try this: $.getscript('/javascripts/audio.js', function(){ audio.load('<%= @song.sample_url %>'); audio.play(); )};

c - Binary matrix vector multiplication -

i want multiply 8x8 binary matrix represented unsigned 64 bit integer 8 bit vector represented unsigned char. however, due other issues matrix must be ordered columns, ergo there's no easy matching of bytes easy multiplication. any idea how speed such calculation? every operation counts need billions of such calculations made. the multiplications made on 2 element field (f-2). with matrix , vector representation, helps matrix multiplication way: (col 1 ... col 8 ) * (v 1 ... v 8 ) t = col 1 * v 1 + ... + col 8 * v 8 where matrix = (col 1 ... col 8 ) and column vector v = (v 1 ... v 8 ) t thinking further, can multiplications @ once if inflate 8-bit vector 64-bit vector repeating every bit 8 times , calculating p = & v_inflated . thing left then, addition (i.e. xor) of products. a simple approach xoring products is. uint64_t p = calculated products text above; uint64_t sum = 0; for( int = 8; i; --i ) { sum ^= p & 0xff; p >> ...

xml - Oracle - Automate Export/Unload of Data -

oracle sql developer has option export contents of query result various formats (csv/fixed width/excel/xml). there way automate it? if not, free tools available let me automate exports same formats sql developer capable of exporting to? i don't know of way automate sql developer exports, no. however, it's easy enough generate csv and/or fixed width files pl/sql (using utl_file package). tom kyte has example of programs generate csv or fixed width files using either pl/sql or pro*c. either can relatively automated using favorite scheduler. xml outputs can automated in same way depending on how control need on xml generated. if need valid xml , don't care format of xml, can using dbms_xmlgen package (this example straight documentation). declare qryctx dbms_xmlgen.ctxhandle; result clob; begin qryctx := dbms_xmlgen.newcontext('select * hr.employees'); -- set row header employee dbms_xmlgen.setrowtag(qryctx, 'employee'); -...

ios - UIButton - text truncated -

i've created wide uibutton interface builder (xcode 4), added in dummy 5 character title (e.g. click) , changed title text programmatically later. odd thing width of title text seems remain same so, if use longer piece of text (e.g. "now click here"), appears this: "n...e" any idea what's going on? update: if use long line of text in ib it's centred. however, once i've programmatically-changed text appears left-aligned! you need use uibutton method settitle:forstate: [self.mybutton settitle:@"correct new title" forstate:uicontrolstatenormal]; as correctly update size , position of buttons label. setting title self.mybutton.titlelabel.text = @"wrong new title"; not.

shell - sh: How do I avoid clobbering numbered file descriptors? -

when have exec 3>>file # file descriptor 3 points file [ $dryrun ] && exec 3>&1 # or possibly stdout echo "running">&3 exec 3>&- # , closed i'm worried file descriptor 3 may have pointed outside of function in question. how can handle this? is there builtin next_available_fd ? is there way duplicate fd3 variable, dup once function done? and should worry threading , concurrent writes fd3 in case? i'm in sh, maybe bash/ksh/zsh has answer this? instead of using exec redirect file descriptor within function, can (with bash, haven't tried other shells) do: foo() { test $dryrun && exec 3>&1 echo running >&3 } 3>>file foo more_commands in setup, "running" go either file or original stdout depending on $dryrun, , more_commands have fd 3 before foo called.

javascript - How do I add one single value to a JSON array? -

i kind of new world of interface, , found json amazing, simple , easy use. using js handle pain !, there no simple , direct way push value, check if exists, search, .... nothing ! and cannot add 1 single value json array, have : loadedrecords = {} i want : loadedrecords.push('654654') loadedrecords.push('11') loadedrecords.push('3333') why hard ???!!! well .push array function. you can add array ur object if want: loadedrecords = { recs: [] }; loadedrecords.recs.push('654654'); loadedrecords.recs.push('11'); loadedrecords.recs.push('3333'); which result in: loadedrecords = { recs: ['654654', '11', '3333'] };

jQuery Deferred - waiting for multiple AJAX requests to finish -

this question has answer here: pass in array of deferreds $.when() 9 answers i have 3 layer deep chain of deferred ajax calls, , ideally going kick promise way when deepest layer finishes (makes me thing of inception... "we need go deeper!"). the problem i'm sending off many ajax requests (possibly hundreds) @ once , need defer until of them done. can't rely on last 1 being done last. function updateallnotes() { return $.deferred(function(dfd_uan) { getcount = 0; getreturn = 0; (i = 0; <= index.data.length - 1; i++) { getcount++; $.when(getnote(index.data[i].key)).done(function() { // getnote deferred getreturn++ }); }; // need here // when getreturn == getcount, dfd_uan.resolve() }).promise(); }; you can use .w...

android - How to create context menu on double click? -

i need create context menu on double click on long tapping. how can done? i mean oncreatecontextmenu called when user press long tap on widget. in case need same when user double clicks on widget. added i know it's not nice option, since it's not normal android ui. primary problem solve ui bugs devices of vendors - namely htc ( look post ). have seemingly resolved described issue, still have problems context menus. last resort thought avoid tapping through double click. thanx understanding... from gather, have context-sensitive actions want tied edittext , , htc's changes android interfering that. first, reconsider using context menus in general, not particularly discoverable, of users never find them. second, in case of edittext , odds of users discovering double-tap bring context menu on par odds earth have extinction-level asteroid strike today. :: looks in sky :: rather double-tap, 1 option put small imagebutton adjacent edittext , downward-...

printing - C# PrintPreviewDialog - How to change a background? -

i have printpreviewdialog. default, document printed being shown on white sheet. possible change background white sheet custom image? edit i've figured out - had drawimage on printeddocument. if check mdsn there back color property. mentioned this api supports .net framework infrastructure , not intended used directly code. you can inherit printpreviewdialog, , try changing color property of new class. (i not sure method or work or not)

add in - How do I format a cell as hyperlink using Excel's COM API? -

i have excel addin (c# iextensibility) , need mark cell having hyperlink format. best way this? i think need set cell builtin style 8. if range.style - there no way set style builtin id. how can this? ??? - - dave range("a1").style = "hyperlink" note give cell illusion of looking hyperlink. make have hyperlink, need go: sheet(1).hyperlinks.add anchor:=range("a1"), _ address:="http://www.google.com", _ texttodisplay:="www.google.com"

Duplicate class mapping with Fluent NHibernate when loaded from multiple assemblies -

i using fluent , nhibernate v2.4 in web application. because of design have mapping files in several assemblies. however when try add second assembly mapping (see code below) error saying class (the 1 in second assembly @ point) has been mapped (needless have 1 mapping class per class). can see i'm going wrong? the error: duplicate class/entity mapping nhibernate.cfg.mappings.addclass(persistentclass persistentclass) +181 nhibernate.cfg.xmlhbmbinding.joinedsubclassbinder.handlejoinedsubclass(persistentclass model, xmlnode subnode, idictionary`2 inheritedmetas) +1834 nhibernate.cfg.xmlhbmbinding.classbinder.propertiesfromxml(xmlnode node, persistentclass model, idictionary`2 inheritedmetas, uniquekey uniquekey, boolean mutable, boolean nullable, boolean naturalid) +1911 nhibernate.cfg.xmlhbmbinding.classbinder.propertiesfromxml(xmlnode node, persistentclass model, idictionary`2 inheritedmetas) +64 nhibernate.cfg.xmlhbmbinding.rootclassbinder.bind(...

c# - How to add Headers in HTTPContext Response in ASP.NET MVC 3? -

i have download link in page, file generate user request. want display file size, browser can display how left download. solution, guess addin header request work, don't know how it. here try code: public filestreamresult downloadsignalrecord(long id, long powerplantid, long generatingunitid) { signalrepository sr = new signalrepository(); var file = sr.getrecordfile(powerplantid, generatingunitid, id); stream stream = new memorystream(file); httpcontext.response.addheader("content-length", file.length.tostring()); return file(stream, "binary/rfx", sr.getrecordname(powerplantid, generatingunitid, id) + ".rfx"); } when checked on fiddler, didn't display content-length header. can guys me out? try httpcontext.current.response.appendheader("content-length", contentlength);

javascript - Missing body and unfounded error message on IE9 -

Image
i have social network allows users post blogs , ask questions . if click on above links, you'll notice commnunity blogs , questions page authors posts' displayed. if on ff,safari,chrome, or ie8 you'll see them displayed should. if on ie9, see giant black letters underneath body "object not found!". major issue when ask question in ie9, body of question not display on community page or on blog when have opened read. ( not display @ all). which more curious, when composing blog worse on ie9. when submit pressed, reloads page blank. code structure composing blogs , questions, , displaying blogs , questions same except mysql differences. all of above works should on ie8, ff, chrome, , safari etc... here lengthy code structures each: ( quite bit going put links code hosted somewhere else ) compose blog community blogs page reading individual blog // duplicate pages questions : ask question community questions page reading individual question...

Best way to manage redis data -

Image
just getting started redis, , i'm having hard time managing redis data. there tools give visualization of applications redis data? try redis desktop manager - cross-platform open source redis admin gui. it's available windows, mac os x , linux.

c# - Simple example of IServiceBehavior and ApplyDispatchBehavior -

i trying plug unity wcf service library service behavior. i need simple bare bones example of service behavior. all want setup ioc unity container on startup of wcf service. note: not using wcf service application. don't have access of asp.net ways of doing this. concept point of view, service behavior seems elegant method. don't know how set 1 (what code need, update config files, etc). if want control instancing of wcf service instances, you'll need service behavior plug iinstanceprovider that. can find simple provider implementation (for ioc container) in post interface @ http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/31/wcf-extensibility-iinstanceprovider.aspx . per comments, if need simple iservicebehavior, here's sample implementation can use. public class stackoverflow_6539963 { public class myservicebehaviorattribute : attribute, iservicebehavior { public void addbindingparameters(servicedescription servicedescr...

Maven Properties not referenced in properties file -

i have properties in maven pom.xml. <properties> <number>3</number> <age>38</age> </properties> (they random properties) in properties file, lets call resource.properties, have following: value1 = ${number} value2 = ${age} when spring tries read properties file, cannot reference ${number} saying cannot found. why , how can make work? or doing not possible @ all. edit: have enabled filtering still not work. resource in src/test/resources directory. here part of pom enable filtering. <build> ... <resources> <resource> <directory>src/test/resources</directory> <filtering>true</filtering> </resource> </resources> ... </build> you need tell maven files uses replace placeholders e.g <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resour...

java - How do I get my Etherpad changes to show up? -

i change files /etherpad/trunk/infrastructure/ace/www/ace2_inner.js , run /etherpad/trunk/etherpad/rebuildjar.sh , yet when run again looks same. there trick i'm missing? i've tried running rebuildjar.sh clearcache no avail. look @ bin/build.sh , track down scripts called directly , scripts called via subscripts. whole thing mess :/

Can PowerShell synch Nuget packages between Devs' workstations? -

seeking ps script inspect packages installed on masterworkstation, then; produce list of commands can executed on other workstations produce synched dev image. thx nuget doesn't have concept of packages installed @ machine level. instead, packages installed in each project needs it. when packages installed in project, repository.config file created lists what's installed. using file, can re-fetch same packages on machine, keeping things in sync. see post more details on workflow.

ant - javascript TypeError: Cannot find function startsWith -

i have javascript function: string.prototype.startswith = function(str) { return (this.indexof(str) === 0); } and when run on typeof returns object , works. when run on typeof returns string , get: javax.script.scriptexception: sun.org.mozilla.javascript.internal.ecmaerror: typeerror: cannot find function startswith. (<unknown source>#29) in <unknown source> @ line number 29 does know whats going on? don't understand why instance type of first thing i'm using object. it's result of readline call, shouldn't string? <target name="analyze"> <script language="javascript"> <![cdata[ importclass(java.io.file); importclass(java.io.filereader) importclass(java.io.bufferedreader) //setup source directory dir = project.getproperty("project_home"); fs = project.createdatatype("fileset...

C++ templates: how to determine if a type is suitable for subclassing -

let's have templated class depending on type t . t anything: int , int* , pair <int, int> or struct lol ; cannot void , reference or cv-qualified though. optimization need know if can subclass t . so, i'd need trait type is_subclassable , determined logical combination of basic traits or through sfinae tricks. in original example, int , int* not subclassable, while pair <int, int> , struct lol are. edit : litb pointed out below, unions not subclassable , t can union type well. how write trait type need? you want determine whether non-union class. there no way known me (and boost hasn't found way either). if can live union cases false positives, can use is_class . template<typename> struct void_ { typedef void type; }; template<typename t, typename = void> struct is_class { static bool const value = false; }; template<typename t> struct is_class<t, typename void_<int t::*>::type> { static bool cons...

passing data from php simple dom parser to jquery -

i have simple script : <?php include_once("simple_html_dom.php"); $content = file_get_html('http://en.wikipedia.org/wiki/myst'); ?> what i'm trying find way send jquery script ....would need $.ajax in jquery? need add in script. i start jquery code document.ready....would need changed? <?php if(isset($_get['getcontent'])){ include_once("simple_html_dom.php"); echo file_get_html('http://en.wikipedia.org/wiki/myst'); } ?> and <script type="text/javascript"> $.get("content.php",{"getcontent":"true"},function(data){ // data content php-script // }); </script>

embedded - Arbitrary Precision Arithmetic (Bignum) for 16-bit processor -

i'm developing application 16-bit embedded device (80251 microcontroller), , need arbitrary precision arithmetic. know of library works 8051 or 80251? gmp doesn't explicitly support 8051, , i'm wary of problems run on 16-bit device. thanks try this one . or, give idea of you're trying it; understanding workload lot. ttmath looks promising. or, there approximately zillion of them listed in wikipedia article .

windows - regular dll vs extension dll -

i have dll (a.dll) uses atl stuff, , can't have mfc in it. there stuff needs mfc though, made mfc regular dll , called b.dll , gets automatically loaded @ runtime a.dll (via import library). the part of b.dll needs class (foo) defined in b.dll, , class has stuff in uses mfc. allowed create foo object in a.dll? b need extension dll instead? the regular dll page says: all memory allocations within regular dll should stay within dll; dll should not pass or receive calling executable of following: pointers mfc objects pointers memory allocated mfc but extension dll page says the client executable must mfc application compiled _afxdll defined., , a.dll can't mfc app. is problem use regular dll in case? thanks, bryan maybe i'm misunderstanding, if can't use mfc, , b provides class does, how can instantiate object in a? looking have b have factory function creates object , passes through pointer? in case need ensure b...

delphi - What solutions are available to automate keystokes and entry of incrementing filenames? -

i assembling image sequences, each sequence consisting of 1-5k png images. each sequence subject large number of image manipulations. these manipulations identical each image, though may different sequence sequence. wish automate whole operation. can automate image manipulations using tools have (paintshop photo pro, irfanview32, among others). problem have automating first step - assembly of images initially. the images produced tool, written in java. there no access source tool. in addition tool written in gui style derived in unix world. implications of normal windows shortcuts not recognised tool (eg alt-f file menu; buttons not have shortcuts; etc). tool provides 2 windows - control window , image window. the sequence of actions need carry out derive images follows: initial steps (no automation needed). run tool load initialisation file control window use image window setup image full screen @ required magnification load log file control window (format not availab...

c# - Honestly, what's the difference between public variable and public property accessor? -

possible duplicates: what difference between field , property in c# should use public properties , private fields or public fields data? what difference between: public string vara; and public string vara { get; set; } the public property accessor gives more flexibility in future. if want add validation setting value, write non-default setter. none of other code have modified. there reasons you'd want replace default getter code. can real pain public variable.

windows - C split string function -

i trying implement function split strings, keep getting segmentation faults. working on windows xp, , therefore had implement strdup(), because windows api doesn't provide it. can tell me what's wrong following piece of code. char** strspl(char* str, char* del) { int size = 1; for(int = 0; < strlen(str);) { if(strncmp(str + i, del, strlen(del)) == 0) { size++; += strlen(del); } else { i++; } } char** res = (char**)malloc(size * sizeof(char*)); res[0] = strdup(strtok(str, del)); for(int = 0; res[i] != null; i++) { res[i] = strdup(strtok(null, del)); } return res; } char* strdup(char* str) { char* res = (char*)malloc(strlen(str)); strncpy(res, str, sizeof(str)); return res; } edit: using debugger found out, program crashes after following line: res[0] = strdup(strtok(str,del)); also, fixed strdup(), there still no progress. you're n...

objective c - How do you bind to or invoke Foundation functions? -

i'm interested in binding ios foundation functions seen in ios documentation there aren't handles or instances send message invoke them. how monotouch? think involve within monotouch.objcruntime namespace. all of monotouch's ns* objects implement monotouch.objcruntime.inativeobject interface has property getter called "handle". accessor public on nsobject , subclasses. edit: code bind nssetuncaughtexceptionhandler() this: public delegate void nsuncaughtexceptionhandler (intptr exception); [dllimport ("/system/library/frameworks/foundation.framework/foundation")] extern static void nssetuncaughtexceptionhandler (intptr handler); then use this: static void myuncaughtexceptionhandler (intptr exception) { // got exception... } static void main (string[] args) { nssetmyuncaughtexceptionhandler (marshal.getfunctionpointerfordelegate( new nsuncaughtexceptionhandler( myuncaughtexceptionhandler ) )...

jquery - Amazon Cloudhosting and JPlayer -

i'm confused amazon's cloud hosting slash getting jplayer work. i've tested player (no deviation in html demos) on video files hosted on dropbox , worked fine, except bandwidth slow needs. i've tried replacing dropbox urls amazon urls no success. here js code $(document).ready(function(){ $("#jquery_jplayer_1").jplayer({ ready: function () { $(this).jplayer("setmedia", { m4v: "http://media.callserver.dyndns.biz.s3.amazonaws.com/edited+original+intro.mp4", ogv: "http://media.callserver.dyndns.biz.s3.amazonaws.com/edited+original+intro.ogv" }).jplayer("play"); },ended: function (event) { $("#next").show(); window.location.href = "http://callserver.dyndns.biz:90/index.php?action=testvid"; },swfpath: "/jquery.jplayer.2.0.0", supplied: "m4v, ogv" }); })...

Rails Pagination with Kaminari with has_many :through Relationship -

i have 3 relevant models. user has_many :photos , belongs_to :dorm , dorm has_many :users , has_many :photos, :through => :users , , photo class belongs_to :users , belongs_to :dorm . i want paginate photos in dorm kaminari. have in gemfile , ran bundle command. in dorms_controller: @dorm=dorm.find(params[:id]) @photos=@dorm.photos.page(params[:page]).per(3) and in dorm show view (actually in partial, _index.html.erm rendered in show view): <%= paginate @photos %> this gives me error: undefined method 'page' #<class:0x107483d68> . i know why doesn't work (shouldn't called on class), don't know how make work... hrm, strange. should work. made vanilla app action shown above , following models, couldn't reproduce error. class dorm < activerecord::base has_many :users has_many :photos, :through => :users end class user < activerecord::base belongs_to :dorm has_many :photos end class photo < activer...

mysql - what is "Waiting for table level lock"? -

Image
why have many queries when using 'show processlist ' and cpu 600+% used is there can improve mysql performance? thanks yes, can change storage engine myisam innodb - myisam knows table level locking (when writes record, blocks whole table), while innodb knows row level locking (it locks row writing to)

objective c - Can you use C++ libraries in a Cocoa (Obj-C) project? -

i'm considering learning objective-c , cocoa, in order use apple's tools , guis. however, i'd graphics programming; openframeworks , cinder 2 libraries catch eye, we're in c++ land. i come java/swing/processing background... don't know c family. how can call c , c++ libraries, cinder , of, native cocoa? and, bonus points: solution work on iphone or ipad? in short, c++ fine os x , ios programs, , plays objective-c quite nicely. in more detail: however, i'd graphics programming; openframeworks , cinder 2 libraries catch eye, we're in c++ land. i won't speak libraries directly. to answer question in more general terms: c++ fine in app, since c, c++, objc, , objc++ first class development languages ios apps. i come java/swing/processing background... don't know c family. how can call c , c++ libraries, cinder , of, native cocoa? objective-c++ allows use c, c++, , objective-c in same translation. feel free use/comb...

Android Downloading Multiple images from Internet -

i trying download multiple images internet(number big 50+) creating ansynch task each image , start download , show downloaded images in grid. since using grid view come gridactivity getview method called , starts downloading. many times code fails giving socket error. algo - getview{ call asynch task } asynctask(){ start download once download finsishes update grid view image } asyctask choice have looked @ multithreading-for-performance , if not tutorial handle you're trying accomplish.

jquery - What should I call this behavior? -

i'm looking make simple jquery plugin. typically called on textboxes/textareas, job clear textbox of text when focus put there, , fill had when focus taken away. e.g have textbox user's name. default says : 'first name'. want have cleared away if click/focus in textbox, when focus away, want 'first name' again. what should call plugin? i'd use this: $("#mytextbox").pluginname(); you hiding text, call hidextext(). hide toggleexampletext() hide `toggletip() hide `togglehinttext() hide `togglehint

build automation - Is recursive publishing possible / easy in Gradle? -

Image
we have ant , ivy-based build management system, consists of shared ant file , set of conventions around directory structure. one hurdle i'm trying overcome common case of "recursive publish". say, have 5 in-house code modules have dependency graph this: each module should publish ivy artifacts our internal repo artifacts not yet cleared deployment test should have status "integration" artifacts deployable test should have status "milestone" (manually promoted developer) artifacts verified testers should have status "release" say developer has 5 modules checked out locally, , has made changes them all. wants promote changes "milestone" status. in other words should happen in ivy repo is: e-1.0-rc1 gets published d-1.1-rc2 gets published, referencing e-1.0-rc1 dependency c-2.0-rc1 gets published, referencing d-1.1-rc2 dependency b-3.3-rc1 gets published, referencing e-1.0-rc1 dependency finally, a-7.1-rc2 gets...

java me - Can anyone give me examples for button and textViews in Android that will be according to "Supporting Multiple Screens"? -

i read http://developer.android.com/guide/practices/screens_support.html.com ? couldn't how apply this, can give me example buttons , textview how fit on different devices? it's not complicated might think. first remember basic layout designed mdpi , normal screen size with medium density (about 160 dpi). so when design layout important part don't use px unit when define layout. instead use dp (density-independent pixel) unit automatically scaled correct number of px current density. til moment have 1 file (e.g. mylayout.xml) different layout sizes (small, normal, large , xlarge). if think layout should different on device xlarge display, tablet create folder called layout-xlarge in same level layout , layout file named mylayout.xml . can make changes file let layout different on devices xlarge display. perhaps want larger text box you want rearrange button , text box. so see, it's not hard. use dp unit dimensions , android rest you.

jquery - lightbox refresh Action -

i have form made using webform[drupal] load on lightbox. the structure of site in ajax format. when form submitted correctly there no problem. when validation fails, page refreshed! if check validations using js, captcha causes problem when not entered correctly, makes page reload. once page reloads goes home page.. i want have form open in page left in lightbox.. when refreshed, form should show in lightbox. solved using ajax captcha the trick avoid kind of reload.

linux - What can I do to find the cause of pread64/pwrite64 hangs? -

my application doing heavy io on raw /dev/sdb block device using pread64/pwrite64. doing fine. call pread64/pwrite64 takes little 50-100us. takes whole lot more, several seconds. what can recommend find cause of such problem? i have not used have heard tool called latencytop.

javascript - How to Pass Variable Into .post()? -

i have this... $().ready(function () { $(".post .comment_this").click(function () { var comment_id = $(this).attr('rel'); $.post(url_base + 'bio/community/get_comments', { 'comment_id' : comment_id }, function (response) { console.log(comment_id); }); }); }); how pass comment_id function? can use there... you can use there without problem. in javascript can access every variable defined in scope chain, global scope. locally defined variables override ones come chain. javascript variable scope on so

android - How to check ip is available in network or not? -

i have list of ip getting using udp broadcasting, on bases of alive/death packet ,i got know whether user alive or went off. but have single case suppose user went out network before sent death packet, how can detect user live or not. - solution have: so purpose m running thread ,in send dummy data user(from ip list), if ip not available respond io exception. taking time identify ip in network. pls suggest me if have faster solution. try pinging: ping and article: java ping command hope helps

Is it posible to select a stack of value by using MYSQL GROUP BY -

i got query : select email abc_table group email having ( count(email) > 1 ) so return me : email a@b.com c@d.com e@f.com and need adjust query : email id a@b.com 1 a@b.com 2 c@d.com 3 c@d.com 4 c@d.com 5 e@f.com 6 is posible result using group having ? or suggestion result? thanks lot! select a.email , a.id abc_table join ( select email abc_table group email having count(email) > 1 ) ag on ag.email = a.email

Programatically pin a build in Teamcity -

is possible pin build in teamcity programatically/automatically? want pin build if deploy-build successfull. just found out possible through rest api can f.ex send put command http://teamcityserver:81/httpauth/app/rest/builds/id:688/pin/ , build id 688 ( teamcity.build.id ) pinned.

c++ - Uniform initialization of references -

i trying understand new uniform initialization of c++0x. unfortunately, stumpled on using uniform initialization of references. example: int main() { int a; int &ref{a}; } this example works fine: % lang=c g++ uniform_init_of_ref.cpp -std=c++0x -o uni -wall -wextra uniform_init_of_ref.cpp: in function `int main()': uniform_init_of_ref.cpp:3:10: warning: unused variable `ref' [-wunused-variable] ( update comeau throws error example, maybe gcc shouldn't compile well) now, if use custom data type instead of integer, doesn't work anymore: class y {}; int main() { y y; y &ref{y}; } % lang=c g++ initialization.cpp -std=c++0x -o initialization -wall -wextra initialization.cpp: in function `int main()': initialization.cpp:9:13: error: invalid initialization of non-const reference of type `y&' rvalue of type `<brace-enclosed initializer list>' initialization.cpp:9:8: warning: unused variable `ref' [-wunused-varia...

c# - Ninject. Optional Injection -

i have global flags enable/disable features. i'd inject dependencies depending on flag. features require classes heavily constructed want inject null if value of flag false , actual dependency otherwise. ninject doesn't allow injecting null. there other options? update: constructor arguments can decorated optionalattribute attribute. in case null injected if there no corresponding binding found. there problem here: can't verify if target class can constructed. have test each public dependency verifies if can constructed successfully. in case if value of flag true not able find error when dependency decorated optionalattribute attribute, cannot constructed properly. i'd manage on binding level only. you can vary injection behaviour binding using factory method (i.e. tomethod ), , it's possible allow injection of nulls configuring container's allownullinjection setting. another alternative use factory method , supply lightweight dummy object in...

c++ - Assigning value of global pointers -

#include <iostream> int = 9; int *p; p = &a; int fun(); int main() { std::cout << fun(); return 0; } int fun() { return *p; } why code give error: expected constructor, destructor, or type conversion before '=' token| whereas code runs ok: #include <iostream> int = 9; int *p = &a; int fun(); int main() { std::cout << fun(); return 0; } int fun() { return *p; } you allowed declare , initialize variables/types globally not assign them. main() start of c++ program , assign statements have inside main. c++03 standard: section $3.6.1/1 : a program shall contain global function called main , designated start of program. if coming scripting background, should note c++ different scripting languages in way can declare items outside bounds of designated start of program ( main() ), cannot processing(assignment or other statements).

c# - XML POST and parse in ASP.NET -

if posts xml application asp.net page, how can parse , give response in xml format? sample client code posting xml url: webrequest req = null; webresponse rsp = null; string uri = "https://beta.abc.company.com/mypage.aspx"; req = webrequest.create(uri); req.method = "post"; req.contenttype = "text/xml"; streamwriter writer = new streamwriter(req.getrequeststream()); writer.writeline(txtxml.text.tostring()); writer.close(); rsp = req.getresponse(); how parse xml mypage.aspx , give response xml? you read xml request stream. inside mypage.aspx : protected void page_load(object sender, eventagrs e) { using (var reader = new streamreader(request.inputstream)) { string xml = reader.readtoend(); // xml } }

sql server 2005 - Can Common Table expressions be used here for performance? -

can common table expressions used avoid having sql server perform following string parsing twice per record? guess "no." select distinct client_id ,right('0000000' + right(client_id ,patindex('%[^0-9]%' ,reverse('?' + client_id)) - 1) ,7) correctedclient membob_vw client_id <> right('0000000' + right(client_id ,patindex('%[^0-9]%' ,reverse('?' + client_id)) - 1) ,7) order 1 ,2 every time try format sql "code block" looks (displaying on multiple lines) until page refreshed, after point sql displayed , me @ least, on 1 line- , can't seem corerct that. does display way people using browser new ie6? company imposes pos browser on me , prevents me using other. no, cte not perform...

linq to entities - Not getting data of Include object -- Entity Framework -

i getting problem " include " in entity framework. lets assume have 2 tables foreign key relation. var result = (from u in entity.table1.include("table2") join o in entity.table2 on u.column1 equals o.column1 u.column2 == “abc” && u.column3 == ‘xyz’ && o.column5 == organizationcode select u).firstordefault(); with above query not returning table2 object data in result though have proper data in database. the issue have found above query is, if query having "include" "join", ef not considering "include" tables. assumption. after spending time got data writing dummy query below that. please see both queries below. var result = (from u in entity.table1.include("table2") join o in entity.table2 on u.column1 equals o.column1 u.column2 == “abc” && u.column3 == ‘xyz’ && o.column5 == organizationcode ...

ios - AVPlayerLayer animates frame changes -

whenever change frame of avplayerlayer, video not resized immediately, animated new size. for example: change frame (0, 0, 100, 100) (0, 0, 400, 400), view's frame changed immediately, video's size animated new size. has encountered issue? , if yes know way disable default animation? thanks! you can try disabling implicit actions , using 0 length animations: calayer *videolayer = <# avplayerlayer #> [catransaction begin]; [catransaction setanimationduration:0]; [catransaction setdisableactions:yes]; cgrect rect = videolayer.bounds; rect.size.width /= 3; rect.size.height /= 3; videolayer.bounds = rect; [catransaction commit];

javascript - How can I get city name from a latitude and longitude point? -

is there way city name latitude , longitude point using google maps api javascript? if please see example? this called reverse geocoding documentation google: http://code.google.com/apis/maps/documentation/geocoding/#reversegeocoding . sample call google's geocode web service: http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true

php - how does this "licensing" work with this software -

optimizepress wordpress plugin. own copy , use , wondering how use licensing secure product. i consider securing own php script if it's viable. here's secure product: on there server download script have enter domain url in text box license plugin url. they have 2 textboxs enter domains in: 1. if it's first time licensing sites 2. adding more sites account then click submit button , serial code sent back after install plugin in wordpress, must goto settings area asks enter serial code verification otherwise can't use script how done? used php script i'll distributing? thanks thoughts i'm not familier script possible script using curl, serial number used authenticate account verification access account. next pull url script being run , verify url listed on account. from there if url not listed send fail command killing script, if url listed authenticate. if listed script check status of license , either run or kill script. ...

Get data from popup window to parent window in Magento -

i working on magento module has form user has enter order number. have included button in form opens popup window displays list of orders. heres have done code button opens popup <button type="button" class="form-button" onclick="window.open(\'' .mage::helper("adminhtml")->geturl('*/inventory_receipt/selectorder',array() .'\',\'\',\'height=500,width=550\');"><span>' .mage::helper('adminhtml')->__('lookup order') .'</span></button> then have created selectorder action in controller displays grid similar grid in sales/order (just modified grid.php sales/order). now want implement when user clicks on order, parent form should populated selected order number , close popup window. can on how done? appreciated. you use javascript window.opener reference inside popup execute javascript in original document. ...

c# - How can I do that in bouncyCastle (get installed certificates)? -

ok, quite new crypto world of bouncycastle, , perhaps mental block, can't seem find(/google for) equivalent to: x509store store = new x509store(storename.my, storelocation.currentuser); store.open(openflags.readonly); i think might easiest , dumbest thing, how can access windows installed certificates, using bouncy castle? or if can't, how can convert system.security.cryptography.x509certificates.x509certificate2 org.bouncycastle.x509.x509certificate ? bouncycastle doesn't have access windows certificates store, role of microsoft's .net classes. convert between .net certificates , bouncycastle equivalents @ methods in org.bouncycastle.security.dotnetutilities class, particularly tox509certificate , fromx509certificate methods.

Grab URL parameters to maintain search form options using jQuery or javascript -

i have set of search filters set url string (for further processing). page reloads show results, options selected user lost. wondering if it's possible use jquery capture parameters url , 'remember' options had been selected? for example, if url contained www.something.com/index.html?&colour=red&circle=1&star=0, form load following: <h3>colour</h3> <p>blue: <input name="colour" type="radio" value="blue" /></p> <p>red: <input name="colour" type="radio" value="red" /></p> [selected] <p>green: <input name="colour" type="radio" value="green" /></p> <h3>shape</h3> <p>circle: <input name="circle" type="checkbox" value="1" /></p> [selected] <p>square: <input name="square" type="checkbox" value="1" /></p...

amazon s3 - Getting started with secure AWS CloudFront streaming with Python -

i have created s3 bucket, uploaded video, created streaming distribution in cloudfront. tested static html player , works. have created keypair through account settings. have private key file sitting on desktop @ moment. that's am. my aim point django/python site creates secure urls , people can't access videos unless they've come 1 of pages. problem i'm allergic way amazon have laid things out , i'm getting more , more confused. i realise isn't going best question on stackoverflow i'm can't fool out here can't make heads or tails out of how set secure cloudfront/s3 situation. appreciate , willing (once 2 days has passed) give 500pt bounty best answer. i have several questions that, once answered, should fit 1 explanation of how accomplish i'm after: in documentation (there's example in next point) there's lots of xml lying around telling me need post things various places. there online console doing this? or literally have ...

javascript - Problem with loop -

possible duplicate: javascript infamous loop problem? when mousemove event reaised variable i equal last value(in case = 4) sectors. can store value of i ? for (var = 0; < piechart.sectors.length; i++) { piechart.sectors[i].mousemove(function (event) { var percent = (localdata[i] * 100) / totalsum; piechart.popup(event.clientx, event.clienty, [percent, "% всего времени\n Было сделано", localdata[i], "звонков"].join(' ')); }); } you need closure. see here nice explanation: http://www.mennovanslooten.nl/blog/post/62 i'll posting code modified shortly.

php - Image from URL then crop -

so i've been trying grab image external url, crop , save it. copy , save okay it's crop part troubling me. can't figure out how image resource curl stuff (i'm no curl else's curl stuff). i though this: $img = imagecreatefromstring($image); $crop = imagecreatetruecolor(8,8); imagecopy ( $crop, $img, 0, 0, 8, 8, 8, 8); but no luck there, saves corrupt png. here full code: $link = "urlhere"; $path = './mcimages/faces/'; $curl_handle=curl_init(urldecode($link)); curl_setopt($curl_handle, curlopt_nobody, true); $result = curl_exec($curl_handle); $retcode = false; if($result !== false) { $status = curl_getinfo($curl_handle, curlinfo_http_code); if($status == 200) $retcode = true; } curl_close($curl_handle); if($retcode) { $curl_handle=c...

ruby on rails - In which folder should I put "global" shared partial templates? -

this question has answer here: where put partials shared whole application in rails? 6 answers i using ruby on rails 3.0.7 , planning use partial templates. classes in application use same partials have decide located those. is idea put "global" shared partial templates in lib folder? if no, common practice choose folder put those? advice on how name , load folder? the standard placing shared partials in app/views/shared , , referencing them as render :partial => 'shared/partial_name' if have standard "row in list" partial (say, index page), use shared partial like: # render single object row: render :partial => 'shared/item', :locals => { :item => @item } # or render them all: render :partial => 'shared/item', :collection => @items

Twitter's Rate Limit, bypass? -

i code mobile web twitter client lot of functions in mind, going through api, noticed limit requests 350 per hour, , they've disabled white-listing of ip addresses. doesn't seem feasible large scale app, there anyway bypass. or dump entire project. programming lang chiefly php. thats 350 requests per hour per user, not global per application. by mean is, if application used 100 users, each 1 of users has own limit account. so app can refresh around once every 10 seconds or so, seems plenty mind.

jQuery blur keeps firing when two inputs are involved -

i've dug around while on google , here on stack overflow , can't find related this. i've got multiple input textfields when blurred calls jquery ajax function server. works beautifully, almost. the problem if have focus on 1 text input , click on 1 (making in focus). blur event keeps getting fired ajax calls server , alerts. any ideas how calm blur down isn't firing? there simple i'm not doing might fix this. here's code (ignore {{}} , {%%} tags, django template). the inputs: <td class="tracking-text">ck req:</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.checkreq|default_if_none:"&nbsp"}}" size="10"></td> <td class="tracking-text">lpd:</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.lpd|default_if_n...