Posts

Showing posts from July, 2011

python - struct.error: unpack requires a string argument of length 2 -

i have following code works 64bit computer not work mine , gives fallowing error.i use python 3.3 , requiered libraries. not solve problem please help. import matplotlib.pyplot plt import binascii import numpy import struct array = [] out = open('output.txt','wb') a=int(input("enter first value:")) b=int(input("enter second value:")) open("thefile.bin", "rb") f: i=0 in range(0, a): byte = f.read(1) i=0 in range(a,b): byte = f.read(1) value = struct.unpack('b', byte)[0] array.append(value) plt.plot(array) plt.ylabel('value') plt.show()

sql - PostgreSQL: nonstandard use of escape string -

i have postgresql 8.4 database being queried application outside of control. queries such following throwing warnings working... select "tagname","tagindex","tagtype","tagdatatype" "tagtable" "tagname" = 'lift_stations\07\etms\generator_etm' however, same query stations 08 , 09 failing... select "tagname","tagindex","tagtype","tagdatatype" "tagtable" "tagname" = 'lift_stations\08\etms\generator_etm' warning: nonstandard use of escape in string literal line 2: ...,"tagdatatype" "tagtable" "tagname" = 'lift_stat... ^ hint: use escape string syntax escapes, e.g., e'\r\n'. error: invalid byte sequence encoding "utf8": 0x00 hint: error can happen if byte sequence not match encoding expected server, controlled

windows - Batch Echoing from Lateral to Horizontal -

i have following issue: regular list approximate information: computer1 dateimplemented computer2 dateimplemented computer3 dateimplemented <this goes on while> what want do: computer1,dateimplemented computer2,dateimplemented <etc> i have been trying bunch of ways output is: computer1 dateimplemented. this going 1 of 50-50 scenarios solution stupidly easy or stupidly hard. thank in advance! @echo off setlocal enabledelayedexpansion set computer= /f "delims=" %%a in (list.txt) ( if not defined computer ( set "computer=%%a" ) else ( echo !computer!,%%a set computer= ) ) as usual, batch flile may modified manage special batch characters, if required.

jquery method .not to remove nested div from string -

i need remove 1 of nested divs. can remove div#parent (+divs inside) with: var $s = $(s).not('div#parent'); but can't remove 1 div inside (e.g. div#first): var s = '<h1>heading</h1><div id="parent"><div id="first"><p>paragraph</p></div><div id="second"><p> second div</p></div></div>'; var $s = $(s).not('div#parent > div#first'); $('body').append($s); // shows html how scenario done? your .not filtering top-level elements, $(s) returns: > $(s) [<h1>​heading​</h1>​, <div id=​"parent">​…​</div>​] since both of them don't match selector, nothing removed set of matched elements. find , remove elements instead: var $s = $(s); $s.find('#first').remove();

android - GoogleCloudMessaging register method -

i trying register device gcm. ma using emulator 4.2.2. getting io exception says "service not available". called register inside main activity class async request. what cause exception. fault on side or google service unavailable. pls help...

c++ - in SDL when i draw a menu over the screen it makes the game slower and doesn't work how can i fix this? -

hi i've been coding on sdl couple of months, i'm makin little game try, can manage states, have intro screen main screen play button , game state,i load map , drow characters(entities) 1 control , make collision test, can make camera focus on character , follow him arroun map, problem want try in game menus(to give more speed,health,strenght character , things that) made new class tha renders menu on screen image covers whole screen , button closes menu, when activate menu (whit key down event) menu shows button doesn't , after while menu doesn't show anymore , event "creates menu" doesn't work. my code drawing on screen this: bool draw::ondraw(sdl_surface* screen, sdl_surface* image_draw, int x, int y) { if(screen == null || image_draw == null) { return false; } sdl_rect drawing; drawing.x = x; drawing.y = y; sdl_blitsurface(screen, null, image_draw, &drawing); return true; } also create screen th

Rails Calendar with spanning Events -

i in need build calendar allows events span multiple days. i have used ryan bates railscast http://railscasts.com/episodes/213-calendars-revised setup display event start date. is there easy way build off allow event span multiple days? people have suggested full calendar alternative, data relies heavily on conditions built within controller advises events show on particular page.

html - Two color border -

Image
i know possible have effect of double border 1 below other possible using css have part of width of border 1 color , rest color? here example of image recreate border using css only: i think figured out 1 way it. check out http://jsfiddle.net/re4a7/ html <ul> <li><h3>mission</h3> </li> </ul> css ul h3 { font-size:1.2em; font-family:arial; border-bottom:1px solid #333; padding-bottom:10px; position:relative; width:250px; } ul li { list-style:none; } ul h3:after { border-bottom:1px solid #ff4800; bottom:-1px; left:0px; content:""; position:absolute; width:55px; }

IOS twitter feed tutorial -

i building app require users able view feeds only. i looked @ lot of tutorials online talk new api v1.1 of twitter , authentication required @ times. i see lot of examples , followed several of them like http://www.appcoda.com/ios-programming-101-integrate-twitter-and-facebook-sharing-in-ios-6/ i saw tutorial posted on twitter dev page.following of these focused on few key elements using acaccount retrieve account settings of current user using slrequest encapsulate http request made twitter api retrieving data in json format, parsing , presenting user well question is, not want user specific feeds. it's company updates twitter regularly, users using app should feeds regarding company. wondering if there way, app provides default or hard coded authentication information ? is there sort of tutorial, library or out there me move in correct direction ? thank time , help. your going want implement following api call information: https://dev.twitter.c

networking - Which port number should be used for network example code? -

i've written little haskell network example, don't know, port should use. i couldn't find example port number in ietf papers found or in wikipedia's list of port numbers , maybe there common port number in programming community. ports beyond 1024 , under 65535 , not have been used computer ok, choose like. net frameworks use 8000 or 8888.

haskell - Destructure a list two elements at a time (Clojure) -

this problem takes many forms. example, given input '(1 2 3 4 5 6), might want swap values between , odd pairs. output '(2 1 4 3 6 5). in haskell, rather easy: helper [] = [] helper [x] = [x] helper (x : y : ys) = y : x : helper ys i wrote clojure code accomplish same task, feel there cleaner way. suggestions on how improve this? (defn helper [[x y & ys]] (cond (nil? x) (list) (nil? y) (list x) :else (lazy-seq (cons y (cons x (helper ys)))))) ideally list consumed , produced lazily. thanks. (for [[a b] (partition 2 '(1 2 3 4 5 6)) [b a]] i) or resembling haskell version: (defn helper ([] (list)) ([x] (list x)) ([x y & r] (concat [y x] (apply helper r)))) (apply helper '(1 2 3 4 5 6))

How do I create an HTTP server with Node.js on a DreamHost VPS running Apache? -

i've installed node.js on dreamhost vps (basically virtual machine), vps hosts lot of other websites using apache. how can bind http listener specific domain using node.js, when visit "mynodejsdomain.com", responses node.js code, when visit "myotherdomain.com", responses apache/php? turns out needed tell apache forward requests domain, , dreamhost provides nice frontend mod_proxy: http://wiki.dreamhost.com/proxy_server thanks, codecaster !

C++: Building functions -

i having trouble understanding why function won't work. i've looked @ while loop several times, don't see why program isn't executing correctly. how stop while loop going off infinitely? i trying create program tells user how long it'll take pay off loan , needs paid on last month. user types in loan being borrowed, interest , money s/he intends pay each month. for example, borrowed $100 @ 12% annual interest. first month have pay $100*0.01 = $1. let pay $50 per month new balance 100 + 1 - 50 = $51. have pay 1% of $0.51. new balance 51 + 0.51 - 50 = $1.51 , keep going until it's paid off. this code looks like: #include <iostream> using namespace std; void get_input(double &principal, double &interest, double &payment); int main() { double money, i, pay; cout << "how want borrow ?"; cin >> money; cout << "what annual interest rate expressed percent?"; cin >> i; co

mvvm - C# POCO to JS Object dynamically -

i looking @ mvvm knockout.js. 1 of things achieve "easily" code behind mvvm poco client corresponding js object. the idea being that: a) if change c# poco reflect in js object b) changing value in poco result in necessary interaction client update js object i guessing when use signalr ( http://signalr.net/ ) this? , use mapping plugin ko ( http://knockoutjs.com/documentation/plugins-mapping.html ) turn observables. so questions are: are assumptions correct in terms of getting poco server side data ko via signalr is there way achieve 1.? yes, can use signalr push real-time changes poco representation of object client. mean, won't automatic in terms of change property, magically sends message. have build plumbing ensure send specific signalr message when particular object changed. choose resend entire representation of object again (e.g. current values) or send values know changed more efficiency. from there need update corresponding js represent

ESENT--read a ese database file -

the pagesize of file read 32768. when set jet_paramdatabasepagesize 32768,jetinit returns -1213.then,i set jet_paramrecovery "off",jetinit succeeds.but,when use jetattachdatabase,it returns -550. here code: err=jetsetsystemparameter(&instance,sesid,jet_paramdatabasepagesize ,32768 ,null); err=jetcreateinstance(&instance,null); err=jetsetsystemparameter(&instance,sesid,jet_paramrecovery,0,"off"); err=jetinit(&instance); err=jetbeginsession(instance,&sesid,null,null); err=jetattachdatabase(sesid,buffer, jet_bitdbreadonly ); err=jetopendatabase ( sesid, buffer, null, &dbid, jet_bitdbreadonly ); what's wrong it?i running windows 7 32bit. the page size global process (not instance) , persisted in log files , database, changing page size can annoyingly tricky. is there information in database you're trying access? or did experience during development? if saw during development, easiest thing blow away (del .edb edb

mysql - Conditional Where clause in sql -

select cola, colb car car.id in (select id make) , car.id in (select id model); the above query works file is, there case make table has not been popluated anything. empty table. there way make join not take place on table? basically, if table has 1 or more rows, apply condition. otherwise, ignore , dont limit it. is there way achieve same result on left join? edit result algorithm: select stuff original table car. take away not in table make if make has content take away not in table model if model has content.... take away in table model2 if model2 has content.... thisnk of model2 table of things dont want, , model , make tables of things want. select cola, colb car ((select count(*) make) = 0) or id in (select id make)) , id in (select id model) with left join: select distinct cola, colb car join (select count(*) c make) mcount left join make on car.id = make.id join model on car.id = model.id mcount.c = 0 or make.id not null using or can

javascript - How can i create order based click events -

i'm trying create web based game toddler involving counting. want make click 1 through 10 in order, cant click 3 until have correctly clicked 1 , 2 in order. pretty easy, i'm bit of noob when comes js. appreciated. thanks. if you're new js, may want start learning jquery. find incredibly useful. it, this: <button value='1'> 1 </button> <button value='2'> 2 </button> <button value='3'> 3 </button> ... <script> var highest = 0; $('button').click( function() { if($(this).val() == highest+1) { highest = $(this).val(); alert("yay!"); } }); </script> this code tell 'yay!' every time click next number.

java - How to read font size of each word in a word document using POI? -

i trying find out whether there exist in word document has font of 2. however, have not been able this. begin with, i've tried read font of each word in sample word document has 1 line , 7 words. not getting correct results. here code: hwpfdocument doc = new hwpfdocument (filestream); wordextractor = new wordextractor(doc); range range = doc.getrange() string[] paragraphs = we.getparagraphtext(); (int = 0; < paragraphs.length; i++) { paragraph pr = range.getparagraph(i); int k = 0 while (true) { characterrun run = pr.getcharacterrun(k++); system.out.println("color: " + run.getcolor()); system.out.println("font: " + run.getfontname()); system.out.println("font size: " + run.getfontsize()); if (run.getendoffset() == pr.getendoffset()) break; } } however, above code doubles font size. i.e. if actual font size in document 12 outputs 24 , if actual font 8 outputs 16. is correct way read font size word

java - Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError -

i developing spring mvc application using sts (eclipse plugin) , maven. for creating project, followed sts wizard new "spring mvc project". afterwards, added dependencies other projects , libraries. however, when trying deploy project integrated vfabric server of sts, exception: severe: containerbase.addchild: start: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/wsa]] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:154) @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901) ... caused by: java.lang.illegalstateexception: unable complete scan annotations web application [/app] due stackoverflowerror. possible root causes include low setting -xss , illegal cyclic inheritance dependencies. class hierarchy being processed [org.bouncycastle.asn1.asn1encodablevector->org.bouncycastle.asn1.derencodablevector->org.bouncycastle.a

hook - Woocommerce - Append custom field after price in content-single-product.php -

i need append custom field called unit_description after price read e.g. $7.00 per sandwich . i'm thinking begin with: remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); try this: add_filter( 'woocommerce_price_format', 'overwrite_woocommerce_price_format', 10, 2 ); function overwrite_woocommerce_price_format( $format, $currency_pos ) { global $post; if ( $post->post_type != 'product' ) return $format; $custom_field = get_post_meta( $post->id, 'unit_description', true ); // return custom field value return $format . ' ' . __( $custom_field, 'woocommerce' ); // here you'll append custom field price } hope helpful

javascript - Convert pdf to a single page editable html -

i have been trying convert pdf file single nice html page .after surfing it. solutions have got little bit lacking requirements.as have create individual html pages 200 pdf files.as online converters might not leading solution. tried following solutions along requirements not being fulfilled. embed tag of html5 + embeds pdf html page nicely. - html page not editable since embeds pdf html page. pdftohtml + converts pdf single html page. - the not nice. pdf.js + converts pdf html page readable look. - html page not editable. jpdf2html + converts pdf single html page nice , html css. - it creats big folder contaning images thumbnails , html page single page in pdf might not feasible large number of pdf files. from can improve output.. flexpaper has desktop publisher mode called elements has ability convert pdf editable elements- worth look http://flexpaper.devaldi.com/download

wso2 - How We Can Break a String in Wso2esb using Xpath -

i wish break string in wso2esb using xpath input <property name="message" value="assetname:ups,assetcode:452chi,assetid:548935,assetvalue:215" scope="default"/> i need break in same property using xpath need this assetname:ups assetcode=452chi assetid=54895 assetvalue=215 for tried tokenize function wso2esb showing errors configure file <proxy xmlns="http://ws.apache.org/ns/synapse" name="xpathcheck" transports="https,http" statistics="disable" trace="disable" startonload="true"> <target> <insequence> <property name="max" value="1" scope="default" type="string"/> <property name="min" value="1" scope="default" type="string"/> <property name="messagetext" expression="fn:concat('assetid:',get-property('min&#

html - Center block (paragraph) inside div -

there example in jsfiddle . small description: div 300x300 might 500x500 or 100x100 in future (so need flexible solution) background image (which size:cover don't care size). inside div there <p> hight of 50px (but might 100px or 25px in future) has text inside (20) , background-color bit transparent (blue). i want center inside div , sollution should flexible (so future changes won't take few hours fix images/ideas manually, cool use % values. has idea? one way: .cover-price{ height: 300px; width: 300px; background-repeat: no-repeat; background-size: cover; position:relative; /*make container relative*/ } .cover-price p{ line-height: 50px; width: 100%; height: 50px; background-color: rgba(43,32,122, .3); color: pink; position:absolute; /*make p absolute*/ top: calc(50% - 50px); /*give top 50% - height of p*/ } fiddle using calc since have specified css3 in tags if not using calc lack

php - Delete a specific image out of a folder -

i have website allows users upload photos folder. when page refreshes, show images inside folder. i used scandir instead of glob function read images. check file type extension see if in allowed format (jpg, jpeg, gif, png) use loop display them. each image has "delete" link next it. when user presses "delete" link, want remove specific image in folder. know function unlink() able delete image, couldn't because don't know how pass specific image name delete.php. told me use ajax, haven't learned yet. if necessary, go learn immediately. please tell me if there ways solve instead of ajax. thank much! $dir = 'images/'; $file_type_allowed = array('jpg','jpeg','png','gif'); $dir_contents = scandir($dir); foreach($dir_contents $file){ $file_type = explode('.',$file); $file_type = strtolower(end($file_type)); if($file !== '.' && $file !== '..' && in_arra

Android - Set Default Spinner Themes -

i'm new android development. i'm using drag , drop pull down default spinner onto layout. however, default not 1 see using triangle on bottom right. an example of see is: http://www.mkyong.com/wp-content/uploads/2011/11/android-spinner-demo1.png whereas i'm looking achieve this: http://i.stack.imgur.com/x82ld.png is styling issue? apologies ripping off other people's images, don't have enough rep uploading own images. thanks much! i've solved issue setting theme of application/activity holo.light. hope helps other people in process.

html5 - chrome goes back 2 times instead of one time when using history.pushState/location.hash -

open new tab in chrome (opens http://google.com example) open testpage.htm containing history.pushstate({},"test","#lightbox"); changes url testpage.htm#lightbox if hit button of chrome url changed http://google.com , 2 states back, not one firefox , msie10 work both good, it's chrome issue how can fix this? there workaround? thank in advance (feel free give question better title , feel free correct english) notes: on step 2 can use window.location.hash = "#lightbox" same issue on step 3 can simulate button within code, using history.back() , in case url switched correct 1 testpage.htm , related button of chrome's gui i tried window.addeventlistener("popstate", function(ev){ ev.preventdefault(); }); window.addeventlistener("hashchange", function(ev){ ev.preventdefault(); }); without success :( update 2: same using history.js

How to call SOAP Webservice with security header in blackberry 10 Cascading C /QML? -

i new bb 10 cascade. need call soap webservice security header. how use qtsoap ? thanks in advance. if question how add security header qtsoap request, can way: on qnetworkrequest , set header void qnetworkrequest::setrawheader(const qbytearray& headername, const qbytearray& headervalue) , give this: request.setrawheader("wsse:security", "yourheadervalue"); send request void qtsoaphttptransport::submitrequest(qnetworkrequest& networkreq, qtsoapmessage& request, const qstring& path)

Magento shop is down but admin panel works -

our shop working fine until yesterday when browser showed "err_empty_response". shop did not work @ admin panel working fine. shop located on dedicated server , no updates made, no extension installed , no other relevant changes made cause problem. makes crazy why admin panel works while shop down, idea happen? local.xml not show anything.

c# - Cannot convert IQueryable<IEnumerable<string>> to return type IEnumerable<string> -

Image
in following function error when try return value saying: cannot convert system.linq.iqueryable<system.collections.generic.ienumerable<string>> return type system.collections.generic.ienumerable<string> public ienumerable<string> getmodulekindpropertynames(long modulekindid) { var configurationid = getmodulekindpertypeconfigurationid(modulekindid); var propertynames = _dbsis.modulekinds .where(t => t.pertypeconfigurationid == configurationid) .select(x => x.pertypeconfiguration.properties .select(z => z.name)); return propertynames; //red line below property names } how can solve issue? it looks want select items a collection within collection , flatten result single sequence. conceptually, like: if that's case, you're looking selectmany method: var propertynames = _dbsis.modulekinds

404 Not Found after submit login page in codeigniter -

Image
codeigniter load login page when submit form, browser response 404 not found. have no idea real problem. please help. below our codes: this view file : view/login/index.php <?= form_open(base_url().'login/index', array('id' => 'loginform')) ?> <div class="wrap-login"> <div id="content1"> <div id="main"> <h1>administrator area</h1> <div class="full_w1"> <div class="form"> <?php if ($this->session->flashdata('message')) : ?> <?= $this->session->flashdata('message') ?> <?php endif; ?> <?= form_label(lang('username'), 'username', array('data-icon' => 'u')) ?> <?= form_input(array('name'=>'username','id'=>'username&#

Tapestry: How to set HTML checkbox from java page -

i using plain html checkbox(not tapestry type). need set checkbox checked in java page. how do that? here tml code fragment <input type="checkbox" name="leaf" id="leaf" value="leaf"/> any appreciated. thanks. you need set checked property. i'd use <t:any> component. tml <t:any element="input" type="literal:checkbox" name="literal:leaf" id="prop:clientid" value="prop:currentobject.value" checked="prop:checked" /> java @property private sometype currentobject; public string getclientid() { return "mycheckbox_" + currentobject.getid(); } // if returns null, tapestry won't render attribute public string getchecked() { return currentobject.isselected() ? "checked" : null; }

html - How to disable <br> tags inside <div> by css? -

<br> won't let me display 3 buttons inline, need disable inside div, , can't delete them, automatically there. i have: <div style="display:block"> <p>some text</p> <br> <p>some text</p> <br> </div> and want: <div style="display:block"> text text </div> more info i not want have mystyle.css file. of course know way of disabling it. i asked how add divs style br { display: none; } if possible. solution: it not possible remove <p> tags without removing content inside. it not possible hide <br> directly divs style, make way: <style type="text/css"> .mydiv { display: block; width: 100%; height: 10px; } .mydiv br { display: none; } </style> <div class="mydiv"> text text </div> http://jsfiddle.net/cgt4e/ you alter css render them less obtrusively, e.g. div p, div br { display: inline; } http:/

java - What is the optimized implementation of conflict graph for combinatorial auction? -

given m bids may share subset of n items, want find best way store conflicts among bids , check whether 2 bids conflicting (i.e., share @ least 1 item). far, have tried matrix of dimension m x m isn't optimal. problem may have thousands of bids, therefore error "java out of memory space" when use square matrix implementation. then, tried triangular matrix (because original conflict matrix symmetric) without getting rid of memory issue! any better idea? the best way code? thanks. one solution use guava's table , combine list<bid> containing bids. note: below code uses lot of guava goodness: final list<bid> allbids = lists.newarraylist(); final table<bid, bid, void> conflicts = hashbasedtable.create(); when store new bid, you'll (this supposes bid has .items() method return set<item> ): for (final bid bid: allbids) if (!sets.intersection(newbid.items(), bid.items()).isempty()) conflicts.put(newbid, bid

amazon ec2 - Intalling BlueStaks on Windows-Server2008/2012 -

i install bluestacks on ec2 instance running windows server 2008. tried installation got cancelled in middle sighting graphics issues. i downloaded second setup again failed throwing error code 1603. i know if possible installing bluestacks on amazon ec2, , if yes prerequisite of installing on ec2 instance thank you

python - How does one make a twistedmatrix subprocess continue processing after the client disconnects? -

i`m creating twisted tcp server needs make subprocess command line call , relay results client while still connected. subprocess needs continue running until done, after client disconnects. is possible this? , if so, please send me in right direction..its new me. thanks in advance! there's nothing in twisted's child-process support automatically kill child process when particular tcp client disconnects. behavior you're asking default behavior.

jquery - How to set fixed position to DIV into the page -

Image
i have css box-model this: using jquery (when button cliecked) resize main content div, footer doesn't maintain position @ bottom of screen: i try set position: fixed footer div, doesn't scroll page. i know if there way position footer regardless of content use css achieve this .my_footer { position: fixed; bottom: 0; left: 0; right: 0; height: 100px; }

c++ - Set CXXFLAGS in Rcpp Makevars -

i set c++ compiler flag -o0 in makevars of rcpp project. if take @ /etc/r/makeconf , see compilation command seems be $(cxx) $(all_cppflags) $(all_cxxflags) -c $< -o $@ since all_cxxflags = $(r_xtra_cxxflags) $(pkg_cxxflags) $(cxxpicflags) $(shlib_cxxflags) $(cxxflags) i can edit in makevars variable $(pkg_cxxflags) add headers specific libraries, not satisfied cxxflags = -o3 -pipe -g $(lto) . able directly in makevars, tune each project according needs. when edit cxxflags in makevar, nothing happens. is possible adjust variable ? approach possible ? know can edit ~/.r/makevars , , switch requested. wondered if there more robust approach. you want pkg_* variants in local file, e.g. ~/.r/makevars . here (shortened, edited) portion of mine: ## c code cflags= -o3 -g0 -wall -pipe -pedantic -std=gnu99 ## c++ code #cxxflags= -g -o3 -wall -pipe -wno-unused -pedantic -std=c++11 cxxflags= -g -o3 -wall -pipe -wno-unused

Facebook posts in page invisible -

i have facebook page. if post message manually website posts seen in web. { "id": "464583420338154_464899220306574", "from": { "category": "tv network", "name": "enr uk", "id": "464583420338154" }, "message": "fdsfsdfsdfsdfsd", "actions": [ { "name": "comment", "link": "https://www.facebook.com/464583420338154/posts/464899220306574" }, { "name": "like", "link": "https://www.facebook.com/464583420338154/posts/464899220306574" } ], "privacy": { "description": "public", "value": "everyone", "friends": "", "networks": "", "allow": "", "deny": "" }, &qu

c# - How to sort a datatable and then append rows at the bottom? -

i have function returning data table. function appends 1 row calculated sum. requirement has come sort data table. tried sort datatable append total row, data table taking total row in consideration. how can mitigate behaviour? dt.defaultview.sort = "totalearning desc"; //sorting first adding datarow dr = dt.newrow(); dr.itemarray = new object[] { "total", dt.compute("sum(redeemed)", ""), dt.compute("sum(earning)", ""), dt.compute("sum(paidhousefee)", ""), dt.compute("sum(paidfine)", ""), dt.compute("sum(totalearning)", ""), dt.compute("sum(noofdayspresent)", ""), dt.compute("sum(noofdaysabsent)", ""), dt.compute("sum(avgdaily)", "") }; dt.rows.insertat(dr, dt.rows.count); i suggest use linq-to-dataset instead more powerful , more reada

Android - How to create a Permanent Notification -

i have created notification in "oncreate" activity method. everything runs smoothly, can close pressing "delete all" button. how make notification perma? in should more of info rather notification.. this current code: private void shownotification() { // todo auto-generated method stub nmn = (notificationmanager) getsystemservice(notification_service); notification n = new notification.builder(this) .setcontenttitle("whip , weep") .setcontenttext("whip on!") .setsmallicon(r.drawable.ic_launcher) .build(); nmn.notify(notification_id, n); } on notification builder use .setongoing(true) , prevent user removing notification. see notification builder documentation more info: http://developer.android.com/reference/android/app/notification.builder.html#setongoing%28boolean%29

java - Testing Spring Web Flow exception event -

i have following setup in flow xml (my-flow.xml): <view-state id="exceptionviewstate" view="general_error" model="oneobjet"/> ... <view-state id="previousviewstate" view="previous_view" model="oneobjet"> <transition on="actionconfirmed" to="endstate" /> </view-state> ... <global-transitions> <transition on-exception="com.xxx.exception.generalexception" to="exceptionviewstate"/> </global-transitions> and trying test flow xml extending abstractxmlflowexecutiontests public void testmyflow_exception() { setcurrentstate("previousviewstate"); mockexternalcontext context = new mockexternalcontext(); context.seteventid("com.xxx.exception.generalexception"); resumeflow(context); assertcurrentstateequals("exceptionviewstate"); assertresponsewrittenequals("general_error", c

html5 - simple drop down box -

i have nav bar 4 links. 3 direct links , 1 should drop down 3 more links. struggling ul.services reappear when hovering on services link. html <a href="#" class="services">services</a> <ul id="drop_down"> <li><a href="#">profit</a></li> <li><a href="#">profit</a></li> <li><a href="#"">profit</a></li> </ul> <a href="#">about</a> <a href="#">contact</a> <a href="#">testimonials</a> css #drop_down{ display: none; position: absolute; list-style-type: none; text-align: right; margin-left: 0; padding-left: 0; } a:hover{ color: red; } .services:hover > #drop_down{ display: block; } can help. thanks the best way using jquery .hover() , fadein(), .fadeout() functions, first need know html code have lot of errors. html corrected: <a href

What are key differences between sbt-pack and sbt-assembly? -

i've stumbled upon sbt-pack plugin. development stream seems steady . it's surprising me believed plugin (quoting sbt-pack's headline) "creating distributable scala packages." sbt-assembly (among other features). what key differences between plugins? when should use 1 on other? (disclaimer: maintain sbt-assembly) sbt-assembly sbt-assembly creates fat jar - single jar file containing class files code , libraries. evolution, contains ways of resolving conflicts when multiple jars provide same file path (like config or readme file). involves unzipping of library jars, it's bit slow, these heavily cached. sbt-pack sbt-pack keeps library jars intact, moves them target/pack directory (as opposed ivy cache live), , makes shell script run them. sbt-native-packager sbt-native-packager similar sbt-pack started sbt committer josh suereth , , maintained highly capable nepomuk seiler (also known muuki88). plugin supports number of formats

backbone.js - Image not appear using cordova plugin -

i'm using 2 types of cordova plugin store image gallery , make retrieve back. file: https://github.com/apache/cordova-plugin-file camera: https://github.com/apache/cordova-plugin-camera my project based on backbone.js . problem is, got weird problem last week. image still can't appear on next page after click button. got 2 pages, first page store image gallery after capture picture using camera cordova plugin. below code page 1 javascript function onphotourisuccess(imageuri) { var largeimage = document.getelementbyid('image'); largeimage.style.display = 'block'; largeimage.src = imageuri; localstorage.imageurl = imageuri; } html <button onclick="getphoto(picturesource.photolibrary);">from photo library</button> <img id="image" name="image" src="" style= "display:none;width:100%;" /> then want retrieve image in gallery using imageuri store localstorage.imag

python - A simple database inner join using django -

i have 2 tables legacy database imported django app using inspectdb here model definition class appcosts(models.model): cost = models.decimalfield(max_digits=10, decimal_places=2) class appdefinitions(models.model): data = models.textfield() permissions = models.charfield(max_length=50, blank=true) appcost=models.onetoonefield(appcosts, db_column='id') every app in appdefinitions has 1 entry in appcosts - 1 one relationship when use select_related() : >>> appdefinitions.objects.select_related().query.__str__() u'select _app_definitions.id, _app_definitions.data, _app_definitions.permissions, _app_definitions.id, _app_costs.id, _app_costs.cost _app_definitions inner join _app_costs on ( _app_definitions.id = _app_costs.id )' >>> = appdefinitions.objects.select_related().first() >>> a.id u'abaqus' >>> a.cost traceback (most recent call last): file "<console>", lin

Change Default Notification Ringtone on Android -

i'm trying change notification ringtone within app. far can notification ringtones show, , select 1 of them, it's not changing it. i'm using far: sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(this); uri notification = uri.parse(settings.getstring("timersound", ringtonemanager.getdefaulturi(ringtonemanager.type_notification).tostring())); intent intent = new intent(ringtonemanager.action_ringtone_picker); intent.putextra(ringtonemanager.extra_ringtone_type, ringtonemanager.type_notification); intent.putextra(ringtonemanager.extra_ringtone_title, "select alert tone"); intent.putextra(ringtonemanager.extra_ringtone_existing_uri, notification); intent.putextra(ringtonemanager.extra_ringtone_show_silent, false); startactivityforresult(intent, 5); you can change notification ringtone following code //new ringtone uri uri nuri = uri.parse("")

php - "Unsupported media type" when PUTing to Apigility with Postman -

i'm building restful api using zend framework 2 , apigility zend framework. testing, use chrome extension postman rest-client. i can requests , post requests without problems sending form-data without problems. but when try put, patch or delete request, following error: { "type":"http://www.w3.org/protocols/rfc2616/rfc2616-sec10.html", "title":"unsupported media type", "status":415, "detail":"invalid content-type specified" } accept whitelist in rest-service-config of apigility: application/vnd.timber-ms.v1+json, application/hal+json, application/json content-type whitelist: application/vnd.timber-ms.v1+json, application/json the content-type of response application/problem+json what can fix , successfull put/patch requests? problem postman or apigility? you're getting 415 error of unsupported media type when apigility cannot deserialize data coming client. call

java - Console output and file output seem to be different -

so doing program go through every folder in designated folder , if there files inside of thoes folder, read them. the files this: file name: grades mait 5 5 5 kati 3 3 3 vello 4 4 4 so read in each line , 0th element in every line name of student add array. after take grades , calculate median of them. also files in folders named class name. instance math has every math grade in it. now programs job read thoes files , produce output file contains every students name , median in every class , after median of grades. this how output looks right now: nimi: mait keskmine hinne: 5.0 aine: ..\text\students\english\grades nimi: kati keskmine hinne: 3.0 aine: ..\text\students\english\grades nimi: vello keskmine hinne: 4.0 aine: ..\text\students\english\grades nimi: mait keskmine hinne: 1.0 aine: ..\text\students\math\grades nimi: kati keskmine hinne: 2.0 aine: ..\text\students\math\grades it's not in english in form of name:, median; , class name; now problem here th

javascript - No flash message output in console -

i have controller hit via ajax call , sets flash[:info] string. controller renders js.erb file put: console.log("<%= flash["info"] %>") but unfortunately nothing output in console. how can output message ? it's because flash[:info] doesn't equal flash["info"], have use 1 type. should work: console.log("<%= flash[:info] %>")

javascript - See the updated document in allow / deny rule in Meteor.js -

i'd specify allow rule document update in meteor.js depend on properties of updated document. in update callback, old document, list of changed top-level fields , mongo modifier. there easy way determine how document if updated?     a non-trivial real-life example: i've got party model maxcount integer specifies how many people can fit in party, , people array names of people attending. user can push several names array. i'd allow update made if in resulting document length of array not exceed maxcount . this perfect example of why allow/deny rules in current form insufficient real world problems. there multitude of ways document can updated, , it's impractical check of them tools allow/deny gives you. i'd should use them if permissions like: "the owner of document can whatever wants document". that being said, if really want example above try checking if people.length < maxcount when modifier['$push']['people&

Delphi 7 - ShowMessage to Stay on Top and not to be Able to Click Other Windows of applications unless you Press ''ok'' button in the message -

how can that? procedure tfmain.button2click(sender: tobject); begin showmessage('cya!!'); application.terminate; end; is there way able click ''ok'' showmessage , if dont wont able click else in interface? i think you're looking mb_systemmodal flag on messagebox . instead of showmessage , call messagebox directly, this: messagebox(application.handle,'cya!!',pchar(application.title),mb_ok or mb_iconinformation or mb_systemmodal);

Android Phonegap getting Unfortunately <app> has stopped after installing facebook connect plugin -

i developing android phonegap app 'facebook connect' plugin. this documentation , plugin page have used; phonegap-facebook-plugin after installing plugin, when app launch , trigger fb login function, gets "unfortunatly has stopped" message , crashes. i have installed before without issues. time doesn't work well. i using cordova. 3.3.1-0.1.2 , phonegap. 3.3.0-0.19.6 . i didn't why u mention both cordova , phonegap.. but please check answer! add below config.xml , ensure place config.xml in root folder index.html file: <gap:plugin name="com.phonegap.plugins.facebookconnect"> <param name="app_id" value="..." /> <param name="app_name" value="..." /> </gap:plugin> add below of index.html file , every .html file want access plugin scripts: <script scr="phonegap.js"></script> <script src="cdv-plugin-fb-connect.js">&l

hudson - Being clever when copying artifacts with Jenkins and multi-configurations -

suppose have (fictional) set of projects: foo , bar. both of these projects have sort of multi-configuration option. foo has matrix on axis x takes values in { x1, ..., xn } (so there n builds of foo). bar has matrix on axis y takes values in { y1, ..., ym } (so there m builds of bar). however, bar needs copy artifacts foo. turns out y strictly finer partition n. example, x might take values { windows, linux } , y might { windows_xp, windows_7, debian_testing, fedora } or whatever. is possible bar sort of table lookup work out configuration of foo needs when copies artifacts across? can write shell script spit out mapping, can't work out how invoke when jenkins working out needs copy. at moment, hacky solution have 2 axes on foo, on x , 1 y , , filter out combinations don't make sense. resulting combination filter ridiculous , matrix sparse. yuck. a solution don't parametrise foo on y instead: huge waste of compile time. and, worse, generated artefa

mysql - DataBase-Finding total scores -

i've 15 levels, , each level consists of 2 rounds . i've find total score finding max score user earned in round1 , round2 , calculate it. likewise same method how many levels played. and, finally, total result calculating scores levels. can please me find total score using mysql..! i tried code: select *, (classifica_score + max2) total from( select ifnull( max(xx1.classifica_score), 0) classifica_score, xx1.classifica_level, xx1.classifica_round, xx1.fb_id, (select ifnull( max(tc1.classifica_score), 0) tab_classifica tc1 tc1.classifica_round = 2 , tc1.fb_id = xx1.fb_id) max2 tab_classifica xx1 xx1.classifica_round=1 group xx1.classifica_level, xx1.classifica_round, xx1.fb_id union select ifnull( max(xx2.classifica_score),0) classifica_score, xx2.classifica_level, xx2.classifica_round, xx2.fb_id, (select ifnull( max(tc2.classifica_score),0) tab_classifica tc2 tc2.classifica_round = 1 , tc2.fb_id = xx2.fb_id ) max1 tab_classifica xx2 xx

c++ - CMake find_path include directory prefix -

i writing minimal find*.cmake openni. find header files wrote find_path(openni_include_path xnos.h) which working expected (openni_include_path has value /usr/include/ni). however, in files have include headers with #include <ni/xnos.h> how can rid of ni prefix, can write #include <xnos.h> the problem first include xncppwrapper.h gets included , file includes again xn*.h headers, without ni prefix. results in compiler error. always have path use find_path match 1 in #include statements. if want #include <ni/xnos.h> should write find_path(openni_include_path ni/xnos.h) if instead want #include <xnos.h> , use find_path(openni_include_path xnos.h) just sure make mind beforehand 1 want use , stick it . mixing several include paths same library sure way unnecessarily overcomplicate build environment.

ios - Get Spotify Track artwork on UITableView -

i trying artworks or album covers using spotify api. using: nsstring *url = @"http://ws.spotify.com/search/1/track.json"; nsmutabledictionary *params = [[nsmutabledictionary alloc] initwithobjectsandkeys: ([utils isemptystring:_searchbar.text] ? @"music" : _searchbar.text), @"q", nil]; [self sendrequestwith:url params:params method:requestmethodget success:^(afhttprequestoperation *operation, id response, nsdictionary *userdata) { nsdictionary *result = (nsdictionary *)response; if(result){ [_tracklist removeallobjects]; nsarray *tracks = [utils getdictionaryvalue:result by:@[@"tracks"]]; (nsdictionary *trackdata in tracks) { wptrack *track = [[wptrack alloc] initwithspotifyjson:trackdata]; [_tracklist addobject:track]; } [listviewcontroller updatewithobjects:_tracklist]; } } failure:^(afhttprequestoperation *operation, nserror *erro

WSO2 : API Manager 1.6.0 on WSO2ESB 4.8.1 -

is possible install api manager 1.6.0 feature on wso2esb 4.8.1 .i tried install using feature management,but showing dependency problem.. while trying install using feature management,i getting below error your original install request has been modified. org.wso2.carbon.registry.core.server.feature.group-4.2.1 present because other installed software requires it. added installed software list. org.wso2.carbon.security.mgt.feature.group-4.2.2 installed, update performed instead. org.wso2.carbon.module.mgt.server.feature.group-4.2.0 present because other installed software requires it. added installed software list. org.wso2.carbon.rest.api.server.feature.group-4.2.1 present because other installed software requires it. added installed software list. org.wso2.carbon.endpoint.server.feature.group-4.2.1 ignored because newer version installed. org.wso2.carbon.registry.community.features.server.feature.group-4.2.1 ignored because installed. org.wso2.carbon.event.server.feature.group