Posts

Showing posts from September, 2011

Generating unsigned, release apk with Android Studio -

i need generate unsigned, release apk (where else sign , release store- else handling keys , else). problem android studio throws error whenever try build: app-flavorunsigned-release-unsigned.apk not signed. please configure signing information selected flavor using project structure dialog. i've tried several, previous methods: failed @ creating artifact (can't find menus "artifacts" anywhere, although editing configurations found option choose custom artifact) [ probably best bet ] creating empty signing config creating custom flavor using terminal run gradle assemble or gradle assemblerelease (which fail due 1 of important module libraries trying built) here current [app's] build.gradle: apply plugin: 'com.android.application' android { signingconfigs { unsigned { storepassword = "" keyalias = "" keypassword = "" } } compilesdkversion 19

angularjs - Leaflet Draw + Angular + GeoJSON: How to achieve two way binding between Map and GeoJSON object -

i can add geojson layer leaflet map using angular leaflet directive. i can add leaflet draw control , create new layers (polygons, polylines etc.) however, there appears no straight forward way enable editing of geojson layer loaded directive. the code looks this: angular.extend($scope, { controls: { draw: {} }, geojson: { ........... ........... } }); ..... ..... <leaflet center="london" controls="controls" geojson="geojson"></leaflet> however when try edit layer or create new layers, changes happen in different layer group. example, after geojson loaded, if click on edit button, none of items loaded via geojson become editable. i want draw control bound geojson object specified in directive. objective have modification via ui reflect in geojson object , vice versa. in other words want

php - How does the Mandrill API handle the send_at parameter for free accounts? -

here’s setup: we’re @ free level of mandrill, using api via php. using example scripts on mandrill site (link below) , changing few essentials (key, recipient, etc.)... https://mandrillapp.com/api/docs/messages.php.html ...we’re finding “send_at” parameter hanging up. here’s response script if “send_at” set null or “”: array ( [0] => array ( [email] => someone@somewhere.com [status] => queued [_id] => 0c16bc002c874911ae36558881e5da77 ) ) if assign date/time “send_at” parameter (a date in past per mandrill api instructions ), following response script: a mandrill error occurred: mandrill_paymentrequired - email scheduling available accounts positive balance. what have “send_at” parameter use mandrill api free account? you can omit parameter altogether. it's optional , since you're not scheduling, don't need provide it. we'd recommend removing of optional parameters you're not setting testing purposes, , add ones need or sp

COM servers in Delphi service applications -

this general question i'm hoping have specific info or recommendations. i have application suite includes service application acts communications interface , data historian industrial pollution-control hardware. service contains singleton com server allow rest of suite have access hardware , data via service. i've read stuff how svcom required make com servers work in delphi service apps. have , use svcom - claims. i'm not comfortable it, product , coding styles , expectations don't match, , makes debugging more of headache. but real problem idea lengths svcom goes to make com server work in service app absolutely required. documentation, , of stuff comes in searches on subject, makes sound toolbox absolutely required com-server-in-service scenario. have couple of different 3rd-party libraries implementing opc servers, prosys sentrol , older production robots library (if you're not familiar opc, it's pretty-much ubiquitous data-interchange standa

In Livecode, how do you upload images that are on the device the app is running on? -

if app on ipad, how retrieve images on ipad? the following project of mine. should work that. function rescale theimgwidth,theimgheight,thecdwidth,thecdheight if thecdwidth/theimgwidth < thecdheight/theimgheight put thecdwidth / theimgwidth myratio else put thecdheight / theimgheight myratio end if put theimgwidth * myratio mynewwidth put theimgheight * myratio mynewheight return mynewwidth,mynewheight end rescale on pickphoto set visible of templateimage false if environment "mobile" mobilepickphoto "library" put result rslt if rslt "cancel" exit pickphoto else if there image "photo" delete image "photo" end if put long id of last img myimage set name of myimage "photo" end if else answer file "choose picture...&qu

ios - Is it possible to change the company identifier of an existing Xcode project? -

i have existing xcode project in i've mistakenly set company identifier companyname rather com.companyname . bundle identifier renders companyname.productname (which expected), i'm hoping able change more correct com.companyname.productname . i change bundle identifier in plist, possible change company identifier , have change reflected in bundle identifier , anywhere else needs show up? or changing bundle identifier best bet? , there out if do? (the app has not yet been submitted, i'm in process of getting ready that.) thanks in advance.

linux - how to get the text in shell between two specific character ( [ ] bracket ) with sed? -

i try text in shell between 2 specific character sed, in shell, doesnt seem work. i try text "[" , "]" [561:0:43:0] -> 561:0:43:0 so tried follow sed -e '/[/,/]/p' test > test2 test content example: [561:0:42:0] [561:0:43:0] [561:0:478:0] [561:0:48:0] [562:0:9:0] after command when read test2 still contains brackets i tried search alternatives here, cant find aníthing work. any suggestion ? thanks you didnt expected output becuase p command prints entire pattern space,( or in sed command current line read) you can use like $ sed -r 's/\[(.*)\]/\1/g' test 561:0:42:0 561:0:43:0 561:0:478:0 561:0:48:0 562:0:9:0 s commands substitutes within [] contents of \1 capture group 1, caputured (.*)

spring map optional query parameters to sql prepared statement -

i'm creating rest api in spring project. the problem i'm facing how elegantly create preparedstatement variable number of parameters. for eg. have product collection , i'd have lots of query parameters /accounts?categoryid=smth&order=asc&price=<1000&limit=10&offset=300 problem these parameters may or may not set. currently have looks this, haven't started sanitizing user input controller @requestmapping(method = requestmethod.get) public list<address> getall(@requestparam map<string, string> parameters) { return addressrepository.getall(parameters); } repository @override public list<address> getall(map<string, string> parameters) { stringbuilder conditions = new stringbuilder(); list<object> parametervalues = new arraylist<object>(); for(string key : parameters.keyset()) { if(allowedparameters.containskey(key) && !key.equals("limit") && !ke

javascript - Using _.matches() and to filter Backbone models -

i want filter backbone models have multiple key/value paris equal. example, want match all/first model has id of 123 , name 'john'. i realize there other ways this, leverage matches() method. is possible use underscore's matches() method create function pass filter or find find backbone model? var search_fn = _.matches({id: 123, type: 'john'}); var should_be_active = _.find(master_model_array, search_fn); yes, should work, similar have done using "filter". to reiterate: // sample data var x = {name:"j", id: 1}, y = {name: "j", id: 2}, z = {name: "j", id: 1, more: "data"}, match = _.matches({name: "j", id: 1}); var list = [x,y,z]; var result = _.filter(list, match); this results in x , z matches criteria. jsfiddle hope helps.

java - Libgdx actor following a Parabolic movement -

i want move actor position x1, y1 position x2, y2 parabolic movement . should use bezier curve ? is there example take at? in tests project saw linear movement (in pathtest example). thanks in advance! bezier curve cubic, not parabolic. you use following action in stead. protected void update (float percent) { actor.setposition(startx + (endx - startx) * percent, starty + (endy - starty) * percent * percent, alignment); } hope helps. luck.

java - Algorithm to find neighboring subimages -

i have image , extracting subimage feed neural network. attempting calculate average output of subimages in same neighborhood. so if have original image (m x n pixels) , found subimage @ (sub_x, sub_y) size (sub_width , sub_height), need extract subimages same size (sub_width , sub_height) @ (sub_x + m, sub_y + n) m , n go 1 - 3. i have working solution: for (int subx = (x-3); subx < (x+4); subx++) (int suby = (y-3); suby < (y+4); suby++) if ( (subx > 0) && (suby > 0) ) if ( ((subx + width) < img.getwidth()) && ((suby + height) < img.getheight()) ){ counter++; testingimage = img.getsubimage(subx, suby, width, height); } x,y, width, , height integers of original subimage found. img original full sized bufferedimage. i'm not happy performance though. there faster/smarter way this? here's 1 simple thing can do: rid of conditions inside loops. calculate ranges first, o

Call javascript function encoded in a string -

if put function string this: var functionstring = function (message) { console.log(message); }.tostring(); is there way convert string function , call it? tried eval(functionstring) which returns "uncaught syntaxerror: unexpected token", , functionstring.call(this, "hi!"); which returns 'undefined not function'. is possible in javascript? thanks in advance reply! edit: point of question function has been converted string using tostring(). console.log(functionstring); returns string: "function (message) {console.log(message);}" can transform string function , call it? that's problem trying solve. thanks! your functionstring contains string "function (message) { console.log(message); }" evaluating as-is present javascript engine incorrect syntax (there no name function). javascript expects construct function <name>(<params>) { } . alternatively, can use anonymous function (i.e. n

c - Getting character attributes -

using winapi attribute of character located in y line , x column of screen console. trying after call getconsolescreenbufferinfo(getstdhandle(std_output_handle), &nativedata); console cursor set specified location. won't work. return last used attribute change instead. how obtain attributes used on characters on locations? edit: code used test readconsoleoutput() : http://hastebin.com/atohetisin.pl throws garbage values. i see several problems off top of head: no error checking. must check return value readconsoleoutput , other functions, documented. if function fails, must call getlasterror() error code. if don't check errors, you're flying blind. you don't allocate buffer receive data in. (granted, documentation confusingly implies allocates buffer you, that's wrong since there's no way return pointer it. also, sample code shows have allocate buffer yourself. i've added note.) it looks if had intended read characters

android - dalvik.system.PathClassLoader can't find jni on Intel devices -

i'm having issue dalvik.system.pathclassloader can't find jni file on intel devices. think has structure of aar dependency have because once removed dependency, jni file found without issue. aar dependency has x86 , arm libraries , project has arm libraries. the folder structure is: my project src jnilibs armeabi liblibrarya.so my aar dependency project has: src jnilibs armeabi liblibraryb.so x86 liblibraryb.so with structure, liblibrarya.so not found on x86 devices. i'm not sure if gradle packaging issue or if dalvik/runtime issue. i'm @ loss of go next. error is: fatal exception: main process: com.project, pid: 10850 java.lang.unsatisfiedlinkerror: dalvik.system.pathclassloader[dexpathlist[[zip file "/base.apk"],nativelibrarydirectories=[/lib/x86, /vendor/lib, /system/lib]]] couldn't find "liblibrarya.so" @ java.

java - Trouble with sorting in a Binary Search tree -

i've been having trouble making binary search tree work. idea person put in , sorted based on name. the class using person is: package tree; public class person { private int age; private string name; private string gender; public person( string name, string gender,int age) { this.age = age; this.name = name; this.gender = gender; } public int getage() { return age; } public void setage(int age) { this.age = age; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getgender() { return gender; } public void setgender(string gender) { this.gender = gender; } @override public string tostring() { return "person [age=" + age + ", name=" + name + ", gender=" + gender + "]"; } } and search tree is:

javascript - RegEx to match words in comma delimited list -

how can match text appears between delimiters, not match delimiters themselves? text donotfindme('donotfindme') donotfindme(findme) donotfindme(findme,findme) donotfindme(findme,findme,findme) script text = text.replace(/[\(,]([a-za-z]*)[,\)]/g, function(item) { return "'" + item + "'"; }); expected result donotfindme('donotfindme') donotfindme('findme') donotfindme('findme','findme') donotfindme('findme','findme','findme') https://regex101.com/r/tb1ne2/1 here's pretty simple way it: ([a-za-z]+)(?=,|\)) this looks word succeeded either comma or close-parenthesis. var s = "donotfindme('donotfindme')\ndonotfindme(findme)\ndonotfindme(findme,findme)\ndonotfindme(findme,findme,findme)"; var r = s.replace(/([a-za-z]+)(?=,|\))/g, "'$1'" ); alert(r); used same test code other 2 answers; thanks!

mysql - query with LEFT JOIN and ORDER BY...LIMIT slow, uses Filesort -

Image
i have following query: select fruit.date, fruit.name, fruit.reason, fruit.id, fruit.notes, food.name fruit left join food_fruits ff on fruit.fruit_id = ff.fruit_id , ff.type='fruit' left join food using (food_id) left join fruits_sour fs on fruits.id = fs.fruit_id (fruit.date < date_sub(now(), interval 180 day)) , (fruit.`status` = 'rotten') , (fruit.location = 'usa') , (fruit.size = 'medium') , (fs.fruit_id null) order `food.name` asc limit 15 offset 0 and indexes ever want, including following being used: fruit - fruit_filter (size, status, location, date) food_fruits - food_type (type) food - food (id) fruits_sour - fruit_id (fruit_id) i have indexes thought work better not being used: food_fruits - fruit_key (fruit_id, type) food - id_name (food_id, name) the order by clause causing temporary table , filesort used, unfortun

matplotlib - 3-D Quiver Plot in Python -

i trying make 3-d quiver plot in python 2.7. when run quiver3d_demo.py matplotlib site, value error looks like: -------------------------------------------------------------------------- valueerror traceback (most recent call last) /library/python/2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/ipython/utils/py3compat.pyc in execfile(fname, *where) 202 else: 203 filename = fname --> 204 __builtin__.execfile(filename, *where) /users/loisks/desktop/quiver3d_demo.py in <module>() 15 np.sin(np.pi * z)) 16 ---> 17 ax.quiver(x, y, z, u, v, w, length=0.1) 18 19 plt.show() /library/python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/axes/_axes.pyc in quiver(self, *args, **kw) 3802 if not self._hold: 3803 self.cla() -> 3804 q = mquiver.quiver(self, *args, **kw) 3805 self.add_collection(q, false) 3806 self.updat

progress bar - Android - Round ProgressBar starts at wrong place -

Image
i'm trying add round progress bar app want start @ top of circle , end @ top. however, try angles etc doesn't change appearance. i'm new android go easy on me. here code: <progressbar android:id="@+id/progressbar" android:layout_width="300dp" android:layout_height="300dp" android:indeterminate="false" android:layout_centerinparent="true" android:progressdrawable="@drawable/circular_progress_bar" android:background="@drawable/circle_shape" style="?android:attr/progressbarstylehorizontal" android:max="100" android:progress="30" /> circle_shape.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerradiusratio="2.5" android:thickness="6dp" android:uselevel="false&q

c# - Changing BizForm properties Kentico -

i trying have bizform part of transformation as: <cms:bizform runat="server" id="bizform" formname="yourbizformcodename" enableviewstate="false" formdisplaytext="form submitted"/> in documenttype/pagetype have field allows user enter whatever want display once form has been submitted, in theory need go , change formdisplaytext has been provided. i have tried using eval("submittext") inside formdisplaytext, doesn't work. does have solution this? thank you following code works fine me (kentico v8.1): <cms:bizform runat="server" id="bizform" formname="test" enableviewstate="false" formdisplaytext='<%# cms.macroengine.macrocontext.currentresolver.resolvemacros("{%currentdocument.submittext#%}") %>' />

javascript - jQuery .height() not working with box-sizing: border-border -

i have nav bar have positioned 'fixed' @ top of page. problem have want displace entire page down (dynamic) size of nav depending on size of screen used. basically, want move whole page down height of nav. this, i'm going using padding nav affect it's height. using box-sizing:border-box attribute on nav whenever try , load page, doesn't account height added padding when use jquery's .height() function. the div 'displacement' class not have except 100% width initially. ugly result along of current code http://jsbin.com/qomepe/2 can tell me why happening or if i've overlooked something? try using .outerheight() height of navbar. from jquery api docs: "the top , bottom padding , border included in .outerheight() calculation; if includemargin argument set true, margin (top , bottom) included." http://api.jquery.com/outerheight/

python - How do you represent na in a Pandas DataFrame? -

does pandas have equivalent of r's na (meaning not available)? if not, convention representing missing value, opposed nan represents mathematically impossible value such divide zero? currently there no na value available in pandas or numpy. section "working missing data" in pandas manual ( http://pandas.pydata.org/pandas-docs/stable/missing_data.html ): the choice of using nan internally denote missing data largely simplicity , performance reasons. differs maskedarray approach of, example, scikits.timeseries . hopeful numpy able provide native na type solution (similar r) performant enough used in pandas. also, part of documentation ( http://pandas.pydata.org/pandas-docs/stable/gotchas.html#nan-integer-na-values-and-na-type-promotions ) provides more details on trade-offs in choice of na representation.

homebrew - brew install fontforge error yosemite -

i'm on os x yosemite , trying install fontforge via brew. when try install following error. i'd use fontforge try fontcustom , grunt-webfont. error mean? need install else first? $ brew install fontforge --with-python ==> downloading https://github.com/fontforge/fontforge/archive/2.0.20140101.tar.gz downloaded: /library/caches/homebrew/fontforge-2.0.20140101.tar.gz ==> ./autogen.sh ==> ./configure --prefix=/usr/local/cellar/fontforge/2.0.20140101 --without-cairo ==> make 1 error generated. make[2]: *** [libgdraw_la-gmatrixedit.lo] error 1 make[2]: *** waiting unfinished jobs.... make[1]: *** [all-recursive] error 1 make: *** [all] error 2 i had same problem , reinstalling 10.10 xcode command line tools solved it! :-) good luck -

How to detect canny edge and integral projection on a real time webcam using c# aforge? -

"i have been trying detect canny edge on image , has been successful, don't know how detect edge if want real time, here code, has no error canny window can't processed using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; //using komcit; using system.drawing.imaging; using system.io; using system.timers; using aforge; using aforge.imaging.filters; using aforge.video.directshow; using system.threading; namespace canny_video { public partial class form1 : form { public form1() { initializecomponent(); } private filterinfocollection capturedevice; private videocapturedevice finalframe; void finalframe_newframe(object sender, aforge.video.newframeeventargs eventargs) { camerabox.image = (bitmap)eventargs.frame.clone();

css - HTML Table with images -

so re making site university's drama department , want add 3 images side side (with spacing between them). need have captions. caption needs have header (that styled differently caption itself) followed caption itself. having looked around here , other places figured able using table since formatting size easiest way. have been @ portion of site 1 month , have tried numerous other methods (divs, tables, etc.) wondering if else has done , able impart advice. site located here: drama site . appreciated (i hope follows guidelines, first time asker) edit: following portion of code need with: function windowsize() { var w = var w = document.getelementbyid('body').clientwidth; document.getelementbyid('newstable').style.width = w + 'px'; document.getelementbyid('newsitems').style.height = document.getelementbyid('newsitems').clientwidth + 'px'; } <body id="body" onload="windowsize();getcurrentpage();

vb.net - Making a button.click event do two different things -

i'm working on simple vb.net program (just using winforms) , terrible @ ui management. i'd have single button starts process, , have same button stop process. i'm thinking having main form initiate counter, , click event iterate counter. simple check, , if counter thing , odd thing b. is there better way, aside using 2 buttons or stop/start radio buttons? i've done exact thing 1 of 2 ways. can use static variable or toggle text of button. since button has 2 functions, design requires indicate user. following code assumes button's text set in design mode "start", , code start , stop process in subs startprocess , endprocess. public sub button1_click(byval sender object, byval e system.eventargs) if button1.text ="start" startprocess() button1.text="end" else endprocess() button1.text="start" end if end sub edit the above solution fine sin

XBee Wi-Fi - decoding UDP packets of sampled data -

i bought xbee wi-fi s6b. (i expecting similar wifly can post sampled i/o data webpage.) going hook 2 temperature sensors analog inputs. note - there no arduinos in project. i have configured xbee send udp packets computer on port 3054 (0xbee) - can see them using netcat . my question : there existing software out there linux or raspberry pi can receive these packets , decode them? i'd rather not have re-invent wheel. i've searched extensively, found api mode arduino attached. i'm interested in running xbee 2 temperature sensors. many of search results i've seen talking another xbee connected computer via serial port. i'd rather not buy xbee, because computer on same network. here's small program created listen xbee udp packets. listens 1 temperature sensor, configurable add on other sensors. https://github.com/bseeger/xbee_listener

ruby on rails - Devise telling me "Email already taken" when I try to register my name and email. -

i'm new programming, , have been learning ruby on rails 12 weeks. i have devise users/sign_up page on app now, , after entering name , password, tells me check email account confirmation message. message never came, did research , debugging, , think problem may solved. however, can't use same email try out fix, because when register again, "1 error prohibited user being saved: email taken." (i did research on here on stackoverflow, think answers may old - can't see talking in of devise files.) there way can clear out email can enter register again? you can delete user in database. first, connect database running rails console in terminal. then, can find , delete user running query user.find_by(email: 'foo@bar.com').destroy this article worth read on rails finder methods. http://api.rubyonrails.org/classes/activerecord/findermethods.html

mysql - sum of value of each month of year -

i want query in mysql sum of value every month on year. currently have this: select e.rfc rfc, sum(f.total) total, month(f.fecha) mes foo f inner join bar e on f.bar_id = e.id inner join baz u on e.baz_id = u.id u.id = 3 , date(f.fecha) between '2014-01-01' , '2014-12-31' group month(f.fecha) but in months doesn't exist foo values not showing. my result atm it's like: rfc total mes aaa010101aaa 10556.000000 12 aaa010101bbb 1856.000000 11 aaa010101bbb 66262.896800 10 aaa010101bbb 990.090000 9 aaa010101bbb 73.000000 8 aaa010101bbb 1304761.620000 7 my desired result are: rfc total mes aaa010101aaa 10556.000000 12 aaa010101aaa 0.0 11 ... (when no data it's available return 0.0 month) aaa010101aaa 0.0 1 aaa010101bbb 0.0 12 aaa010101bbb 1856.000000

ajax - JAX-RS | Download PDF from Base64 encoded data -

folks, i have rest controller calls service base 64 encoded string represents pdf. i'm calling rest endpoint through ajax call. want user download pdf file when click on link. here rest controller: @get @path("/getinvoice/{invoiceid}.pdf") @produces("application/pdf") @consumes(mediatype.text_html) public response invoice(@pathparam("invoiceid") final string invoiceid) throws shoppingcartexception, unexpectederrorfault_exception, malformedqueryfault_exception, invalidquerylocatorfault_exception, loginfault_exception, ioexception { base64decoder decoder = new base64decoder(); byte[] decodedbytes = decoder.decodebuffer(aservice.getinvoicebody(invoiceid)); responsebuilder response = response.ok(new bytearrayinputstream(decodedbytes)); response.header("content-disposition", "attachment; filename=test.pdf"); return response.build(); } the service returns ba

ios - How to increase the height of UINavigationBar? -

Image
simple question: how can increase height of navigation bar additional widgets fit in there while keeping blur? examples calendar app weekday abbreviations added bottom of navigation bar... ...and in mail when move mail different folder: as ianurag post ans correct still have ui problem (width not proper) can change size adding category below sample project download code #import "viewcontroller.h" @implementation uinavigationbar (customnav) - (cgsize)sizethatfits:(cgsize)size { cgrect rec = self.frame; cgrect screenrect = [[uiscreen mainscreen] bounds]; rec.size.width = screenrect.size.width; rec.size.height = 70; return rec.size; } @end output when press on "button" problem in ianurag code

android - Is this below code is correct for saving logcat details to a file in eclipse? -

public static void savelogcattofile(context context) { string filename = "logcat_"+system.currenttimemillis()+".txt"; file outputfile = new file(context.getexternalcachedir(),filename); @suppresswarnings("unused") process process = runtime.getruntime().exec("logcat -f "+outputfile.getabsolutepath()); } please check above code , me to save logcat details file (permanently), should append after everytime debugging in eclpise . try public static void savelogcattofile(context context) { try { process process = runtime.getruntime().exec("logcat -d"); bufferedreader bufferedreader = new bufferedreader(new inputstreamreader(process.getinputstream())); stringbuilder log = new stringbuilder(); string line; while ((line = bufferedreader.readline()) != null) { log.append(line); }

algorithm - merging two SKShapeNode polygons into one -

Image
i have multiple polygons (skshapenodes) on sprite kit layer. of them non-selfintersecting polygons. know: 1) if introduce new one, intersect of previous ones: does sknode's: "func intersectsnode(_ node: sknode) -> bool" provide means this? how can iterate on node tree check against existing skshapenodes? 2) area of intersection: if new polygon intersects , existing one, need calculate area of intersection (e.g. area in red in picture below). propose simple algirithm this? 3) merge both of polygons new skshapenode polygon , remove 2 prior polygons sknode tree. so after introducing new polygon intersects existing polygon b, remove both of existing polygons , b sprite kit's node tree , introduce new polygon c path merge paths of polygon , b (in orange in picture below) i'm relatively new sprite kit , graphics programming , not comfertable euclidean geometrics either. suggestions on approaches how proceed in these tasks appreciated!!!

Over ride magento template file -

i want on ride checkout/cart/item/default.phtml file in extension in order add details on cart page below product name i hope work in case <checkout_cart_index translate="label"> <reference name="checkout.cart"> <action method="additemrender"><type>simple</type><block>checkout/cart_item_renderer</block><template>ext_name/checkout/cart/item/default.phtml</template></action> <action method="additemrender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>ext_name/checkout/cart/item/default.phtml</template></action> <action method="additemrender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>ext_name/checkout/cart/item/default.phtml</template></action> </reference>

javascript - Using this with pseudo selectors jquery -

i'd know if there way use this css pseudo selectors - (aka nested elements) in jquery. here's might like. $('#element').click(function(){ $(this' .nested').css('height','100px'); }); but isn't how syntax works. i'd know how work. use find() instead. example: $('#element').click(function(){ $(this).find('.nested').css('height','100px'); });

java - GUI Using JFrame, & JPanel drawing custom shapes -

pretty create shape class, rectangle , circle , triangle extending shape , , square class extending circle . have code working main class, i'm having tough time converting gui because i'm not sure how number 3 make come , how make g.drawoval(with given x,y & radius) , draw triangle(given x,y, base , height) . project6 class have extend jframe class project6 constructor have set gui window. a new abstract method: public void display(graphics g); should added base , derived classes. a custom jpanel must set paintcomponent method the new display(graphics g) method have draw shapes on gui window , called loop in paintcomponent method. import javax.swing.*; import java.awt.*; import javax.swing.jframe; import javax.swing.jpanel; public class project6 extends jframe { private shape [] thearray = new shape[100]; public static void main (string [] args) { project6 tpo = new project6(); tpo.run(); } public void run () { int count = 0; thearray[c

mysql - sql query for a certain condition -

i have table like: empid empsalary empdept 1 45000 2 40000 3 50000 sales 4 60000 sales 5 75000 6 80000 7 25000 ops 8 30000 ops 9 55000 marketing 10 60000 marketing i have write query as: select empid empsalary > avg(empsalary) each empdept kindly help. try this: select e.empid, e.empsalary, e.empdept employee e inner join (select e1.empdept, avg(e1.empsalary) empsalary employee e1 group e1.empdept ) on e.empdept = a.empdept , e.empsalary > a.empsalary; edit select e.empdept, count(distinct e.empid) noofemployees employee e inner join (select avg(e1.empsalary) empsalary employee e1) on e.empsalary > a.empsalary group e.empdept;

Using query but it returns a null row? (MySQL) -

i have table number of values. however, when use command: select id table id <= 2 , id not null i following output: # id 1 1 2 2 * null however, having null row messes things, use in statement on subquery, evaluates false there comparison null value. could explain why null value exists, , how rid of it? thanks!

c++ - How to get the extension of a file in windows -

is there way can extension of given file. if suppose there file "abc.txt" after renaming file name "abc.exe" extension .exe there way can original extension of file in created. i looked getfileinformationbyhandle not of help is there way can original extension of file in created no, not without operating system add-ons or simple backup of file .

Selenium code to input values to text boxes from excel by opening browser single time -

i wrote selenium code read values excel sheet contains 2 columns.i need input these 2 text boxes in webpage .i not want use testng @ point .my issue every time browser opens webpage each entry ie each row . have 10 rows in excel sheet 10 web pages opened , each input text boxes .how can rewrite code open single browser , input values 1 one . public class insert { public static void main(string[] args) { try { fileinputstream fis = new fileinputstream("f:\\book4.xlsx"); xssfworkbook wb = new xssfworkbook(fis); xssfsheet sheet = wb.getsheet("testdata"); for(int count = 1;count<=sheet.getlastrownum();count++) { xssfrow row = sheet.getrow(count); system.out.println("running test case " + row.getcell(0).tostring()); runtest(row.getcell(1).tostring(),row.getcell(2).tostring()); } fis.close(); } catch (ioexception e) { system.out.printl

Pythagorean triple calculation in java -

i found way calculate pythagorean triple until number,but program duplicates , in different order . how can avoid this? try organize pythagorean triple c value (a a+b b=c*c) code import java.util.scanner; public class ex4 { public static void main(string[] args) { scanner s = new scanner(system.in); int number; number = s.nextint(); for(int c=1;c<number;c++){ for(int b=1;b<number;b++){ for(int a=1;a<number-2;a++){ if(a*a + b*b == c*c) system.out.println("("+a+","+b+","+c+") : "+a+"*"+a+" + "+b+"*"+b+" = "+c+"*"+c); } } } } } make change: for(int c=1;c<number;c++){ for(int b=1;b<c;b++){ for(int a=1;a<b;a++){ if(a*a + b*b == c*c ) but aware more efficient methods such euclid

c++ - Wrong number of template arguments error -

i'm new templates , trying use functions out of class adapt generic programming. wenn this: template<int c, int d> class a{ ... } float function(number<int c, int d> value); it leads following error: error: wrong number of template arguments (1, should 2) float function(number<int c, int d> value); ^ am missing here? you need define template arguments on function , forward them type: template<int c, int d> float function(number<c, d> value);

java ee - Glassfish and javax.naming.NameNotFoundException after app Reload -

environment: glassfish server open source edition 4.1 disable-nonportable-jndi-names: true the problem: when deploy or redeploy application - works ok. after reload or disable/enable following exception arises during connection standalone client: exception in thread "main" javax.naming.namingexception: lookup failed 'java:global/synisbackendear/synisbackend/unitronicsdriver'... ... caused by: javax.naming.namenotfoundexception: unitronicsdriver not found... ... caused by: java.lang.illegalstateexception: exception attempting inject local ejb-ref name=com.protechnologia.synis.drivers.unitronics.unitronicsdriver/configurationprovider,local 3.x interface =com.protechnologia.synis.settings.configurationprovider,ejb-link=null,lookup=java:app/synisbackend/configurationproviderxml,mappedname=,jndi-name=,reftype=session class com.protechnologia.synis.drivers.unitronics.unitronicsdriver: object not instance of declaring class ...

jpa - Incompatible types; found: interface java.util.List<java.lang.Object>, required: interface java.util.List<test.entity.Emp> -

i have following class structure public class emp implements java.io.serializable { .... } public interface employeedao { public list<emp> findallemployees(); } public class employeedaoimpl implements employeedao { public list<emp> findallemployees() { criteriaquery cq = getentitymanager().getcriteriabuilder().createquery(); cq.select(cq.from(emp.class)); return getentitymanager().createquery(cq).getresultlist(); } ... } issue having is return getentitymanager().createquery(cq).getresultlist(); the above line gives me following error, reason this? incompatible types; found: interface java.util.list<java.lang.object>, required: interface java.util.list<test.entity.emp> the same code works in other higher version of java. current jdk 1.6 you didn't tell criteraquery type return. public list<emp> findallemployees() { criteriaquery<emp> cq = getentitymanager().getcriteriabu

java - switching to time edit mode of digital watch in statechart diagram in eclipse -

i have question: i'm dealing digitalwatch.sct state chart model right now. when bottom right pressed @ least 1.5 seconds, digital watch should switch time editing mode. how can manage it, kind of strategy or triggered event should do? the event bottom right pressing "buttons.bottomrightpressed". thank help. even though don't know details of statechart model 'blindly' suggest following steps: add state 'waitforeditmode' add transition state e.g. 'clockmode' waitforeditmode buttons.bottomrightpressed trigger add new event bottomrightreleased buttons interface add transition trigger buttons.bottomrightreleased waitforeditmode clockmode. add transition trigger 'after 1500ms' waitforeditmode 'editmode' of course there alternatives... one more hint: if post questions regarding yakindu statechart tools it's user forum should answers without 4 month delay ;) ...

scikit learn - Python ROC curve from 2 discrete histogram distributions -

i'm using python (numpy) , want plot roc curve given 1d noise histogram , 1d histogram signal+noise distribution. aware various libraries scikit-learn can generate roc curves, use supervised machine learning approach based on predicted vs. actual labels. instead have 2 numpy arrays: 1 discrete probability density function (histogram) of background noise distribution, , histogram signal+noise distribution. i'm not doing machine learning, instead want make roc curve 2 histograms. can scikit-learn or python library this? thanks

javascript - Display list of data - one by one -

i want display list of data: <li ng-repeat="d in list_of_data"> <div class="line"> {{ d }} </div> </li> but want have pause between appearance each line of data, use such code: function myctrl($scope) { $scope.list_of_data = []; $scope.start = function() { var = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']; var addelement = function(i) { alert(i); $scope.list_of_data.push(a[i]); if (i < a.length - 1) settimeout(function() { addelement(i+1); }, 1000); } addelement(0); }; } but when launch code numbers (0..9) in alert window, 1 div ('one') in page. why ? here jsfidlle the issue function passed first argument of settimeout executed out of digest cycle , view no

python - How to create LinkExtractor rule which based on href in Scrapy -

i trying create simple crawler scrapy (scrapy.org). per example item.php allowed. how can write rule allow url start http://example.com/category/ in get parameter page should there number of digit other parameter. order of these parameter random. please how can write such rule? few valid values are: http://example.com/category/?page=1&sort=a-z&cache=1 http://example.com/category/?page=1&sort=a-z# http://example.com/category/?sort=a-z&page=1 following code: import scrapy scrapy.contrib.spiders import crawlspider, rule scrapy.contrib.linkextractors import linkextractor class myspider(crawlspider): name = 'example.com' allowed_domains = ['example.com'] start_urls = ['http://www.example.com/category/'] rules = ( rule(linkextractor(allow=('item\.php', )), callback='parse_item'), ) def parse_item(self, response): item = scrapy.item() item['id'] = response.xpath('//td[@id="item_id&qu

winapi - EnumProcessModulesEx and CreateToolhelp32Snapshot fails - whatever 32bit or 64bit -

edit: the answer of question here: https://stackoverflow.com/a/27317947/996540 when create project in msvc, option /dynamicbase default enabled now. because of aslr(address space layout randomization, since windows vista), everytime run exe, it's load address random. i doing dll injection job recently, did research on google, , have read projects. load address (base address) of exe important. it seems there're 2 simple apis this: enumprocessmodulesex , createtoolhelp32snapshot. never succeeded. so code sample: void testenumprocessmodulesex(const char* app) { std::cout << "begin testenumprocessmodulesex(" << mybit() << ")" << std::endl; startupinfoa startupinfo = {0}; startupinfo.cb = sizeof(startupinfo); process_information processinformation = {0}; if (createprocessa(app, null, null, null, false, create_suspended, null, null, &startupinfo, &processinformation)) { std::vector

Java: BitSet comparison -

suppose have 2 bitset objects in java values as //<msb....lsb> b1:<11000101> b2:<10111101> how can compare b1 , b2 know value represented b1 greater b2 . are logical operators (>,<,==) overloaded bitset? or have write own implementation? update: found "the operator > undefined argument type(s) java.util.bitset, java.util.bitset" . there built-in way so? you can xor -ing 2 sets together, , comparing length of result lengths of bit sets: if xor empty, bit sets equal. can bypass operation calling equals() otherwise, length of xor result equal position of significant bit different between 2 values. whichever of 2 operands has bit set greater 1 of two. here sample implementation: int compare(bitset lhs, bitset rhs) { if (lhs.equals(rhs)) return 0; bitset xor = (bitset)lhs.clone(); xor.xor(rhs); int firstdifferent = xor.length()-1; if(firstdifferent==-1) return 0; return rhs.get(first

objective c - Set Different UINavigatiobar color for different UIViewController in iOS? -

i have sample project 3 uiviewcontroller want change uinavigationbar color each viewcontroller. i tried use code in viewdidappear method , not changing. [self.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed: @"bg.png"] forbarmetrics:uibarmetricsdefault]; in fact code setting background navigationbar, , true. if want set color each viewcontroller navigation bar, in viewcontroller1 (say first view controller) viewdidappear method add [self.navigationcontroller.navigationbar setbartintcolor:[uicolor greencolor]]; in viewcontroller2 (say second view controller) viewdidappear method add [self.navigationcontroller.navigationbar setbartintcolor:[uicolor bluecolor]]; then navigate through these controllers, see background color of navigation bar changed . but problem may not setting viewcontroller custom class, can set identity inspector.

serialization - Saving Arrays in Swift -

i have question saving arrays in apple's new programming language swift. in objective-c saved data nsfilemanager ... doesn't work anymore in swift. wanted ask how should save array without using nsuserdefaults isn't suited storing big amount of data. appreciate :] first (if array not of string type) change string: var notstringarray = [1, 2, 3, 4] var array: [string] = [] value in notstringarray{ array.append(string(value)) } then reduce array 1 string: var array = ["1", "2", "3", "4", "5"] //ignore line if array wasn't of type string , did step above var stringfromarray = reduce(array, "") { $0.isempty ? $1 : "\($0)\n\($1)" } this create string looks this: "1 2 3 4 5" and write , read file add class @ top of file: class file { class func open (path: string, utf8: nsstringencoding = nsutf8stringencoding) -> string? { var error: nserror? //

html - How do I layer CSS opacity? -

i'm attempting create particular hover effect in html list purely css. when hovering, "background" nav element should half opacity "foreground" li should full opacity. nav { font-size:2.0em; } nav:hover { background-color: #0000ff; opacity: 0.5; } nav li:hover { background-color: #ff0000; opacity: 1.0; } <nav> <ul> <li>first</li> <li>second</li> </ul> </nav> unfortunately li hover appears have picked half opacity, though opacity:1.0 has been specified. why happening , missing? is want? nav { font-size:2.0em; } nav:hover { background-color: rgba(0,0,255,0.5); } nav:hover li { opacity:0.5; } nav li:hover { background-color: #ff0000; opacity: 1.0; } <nav> <ul> <li>first</li> <li>second</li> </ul> </nav> edit about "why" part: acco