Posts

Showing posts from June, 2012

php - jQuery voting system -

so making voting system, thumbs & thumbs down voting system. using cakephp , jquery mysql want make sure front end correct , best way it. i want user able change vote, so utilizing jquery best , efficient way? i'm novice jquery when comes class manipulation. the id field going unique id of photo users voting on. of course test , not going final product in production. there multiple photos on page , user votes or down each of them. here code. <?php echo $javascript->link('jquery/jquery-1.4.2.min',false); ?> <script type="text/javascript"> $(document).ready(function() { $('.vote').click(function () { if ($(this).hasclass("current")) { alert("you have voted option!"); return; } var parentid = $(this).parent("div").attr("id"); if ($(this).hasclass("up")) { //do backend...

WPF ListView SelectedValue not being set -

i've looked @ few solutions nothing has worked yet me. i'm using mvvm project , have listview can't set selecteditem property. if (simplified) xaml. <listview name="uxpackagegroups" itemssource="{binding path=packagegroups, updatesourcetrigger=propertychanged, mode=twoway}" borderthickness="0" borderbrush="#ff0000e8" scrollviewer.cancontentscroll="true" selecteditem="{binding path=packagegroupselecteditem, mode=twoway}" > <listview.itemtemplate> <datatemplate> <label content="{binding name}" height="20" margin="0" padding="0"/> </datatemplate> </listview.itemtemplate> and bind packagegroups in viewmodel public packagegroup packagegroupselecteditem {get; set; } public observablecollection<packagegroup> packagegroups {get; set; } private void loadui() { packagegroups = fact...

greasemonkey - Trigger inline onchange javascript -

i'm writing greasemonkey script creates auto-complete search type box makes easier select large dropdown on webpage. dropdown has inline onchange code can't seem trigger when change selection using javascript. ideas? suppose the page had like: <input onchange="somefunction()"> then greasemonkey javascript change input value , call function using: unsafewindow.somefunction();

sql - delete from table1,table2,table3 where? -

if tables want delete have column gamer_id can delete table1, table2, table3 gamer_id = 123? or there different syntax? mysql supports multi-table deletes : delete t1, t2, t3 table_1 t1 join table_2 t2 on t2.gamer_id = t1.gamer_id join table_3 t3 on t3.gamer_id = t1.gamer_id t1.gamer_id = 123

iPhone - how to declare a method and avoid leaks -

suppose have method this - (uibutton *) createbuttonatx:(cgfloat)vx y:(cgfloat)vy{ //... bla bla bla... //at point have uibutton *mybutton = [[uibutton alloc] initwithframe:myframe]; // have alloc here... // ... more bla bla , return mybutton; } as button allocated , not released technically leak, right? on main code, caller like uibutton *onebutton = [self createbuttonatx:100 y:100]; [myview addsubview:onebutton]; [onebutton release]; in theory, onebutton mybutton on createbutton method being released on main code, so, instruments point method leaking... how solve that? using autorelease? thanks replace last line with return [mybutton autorelease]; the truth view retains subview when use -addsubview:.

CakePHP form helper problem with date for editing -

i'm quite newbie in cakephp, i've tried create form form helper on date field echo $this->form->input('item.date'); yes, works fine (i'm using cakephp v1.3.3) input/add new record when try using on edit page nothing. here's code echo $this->form->input('item.date', array("value"=>$rs['item']['date'])); it still display listbox without retrieving value desired table. appreciated, sorry english.. you shouldnt use inline params default values. pass them down controller: http://www.dereuromark.de/2010/06/23/working-with-forms/ see "default-values"

C : Dynamically storing strings (of dynamic sizes!)? -

am missing incredibly simple? because can't seem find reason why code isn't storing strings dynamically. blank lines when print them @ end. supposed print last "n" lines of arbitrary number of lines. there seems problem storage of actual lines though. can lend hand? this not hw way. problem k&r book (whose answers online). i'm trying learn c on own. void tail5_13(int n) { int maxpoint = 3; size_t *maxlength; *maxlength = sizeof(char) * 10; char **pointptr = malloc(sizeof(void *) * maxpoint); char **pointcnt = pointptr; char *lineptr = malloc(sizeof(char) * *maxlength); int numlines = 0; int printnum = 0; int c; while((c = getline(&lineptr, maxlength, stdin)) > 1) { if(numlines < maxpoint) { storeline5_13(pointcnt, lineptr, c); pointcnt++; } else { maxpoint *= 2; printf("increased pointer amount %d\n...

mysql - Can I run php script in background mode? -

now, developing snmp webserver , want data mib in windows insert in mysql data base. use snmp connection provide in php, want php script run , no interface in background updating database. can or there better way do. please, me. you'll need daemon in php, although isn't best way it, it's possible. fire php script command line (php cli environment) , fork off console new process. starting depends on os, in either case simple console script job. have make sure php script never finishes. use never ending script poll snmp agent , write values mysql. design bunch of php scripts reading db , displaying values in webpage. note: php not designed such purpose, i.e. implementing resident daemon behaves kind of application, may run difficulties regarding memory consumption , processing (no multi-threading!). i recommend use language daemon service i.e. java. there's free open source library snmp4j easy use , let realize poller in minutes (i it's more mature s...

asp.net - Infragistics Ultralistview MouseHover Retrieve User Information -

i using infragistics ultralistview display data in list contains 3 columns , 4-5 rows(that upto 'n' rows depending upon data added). when hover on row 2 seconds, want other information row should displayed in panel control. how that? let me know if else required side. i've done sort of thing combo using mouseenterelement event control , processing display of information manually. for project specifically, reference data valuelistitem. when event triggered, fires ultrawintooltip dropdown element. for project, might want attribute data tag property of each ultralistviewitem, , capture mouseenterelement. try (vb): dim lst ultralistview = ctype(sender, ultralistview) if e.element.getcontext().gettype() gettype(ultralistviewitem) '-- item in question dim li ultralistviewitem = ctype(e.element.getcontext(), ultralistviewitem) '-- transpose own data here dim dr datarow = ctype(li.tag, datarow) '-- use timer delay showing of tip...

objective c - What's the regular pattern to implement `-init` chain when subclassing UIView? -

when make object use in nib, object should implement -initwithcoder: . can't figure out regular pattern implementing this. i have been used code. - (id) initwithcoder:(nscoder *)adecoder { if(self=[super initwithcoder:adecoder]) { // initialize object. } return self; } but have make same code uiview instantiated code this. - (id) initwithcoder:(nscoder *)adecoder { if(self=[super initwithcoder:adecoder]) { // initialize object. } return self; } - (id) initwithframe:(cgrect)frame { if(self=[super initwithframe:frame]) { // initialie obejct. } return self; } i feels wrong. recommendations? *of source initialization logic can extracted new method, it's not point. use awakefromnib initialize uiview that's being created nib file. if want make general can created either nib file or programmatically, make method configureobject , call both designated initializer (often initwithframe:) , awakefromnib. - (void)configureobject { ...

textarea: select text and scroll to it with javascript -

i've been trying find solution past few hours, no luck far. how select text (actually found 1 already, haven't tested yet) in textarea , force scroll text? i've tried using scrolltop, don't know how calculate number of lines of wrapping textarea in mind. think you're trying do: http://flesler.blogspot.com/2007/10/jqueryscrollto.html can use scroll dom elements, in case text you're selecting.

xcode - Nesting XIBs in Interface Builder / embedding by reference -

say have created xib icon view. want embed number of instances of icon view in different xib container view by reference , if alter properties / layout in original icon view xib, instances in container view xib reflect these changes. essentially, embedding reference. maybe i'm being dense, seems default behaviour of interface builder when dragging view container view copy over, rather referencing original xib? , dragging instance of class associated icon view container view results in blank view. i'm sure there's way this, i'm damned if can figure out. avoid ib plague ;) there isn't way of doing directly in interface builder. needed similar in last app. ended doing placing placeholder view in location want referenced xib , in viewdidload or viewwillappear, etc, load xib , place loaded view child of placeholder view. nsarray *views = [[nsbundle mainbundle] loadnibnamed: @"referencedview" owner: self options: nil]; uiview *referencedvie...

design - Scala traits / cake pattern vs case classes -

in web application authorized user has @ least 4 "facets": http session related data, persistent data, facebook data, runtime business data. i've decided go case class composition instead of traits @ least 2 reasons: traits mixing can cause name clashes i want free case class goodies pattern matching , copy method i'd know experienced scalaists opinions on subject. looks traits and/or cake pattern should suitable such tasks i've mentioned above there problems... obvious not want implement fast , easy understand in depth using in future. so decision have flaws , misunderstanding or right? related code looks this: case class facebookuserinfo(name: string, friends: list[long]) case class httpuserinfo(sessionid: string, lastinteractiontime: long, reconnect: boolean) case class runtimequizuserinfo(recentscore: int) trait userstate { def db: user def http: httpuserinfo } case class connectinguser(db: user, http: httpuserinfo) extends userstate cas...

java - Ubuntu/Spring 3 - Strange issue with locale -

i'm experiencing strange issue ubuntu 10.04.1 lts x86_64 seems work fine when system locale en_us. however, when system locale en_gb spring tries default resource bundle en_us rather en_us. the exception: 06-oct-2010 23:35:12 org.springframework.context.support.resourcebundlemessagesource getresourcebundle warning: resourcebundle [messages] not found messagesource: can't find bundle base name messages, locale en_us system locale: taylor@taylor-laptop:~$ locale lang=en_gb.utf8 lc_ctype="en_gb.utf8" lc_numeric="en_gb.utf8" lc_time="en_gb.utf8" lc_collate="en_gb.utf8" lc_monetary="en_gb.utf8" lc_messages="en_gb.utf8" lc_paper="en_gb.utf8" lc_name="en_gb.utf8" lc_address="en_gb.utf8" lc_telephone="en_gb.utf8" lc_measurement="en_gb.utf8" lc_identification="en_gb.utf8" lc_all= taylor@taylor-laptop:~$ the default spring locale setup below: <bean id...

asp.net 3.5 - on a Web Setup, how do I exclude all .pdb files? -

in sample solution on visual studio 2008, let's say, have this: mywebsite project ( web site project ) mylibrary project ( library project ) mywebsitedeploy project ( web deployment project ) mywebsetup project ( web setup project ) inside mywebsite there mylibrary.dll , mylibrary.pdb witch included in mywebsitedeploy project , pass mywebsetup how can tell mywebseitedeploy or mywebsetup to exclude *.pdb files not needed in deployed website ? open project properties in visual studio. select "build" tab, change "configuration" "release" , click on "advanced" button. change debug info "none" . build not create .pdb files.

c# - how to split list using linq -

i have list of int consists of value 0,0,0,1,2,3,4,0,0 split 3 lists list consists 0,0,0 , list b consists 1,2,3,4 , list c consists 0,0.i know how split using if , for,but how can using linq. usual format need split in starting zeros , in middle values , in last zeros need split first zeros in 1 list ,middle values in 1 list , end zeros in list in example above here using linq , take index values. first one. mylist.takewhile(x => x==0) second one. mylist.skipwhile(x => x==0).takewhile(x => x!= 0) third one. mylist.skipwhile(x => x==0).skipwhile(x => x!= 0)

java - What transaction manager to use? (JPA, Spring) -

i'm developing web application based on jpa + hibernate, spring , wicket. wondering what's best way of implementing transactions in code? transaction manager should use? should org.springframework.orm.jpa.jpatransactionmanager , or org.springframework.jdbc.datasource.datasourcetransactionmanager or else? i'd use spring managing transactions. nanda right , can use jpatransactionmanager. transaction manager abstraction talking here spring's platformtransactionmanager interface, , jpatransactionmanager implementation of interface understands jpa. you should read chapter transaction management spring reference better understand topic.

c++ - Win32 programming question -

i have tab-based application windows, developing myself. i add subtle gradient background of tab control. how go around doing this? best method me use? i think implementing custom control takes space of tab control work, how draw gradient using gdi? thanks in advanced. to use gdi you'll need gradientfill function. can use gdi+ gradients. here's plain gdi example: trivertex vert[2] ; gradient_rect grect; vert [0] .x = 0; vert [0] .y = 0; vert [0] .red = 0x0000; vert [0] .green = 0x0000; vert [0] .blue = 0x0000; vert [0] .alpha = 0x0000; vert [1] .x = 100; vert [1] .y = 32; vert [1] .red = 0x0000; vert [1] .green = 0x0000; vert [1] .blue = 0xff00; vert [1] .alpha = 0x0000; grect.upperleft = 0; grect.lowerright = 1; gradientfill(hdc,vert,2,&grect,1,gradient_fill_rect_h); as tab control, sub-class control , override non-client , client drawing handlers render gradient. to sub class control, first create co...

c++ - Confused about implicit template instantiation -

this statement c++03 standard, §14.7.1p5: if overload resolution process can determine correct function call without instantiating class template definition, unspecified whether instantiation takes place. [ example: template <class t> struct s { operator int(); }; void f(int); void f(s<int>&); void f(s<float>); void g(s<int>& sr) { f(sr); // instantiation of s<int> allowed not required // instantiation of s<float> allowed not required }; — end example ] i unable understand point. have undefined behavior? i found similar problem , don't understand. there explained correct behavior undefined, mean? here: msvc: implicit template instantiation, though templated constructor not used during overload resolution determined correct function call when write f(sr) void f(s<int>&); without explicitly instantiating definition of class template s ,...

iphone - Problem With memory management in my code -

-(void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch=[touches anyobject]; currentpoint=[touch locationinview:self.view]; rootlayer = [calayer layer]; rootlayer.frame = self.view.bounds; [self.view.layer addsublayer:rootlayer]; starpath = cgpathcreatemutable(); cgpathmovetopoint(starpath, null, currentpoint.x, currentpoint.y + 15.0); for(int = 1; < 5; ++i) { cgfloat x = 15.0 * sinf(i * 4.0 * m_pi / 5.0); cgfloat y = 15.0 * cosf(i * 4.0 * m_pi / 5.0); cgpathaddlinetopoint(starpath, null, currentpoint.x + x, currentpoint.y + y); } cgpathclosesubpath(starpath); shapelayer = [cashapelayer layer]; shapelayer.path = starpath; uicolor *fillcolor = [uicolor colorwithwhite:0.9 alpha:1.0]; shapelayer.fillcolor = fillcolor.cgcolor; [rootlayer addsublayer:shapelayer]; } - (void)dealloc { ...

Can I programmatically add a row to a WPF datagrid? -

i want add new row, have datasource in objects in need processing. need below wpf datagrid... datarow row = datatable.newrow(); foreach (navitem item in record.items) { row[item.fieldno.tostring()] = item.recordvalue; } datatable.rows.add(row); you should using observablecollection<navitem> datagrid source. adding new element collection add datagrid. see msdn article .

html - Dynamic PDF style problem in php? -

when create dynamic pdf (html pdf) inline css not working text padding or text margin. am not sure tcpdf converting html pdf. generating pdf using commands. drawing pdf. styles not effective there. try http://www.digitaljunkies.ca/dompdf/examples.php#demo its easy , taking inline style <html> <head> <style> /* type style rules here */ </style> </head> <body> <table><tr><td style='background-color:red'>asdasdasdasd</td></tr></table> </body> </html>

osx - gedit text editor - mac os x -

does know if can setup remote connections in gedit(on mac os x snow leopard), don't have keep ftp'ing seperately. i know can done on ubuntu can't figure out how on mac, if possible. an application independent solution sshfs on osx through macfuse . sshfs available linux.

In C# and also Java, what's the relationship between Object[] and String[]? -

i started think of problem , can't find answer. following code compiles , executes expected object[] test = new string[12]; however, don't know why. i mean, should consider string[] derived class of object[]? think in c#, every array instance of array class. if array generic, should array<t> , , array<string> can assigned array<object> , doesn't make sense. remember interface can use in/out keyword. and in java, i'm not sure, still feel weird. why different types of references can possibly assigned each other when don't have super-sub class relationship? can explain little? thanks lot! it's because reference type arrays support covariance in both java , c#. means every write reference type array has checked @ execution time, make sure don't write wrong type of element :( don't forget both java , c# (and .net in general) started off without generics. if had had generics start with, life have been different. ...

asp.net - Record and save audio in c# .net web application -

is there anyway can record sound microphone using c# .net what best option if have save audio online in terms of file occupying storage space. any particular format file should saved in optimum output. i think have use either small flash application or silverlight application actual recording. upload file application using web service or similar. and mp3 sort of standard file format sound on web. i'd go that.

c++ - Reducing number of template arguments for class -

i have method , 2 classes defined this: template<template<class x> class t> void dosomething() { t<int> x; } template <class t> class classwithonearg { t t; }; template <class t1, class t2> class classwithtwoargs { t1 t1; t2 t2; }; i can dosomething<classwithonearg>(); but cannot dosomething<classwithtwoargs>(); however, i'd pass classwithtwoargs dosomething, t2 = double. the method found create template <class t1> class classwithtwoargs_child : public classwithtwoargs<t1, double> { }; and then dosomething<classwithtwoargs_child>(); this works, in concrete case classes require constructor argument , have create constructor argument in _child-class , pass base want avoid. do have idea how that? thanks lot! indirection solution. instead of template template parameter pass "meta function" -- function maps 1 type in form of struct nested class template: ...

How to count field in Crystal Reports? -

first of all, new crystal reports maybe asking might stupid. i added tables , want count appearance of field depending on field in same table. if other field has value, have increase counter. have use returned value of counter custom field in report. have add multiple fields one, counting thing. so... how do counting? thank answers ! i'd use running total field, evaluated function (formula), checks other field value.

xml - ASP.NET to PowerPoint: File gets corrupted when adding image -

i have used this example when exporting data powerpoint: i have modified generateslidesfromdb() method: public void generateslidesfromdb() { string slidename = @"c:\users\x\desktop\output.pptx"; file.copy(@"c:\users\x\desktop\test.pptx", slidename, true); using (presentationdocument presentationdocument = presentationdocument.open(slidename, true)) { presentationpart presentationpart = presentationdocument.presentationpart; slidepart slidetemplate = (slidepart)presentationpart.getpartbyid("rid2"); string firstname = "test user"; slidepart newslide = cloneslidepart(presentationpart, slidetemplate); insertcontent(newslide, firstname); newslide.slide.save(); deletetemplateslide(presentationpart, slidetemplate); presentationpart.presentation.save(); } } as can see overwrite placeholder "test ...

uiview - What is the use of removeFromSuperView in iphone? -

in program, if put below line in cellforrowatindexpath(tableview), scrolling fine. otherwise, lines crashed. want know code did? the code is.... for (uiview *oldviews in cell.contentview.subviews) { [oldviews removefromsuperview]; } thanks in advance you have know in ios manipulating "views". views ui parts (images, labels, inputs etc.) or containing layer. at launch beginning must add view window. can add add many views want on view. if add view b on view a. , view on window. semantic : view superview of b view b subview of a view subview of window the window superview of view a so if invoke removefromsuperview on b, removing b on (and displaying). please note : when add subview (addsubview:) retain performed on view added. when remove view (removefromsuperview: or removesubviewatindex:) release performed on view removed. to answer initial question for (uiview *oldviews in cell.contentview.subviews) { [oldviews removefromsu...

c++ - How to force AfxMessageBox to center on mainframe and not whatever child window that currently has focus -

i'm developing mdi application, primary document maximized in mdi frame. create non-modal dialog pop-up display secondary information user while work in main window. however, when user moves pop-up takes focus expected. problem occurs when window has focus , event generates afxmessagebox occurs in mainframe. expect afxmessagebox pop-up centered on mainframe. currently, pops centered on non-modal dialog pop-up window which, chance, had focus @ time. is there way force afxmessagebox pop-up centered on mainframe? or @ least force pop-up centered on window in called. example, if in non-modal dialog error occurs, want afxmessagebox appear centered on dialog because it's intuitive error occurred there. alternatively, if i'm working non-modal dialog , error occurs in mainframe or document afxmessagebox appear centered on it's view/frame despite fact i'm working child window. i hope that's clear enough. use cwnd::messagebox() method instead. ...

Why are there four mono C# compilers? -

this page explains 4 different mono compilers - mcs/gmcs/smcs/dmcs. to me, it's little bit weird have 4 c# compilers. newer version of compiler maintains backward compatibility. i assume that's because of runtime support issues, microsoft's c# has 1 csc.exe supports of runtime versions. it's because mono's compiler written in c# , uses system.reflection, means can access mscorlib runtime it's running on. therefore, example, smcs doesn't target 2.1, uses 2.1 corlib, etc. there have been plan while have *mcs use either mono.cecil or ikvm.reflection instead of system.reflection, mean there single mcs compiler arguments target different runtimes. microsoft's compiler doesn't have limitation because doesn't use .net reflection (it's written in native code).

responds_to_parent in rails 3 -

how use responds_to_parent plug in rails 3. had used in rails 2.3.5. @ time there no errors. when shifted rails 3 showing following error undefined local variable or method `erase_redirect_results'. how solve issue? use https://github.com/itkin/respond_to_parent

IP address textbox in Android? -

i'm totally new android. i put in textbox user can enter ip address ... how limit user enter numbers? ... , how validate? is there ready-made-ip-address-textbox "out there" can use? thanks! mojo for validation, regular-expressions.info has regex string use testing ip in valid (0-255) range: \b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

c++ - GetPixel in GDI -

using getpixel, right retrieve pixel information hdc temporarily store after draw on each wm_paint call? it x,y pixel value of whatever bitmap selected within hdc. http://msdn.microsoft.com/en-us/library/dd144909%28vs.85%29.aspx getpixel quite slow, if recall correctly. depending on want do, lot faster access raw bitmap data directly.

c# - SOA Question: Exposing Entities -

i incorporate soa pattern in 3 tier structure. created service layer (wcf host) between bll , ui. structure setup looks this ui <> wcf <> bll <> dal <---[entities] ---> the problem is, have entities in separate dll (and visible in layers except on ui) now, need expose consumer of service can use it.in case, ui. how can possibly that? entities.dll namespace entities { public class account { public string acctid { get; set; } public string acctname { get; set; } } } now, im planning use in wcf service interface layer public class accountservice : iaccountservice { public account getaccount(string acctid) { //fetch dal through bll } } is ok attribute entities? (note, i'm using entities in dal , bll) using system.runtime.serialization; namespace entities { [datacontract] public class account {...

Retrieve plain text with jquery ajax and convert to JSON -

update: following works fine in ie8, data comes null in firefox: $.getjson('myurl/solr/select/?q=citystate%3asea*&version=2.2&start=0&rows=3&indent=on&wt=json&fl=citystate', function(data) { alert(data.response.docs[0].citystate); }); i have jetty server generates json data plain text - here headers like: last-modified wed, 06 oct 2010 23:22:27 gmt etag "oti5ywmzyzfkndgwmdawmfnvbhi=" content-type text/plain; charset=utf-8 content-length 565 server jetty(6.1.3) here example of output: { "responseheader":{ "status":0, "qtime":1, "params":{ "fl":"citystate", "indent":"on", "start":"0", "q":"citystate:sea*", "wt":"json", "version":"2.2", "rows":"10"}}, "response":{"numfound":233,"start...

c# - practical applications of bitwise operations -

what have used bitwise operations for? why handy? can please recommend simple tutorial? although seems hooked on flags usecase, isn't application of bitwise operators (although common). c# high enough level language other techniques used, it's still worth knowing them. here's can think of: the << , >> operators can multiply power of 2. of course, .net jit optimizer (and decent compiler of language well), if you're fretting on every microsecond, might write sure. another common use these operators stuff 2 16-bit integers 1 32-bit integer. like: int result = (shortinta << 16 ) | shortintb; this common direct interfacing win32 functions, use trick legacy reasons. and, of course, these operators useful when want confuse inexperienced, when providing answer homework question. :) in real code though you'll far better off using multiplication instead, because it's got better readability , jit optimizes shl , shr inst...

android how to make native zip application -

i create zip file files located on sd card, have managed using java think result slow, thought of going native using android ndk. my questions are: does know c/c++ library zip unzip files work on android? how know if library work on android? will make difference on performance? i 7zip, open sourced here . can try compiling within app in android ndk. gzip option.

rename element in clearcase with @@ in filename -

for reason users produced files end in " @@ " (...) (i think because have in ccrc gui option show version extended pathname , think has somewhere little bug). now... unable remove or rename these files (it returns "not object in vob") how can rename or remove these files? update resolved forgot use complete rmname "a.doc@@@@\bla\1", after full path delete them. the simplest solution try list , remove objects base clearcase view directly on ccrc server (or base clearcase client). from kind of clearcase installation (ccrc server or full clearcase client), have access cleartool (the clearcase cli -- command line interface --), , can: cleartool ls : list files in view, check files @@ indeed there cleartool rmane -force remove them the op used cleartool rmname "a.doc@@@@\bla\1" , meaning had use extended path (file name + @@ + version path) of file ended @@ , hence 4 @ : file@@@@version .

jax rs - EJB-like transactions in JAX-RS -

i'm adding restful api existing application (jboss 4, ejb 2, adding resteasy). application has session beans container-managed transactions. start with, i'm calling remote interfaces on enterprise beans. ejb usage being phased out, new functionality added without writing new methods on beans. does jax-rs or jboss 4 offer transaction support on resource methods? or have write own transaction code in each of resource methods? jax-rs has preprocessinterceptors , postprocessinterceptors, not appear have interceptor wraps invocation. why don't use session beans jax-rs service? having container managed transactions works java ee. for example see: http://bdoughan.blogspot.com/2010/08/creating-restful-web-service-part-45.html

asp.net mvc - Password protect a whole .net mvc application? -

hellu, i want put password protection on entire web application development , testing purposes. simple way (global asax, webconfig etc), means don't have change in rest of application. password , username can stored in code/webconfig or whatever. since i'm not hosting myself, have limited access server (and can't modify iis in way). anyone knows good, simple, quick, awesome way achieve (other placing whole thing in "secret" folder)? simplest thing is: use forms authentication... ...with simple, xml membership provider add [authorize] parent controller class , use controllers in app.

c# - Error with ViewModels and Create/Edit Actions -

i'm trying create asp.net mvc 2 webapp using northwind database following nerddinner tutorial, keep getting following error when trying edit product: value of member 'supplierid' of object of type 'supplier' changed. member defining identity of object cannot changed. consider adding new object new identity , deleting existing 1 instead. this happens when change category and/or suppliers (both dropdownlists), other fields (checkbox , textbox) ok. i can't create new product since model.isvalid return false reason (no exceptions). what doing wrong? productcontroller.cs public actionresult edit(int id) { product producttoedit = productsrepository.get(id); return view(new productviewmodel(producttoedit)); } [httppost] public actionresult edit(int id, formcollection formvalues) { product producttoedit = productsrepository.get(id); if (tryupdatemodel(producttoedit, "product")) { ...

c# - Cannot suppress CA1903:UseOnlyApiFromTargetedFramework -

fxcop telling me following: "assembly 'ilretail.ebusiness.common.webutility.dll' has reference assembly 'system.web.routing, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. because assembly introduced in .net framework 3.5 service pack 1, higher project's target framework, .net framework 3.5, application may fail run on systems without framework installed." to try suppress this, have following line in assembly.cs: [module: suppressmessage("microsoft.portability", "ca1903:useonlyapifromtargetedframework", messageid = "system.web.routing, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35")] i can suppress message in other projects, not one. any ideas i'm missing? you need make sure added code_analysis compilation symbol.

jquery - What's the difference between .delegate() and live()? -

since $("table").delegate("td", "hover", function(){ $(this).toggleclass("hover"); }); is equivalent following code written using .live(): $("table").each(function(){ $("td", this).live("hover", function(){ $(this).toggleclass("hover"); }); }); according jquery api . i bet i'm wrong isn't same of writing $("table td").live('hover', function() {}); so, what's .delegate() for? .live() listens on document .delegate() listens on more local element, <table> in case. they both act same listening events bubble, 1 .delegate() bubbles less before being caught. your example of: $("table td").live('hover', function() {}); isn't same, again attaches event handler document , not <table> , .delegate() more local elements, more efficient in respects...though still uses .live() under covers. a...

groovy - Using Gaelyk URL routing in a non google app engine application -

i have groovy web application not being deployed on google app engine. (gae) have used gaelyk before , url routing functionality described in doc how port on routing functionality gaelyk basic groovy web application not being deployed on gae? note 1: not want use grails application. note 2: dont mind including gaelyk jar rather not include gae. if want implement in own non gae framework, best place start source... to start with, you'll need class extends javax.servlet.filter in gaelyk, routesfilter class as can see, in init method of filter, calls loadroutes loads routes.groovy script via groovyshell . this shell makes use of other classes in same package ends populating list<route> routes property in filter instance of route class . the filter ( when configured web.xml ) intercepts requests server checks uri against each route in turn (by calling foruri method each route), , if match found, redirects or forwards required. if no match foun...

In C how do you access a variable in a struct that's in a pointer array? -

typedef struct { employeet *employees; int nemployees; } *payrollt; typedef struct { string name; } *employeet; i need without accessing array: employeet e = payroll.employees[i]; but gives me error(expected identifier before '(' token) : employeet e = payroll.(*(employee+i)); before struct's interchange employees[i] , *(employee+i) why need avoid array syntax? *(ptr+offset) == ptr[offset] , strictly, every time. you have no performance penalty , array syntax clearer. edit: got real crux of problem. if payroll (in example) pointer type, need use arrow operator instead of dot operator: payroll->employees[0]

jquery tools .onSuccess -

can point me in right direction on this? using tools validator wanting execute ajax submit function have if validation passes. have working validation script here works, , ajax call works; i'm having time trying figure out how them work together. how can this? $(document).ready(function() { $("#leadbanker_intake_form").validator({ position: 'center right', offset: [0, 0], message: '<div><em/></div>' }).bind("onsuccess", function(e, els) { // function here still works though forms haven't validated } }); as per the documentation : the second argument jquery object containing fields passed validation. so, in onsuccess callback, need check length of els (the second argument) , make sure it's equal total number of fields you're validating. i think should work (but haven't tested it): $(document).ready(function() { $("#leadbanker_i...

datetime - A detailed explaination of what is "wrong" with date handling in GWT -

i have seen countless forum posts complaining of issues in gwt when handling dates. still unclear "wrong" date handling, special considerations need made, , when/where/why methods date.setminutes(int minutes) should not used. does have feedback? way in beginning of java (i.e., java 1.0), date/time api largely (solely?) consisted of date class. java folks aware lacked robustness, added calendar class in java 1.1 , tried change date class value object deprecating of it . unfortunately, calendar class wasn't thought-out (see here ) , we're stuck many consider monstrosity. bringing today, gwt supports date because, well... how can live without dates?, doesn't support calendar/gregoriancalendar/timezone because it's ugly , surely there has better answer. sadly, no one's thought of in on 3 years calendar support requested way in january of 2007 , marked planned april 2008. in short, go ahead , use the deprecated date methods in gwt cod...

oracle - Difference between FETCH/FOR to loop a CURSOR in PL/SQL -

i know fetching cursor give me access variables %rowcount, %rowtype, %found, %notfound, %isopen ...but wondering if there other reasons use open - fetch - close instructions loop cursor rather than loop cursor cycle... (in opinion better becase simple) what think? from performance standpoint, difference lot more complicated tim hall tip omg ponies linked to imply. believe tip introduction larger section has been excerpted web-- expect tim went on make if not of these points in book. additionally, entire discussion depends on oracle version you're using. believe correct 10.2, 11.1, , 11.2 there differences if start going older releases. the particular example in tip, first of all, rather unrealistic. i've never seen code single-row fetch using explicit cursor rather select into. fact select more efficient of limited practical importance. if we're discussing loops, performance we're interested in how expensive fetch many rows. , that...

c# - Is it possible to POST a file and some data in the same call to a webservice? -

i webservice able take username , binary file parameter in same call it. possible? i thought use webclient.credentials , set username way, doesnt seem working the simplest way turn binary data base64 string. string can transmitted passing parameter or inside xml string. web service method: now depending on size files, incur performance loss, not substantial one. to convert byte array base64 string: byte[] data = getsomedata(...);//whatever use byte array. string sdata = system.convert.tobase64string(data ); i choose method on webclient.fileupload() because have more control , more options. rather post page, can send additional information file, usernames, passwords etc. if put them neat xml file. [webmethod] public bool submitfile(string username, string file) { } or [webmethod] public bool submitfile(string data) { } where data be: <data> <authentication> <username></username> <password></password> </a...

serialization - JsTree: Load custom metadata from an external xml source -

i have existing data structure stored xml doc. sitemap. every node has associated metadata (e.g., keywords , description associated node). able use xml_data plugin able load directly source. quick @ both documentation , source, doesn't possible - i'm limited 2 formats described in documentation. however, can't imagine unique use case. seems options extend jstree add own xslt xsl var handle format, preprocess format of file server side result in expected format, or change data interchange format json , convert between json , xml serverside. sense posts have seen is @ least possible serialize/deserialize metadata json_data plugin, i'm not 100% sure on that. can refine direction based on experience? i looks me possible. see: http://www.jstree.com/documentation/xml_data the jstree function called .parse_xml can used convert xml strings or objects dom structure required jstree. edit: wrong! if post example of site map xml i...

flex - How vunerable to XSS attacks is Flash? -

the reason why ask i'm telling vendor of ours have use ms antixss library asp.net ui components make, work flex build flash based uis - , wondering if there's equivalent flash (assuming it's vunerable). the short answer is: flash player has lot of features in place prevent xss attacks, they're built in player itself, there isn't particular library need use. if don't call security-related apis, , don't put config files on server, security-wise, using restrictive settings available. (assuming pay attention how make use of user input.) more generally, apis have potential lead xss vulnerabilities rule disabled in xss situations unless actively enable them. example, if html page on site loads in flash file site, , flash content tries to, say, make javascript calls page, calls blocked default unless allow them. similarly, if flash content on site loads in components site, components not able introspect parent unless call apis allow them to. there va...

java - Spring 3 web request interceptor - how do I get BindingResult? -

i realy appreciate spring 3 anoation driven mapping of web controllers i have lot of controllers signatures like: @requestmapping(value = "solicitation/create",method = requestmethod.post) public string handlesubmitform(model model, @modelattribute("solicitation") solicitation solicitation, bindingresult result) but issue is, want write interceptor ho through bindingresults after processing - how them httprequest or httpresponse? as intercpetor methods alike signature public boolean posthandle(httpservletrequest request, httpservletresponse response, object handler) after execution of controller method bindingresult stored model attribute named bindingresult.model_key_prefix + <name of model attribute> , later model attributes merged request attributes. so, before merging can use hurda's own answer, after merging use: request.getattribute(bindingresult.model_key_prefix + "solicitation")

python - How do I remove the y-axis from a Pylab-generated picture? -

import pylab # matplotlib x_list = [1,1,1,1,5,4] y_list = [1,2,3,4,5,4] pylab.plot(x_list, y_list, 'bo') pylab.show() what want remove y-axis diagram, keeping x-axis. , adding more margin diagram, can see lot of dots on edge of canvas , don't good. ax = pylab.gca() ax.yaxis.set_visible(false) pylab.show()

Regex get parts of string that do not match pattern -

i learning regex ( http://www.regular-expressions.info/ ), , trying figure out how match part of following string not: word containing q not followed u . i've gotten far, cannot figure out how reverse properly. regex successful in finding word. now, need figure out how make find rest of string except word. suggestions? (\w*(q(?!u))\w*) jazzy 23 jacky 21 jiffy 21 junky 21 quaky 21 zappy 21 zaxes 21 zinky 21 zippy 21 furzy 20 hafiz 20 quack 20 quaff 20 quick 20 quiff 20 woozy 20 boozy 19 cozey 19 crazy 19 enzym 19 fuzzy 19 hamza 19 jammy 19 jemmy 19 jerky 19 jimmy 19 jimpy 19 jokey 19 jumpy 19 kudzu 19 kylix 19 qophs 19 whizz 19 zilch 19 zincy 19 zymes 19 you need specify language (javascript, php, etc.). here's 1 way in js: ( see in action @ jsfiddle .) var str = 'jazzy 23 ' + 'jacky 21 jiffy 21 junky 21 quaky 21 zappy 21 zaxes 21 zinky 21 ' + 'zippy 21 furzy 20 hafiz 20 quack 20 quaff 20 quick 20 quiff 20 ' ...

design patterns - Extend multiple Java classes without duplication -

i have java class can extend either of 2 third-party classes, cannot change. can choose either of these implementations @ compile time no changes class other "extends" declaration. unfortunately need choose implementation use @ runtime, not @ compile time. what's best way select between these 2 implementations @ run-time without duplicating entire derived class? it sounds require strategy pattern . the strategy pattern (also known policy pattern) particular software design pattern, whereby algorithms can selected @ runtime. so java class should contain reference 1 of 2 classes want use, , bridge implementation. implementation choose can selected @ runtime. it's not clear problem description, if 2 3rd-party classes implement common interface, java class implement interface , can directly map referenced 3rd-party class.

php - Get absolute days away -

i want absolute days away datetime today. example, know if date 2 days away, or 78 days away, or 5,239 days away (not likely, idea). using ms sql database returning datetimes time components 00:00:00. date_diff returns relative values have crazy math absolute dates calculating months, years, etc. also, having issues getting date component of today's date in php. edit: mr. w. ended with: $date = $row['airdatedatetime']; $today = date_create(date("y-m-d")); $away = date_diff($today, $date); $d = $away->format("%r%a"); the date_create() part part missing convert actual datetime. also, format needs %r%a . using %r%d works dates in month. the date_diff() function (really, datetime::diff() method) want, , it's not hard. in fact, think example in docs you're after: <?php $datetime1 = new datetime('2009-10-11'); $datetime2 = new datetime('2009-10-13'); $interval = $datetime1-...

EDT editor - a modern approach? -

i used edt editor on vms long time ago. there modern implementation of excellent text editor available? if so, there source codes? maybe circumvented emacs , vim? thank you http://www.atl.lmco.com/projects/csim/gui/edt/

java - can't access servlet, 404 not found -

edit 10/8/10 @ 8:20am est - since can't make work in prod, i'll try make fail in test. edit 10/8/10 @ 4:30pm est - having great time!!! not. ok, hell continues. learned earlier today we're running apache httpd separate process. we're thinking maybe we're not forwarding request tomcat somehow. not running httpd in test environment. edit 10/8/10 @ 8:20pm - found out server had httpd running on it. httpd forwarding jsp requests tomcat. apache eating servlet requests, trying serve static pages (?) , failing of course. hacked bajezus out of worker2.properties make httpd forward requests. ouch. tomcat 5.5, redhat linux. i created servlet of course runs fine in our test environment. moved production , fail 404 error. according catalina log servlet seems load properly. i'm @ wits end - don't know how troubleshoot this. it's have misspelled servlet name somewhere. here's web.xml <?xml version="1.0" encoding="utf...

c++ - Linking with --whole-archive flag -

this problem related this question asked yesterday. seems linker flag --whole-archive forces test object included in binary. however, in linking with, g++ main.cpp -o app -wl,--whole-archive -l/home/dumindara/intest/test.a -wl,-no--whole-archive i following error: /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgcc_s what do? .a files meant statically linked, , not compiled -fpic . consequently, cannot make shared library it.

php - Error: Allowed memory size of 67108864 bytes exhausted -

when upload picture file size: 375kb width: 2000px height: 3000px i error error fatal error: allowed memory size of 67108864 bytes exhausted (tried allocate 2157 bytes) in... why happen, when 67108864 = 64mb? i use shared server. .htaccess is: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule> where must write php_value memory_limit 128m ? it seems have 64m (67108864 / 1024 / 1024) allocated php. if have access php.ini , increase max memory size. you can in bootstrap php script. ini_set('memory_limit', '128m'); or in .htaccess php_value memory_limit 128m

Android:To set an item as selected when the ListView opens? -

an activity has button , listview. initially, button visible. when button pressed, listview displayed. when displayed, possible me show 1 particular item selected/focussed? a use case suppose list of language settings , when list opens, selected language must shown highlighted. if know index of item, how set focused on display? in short, listview::setselection(int position) need. however, depending on whether device in touch mode or not, may or may not have visual effect (background highlighting). more details, refer android listview selection problem