Posts

Showing posts from January, 2012

mysql - Where are Custom Menus saved in the Database for Wordpress 3.0? -

i've been searching , searching sql database in phpmyadmin can't seem find custom menus stored in database. know it's stored? have large menu takes forever create. i'm in development , rather recreating in production want try , copy sql on see if works. thanks! the actual menu titles, ids, , names stored in wp_terms table.

javascript - Possible to style a select slider with JS or JQuery? -

i can't find way style scrollbar of drop down menu, solutions divs not elements. have tried javascript , jquery plugins unsuccessful. you can see issue in question here ( http://liquor.com/asp-test ) - click drop down under type of alcohol , you'll see scrollbar wish style. this not possible, except in ie, unless emulate drop down menu using div you've mentioned. scrollbars considered part of browser chrome.

c# - Why does my installer always prompt for reboot -

i want reboot when uninstalling. fragment wix file: <installexecutesequence> ... <custom action="cleanregistry" sequence="7100">remove~="all" , not upgradingproductcode</custom> <schedulereboot sequence="7200">remove~="all" , not upgradingproductcode</schedulereboot> </installexecutesequence> running generated msi produces following log: msi (s) (48:7c) [10:19:29:951]: skipping action: cleanregistry (condition false) msi (s) (48:7c) [10:19:29:951]: doing action: schedulereboot how possible same condition evaluates false true? schedulereboot ever ignore condition? edit: trying use condition reboot~="force" conditionally execute command when reboot has been requested customaction. condition never evaluating true , command not being run. property being set call msisetproperty custom action. either custom action not working or have made mistake in condition! suggestions? ...

c# - Correct way to Switch between Dev, Test and Prodcution Services in Builds -

i have client side app (wpf) hits web services. when running in dev want hit dev version of these web services. when running in test environment want hit test version of services. wise production. since these values in app.config file best way switch between them? another single config file way along lines of: <add key="service-dev" value="serviceurl"/> <add key="service-uat" value="serviceurl"/> <add key="service-prod" value="serviceurl"/> if app knows environment it's running in pull 1 need. up though. i've used multiple config approach deployment scripts deploy correct file requested deployable environment.

c - gdb: set a breakpoint for a SIGBUS handler -

i'm trying debug simple stop-and-copy garbage collector (written in c) using gdb. gc works handling sigbus. i've set breakpoint @ top of sigbus signal handler. i've told gdb pass sigbus program. however, doesn't appear work. the following program (explained inline) shows essence of problem: #include <stdio.h> #include <sys/mman.h> #include <assert.h> #include <signal.h> #define heap_size 4096 unsigned long int *heap; void gc(int n) { signal(sigbus, sig_dfl); // debugging printf("gc time\n"); } int main () { // allocate twice required heap size (two semi-spaces) heap = mmap(null, heap_size * 2, prot_read | prot_write, map_anon | map_shared, -1, 0); assert (heap != map_failed); // 2nd semi-space unreadable. using "bump-pointer allocation", sigbus // tells out of space , need gc. void *guard = mmap(heap + heap_size, heap_size, prot_none, map_anon | map_shared | map_f...

.net - Registry.LocalMachine.OpenSubKey failing intermittently -

i have code ( winforms app .net 2.0 ) registrykey regkey=registry.localmachine.opensubkey@"software\cpaperless\ttc\settings", false); this code failing every once in while on win7 , vista when uac on ( failing mean key null.) note key existing , can see in registry furthermore part of product uses same key in hklm code in c++ , works every time long lretval = regopenkeyex(hkey_local_machine, "software\cpaperless\ttc\settings", 0, key_read, &hkeyttc_lm); what going wrong here. has seen behaviour before tia possible registry virtualization issue?

.net - How do I catch an exception in a GUI thread? -

an exception thrown in user control based on picture box, causing show typical error image (red x). since gui thread caught , handled exception itself, cannot find out exception occurred , debug. i'm wrapping whole onpaint code in try-catch, , able debug code, found quite tedious wondered if there way break debugger gui thread exception. it works way default. ui thread exception handling method controlled application.setunhandledexceptionmode(). default unhandledexceptionmode.catchexception threadexception event raised and, default, creates threadexceptiondialog. however, if debugger attached overrides mode. exception unhandled if there no active catch clause. debugger stop, allowing diagnose problem. writing own try/catch, prevent working. do beware onpaint() can special, particularly picturebox. has try/catch clause, catching unhandled exception , painting red cross. bit unusual necessary because supports imagelocation property. lets display images pote...

mysql - stored procedure -

in below procedure want set title_id @v_title_id variable can use in procedure. ideas thanx in advance. i'm using innodb engine type. delimiter // drop procedure if exists sp_title_splitgenres // create procedure sp_title_splitgenres ( p_genre_id int, p_genre_str varchar(2000) ) begin set @v_stringseperator = '::::' ; set @v_title_id = (select title_id filmo_title_genre genre_id = p_genre_id); while length(trim( p_genre_str )) > 0 set @v_curr_str := (select substring_index( p_genre_str, @v_stringseperator, 1 )); set p_genre_str = (select ltrim(trim(leading concat(@v_curr_str ,@v_stringseperator) p_genre_str)) ); create temporary table filmo_title_genre_temp ( title_id int(11) not null, genre_id int(11) not null, sequence_num int(11) not null default '0', primary key (title_id,genre_id,se...

Cassandra atomic reads/writes within a single ColumnFamily -

cassandra's front page http://incubator.apache.org/cassandra/ states that: cassandra guarantees reads , writes atomic within single columnfamily. what mean? sounds means batch_insert() , batch_mutate() of two different rows, in same cf atomic , if operation on 1 of rows fails, whole operation fails. sounds true... correct? i have answer jonathan ellis, cassandra maintainer: it's correct, if understood correctly. should remove since it's confusing written. what means is, if write given row acked, eventually, all data updated in row available reads. no, it's not atomic @ batch_mutate level @ list level.

xml - Oracle XSL processor expanding namespaces -

i generating , validating xml , experiencing problem oracle expands full namespace prefix. source document may this: <pcy> <tlist> <currtrn> <txn_a>1</txn_a> <txn_b>2</txn_b> ... the transform looks this: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:sc="http://www.mycompany.com/schemaalpha" xmlns:pl="http://www.mycompany.com/schemabeta"> <xsl:template match="/"> <pcyitem> <pl:maintlist> <pl:currenttrnitem> <sc:primarytrnid> <xsl:value-of select="/pcy/tlist/currtrn/txn_a"/> </sc:primarytrnid> <sc:secondarytrnid> <xsl:value-of select="/pcy/tlist...

jquery - Reload single jqGrid row? -

how can reload single jqgrid row? we know how reload entire grid - want update single row when know data in row has changed. if hold data on server , server support filtering of data ( single of advance searching ) can use same url use in jqgrid manual jquery.ajax calling. should set filter id equal row need refresh. on successful response server can use setrowdata or delrowdata update row contain or delete row.

ruby on rails - Using Authlogic with a User model that isn't called "User" -

i have application tracks people, people are, possibly, users of product. i'd rather have model called person (rather user), can't seem figure out how indicate authlogic i'm using person instead of user. i'm sure it's somewhere obvious i'm not seeing, i've been pouring on things hours , i'm giving up. :-) i think can add acts_as_authentic in person model, , should work fine. if face says user in documentation, change them person

php - PHPDoc: @return void necessary? -

is necessary this: /** * ... * * @return void */ i have quite few methods don't have return value, , seems redundant put in comment. considered bad form leave out? if makes clear documentation, leave in, isn't strictly necessary. it's entirely subjective decision. personally, leave out. edit stand corrected. after little googling, wikipedia page says: @return [type description] tag should not used constructors or methods defined void return type. the phpdoc.org website says: @return datatype description @return datatype1|datatype2 description the @return tag used document return value of functions or methods. @returns alias @return support tag formats of other automatic documentors the datatype should valid php type (int, string, bool, etc), class name type of object returned, or "mixed". if want explicitly show multiple possible return types, list them pipe-delimited without spaces (e.g. "@retur...

Problem displaying related foreignkey data in Django Admin screen -

to display foreignkey data in admin list view, created callable: def next_date(self): evdateobj = eventdate.objects.filter(event__id__exact=self.id) .exclude(event_date__lt=datetime.date.today()) .order_by('event_date')[:1] return evdateobj this shows in list view as: [<eventdate: 25 september 2010>] which unicode string eventdate model (25 sept 2010), django-generated object stuff around it: [< eventdate ______ >] if modify callable return statement try , date itself: return evdateobj.event_date or return evdateobj.event_date.strftime("%d %b %y") the admin list view shows: (none) any thoughts? unsure how proceed because can desired object, cannot access of properties without triggering "(none)" result. have tried: evdateobj = eventdate.objects.get(event__id__exact=self.id) .exclude(event_date__lt=datetime.date.today()) .order_by('event_date')[:1] objects.filter(...

iphone - superview and parentviewcontroller nil after adding a subview -

i think i'm missing fundamental , want ask community help. i'm building app based around basic iphone utility application. mainview , flipsideview share elements have created separate viewcontrollers , nib files pieces. in order have done following: 1. created viewcontroller called searchdateviewcontroller file's owner of searchdateview.xib 2. searchdateview.xib uiview uilabel inside, view wired correctly 3. inside both mainviewcontroller.m , flipsideviewcontroller.m add subview folllows: - (void)loadview{ [super loadview]; searchdateviewcontroller = [[searchdateviewcontroller alloc] initwithnibname:@"searchdateview" bundle:nil]; [[searchdateviewcontroller view] setframe:[searchdateview frame]]; [[self view] addsubview:[searchdateviewcontroller view]]; ... } everything displays , works fine. depending on actions happen in each of main , flipside views uilabel of nib changed. however, wanted different if searchdateviewcontroller loaded main...

iphone - Reachability Guide for iOS -

has found halfway decent guide implementing reachability on ios? i have implemented reachability this. download https://developer.apple.com/library/content/samplecode/reachability/introduction/intro.html , add reachability.h , .m project. add systemconfiguration framework project. #import "reachability.h" want use it. use code. -(bool)reachable { reachability *r = [reachability reachabilitywithhostname:@"enbr.co.cc"]; networkstatus internetstatus = [r currentreachabilitystatus]; if(internetstatus == notreachable) { return no; } return yes; } when want check reachability... if ([self reachable]) { nslog(@"reachable"); } else { nslog(@"not reachable"); } here example project made. http://dl.dropbox.com/u/3656129/reachabilityexample.zip

Javascript parses in some way the string parameters of functions? -

when try pass string function so i="file:///bla/bla/bla"; fade(i); i uncaught syntaxerror: unexpected token : so tried passing literal in function f("img1.jpg"); , got uncaught referenceerror: img1 not defined (anonymous function) what going on? (note kind of new in js) in particular: timeout = 3; var fadetime = 5; var curr = 0; var fadedelta = 100/(fadetime*30); var opac = 100; //var fadedelta = 100/(fadetime*3); //prelaod images have them there var namearr = new array( "img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg"); var imgarr = new array(); var = 0; for( = 0; i<2 ; i++) { var tmp = new image() tmp.src = namearr[i]; imgarr.push(tmp); } function setopacity(image, op) { if(typeof(image.filters) != 'undefined' ) { image.filters.alpha.opacity = op; } else { image.style.opacity = op/100; } } function fadein(isrc) { var locimg = document...

linux - C++ linker errors, Undefined references to Items that should be referenced from a Share Object -

i building library, called physgameengine, aid in building games. game library links against several libraries, including: ogre3d, bullet physics , sdl, in library files libogremain-1.6.5.so, libbulletcollision.a, libbulletdynamics.a, libbulletsoftbody.a, libsdl-1.2.so.0. library/shared object appears build fine in ubuntu 9.10, using gcc , code::blocks. build fine on windows mingw , code::blocks. in windows can make games compile/link using library built fine, programs run , expect to. in ubuntu when try compile/link game uses library making lots of undefined reference errors. none functions or objects in library built, rather items library calls. here example of errors get. > ||warning: libogremain-1.6.5.so, needed ../physgameengine/bin/ubuntudebug/libphysgame.so, not found (try using -rpath or -rpath-link)| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::root(std::basic_string<char, std::char_traits<char>, std::allocator<char...

Why doesn't Java allow to throw a checked exception from static initialization block? -

why doesn't java allow throw checked exception static initialization block? reason behind design decision? because not possible handle these checked exceptions in source. not have control on initialization process , static{} blocks cannot called source surround them try-catch. because cannot handle error indicated checked exception, decided disallow throwing of checked exceptions static blocks. the static block must not throw checked exceptions still allows unchecked/runtime-exceptions thrown. according above reasons unable handle these either. to summarize, restriction prevents (or @ least makes harder for) developer building can result in errors application unable recover.

php - Syntax for rendeing a zend form in a non zend project -

i'm using zend form in non-zend project , i'm able access zend_form fine custom class custom_form . in file want render form, create instance of form, i'm not sure how render it. $form = new custom_form(); //how render form here var_dump($form); //var_dump looks busy couldn't find info this should work, need view script , call render(); method. $view = new zend_view(); $view->doctype('xhtml1_transitional'); $form = new custom_form(); $form->setview(new zend_view()); echo $form->render();

iphone - How to catch if an view or UITextField enters editing mode? -

i've subclassed uitextfield , inside that, need know if text field in editing mode or not. when editing mode changes yes/no need notified somehow. tried overwrite setter of editing property, doesn't seem work. there else? you can event in textfield's delegate using textfielddidbeginediting: method. alternatively can add observer listen uitextfieldtextdidbegineditingnotification notification.

algorithm - How to compute the absolute minimum amount of changes to convert one sortorder into another? -

goal how encode data describes how re-order static list 1 order order using minimum amount of bytes possible? original motivation originally problem arose while working on problem relaying sensor data using expensive satellite communication. device had list of 1,000 sensors monitoring. sensor list couldn't change. each sensor had unique id. data being logged internally eventual analysis, thing end users needed daily sensor fired in order. the entire project scrapped, problem seems interesting ignore. talked "swaps" because thinking of sorting algorithm, it's overall order that's important, steps required arrive @ order wouldn't matter. how data ordered in sql terms think of this. **initial load** create table sensor ( id int, last_detected datetime, other stuff ) -- fill table ids of sensors location day 0: select id sensor order id (initially data sorted sensor.id because known value) day 1: select id sensor order last_detected day...

development environment - How to get an outline view in sublime texteditor? -

how outline view in sublime text editor windows? the minimap helpful miss traditional outline (a klickable list of functions in code in order appear quick navigation , orientation) maybe there plugin, addon or similar? nice if can shortly name steps neccesary make work. there duplicate of question on sublime text forums. hit ctrl + r , or cmd + r mac, function list. works in sublime text 1.3 or above.

groovy - Default Grails '/' controller mapping not resolving properly -

this 1 has been driving me crazy today. since upgrading grails 1.2 , weblogic 10.3 default root mapping "/" stopped working. here's have... i have url mapping: "/"(controller:"igive", action:"index" ) i have controller named igivecontroller index closure def index = { render "foo" } when go application running in embedded tomcat , jetty http://localhost:8080/mycontext/ "foo" returned property. when build war , deploy weblogic 10.3 404. i downgraded grails 1.1.2 , still didn't work on weblogic 10.3 error more descriptive could not open servletcontext resource [/web-inf/grails-app/views/index.gsp] so seems it's ignoring url mapping "/" other url mappings deeper working. clues?? i think more related weblogic - seeing same on weblogic 9.2 - not on tomcat or jetty. doesn't hit urlmapping: "/"(controller: 'home', action: 'index') i think we...

iphone - Accelerometer detecting side to side movements -

can please give me example of how detect if iphone moving left or moving right. long version of shake want app able know if users arm going right or left. imagine hand window wiper phone @ end any ideas? thanks, sam :p that acceleration.x value. imagine 3 lines going through iphone: 1) line perpendicular iphone screen , going through it, z. 2) horizontal , parallel line screen, x (what you're looking for). 3) vertical , parallel line screen, y. so, moving iphone left or right generate changes in x graph. moving iphone or down generate changes in y graph. moving iphone forward or backward generate changes in z graph. hope helps grasp accelerometer's concept, ~ natanavra.

c# - auto generate javascript to update client html compared to previous html? -

do think difficult write framework mvc compares last html output current html want output, , instead of sending entire html, figure out has changed , generate js code updating compared previous html? (presuming nothing manually changed on client using js)... maybe idea codeplex project? or maybe exists? if so, tell. thanks. i think it's interesting question, 1 without practical solution.. if understand correctly want generate diff current dom new one, , want generate change script (which javascript executed client side) on server. the issue in order server generate diff, needs know previous dom structure in order compare new 1 (i.e. new html page) the ways can think of are: 1. client sends full current page or representation of it. 2. server stores copy of previous page. the problem #1 you've negated performance benefit it. sending full page server bad or worse sending server client. can achieve same effect requesting full page body via ajax , replacing...

facebook - How to publish LIKE feature for Photo/Video using object_id we get from Photo/Album/Video table -

how publish feature photo/video using object_id photo/album/video table. comments.add has object_id, through can publish comments on photo/album/video. how same. thanks in advance :-) right can use graphapi 'like' posts. user can photos, videos, etc.

php - best solution for upload progress bar for shared server user -

i have seen lots of solution, best stable solutin no-administrator user cant config server. found of these: using apc extension perl cgi instead of php flash based using js framework im not sure use extension, not understand perl control on process, , totally not use flash in mywebsite because significant percentage of user have not flash. , im not want use framework because of growing mywebsite size. i think must better ajax | js | php portable solution. you have listed possibilities know of - ajax based uploads utilize flash in process, far know (e.g. uploadify ). if ask me, go flash. users have it, , it's least hassle set up. by way, using javascript framework idea, independently question. increase in project size insignificant (20-100 kb) , libraries need loaded once. make lot of things easier do, , offer cross-browser consistent foundation user interface. if use lot of javascript, you're better off framework.

database - Use Django (or Ruby on Rails) on server without root access? -

is possible develop multi-client web-based crud applications (with django, ruby on rails, etc.) on server on don't have root access? our machines @ school, on have regular account, run web server, , can publish regular html pages , cgi scripts. how easy/difficult/impossible install django database support there in home directory , simple example running? example started, i'm imagining user may create account, log in , leave message. we don't have mysql etc., i'd have install in home directory, if possible. any tips or appreciated. it possible install , run django without root access, although it's far simple. i doubt you'd able run mysql. however, sqlite work fine, requires access file, can live in home directory. assuming you're running python 2.5+, sqlite libraries included. since can run cgi scripts, should able run django via fastcgi. see the fastcgi deployment documentation details. in terms of django itself, needs in pythonpa...

MySQL select query return unrelated output -

select updatedate, id,cssn,clname,cfname,cdob,cdod,ccity,cstate,chospital,ccurstatus,cmmrcashworker,ctelephone med_patient ccurstatus!='completed' , cmmrcashworker = '2' , chospital = '1234' or chospital1 = '1234' or chospital2 ='1234' , updatedate between '1/30/2010' , '1/28/2010' order id desc' output: updatedate chospital chospital1 chospital2 01/15/2010 1234 01/15/2010 1234 but acutally knowledge query must return empty row. where mistake in query? try adding parentheses chospital condition, otherwise or not expect: ccurstatus!='completed' , cmmrcashworker = '2' , (chospital = '1234' or chospital1 = '1234' or chospital2 ='1234') , updatedate between '1/30/2010' , '1/28/2010' order id desc' also: ... updatedate between '1/30/2010' , '1/28/2010' ... ^ doing string compare rather date comparison, try changing...

How to run a scheduler/ timer on server startup in Grails -

i have timer class scheduled execute every 5 mins. want start timer class when tomcat starts first time. best approach in grails? thank you. jay chandran if need more flexibility timer, can use quartz plugin , configure cron job: class mytimerjob { static triggers = { // cron trigger every 5 minutes cron name: 'mycrontrigger', cronexpression: '0 */5 * * * ?' } def execute = { // perform task } } to start quartz on application startup (like jared said: not on tomcat startup), make sure grails-app/conf/quartzconfig.groovy has following: quartz { autostartup = true } autostartup = true default, won't need change there. using plugin save having handle timer logic yourself.

python - in numpy what is the multi dimensional equivalent of take -

i have bit of code def build_tree_base(blocks, x, y, z): indicies = [ (x ,z ,y ), (x ,z+1,y ), (x ,z ,y+1), (x ,z+1,y+1), (x+1,z ,y ), (x+1,z+1,y ), (x+1,z ,y+1), (x+1,z+1,y+1), ] children = [blocks[i] in indicies] return node(children=children) where blocks 3 dimensional numpy array. what i'd replace list comprehension numpy.take, take seems deal single dimension indices. there take work multidimensional indices? also know transpose, slice , reshape, slow i'm looking better option. how taking 2x2x2 slice, flat ? import numpy np blocks = np.arange(2*3*4.).reshape((2,3,4)) i,j,k = 0,1,2 print [x x in blocks[i:i+2, j:j+2, k:k+2].flat] ( flat iterator; expand this, or np.fromiter() , or let node iter on it.)

formatting - Recording Mono on iPhone in IMA4 format -

i'm using speakhear sample app on apple's developer site create audio recording app. i'm attempting record directly ima4 format using kaudioformatappleima4 system constant. listed 1 of usable formats, every time set audio format variable , pass , set it, 'fmt?' error. here code use set audio format variable: #define kaudiorecordingformat kaudioformatappleima4 #define kaudiorecordingtype kaudiofilecaftype #define kaudiorecordingsamplerate 16000.00 #define kaudiorecordingchannelsperframe 1 #define kaudiorecordingframesperpacket 1 #define kaudiorecordingbitsperchannel 16 #define kaudiorecordingbytesperpacket 2 #define kaudiorecordingbytesperframe 2 - (void) setupaudioformat: (uint32) formatid { // obtains hardware sample rate use in recording // audio format. each time audio route changes, sample rate // needs updated. uint32 propertysize = sizeof (self.hardwaresamplerate); osstatus err = audiosessiongetproperty ( kaudiosessionprope...

c / c++ disable access to files -

is possible disable access of program files completely? because don't want have kind of access files on system, possible compile doesn't have access file stream or run someway cant access files? the closest you'd able come run program in chroot jail.

using primary key in asp.net mvc urls -

i keep hearing shouldn't using primary keys in asp.net mvc url for example: /users/edit/1243 what issue here? what alternative, putting in user names? want unique, seems primary key cleanest option thoughts? i don't see problem putting primary key on url (neither creators of stack overflow , countless other sites either matter). 1 thing done supply primary key , supply seo , user friendly "slug" human-readable title of data identifier links to. if intend identify resource (in case, user account) have supply unique identifier on url. if decide not use primary key must still choose identifier cannot change.

ruby on rails - Using a normal text link instead of a form -

i writing small application using rails 3. in 1 part of there link (should link) if clicked adds connection between 2 people (see below). what needing use normal text link instead of form, how done? <%= form_for([@profile, @contact]) |f| %> <p><%= f.hidden_field :profile_id, :value => params[:profile_id] %></p> <p><%= f.hidden_field :friend_id, :value => profile.id %></p> <p><%= f.submit %></p> <% end %> something like: <%= link_to 'link these persons', [@profile, @contact], :method => :post, :profile_id => params[:profile_id], :friend_id => profile.id %>

c - strndup call is currupting stack frames -

i have seen strange behavior "strndup" call on aix 5.3 , 6.1. if call strndup size more size of actual source string length, there stack corruption after call. following sample code issue can come: int main () { char *dst_str = null; char src_str[1023] = "sample string"; dst_str = strndup(src_str, sizeof(src_str)); free(dst_str); return 0; } does have experienced behavior? if yes please let me know. as per observation, there must patch os issue got fixed. not patch if @ there any. please throw light. thanks & regards, thumbeti you missing #include <string.h> in code. please try that—i sure work. reason without #include <string.h> , there no prototype strndup() in scope, compiler assumes strndup() returns int , , takes unspecified number of parameters. wrong. (i assuming you're compiling in posix compliant mode, strndup() available you.) for reason, useful compile code warnings enabled. if...

Java unreported exception -

while learning java stumble upon error quite often. goes this: unreported exception java.io.filenotfound exception; must caught or declared thrown. java.io.filenotfound example, i've seen many different ones. in particular case, code causing error is: outputstream out = new bufferedoutputstream(new fileoutputstream(new file("myfile.pdf"))); error disappears , code compiles & runs once put statement inside try/catch block. it's enough me, not. first, examples i'm learning not use try/catch , should work nevertheless, apparently. whats more important, when put whole code inside try/catch cannot work @ all. e.g. in particular case need out.close(); in finally{ } block; if statement above inside try{ } , finally{} doesnt "see" out , cannot close it. my first idea import java.io.filenotfound; or relevant exception, didnt help. what you're referring checked exceptions , meaning must declared or handled. standard cons...

sql server - What is the purpose of "::" in T-SQL -

in (non-english) book on t-sql (sql server 2005) read about: select * ::fn_helpcollations() though, execution of without " :: " select * fn_helpcollations() in sql server 2008 r2 gives same result. what " :: " mean in t-sql? from msdn : however, when call sql server built-in functions return table, must add prefix :: name of function: select * ::fn_helpcollations() looks can omit :: in sql server 2005 , 2008. :: syntax supported backward compatibility.

perl - How can I properly install Win32::GuiTest? -

i trying use win32::guitest , windows xp , perl version 5.8.6. i getting following error: can't locate loadable object module win32::guitest in @inc (@inc contains: c:/perl/lib c:/perl/site/lib .) @ e:\a\simply.pl line 259 compilation failed in require @ e:\a\simply.pl line 259. begin failed--compilation aborted @ e:\a\simply.pl line 259 i tried following instructions win32-guitest-1.3 . tried install: i created c:\temp , downloaded zip file , extracted contents , placed in c:\temp , gave command c:\temp>ppm ppm> install c:\temp\win32-guitest.ppd it giving error as... error: no suitable installation target found package win32-guitest. if use package win32-guitest-1.56 , giving error error: package 'win32-guitest' not found. please 'search' first. and if use command c:\temp>ppm ppm> install win32::guitest i error as... error: no valid repositories: error: 501 protocol scheme '' not supported error: 501 ...

c# - How to make json array parsing work on the server side -

i have action on server side: public void action(container container) { } where container is: public class container { public string[] arr; } from client side, i'm invoking action in way below: $.post("controller/action", { arr: "abc" }, null, "json"); after this, arr in container contains 1 element " abc ". but, while invoking action way below: $.post("controller/action", { arr: ["abc", "def"] }, null, "json"); the json array not deserializing on server side. arr in container null . how make simple thing work ? regards if using jquery 1.4 try this: $.ajax({ url: 'controller/action', type: 'post', data: { arr: [ 'abc', 'def' ] }, traditional: true, datatype: 'json' }); notice traditional flag . or if prefer continue using $.post() : $.post( 'controller/action', $.param({ arr: [ ...

sql - Grouping data in the select statement -

i have huge data needs classifed in different groups while retrieving. each group has different condition. don't want retrieve them separately. want know number of items in each group using single sql statement. for example, pseudo code this: select count(issueid) issue1_count if(condition1), count(issueid) issue2_count if(condition2), count(issueid) issue3_count if(condition3) table1, table2, tabl3 common_condition1 , common_condition2; can me in making oralce query this... put this: select sum(case when condition1 1 else 0 end) issue1_count, sum(case when condition2 1 else 0 end) issue2_count, sum(case when condition3 1 else 0 end) issue3_count, table1, table2, tabl3 common_condition1 , common_condition2;

c++ - Using DYLD interposing to interpose class functions -

i have succesfully using dyld -macosx- interpose standard c functions third party application, getting important information workarounds does. need replace function of class. the function want override qstring::append(..., ..., ...), each time string appended -the whole application uses qstring-, find out. is there way? here's code have. // libinterposers.c #include <stdio.h> #include <stdint.h> #include <unistd.h> #include <fcntl.h> #include <stdarg.h> #include <dlfcn.h> #include <stdlib.h> typedef struct interpose_s { void *new_func; void *orig_func; } interpose_t; int my_open(const char *, int, mode_t); int my_close(int); void* my_malloc(size_t); static const interpose_t interposers[] \ __attribute__ ((section("__data, __interpose"))) = { { (void *)my_open, (void *)open }, { (void *)my_close, (void *)close }, { (void *)my_malloc, (void *)malloc }, }; int my_open(const char...

jquery - Javascript to compare page you are on with a link -

i have menu, , need link current page on highlighted differently. twisted way of comparing strings now, sure there smarter way? jquery(document).ready (function(){ jquery(".filteroptions .option").each (function (index,ele) { link=jquery(ele).find("a").attr("href").tostring(); p=jquery(window).attr("location").tostring().search(link) if (p!=-1){ jquery(ele).find(".link").addclass("current") } }); }); something work... $('a').each(function(){ if ( $(this).attr('href') == window.location.href ) { $(this).addclass('current'); } }); or if you're not using full-path urls in links... $('a').each(function(){ if ( window.location.href.indexof( $(this).attr('href') ) !== -1 ) { $(this).addclass('current'); } }); ...

javascript - Mouse position relative to div -

i using jquery ui drag , drop. trying mouse position relative div, here code: $( "#db_tables " ).droppable({ activeclass: "ui-state-default", hoverclass: "ui-state-hover", drop: function( event, ui ) { var x = ui.position.left - ui.offset.left; // tired event.pagex - this.offsetleft; var y = ui.position.top - ui.offset.top; // tired event.pagey - this.offsettop; $( '<div style="margin-top:' + y + 'px; margin-left:' + x + 'px; "></div>' ).html( ui.draggable.html() ).appendto( ); } }); but position of dropped div not correct, can please tell me wrong code? take here: http://docs.jquery.com/tutorials:mouse_position edit: jquery docs page above broken. here alternate: http://api.jquery.com/event.pagex/ event.pagex , event.pagey should give mouse position $("#drag").draggable({ stop: function(event, ui){ var x = event.pagex - ui.offset.left; ...

tips on creating RSS/XML easily in python -

i have list if these 3 items: title , link , html based description , looking library or external tool can fed these 3 items , create rss xml page. such thing exist? this might not answer search for, rss dialect simple standard (holding 0.9 , 2 especially, , constraints 1, too). you consider writing hand, if don't have additional constraints (like, use django, or more complex in nearer future, or should automatically distributed, or want create rss 1, rss 2 , atom @ once , don't have time read 3 specs). specifications: rss 0.91 rss 1.0 rss 2.0 atom

Dynamically loading an external CSS file using JavaScript -

possible duplicate: dynamically loading external css file i'm trying create dynamic page using external .css pages page color changed. below code. when click href , not getting output. can please tell what's problem in code? suggestions or ideas please. <script language="javascript"> function loadjscssfile(filename, filetype) { if (filetype=="css") { var fileref=document.createelement("link") fileref.setattribute("rel", "stylesheet") fileref.setattribute("type", "text/css") fileref.setattribute("href", filename) } if (typeof fileref!="undefined") document.getelementsbytagname("head")[0].appendchild(fileref) } loadjscssfile("mystyle.css", "css") </script> <a href="javascript:loadjscssfile('oldstyle.css','css')">load "oldstyle.css"...

oop - Building one object given another -

say calling third-party api returns post, , want take , transfer properties own post class. have in past had method public static my.post build(their.post post) maps properties how want. however, better/valid have constructor accepts their.post , property mapping in there? or should there separate class converting, , leaves my.post in more pojo state? thanks thoughts! these answers starts "it depends." people argue against using public static methods, based on fact hard mock them (i don't buy bandwagon). this comes down design, want post part of class? if add "copy" constructor part of class , dependent on changes post. if change post, code has adapt. the better solution decouple it. need find extenal method map two. 1 way use static builder method (like mentioned) or if want take step further, more complicated solution extract information want post type of generic collection class. create constructor accept constructor class. w...

php - IDs in MySQL, standard IDs or alphanumerics? -

i'm thinking of this, if make web site specific university's students should make id standard ids on mysql (integer, auto increment) or should give ids how email address is, if student's email address e12234@university.edu his/her id e12234 (on web site). ok, performance? edit: also, there such email addresses: n13345@university.edu (exchange student) jennajameson@university.edu (this professor) i recommend separate, independent value id (integer, auto increment). id values should never change, never updated. people change emails time, corporations reissue same email address new users sometimes.

WCF and Spring.nets ServiceExporter -

has using spring.nets spring.servicemodel.serviceexporter wcf ?? some background..... i'm trying configure wcf services spring.net use in web application in first iteration of project suceeded configuring service object spring (i gave id requestmanagerservice) , in svc file pointed springs servicehostfactory @ object. svc file looked this: <%@ servicehost language="c#" debug="true" service="requestmanagerservice" factory="spring.servicemodel.activation.servicehostfactory" %> however not want decorate interface/contract [servicecontract] , [operationcontract] attributes. avoid can use springs serviceexporter. so have set following in web config: <object id="requestmanagerservice" type="supplyanddemand.messaging.ui.web.requestmanagerservice, supplyanddemand.messaging.ui.web" singleton="false"> </object> <system.servicemodel> <services> <s...

c# - Why does Dispatcher.Invoke not execute the delegate argument in this example? -

[test] public void a() { var d = dispatcher.currentdispatcher; action action = () => console.writeline("dispatcher invoked me!"); var worker = new backgroundworker(); worker.dowork += somework; //worker.runworkerasync( (action) delegate { console.writeline("this works!"); } ); worker.runworkerasync((action) delegate { d.invoke(action); } ); system.threading.thread.sleep(2500); } private void somework(object sender, doworkeventargs e) { (e.argument action)(); } this block of code doesn't throw exception. @ same time, dispatcher.invoke nothing. found odd. i extracted helper method base viewmodel. worker threads used method doonuithread() avoid thread affinity issue. in unit-tests, find attempting test view model objects results in failures due above issue. i move whole behavior out pluggable dependency substitute in tests. e.g. viewmodelbase depends on uit...

events - Custom attribute in .NET to execute code before and after decorated method? -

ideally i'd find way like: [mycustomattribute()] public void mymethod() { debug.write("b"); } public mycustomattribute : attribute { public void onbegin() { debug.write("a"); } public void onend() { debug.write("c"); } } which write: abc when mymethod() gets excuted. ideas if can done? actionfilter attribute seems similar idea, applies mvc requests. take @ postsharp - pretty already. it post processor - takes compiled assembly, looks attributes , injects code decorated methods.

php - zlib.output_compression - for zip functionality it should be On or Off -

what significance of zlib.output_compression in zip functionality? should on or off? do have add contenttype gzip should extension of generated file should .gz instead of zip. which best way of zipping bunch of files, huge number of files. zlib.output_compression compressing text data browsers reduce traffic, can not used generate zip files. you should use appropiate library severside , stream zip client correct mime type header, browser ask user store file usual download.

mysql - SQL : find rows and sort according to number of matching columns? -

let's imagine having "cars" table such simple structure... car_id int color enum('black','white','blue') weight enum('light','medium','heavy') type enum('van','sedan','limo') fist, i'm selecting car (1, black, heavy, limo), i'd list of related cars sorted number of matching columns (without column weight). so, first i'm expecting see (black, heavy, limo) cars, i'm expecting see cars 2 matching fields etc. is possible execute kind of sorting using sql? sorry english, hope question clear you. thank you. there few ways optimise sub-queries, without using case statements or sub-optimal join clauses: select * ( select selection.carid, selection.colour, selection.weight, selection.type, 3 relevance tb...

c# - get NASDAQ, IMKB 100 and URALS data using web service or XML -

where can these urls or web services online data? instance used spam euros etc. i doubt you're going find free. providing quotes real-time expensive. if you're not against subscribing service, there few out there. there's list @ remotemethods.com might started. saw resources nasdaq though, not others listed. a little more digging brought up: http://www.xignite.com/xglobalquotes.asmx?wsdl http://www.webservicex.net/realtimemarketdata.asmx?wsdl http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx?wsdl use @ own risk -- don't know these services.

Updating models in a Doctrine Migration -

i'm trying update model in context of doctrine_migration. calling save() on object doesn't seem update database. tried calling execute() doctrine_query in context of doctrine_migration. tried running getsqlquery() on query object , valid query works if executed in mysql console, if run migration no errors , execute() doesn't seem anything. how can execute() query in context of migration? $res = doctrine_query::create()->update('foobar')->set('colfoo', '?', 'valbar')->execute(); this should trick

cocoa - NSDate constant for Fetch Predicate -

i'm using fetch predicate in ib filter our default result return core data , i'm looking this: datecreated < yesterday where "yesterday" supposed nsdate constant yesterday result return before yesterday. this didn't work. , searching didn't turn related i'm wondering want here possible. irrespective of core data (because has nothing core data, predicates ), query (before date) normal, predicate syntax has no facilities "natural language" dates. you pass in date object , that's that. it's create appropriate date object represent "yesterday". to same sort of "automatic" behavior you're looking for, bind array controller's fetch predicate controller via key (kvc-compliant method) "beforeyesterdaypredicate" ... method hand dynamically-generated predicate you'd create code.

c - How to find whether the MORE FRAGMENTS field is set or no? -

given header , how find if more fragments field set or not.. struct sniff_ip { u_char ip_vhl; /* version << 4 | header length >> 2 */ u_char ip_tos; /* type of service */ u_short ip_len; /* total length */ u_short ip_id; /* identification */ u_short ip_off; /* fragment offset field */ #define ip_rf 0x8000 /* reserved fragment flag */ #define ip_df 0x4000 /* dont fragment flag */ #define ip_mf 0x2000 /* more fragments flag */ #define ip_offmask 0x1fff /* mask fragmenting bits */ u_char ip_ttl; /* time live */ u_char ip_p; /* protocol */ u_short ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source , dest address */ }; struct sniff_ip ip_hdr; ... if(ip_hdr.ip_off & ip_mf) ...

Encrypt javascript code to prevent javascript injection in MongoDB? -

i'm going store javascript code in mongodb (no-sql) database. but prevent javascript injection want encrypt javascript code in string. is there way encrypt , decrypt without having defect javascript code? there lot of stuff other web considering this. i suggest have @ jquery plugin encryption jquery plugin encryption i personnally have not used 1 of these encryption tools, integration seems pretty easy, , of course should generate random encryption key : for instance here example of jqcrypt : <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.jqcrypt.js"></script> <script type="text/javascript"> $(function(){ $('#form_id').jqcrypt({ keyname: 'jqckval', randomkey: false, key: 'some_key_value', callback: function(form){ form.submi...

python - How to return the count of related entities in sqlalchemy query -

i'm new sqlalchemy, , while documentation seems thorough, couldn't find way quite want. say have 2 tables: forum , post. each forum has parent forum, , number of posts. want is: a list of top-level forums eagerly loaded child forums accessible through top-level forums a count of posts each child forum so started with: query(forum).filter(forum.parent==none).all() which gives me top level forums. of course accessing child forums yields n select queries. query(forum).options(eagerload('children')).filter(forum.parent==none).all() this solves n select problem. now best guess goes this: query(forum, func.count(forum.children.posts)).options(eagerload('children')).filter(forum.parent==none).group_by(forum.children.id).all() but is: attributeerror: neither 'instrumentedattribute' object nor 'comparator' object has attribute 'posts' i've tried few variations, haven't got further. clarity i'm lookin...

sql - Converting mysqlpp::String to C++ int -

ok, i'm relatively new using mysqlpp library used in visual studio connect mysql database , having trouble trying convert vector of type mysqlpp::string vector of type int. have experience mysqlpp , mind helping me out little? i've posted example of i'm trying below appears in code. assume vector futureitemsets populated , want copy on contents integer vector. can provide! vector<int> timeframeitemsets; vector<mysqlpp::string> futureitemsets; for(int j = 0; j < static_cast<int>(futureitemsets.size()); j++) { timeframeitemsets.push_back(futureitemsets[j]); } mysqlpp::string has operator int() code snippet should work. problem having it? if want more explicit, can use mysqlpp::string's conv function: int = futureitemsets[j].conv<int>(0); timeframeitemsets.push_back(i);