Posts

Showing posts from July, 2011

Cakephp application development scope -

i want separate cakephp application in users authentications... have created authentication key of 50 digits boolean. 10111... in way.. wanna separate application accordingly. suppose blog post. want access view post if users first authentication digit 1 , if post private need authenticate using digit 2 . other status of post suppose private wanna again check action of digit. should scope.? better way go with... second want have common function. have taken example of simple controller post wanna of models , controllers. how can make single inbuilt function all. you'll need create these rules in appcontrollers authorize() method, assuming using authcomponent , controller auth method.

TYPO3 - Printing view of page has weird information -

when try print page site created in typo3, can read @ end of every link string "(index.php?id=2) , or id of page link goes. how can turn off? by using extension realurl or cooluri (i recommend first). not better on print view, have positive effect on seo. update: ok, think understood wrong in first place. guess mean have url appended every link on website, not in header/footer of printed page, right? use css framework yaml? of them contain code like a[href]:after { content: " ("attr(href)")"; } in print stylesheets, adds url of each link @ end of link. search part , remove it. may enable print preview in firebug or whatever browser use develop. should see same result , css responsible behavior.

backbone.js - this that pass inside object as parameter to Backbone View : "window" or "backbone view" object? -

the code: var appointment = backbone.model.extend({}); var appointment = new appointment(); appointment.set('title', 'my knee hurts'); var appointmentview = backbone.view.extend({ render: function(){ $(this.el).html('<li>' + this.model.get('title') + '</li>'); } }); question that: $(this.el)... looks "this" "window" object , not event object? please if can expain how working. thanks, yosef in backbone.js views this bound view object, not window. can access event object if needed , through there reference target element. have @ question more information.

python - How do I place a process in the background so it does not interrupt my return? -

i need urgently in django site, because of time constraint, cannot heavy modifications. cheapest in-place modification. if focus on either build or run ... now id build (or run). all heavy work in separate function. ' import multiprocessing mp def main(): id = get_build_id(....) work = mp.process(target=heavy_build_fn) work.start() return id if ran in shell (i have not tested on actual django app), terminal not end until work process done job. web app, need return id right away. can place work on background without interrupting? thanks. i've read how run script in python without waiting finish? , want know other ways it, example, sticking mp. popen solution may not want actually. import multiprocessing mp import time def build(): print 'i build things' open('first.txt', 'w+') f: f.write('') time.sleep(10) open('myname.txt', 'w+') f: f.write('3') ...

In Haskell, + is a function, (+ 2) is a function, (+ 2 3) is 5. What exactly is going on there? -

how possible, going on there? is there name this? what other languages have same behavior? any without strong typing system? actually (+ 2 3) type error. (+) 2 3 or (+ 2) 3 give 5. this behaviour simple , intuitive if @ types. avoid complications of infix operators + , i'm going use function plus instead. i'm going specialise plus work on int , reduce typeclass line noise. say have function plus , of type int -> int -> int . 1 way read "a function of 2 int s returns int ". notation little clumsy reading, isn't it? return type isn't singled out specially anywhere. why write function type signatures way? because -> right associative, equivalent type int -> (int -> int) . looks more it's saying "a function int (a function int int )". 2 types in fact same, , latter interpretation key understanding how behaviour works. haskell views functions being single argument single result. there may computations hav...

iphone - Populate TableView With The Use of PopOverController - Objective C -

possible duplicate: unable populate tableview in popovercontroller - objective c i using button called "button". on clicking want display contents present in kkkk array in tableview of popovercontroller i.e. want small tableview pop cells show contents of kkkk array. i using following lines of code :: table = [[uitableviewcontroller alloc]init]; popover2 = [[uipopovercontroller alloc] initwithcontentviewcontroller:table];//tell view controller should shown [popover2 setpopovercontentsize:cgsizemake(200, 200)]; // set content size of popover [popover2 presentpopoverfrombarbuttonitem:uploadspace permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; //from should "pop" self.popovercontroller = popover2; popovercontroller.delegate = self; nsstring *hhdir = [nshomedirectory() stringbyappendingpathcomponent:@"documents"]; nsstring *hhfilepath = [hisdir stringbyappendingpathcomponent:@"hh.txt"]; nsarray...

android - How do I get the scene update handler to break when the action is up (AndEngine)? -

i'm trying increase scale of sprite using update handler. doesn't, however, allow scene action event called, sprite continues increasing in size. how update handler break when action up? have: the update handler: scene.registerupdatehandler(new iupdatehandler() { @override public void reset() { } @override public void onupdate(float psecondselapsed) { if(fillernum>-1){ if(filler[fillernum].active){ mphysicsworld.unregisterphysicsconnector(mphysicsworld.getphysicsconnectormanager().findphysicsconnectorbyshape(filler[fillernum].sprite)); mphysicsworld.destroybody(filler[fillernum].body); filler[fillernum].sprite.setscale(filler[fillernum].scale+=psecondselapsed*3); filler[fillernum].body = physicsfactory.createcirclebody(mphysicsworld, filler[fillernum].sprite, bodytype.dynamicbody, fixture_def); ...

cryptography - How to print a certificate's public key length and modulus separately in Java -

i found method called getpublickey() under java.security.cert.certificate class, methods returns length, modulus in 1 value publickey object. there way information separately ?? in case dealing rsa based public key publickey object receive rsapublickey instance. therefore can cast rsapublickey , use it's methods getpublicexponent() , getmodulus() .

objective c - how load many photos from url in background (asynchronous) -

i have method use load many images scroll view, when images load url scroll view stuck , can't understand how load them in background user not feel it. this method call few times (8) in "for" cycle. - (void)loadphotostoleftscroll{ //getting image information json nsmutabledictionary *photodict; photodict = [leftphotoarray lastobject]; //getting photo nsstring *photopath = [photodict objectforkey:@"photos_path"]; nslog(@"photo path:%@",photopath); nsdata * imagedata = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:photopath]]; uiimage *image = [uiimage imagewithdata:imagedata]; // use image how like, say, button background //calculating hight of next photo uiimageview *leftimage = [leftblockscroll.subviews lastobject]; //allocating photoview uiimageview *photoview = [[uiimageview alloc]initwithframe:cgrectmake(5 , leftimage....

How to process only single charater as and when user enters it on the console in java -

is there way of processing single charater in java using simple program? i should ask user enter charater, when user enters character java program should process before user enters next character, , should give immediate response user on character has entered.i tried public class inputchar { public static void main(string args[]) { system.out.printf("enter char ==> "); try { char temp = (char) system.in.read(); system.out.printf("you entered: " + temp + "\n"); } catch (exception exe) { exe.printstacktrace(); } } } but still in above program whenever user enters character not printing character right away.in above program when user presses 'enter' key program processes whatever has entered.is there anyway without pressing 'enter' key process first charater input user has entered. first system.in.read() gets input user. allows user enter numbe...

How can we know whether an application installed in the android device reads contacts of our mobile? -

i have 1 small problem i.e whenever install application in our android mobile need find whether application reads our contacts or not. if application reads contacts have raise 1 alert box red mark , information. thats why creating 1 application find, newly installed application reads our contacts or not. pls me. , regards. possible duplicate... answer here: java: need way shorten code packagemanager p = context.getpackagemanager(); final list<packageinfo> appinstall = p.getinstalledpackages(packagemanager.get_permissions | packagemanager.get_providers)

java - Getting blank page while opening PDF file in IE8 -

i facing 1 issue in our client server. we're unable open pdf file in ie8 browser ssl port (google chrome , firefox , ie9). found solutions different sites.. didn't help. able open pdf file our local development server , local machine server. same code deployed in our client environment. on click of pdf file link, getting blank page (should generate pdf file dynamic values). not using no-cache , no-store in header.. using jsp, javascript, struts , adobe reader 10.1.3 version , win 7 ie 8 , weblogic 9.2 server. please provide solution resolve issue.. there issue releated ssl port or adobe reader?

c# - convert into hash code and decrypt it -

i pass loan id, social security number , zipcode in url. loanid: 205689 ssn no: 555-896-4569 zip code: 12345 the url http://localhost/product/abc/manager/internet/paycredential.aspx?loanid=205689 i need convert social security number , zip code hashcode security purposes , pass them in url. decrypt them when page called. how can this? don't bother reinventing wheel. use ssl - communications encrypted, including urls.

javascript - How to "pop out" an IFRAME within my document? -

i loading page same domain iframe on page. after interacting javascript-driven form in iframe want take on entire document. can't set page's location of iframe because there's no way state want in passing url parameters. all references can find jumping out of iframe s page in iframe controlling popping out. want pop out iframe code in context of main document. (my project google chrome user script interacting 3rd party site have no server control over.) i'm using jquery vanilla javascript fine of course. you can't "pop out" of iframe normal method ( location.href = "..." ), because lose form , js state. likewise, code like: document.head=frames[0].document.head; document.body=frames[0].document.body; would appear work not preserve js state. it may possible iterate on frame's contents , copy structure and values current page, seems fool's errand me. i recommend make look frame has taken over. can cod...

iphone - import main project file in referenced project ? -

i integrated three20 project in app. want go called class. unable import class. in ttphotoviewcontroller: mainmenuvc *mmenu = [[mainmenuvc alloc] init]; [self.navigationcontroller pushviewcontroller:mmenu animated:yes]; [mmenu release]; but xcode cant file class. "use of undeclared identifier..." i tried import following, none worked: #import <myapp/mainmenuvc.h> #import "myapp/mainmenuvc.h" #import <../myapp/mainmenuvc.h> have tried this [self.navigationcontroller poptorootviewcontroller animated:yes]; you cannot import class files vice versa means. if import class b in class this: import "b" cannot import class in class b this: import "a" instead use @class "a" in .h file

sql - Very large "delete from" statement with "where" close, should I optimize? -

i have classic "sales" database contains millions of rows in tables. on each of these large tables, have associated "delete" trigger , "backup" table. this backup table keeps "deleted" rows last 7 days : trigger starts copying deleted rows backup table, perform delete in backup in fashion : create trigger dbo.trigger on dbo.example_data delete insert example_backup select getdate(), * deleted delete example_backup modified < dateadd(dd, -7, getdate()) the structure of backup table similar original data table (keys, values). difference add in backup tables "modified" field, integrate key. a colleague of mine told me should use "a loop" because delete statement cause timeouts/issues backup table contains several millions of rows. delete blow @ point ? should in different manner ? it looks sybase 12.5 supports table partitioning; if design such data can retained 7 days (using hard breakpoint), partition ta...

joomla 2.5 how to search the kunena component content from main serach bar? -

need search content website , kunena component (both latest version). search must main search bar (default joomla). how configure search query? the best approach write search plugin kunena. there such plugin j1.5, , can seen on list @ [jed][1]. if don't have j2.5 version, shouldn't difficult download simple j2.5 plugin same list use reference write own kunena tables.

php - mySQL query complicated join producing random and erroneous number -

the following code supposed find electors not have postal vote, have telephone number not in possession of codes listed in table called voting intentions pledges or not listed in table @ all. from electors,voting_intention electors.telephone > 0 , electors.postal_vote != 1 , ( electors.mosaic not in ('e1','e2','e3') or ( electors.id = voting_intention.elector , voting_intention.pledge in ('u','w','x') ) or electors.id != voting_intention.elector ) at moment producing count of on 2 million records many times number in database. wrong can't see error. from electors e left join voting_intention v1 on e.id = v1.elector , v1.pledge in ('u','w','x') left join voting_intention v2 on e.id = v2.elector e.telephone > 0 , e.postal_vote != 1 /* not have postal vote?? */ , (e.mosaic not in ('e1','e2','e3') o...

PHP , Facebook comments -

i have website located here www.sonnysgolfleague.com trying integrate facebook comments on it. site uses cutenews news articles. following code inserted index.php <script> (function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/all.js#xfbml=1&appid=<ВАШ_appid>"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> then on add comment form cute news use following code <div class="fb-comments" data-href="http://sonnysgolfleague.com/index.php?subaction=showcomments&id={news- id}&archive=&start_from=&ucat=1&" data-num-posts="2" data-width="470"></div>` which works when leave comment on news story shows comment on every news story. believe becaus...

asp.net mvc 3 - Why unobtrusive MVC validations are not working in IE7 and IE8? -

i have application in asp.net mvc 3 using razor . have setup data annotations on text boxes along jquery validation , unobtrusive validation . the thing is, fields have custom validation logic using plain old vanilla javascript following functions . function validation() { var signup = signupvalidation(); var book = bookingvalidation(); if (signup && book) { return true; } else { showerrormessage(); return false; } } function showerrormessage() { $('span#errormessage').html('these fields required'); } where signupvalidation() , bookingvalidation() functions returns either true or false on basis of other validation logic. this code submit button. @using (html.beginform(mvc.booking.actions.atwork(model: null), formmethod.post, new {@onsubmit = "return validation()" })) { @html.partial("_bookingview") } this approach working in browsers except ie-7/8. ...

c++ - stringstream code separating words - how does this thing work? code snippet inside -

i have code found cut string words. cant figure out how while part works. how know extract words without whitespaces buf variable? seems extraction operator (>>) used both progress bits buffer, , return true loop - cant figure out how knows cut words whitespaces. string buf; // have buffer string stringstream ss(str); // insert string stream vector<string> tokens; // create vector hold our words while (ss >> buf) tokens.push_back(buf); that std::operator>> , not bitwise operator, , used extract formatted data, in case std::string . returns reference stream being read. a stringstream can used in boolean context due conversion operator void*() , allowing used terminating condition in loop.

scalability - Conflict-free Replicated Data Types (CRDT) vs Paxos or Raft -

when idea use crdt instead of paxos or raft? if can use crdt, so. should better performance. enables interesting use cases such working offline , merging later. not possible design things such crdt work you. in case, paxos can solve hard problems you. but if you've decided use paxos, should limit how work being done directly through paxos algorithm. instead performance reasons want reserve paxos necessary operations such master election, , let replicated master setup handle decisions. (in high throughput environment master delegate responsibility specific shards specific children, replicate off each other. not let master become bottleneck...) that said, easier claim you'll wave magic wand of paxos in practice. in light may find http://static.googleusercontent.com/external_content/untrusted_dlcp/research.google.com/en/us/archive/chubby-osdi06.pdf interesting description of difficulties real-world paxos implementation encounter.

visual c++ - Is there a way to override the handler called when a user clicks a checkbox in a CListCtrl? (MFC) -

i trying disable user's ability alter state of checkbox in list control. changing state pragmatically. handle lvn_itemchanged message, , trying alter state there isn't option due layout of rest of program. have tried doing hittest when user clicks in list control , resetting checkbox there isn't giving me exact results looking for. is there specific message sent or function can override when user clicks checkbox itself? override handler or catch message doesn't go anywhere. solution: i ended removing lvs_ex_checkboxes flag , created own implementation. way there 1 way change icons. reading link previous question gave me idea set "busy" flag, otherwise stack overflow errors. // in dialog class m_clistctrl.setimagelist(&m_imglist, lvsil_small); // custom checkboxes (only 2 images) // ... void cmydialog::onlvnitemchangedlist(nmhdr *pnmhdr, lresult *presult) { if(busy) { return; } // .... } // when calling setcheck function: bu...

php - Google Custom Search initial value -

Image
i have created google search function, leave textfield blank instead of appearance:- it possible? thanks! assuming you're using stock custom search embed code, add following css: form#cse-search-box div input { background-image: none !important; }

adobe - InDesign CS5 / Script: Can I convert TIFF and PNG images to `black and white`? -

i have script scans document image types, converts them black , white, , exports black , white images new folder. seems if indesign export these image file-formats:   jpeg, tiff, , png (it not export gif files). however, seems indesign doesn't have colorspace.gray or colorspaceenum.gray properties tiff , png files (it does have property jpeg files, though). so, there way convert tiff , png files black , white in indesign's extendscript? if there not , reasoning not providing black , white conversion these file types? here code, of exports black , white jpeg files: var document = app.activedocument; var newfolder = createfolder(document); // if subdirectory dne, create folder function below saveallimages(document, newfolder); // function below function createfolder(doc) { try { /* * type-casting filepath property (of type object) string type; * must string type concatenate subdirectory variable (also of type string) ...

What is wrong with this simple python metaclass? -

digression start i learnt metaclasses in python. don't think creators of python wanted use them. mean name metaclass might not class in cases enough divert people away concept! digression end on question. wrote simple metaclass add default doc string classes created in module. not working: def metest(cls,name,bases,dict): cls.setattr(cls,'__doc__',"""default doc""") return type(cls,(),{}) __metaclass__=metest class test(object): pass print test.__doc__ t=test() print t.__doc__ output: none none what doing wrong? i made example work: def metest(name, bases, dict): print name, bases, dict dict['__doc__'] = """new doc""" cls = type(name+"_meta", bases, dict) return cls class test(object): "old doc" __metaclass__ = metest print test print test.__doc__ t = test() print t.__doc__ make "meta class" us...

php - smarty grammer error cannot use symbol [] -

this line: {$data["bank_data"]["arrangement"]["id"]} returns following error: php (5.3.9) error (e_user_error): file: smarty.class.php line: 1092 type: smarty error: [in tke-g-admin_scopeofwork.tpl line 10]: syntax error: unrecognized tag: $data["bank_data"]["arrangement"]["id"] (smarty_compiler.class.php, line 446) this line: {$data.bank_data.arrangement.id} does not return error. works correctly. so, why first section wrong? how use [] access array. judging error posted, you're using smarty2. the docs give 2 options accessing arrays: {* string indexes *} {$some.array.value} {* numeric indexes *} {$some[0][1]} you can use variable provide index so {assign var="key" value="array"} {$some.$key.value} == {$some.array.value} using "trick", can access string indexes containing "special characters" such . , [] or . smarty3 bit more fl...

objective c - How to config RestKit errorMapping to accept more complex response? -

the errormapping defined as: [[[[rkobjectmanager sharedmanager] mappingprovider] errormapping] setrootkeypath:@"error"]; it works simple error message string: render status: :unprocessable_entity, json: { :error => 'cannot create topic' } however, fails hash response: render status: :unprocessable_entity, json: { :error => @topic.errors } and gives: w restkit.object_mapping:rkobjectmappingoperation.m:239:-[rkobjectmappingoperation transformvalue:atkeypath:totype:] failed transformation of value @ keypath ''. no strategy transforming 'jkdictionary' 'nsstring' is there way configure restkit errormapping accept hash response (and stores in nsdictionary )? i assume using default error mapping? maps error keypath rkerrormessage class. class expects nsstring, have nsdictionary (jkdictionary because using jsonkit, still...). if don't want modify server code, can create own error class on iphone , ...

gpg.exe is not decrypting file in the ssis package after creating a job -

i have inserted execute process task in control flow of ssis package gets encrypted files folder , decrypts file using gpg.exe. have passed key passphrase in expression of execute process task. while running package directly executes , decrypts file. but, when create job in sql server 2005 of package , execute job, shows executed neither of file being converted. any suggestion what's going wrong or other security issues existing in job. have spent amount of time on googling on not found solution. finally found solution, there no error in package or job. security issue not allowing execute job containing executable file. did have added current user detail in sql server configuration manager>>sql server agent. instead of built in account check account , enter current account detail.

Entity Framework executes both INSERT and UPDATE stored procedures when you do INSERT -

i have stored procedure, mapped in entity framework 4.1 object. call made within using (transactionscope transaction = new transactionscope()) { try { dbentity.car.addobject(carinfo); dbentity.savechanges(); /* other object savings */ transaction.complete(); dbentity.acceptallchanges(); } catch (exception exp) { throw exp; } { dbentity.dispose(); } } i see stored procedure mapping done currently. if execute stored procedure alone on ms sql server, executes correctly. here stored procedure alter procedure [dbo].[carinsert] @qty int ,@styleid int ,@tfee money ,@hwaytax money ,@ofees money ...

c++ - Curiously recurring templates with template leaf classes -

i thinking using curiously recurring template pattern application. however, classes operate on user defined types. understand if possible create structure similar 1 shown below: template <class t_leaftype> class basetrajectorypoint { }; template <class mytype> class mytrajectorypoint: public basetrajectorypoint<mytrajectorypoint> { private: mytype a; }; the code above fails compile following error: type/value mismatch @ argument 1 in template parameter list ‘template class basetrajectorypoint’ are there alternative ways of approaching problem? use static polymorphism, prefer define possible methods in base class. template <class t_leaftype> class basetrajectorypoint { }; template <class mytype> class mytrajectorypoint: public basetrajectorypoint<mytrajectorypoint<mytype> > { private: mytype a; }; mytrajectorypoint isn't type, it's template; when pass template parameter, it...

c# - Find out if server is running, asp.net -

i have server , website running 100% fine. the thing is, want website show on default page "status" of server. thinking pinging server code: uri url = new uri("http://www.abhigrgrgrgrgsheksur.com"); string pingurl = string.format("{0}", url.host); string host = pingurl; bool result = false; ping p = new ping(); try { pingreply reply = p.send(host, 3000); if (reply.status == ipstatus.success) return true; } catch { } return result; the code website found online, not mine. the thing is, if put code on default page on website, when people "reverse" pings server, question is, can drop server? or stop working? or that? server not website. it's running process (minecraft server). if understood correctly worried on every refresh of page ping , multiple ping call made so statement made in remarks paragraph ping class @ http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx might concern...

vb.net - Deleting menu item results index error ("source not found") -

in vb.net 2010, whenever delete menu item on windows form (a mainmenu1 object), exception thrown @ run-time suggesting there index value missing -- "source not found" error. need go mainmenu1 object on bottom of form @ design time , something? (btw, have tried deleting source code menu item, , menu item, , exception still thrown). basically, occurring not allowing me delete menu item, , successful run thereafter. i had problem. simple fix restore menu clicking undo. run code make sure still works. when have done this, close visual studio. open vs , load project. delete item menu , run project. should fine

c++ - Logic Help: comparing values and taking the smallest distance, while removing it from the list of "available to compare" -

okay, have been set task of comparing list of photons using 1 method (iu) , comparing (tsp). need take first iu photon , compare distances all of tsp photons, find smallest distance, , "pair" them (i.e. set them both in arrays same index). then, need take next photon in iu list, , compare of tsp photons, minus 1 chosen already. know need use boolean array of sorts, keeping counter. can't seem logic out entirely. the code below not standard c++ syntax, written interact root (cern data analysis software). if have questions syntax better understand code, please ask. i'll happily answer. i have arrays , variables declared already. types see called eemcparticlecandidate , that's type reads tree of information, , have whole set of classes , headers tell how behave. thanks. bool_t used[2]; if (num[0]==2 && num[1]==2) { titer photoniteriu(mphotonarray[0]); while(iu_photon=(eemcparticlecandidate_t*)photoniteriu.next()){ if (iu_...

java - Why can't Apache HttpClient 4.2 retrieve this page? -

i'm trying retrieve page using apache httpclient: http://quick-dish.tablespoon.com/ unfortunately, when try this, returns following (as returned jsoup, it's returning http... string itself): <html> <head></head> <body> http/1.1 200 ok [server: nginx/1.0.11, content-type: text/html;charset=utf-8, last-modified: mon, 02 jul 2012 15:30:40 gmt, vary: accept-encoding, cookie,accept-encoding, x-powered-by: php/5.3.6, x-pingback: http://quick-dish.tablespoon.com/xmlrpc.php, x-powered-by: asp.net, content-encoding: gzip, x-blz: lb1.blaze.io, date: mon, 02 jul 2012 16:06:21 gmt, content-length: 11723, connection: keep-alive] </body> </html> here code (note i'm emulating google bot i've found web servers tend better behaved way): url sourceurl = new url("http://quick-dish.tablespoon.com/"); httpclient httpclient = new contentencodinghttpclient(); httpclient.getparams().setbooleanparameter("http.protocol.handle-...

Using share intent in android for instagram -

i want share image instagram in app. facebook, twister... know, can using share itent wit instagram don't know. please me. in advance! here solution using share intent this sample intent share = new intent(intent.action_send); share.settype("image/jpeg"); share.putextra(intent.extra_stream, uri.parse("file://"+environment.getexternalstoragedirectory()+"/pictures/jusgramm.jpg")); //share.putextra(intent.extra_stream,data); startactivityforresult(intent.createchooser(share, "share image via"),share_pic_request);

Add a Text overlay to this slideshow from a <p> tag using jquery -

i have slideshow , want each image have headline , description overlay image , fade in , out images it... i think have copy sol variable on each instance used //sol = document.getelementbyid('slidy').getelementsbytagname('img') //var sho = document.getelementbyid('slidya').getelementsbytagname('a'); but trying see if there way call both the:'a' , 'p' tags without adding whole mess of code for instance here want html like <div id="slidy" class="slidepart fl"> <img width="100%" src="/img/1.jpg"> <p>here text...</p> <img width="100%" src="/img/2.jpg"> <p>here somemore text...</p> <img width="100%" src="/img/3.jpg"> <p>even more text...</p> <img width="100%" src="...

css - Centering a Float Left Menu with Unknow Width -

i want li element of ul of menu in center, tried lot of methods not going on. take on css: #menu { float: left; width: 767px; height: 38px; margin: 11px 0 0 14px; background: url(images/menubg.gif) repeat-x; -webkit-border-radius: 0px 0px 7px 7px; border-radius: 0px 0px 7px 7px; border: 1px solid #efeff1; } #menu ul { list-style: none; text-align: center; padding: 0; margin: 0; height: 40px; } #menu ul li { float: left; color: #767676; height: 18px; padding: 11px 0px 11px 0px; display: inline; } #menu ul li { font-family: arial, helvetica, sans-serif; color: inherit; font-size: 12px; text-decoration: none; font-weight: bold; display: block; padding: 0px 23px 2px 23px; border-left: 1px soli...

c# - Using Reflection to Upsert Derived Entities in Generic Repository -

a bit new @ repository pattern. trying build generic repository handle state changes derived entities. i've done far create custom attribute flag property 1 needs upserted. attribute: public class derivedobjectattribute : attribute { public enum entitytype { reference, object } public entitytype derivedtype { get; set; } } i define attribute property on want cascade state changes. sample entity: public class fightingcharacter : baseentity { public costume costume { get; set; } [derivedobject(derivedtype=derivedobjectattribute.entitytype.reference)] public specialfinish specialfinish { get; set; } [derivedobject(derivedtype = derivedobjectattribute.entitytype.reference)] public list<movelist> movelist { get; set; } } so class, costume property not need cascade, specialfinish , movelist properties should. then in repository: public class datarepository<t> : irepository<t> t : baseentity { ...

jqGrid permutation array -

in jqgrid trying use permutation array saving reorder state of columns. eg. basic column state perm = [0,1,2,3,4] column 3 hidden , column 0 checkbox. have custom context menu use give me perm array of [0,1,3,2,4] have read in documentation permutation array needs start 1, right? when try using "remapcolumns" functions of jqgrid , pass perm array, works fine. if try hiding , showing columns couple of times, column order getting messed with. please me understand these indices permutation array stand for? column indexes visible columns? should hidden columns part of array? happens in case of frozen columns? in examples have seen perm = [0:1, 1:3, 2:2, 3:1] correct way? using grid.jqgrid("remapcolumns", perm, true); try use last parameter of function grid.jqgrid("remapcolumns", [0,1,3,2,4], true, false); permutation, updatecells, keepheader wiki:methods

asp.net mvc 3 - Is it possible to set a Knockout dependent observable with AJAX POST -

using knockout 2.0 , mvc3 razor forms, not able make dependent observable work when introduce ajax method. have set set of observables part of calculation, , when return product of observables, able set span tag correct result. however, when try use ajax method handle observables , return result, unpredictable behavior. first, appears ajax post not pick 1 of observables when input fields updated (var b posts action method 0, updated), , seems not able set result when evaluates correctly. appears there timing issue either observables or ajax call. although keeping performing calculation in javascript works fine, intent call ajax methods more complicated logic. have removed call ko.applybindings doc.ready(), , moved script methods bottom of page- way found make partly functional. viewmodel set follows: var viewmodel = { a: ko.observable(0), b: ko.observable(1), c: ko.observable(2), // commented out, since // dependent observable handle // d: ko.observable(0)...

javascript - how can i automatically calculate an expression from a text field -

how can automatically calculate expression text field .. there function or thing .. <input type="text" value="3+4" id="txt"> var result = function_in_javascript(document.getelementbyid("txt").value) alert(result )// 7 try eval(document.getelementbyid("txt").value) edit: though?

linux - Install ruby on rails on centOS -

these days ,i try install redmine (a web app based on ruby on rails) on centos. followed offical guide on ruby website.however met problem: in terminate: [root@localhost aaa]# cd blog [root@localhost blog]# rails -v rails 3.2.6 [root@localhost blog]# rails server => booting webrick => rails 3.2.6 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server [2012-07-03 07:01:32] info webrick 1.3.1 [2012-07-03 07:01:32] info ruby 1.8.7 (2012-06-29) [i686-linux] [2012-07-03 07:01:32] info webrick::httpserver#start: pid=20517 port=3000 ... it works well. when start app redmine. [root@localhost aaa]# cd redmine [root@localhost redmine]# rails -v script/rails:6:in `require': no such file load -- rails/commands (loaderror) script/rails:6 [root@localhost redmine]# rails server script/rails:6:in `require': no such file load -- rails/commands (loaderror) script/rails...

python - Sending data via USB using PyUSB -

i need send data via usb using python, i'm using pyusb (http://sourceforge.net/apps/trac/pyusb/) usb port available, , tried send message: devlist = usb.core.find(find_all=true) dev in devlist: cfg in dev: intf in cfg: sys.stdout.write('\t' + str(intf.binterfacenumber) + ',' + str(intf.balternatesetting) + '\n') ep in intf: sys.stdout.write('\t\t' + str(ep.bendpointaddress) + '\n') if ep.bendpointaddress: try: dev.write(ep.bendpointaddress, 'test', intf.binterfacenumber) except exception: print "\t\terror : dev.write("+str(ep.bendpointaddress)+", 'test', "+str(intf.binterfacenumber)+")" the result : 0,0 129 error : dev.write(129, 'test', 0) 0,1 129 error : dev.write(129, ...

c# - Lync: VideoWindows of AVModality.VideoChannel are null after successfully calling BeginStart (COMException HRESULT: 0x80029C4A TYPE_E_CANTLOADLIBRARY) -

Image
we trying incorporate lync communication (lync sdk 2010) our application , have run issue videowindows ( capturevideowindow , rendervideowindow ) of avmodality 's videochannel : null, after calling beginstart . connection established. can talk. our own video shown in remote lync client. avmodalitystate connected . videochannelstate goes connecting receive send . it not matter when , how try access them: directly after beginstart , in asynccallback of beginstart , in response various state changes or in response external trigger (user click event); in main/ui thread or in event/callback thread. 2 video windows null. in example application "%programfiles%\microsoft lync\sdk\samples\audiovideoconversation", works intended: beginstart has finished, can access non-null video windows. in our little stand-alone prototype project, works, too. in our real application, not. we have double checked , have run out of ideas of might cause problem. any ideas, hints? s...

NotifyPropertyChanged in java - Android -

does know if there in java similar notifypropertychanged in c#? have been searching around, , there no proper answer. here senerio: in fact,i working on android application. applications read data remote bluetooth device via bluetooth socket. once data received socket, data decoded decoder(it class) , update value ui. however, have decoder class decode data bluetooth device , activity manage display value ui. need pass decoded value decoder ui. think need notifypropertychanged event, when there updated value decode, inform activity class update ui. pure java (not android specific) have interface typically used beans handle property change events can use. classes involved are: propertychangesupport class extend in order fire change notifications inside of setter methods. propertychangelistener instances register , listen change events. propertychangeevent objects encapsulate data passed change. here's article oracle docs describing interface in more deta...

How to edit the same file in multiple tabs in vim? -

i edit long files in vim have blocks of code in multiple disparate places in file need going , forth between. obviously, 1 way of solving split window :split , edit each portion in different split window, , :w in either window save whole file. , if have large enough screen have use vim on low-resolution laptop , don't want reduce screen space further splitting window. in case, i'd edit file in multiple tabs , , treat each separate tab separate view split. can sort of mimic using :tabopen <the same filename> once have 1 copy of file open, sort of hacky — doesn't work if i've made changes file because vim thinks i'm opening file second time. is there way behavior want tabs in vim? the :tab command takes command argument. so can this: :tab split this work if buffer modified, , save in either tab saves file, updating saved state in both.

c++ - OpenGL shader(s) refusing to link -

problem: been struggling code load external shaders , not working. no matter how rewrite code , try again same error every time. the shaders compile not link, there doing wrong in function? error catching blocks work great btw. fragment shader(s) failed link, vertex shader(s) failed link. error: error(#280) not shaders have valid object code. error: error(#280) not shaders have valid object code. i'm using freeglut, x64 windows 7 , mingw (and not using ide) usage: in mainloop have gluint programid = loadshader("vertex.shader", "frag.shader"); enable gluseprogram(); gluint loadshader(const char * vertex_file_path, const char * fragment_file_path) { gluint vertexshaderid = glcreateshader(gl_vertex_shader); gluint fragmentshaderid = glcreateshader(gl_fragment_shader); gluint programid = glcreateprogram(); glint status = gl_false; int infologlength; std::string line = ""; //read in , compile std::strin...

javascript - Jquery tablesorter sorting is not working -

hai coding coding jquery tablesorter <script type="text/javascript"> $(document).ready(function() { $("#sorttable").tablesorter() .tablesorterpager({ container: $("#pagerone"), positionfixed: false }) }); </script> the data 14.6km,about:21 mins 12.6km,about:41 mins 9.6km,about:15 mins 5.6km,about:5 mins 140.6km,about:3 hours 21 mins like above, how sort above type of data,please give me solution problem data not sorting jumping data. please problem <table id="sorttable" class="yui" width="580px" style="display: block; "> <thead><tr><th align="center" class="header headersortdown"><a href="#" title="click header sort">sort1</a></th><th align="center" class="header"><a href="#" title="click header sort...