Posts

Showing posts from January, 2013

objective c - How do I load a CSV in IOS after saving it locally -

i have csv file i'm downloading s3 account , show in ios app using quicklook framework. the error i'm getting in console. says qlpreviewcontroller's datasource shouldn't nil @ point. this appears after line of code runs // set data source [previewer setdatasource:self]; here's code downloading file, saving , loading quicklook -(void)showdocument { nsstring *stringurl = @"http://jornada.s3.amazonaws.com/dust.csv"; nsurl *url = [nsurl urlwithstring:stringurl]; nsdata *urldata = [nsdata datawithcontentsofurl:url options:nsdatareadinguncached error:nil]; if ( urldata ) { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [nsstring stringwithformat:@"%@/%@", documentsdirectory,@"tempfile.csv"]; //[urldata writetofile:filepath atomically:yes...

how to get jquery on() to work on not-yet-existing elements -

i have used delegate() bind events elements don't exist when dom loaded. understand on() supposed replace delegate, don't understand documentation on jquery site how translate following code use on() $(document).delegate( ".course_name, .start_date, .book_title, .book_author, .book_isbn", "click", function() { var whichbutton = $(this).attr("class"); make_table(whichbutton); fillisbn(); }); $(document).on("click", ".course_name, .start_date, .book_title, .book_author, .book_isbn", function() { var whichbutton = $(this).attr("class"); make_table(whichbutton); fillisbn(); }); not hard, it? internally nowdays .delegate reference .on . .delegate imple...

java.util.scanner - Can I create a String variable that will always be the newest nextLine() Scan? -

because creating new string variable next line stored next line of whatever printout is, there way me create new string variable newest nextline()? want don't have keep making new strings collect each new line of input. thanks help! yes, example below: scanner scan = new scanner(system.in); out.println("enter something: "); //user enters "some" string scaninfo = scan.nextline(); out.println(scaninfo); //outputs "some" out.println("enter something: "); //user enters "thing" scaninfo = scan.nextline(); out.println(scaninfo); //outputs "thing" just make sure know being rewritten every time not able access again. careful .nextline , .nextint (as wont able save .nextint string variable) another idea (not sure exact implementation looking for) use stack, because can keep track of of scanned in information , can pop off recent scanned value

c++ - Why do i need to declare underflow_error -

in below code, error stack.cpp: in member function ‘t* stack<t>::pop()’: stack.cpp:53: error: there no arguments ‘underflow_error’ depend on template parameter, declaration of ‘underflow_error’ must available what rationale behind declaring class underflow_error; ? #include <iostream> using namespace std; template <class t> class stack { public: stack(): head(null) {}; ~stack(); void push(t *); t* pop(); protected: class element { public: element(element * next_, t * data_):next(next_), data(data_) {} element * getnext() const { return next; } t * value() const {return data;} private: element * next; t * data; }; element * head; }; template <class t> stack<t>::~stack() { while(head) { element * next = head->getnext(); delete head; head = next; } } template <class t> t * stack<t>::...

How can I stop Fluent NHibernate automapping from creating foreign keys across the database? -

i using latest version of fluent nhibernate automapping. there convention or property can set stop creating foreign key constraints across tables? have 200 classes, cannot go each individual class , property name , set foreignkeyconstraintnames("none", "none") how can add foreignkeyconstraintnames("none", "none") in automapping? don't want hardcode table name or column name. have automapping create mappings without foreign keys. basicall don't create foreign keys across database. how can this? there similar post here answer not clear me. a simple convention public class noforeignkeys : ireferenceconvention, ihasmanyconvention { public void apply(imanytooneinstance instance) { instance.foreignkey("none"); } public void apply(ionetomanycollectioninstance instance) { instance.key.foreignkey("none"); } } // use automap.assemblyof().conventions .fromassemb...

c# - How to use offset parameter of StreamCreateFile in BASS library? -

i trying use bass library audio editing, if familiar library can me. the function i'm using bass.bass_streamcreatefile(filename, offset, length, flags); for little background, i'm using bass.net wrapper, working mp3 files. actual code i'm using function is: int basestream = bass.bass_streamcreatefile(filename, starttimebytes, durationbasebytes, bassflag.bass_stream_prescan | bassflag.bass_stream_decode | bassflag.bass_sample_float); whenever offset (starttimebytes) equals 0, stream created fine, whenever offset non-zero, method returns 0, , error code given bass_error_fileform. however, files used work fine without offset (offset = 0). maybe there wrong flags i'm using or something? your mp3 files contain frames without offset. use 0 offset. set playback position of stream use bass_channelsetposition () . create stream offset = 0; translate time (seconds) position bytes, based on channel's format using bass_channelseconds2bytes() ...

javascript - Not able to show a div at the mouse position on an Image Map -

Image
i have image: and trying show div when hover on image map have created. works once strange reason , work randomly. moreover, have noticed sort of delay showing div when hover on image map after first time. also, code not work firefox smoothly whereas chrome does. here code till now: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style> #pipelines{ margin-left:auto; margin-right:auto; margin-top:auto; margin-bottom:auto; } #content{ } </style> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>pipeline</title> <script src="http://code.jquery.com/jquery-1.9.1.js"...

iphone - Moving a UIWebView on iOS -

i'm working on ios application , i'm having trouble navigation. i'm new xcode , assumption dynamic content handled through webviews. plan have 4 webviews. 1 dynamic content , other 3 options. my terrible diagram: http://i.imgur.com/t9l30ug.png the center view content created via javascript dragged around. example youtube app drag side options. the final product this, include usual ios overscroll , bounce. http://i.imgur.com/3xyn0eo.gif as of right have loaded center web view local html. i'm bit lost go here. here need dragging view , adding easing. realize it's big question, if @ least point me in correct direction, appreciated. however, if looking @ , thinks i'm going in wrong direction developing structure, please tell me. thanks guys while could web views, there's no need so. web views suited displaying mixed-media styled text or arbitrary websites. however, they're quite bit more difficult work doing interactive touch-a...

RVM with legacy rails app. Can I set the version of rubygems? -

i have client on legacy version of rails ( 2.2.2 ) environment running gem version 1.3.2. when run gem -v on new legacy gemset i've created ruby 1.8.7 , rails 2.2.2 , says version of gem 1.8.25 is there way can set rubygems 1.3.2 legacy gemset? you should upgrade/downgrade rubygems following command: rvm install rubygems 1.4.2 have seen how downgrade rubygems? ?

objective c - SenTestCase linker error iOS -

i'm trying write test cases ios app. however, there seems problem regarding sentesting framework. i'm getting following error: undefined symbols architecture i386: "_objc_class_$_sentestcase", referenced from: _objc_class_$_testsmartdiary in testsmartdiary.o _objc_class_$_testaddtask in testaddtask.o _objc_class_$_testaddcontacts in testaddcontacts.o "_objc_metaclass_$_sentestcase", referenced from: _objc_metaclass_$_testsmartdiary in testsmartdiary.o _objc_metaclass_$_testaddtask in testaddtask.o _objc_metaclass_$_testaddcontacts in testaddcontacts.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) i don't know going wrong. have added sentestingframework. happening because i'm using 2 different machines develop same project. need specify path? read solution given here: ios: linker errors ocunit integration not feasible delete target , a...

r - Adding mean line and text label to lattice histogram -

Image
aloha - i creating series of histograms , add vertical line indicating mean value of distribution text label indicating sample size. code follows: bin_width <- 1 #desired bin width print(histogram(~ length..cm. | method, #create , print histogram , save variable "graph" data = hist.data[hist.data$scientific_name == "pristipomoides filamentosus",], nint = (max(hist.data$length..cm.) - min(hist.data$length..cm.)+1)/bin_width, layout = c(1,2), type = "density", main = "length-frequency of pristipomoides filamentosus gear", xlab = "length (cm)", panel = function(x, ...){ panel.histogram(x,...) panel.mathdensity(dmath = dnorm, col = "red", args = list(mean = mean(x), sd= sd(x)), ...) } )) i assumed done using panel.abline , panel.text functions inserted after panel.histogram , not seem working. doing wrong? if can give me code dummy vertical line (e.g. x=10) , dummy text, can inse...

floating accuracy - how to avoid inaccuracy in multiplications and divisions in python -

i working python , playing multiplications , divisions can't accuracy want operations. following example may reach point. let a = 3 , b = 4 , euclidean norm ( sqrt(a*a + b*b)) 5.0, , divisions work fine, 3/5.0 0.6, , 4/5.0 = 0.8. when want make following 3 * -0.8 + 0.6*4 answer little number not expected zero. i know problems inherent data type, registers , in general machine limits, think there must way @ least simple computations (like example) made no errors. you can use fraction accurate answer: >>> fractions import fraction >>> fraction(-8, 10) * 3 + fraction(6, 10) * 4 fraction(0, 1) or use decimal : >>> decimal import decimal >>> decimal('-0.8') * 3 + decimal('0.6') * 4 decimal('0.0') beware of string used in decimals: using normal numbers make decimals use inaccurate value of number.

delphi - Tcp connection exception -

my server has list of 4 tcp connected clients . if list full , next client must reject //server side unit serverunit; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, idthreadmgr, idthreadmgrdefault, idantifreezebase, idantifreeze, idudpbase, idudpserver, idbasecomponent, idcomponent, idtcpserver, stdctrls, extctrls,idsockethandle, comctrls, idudpclient, grids, idtcpconnection, idtcpclient; type tform1 = class(tform) panel1: tpanel; label3: tlabel; edit3: tedit; button1: tbutton; idtcpserver1: tidtcpserver; idudpserver1: tidudpserver; idantifreeze1: tidantifreeze; idthreadmgrdefault1: tidthreadmgrdefault; statusbar1: tstatusbar; groupbox2: tgroupbox; incomingtext: tmemo; groupbox1: tgroupbox; clients_stringgrid: tstringgrid; idtcpclient1: tidtcpclient; procedure button1click(sender: tobject); procedure idudpserver1udpread(sender: tobject; adata: tstream; abinding: tidsockethandle); procedure addtcpconn(ath...

vba - Visual Basic Compile Error - Invalid Character -

i got vb script off internet create new mail alerts secondary email accounts in outlook(2010). now first part of code, , when running outlook, gives me following error: "compile error: invalid character" the debugger underlines _ character in following line: "sndplaysounda" _ 'on next line change file name , path of sound want play.' public const sound_to_play = "c:\windows\media\speech on.wav" public const snd_async = &h1 public declare function sndplaysound lib "winmm.dll" alias "sndplaysounda" _ (byval lpszsoundname string, byval uflags long) long public declare function messagebox _ lib "user32" alias "messageboxa" _ (byval hwnd long, _ byval lptext string, _ byval lpcaption string, _ byval wtype long) _ long function openoutlookfolder(strfolderpath string) outlook.mapifolder ' purpose: opens outlook folder folder path.' ...

php - Format currency in all input scenarios -

any regex experts can solve this? basically, need same output on different scenarios. need figure out correct regex. <?php // inputs $numbers = array( "1234", "1 234,00", "1234.00", "1234,00", "1.234,00", "1.234.00", "1,234.00", "1,234,567.00", "123,456.00", "1.234.567,00", "1 234 567,00", "-1234", ); foreach ($numbers $number) { echo $number . " => " . my_number_format($number) . " <br />"; } // currency format function my_number_format($number){ // return number_format((double)$number, 2, ',', ' '); $number = preg_replace('#(\d),(\d)#','$1$2',$number); setlocale(lc_monetary, 'sv_se'); return money_format('%!i', $number); } ?>

"java.lang.ArrayIndexOutOfBoundsException: -1" while adding tab to "javax.swing.JTabbedPane" -

please resolved java.lang.arrayindexoutofboundsexception . i getting exception quite randomly , worst part not reproduce exception. stack-trace shows addtab() thrown exception. here code- public class closabletabbedpane extends jtabbedpane{ public void addtab(string title, component component) { super.addtab(title+" ", component); } public string gettabtitleat(int index) { return super.gettitleat(index).trim(); } public void removetab(int index){ this.removetabat(index); } here stack trace- 21 may 2013 09:38:11,992 error eerror : java.lang.arrayindexoutofboundsexception: -1 @ java.util.arraylist.elementdata(arraylist.java:371) @ java.util.arraylist.get(arraylist.java:384) @ javax.swing.jtabbedpane.gettitleat(jtabbedpane.java:1112) @ javax.swing.plaf.basic.basictabbedpaneui$handler.updatehtmlviews(basictabbedpaneui.java:3578) @ javax.swing.plaf.basic.basicta...

c# - Execute decrypt function on LINQ query -

if have following query companies.name encrypted: obviously executing following query going invalid because we're searching against encrypted names. iqueryable<file> files = getfiles(f => f.clients.any(fc => fc.contacts.any(c => c.companies.any(x => x.name.contains(searchtext))))); i'm after way decrypt companies.name before query executed via decrypt() function have in place. edit 1: i have partial class company decrypted property called displayname returns decrypted name property, linq telling me specified type member displayname not supported in linq entities. initializers, entity members, , entity navigation properties supported. iqueryable<file> files = getfiles(f => f.clients.any(fc => fc.contacts.any(c => c.companies.any(x => x.displayname.contains(searchtext))))); if there's way use partial class property inside linq statement guess work. edit 2: i ended creating sql clr function decrypts company names...

TYPO3 Calendar plugin/extension. Which one to choose? -

i have no clue started calendar plugin. can please suggest me if it's easy create 1 scratch or use existing 1 , modify it. if it's later, plugin better. following key functionalities of calendar: the created events should approved (maybe authorized group or something). the events should customized displayed on specific pages or pages. add media library now, 1 better idea...to start new one..or build on existing 1 ? . i'm using typo3 6.1.0. , extension builder creating extension/plugin. thanks the popular calendar typo3 extension cal. think, it's complete one. http://typo3.org/extensions/repository/view/cal currently on ter find versions compatible typo3 cms 6.2.99. or participate in developement, or fork it, or inspired it's functionalities , make own.

c - PROC : Regarding proc Executable size difference -

2 years , have compiled proc test.pc , create executbale "test" . now same proc program have compiled , executable size different compare previous one(i didn't change proc code). why happend or have missed while compiling? please let me know this might due version of gcc different.

php - Trouble with vanilla Bonfire/CI installation and .htaccess -

ok, situation rather simple (although not yet resolved). i downloaded bonfire (for codeigniter) created new folder in sites folder, let's bonfire (i'm using xampp mac) i'm going http://localhost/~drkameleon/bonfire (where install page should appear based on docs) and i'm getting error message server error! the server encountered internal error , unable complete request. either server overloaded or there error in cgi script. now, i'm thinking it may have installation folder being subfolder (i think it's mentioned somewhere in bonfire's documentation, too). however, still don't know tweak in huge .htaccess file comes along bonfire. so, here : # ---------------------------------------------------------------------- # webfont access # ---------------------------------------------------------------------- # allow access domains webfonts. # alternatively whitelist # subdomains "subdomain.example.com". <if...

compiler options - How to add /bigobj parameter to msbuild -

this question has answer here: how set compile flag /bigobj in visual studio? 2 answers i got visual studio solution, generates big objects ( msdn ) how , option should pass ask msbuild generate big objects? see following: how edit microsoft visual studio 2013 compiler switches? see also: penalty of msvs compiler flag /bigobj build issue msvs 2010 , c++ standard how compile /bigobj within dymola (modelica)

jquery - Controller can return either JSON or HTML depending on the result -

suppose have pop-up window contains form. must have controller processes form, , depending on result, controller returns either json (if goes well, , popup can closed javascript) or html (if form data not valid , form must replaced new html - validation error messages). found such solution: that's form: <form id="message" ...> ... </form> and have jquery handler form: $(document).on("submit", "form#message", function (evt) { evt.preventdefault(); $.ajax({ type: this.method, url: this.action, data: $(this).serialize(), success: function (result) { if ($.isplainobject(result)) { // json // close pop-up window } else { // html $("form#message").html(result); } } }); }); controller: [httppost] public actionresult updatemessage(messagemodel model) { ... if (.. ...

android - Link of class 'Landroid/support/v4/app/Watson; failed - Unable to resolve superclass of Lcom/actionbarsherlock/app/SherlockActivity -

i have android project working on few weeks ago working fine in last attempt, project compiles fine, while launching application, getting following warning , crashes application. unable resolve superclass of landroid/support/v4/app/watson; link of class 'landroid/support/v4/app/watson;' failed unable resolve superclass of lcom/actionbarsherlock/app/sherlockfragmentactivity; please tell me how can fix this. thanks i noticed had problem after updating adt plugin revision 22. problem raised due new android package named android private libraries not included on old projects. i fix issue following below steps: 1.right click on project 2.build path-> configure build path -> order , export 3.check android private libraries , click ok 4.clean project 5.rebuild project

Constructor overloading issue in java -

i learing core java , practicing it. understand concept of method overloading. when run below program shows error " constructor methodover in class methodover cannot applied given types; methodover m2 = new methodover(); ^ required: int,int found: no arguments reason: actual , formal argument lists differ in length" please find code below , help.. learning. public class methodover { int x; int y; methodover(int a, int b) { x=a; y=b; system.out.println("the values assigned are" +x+ "and" +y); } void multiply(methodover obj) { obj.x = 2; obj.y = 2; system.out.println("the multiplication result object passed is" +obj.x*obj.y ); } public static void main(string[] args) { methodover m1 = new methodover(5,6); methodover m2 = new methodover(); m2.multiply(m1); } } while playing c...

Horizontal scrolling images gallery in android -

Image
i working on camera application in android , have page camera preview on half of screen , image gallery shown in image below. right now, using gridview show image thumbnails in gallery. but, problem is, can't make gallery scrollable(horizontally). found horizontal scrolling not supported in grid view. the screenshot provided iphone app , working fine. used uicollectionview in iphone app same. i can't find uicollectionview in android. any appreciated. in advance. or can use additional plugins this

XSLT copy value from 1 node to another in xml -

i creating xml file using xslt. in newly created xml file m getting following structure <node1 id=n1> <node2 id = n2> <node4>value1</node4> </node2> <node3 id= n3> <node5></node5> </node3> </node1> now issue need copy value of <node4> i.e. "value1" <node5> i mean <node5>value1</node5> this. can 1 let me know how achieve in xslt? edit: value1 being generated in loop being applied in xslt on xml. main question how copy value 1 node in case new node being created through xslt node 5 i'll using <node5> <xsl:text> <xsl: select="node1/node2/node4"/> </xsl:text> </node5> this: <node5> <xsl:value-of select="/node1/node2/node4"/> </node5> sets content of node5 in output xml value contained in node4 in input xml.

c++ - Why locking a std::mutex doesn't block the thread -

i wrote following code test understanding of std::mutex int main() { mutex m; m.lock(); m.lock(); // expect block thread } and got system_error: device or resource busy . isn't second m.lock() supposed block thread? from std::mutex : a calling thread must not own mutex prior calling lock or try_lock. and std::mutex::lock : if lock called thread owns mutex, program may deadlock. alternatively, if implementation can detect deadlock, resource_deadlock_would_occur error condition may observed. and exceptions clause: throws std::system_error when errors occur, including errors underlying operating system prevent lock meeting specifications. mutex not locked in case of exception being thrown. therefore not supposed block thread. on platform, implementation appears able detect when thread owner of lock , raise exception. may not happen on other platforms, indicated in descriptions.

winapi - What's the standard method close application and start another in windows? -

i implementing automatically updater need close current running application , start installer. the code used : if (executeasadmin(m_filepath)) postquitmessage(0); bool executeasadmin( lpctstr filepath ) { shellexecuteinfo shexecinfo = {0}; shexecinfo.cbsize = sizeof(shellexecuteinfo); shexecinfo.fmask = see_mask_classname; shexecinfo.lpclass = _t("exefile"); shexecinfo.hwnd = null; shexecinfo.lpverb = _t("runas"); shexecinfo.lpfile = filepath; shexecinfo.lpparameters = null; shexecinfo.lpdirectory = null; shexecinfo.nshow = sw_normal; shexecinfo.hinstapp = null; return shellexecuteex(&shexecinfo); } is enough? you don't have quit application. in windows, can't overwrite dlls , exes while they're in use. however, can rename them. so, application can rename it's binaries , run installer. installer can run simultaneously without affecting application (except other text fi...

sql - How to only return in certain increments of days -

i'm trying return every 14 days starting 12/31/2010 12/31/2011, statement doesn't seem work select distinct convert(varchar,month(time_stamp)) + '/' + convert(varchar,day(time_stamp)) report time_stamp '%2011%' , convert(varchar(20),datediff(d,'2010-12-31',time_stamp) / 14) not '%.%' order 1 this doesn't seem work because returns oddball dates... 1/1 1/10 1/11 when should return every 14 days, this... 1/14 1/28 2/11 and on.. anyone know cleaner method, works? change modulo value offset start date select distinct convert(varchar,month(time_stamp)) + '/' + convert(varchar,day(time_stamp)) report time_stamp '%2011%' , datepart(dayofyear, time_stamp) % 14 = 0 order 1

Convert Eclipse java project (with java source folder) to gradle project -

i want migrate java projects (223 projects) gradle project . i'm using gradle eclipse plugin, developed springsource sts team. currently, java projets strutured that: myprojet/ +- src/log +- some.package.log +- some.package.log.a +- src/tools/core +- some.package +- some.package.tools.b +- some.package.tools.c +- src/tools/graph +- some.package.graph +- src/tests +- some.package.test.d +- src/somemodule +- otherdirectories src/log, src/tools/core, src/tools/graph, src/tests , src/somemodule java source folders . after converting project gradle (via configure -> "convert gradle project..."), java source folders become packages. also, matter declared packages in java classes must modified. example, eclipse tell me that: declared package "some.package.test.tools.a" not match expected package "tests.some.package.test.tools.a" eclipse give me possibility change package declaration of class. must classes (so...

java - How do I call method in RemoteServiceServlet from HttpServlet? -

i using gwt , want able invoke method incrementproduct(string productname) in main remoteserviceservlet typing url in browser: http://mywebshop.appspot.com/increment?name=pillow to handle request i've created following httpservlet: public class incrementservlet extends httpservlet { @override protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { system.out.println("incrementservlet called!"); string name = request.getparameter("name"); // call myremoteserviceservlet.incrementproduct(name) somehow } } and added web.xml: <servlet> <servlet-name>incrementservlet</servlet-name> <servlet-class>x.y.z.incrementservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>incrementservlet</servlet-name> <url-pattern>/increment</url-pattern> </servlet-map...

Custom query in Oracle SQL -

i have integer field in table. i want read first digit of field, digit read next digits. for example consider field: 355560 i read first digit (3) then read 3 digits after 3 : (555) how write select query? select substr (355560, 2, substr (355560, 1, 1)) dual;

javascript - Ajax onchange disables second ajax call onclick -

i have situation have following code: <input type="text" onchange="javascript:ajax01()"> <a href="javascript:ajax02()">text</a> both ajax-functions work - except when have text-field active , click on link. ajax01 executed, not ajax02. if have textfield active, click outside textbox, ajax01 fires, , click link , ajax02 fires. both successfully. but how ajax02 fire simultaneously ajax01 if click link directly being active in f try (notice removed javascript: input element. in experience, needed when used in links href attribute. also, there no need force javascript href attribute. should located withing on...() function. <input type="text" onchange="ajax01();"> <a href="javascript:void(0)" onclick="ajax02();">text</a>

android - Bluetooth Communication Message Send Process -

i have used bluetooth chat application, in can chat using bluetooth application.but need need send text message using bluetooth communication, expecting paired device may or may not have bluetooth chat application, still must receive text messages. here in chat application, need application both sides same messanger. i need commmunicate , send text message bluetooth device. can me should ? thank you

Convert Php array in javascript array -

i have php array this [0]->imgae_name=1 image_url=a [1]->imgae_name=2 image_url=b i want convert array in javascript array how can this? you convert php array json using json_encode , echo json string javascript in page , use javascript jsonobject convert js array

performance - Which is a better way to extract grayscale pixel values in Android in terms of battery drain and processing time? -

hope well. i @ of crossroads in current project, needing extract grayscale pixel values sorted per discussion in previous post (and kindly , thoroughly answered). the 2 main methods aware of are: extract grayscale yuv preview. take photo, , convert rgb values grayscale. one of main aims simplicity, project whole needs it, question - whaich of these 2 (or method not aware of) reliable/stable, less taxing on battery , processing time? please note, not after code samples, looking people may have experienced, may hve read (in articles etc) or have intuitive hunch about. thank taking time read this. i'm working on project uses pixel values calculations, , noticed it's better use values directly yuv preview if need grayscale, or need use entire preview calculation. if want use rgb values, or calculate based on part of preview it's better convert area need converting bitmap , using instance. however, depends on you're trying achieve since no 2 p...

How to make a screen appear moving right side after splash screen in android cocos2d -

i developing game app using cocos2d android. after loading screen have menu screen , 2 more screen need effect after splash screen when moves next screen need rotating or moving towards right/left how can can 1 suggest me? how effect when moving 1 screen next activity? thank in advance , answers appreciated. hi hope you. in code used splash screen moves left , next screen comes form right side of screen ccdirector.shareddirector().replacescene(ccslideinrtransition.transition(1, mainmenuscreen.sence()));

How can I create a variable array name in Perl? -

array @p multiline array, e.g. $p[1] second line. this code explain want: $size=@p; # line number of array @p for($i=0; $i<$size; $i++) { @p{$i}= split(/ +/,$p[$i]); } i want result should this: @p0 = $p[0] first line of array @p goes array @p0; @p1 = $p[1] second line of array @p goes array @p1; ... ... and on. but above code not work, how can it? it bad idea dynamically generate variable names. i suggest best solution here convert each line in @p array array of fields. lets suppose have better name @p , @lines . can write my @lines = map [ split ], <$fh>; to read in lines file handle $fh , split them on whitespace. first field of first line $lines[0][0] . third field of first line $lines[0][2] etc.

jquery - Smooth update of DOM tree in Javascript -

i looking solution of migrating dom tree in smooth way. let's imagine dom tree shows list of books: <div class="books"> <div class="book"> <div class="title">book 1</div> ... </div> <div class="book"> <div class="title">book 2</div> ... </div> ... </div> this list should updated new version generate server's input: <div class="books"> <div class="book"> <div class="title">this new book</div> ... </div> <div class="book"> <div class="title">another book</div> ... </div> <div class="book"> <div class="title">book 2</div> ... </div> ... </div> i replace whole structure new one. causes big flicker on screen, avoid. aim iterate through element i...

extjs4.1 - How to insert records for particular store field in extjs -

i getting month, target, target1 values getting webservice available in store. want calculate total value , insert total field value in same store. i doing calculation don't know how insert total value total field. can tell me how this? chartstore.each(function (rec) { total=parsefloat(rec.get('target'))+parsefloat(rec.get('target1')); }); month target target1 total jan 25 25 50 mon 50 50 100 you should use convert function in model total field below { name : 'total', convert : function( value, record ) { var totalvalue = record.get('target') + record.get('target1'); return totalvalue; } type: 'number' },

osx - Detection of framework usage on Mac system? -

i wanted develop sample framework on osx having requirement @ point in time framework should used single client, not getting how achieve ? api's detect weather framework in use? can use file related api this?..i have seen windows sample where detecting dylib's usage using following api's ?? createfilemappingw mapviewoffile openfilemappingw does has come across such scenarios?? you can use lsof command. return list of open files. in absence of options, lsof lists open files belonging active processes. nstask* task = [[nstask alloc] init]; nspipe* pipe = [[nspipe alloc] init]; nsarray* args = [nsarray arraywithobjects: @"-c", @"lsof | grep -i some.framework | wc -l",nil]; [task setlaunchpath: @"/bin/sh"]; [task setarguments: args]; [task setstandardoutput: pipe]; [task setstandarderror: pipe]; [task setstandardinput: [nspipe pipe]]; [task launch]; [task waituntilexit]; nsfilehandle* file = [pipe filehandleforre...

PowerShell Checks Script Output to HTML Issue -

i have checks script converting output html. it has function checks websites response time. can't life of me output show in html. ideas? # function check external website content function websitecheck($object) { $webclient = new-object system.net.webclient $webclient.headers.add("user-agent", "powershell script") $output = "" $starttime = get-date $output = $webclient.downloadstring($object) $endtime = get-date if ($output -like "*test*" -or "*testing*") { "success`t`t" + $starttime.datetime + "`t`t" + ($endtime - $starttime).totalseconds + " seconds" + "`t" + $object } else { "fail`t`t" + $starttime.datetime + "`t`t" + ($endtime - $starttime).totalseconds + " seconds" + "`t" + $object } } #external website check function write-host "external website checks" write-host "" $html = $html + @" websitecheck "http...

python - Posting to Facebook wall -

this has been asked several times, after reading many different posts still have not basic version running posting wall. i want post wall of fb user python. php sdk ( https://github.com/facebook/facebook-php-sdk ) uses first example. need equivalent code in python. require 'facebook-php-sdk/src/facebook.php'; $facebook = new facebook(array( 'appid' => 'your_app_id', 'secret' => 'your_app_secret', )); // user id $user = $facebook->getuser(); the pythonsdk ( https://github.com/pythonforfacebook/facebook-sdk ) says basic usage is: graph = facebook.graphapi(oauth_access_token) without explaining oauth_access_token is. according here: python - facebook api - need working example 1 has generate access token? an access token used authorize application stuff on users behalf. there several ways (also referred "flows") such token, can read on here: facebook developers access tokens . facebook provides too...

java - Align components on the page top right with GridBagLayout Manager -

Image
i trying make login page facebook, code have written not showing on top left side instead showing @ centre of page, using gridbaglayout , anchore setting text @ first_line_end. final jframe f2=new jframe("admin main"); f2.setsize(1350,730); f2.setvisible(true); f1.setvisible(false); f2.setdefaultcloseoperation(jframe.exit_on_close);![enter image description here][2] gridbaglayout gbl=new gridbaglayout(); final jpanel p2=new jpanel(gbl){ private image img = imageio.read(new file("f:\\untitled folder\\rohan\\football2.jpg")); @override protected void paintcomponent( graphics g ) { super.paintcomponent(g); g.drawimage(img, 0,0,1366,730, null); } };; gridbagconstraints g2=new gridbagconstraints(); g2.insets=new inse...

java - How to set atributes throught reflexion -

i have map of <string, object>: params={ dateofbirthto=23.05.2013, lastname=bbb, ssn=aa-ccc-ddd, gender=male, dateofbirthfrom=03.05.2013, firstname=aaa } then have form contains variable map. how can create new form value through reflection? something like: simpleform form = new simpleform(); map<string, object> parameters = request.getparams(); (map.entry<string, object> entry : parameters.entryset()) { // fill form } you use apache commons beanutils simpleform form = new simpleform(); map<string, object> parameters = request.getparams(); (map.entry<string, object> entry : parameters.entryset()) { beanutils.setproperty(form, entry.getkey(), entry.getvalue()); }

asp.net - Get DataTable from aspx using VB 2010 -

i creating vb 2010 desktop application. use lines below string response aspx page use collect online data application. dim response byte() = mywebclient.uploadvalues(myweb & "/default.aspx", "post", nmv) dim str string = replace(system.text.encoding.ascii.getstring(response), "<(.|\n)*?>", "") system.text.encoding.ascii.getstring(response) 'nmv' defined namevaluecollection variable now need data aspx page either nmv or datatable. possible? how go doing it? thinking key in system.'array'... or can't figure out , don't search results on web. getting data string array me, getting nmv better; getting datatable perfect! able deal aspx page giving data in format, need vb app know how collect it. thank you maybe easiest way use *.ashx http handler (generic handler) , save datatable xml, : server: public class handler1 : ihttphandler { public void processrequest(httpcontext context) ...

javascript - convert string array from json sublist -

i have sublist in json response, as "sublist" : { "102" : "core_java(23)", "103" : "oracle(12)", "111" : "ruchek(15)", "104" : "ist-examportal(20)", "105" : "cybersecurity(30)" } i want make this var jsonsource = '[{ "id" : 102, "subname" : "core_java(23)" }, { "id" : 103, "subname" : "oracle(12)" }, { "id" : 111, "subname" : "ruchek(15)" }, { "id" : 104, "subname" : "ist-examportal(20)" }, { "id" : 105, "subname" : "cybersecurity(30)" }]'; help me using javascript. thank in advance. you can for-in loop. var result = []; for(var property in sublist){ if(sublist.hasownproperty(pr...

c# - How to know if user clicked on X in the form -

this question has answer here: how know user has clicked “x” or “close” button? 6 answers thanks takes effort on answering question. i'm using winforms c#, , on mainform_load, i'm calling login form user. login form contains x button (the default button on top-right) , loginbutton. now... if user decides click on x button login form closes , should mainform, know how do. but... if user clicks on loginbutton loginform should close, mainform should stay opened. any idea hwo ? assuming using showdialog show login form, can this: if(loginform.showdialog() == dialogresult.ok) { //login ok } your login form should set dialogresult ok before closes, successful login, so: if(loginsuccess){ this.dialogresult = dialogresult.ok;//this close form }

ruby - batch convert HTML to Markdown -

i have whole lot of html files live in 1 folder. need convert these markdown found couple gems out there great 1 one. question is... how can loop though each file in folder , run command convert these md on separate folder. update #!/usr/bin/ruby root = 'c:/doc' indir = file.join(root, '/input') outdir = file.join(root, '/output') extension = nil filename = nil dir.foreach(indir) |file| # dir.foreach show current , parent directories if file == '.' or item == '..' next end # makes sure current iteration not sub directory if not file.directory?(file) extension = file.extname(file) filename = file.basename(file, extension) end # strips off last string if contains period if filename[filename.length - 1] == "." filename = filename[0..-1] end # got stuck reverse_markdown file.join(indir, filename, '.html') > file.join(outdir, filename, '.md') dir.glob(directory) {|f| ... } loop...

Is it a good idea to serve different jQuery versions based on conditional comments? -

with jquery 2.0 being released, wonder if there problems occurr when serving different versions of jquery ie8 , lower , other browsers use of "conditional comments": <!doctype html> <head> <!--[if lte ie 8]> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <![endif]--> <!--[if gt ie 8]> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <![endif]--> <!--[if !ie]> --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <!-- <![endif]--> </head> <body> </body> </html> since release notes state, jquery 2.0 has same api jquery 1.9 i assume save take approach extensive amount of existing jquery code. missing some...

python format string thousand separator with spaces -

for printing number thousand separator, 1 can use python format string : '{:,}'.format(1234567890) but how can specify want space thousands separator? here bad simple solution if don't want mess locale : '{:,}'.format(1234567890.001).replace(',', ' ')

asp.net - Hide ASP Website and SQL Ptored Procedures from Users -

i'm creating asp.net web application hosted on different servers, , not want show code others have access servers. so, heard of publishing pre compiled code in asp.net code secure. but need hide stored procedures main. so, how can hide them ?? like.. precompiling or converting dlls etc, how can this?? for code can publish , stored procedure can using with encryption encrypts code behind stored procedure. create procedure sp_mytest encryption select * tablename check link you may check msdn

oracle - sql statement finding total of an amount -

i trying write sql statement can find company's top client. top client defined 1 has purchased (total purchase amount) among company's clients, not max amount in 1 purchase. how go @ solving one? don't have experience sql have far is: select client.clientno, client.client name, purchase.amount purchase, client purchase.clientno = client.clientno group client.clientno, client.cname, purchase.amount; this displays results of candidates. how start since i'm not looking max value of amount total sum of highest paying client? just going put additional question if answer.. how change constraint on 1 of tables limited set of strings? right varchar2(25) want valid "string" "string2" appreciated. try: select clientno, cname (select client.clientno, client.cname, rank() on (order sum(purchase.amount) desc) rnk purchase join client on purchase.clientno = client.clientno group client.clientno, client.cname) rnk = 1; update if want sum o...