Posts

Showing posts from April, 2015

asp.net mvc 3 - Div won't refresh with Ajax.ActionLink -

i trying use ajax.actionlink refresh list of items on page. can basic ajax updates working in test page without issue, in particular case i'm not able work. my index controller , view simple (see below). index view renders list action, items listed , ajaxlinks are. ajaxlinks call "updatestatus" action changes status of item. after happens list should no longer show item return list action. however, while code executes no errors, page nt update or refresh. can see problem? public function index(optional byval status string = "pending") actionresult viewbag.status = status return view() end function public function list(optional byval status string = "pending") actionresult 'code populate model filtered list here' return view(plvm) end function public function updatestatus(byval id integer, byval status string, byval actionstatus string) 'code update status here...

Unable to read/write to Coldfusion 8.01 tmpCache directory on server restart -

i'm having odd issue installation of cf8.01. updated coldfusion image hotfix (kb403411) & discovered cf started needing use of new directory image manipulation functions [imageresize()] {coldfusionh_home}/tmpcache & subdirectories /cffileservlet/_cf_image/. tmpcache did not exist & had created, it's subdirs created automatically. there 3 problems here: coldfusion not appear deleting temporary files subdirs an error thrown on first attempt write these dirs after first restart of coldfusion. subsequent read/write attempts fine. [trace posted below] a directory entry has added sandbox settings allow access directory [actually more of pia issue - correct behavior sandboxes] so have several questions: how test/ensure cf deleting these files when no longer needed what possible cause of startup error & how fix? the sandbox thing pain, can cf told use /tmp or /var/tmp or instead i've tried several different owner/permission combinations on dir...

lua - Extract function body -

how can extract function body (as string)? example call c function, extract function stack, check if type lua_tfunction , need body? when function on stack, has been compiled. best can try lua_dump , decode bytecode .

android - Root directory/Archive file not found while importing -

i trying import archive file containing android application project in eclipse . receive message no projects found import . same goes when importing root directory. why getting message? the project in question may not have been set work eclipse. example, might not have .classpath , .project files. if so, can still "import" android project -- start new android project , choose "create project existing source".

character encoding - Doctrine Dbal: How to set collation? (in Symfony2) -

i'm used creating pdo object in 4th parameter (driver options): array(\pdo::mysql_attr_init_command => "set names {$this->charset} collate {$this->collation}") how can tell symfony 2 this? in configuration file can see 'charset' option. i need create tables specific collation: utf8_unicode_ci what can have tables created through command line created collation instead of latin1? i have been facing same problem. seems has dbal configuration. have found in pdo documentation following under pdo_mysql dsn — connecting mysql databases: charset ignored.

c# - UDP - Can I send two datagram parts, and make the receiving end combine them into one? -

this maybe stupid question, since relatively new udp here goes... if having 2 separate byte arrays need receiving side 1 big array, example: byte[] array1 = {1,1,1} byte[] array2 = {2,2,2} can avoid having create buffer , copy each array it, , send buffer, this: byte[] buffer= new byte[array1.length + array2.length]; buffer.blockcopy(array1, 0, buffer, 0, array1.length); buffer.blockcopy(array2, 0, buffer, array1.length, array2.length); udpclient.send(buffer, buffer.length); because if 2 big, , data rate high, copying uses system resources... can somehow tell udpclient starting udp fragmentation, , this: udpclient.imstartingonebigdatagram(); udpclient.send(array1, array1.length); udpclient.send(array2, array2.length); udpclient.thatsallfolks(); and sure receiving side get: byte[] recv = {1,1,1,2,2,2} i using c# this, , dont need use udpclient , making point. use equivalent of win32 api's wsasendmsg : public int send( ilist<arraysegment<by...

scala - How to find the #fragment in a URL in Lift -

i'm pretty new lift, , 1 of things i've been trying find how to, in context of snippet, find '#' in current page's url. if user visits http://www.example.com/some/path/page#stuff extract "stuff" that. i've been googling , searching api docs , have yet find this. i don't think part behind # ever gets sent server in first place. that's wikipedia has it: in uris hashmark # introduces optional fragment near end of url. generic rfc 3986 syntax uris allows optional query part introduced question mark ?. in uris query , fragment fragment follows query. query parts depend on uri scheme , evaluated server — e.g., http: supports queries unlike ftp:. fragments depend on document mime type , evaluated client (web-browser). clients not supposed send uri-fragments servers when retrieve document, , without local application (see below) fragments not participate in http redirections.

database - Create service to encapsulate business queries -

we have several (5+) applications hit same database , we're running issues applications take own hands build queries fetch same data. however, since different developers creating these queries they're not identical should be, returning different results time time. as far can see there 2 possible solutions. create library each application references proper query create wcf service encapsulate common queries used each application , create client each application use i'm leaning towards option 2 since give flexibility modify filters we're using in our queries, updating each application @ once. the service hierarchy like public class queryservice { private readonly irepository _repository; public queryservice(irepository repository) { _repository = repository; } public ienumerable<int> getcommonoperation() { return _repository.getcommonoperation(); } public ienumerable<anotherdto> anothercommono...

c++ - The thread has exited with code 1 (0x1) -

the thread 'unsigned long __cdecl open_thread(void *)' (0x7380036) has exited code 1 (0x1) is error or thread executed doe sthe code indicates exit code 0 customarily used signal successful termination. exit code 1 seem indicate error. only in possession of specification of open_thread sure. you.

authentication - Rails: Roles/admin -

prefface i'm new rails & programming. working on first rails app--i have authentication omniauth , devise , simple article submission working users. i want 2 things: if user isn't specific role, reroute them page. if preference 'offline' allow admins view site. i have yet create prefferences table--looking suggestions. :) what's best way set simple roles? what's easiest way redirect users if they're not admin and if site 'offline'? i'm using cancan role-based authorization on current project. i've found works great including ability both of you're looking for. , documentation! oh, documentation. if gem authors wrote documentation cancan's, believe bring world peace. and added bonus, because written ryan bates , has railscast recorded it.

java - How to convert a color integer to a hex String in Android? -

i have integer generated android.graphics.color the integer has value of -16776961 how convert value hex string format #rrggbb simply put: output #0000ff -16776961 note: not want output contain alpha , have tried this example without success the mask makes sure rrggbb, , %06x gives zero-padded hex (always 6 chars long): string hexcolor = string.format("#%06x", (0xffffff & intcolor));

Android: I can't use a CursorAdapter because of concurrency concerns. What should I do instead? -

thank time. can clear possible, apologies in advance extent fail so. the situation: creating multithreaded android application deals local database. synchronization/concurrency reasons, want particular activity have no dealings @ cursor. right now, however, uses cursoradapter show data db on screen. the question: how can replicate functionality of simplecursoradapter without using cursor (because having open cursor introduce concurrency errors)? (using arraylist of objects work best, have lying around ready play with.) thank you. stick around , clarify needed. something may useful: if want deal cursors in threadsafe way on asynchronous thread (i.e. predictably) try using runonuithread: http://developer.android.com/reference/android/app/activity.html#runonuithread(java.lang.runnable) the code follows: activity.runonuithread(new runnable() { @override public void run() { //paste code here } }); this co...

android - Activity calls a second Activity but result is sent back BEFORE the second Activity calls onCreate()? -

i need here. basically, have activity. uses startactivityforresult() method call second activity (which part of same app). result code second activity returns result_cancel before oncreate() method of second activity called. this bewildering me. if change intent , call android messaging app activity , not own activity result code correctly after activity finishes. it's pretty obvious me when call own activity result must different. can me understand doing wrong , me fix issue? testing on android v2.2 my initial thought try using intent filter in android manifest , limiting intents single activity you're trying result from. i hope answers question!

c# - NHibernate Criteria Search By Time Of Day -

i trying create nhibernate criteria me posts created during time of day. example, want posts created between times of 12:15:00 , 2:20:00. post this public class post { public virtual datetime createdon { get; set;} } and mapping: <class name="post" table="posts"> <property name="createdon" not-null="true"/> </class> and use detachedcriteria (this part of larger search) similar to: var criteria = detachedcriteria.for<post> .add(restriction.ge("createdon", time(12, 15, 00)) .add(restriction.le("createdon", time(2, 20, 00)); i know isn't @ correct shows trying accomplish. using sql server database. if create query directly in sql use datepart function. this question inquires calling datepart function nhibernate. use nhibernate projection: projections.sqlfunction. what complicates things little need have multiple projections, 1 hour, minu...

Unexpected shared data using JavaScript prototypal inheritance -

coming java background, expect properties in base class of instance of class unique other class instances use same base class. in javascript, properties stored in "base class" appear shared between various instances of "base class". instance, see here: http://jsfiddle.net/4waqv/ as can see, baseview.settings accessed via both viewone , viewtwo . changing value in baseview.settings in 1 instance affects value in other instance. if move settings: {} out of baseview , viewone , viewtwo , works way expect. http://jsfiddle.net/4waqv/1/ however, don't want clutter viewone , viewtwo properties. can dynamically create this.settings inside baseview.setprop() : http://jsfiddle.net/4waqv/2/ are there better ways deal this, or solution? note i'm using backbone.js views in example, expect javascript prototype inheritance solution result similarly. can see backbone uses typical methods of creating prototypical inheritance: https://github....

MySQL - on update cascade (multiple tables) -

first - i've been looking answer on past few days no luck. meaning i've seen answers, tried them , still errors. i'm point looking @ code makes me sick. appreciated. i have 3 tables clients, projects , project_notes. project can assigned 1 client, clients can have multiple projects. project can have multiple notes note can assigned 1 project. what i'm looking if 'trash' client projects associated client 'trashed' well. project notes projects trashed 'trashed' well. i can 'trash' project 'trash' associated project notes 'trashed' well. i assume need use foreign keys , on update cascade - i've been trying. think i'm screwing way primary keys set - new me wrong. i can create tables no problem. can insert data tables without , problem. however, 1 run update query on either clients or projects table i'm not longer able insert data table except clients. here's code used create tables: create tab...

plot - JFreechart Polar Chart shape annotation -

Image
i trying color different region of polar chart different colors. e.g coloring region between angle 20 , 60 , between radii 2 , 4. how can this? thinking of using shape annotation , there drawing arc, seems there no shape annotation polar plots. ideas? thank you import java.awt.color; import java.awt.dimension; import java.util.arraylist; import java.util.list; import javax.swing.jframe; import org.jfree.chart.chartpanel; import org.jfree.chart.jfreechart; import org.jfree.chart.axis.numberaxis; import org.jfree.chart.axis.numbertick; import org.jfree.chart.axis.valueaxis; import org.jfree.chart.plot.polarplot; import org.jfree.chart.renderer.defaultpolaritemrenderer; import org.jfree.chart.renderer.polaritemrenderer; import org.jfree.data.xy.xydataset; import org.jfree.data.xy.xyseries; import org.jfree.data.xy.xyseriescollection; import org.jfree.ui.textanchor; public class test2 extends jframe { private static final string title = "archimedes' spiral"; ...

ajax - Rails Gem: Ajaxful_rating route problem -

i'm trying ajaxful_rating work rails installation. i have running find until user clicks on star rate. when click star, browser url points http://localhost:3000/entries/1/rate?dimension=design&show_user_rating=false&small=true&stars=4 , error: no route matches "/entries/1/rate" but routes say: resources :entries collection ... end member post 'rate' put 'submit' end is there i'm missing? js not included? have included jquery right now. edit try { element.update("ajaxful_rating_design_no-small_entry_1", "<ul class=\"ajaxful-rating\"><li class=\"show-value\" style=\"width: 60.0%\">global rating average: 3.0 out of 5</li><li><a href=\"/entries/1/rate?dimension=design&amp;show_user_rating=false&amp;small=false&amp;stars=1\" class=\"stars-1\" data-method=\"post\" data-remote=\...

c# - Fileupload control in ASP.Net 4 how to return failure reason? -

i have simple web page on intranet can use upload file toa "drop" folder. of users aren't able upload files. how details on caused upload failure? i know has rights need little more detail. any suggestions? tia j look in application event log on web server , there details of uncaught exceptions thrown asp.net

orchardcms - Instaling Orchard at the root stops other ASP.net applications at different folders -

after installing orchard using webmatrix @ root other applications stop. reason , how can make other applications in working condition. thanks all. edit: showing not load file or assembly 'system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. are sure iis web applications? have site orchard @ root , unrelated application runs in folder, without problem. another thing check web.config. because orchard above , has pretty restrictive config, may have restore settings in sub-dirs.

Jquery Slideshow Script, Pause on Click -

i'm new jquery , javascript in general, sorry if simple question. hugely appreciated. have slideshow auto-paging , want when click on controller (#thumbs li) show pauses. here's js: <script type="text/javascript"> var currentimage; var currentindex = -1; var interval; function showimage(index){ if(index < $('#bigpic div').length){ var indeximage = $('#bigpic div')[index] if(currentimage){ if(currentimage != indeximage ){ $(currentimage).css('z-index',2); cleartimeout(mytimer); $(currentimage).fadeout(400, function() { mytimer = settimeout("shownext()", 3500); $(this).css({'display':'none','z-index':1}) }); } } $(indeximage).css({'display':'block', 'opacity':1}); currentimage = indeximage; ...

.net - Javascript not executing from ASP.NET -

please @ code , find out why isnt working. not getting alert in webpage. but, console.writeline beneath getting executed. private void publishloop() { while (running) { thread.sleep(5000); dtmessages = (string)(cache.get(key)); if (dtmessages == null) { //publish here dtmessages = loadmessages(); system.diagnostics.debugger.log(0,null,dtmessages); page.clientscript.registerstartupscript(this.gettype(),"clientscript", "alert('hi');",true); console.writeline(dtmessages); } } } edit: can register 1 unique key per response. you're running line of code inside while loop, keeps registering same key. need give unique key parameter each time call function. in case, maybe can have counter in loop , append key string int = 0; while (running) { ...

silverlight - Caliburn.Micro convention for Accordion and AccordionItem -

Image
i'd use caliburn.micro conventions accordion control silverlight , wpf toolkits: view: <grid background="white"> <controls:accordion x:name="items"/> </grid> viewmodel: public class shellviewmodel : ishell { public shellviewmodel() { items = new list<accitemviewmodel> { new accitemviewmodel { displayname = "header one", content = "content one" }, new accitemviewmodel { displayname = "header two", content = "content two" }, }; } public ienumerable<iscreen> items { get; set; } public class accitemviewmodel : screen { ...

javascript - Permission denied error on IE8 and 7 -

webpage error details user agent: mozilla/4.0 (compatible; msie 7.0; windows nt 6.1; slcc2; .net clr 2.0.50727; .net clr 3.5.30729; .net clr 3.0.30729; .net4.0c; bri/2) timestamp: fri, 1 jul 2011 01:21:21 utc message: permission denied line: 55 char: 17 code: 0 uri: http://www.testing.com/phone_select/ message: permission denied line: 55 char: 17 code: 0 uri: http://www.testing.com/phone_select/ current domain http://www.gale.testing.com/ . error occur when tried redirect http://www.testing.com/phone_select/ top.window.location is because cross domain problem? no ajax involved. in firefox , chrome works fine. ie7 , ie8 cause problems. use top.location.href instead?

c# - Using Generic Event Handler for Controls in Windows Forms! -

i have bunch of controls populated database when form loads. using dictionary (control.name key , control.value value) store inital values. when user changes values using other dictionary load current values , compare inital dictionary. if values different running kind of code prompt user of changes. think more hackish , looking better solution. please advise. thanks try this for each ctrl control in me.controls if typeof ctrl checkbox addhandler (directcast(ctrl, checkbox).checkedchanged), addressof control_changed elseif typeof ctrl textbox addhandler (ctrl.textchanged), addressof control_changed elseif typeof ctrl numericupdown addhandler (directcast(ctrl, numericupdown).valuechanged), addressof control_changed end if next sub control_changed(byval sender object, byval e eventargs) ' handle events here end sub

silverlight - Usercontrol issue -

i have got big confusing question.... is .xaml file page or usercontrol. simple words silver light has pages or every silver light page called usercontrol???? i have scenario: firstly have mainpage , app.xaml. i have added mypage.xaml sivlerlight usercontrol. has same extension , code behind same main page. able find mypage silverlight usercontrol in toolbox menu not mainpage... there specific reason cannot use mainpage usercontrol...??? any answers appreciated. thanks in advance... when right click project , select add new item, can choose add either silverlight page or user control. both written in xaml, 1 starts <page> , other <usercontrol> ** edited hitech magic's correction a user control base class writing own .xaml object. page inherits user control, has additional functionality (you can navigate inside frame) hope helps.

sms - Send a text message from R -

i know can send email r sendmail, , can tweet twitter. there way send text message r script? all of major cell phone carriers allow send text messages using standard email (smtp) protocol. can send text message sending email phone. here different email domains different carriers: http://www.emailtextmessages.com/

winapi - VB.NET - Timer Every Second Monitoring Windows Application Titles -

i have vb.net desktop application i'm using monitor events in windows application running on system. need respond events in matter of seconds. 1 of events i'm monitoring instantly changes window title of child window within main process (i'm not changing it, application i'm monitoring causes change in it's own child window title). have function uses windows api's iterate through title text of process's child windows, , i'm checking values in titles. is bad idea running timer/title check once every second? there performance issues associated running timer in windows every second 24/7? bad performance calling api's retrieve titles of application's child windows? cause application crash sending requests often? thanks! you have benchmark see, if recall correctly, iterating through every window has significant overhead. can't monitor single window? if that, should fine.

c++ - typedef function pointer that takes argument ClassName* before defining ClassName? -

i have following situation: typedef void (*f_pointer)(classname*); class classname { public: f_pointer f; } this happens because instance of classname needs pass pointer client. however, if write things in order, complains classname not declared, whatnot. however, if switch them around, complains f_pointer not being declared when declare instance in class. so maybe i'm missing simple here, how accomplish this? forward declaration: class classname; typedef (*f_pointer)(classname*); class classname { public: f_pointer f; } or shorter: typedef (*f_pointer)(class classname*); // implicit declaration;

python - What is Tkinter's tkapp? -

i'm using tkinter in python, , trying create code run when text box's value changed. code find online uses mysterious tk member of tkinter widgets, , can't find documentation on it! found it's of type tkapp , there's no documentation on either. where can find decent resource explains me workings of mysterious thing? (even better, can find documentation on tkinter? can find tutorials). probably best single resource tkinter this page in python.org wiki. there documentation in python library reference (for 2.7 , 3.2 ). unfortunately, because of tkinter wrapper around existing tk functionality, lot of documentation tkinter assumes know tk reading tk documentation important, too.

jQuery accordion slideToggle problem -

i have accordion html loads live via ajax in div. div has close button can remove dom when clicked. when div created again without reloading page slidetoggle triggers twice , down , hides content. here html loaded via ajax: <div id="slidetoggle"> <h3>title</h3> <p>content</p> <h3>title</h3> <p>content</p> *..and on..* </div> here jquery: $("#slidetoggle p:not(:first)").hide(); $("#slidetoggle h3").live('click', function(){ $(this).next("p").slidetoggle("slow").siblings("p:visible").slideup("slow"); }); thanks in advance! use .die() when remove nodes dom.

html - why won't my image show? -

my image saved in same folder tree or whatever called webpage, , won't load. it's simple can't figure out. hint appreciated. <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <meta content="text/html; charset=iso-8859-1" http-equiv="content-type"> <title>website</title> <style type="text/css" media="screen, print, projection"> body{ background-image:url('c:\users\blah\desktop\webdesign\randompicture.png'); } </style> </head> <body> </body> </html> try using relative paths, if picture in same directory html file, write: background-image: url(randompicture.png); also, don't need apostrophes in url() notation of css. if put rules separate css file, path should relative css file, not htm...

file io - Python `tee` stdout of child process -

is there way in python equivalent of unix command line tee ? i'm doing typical fork/exec pattern, , i'd stdout child appear in both log file , on stdout of parent simultaneously without requiring buffering. in python code instance, stdout of child ends in log file, not in stdout of parent. pid = os.fork() logfile = open(path,"w") if pid == 0: os.dup2(logfile.fileno(),1) os.execv(cmd) edit : not wish use subprocess module. i'm doing complicated stuff child process requires me call fork manually. here have working solution without using subprocess module. although, use tee process while still using exec* functions suite custom subprocess (just use stdin=subprocess.pipe , duplicate descriptor stdout). import os, time, sys pr, pw = os.pipe() pid = os.fork() if pid == 0: os.close(pw) os.dup2(pr, sys.stdin.fileno()) os.close(pr) os.execv('/usr/bin/tee', ['tee', 'log.txt']) else: os.close(pr) ...

Git working tree in IIS's wwwroot -

we have visual studio 2003 solution containing multiple web-applications need located in c:\inetpub\wwwroot\ . i know can create repository in svn can contain applications, , each physical path can connected different location in same repository. ex: c:\inetpub\wwwroot\app1\ > svn-repo:/apps/app1 c:\inetpub\wwwroot\app2\ > svn-repo:/apps/app2 i need create repository in git, questions are: is possible git, because want avoid having .git folder in c:\inetpub\wwwroot\ (we can have similar configuration different project, , i'm pretty sure 2 working trees can't share same .git folder)? does have idea on how organize repository in git? because sub-directories of wwwroot separate (visual studio) projects, part of single (visual studio) solution treated single product. , product has version, makes sense have of in single repository. suggest? even if submodules in theory, since don't want .git in wwwroot , simplest solution...

Recovering files from Git objects -

i obliterated work , prefer not explain how. thing have left git objects. more recover of loss packed image files. size of object files can tell ones are. there way turn them usable files? first thing: make backup! work on copy of backup. if git objects still in correct directory ( .git/objects/xx/xxx… ) can use git fsck --full git discover them — list every object in repository. ones labeled commit , tag , ones want recover. i use script creates branch each commit object found (e.g. increnting numbers rescue-1 , rescue-2 , etc.). afterwards use gitk --all visualize branches , pick top (most recent) one. create new branch there rescued-master . checkout new master branch , run git branch --no-merge . should list of branched off commits, not contained in master. want give them new branch name too. after you're done, delete numbered rescue- branches. hope helps , gives a starting point.

jboss - How to handle a Connection object to remote jms server -

we using application contains jboss @service mbean encapsulates javax.jms.connection object. during startup of mbean connection created initializing remote initialcontext, looking connectionfactory context, , creating connection factory: @service public class jmspublisher extends etcc.... { private connection connection; protected void startservice() { context ctx = getremoteinitialcontext(); connectionfactory connectionfactory = (connectionfactory) ctx.lookup("connectionfactory"); connection = connectionfactory.createconnection(); } } my question is: how long can supposed maintain connection ? in practise see connection throws jmsexception when try create session on after undefined amount of time. the documentation of connection tells object represents socket, timeouts due inactivity normal. how can deal without creating new connections each , every message ? your best bet have jmspublisher implement javax.jms.exception liste...

Redis - How to completely flush/clear memory after a flushdb? -

after doing several flushdb on redis database, wonder how flush/clear memory use ? indeed, made tests : watching memory htop -> 800 mo used fill in redis database -> goes 1500 mo used flushing database => memory use stay @ 1500 mo... any ideas ? thanks try using flushall

java trace of all runtime variable access -

i need log run-time access variable or object current direction markup classfile modified bytecode performance not issue bcel looks nice add trace instructions each relevant opcode in bytecode however, add semantic information source file e.g. variable for-loop counter require ast / parsing tree manipulation. so asm / javaassist better choices ??? logging variable-usage key requirement - bytecode looks right level handle this. have access source parse tree more semantic information any thoughts ? p.s. large prolonged project look javasnoop ( https://www.aspectsecurity.com/research/appsec_tools/javasnoop/ ). monitor function calls.

vim - How to use vimclojure and SLIMV together? -

both addons have sides, slimv has better repl(faster vimclojure repl), vimclojure's indentation , syntax coloring better(also, vimclojure's syntax coloring working in repl too). , vimclojure's indentation better. example, slimv indentation function: (defn func []) and vimclojure's: (defn func []) i'm trying use both plugins, sides of each one. need syntax coloring in slimv repl, , vimclojure indentation. have ideas how can that? you can replace slimv indent plugin in vimfiles/indent whatever want (so guess vimclojure's indent plugin well). you can replace syntax plugin in slimv in vimfiles/syntax (actually there's no special syntax plugin, uses vim's built-in lisp.vim). you can enable syntax coloring in slimv repl buffer command in .vimrc: let g:slimv_repl_syntax = 1 ... , i'll fix indentation problem mentioned in slimv :)

javascript - Show headers only for collections that are not empty -

i have couple of lists this: <ul> <li class="list-header">header</li> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> by rules hide , show <li> items list has visible <li> , has no visible <li> elements @ except 1 list-header class, <li class="list-header"> still there. want hide header if there no <li> visible elements in under header. though want <ul> still visible. how do that? what could ( demo ): $('ul').each(function() { $ul = $(this); $ul.find('.list-header').toggle($ul.has('li:not(.list-header):visible').length != 0); }); basically, above toggling .list-header (i've wrapped in .each() in order demo different lists) depending on whether list .has() :visible li elements :not(.list-header) . update works. sorry.

resources - Tool to manage and track versions of ide,programming languages,plugins etc -

can suggest tool(if exists) keep track of versions of resources use develop project? i.e. project:myproject ide:eclipse php:5.0.2 ireport plugin:1.2.1 ... thanks. one approach use source control: check in binaries (or installers) tools use along project. when upgrade tool, check in upgraded version, source control history includes needed build particular version of project. if want build last year's version of code, need in source control. (disk space cheap, keep copy of everything)

javascript - How to add controls dynamically on asp.net page and fill it according to previously added controls? -

i developing system going used resource managers of training institute. resource manager schedules batches different skills @ different centers , assign faculties conduct particular batch. **batches timings 27-jun-11 28-jun-11 29-jun-11 30-jun-11 1-jul-11** mon tue wed fri center-1 9am 4pm skill1 skill2 skill3 skill4 skill5 batch-1 faculty1 faculty3 faculty1 faculty1 faculty1 center-2 9am 4pm skill4 skill2 skill1 skill3 skill5 batch-2 faculty2 faculty2 faculty2 faculty2 faculty2 center-3 9am 4pm skill1 skill3 skill2 skill4 skill5 batch-3 faculty3 faculty1 faculty3 faculty3 faculty3 resource manager schedules 1 batch particular center week @ once, comes down schedule next batch other center same week. at time of scheduling batch there dropdownlists...

asp.net - How to bind one column to gridview which is not present in database -

how bind 1 column gridview not present in database? i want display total unit in last column named total unit not present in database. i got argument exception: column 'tunit' not belong table. foreach(datarow row in dt.rows ) { object[] obj=new object[2]; obj[0] = row["transaction_id"]; obj[1] = row["tunit"]; dtgrid.rows.add(obj); } the best solution problem implement unbound column explained in unbound columns topic.

java - Ant (1.8+) Task for WebDAV Uploads -

i'm looking library implements webdav tasks ant 1.8 , later. found projects seem abandoned. short pointer in right direction appreciated! when run on windows can try mount webdav drive described here = mapping webdav folder network drive letter , use copy task filetransfer. code google.com has antdav provides no downloads, wiki example , two classes in browsable srctree after search 'webdav java api' search engine of trust , use via java task in ant or use write own ant task.

version control - Fogbugz and Kiln - any gripes? -

we considering moving using fogbugz , kiln (and mercurial). we've had trial period month , seems ok. i wondering if uses either or both of these systems, , has observed disadvantages, or faced difficulties them? thanks i use both fogbugz , kiln current project , couldn't happier. highly recommend both products. ebs, easy use ui, integrating cases commits, nice features.

javascript - How to pass an array into a map? Syntax -

i need this: $('#online-order').wcforms({id: '#online-order', to: 'contact', colors['red']: '#00f' }); but there mistake in syntax. please, tell me how must pass it. thanks! as javascript has no associative arrays, if want way, need use object. {id: '#online-order', to: 'contact', colors: { red: '#00f'} } jsfiddle demo you can access red property this: var obj = {id: '#online-order', to: 'contact', colors: { red: '#00f'} }; console.log(obj.colors.red); //or console.log(obj['colors']['red']);

java - Layout orientation? -

i made 2 layout , first 1 android 2.1 ( need in portrait ) , second 1 android 3 ( need in landscape ) , these 2 layout use 1 class . how can set these 2 layout on landscape , portrait? if set in androidmanifest , can use 1 of these mode portrait or landscape , , we can't use: <activity android:name=".activity" android:screenorientation="portrait"></activity> now method true? thanks its rely not necessary set screen orientation attribute. i handle senario in project. make 2 folder in resours first portraitemode , second landscape maode like layout folder , layout-land folder layout---store layout when u wann give in portraitr mode layout-land----store layout when u wann give in landscape mode

foreign keys - MySQL Inserting data and setting FK's? -

i have table in database http://i.stack.imgur.com/bsos9.png i have pk,fk relationships setup , im ready start inserting data. however not know start. do insert tables primary keys first. but how give foreign keys values of primary key in linking tables? i thought starting with: -patient -department -procedure -staff -events -supplies any reference material appreciated, tried googling question not luck. perhaps eloquote more accurately. you thought correctly, start foremost "parent" table, , work way down. inserting foreign keys can done either nested queries or getting key, storing it, , reusing it. personally i'd go nested queries.

php - Doubt using update query -

i have particular column unique in database. regarding using particular script name field avoid duplicacy. issue if want update other field except name field query not firing. please give me proper approach this. using particular script if wish make changes in row need make changes in name field also...chk out. if($name!="") { $sql = "select a_name t_a_list a_name = '$name'"; $result = mysql_query($sql); if(mysql_num_rows($result) != 0) { $msg = "<font color=red>record not saved. album exist!</font>"; } } else { $msg = "<font color=red>enter name of album!</font>"; } if($msg=="") { //update query } example.. consider example have name field includes email ids of user. if user want update mail id script executing if want make changes other field name, contact number, address how script need modify. if user want change mail id run , avoid , check mail id if exist. no...

php - overlapping text strings created with imagettftext -

Image
i have image resource created png transaprency support following: $image = imagecreatetruecolor($new_width, $new_height); imagealphablending($image, false); imagesavealpha($image, true); $new_image_bg = imagecolorallocatealpha($image, 255, 255, 255, 127); imagefill($image, 0, 0, $new_image_bg); i'm adding overlapping layers of text image resource imagettftext() , overwrites current area of image. i'm trying merge existing image resource maintaining transparency of text string. below example of i'm trying avoid: one solution is: rather placing text directly in target image, place in secondary image , perform imagecopymerge() operation.

Use and meaning of session and process group in Unix? -

unix processes have session id , part of process group - can changed/queried functions such setsid()/getpgrp() . however concept of process group , session eluded me, explain significance having distinct sessions , process groups provide - why/when 1 want create new session or place several processes in same session and/or process group ? a process group collection of related processes can signalled @ once. a session collection of process groups, either attached single terminal device (known controlling terminal ) or not attached terminal. sessions used job control: 1 of process groups in session foreground process group, , can sent signals terminal control characters. can think of session controlling terminal corresponding "login" on terminal. (daemons disassociate controlling terminal creating new session without one.) e.g. if run some_app shell, shell creates new process group it, , makes foreground process group of session. ( some_app might cre...

Trying to get php to run on cron -

this driving me little insane, , i've gone through hundered different things without touching on solution; may miss out on details on i've done far. i'm trying cron job run on linux server ive got running in datacentre. i'm trying run simple php script in format: * * * * * php -q /path/to/script/file.php the php part runs fine if type in manually, nothing happens when cron runs; appears run in logs fine, no errors. if go , edit crontab -e, , put in line * * * * * echo "test" > /tmp/test.txt that seems work ok, creates text file. has had problems running php script in format? (btw i'm testing run every minute, doesnt work @ time.) any appreciated. try invoking php it's full path, example /usr/bin/php the cron not have same environment variables user profile have, might not find executable.

Android make an HTTP Get request through jsp to oracle db? -

so want communicate oracledb through android app. allowing users update tables in db mobile phone. application running in desktop form using jsp file. want transition jsp file work android. i've read connect directly oracledb although not acceptable obvious security reasons. question use existing jsp file android , interact server through that? how make request jsp file can call upon info downloaded server , populate fields in app? thank you. honestly, i'd drop jsp , @ web service database through apex listener. examples here , here

SQL Server Concurrency issue -

i’ve report sits on top of view. view underlying tables updated every 15 minutes , update cycle takes approximately 1 -2 minutes , during time if run report i’m getting wrong values on report .is there way can apply kind of locks on view can report once update done , avoid dirty data on report.please let me know if there other solution issue thanks, ravi i consider using different method update underlying tables. instead of updating these tables 1-2 minutes, make "shadow" tables in schema. (and have third schema temporary holding.) allows work on tables users can't see, switch them in using metadata operation. can this: truncate/re-populate shadow tables (2 minutes, or maybe less no contention) start transaction (sub-millisecond) move primary table holding schema, using alter schema ... transfer (sub-millisecond) move shadow table dbo schema (sub-millisecond) move primary table shadow schema (sub-millisecond) commit transaction (sub-millisecond) (...

compilation - cannot run a simple java code -

i have downloaded java developers kit 64bit windows 7, wrote down code in notepad, though code compiling command prompt , creating .class file, refusing run showing error code: java.lang.noclassdeffounderror: first caused by: java.lang.classnotfoundexception: first @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) not find main class: first. program exit. exception in thread "main" i have made sure more once file name , class name same(i have kept them smallcase 'a' sure). still no avail, please suggest few solutions please.. i'm new java i'm c/c++ programmer. a java program has basic structure: classname.java public class classname { pu...

xaml - Change property of "super/base" style wpf -

i creating base style. using inheritance implement base style. know how add properties on derived class don't know how change property. let me give example: let have base style: <!-- srollviewer scrollbar repeat buttons (at each end) --> <style x:key="scrollbarlinebutton" targettype="{x:type repeatbutton}"> <setter property="snapstodevicepixels" value="true"/> <setter property="overridesdefaultstyle" value="true"/> <setter property="focusable" value="false"/> <setter property="template"> <setter.value> <controltemplate targettype="{x:type repeatbutton}"> <border name="border" margin="1" cornerradius="2" backgrou...

c# - Why can my WindsorContainer not resolve IWindsorContainer? -

this example not using best practice using iservicelocator wrap container has me bit baffled. i thought windsorcontainer automatically resolve iwindsorcontainer? var container = new windsorcontainer(); container.register(component.for<ineedwindsorcontainer>() .implementedby<givemewindsorcontainer>() .lifestyle.singleton); implementation of ineedwindsorcontainer: public class givemewindsorcontainer : ineedwindsorcontainer { iwindsorcontainer _container; public givemewindsorcontainer(iwindsorcontainer container) { _container = container; } } this not work, because windsorcontainer not know how resolve iwindsorcontainer! of course immediate solution came was: var container = new windsorcontainer(); container.register( component.for<iwindsorcontainer>() .instance(container) .lifestyle.singleton, component.for<ineedwindsorcontainer>() .implementedby<givemewindsorcontainer>() ...

java - Xerces setTextContent method strips new lines / carriage returns. How to prevent? -

i'm using xerces (java) generate xml documents. have large block of text (including carriage returns , new lines) replicate in xml document text content of element. example: <element>this text here more that's folks</element> however, whenever try use: element.settextcontent(myblockoftext) all new lines replaced single space characters. how can keep new lines within block of text using xerces? (tried cdata, it's quoting xml (left angle brackets etc) within xml itself). do have control of document? if so, might try xml:space attribute. see http://www.w3.org/tr/xml/#sec-white-space , http://codeidol.com/java/java-xml-for-web/generating-and-serializing-xml-documents/handling-whitespace/

R - brevity when subsetting? -

i'm still new r , of subsetting via pattern: data[ command produces logical same length data ] or subset( data , command produces logical same length data ) for example: test = c("a", "b","c") ignore = c("b") result = test[ !( test %in% ignore ) ] result = subset( test , !( test %in% ignore ) ) but vaguely remember readings there's shorter/(more readable?) way this? perhaps using "with" function? can list alternative example above me understand options in subsetting? i don't know of more succinct way of subsetting specific example, using vectors. may thinking of, regarding with , subsetting data frames based on conditions using columns data frame. example: dat <- data.frame(variable1 = runif(10), variable2 = letters[1:10]) if want grab subset of dat based on condition using variable1 this: dat[dat$variable1 < 0,] or can save ourselves having write dat$* each time using with : with(...

.net - Rx ForkJoin Missing -

i downloaded stable release of reactive extensions .net , looking @ 101 rx examples . parallel execution example uses forkjoin method. method not in stable release (or unstable matter). how can same sort of arbitrary parallel execution forkjoin did? update i downloaded rx site, , wasn't there. used nuget anderson imes suggests instead , there expected. i pulled down latest version (1.1.10621) rx_experimental-main package , it's still there in system.reactive.linq . name of static class appropriate extension methods system.reactive.linq.observable . verified in reflector.

magento - Event Observer - Trigger an event -

i create event observer want show message / alert box when total weight of cart surpass 23 kg (to tell truth, want event check weight limit , trigger alert box when customer add product cart). could me make such observer? you don't need involved... already have been given code write weight out, put code in block, put in header (or cart sidebar) , add if statement. don't put if($weight>23) { echo "too heavy - shopping cart going burst itselves!" } put custom variable in admin , compare against that. in weigh, if change courier customer can update max weight.

android - Data set for storing objects in java -

let's have multiple objects stored: person ------------ employee ------------ sales engineer | | customer field engineer so: person, customer, employee, sales engineer, field engineer. i need keep track of of these...what best way store them? in arraylist? custom arraylist? the way stored may affect future expansion - in future, these objects might generated fields sql server. (also, android app - factor.) you'll want list<person> . diagram suggests inheritance, you'll want have collection of super class , let polymorphism rest. your code can this: list<person> people = new arraylist<person>(); // class extends person can added people.add(new customer()); people.add(new fieldengineer()); (person person : people) { system.out.println(person); } your design expressed won't allow engineers customers, or sales engineers go field, that's curse of inheritance in cases yours. a better ...