Posts

Showing posts from January, 2011

php - Javascript "print contents of div" function repeating the same content -

i attempting edit wordpress plugin client used print coupon using custom javascript function print contents of div. plugin called shortcode: [print-button target='div#foo'] the target css id of container div jpg of coupon being content. when click on generated "print" button window opens , brings print dialogue jpg. 1 instance of plugin on page works perfectly, when have 2 or more instances jpg opens in new print window last 1 on page. here plugin code: add_shortcode("print-button", "sc_show_print_button"); function sc_show_print_button($atts, $content = null){ $target_element = $atts['target']; if($target_element == ''){$target_element = "document.body";} $output = "<input id=\"coupon\" type='button' onclick='return pop_print()' value='print coupon'/> <script type='text/javascript'> function pop_print(){ w=window.open(...

jdbc - Querying Large Datasets in Cassandra -

i experience rdbms programmer. working on scientific research problem involving genomic data. assigned explore cassandra since needed big data, scalable , cheap (free) solution. setting cassandra , loading data seductively trivial , similar experience traditional dbs oracle , mysql. problem finding simple strategy query data since fundamental requirement data repositories. data working mutation datasets contain positional information calculated numerical measures regarding data. set initial static column family looks this: create table variant ( chrom text, pos int, ref text, alt text, aa text, ac int, af float, afr_af text, amr_af text, int, asn_af text, avgpost text, erate text, eur_af text, ldaf text, mutation_id text, patient_id int, rsq text, snpsource text, theta text, vt text, primary key (chrom, pos, ref, alt) ) bloom_filter_fp_chance=0.010000 , caching='keys_only' , comment='' , dclocal_read_repair_chance=0.000000 , gc_grace_seconds=864000 , read_repair_c...

three.js - Distributing colour swatch to IcosahedronGeometry faces -

Image
i have icosahedrongeometry , distributed array of 3 blue colours evenly possible on icosahedrongeometry faces adjacent faces use different colour array. change array have 4 colours if work better? i don't understand math enough know in order faces applied icosahedrongeometry. i've tried like: var colours = [0x62a5dc, 0x4577b9, 0x2b2b5d]; ( var = 0; < geometry.faces.length; ++ ) { if(i<5) geometry.faces[ ].color.sethex( colours[0] ); else if(i<10) geometry.faces[ ].color.sethex( colours[1] ); else geometry.faces[ ].color.sethex( colours[2] ); } but didn't have great result have @ utility program http://threejs.org/examples/misc_uv_tests.html . it shows uv map, , can see faces share edge. remember, wraps. face numbers wrap, too. in image below, face numbers on right edge 19 , 14. three.js r.58

c++ - Fatal error when compiling llvm/clang - 'cstddef' file not found -

when trying compile llvm/clang ../llvm/configure --enable-cxx11=yes --enable-libcpp=yes --enable-optimized=yes --prefix=/usr/local --enable-targets=all --with-gcc-toolchain=/usr/local/bin --enable-bindings=auto the following error occurs: [...]llvm/include/llvm/support/alignof.h:19:10: fatal error: 'cstddef' file not found #include <cstddef> ^ 1 error generated. rm: [...]/llvm_build/lib/support/release+asserts/apfloat.d.tmp: no such file or directory make[1]: *** [[...]/llvm_build/lib/support/release+asserts/apfloat.o] error 1 make: *** [all] error 1 but cstddef indeed exist (in /usr/local/include/c++/4.8.0/ ). adding --includedir=/usr/local/include/c++/4.8.0/ configure not also. what can cause this? try building cmake or re-installing dependancies below cmake .. -dcmake_build_type=release -dllvm_targets_to_build="x86_64;jsbackend" \ -dllvm_include_examples=off i ran similar errors , installed essential gcc-4.8 , li...

why cant you access first div element of body like document.body.div[0] in html/javascript -

i can document.body.childnodes[1] why not 'document.body.div[1]'. how document special? sorry if missing something. following logic,and document not special, body should have been accessible through this. document.childnodes[1] or so. assuming div body second element. why work this. document.body.etc << can but... document.body.div << not this. instead this... document.body.childnodes[1] << works given div 2nd element! document.childnodes[1] << why not way acces body given 2nd element [1]. document.body.div.p << want this, understanding of html object model should possible. document.childnodes[0] return first tag in whole document, whereas document.body.childnodes[0] return first tag under body tag.

html - Remove gap between objects using CSS -

looking way remove gap between 2 objects. @ moment there container showing between ul menu , div hold content. have looked @ changing margins/display cannot figure out how remove it. here image show mean. want remove gap between black bar , menubar. sorry horrrid css question. :> image: http://i.imgur.com/dov5gct.png pastebin ids (put them @ end of pastebin url.) css: /iuadqrk0 html: /shwxsp8v cheers in advance xx as answered in comments, should remove height on ul element : #menu { height: 25px; }

php - How can I save information from forms? -

here code in jsfiddle: http://jsfiddle.net/mppxx/ if find way through clicking first "yes" or first image on left within div tag, come across form in speaking about. now, after user inputs information (i include 'submit' button later), how can 'save' information? need information 2 purposes: 1) create reminder said information 2) make separate area "list of reminders" , display saved reminders thanks $(document).ready(function() { $(".appimg1").click(function() { $("#app1").animate({ left: '250px', opacity: 0 }); $("#app2").fadein("slow"); }); }); $(document).ready(function() { $(".ap...

retrieving data from two mysql tables where the second table depends on the first -

i have 2 mysql tables: users(id_user, name, age, gender ). ways(#id_user,id_way, start, end, date). what want retrieve ways corresponding users details. result this: id_way | start | end | date | id_user | name | age | gender --------------------------------------------------------------------------- 2 | place1 | place2 | 12/06/2013 | 145 | john | 28 | m have tried join ? select ways.id_way, ways.start, ways.end, ways.date, users.* ways join users using (id_user)

Java External MySQL Database Connection -

i have java application requires connection external mysql database. however, have restricted list of ip addresses able log computer.the issue 1 of our clients travels , therefore has dynamic ip address. have chosen route use http://www.noip.com take consideration dynamic ip address. however, there's issue on how link 2 programs together. java application still refers [ip address].hlrn.qwest.net rather [sub-domain].no-ip.biz. is there function can use in java override ip address used connect database? thanks. ideally, connection string should have been externalised modified easily. if it's more of policy constraint on ips think whichever way it; still considered violation. anyway, i'm assuming have given thought. on os have hosts file can used override dns name resolution. constraint can map ips not hostname hostname. alias hostname that's mapped ip. example, if add below 127.0.0.1 [ip address].hlrn.qwest.net to hosts file (which way located @...

ruby - Rails - how to get the records by their rank -

i have city model holds names of cities , respective populations. how write method show cities range of ranks? for example, i'd able pass in 2 numbers method high end of ranks , 1 low end. ie, pass in get_cities_by_pop(1,10) top 10 cities population, while get_cities_by_pop(20,35) cities ranked 20-35 population. so far have: def get_cities_by_pop(high, low) cities = city.all.order('population desc') end but not sure how write logic. you have need on activerecord querying guide page . you can use limit specify number of records retrieved, , use offset specify number of records skip before starting return records. example client.limit(5) will return maximum of 5 clients , because specifies no offset return first 5 in table. sql executes looks this: select * clients limit 5 adding offset that client.limit(5).offset(30) will return instead maximum of 5 clients beginning 31st. sql looks like: select * clients limit ...

google app engine - Are single-entity datastore writes atomic? -

in appengine datastore, given entity a = mymodel(a=1, b=2) , a.put() atomic? is, if run: a.a=3 a.b=4 a.put() am guaranteed entity updated correctly properties, (assuming a.put() did not raise exception, is)? dan sanderson's book says it is , couldn't find concrete documentation on subject elsewhere. yes, single entity's update atomic. as noted in article , given entity single protocol buffer in bigtable row. protocol buffers written atomically.

php - how to replace date format in a dynamic string variable? -

my variable dynamic string variable in string have date value , looks like $var = 'bd','100','10-05-2013','20-05-2013','alise'; but want change date format like $var = 'bd','100','2013-05-10','2013-05-20','alise'; my variable dynamic date position , number of dates not fixed. thanks i recommend using strtotime (see http://php.net/manual/en/function.strtotime.php ). can iterate on var (explode if need) , check whether false returned. else meaningful date/date time , timestamp.

php - Yii Creating an audit trail; Controller to another Controller -

i'm creating audit trail module project using yii php, , i'm quite newbi.. , know audit trail concerned creation of history, transaction logs... i've created model audit trail , generated controller separate model it. (using gii of course) my problem lies how create entry , or trail (log, history, don't know term sorry =3) i have audittrailcontroller action: class audittrailcontroller extends controller{ public function actioncreate() { //do create trail } } my plan call actioncreate() every other controllers on modules in whole project say: class studycontroller extends controller { public function addrecord(){ //add record //---> want call acioncreate() audittrailcontroller here //to create entry telling user "user" @ time "time" //performed "add" operation.. } public function updaterecord(){ //update record //---> want c...

How to Display Exception In Grails? -

a have problem code. how can handle error service gsp? tried render service or controller, validation error occured during call save(): - field error in object 'talent.candidateprofile' on field 'core.db_email': rejected value []; codes full exception trace. sources: def create() { [candidateprofileinstance: new candidateprofile(params)] } def save() { def candidateprofileinstance = new candidateprofile(params) if (!candidateprofileinstance.save(flush: true)) { render(view: "create", model: [candidateprofileinstance: candidateprofileinstance]) return } flash.message = message(code: 'default.created.message', args: [message(code: 'candidateprofile.label', default: 'candidateprofile'), candidateprofileinstance.id]) redirect(action: "show", id: candidateprofileinstance.id) } my .gsp page code <div class="full-filed"> ...

ruby - Rails deployment using Phusion Passenger on Bluehost -

i trying deploy rails application on bluehost using passenger , have been failing time. installed passenger gem using: gem install passenger and ran: passenger-install-apache2-module and ran db migrations , did asset precompile the problem is, trying host on sub-domain, did following steps: created sub-domain. created sym link rails app pointing sub-domain. added following lines .htaccess: passengerenabled on passengerapproot /home/username/rails_apps/my_app and when navigate domain in browser gives me: internal server error. server encountered internal error or misconfiguration , unable complete request. please contact server administrator, webmaster@sub.domain.com where going wrong? thanks in advance :) hey have checked user & group in httpd conf file? make sure if have user/group www-data in httpd conf project directories should have same owner & group.

assembly - invoke error when trying to exit program -

i have code restart: mov edx, offset prompt5 call writestring mov edx, 0 mov edx , offset buffer call readstring cmp edx, 'n' or 'n' je exit cmp edx, 'y' or 'y' je readinput jne restart this code ask user enter either y or y yes. if enter y or y program start beginning, if user enter else beside y or y , n or n . if user enter n or n program exits. why invoke error on je exit line thank in advance helping you can't compare 2 values @ same time. when cmp al, 'y' or 'y' assembler calculate bitwise or of 'y' , 'y' , 'y' . instruction becomes equivalent of cmp al, 'y' . if want compare against both of values, need each comparison separately. cmp al,'y' je l1 cmp al,'y' je l1 assuming l1 label want jump if user enters y or y. i...

visual studio 2012 - Viewing all descendant files in TFS/VS -

is possible see descendant files in marked folder in source control explorer window in visual studio? other source control software have used have option, , makes easy iterate through files in folder recursively , see has changed. i think tfs not support feature, there others options available : pending changes don't need iterate through files see has changed. can view has changed using pending changes . pending change change (add, edit, delete ...) has not been check-in in tfs. can view these changes single directory or whole project. in addition, can check-in pending changes 1 directory. see summary window view changes before. right-click item (folder or file), , see options : check in, undo or shelve. more info here . file & folder comparison in source control explorer, can compare differences between 2 server folders, 2 local folders, or server folder , local folder. right click on target folder. it's quite powerfull feature when know it. read more...

jpa - Get counts of values of an Enum in JQL -

is thare way jql can counts according values of enum? example, enum has values single, married, divorced, etc. , counts of persons entity in single java persistence language query? there 2 ways, either use group by, or sub-selects in select clause, select count(p), p.status person p group p.status or, select (select count(p) person p p.status = status.single), (select count(p) person p p.status = status.married), (select count(p) person p p.status = status.divorced) but sub-selects in select clause not supported jpa (at least jpa 2.0, 2.1 believe), eclipselink 2.4 or greater support this.

ios - how to solve "ImageIO: JPEG Application transferred too few scanlines" -

when save image album, failed. error info: peg application transferred few scanlines anyone has ever met this? thanks. // make data provider data. float32 picsize = texture->image_size.width * texture->image_size.height * texture->bytesperpixel; nslog(@"pic size:%f", picsize); cgdataproviderref provider = cgdataprovidercreatewithdata(null, texture->data, texture->image_size.width * texture->image_size.height * texture->bytesperpixel, null); // prep ingredients int bitspercomponent = 8; int bitsperpixel = 32; int bytesperrow = 4 * 320; cgcolorspaceref colorspaceref = cgcolorspacecreatedevicergb(); cgbitmapinfo bitmapinfo = kcgbitmapbyteorderdefault; cgcolorrenderingintent renderingintent = kcgrenderingintentdefault; // make cgimage cgimageref imageref = cgimagecreate(320, 480, bitspercomponent, bitsperpixel, bytesperrow, colorspaceref, bitmapinfo, provider, null, no, renderingintent); // make uiimage uiimage *myimage = [uiimage imagewithcgimag...

How to authentication API controller -

i'm wondering if there's can explain me how have construct authentication api controller. i have native ios application i have grails backend service for moment i'm using fixed user credentials(for development) in ios application (i know these credentials exists). want make flexible providing login controller. in backend, i'm using spring security basic authentication. when make connection backend, provide username , password in http header. my real question here should provide in authentication api controller. want use controller check if user exists, , password correct. anyone has experience this? can't use empty authentication controller spring-security method @secured(['is_authenticated_fully']) if i'm correct it'll send proper http status codes isn't it?

unit testing - CodedUITests: Can i cancel a testrun when some requierements in ClassInitialize couldnt reached? -

is there way cancel testrun in classinitialize()? for example, start application wanted test in classinitialize() method. if application couldnt started wanted cancel testrun , mark failure, prevent other steps testinitialzie() , execution of specific testmethod() . there statement wich supports that? or have set variable in classinitialize() , check variable when starts testmethod() , dependent value of variable mark testmethod() failure or not? thanks in advance try this: [classinitialize] public static void classinitialize(testcontext testcontext) { ... assert.isfalse(haserrors, "aborting {0}", testcontext.testname); }

asp.net mvc - How to Redirect to external url from controller? -

asp.net mvc 4 project how redirect external url http-->https controller? can't type: var url = @"https://www.someurl.com" return redirect(url); it doesn't work. also i've tried this: var uri = new uribuilder(url) { scheme = uri.urischemehttps }; return redirect(uri.tostring()); well stumbled on same problem: have mvc website running under https , have situations need redirect external url recieve parameter , when url http url - http://www.somethingontheweb.com - straightforward return redirect("http://www.somethingontheweb.com"); actually not work because after looks redirect https ://www.somethingontheweb.com not exist @ usually. still don't know why works i've found work around: i've resorted meta refresh so have page: ~/views/shared/doredirect.cshtml , here code: @{ layout = null; } <!doctype html> <html> <head> <meta http-equiv="refresh" content="0; url=@vie...

javascript - "Unable to load http://url status:0" error in onbeforeunload-method -

may of can me find problem? i've got xpage client-side js-code included should executed when decide leave page. in client-side js refer button , click automatically. button got server-side js code included , change flag document ("opened ..." ""). the thing somehow client-side js did not work in different browsers except current ie (10.0.5) , throws error: unable load http://urlofthedocument/... status:0 the funny thing is, when insert alert()-method right after click()-method works fine in every browser. don't want include alert statement figure out there must different avoid this. (a short pause instead of alert-method did not work.) my cs js-code: window.onbeforeunload = warneditmode; function warneditmode(){ if(needunloadconfirm == true){ var el = window.document.getelementbyid("#{id:hidden4ssjs}"); el.click(); //document.open(); //document.write(el); //document.close(); //ale...

primefaces - P:ajax not working with p:commandbutton -

i try never work ;why ajax not supported ?? <p:commandbutton value="maj" rendered="#{lignexl.resultat eq 'pas de fmd'}" onclick="confirmation.show()" > <f:setpropertyactionlistener target="#{parserxls.selectitem}" value="#{lignexl}" /> <p:ajax event="click" listener="#{parserxls.listenercomposant()}"/> </p:commandbutton> listener never executed why !!! i'm trying object according selectitem public void listenercomposant(){ composantitem=cherchercomposant(selcetitem.getrefcomposant(), selcetitem.getreffabricant()); } the command button ajax based. need have like <p:commandbutton value="testbutton" actionlistener="#{bean.savesomething}" id="id" update="panel" /> as can see commandbutton has actionlistener use that.

iphone - How to use UIImagePicker in Navigation Controller? -

i want use uiimagepicker in viewcontroller of navigation controller. camera & photo library. it works dismissal presentation of uiimagepicker not working. gets dismissed uiimagepicker rootnavigationcontroller cancel button want come viewcontroller (subviewcontroller of navigation controller) before present. (the same problem present normal viewcontroller not uiimagepicker ,it coming rootnavigationcontroller . i'm trying push viewcontroller rid of problem apple not allowed use push uiimagepicker ). //sorry english not well,i'm poor.

jquery - Exact synatx of Datetime field in POST -

i trying send date_time jquery post our server using mongodb backend , using django_tastypie_mongoengine posting far have tried putting date="2010-11-10t03:07:43" , date="2013-05-21t02:17:55.544000" in jquery failing everytime. models.py: class problemdetail(document): date = datetimefield(default=datetime.datetime.now) api.py class problemdetailresource(resources.mongoengineresource) class meta: queryset = problemdetail.objects.all() resource_name = 'problem' allowed_methods = ('get', 'post', 'put', 'delete','patch') authorization = authorization.authorization() html page var date = "2000-11-10t03:07:43" data = json.stringify({"date":date}) $.ajax({ url: 'http://xyz.in/api/v1/problem/?format=json', type: 'post', contenttype: 'application/json', data: data, datatype: 'json', processdata: false, success: functi...

c++ - Using CRT Library to find specific memory leaks -

i following msdn article finding memory leaks using crt. http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.100%29.aspx i added _crtdumpmemoryleaks(); exit point of application. shows me thousands of memory leaks in different files. interested in finding memory leaks of particular file/class/function. there possible way implement this. here tried do. void someclass::somerandomfunction(somerandomparameters) { _crtdumpmemoryleaks(); // start of function. // lines of codes may contain memory leaks. _crtdumpmemoryleaks(); // end of function. } i added breakpoints on entry , exit of method. thought second dumpmemory function display memory leaks find between these 2 dumpmemory function calls. didn't happened. there other way this? _crtdumpmemoryleaks() should ever used @ end of program. looking _crtmemcheckpoint(), call @ start of function take snapshot. , use _crtmemdumpallobjectssince() @ end of function see w...

winforms - How to move a certain part of a picture box using Visual Studio c# -

i move part of picture box move part. can move left right want move tip of only. private float angle = 0.0f; image image; private void form1_keydown(object sender, keyeventargs e) { if (e.keycode == keys.right) angle += 1; else if (e.keycode == keys.left) angle -= 1; int = picturebox1.location.x; int b = picturebox1.location.y; if (e.keycode == keys.right) += 5; else if (e.keycode == keys.left) -= 5; picturebox2.location = new point(a, b); rotateimage(picturebox1, image, angle); } private void rotateimage(picturebox pb, image img, float angle) { //store our old image can delete image oldimage = pb.image; pb.image = rotateimage(img, angle); if (oldimage != null) oldimage.dispose(); } public static bitmap rotateimage(image image, float angle) { return rotateimagefinal(image, new pointf((float)image.width / 2, (float)imag...

actionscript 3 - The this must be used to reference the bindadle property -

Image
if using {result} instead of {this.result}, binding mechnism can't work. didn't find doc describing thing. using flex3.5. know reason? <?xml version="1.0" encoding="utf-8"?> <mx:panel xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:script> <![cdata[ [bindable] public var result:string ="b"; function confirm():void{ result = "changed text"; } ]]> </mx:script> <mx:textinput text="{this.result}"/> <mx:button label="confirm" buttondown="{confirm();}"/> </mx:panel> this not problem of binding. far know, should avoid using "result" variable name, because used components. if rename result result1, work regardless of "this" keyword. to see difference between "result" ,...

datagridview - Devcomponents SuperGrid Primary column not set -

hi i use dotnetbar supergrid fo winform cant set desired column primary column show tree buttons , lines .i fill gridwiew in cod , not binding data source.there rows each have sub rows tree button not shown thanks help i find . first added column have been considered primary column . in code not work beceuse added columns manually in designer .although removed them seems data removed columns saved somewhere .so there hidden columns in gridview .i delete control , add new 1

Custom HTML tag attributes are not rendered by JSF -

i want add ios specific tag attributes login-form. if have on web page source, attributes autocorrect, autocapitalize , spellcheck aren't there. reason this? using jsf 2.x. <h:inputtext id="user-name" forceid="true" value="#{login.username}" style="width:120px;" autocorrect="off" autocapitalize="off" spellcheck="false" /> this design. can specify attributes supported jsf component (i.e. it's listed in attribute list in tag documentation ). can't specify arbitrary additional attributes, plain ignored. there several ways solve this: if you're on jsf 2.2+, specify passthrough attribute : <html ... xmlns:a="http://xmlns.jcp.org/jsf/passthrough"> ... <h:inputtext ... a:autocorrect="off" /> (note i'm using xmlns:a instead of xmlns:p avoid clash primefaces default namespace) or: <html ... xmlns:f="http://xmlns.jcp.org/jsf/co...

osx - Audiorecorder, Choosing the input channels. Mac and RME -

i trying record sound through external sound card: rme fireface 400. this code using: ao = audioplayer(mls_o,fs,16,5); % mls_o signal played. ai = audiorecorder(fs,16,2,5); % 2 channels how assign them play(ao);%playing recordblocking(ai,1,2);%recording y_rec=getaudiodata(ai); delete(ai);% deleting objects delete(ao); i can chose number of channels, not address them. audiorecorder supports 2 channels , fireface have 8 input channels. have use first 2 analog: ch5 , ch6. however, default audio recorder 1st , 2nd one, mic inputs. otherwise know other way of doing that? i don't think can audiorecorder object. check out playrec library , pa-wavplay fileexchange submission , either of should capable of doing need. believe psychtoolbox allows this, might overkill needs.

android - A correct way to convert byte[] in java to unsigned char* in C++, and vice versa? -

i'm newbie in c++ , jni, try find correct way convert byte[] in java unsigned char* in c++ using jni, , vice versa ! (i'm working on android) after looking solution in google , so, haven't found details way convert byte[] in java c++. please me, , provide solution vice versa (unsigned char* in c++ byte[] in java). much byte[] in java unsigned char* in c++: java : private static native void nativereceivedatafromserver(byte[] value, int length); jni: ... (jnienv* env, jobject thiz, jbytearray array, jint array_length) { ??? } ps: modified question being real question problem :( you can use convert unsigned char array jbytearray jbytearray as_byte_array(unsigned char* buf, int len) { jbytearray array = env->newbytearray (len); env->setbytearrayregion (array, 0, len, reinterpret_cast<jbyte*>(buf)); return array; } to convert other way around... unsigned char* as_unsigned_char_array(jbytearray array) { int len ...

Implementing DragStarted DragDelta events in windows 8 / WinRT -

Image
how can attach dragstarted dragdelta events grid in windows 8 / winrt . did same in windows phone gestureservice.getgesturelistener() method. tried replace code manipulationstarted & manipulationdelta events in windows 8. result not same. in windows phone single drag enters dragdelta events 2 or more times. in other hand in windows 8, in manupulationdelta event fires once similar drag operation. yeah, think know want. let's have xaml this: <grid margin="50"> <grid.columndefinitions> <columndefinition /> <columndefinition /> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition /> <rowdefinition /> </grid.rowdefinitions> <rectangle fill="blue" x:name="myrect" /> </grid> you want move rectangle around grid dragging it. just use code: public mainpage() { this.initializecomponent(); myrect.ma...

sql - getting last record from the database with some conditions -

my table structure recordid mobilenumber month year yearmonth 101 9900000000 4 2013 20134 102 9900000000 3 2013 20133 103 9900000000 1 2013 20131 104 9999999999 3 2013 20133 105 9999999999 2 2013 20132 106 9999999999 1 2013 20131 suppose current month 4 , year 2013. i need numbers table last entry . had tried query select * tablename yearmonth=(select max(yearmonth) tablename) but problem numbers not appears last month number 999999999 has no value month 4 doesn't retrieve numbers. how can last record of numbers. select * ( select *, row_number() on (partition mobilenumber order year desc, month desc, recordid ...

objective c - How to list out Recently Opened documents in iOS? -

i have listed out documents in nsdocument directory , im able documents modified using : nsmutablearray* filesandproperties = [nsmutablearray arraywithcapacity:[filesarray count]]; for(nsstring* file in filesarray) { nsstring* filepath = [imgr.documentspath stringbyappendingpathcomponent:file]; nsdictionary* properties = [[nsfilemanager defaultmanager] attributesofitematpath:filepath error:&error]; nsdate* moddate = [properties objectforkey:nsfilemodificationdate]; if(error == nil) { [filesandproperties addobject:[nsdictionary dictionarywithobjectsandkeys: file, @"path", moddate, @"lastmoddate", nil]]; } } by fallowing : get directory contents in date modified order now how can list out documents have been opened , viewed use...

c# - WPF Control Templating - How do I create a custom property? -

i'm building xaml usercontrol library using blend. i've created template custom wpf slider type. i'd able add custom brush property control allow easy customisation when designing application interface (my slider design has background colour, foreground colour , thumbnail colour). possible, , if so, appear in blend interface? i know create load of styles, seems overkill changing single colour... in codebehind of usercontrol, define dependency properties brushes want use in template. public static readonly dependencyproperty thumbnailbrushproperty = dependencyproperty.register("command", typeof (brush), typeof (yourcontrol), new propertymetadata(default(brush))); this property show in vs designer , blend in miscellaneous section. if understand right, have created controltemplate custom slider control. if so, can use property within template binding via template binding: update ok, creating template standard slider contro...

java - Is there a way to find all View.GONE elements on a page? -

i have android application i'm hiding , showing different custom items on page. there way loop through items on page set view.gone or going have if each id? thanks lot to find hidden views, can like: linearlayout parentlayout = (linearlayout) findviewbyid(r.id.parent_layout); int childviews = parentlayout.getchildcount(); list<view> hiddenviews = new arraylist<view>(); (int = 0; < childviews; i++) { view v = parentlayout.getchildat(i); if (v.getvisibility() == view.gone) { hiddenviews.add(v); } } in example, list<view> hiddenviews contain views visibility of view.gone .

How to test if a Facebook user has installed my android application with sdk 3 -

i developing android application have facebook integration. users of application able invite friends install application. how tell of users facebook friends have android application installed? you can record in server (google app engine example) users have installed app facebook id, request list of facebook friends id's, compare id in both list , got them.

Android Universal App Approach -

i want develop universal app . novice approach .that means single apk both tablet , phone application . had go through support library fragments my aim build different ui tablet , phone inside single apk . i had read getting app ready jelly bean , nexus 7 . article mention that res/layout/activity_home.xml take advantage of space on 7” screen might provide alternative layout: res/layout-sw600dp/activity_home.xml sw600dp qualifier declares these resources devices have screen @ least 600dp available on smallest side. furthermore might provide different layout 10” tablets: res/layout-sw720dp/activity_home.xml that means can use different layout different device . confuses me edit 1 :: scenario suppose if phone ui layout contains one-view pager , tablet ui layout contain two-view pager . how can achieve ?? in article says designe different layout same name different screen , keep corresponding folder . doubt arise exceptions if try initialize widget c...

c# - Forcing WCF to ignore config file, or sections of config file -

i understand how configure wcf programatically, i'm wondering if there's way force wcf service ignore configuration file and/or ignore parts of configuration file. i'd able restrict service using settings, such ensuring use specific binding configuration whilst leaving binding settings such address configurable. means have 2 options can 1) restrict specific settings required if possible, or 2) disable loading of config file altogether , use own custom config file supports settings need , use these basis on setup bindings programatically based on these values. i understand self-hosted service can @ least iterate binding settings , forth , disable/remove/modify not interested in after have been loaded believe trivial self-hosted services set servicehost manually , i'm wondering if it's way restrict configuration believe having made service there nothing stop taking service library , using different host (such iis) load own custom configuration. i understand ...

the_post() conflict in wordpress script -

i have code similar this: while (have_posts()) : the_post(); .... more code ... $my_query = new wp_query($args); if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); .... other code .. the question how avoid conflict the_post() ? because first while loop i'm accessing posts , second while other posts. , website display info second while, should display info of posts first while. think confusing posts... you can use wp_reset_query() function while (have_posts()) : the_post(); .... more code ... wp_reset_query(); $my_query = new wp_query($args); if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); .... other code .. here reference manual wp_reset_query()

import - MYSQL: Load data as CSV issue -

following mysql command doesnt impoirt db, load data infile "database1.csv" replace table business fields terminated ',' escaped '"' lines terminated '\n' ignore 1 lines (business_name,address,city,state,zip_code,website,phone,contact_name) set website = nullif(website,''), contact_name = nullif(contact_name,'') following struct of business table: create table `business` ( `id` bigint(20) not null auto_increment, `metro_id` bigint(20) default null, `contact_name` varchar(60) collate utf8_unicode_ci default null, `contact_email` varchar(60) collate utf8_unicode_ci default null, `business_name` varchar(512) collate utf8_unicode_ci default null, `city` varchar(512) collate utf8_unicode_ci default null, `state` varchar(512) collate utf8_unicode_ci default null, `zip_code` varchar(20) collate utf8_unicode_ci default null, `phone` varchar(50) collate utf8_unicode_ci default null, `website` varchar(512) col...

c# - Command Argument not working link button -

i have link button , set of records. when link button of specific record clicked, want id of record passed code behind. code have used: <asp:linkbutton id="likes" runat="server" oncommand="linkbutton1_click" commandargument='<%#eval("datarow["id"]") %>' commandname="like"> click</asp:linkbutton> and in cs file have used: protected void linkbutton1_click(object sender, commandeventargs e) { int x = int32.parse(e.commandargument.tostring()); } but command argument null here. can please me? you handle wrong event. think linkbutton inside control @greg84 said, example, handle event itemdatabound of datagrid or repeater . protected void control_itemdatabound(object sender, controlitemeventargs e) { linkbutton likes = (linkbutton)e.item.findcontro("likes"); // write code here handle click // ... }

HTTP caching in RestSharp (monotouch) -

restsharp (monotouch) seems disregard cache-control headers replied server (for calls). general case, restsharp doesn't perform proper http caching? or have missed something? following header params used, document not cached. date: tue, 21 may 2013 11:34:55 gmt content-type: application/json transfer-encoding: chunked connection: keep-alive cache-control: no-transform, max-age=3600 content-encoding: gzip if restsharp doesn't support correct caching, how local http caching best implemented restsharp? adding caching proxy component? it's old question, , looking answer when stumbled on this: monotouch - iphone httpwebrequest turn off caching? now since restsharp using httpwebrequest under hood, , implementation of httpwebrequest in monotouch doesn't feature caching, caching won't work in restsharp either. (and i) have implement our own caching component.

actionscript 3 - Add MXML event listener on component's child -

i'm not sure if possble, add event listener on sub component mxml. this: my component <s:group> <s:button id="mybtn" label="click me" /> </s:group> main application <local:mycomponent> <local:mybtn click="dosomething()" /> </local:mycomponent> i know can in code, want know if it's possible in mxml. if it's possible, correct syntax? it possible, requires lot of setup. first add event metadata mycomponent: <s:group> <fx:metadata> [event(name="click", type="flash.events.mouseevent")] </fx:metadata> <s:button id="mybtn" label="click me" /> </s:group> in theory should make sure component dispatches click event; since click bubble default not need else event. now, main component show event in mxml code hinting, , compiler not complain: <local:mycomponent click="dosomething()> ...

How to override java.util.logging.Logger to my private logger? -

i have code fetched jar uses java.util.logging.logger . jar contains 1000 logger usages , each class start from: private static final logger log = logger.getlogger(someclass.class.getname()); i want handle logs there, means, point them logger usage , not java.util.logging.logger . therefore wrote own logger. so instead: log.log(level.severe, "error sleeping", e); i can write: mylogger.tolog(tloglevel.wfs_error, "monkey", "error sleeping", e ); the problem need run on java files , replace mine. messy way, hmm does know how can easy way convert java.util.logging.logger com.boo.mylogger ? thanks, the slf4j project has a jul-to-slf4j bridge can used redirect java.util.logging.logger calls slf4j. use (by making mylogger implement interface defined slf4j). note that, however, unlike other logging libraries, j.u.l. hard-wired java class libraries , cannot bridged without performance penalty. also, don't know doing ...

java - In RAD 7.5.4 ,code coverage report -

once code coverage enabled in project properties window . once tets case run or package contains of.junit test case result can viewed. generate code coverage report run -> code coverage -> generate report , select test case have executed. can view report either in html view , code coverage report in rad. the applciation of project level , when try code coverage report , whatever package or test case executed packages been covered , packages not no related executed test case. is default, few packages considered coverage ??????? it great if explains in better way....

mysql - Getting MM field extra in my date -

i developing small application,in fetching data date in format yyyy:mm:dd hh:mm:ss.mm in data base date field has stored in format yyyy:mm:dd hh:mm:ss can 1 tell me why getting mm thing mm miscrosecond part of datetime datatype. microsecond introduced in mysql version 5.6.4 . the microsecond part introduced if during table creation datatype specified as datetime(fractional_part) see mysql documentation you should define date field datetime(2) microseconds

Raising obfuscated events with moq throws error -

we have using moq 2 month now. there problem can not solve somehow. in visual studio tests succeeded fine. on build server there several tests failed. have in common is, use "raise" method throw event. our build server tests obfuscated find obfuscation errors. every "normal" expectation "setup(something).returns(something)" works. raise event fails. stacktrace looks following: message: test method ade.graphic.presenter.test.routingenginetest.testrouteoverladderlineswithfbd threw exception: system.argumentexception: not locate event attach or detach method void ᜀ(ᦜ[ᢈ]). +++++++++++++++++++ stack trace: bei moq.extensions.getevent[tmock](action`1 eventexpression, tmock mock) bei moq.mock`1.raise(action`1 eventexpression, eventargs args) bei ade.graphic.presenter.test.routingenginetest.testrouteoverladderlineswithfbd() the code is: documenteventhandler.raise(stub => stub.documentchanged += null, ...

oop - should I use aggregation in this case? -

in case have class called payment superclass of class named card, how can join class verifies if card valid. uml diagram this: payment<---------card i have thought of 2 ways of doing this, know 1 correct one: 1) model association check if credit card valid, not join paymentcard: card_list---1--------------1*---<>card so within class card call like: class paymentcard extends payment { public authorized() ---abstract method { if card.verified(card_number) return true; ---here call card class else return false; } } 2) have read can use aggregation, little dubious how use it: class paymentcard extends payment { card creditcard //aggregation public authorized() { creditcard=new card(numbercard) if creditcard.verified() return true; else return false; } } which 1 of 2 forms better? me, first 1 looks query external ...

insert - Trigger update does not work when creating a new request -

i new db oracle, when create new request in clarity (that project & portfolio management application) or when change status of request, update field status new value of mb_status_idea . the following query works in case of update, if create new request, not update status. (so status not equal status mb). if ( :old.mb_status_idea != :new.mb_status_idea) update inv_investments set a.status = stat a.id=:new.id ; end if; i think problem when creating new request, since insert trigger old contains no value, condition false , doeas not update status. note: field status in table inv_invetments , (stat := :new.mb_status_idea) , database column status mb mb_status_idea i added condition --> or (:old.mb_status_idea null), again when create new request, value of "status" , "status mb" different (status not updated). i appreciate if overcome problem. all ideas highly appreciated, mona with clarity recommended not use triggers couple of...

Set flash mode in android -

i got example set flash mode, cant make work. using in camera swap: final imagebutton button1 = (imagebutton) findviewbyid(r.id.bt_camera); button1.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { camera.release(); idcam.id = idcamera(idcam.id); camera = camera.open(idcam.id); camera.parameters parametro = camera.getparameters(); parametro.setflashmode(parameters.flash_mode_on); camera.setparameters(parametro); camera.startpreview(); try { camera.setpreviewdisplay(camholder.id); } catch (ioexception e) { e.printstacktrace(); } } }); without flash parameters, swap works fine. included in manifest permission: <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> ...

c - How to write 0x00 into file -

i'm writing application communicate (write only) custom usb-serial device. cocoa (os x) application , part related writing coded in posix style. i have solved things have issues null (0x00) character. for example lets says need white 5 characters file. my code follow: char stringaschar[5]; stringaschar[0] = 0x77; stringaschar[1] = 0x44; stringaschar[2] = 0x00; //here problem stringaschar[3] = 0x05; stringaschar[4] = 0xff; ... fputs(stringaschar, file); // write file each character @ specified index represents data registers target device. the problem arise when stream include 0x00 character need have data, writing stopped there (0x00 interpreted stop of stream). how overcome issue? fputs works nul -terminated strings. if want write nul characters file can use fwrite instead: noofbyteswritten = fwrite(stringaschar, 1, noofbytestowrite, file);

ant - Checkup for exact content of folder (no more, no less folders/files) -

i have few directories need verify these directories contain exact list of files , directories , if there files or directories more or less should so. essential thing available task not enough me because need know not if files exists, if there aren't more shouldn't there. i macrodef task define list of files , directories (i have more of them, macrodef seems best solution), have problem checking both types - directories , files @ once. idea how so? i didn't find similar examples of macrodef , appreciate help. thanks you can check if files exist available task, count files on given directory resourcecount task. if equals number of files expected, ok. you'll need set fileset , dirset resource collection .

How to get the element second index in an array in javascript -

i have array follows var arr = [10,12,34,23,12,89,34,12]; in have 12 3 times .i want find second index of 12 in javascript.is possible find.i tried lastindexof() .but did not me.is there way find this. thanks in advance... one more possible solution: array.prototype.nthindexof = function(e, n) { var index = -1; (var = 0, len = this.length; < len; i++) { if (i in && e === this[i] && !--n) { index = i; break; } } return index; }; [10, 12, 34, 23, 12, 89, 34, 12].nthindexof(12, 2); // >> 4

javascript - Google Maps Infobox - Click on android -

i have small app use google maps , infobox set on series of markers. once click on infobox image go link. works on pc , ipad link not "active" when tap image in android (a samsung phone) . here pieces of code: var myoptions = { content: boxtext ,disableautopan: true ,maxwidth: infobox_width ,boxclass:"mybox" ,zindex: null ,closeboxmargin: "-13px 0px 0px 0px" ,closeboxurl: "http://www.google.com/intl/en_us/mapfiles/close.gif" ,infoboxclearance: new google.maps.size(1, 1) ,ishidden: false ,pane: "floatpane" ,enableeventpropagation: true }; infobox = new infobox(myoptions); (var = 0; < locations.length; i++) { var beach = locations[i]; var mylatlng = new google.maps.latlng(beach[1], beach[2])...

c# - Regex: Remove everything except emoticons. how? -

this question has answer here: how match emoticons regular expressions? 3 answers if have string such "i love country :) :d. myself :p -_- .", how remove except emoticons - resulting string should without text ? input string or text can type. i using regex regex.replace(str, "[a-za-z]", ""); but remove "p""d" in ":d :p" smiley. regex then? thanks in advance. there lot of emoticons so wil. end long , on complicated regular expression but. in case think care of 2 'corrupted' emoticons after replace. if case, should work: [abce-oq-za-oq-z]|(?<!:)d|(?<!:)[pp] this regular expresssion match on abc, range e o , ragne of q z lowercase letters matches o , q z. key part in regular expression matches d, p , p if matched char not preceded colon. feature called lookaround (or in exact...

I am unable to use THROW SQL Server 2008 R2 -

sql server 2008 r2 management studio not recognized throw in below example, says incorrect syntax near throw i trying throw error here, can handled in website when insert same value twice. begin try insert businessid (businessid) values (@id) insert businessid (businessid) values (@id) end try begin catch print 'pk exist' throw end catch throw statement introduced in sql server 2012 http://msdn.microsoft.com/en-us/library/ee677615.aspx you can use raiserror instead. http://msdn.microsoft.com/en-us/library/483588bd-021b-4eae-b4ee-216268003e79(v=sql.105) begin catch declare @errormessage nvarchar(4000); declare @errorseverity int; declare @errorstate int; select @errormessage = error_message(), @errorseverity = error_severity(), @errorstate = error_state(); raiserror (@errormessage, -- message text. @errorseverity, -- severity. @errorstate -- state. );...