Posts

Showing posts from February, 2010

java - Applying specific cell data format using POI -

i need apply specific data format cell. xssfcellstyle cellstyle = workbook.createcellstyle(); xssfdataformat format = workbook.createdataformat(); cellstyle.setdataformat(format.getformat("m/d/yy h:mm")); datacell.setcelltype(1); //string datacell.setcellstyle(cellstyle); the data being written problem format applied only when open excel sheet (in excel application), click inside cell data. , pressing enter key. format applied. how can apply format without clicking on every cell? your problem you're setting cell string. part, cell formatting rules apply numeric cells. don't apply string cells, don't formatted (as they're formatted string!) xssfcellstyle cellstyle = workbook.createcellstyle(); xssfdataformat format = workbook.createdataformat(); cellstyle.setdataformat(format.getformat("m/d/yy h:mm")); datacell.setcellstyle(cellstyle); // set cell type not needed, setcellvalue datacell.setcelltype(cell.c...

asp.net - Simply display RSS feed in/on aspx page -

maybe being n00b here, life of me, cant find simple drop in type solution displaying rss feed inside aspx page? i looking simple solution, when firefox gets pointed rss feed, plainly displays it, no thrills, no fuss. don't want xml , format extensively. want basic feed, style font , a:styles. thats it. any ideas? edit: i attempting show worpress "feed" inside aspx page... the simplest solution display in iframe, browser take care of formating. otherwise you'll need parse xml , create appropriate html tags each of elements and/or attributes.

vertica - sql getting pivoted top 5 -

i have sales table following columns: [date], [storeid], [itemid], [amountindollars]. example: 06052012 | 1 | 111 | 2.35 06052012 | 1 | 222 | 5.00 06052012 | 2 | 333 | 9.99 ... 01052012 | 30 | 999 | 3.98 i want able select data in way: [date] | [storeid] | totalsalesfortheday | topsellingitemid1 | topsellingitemid2 | topsellingitemid3 i trying following: select date, storeid, sum(amountindollars), itemid sales group date, storeid, itemid this gives itemids sold in day... how can 1. limit 3 top items 2. present 3 top items in same lines horizontally thanks! as requested - data sample. original table date | storeid | itemid | amountindollars 06052012 | 1 | 111 | 2.35 06052012 | 1 | 222 | 5.00 06052012 | 1 | 444 | 9.99 06052012 | 1 | 222 | 5.00 06052012 | 1 | 444 | 9.99 06052012 | 1 | 333 | 9.99 06052012 | 1 | 444 | 9.99 06052012 | 2 | 222 | 5.00 06052012 | 2 | 444 | 9.99 06052012 | 2 | 333 | 9.99 06052012 | 2 | 444 ...

javascript - jQuery scroll page so cursor stays at the "logical center" -

i have huge html form , near 350 controls take 5-6 times of user screen height. user starts completing each input field beginning of page , goes on. once cursor rich near bottom of screen user must able see next input fields here problem : want avoid scrollbar usage. want set "margines" ( 200px each page side ) if user clicks control near screen edge, here mechanism must work also i'm looking jquery solution playing around jquery.scrollto, can't figure out how embed logic code. this should it http://jsfiddle.net/jswnk/ $(document).ready(function() { $('input').focus(function() { var padding = 100; // desired page "padding" var lbound = $(this).offset().top - $(window).height() + padding; var ubound = $(this).offset().top - padding; if ($(window).scrolltop() < lbound) $(window).scrolltop(lbound); else if ($(window).scrolltop() > ubound) $(window).scro...

mercurial - hg grep --exclude pattern -

how specify --exclude / -x parameter when using hg grep ? i've tried every kind of bare , pattern syntax i've ever come across (including few regex dialects know), can't work simple example. i'm interested in filtering out binary files , minified javascript files ( *.min.js ) search. i'm on windows, if that's pertinent. see hg patterns . default, pattern treated shell glob. if want use regular expression, can try this: hg grep -x "re:.*\.min\.js$" <search term>

xcode - Expression result unused objective-c -

i nooby gets. can please tell me how fix this? #include <stdio.h> int main(int argc, const char * argv[]) { int sum; sum = 50 + 25; "the sum of 50 , 25 %i", sum ; return 0; } change line: "the sum of 50 , 25 %i", sum ; to: printf( "the sum of 50 , 25 %i", sum ); the line in quotes syntax error happens getting compiler (which apparently throwing warning instead).

java - Show action bar also for menu button? -

i'm creating action bar on ics. due spacing icons displayed. i'd supply action bar context-like menu with text if menu button of phone pressed. how can achieve this? atm have 3 icons. 2 of them displayed @ top in action bar. if press menu phone button, 3rd displayed contextmenu! i'd have 3 of them. class myactivity extends sherlockfragmentactivity { @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getsupportmenuinflater(); /* implementation here */ } } from documentation on menus : if menu item not appear action item, system places in overflow menu. thus, showing same action item in both action bar and overflow menu not possible. could this: check (at runtime) menu items fit in action bar , not. for each menu item displayed in action bar, create new, identical menu item dynamically, making sure call newmenuitem.setshowasaction(show_as_action_never) ensure displayed in overflow m...

linux - What happened to /usr/include/machine directory in Ubuntu 12.04? -

i'm trying build/compile old project using original makefile. when so, following error: *** no rule make target `/usr/include/machine/param.h' my os ubuntu 12.04. there seem plenty of param.h files, no /usr/include/machine directory. know (if any) of existing param.h files should use ? thanks i can't recall /usr/include/machine/ directory before... said, try /usr/include/linux/param.h .

signals - C SIGALARM clarification -

"rewrite 'fgets' include alarm if after 5 seconds user doesn't enter data, 'fgets' return pointer null (times out)" this 1 problem of large homework assignment , starting @ signals, catching, handling, etc. said book , lecture slides lacking on this... i idea of creating handler catch type of exception, , understand how alarm works, don't understand how interface work. just thinking "fgets" right now... if put alarm in prior other work being done (just before return pointer): char *fgets(//...//) { alarm(5); char * to_return = null; //...// if alarm goes off before user types in data, can handler "return null"? won't execution resume within "fgets" after handler done? guess i'm confused handler can inside of function (ie can force function return value, can modify variables declared within function, can force jump different function call, etc.) first off, signal handler separa...

python - Why do errors occur? -

simply source class page: pages = "/.././ewcwe/../qds/./qwd/qwf/qwd/../../../sad/qwd/../sad/qwd/sad/.././../../../../bbs/./board.php?bo_table=humor&wr_id=195?los=09&qwe=2&" def __init__(self): self.normalize() def normalize(self): j in range(1, len(self.pages)): if self.pages[j-1] != "." , self.pages[j] == "." , self.pages[j+1] == "/": self.pages = self.pages[:j] + self.pages[j+2:] print self.pages print self.pages index = page() there's no problem error occurs. why errors occur? import os os.path.normpath(pages) normalizes path , returns: '/bbs/board.php?bo_table=humor&wr_id=195?los=09&qwe=2&' you don't have reinvent wheel.

unix - Custom PS1 not showing the current working directory -

i have customized primary prompt bash shell unfortunately not showing current working directory can seen below. [cifsamidala]w# pwd /home/vinod/searchidissue [cifsamidala]w# here have customized ps1: host=`tput bold``hostname``tput sgr0` ps1="[${host}]\w # " here shell info reference. [cifsamidala]w# echo $shell /sbin/sh [cifsamidala]w# echo $0 -sh i tried 'pwd' below of no use. ps1="[${host}]`pwd` # " kindly let me know if missing here. thanks in avance. regards, vinod yadav your shell not bash shell , reason why won't work. ask sysadmin give unrestricted shell.

javascript - Jquery unable to return to active state on animated menu list -

i have menu list animates background position on mouseover , working. when backgroundposition: 0 menu item active. want first item in list return being active when user not hovering on other list items. this have far, movesover animated effect working im not sure how first item return being active state. jquery $(function() { //edited... //services menu background effect var timer; function invocation() { timer = settimeout(function() { $('#services li:first a').stop().animate({ backgroundposition: 0 }, 500); }, 300); } $('li.menu a').each(function() { $(this).css({ backgroundposition: -416 }); $(this).mouseover(function() { $(this).stop().animate({ backgroundposition: 0 }, 500) if ($(this).attr('id') != 's_active') { $('#services li:first a').stop().ani...

google app engine - Can you adjust how long appengine's appcfg remembers passwords? -

i'm regularly releasing google appengine application through command line utility appcfg.sh / appcfg.cmd . unfortunately, cookie stores password has short expiration time; week or less. possible extend period? why not use oauth2 token instead of using password based authentication? it more convenient , can permanently stored, no more typing passwords!

android - Emulator don't jobs correctly with dps -

i have simple layout, have 1 button. <button android:id="@+id/button1" android:layout_width="200dp" android:layout_height="80dp" android:text="button"/> i want see button scale correctly in different densities. created 3 emulators, different abstracted lcd density (120,160 , 240). when run application in tree emulators, button size bigger in each emulator. if read hight , width of button in pixels can see size right. is there problem density in emulator? the version of android ics. thank much. edit. i upload images problem. first images in 160 densities , seconds have 240. screen_with_160_screen_home screen_with_240_screen_home you can see elements ara bigger in 240, home screen. //according density differ when use dp or dip if 200dp in 120 dpi=200×120÷160=150px if 200dp in 160 dpi=200×160÷160=200px if 200dp in 240 dpi=200×240÷160=300px this dp/dip auto scale if want fixed size mean ...

java - Which JSObject should I be using? -

i'm trying make java applet interact through javascript in enclosing environment. up until now, i've been using netscape.javascript.jsobject type deal calls java functions js, i've discovered there's sun.plugin.javascript.jsobject , , sun.plugin.javascript.navig.jsobject ! i've tried finding out more these 2 other versions no avail. should stick netscape.javascript.jsobject ? i've tried finding out more these 2 other versions no avail. should stick netscape.javascript.jsobject ? yes. public interface other classes might support behind scenes.

Arrays as "movieclip" actionscript 3.0 -

my goal have multiple (animated) objects loaded in stage movieclip trought array. my current code: var vijand:array; vijand = new array ; vijand.push(new vijand(-580,-200)); vijand.push(new vijand(-500,-200)); vijand.push(new vijand(-420,-200)); (var n:int = 0; n < vijand.length; n++) { this.addchild(vijand[n]); } //not working part. load on stage. cant control animation within file(its .swf file load) (var n:int = 0; n < vijand; n++){ gotoandstop(1) } so question how can these doing animation "gotoandstop(1)" , or "gotoandstop(2)", on , on. edit: external file load it, in code public function vijand(positiex:int, positiey:int) { vijand = new loader(); vijand.load(new urlrequest("resources/vijand.swf")) this.addchild(vijand); vijand.x = positiex; vijand.y = positiey; } is need? var vijand:array; vijand = new array ; vijand.push(new vijand(-580,-200...

swing - java jlist doesn't display one of the items completely sometimes -

Image
i having problems jlist. have scrollpane , added jlist it. sometime don't see first item in list.(i seeing behavior other items in list also) i appreciate help. thanks, here code snippet -jlist creation: jallscrollpane = new jscrollpane(); jallscrollpane.getviewport().add(allnetlayer); allnetlayer.setvisiblerowcount(3); i add items jlist in following method void additemtolist(string lay) { layerinit =1; if(lay.compareto("all") ==0) { listdata.clear(); } if(lay.compareto("done") == 0) { alllay.setlistdata(listdata); jallscrollpane.updateui(); } else { listdata.addelement(lay); } layerinit =0; } gui creation: javax.swing.grouplayout jlogpanellayout = new javax.swing.grouplayout(jlogpanel); jlogpanel.setlayout(jlogpanellayout); jlogpanellayout.sethorizontalgroup( .... ...

windows - Move form without border style -

how move borderless form? tried looking on internet, nothing. lot. you can drag form using contained control, including itself. using following example, can move form clicking on canvas , dragging. same panel on form putting same code in panel's mousedown event, let create own pseudo caption bar. procedure tform1.formmousedown(sender: tobject; button: tmousebutton; shift: tshiftstate; x, y: integer); const sc_dragmove = $f012; begin if button = mbleft begin releasecapture; perform(wm_syscommand, sc_dragmove, 0); end; end;

windows - How can I draw a line in a printer that looks thinner than a pixel? -

i know gdi limitation. gdi can draw line width @ least 1 pixel. still want draw line looks thinner 1 pixel in printer. do mean can this: with clogbrush begin lbstyle := bs_solid; lbcolor := acanvas.pen.color; lbhatch := 0; end; dwstyle := ps_cosmetic or ps_alternate; acanvas.pen.handle := extcreatepen(dwstyle, 1, clogbrush, 0, nil); acanvas.moveto(x1, y1); acanvas.lineto(x2, y2); you (for example) draw line of alternating black , white pixels. @ least typical laser printer @ 600 1200 dpi, blend pretty line looks less dark. should add, however, line 1 pixel wide laser printer pretty thin. a lot here depend on printer though. example, ink jet printers, thinnest line can draw thicker, when/if quote same (or higher) resolution. lines aren't quite clean either -- in both cases, they're darkest @ center, , fade paper color, ink jet "fade" quite bit slower edges of line aren't clean.

Jquery click to show invisible div (add class) not working in Internet Explorer? -

i have "hidden object" game hot spots click appear show found object. works great in browsers except ie8 , can't figure out why. the hot spots positioned divs, set css: .hotspot { background-color: none; position: absolute; } #hs1 { width: 40px; height: 80px; top: 50px; left: 200px; } and 2, etc. there jquery swaps class on click "done" class: .done { background-color: #ffff00; border: 1px solid #ff0000; } the jquery $('#hs1').click(function(){ $('#textpanel .title').text("correct!"); $('#textpanel .body').text("blah blah"); $(this).addclass('done'); itemsleft--; updateitemsleft(); }); as said, works in other browsers. problem seems stem background-color:none -- if change initial style background-color: #ccc , works (but hidden spots not hidden...) i stuck suggestions? i guess there no value of none in background...

iframe - Track click on whole HTML page with JQUERY -

i'm trying track click on html element. with: $('html').click(function() { // action here }); but thing won't work iframe , coudn't catch iframe click, or click selectionbox http://jsfiddle.net/tyjtc/4/ this answer based on iframe content of domain, using jquery 1.7.2 , should inside of document ready http://jsfiddle.net/tyjtc/6/ html <iframe id="myframe" src='/'></iframe> js $('#myframe').contents().find('body').bind('click', function(e) { alert('clicked'); });

php - Create and load Modules in OpenCart? -

i want add model php file, in new folder in catalog/model dir. <?php class modelopaginacion extends model{ public function contargarages(){ $query = $this->db->query ("select count(*)as total `" . db_prefix . "vendors`"); return $query->row['total']; //return "29"; }//fin funcion }//fin class ?> when want load model in home.php controller whole project appear broke, cuze doesn't show on browser. , ther error generated load in home controller. when comment lines, proyect work fine. can me issue?? there couple of issues above. firstly, you're not naming model right, it's never going work. lets assume going in folder in catalog/model/tool/ called paginacion.php you start defining model as class modeltoolpaginacion extends model { then call in controller, first need load , call it $this->load->model('tool/paginacion'); $this->model_tool_paginacion...

iphone - A static library was omitted from linking -

Image
i have problem linking static library i added static library build target. , added linked library list. but link error occurred. think there not -lcocosdenshion flag in command. and set "valid architectures" "valid_archs = armv6 armv7 i386" build targets. here full log event. need help. thank help! ld /users/tae1560/library/developer/xcode/deriveddata/helloworld-avkpbeubpocaklejnbukdyudocwz/build/products/debug-iphonesimulator/helloworld.app/helloworld normal i386 cd /users/tae1560/documents/projects/daegu/helloworld/ios setenv macosx_deployment_target 10.6 setenv path "/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/...

Android: Enable/Disable Camera programmatically -

i want enable/disable camera programmatically in application. you cannot regular app. can device administrator, user has explicitly enable , available on ics. here's reference: http://developer.android.com/guide/topics/admin/device-admin.html

c# - .Net Compact Framework development on Windows Embedded CE 6.0 -

Image
i busy developing .net compact framework 3.5 application windows ce 6.0 , struggling figure out how development environment , running debug code. creating visual studio project , writing code not problem. press f5 , run puppy in actual win ce 6.0 emulator (or similar?!) getting stuck , have googled subject death , not finding tutorials/documents/help on how 'n visual studio project debugging project (or running simple hello world) in win ce 6.0. so question this. can please point me in direction of tutorial (or provide 1 selves) win ce 6.0 dev environment , running. perhaps missing , not possible connect , debugging win ce? if case, how recommend debugging compact framework code in general? the closest have gotten ce tutorial this: http://tech-stuff-home.blogspot.com/2011/03/building-workspace-for-device-emulator.html , have done steps in tutorial win ce build running, problem not connect compact framework development device created above. edit: though ce running in ...

Xcode completions, spelling checkings stopped -

Image
my xcode 4.3.2 stopped show spelling errors , completions code. way find out if there error in code - build it. xcode colores keywords such if, else, for etc. other code hasn't colored. shown few strange completions. example: cgpoint p; p.y // completion "yes" p.x // completion "xor" completions methods calls nearaly used methods. how can fix this? rebooted mac several times already, , didn't find stuff in xcode's preferences. what solve issue is: 1.) change build settings llvm 3.1 gcc 4.2 2.) go organizer>projects>(select project)> delete derived data 3.) change builds settings llvm 3.1 my syntax highlighting works again. no need restart xcode, , jump through other hoops , hurdles. hope helps me ! update : people can working step 2, if doesn't work. follow 3 steps.

unix - Why always ./configure; make; make install; as 3 separate steps? -

every time compile source, go through same 3 steps: $ ./configure $ make $ make install i understand, makes sense divide installing process different steps, don't it, why each , every coder on planet has write same 3 commands again , again 1 single job done. point of view make totally sense have ./install.sh script automatically delivered source code contains following text: #!/bin/sh ./configure make make install why people 3 steps separately? because each step different things prepare(setup) environment building ./configure this script has lots of options should change. --prefix or --with-dir=/foo . means every system has different configuration. ./configure checks missing libraries should installed. wrong here causes not build application . that's why distros have packages installed on different places, because every distro thinks it's better install libraries , files directories. said run ./configure , in fact should change always. for ex...

android - Draw bitmaps from resources over another -

i have got 2 bitmaps, background , foreground . how draw bitmap foreground on background without using canvas? solution: 1) first create bitmaps resources additional option argb_8888 bitmapfactory.options options = new bitmapfactory.options(); options.inpreferredconfig = bitmap.config.argb_8888; 2) declare bitmaps bitmap background = bitmapfactory.decoderesource(getresources(), r.drawable.background, options); bitmap foreground = bitmapfactory.decoderesource(getresources(), r.drawable.foreground, options); 3) inside ondraw() function draw graphics protected void ondraw(canvas canvas) { canvas.drawcolor(color.white); paint paint = new paint(); canvas.drawbitmap(background, 0, 0, paint); paint.setxfermode( new porterduffxfermode(porterduff.mode.src_over)); canvas.drawbitmap(foreground, 0, 0, paint); } and soxxeh said, source of information: http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/graphics/xf...

Facebook Graph API / FQL : Is it possible to know which one of two users has unfriended the other one? -

using facebook fgraph api or fql, can know if usera has unfriended userb if have usera permissions? in fact, here's i'd achieve: there 2 users whom have all permissions. friends (i can see using api). one day, see not friends anymore , i'd know which 1 of 2 has unfriended other one . possible, in way or another? i'm pretty sure best can detect they're no longer friends because they're not listed in each other's friends list. however, facebook makes point of banning application lets people know when unfriends them.

Nested attributes not being destroyed after an update validation fails in Rails -

i'm struggling head around myself hope can explain well. have form nested models. simplified version of things follows (using rails 3.0.13); #parent.rb class parent < activerecord::base has_many :children, :dependent => destroy accepts_nested_attributes_for :children, :allow_destroy => true validates_presence_of :thing validate :children_unique def children_unique errors[:base] << "you have same child listed more once!" if self.children.map{|x| [child.name, child.age]} != self.children.map{|x| [child.name, child.age]}.uniq end end #child.rb class child < activerecord::base belongs_to :parents end #parents_controller.rb class parentscontroller < applicationcontroller load_and_authorize_resource :parent #using cancan authorization. calls @parent = parent.find(params[:id]); authorize! :update, @parent; @ start of update method def update if @parent.update_attributes(params[:operation]) redirect_to @parent.a...

java - jcodec - has anyone seen documentation on this library? -

i'm trying use jcodec encode bufferedimages h264 movie. haven't been able find example code anywhere. has used library in past? haven't seen documentation, javadoc comes library contains no usage information. if have seen examples, or can provide insight please let me know. http://jcodec.org/ thanks in advance jcodec not support encoding of h.264. can use jna x264 library or ffmpeg. if choose route thread may going: how 1 encode series of images h264 using x264 c api? . [update] of version 0.1.0 jcodec supports h.264 encoding, here's simple class can use turn sequence of images h.264 video in mp4 container: public class sequenceencoder { private seekablebytechannel ch; private picture toencode; private rgbtoyuv420 transform; private h264encoder encoder; private arraylist<bytebuffer> spslist; private arraylist<bytebuffer> ppslist; private compressedtrack outtrack; private bytebuffer _out; privat...

android - How can I override TimePicker to change text color -

my view has white background, , has stay way. have timepicker on white background.everything woking fine android 2.3.3 android 4.0.3 has new timepicker style. numbers have bright color. hard see them on white background, , didn't find direct way change textcolor. don't want change background because not good. is there way override , set color of numbers black? sincerly, wolfen take @ android source styles.xml https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml you set style on activity/timepicker looks this: <style name="mytimepicker" parent="@android:style/widget.timepicker"> <item name="android:textcolor">#000000</item> </style> or maybe (3.0 , above only) <style name="myholotimepicker" parent="@android:style/widget.holo.timepicker"> <item name="android:textcolor">#000000</item> </style> the...

scala - How do I use Zookeeper as "Database" with Play Framework instead of traditional JDBC? -

i using play framework 2.0.1 in scala create application has basic stuff in model not complicated. information in model saved/requested/updated , deleted zookeeper instance. how can best go without crucially breaking play framework? the simple answer tell zookeeper not meant used general datastore/database; however, inclined believe looking mongodb. check out mongodb replica sets , election/voting . should give want want. easier manage zookeeper , more useful general application data storage needs.

ruby on rails - Setting up facebook authentication schema with existing user schema -

i want integrate facebook app through oauth have existing user schema set up. here's current schema: # table name: users # # id :integer not null, primary key # first_name :string(255) # last_name :string(255) # email :string(255) # created_at :datetime not null # updated_at :datetime not null # password_digest :string(255) # remember_token :string(255) # admin :boolean default(false) # what best way add facebook auth using rails? there still couple of different ways this. use email people login facebook establish connection between facebook account , site account. add new column users database (called uid, type string). when use oauth, hash of information user returned, including unique identifier. here's example. can store uid later use way login. regardless of these implementation choices, you'll want use omniauth gem , omniauth-facebook gem (you need ...

css - mobile web app with very long strings -

i'm trying build web app designed mobiles. have links extremely large. want break these strings if text doesn't fit, , use entire string if fits. i tried using word-wrap:break-word : .breakword { width: 100% word-wrap: break-word; } my html is: <table> <tr> <td rowspan="2" style="width:10%" >picture</td> <td colspan="2" style="width:90%" class="breakword">link</td> </tr> <tr> <td style="width:80%">info1</td> <td style="width:10%">info2</td> </tr> <tr> </tr> </table> this code doesn't fit on page - horizontal scroll bar appears. how can make text fit? if correct errors in source, work. remove width:100% style block. conflicts inline style in td , , misses semicolon colpan should colspan also, believe browsers can confused when encountering c...

objective c - iOS: Methods of ViewController subclass not visible in other classes -

i'm trying develop iphone application. things working expect , prefer. right issue i'm having when adding methods 1 of viewcontrollers methods not visible other parts of applications. when add same methods, same signature other view controllers visible. i've googled, browsed stackoverflow, reread, copy/pasted, , prayed spaghetti monster divine insight, no avail. there must minor detail, in folly overlooking. hope able me! infopageviewcontroller.h #import <uikit/uikit.h> #import "db.h" @interface infopageviewcontroller : uiviewcontroller { iboutlet uiwebview* wv; db* db; } @property (retain, nonatomic) iboutlet uiwebview* wv; -(void) reloadinfopage; @end infopageviewcontroller.m #import "infopageviewcontroller.h" @interface infopageviewcontroller () @end @implementation infopageviewcontroller @synthesize wv; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initw...

mapping - After upgrading to Nhibernate 3.2, public Property value is null though mapped private variable has value -

we upgrated nhibernate 3.2 , getting problem in following scenarios: public properties returns mapped private field value returns null // mapping <many-to-one lazy="no-proxy" name="agent" cascade="none" column="`agentid`" not-null="false" access="field.camelcase-underscore"/> // property declared follow private agent _agent; public agent agent { get{ return _agent; } } after getting entity session, in quick watch can see value _agent, agent property returns null i think agent property should virtual since nh needs create proxy handle "no-proxy" setting in correct way.

Return function when jquery event triggers -

how can force function wait event trigger? want confirmation box, user can not until he/she answers question. something this: function ask() { if ($('a').click(function())) { return true; } return false; } ps: know how use "confirm()" in js. i'm writing new sample of it! work 2 functions: function ask() { if ($('a').click(function())) { execute(); } } function execute(){ }

ruby - Swapping keys and values in a hash -

in ruby, how swap keys , values on hash? let's have following hash: {:a=>:one, :b=>:two, :c=>:three} that want transform into: {:one=>:a, :two=>:b, :three=>:c} using map seems rather tedious. there shorter solution? ruby has helper method hash lets treat hash if inverted. {a: 1, b: 2, c: 3}.key(1) => :a if want keep inverted hash, hash#invert should work situations. {a: 1, b: 2, c: 3}.invert => {1=>:a, 2=>:b, 3=>:c} but... if have duplicate values, invert discarding last of values. likewise key return first match. {a: 1, b: 2, c: 2}.key(2) => :b {a: 1, b: 2, c: 2}.invert => {1=>:a, 2=>:c} so.. if values unique can use hash#invert if not, can keep values array, this: class hash # invert not lossy # {"one"=>1,"two"=>2, "1"=>1, "2"=>2}.inverse => {1=>["one", "1"], 2=>["two", "2"]} def safe_i...

java - Binary file reader byte[] to string conversion gone wrong? -

i'm trying display whats in file header should text (the rest of file binary) when print strtemp this: strtemp: ?????? here code. string filename = "test.file"; uri loguri = new file(filename).getabsolutefile().touri(); bufferedinputstream in = new bufferedinputstream(new fileinputstream(new file(loguri))); byte[] btemp = new byte[14]; in.read(btemp); string strtemp = ""; for(int = 0; < btemp.length; i+= 2) { strtemp += string.valueof((char)(((btemp[i]&0x00ff)<<8) + (btemp[i+1]&0x00ff))); } system.out.println("strtemp: " + strtemp); how strtemp whats in file? , display properly? as can see constructor summary of http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/string.html can initialize string bytes directly. also should supply charset have in source file.

php - Kohana - how to create form without refresh? -

how create jquery + ajax form without refresh? controller , views: http://pastebin.com/gl5xvxfz in "clear" php create this: $(document).ready(function(){ $("form#submit").submit(function() { var note = $('#note').attr('value'); $.ajax({ type: "post", url: "add.php", data: "note="+ note, success: function(){ $('form#submit').hide(function(){$('div.success').fadein();}); } }); return false; }); }); in add.php file insert database. there more complicated ways of doing example detecting ajax request in action , if detected print out javascript response. way is javascript function postform(note){ $.ajax({ url : '/controller/action', type : 'post', data : 'note='+note, success : function(jsn){ var json = $.parsejson(...

yii ajax renderpartial with form validation -

i have dropdown list in yii depending on id renders additional fields (that requests other models). how can use $form field in (it's yii-bootstrap) can have validation messages (via $form->errorsummary() ) , not implementing own javascript messages? i'm not entirely sure asking for, seems it's related rendering form fields/errors , validation. far specifing custom selector fields goes, chthml::activedropdownlist , it'll let define drop list items accordingly. validation, can validate drop down making have it's own validation rule , error described here: custom model validators . allow use chtml::errorsummary($model) dropdown return appropriate error message if it's validation fails... cheers, fy

c# - Verifying a delegate was called with Moq -

i got class gets argument delegate. class invokes delegate, , want unit test moq. how verify method called ? example class : public delegate void foo(int number); public class { int a=5; (foo myfoo) { foo(a); } } and want check foo called. thank you. what using anonymous function? can act inline mock here, don't need mocking framework. bool isdelegatecalled = false; var = new a(a => { isdelegatecalled = true}); //do assert.true(isdelegatecalled);

php - codeigniter restful web service + database query -

forgive me upcoming question, lol. (im terribly new @ this) i have read tutorial . i've set auto connect database editing autoload.php file. i'm creating own controller called dsapi.php(code below), want ad_get() function retrieve data simple database can use in android app have developed. i had @ guidelines page and tried write im pretty clueless can see. close want? class dsapi extends rest_controller { function ad_get() { **$query = $this->db->query('select index, title, detailed ads'); foreach ($query->result_array() $row) { echo $row['index']; echo $row['title']; echo $row['detailed']; } $this->response($query, 200);** } function ad_put() { // create new user , respond status/errors } function ad_post() { // update existing user , respond status/errors } function ad_delete() ...

sql server - Restore to remote database from my local machine -

i registered @ go daddy , want restore database there local machine. tool provide me doesn't work unless it's them. i'm trying restore local sql server, when browse can't restore local files of remote database. they're intentionally preventing users restoring backups "foreign" them in order satisfy obscure microsoft security recommendation. you have perform schema comparison , data comparison between local machine , empty database on hosting generate scripts re-create of objects , data. (having scripts available in source control storage helpful.)

c# - Public fields/properties of a class derived from BindingList<T> wont serialize -

i'm trying serialize class derives bindinglist(floor) , floor simple class contains property floor.height here's simplified version of class [serializable] [xmlroot(elementname = "custombindinglist")] public class custombindinglist:bindinglist<floor> { [xmlattribute("publicfield")] public string publicfield; private string privatefield; [xmlattribute("publicproperty")] public string publicproperty { { return privatefield; } set { privatefield = value; } } } i'll serialize instance of custombindinglist using following code. xmlserializer ser = new xmlserializer(typeof(custombindinglist)); stringwriter sw = new stringwriter(); custombindinglist clist = new custombindinglist(); floor fl; fl = new floor(); fl.height = 10; clist.add(fl); fl = new floor(); fl.height = 10; clist.add(fl); fl = new floor(); fl.height = 10; clist.add(fl); ser.serialize(sw, clist); string teststrin...

Android onNewIntent Uri is always null -

in activity's onnewintent() method, getintent().getdata(); null. goes method before going oncreate() or other lifecycle function. returns here browser, don't know why getintent().getdata() null though. this activity starts browser context.startactivity(new intent(intent.action_view, uri.parse(requesttoken.getauthenticationurl()))); and returns here @override public void onnewintent(intent intent){ super.onnewintent(intent); uri uri = getintent().getdata(); if (uri != null && uri.tostring().startswith(twitterconstants.callback_url)) {...} } but uri null. manifest stuff: <activity android:name="myapp.mypackage.tweetformactivity" android:configchanges="orientation|keyboardhidden" android:label="@string/app_name" android:launchmode="singleinstance" android:screenorientation="portrait" android:theme="@android:style/theme.black.notitleba...

javascript object always null -

here code: myext = {}; myext.panel = function (config){ var d = document.createelement("div"); /*do (a lot) config , d here // lot of code here */ return { div:d, events:e, customattribs:ca }; } here caller: var p = new myext.panel({ id:'parent', events:{ onload:function(){ alert("onload"); } }, //more configs }); if do console.log(p) i null. please me debug problem. automatic semicolon insertion has turned return value of function from: return { div: d, events: 3, customattribs:ca }; into: return; it better if stored value want return in variable, , return object: var ret; ret = { div: d, events: e, customattribs: ca }; return ret;

windows installer - Packing multiple .exe in single .msi package -

i trying put multiple .exe in single .msi package , should installed 1 one. lets have a.exe, b.exe , c.exe on clicking on .msi package a.exe should installed , .msi should wait after installation of a.exe should trigger b.exe. on successful installation of b.exe , c.exe should triggered installation. the .exe files (a.exe , b.exe , c.exe) standard installables (for e.g.codesourcery, flash tools, iar workbench etc). please let me know how achieve , tools need. regards horaira advanced installer has dedicated support this. it's commercial tool, license required. as free solution, can try using wix create msi. can launch exe packages using custom actions .

node.js - Getting npm error while installing xmldom -

i getting npm error below npm install xmldom npm http https://registry.npmjs.org/xmldom npm err! error: connect econnrefused npm err! @ errnoexception (net.js:670:11) npm err! @ object.afterconnect [as oncomplete] (net.js:661:19) npm err! npm err! if behind proxy, please make sure the npm err! 'proxy' config set properly. see: 'npm config' npm err! npm err! system windows_nt 6.1.7601 npm err! command "c:\program files (x86)\nodejs\\node.exe" "c:\program file s (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "xmldom" npm err! cwd c:\users\panugasu npm err! node -v v0.6.18 npm err! npm -v 1.1.21 npm err! syscall connect npm err! code econnrefused npm err! message connect econnrefused npm err! errno {} npm err! npm err! additional logging details can found in: npm err! c:\users\panugasu\npm-debug.log...

html list <ol> breaking when user presses enter -

i have contenteditable div element contains list using <ol> . if user selects somewhere else not <li> new <li> item not created. if user presses enter twice after creating list no <li> item created. how force lines in div element <li> item? i dont have fiddle account if add contenteditable tag example here can see/test in action http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_lists the effect of contenteditable varies browser, behavior described in question common when list inside editable area, rather declared editable element. reason appears since enclosing element editable, implementors thought there should way out of list, e.g. add content after it. if change single contenteditable block like <div contenteditable> stuff <ol><li>test</li></ol> other stuff </div> to 3 such blocks, <div contenteditable> stuff </div> <ol contenteditable><li>test</li>...