Posts

Showing posts from May, 2010

plugins - Toolbar button that injects HTML in Internet Explorer -

i'm building browser extension internet explorer. goal have user able click toolbar button , inject html on site user might visiting @ moment. my class implementing iolecommandtarget , iobjectwithsite , have managed toolbar button showing adding info registry, cannot access html document can manipulate it. debugging have shown first end in iobjectwithsite.setsite method , iolecommandtarget.exec method. if implement solution bho can subscribe webbrowser events in setsite method when try same thing in exec method cast webbrowser fails. how build small , simple extension? toolbar.h ccomqiptr<iwebbrowser2, &iid_iwebbrowser2> m_spwebbrowser2; toolbar.cpp stdmethodimp toolbar::setsite(iunknown *punksite) { hresult hr; ccomqiptr<iserviceprovider> sp = punksite; if(!m_spwebbrowser2 && sp) { //bho eotjiman toolbar not obtained through queryservice. sp->queryservice(iid_iwebbrowserapp, iid_iwebbrowser2, (void**)...

asp.net mvc - get new inserted ID in MVC Controller to jQuery -

i updating entity inside controller follows :- [httppost] public actionresult create(project project) { //var model = new compositeimagemodel(0); if (modelstate.isvalid) { //var model = new compositeimagemodel(project.projectid); db.projects.add(project); db.savechanges(); viewbag.projectid = project.projectid; return redirecttoaction("index"); } return view(); } and wish grab new id "viewbag.projectid" inside jquery ajax code :- onsavebegin: function () { //code save begin $('#imagelist').fadein('slow'); $("#imagelist").click(function () { $("#imagelist").load("/file/imageupload/222"); }); }, instead of hardcoded "222". how can it? thanks , time ** * ** * **** update * ** * ** * ** * ** * ** * ** * ** * ** * *** have updated jquery follows :- <script type="text/javascript"> $(document).ready(function () { var imagelist = $(...

tooltip - jQuery Select the next element using a selector -

i know can use .next() find next element of given one. however, situation forces me use selector. i'm using jquery tools build tooltips of table, each "td" having 2 elements: link , tooltip div. goal display tooltip when mouse hovers on link. according html, it's placed right after link need select "the next element". html looks like: <tr> <td><a href="#" id="td1">title</a> <div class="tooltip"> <h1>tooltip title</h1> <p>a detailed descritpion</p> </div> </td> </tr> <tr> <td><a href="#" id="td2">title</a> <div class="tooltip"> <h1>tooltip title</h1> <p>a detailed descritpion</p> </div> </td> </tr> <!-- more rows --> unfortunately, cannot use .next() here since tooltip() function accepts selector string argu...

c++ - Suspend process after a specific child process is started -

i have loader.exe starts process using createprocess(..) process starts after while process b. i suspend process , process b when b started process a. how can wait b? notified or have poll until process there? at runtime know name of process b , know b started process a. thanks use boost interprocess library . of special interest mutexes, conditions, , semaphores.

collections - Mongodb Java MapReduce getOutputCollection -

i don't know outputtypes. i'm trying this: output=collection.mapreduce(map,reduce,null, mapreducecommand.outputtype.inline,null); collection=output.getoutputcollection(); but collection null, because of inline output type. need reduced collection because need reduce further. how this? i found solution :d works output=collection.mapreduce(map,reduce,"mymap",mapreducecommand.outputtype. reduce,null); collection=output.getoutputcollection(); note cannot store in same target "mymap" again , again. have use different name when looping "mymap".concat(integer.tostring(i))

How to completly kill/remove/delete/stop an AsyncTask in Android -

i made app downloads videos our server. issue is: when cancel downloading call: myasynctask.cancel(true) i noticed, myasynctask doesn't stops on calling cancel... progressdialog still goes , jumping status status showing me each time cancel , start again asynctask clicking download button, new asynctask starts... each time click download.. cancel, again download separate asynctask starts. why myasyntask.cancle(true) not cancelling task ? don't want anymore on background. want shut down if click cancel. how ? e d t: thanks gtumca-mac, , others helped me did by: while (((count = input.read(data)) != -1) && (this.iscancelled()==false)) { total += count; publishprogress((int) (total * 100 / lenghtoffile)); output.write(data, 0, count); } thanks!!! asynctask not cancel process on myasyntask.cancel(true) for have stop manually. for example downloading video in doinbackground(..) in while/for loop. protected long doin...

java - How to make a delayed non-blocking function call -

i want call add function of hashset delay, without blocking current thread. there easy solution achieve this: utils.sleep(1000, myhashset.add(foo)); //added after 1 second //code here runs without delay ... you can use scheduledthreadpoolexecutor.schedule : scheduledthreadpoolexecutor exec = new scheduledthreadpoolexecutor(1); exec.schedule(new runnable() { public void run() { myhashset.add(foo); } }, 1, timeunit.seconds); it execute code after 1 second on separate thread. careful concurrent modifications of myhashset though. if modifying collection @ same time different thread or trying iterate on may in trouble , need use locks.

c - generate random RGB color using rand() function -

i need function generate 3 numbers can use them rgb pattern svg. while simple, need make sure i'm not using same color twice. how do that? generate 1 number @ time simple rand (seed time active) , what? don't want exclude number, maybe whole pattern? i'm kind of lost here. to precise, first calling of function example 218 199 154 , second i'll 47 212 236 2 different colors. suggestions? also think struct int r, int g, int b suitable this? edit: colors should different human eye. sorry not mentioning earlier. you use set store generated colors. first instanciate new set. then, every time generate color, if value present in set. if record exists, skip , retry new colour. if not, can use dont forget cache in set after. may become not performant if need generate big quantity of colour.

php - vBulletin date decode from database -

i need use information vbulletin database using external script. need decode join/last visit date. found in database 06-02-2012 in database encoded 1338661020. how decode 06-02-2012 (in php) ? alternatively, can use datetime (which more robust solution). $date = new datetime('@1338661020'); echo $date->format(date_atom); this allows handle things custom timezones per-user easily. more info available on php.net: http://us3.php.net/manual/en/book.datetime.php

php - How to organise content in Drupal? -

i want set website containing 3 categories: movies, books , articles. , want every have menu item , subpage features best content category. in every category want have articles, videos , galleries. want every category page different, articles, videos , galleries different categories. in drupal can create "categories", "views" , "sections". dont want make mistake on design chosen. question methods of mentioned in last sentence should use , in order organize content have in proper way? as there many different ways in drupal - , right way depends on context classification should suggesting taxonomys. in drupal content types best used when actual content different - description sounds rather content similar - find question confusing. so, if content has same fields needs classified category you'll use 1 content type @ least new term reference field create hold reference taxonomy vocabulary. 1 content type hold of content related movies, b...

javascript - Change Form Field Visibility in ModalPopupExtender -

wanted know if there's way change form field's visibility within modalpopup (from modalpopupextender) based upon dropdownlist's change in value. page's technique doesn't seem work: change visibility of asp.net label javascript . javascript: <script type="text/javascript"> function showhide() { if(document.getelementbyid('<%=ddlasvisibilitytest.clientid%>') == "show") { document.getelementbyid('<%=lblasbillingname.clientid%>').style.display = 'inherit'; document.getelementbyid('<%=txtasbillingname.clientid%>').style.display = 'inherit'; } if(document.getelementbyid('<%=ddlasvisibilitytest.clientid%>') == "hide") { document.getelementbyid('<%=lblasbillingname.clientid%>').style.display = 'none'; document.getelementbyid('<%=txtasbillingname.clientid%...

c# - Stuck with httpwebrequest usage -

i bit confused in using httpwebrequest. tried articles not able doing first time. below code trying work on , have few questions, a) aspx page has few controls defined , in code-behind create few controls. when httpwebrequest post, need consider controls , values? need post 1 of controls only. can control? b) url should specified in "(httpwebrequest)webrequest.create"? assume same page shown user. example in example below ("http://localhost/myidentity/confirm.aspx?id=new&designer=true&colors=yes"); c) there else need modify or take care of either in markup or code achieve httpwebrequest? private void onpostinfoclick(object sender, system.eventargs e) { asciiencoding encoding = new asciiencoding(); string postdata = ""; //read stored array , print each element array loop here. byte[] data = encoding.getbytes(postdata); // prepare web request... httpwebrequest myrequest = (httpwebrequest)webrequest.create...

android - Ignore backspace in EditText -

i have edittext need ignore backspace keyevents. have following class, doesn't work: public class customedittext extends edittext { public customedittext(context context, attributeset attrs) { super(context); // todo auto-generated constructor stub this.setonkeylistener(new onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { //you can identify key pressed buy checking keycode value keyevent.keycode_ if(keycode == keyevent.keycode_del){ //do nothing } return true; } }); } } try overriding onkeydown method instead of adding listener

css - DIVs won't resize for a width of less than 420px -

Image
i'm having little problem auto-resizing feature! i've proficiently triple-checked (with search-tool) width-settings set %. there's nothing fixed width in whole website. (well, in fact yes, nothing bigger 100px, , in such case, not more 1 per row). but still, if reisize browser's windows less 420px width, width of body (html-body, of course :p) stop 420px , well-known h-scrollbar appears. any ideas? there sort of default-minimun-width? i've tried setting smaller body's min-width no results. just in case that's somehow helpful: website composed of index (in html), 2 sets of 3 jquery-script , 1 css files, alternatively wrote project when site loads (one desktop-browsers, 1 mobile). i've tried building sites separatedly, no better results. i think resloved problem firefox. think ff allows shrink website minimal width need toolbar website address, searcher, bookmarks , on. testing on css tricks great site if comes mobiles :) at first scre...

asp.net mvc - how to submit a form using jquery in jsp -

in asp.net mvc using following snippet can send change password data controller. in controller can cast posted data changepasswordreq object , can our business. looking equivalent of in jsp . how communicate client side server side? want transfer bigger form number of controls.(i using html build pages). appreciable. var changereq = { currentpassword: epwd, newpassword: newpwd } var jsondata = json.stringify(changereq) $.ajax({ type: 'post', url: "/account/changepassword", cache: false, timeout: 10000, contenttype: "application/json; charset=utf-8", success: function (_results) { //do }, error: function (_results) { //do } }); [httppost] public actionresult changepassword(changepasswordreq _changepasswordreq) { //do business } ...

haskell - unsafeRead causing stack overflow -

here's code bounds checks @ ideone . it runs no out of bounds error. in this code, on line 34 have changed on readarray unsaferead , , still compiles, crashes stack overflow. is ghc bug or have done wrong? unsaferead uses 0-based indices, have either adjust index reading, elem <- unsaferead arr (i-1) or, better, allocate array least index of 0 arr <- newarray (0,upperbound) maxbound as is, unsaferead reads wrong place in array. unrelated: suspect ideone uses 32-bit ghc, better don't run code upperbound > 100000 there.

c# - Null reference using Linq to Xml -

i making country, state dropdownlist. for eg: particular country, read states of country xml file below code protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { string st = (dropdownlist1.selectedindex).tostring(); xdocument main = xdocument.load((server.mappath(@"xmlfile1.xml"))); var query = user in main.descendants("country") st == user.element("state").value --//i getting error here object select user; reference not set instance object dropdownlist2.datasource = query; dropdownlist2.databind(); } op's xml (link provided in chuck's comments) : bind dropdownlist using xml if using namespace in xml file following might you.: xnamespace ns = "url";// url namespace path namespace var query = user in main.descendants("country") state in user.elements("state") ...

jquery in firebug throws always NULL -

i learning how use firebug properly. watched howto , author typed $('p'); in console , displayed p tags. in case there many p tags on site (my local drupal 7 site) shows null. other tags i've tried. have put $ in front , kinda works?! did wrong other way did not work? the previous example didn't because not returning or printing anything. try this: (function($) { console.log('this works'); return $('p'); })(jquery);

jquery mobile click() on listview -

i have problem listview in jquery mobile. want load data server using json , fill thy listview items. works fine. when trying react on click on new loaded item net event! think have refresh view somehow, bit not know how. i made little sketch on http://jsfiddle.net/vqulm/227/ when u hit click me button click event on item isn't tracked anymore. how "wokrs" alert on new items? thank u reading! try $('#listview').on('click', 'li', function() { alert("works"); // id of clicked li directly accessing domelement property }); with jquery > 1.7 demo or $('#listview li').live('click', function() { alert("works"); // id of clicked li directly accessing domelement property }); with jquery version 1.6.4. demo why need this because. you're adding li within listview after page reload, event li s should live (for jquery version used) or delegate (jquery > 1....

convert javascript code to jQuery -

i want change javascript code jquery code, reason when i'm targeting id it's not working. javascript code: scroll(xpos, ypos) { document.getelementbyid('content_section').scrolltop=xpos; } jquery code (i wrote): scroll(xpos, ypos) { $('#content_section').scrolltop(); } what did wrong? , need work on internet explorer. for answers had, tried add scrolltop(xpos); , didn't work still, put in mind ie issues. $('#content_section').scrolltop(xpos); because scrolltop() takes argument scroll target. more detail .scrolltop() without argument works getter method, means $('#content_section').scrolltop(); // without argument will give current scroll position of #content_section . but argument acts setter method means $('#content_section').scrolltop(xpos); // argument will set #content_section position passed argument. according edit function scroll(xpos, ypos) { // need set ...

javascript - Slick grid mapping -

i adding styles of cells. on sorting or filtering, styles fixed cell number , not actual value. e.g: if cell number 2 of row 8th given style. on sorting, cell moves number 2. though, doesn't change position of styled cell. still cell number 2 of row 8th styled. i know there functions mapping ids rows , vice versa. can tell me how use it. i figured out solution it. there following function in dataview: dataview.getrowbyid(rowid); this gives current row displayed. if hidden filter, undefined.

facebook - What are some better ways to create Topic Hubs automatically -

i wish create similar app like: http://www.facebook.com/pages/english-language/106059522759137 http://www.freebase.com/view/en/barack_obama i make use of freebase data or wikipedia data or other data totally clueless how started , make use of available database dumps in php , mysql. please suggest better ways create topic hubs automatically. update: i've decided download freebase wex , gives me freebase guid/mid each topic. wish make use of these ids fetch entire topic hub info through freebase api couldn't find way that, suggestions? examples? to create website topic pages should consider following tasks: decide topics site cover , important relationships between topics wish model. reconcile topics against external datasets freebase , wikipedia. decide data want store locally in database , data needs pulled in dynamically external sources apis. should have data stored locally specific site, otherwise pages spam. create url naming scheme topic p...

Erlang list matching -

i'm working through book thinking in erlang . in "figure 10: example of case" has following example: many(x) -> case x of [] -> none; [ _one ] -> one; [ _one, _two ] -> two; [ _one, _two , _three | _tail ] -> many end. it says : if wondering why line 9 not match against [ _one, _two | _tail ], review list matching rules list tails @ end of previous section. but if match against [ _one, _two | _tail ] still works expected. there error in book or getting wrong ? i think might not error. the semantics of [_one, _two, _three | _tail] is list of 3 elements or more. the semantics of [_one, _two | _tail] is list of 2 elements or more. since third pattern [ _one, _two ] indicates case "a list of 2 elements", using [_one, _two | _tail] little bit redundant. there reason "everything's working expected". if place fourth pattern before third one, gives: ...

javascript - Adding element dynamically in jquerymobile page -

when appending element (position : absolute) dynamically @ run time in content part (data-role=content) of jquerymobile page , footer not set according height of the newly added element.can tell me why happening? it number of reasons, can't tell without looking @ code. for instance, have latest jquery mobile version? right guess aren't doing let footer know new element has been added dynamically. in own implementation latest version of jquery mobile solves problem, take @ other solution such as: how keep jquery mobile header , footer fixed? in here iscroll used plausible solution. may at: scrollview jquery mobile tollbars *not* fixed

sql server 2008 - Classic ASP - Ado Recordset Open() -

i trying set legacy site written in asp classic on local machine. using sql server 2008 , iis ver 7.5. i running error when try open connection database. i used advice in this post to use .udl file create , test connection string know connection string works. using windows authentication , app pool running site has access database use same pool multiple sites , can connect fine. when opening connection trying run stored procedure, if write out stored proc string , run directly in database works expected. here code: const aduseclient = 3 const adcmdstoredproc = 4 const adopenstatic = 3 const adlockbatchoptimistic = 4 dim connectstring,sql connectstring = "provider=sqloledb.1;integrated security=sspi;persist security info=false;initial catalog=my-database;data source=(local)\sqlexpress" sql = "myproc '" & param1 & "','" & param2 & "'" set rs = server.createobject("adodb.recordset") rs.curso...

sql - Doctrine Query <timestamp -

i have colum "datetime", this: 2012-06-04 15:40:20 . i want create query in doctrine data of previous time. less 2012-06-04 15:40:20 . how can realize in doctrine. sorry, have no clue. if understand question correctly, believe syntax just: $datetime = // timestamp ->where('t.somefield < ?', date('y-m-d h:i:s', strtotime($datetime))

html5 - is the figure tag adequate for maps? -

is semantically correct use figure element map (google maps example)? in case can me placed somewhere else without affecting document flow. use figcaption store address of place shown on map. i'm still not sure if suites usecase... this w3c description: the figure element represents flow content, optionally caption, self-contained , typically referenced single unit main flow of document. figure element can used annotate illustrations, diagrams, photos, code listings, etc., referenced in main content of document, could, without affecting flow of document, moved away primary content — e.g., side of page, dedicated pages, or appendix. http://dev.w3.org/html5/spec/the-figure-element.html#the-figure-element based on w3c description <figure> element perfect solution map. if map contains additional graphic info or clarification what's on page already.

iphone - Video is not playing using MPMoviePlayerContrller -

how play video in iphone sdk using mpmovieplayerviewcontroller,here capture video through device , save particular video in documents directory . please tell me one.... get document directory path: nsstring *documentsdirectory = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; then can use of directory listing apis of nsfilemanager. nserror * error; nsarray * directorycontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:documentsdirectory error:&error]; now have contents @ directory path (all videos stored) in array nsurl *videourl = [nsurl urlwithstring:[nsstring stringwithformat:@"%@/%@",documentsdirectory,[directorycontents objectatindex:0]]]; //check url u want play video name in nsarray have selected 1 random video name. use moviecontrollerplayer instance play url: mpmovieplayerviewcontroller *mpviewcontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:videour...

c# - Pass username/password from Windows Forms application to an ASP.NET web application -

here situation: c# windows forms application asp.net web application both authenticate custom user table in same database (usename/password) , create user object used throughout both applications a user logged windows forms application , want launch url open page in asp.net web application in default browser (ie, chrome, firefox, etc.). want pass current username/password windows forms application asp.net web application in order keep user having log web application separately. based on our research, here options have found (and drawbacks): pass username/password in url querystrings , create user object in web application not secure (password visible in url) create temporary html page on client machine includes javascript onload function posts username/password target url , create user object in web application (could not find way post data directly url , display url in default browser using c#) not secure (password visible in temporary page) create "hando...

TextExt jQuery Plugin And Hidden Field Value -

i have been playing http://textextjs.com/ weekend seems solid autocomplete plugin additional functionality might useful in future (like tagging). tried implementing in 1 location use own autocomplete functionality there 1 critical issue me plugin have yet find example/solution for. i using following data structure: [ { "id": "1", "title": "active", //etc.... }, { "id": "2", "title": "inactive", //etc.... }, //etc... ] now using ajax/autocomplete plugin right (though going need functionality tags plugin eventually). have custom itemmanager allows data data work fine here problem. want able set input users sees , interacts the object.title want have hidden input submitted form object.id. how type of functionality when using autocomplete/tags plugin? i have tried @ ongetdataform since seems need create plugin implements (thoug...

multithreading - Looking for a Linux threadpool api with OS scheduler support -

i'm looking thread pool abstraction in linux provides same level of kernel scheduler support win32 thread pool provides. specifically, i'm interested in finding thread pool maintains number of running threads. when running pool thread blocks on i/o, want thread pool smart enough start thread running. anyone know of linux? you can't without os support. there's no way tell thread blocked on i/o. wind having atomically increment counter before each operation might block , decrement after. need thread monitor counter , create additional thread if it's above zero. (remove threads if they're idle more second or so.) generally speaking, it's not worth effort. works on windows because it's "windows way" , windows built ground it. linux, should using epoll or boost::asio . use things "linux way" rather trying make windows way work on non-windows operating systems. you can write own wrappers use iocp on windows, epoll on l...

Mapview loading in android -

mapview in android takes more time load when don't have overlays. there way can make loading faster? if not can know when starts , stops rendering map , show other view till gets loaded? normally mapview waits valid gps data. may takes few minutes. if don't want show current location, start lat , long set zero.

visual studio 2010 - tfs build number - getting started -

i have visual studio 2010 visual studio 2010 team explorer. after check in code, can view changeset number (view history). typically put in changeset number in bug log system fix something. where/how build number? tfs admin thing? started? need use msbuild instead of using visual studio gui? thanks help! when creating build definition , default tfs labels each build format: $(builddefinitionname)_$(date:yyyymmdd)$(rev:.r) the default template's build number can customized under [build defintion] > process > basic > build number format however, may want check out versioned tfs 2010 build more control on build number format , automatic versioning of assemblies (via assemblyinfo.cs).

java - using jpasswordfield safely to encrypt password -

okay not sure how else word title. basically, i'm being lazy , creating application log in website , fill out weekly timesheets me. the app, creates local encrypted file stores login credentials website. have method setup takes passphrase , string, encrypts string using des using passphrase, , writes cipher text file. set login credentials use jtextfield username , jpasswordfield password. initially, built string out of these 2 , passed cipher method. however, jpasswordfield requires .getpassword() safety method encrypt fails, because requires string. i'm looking improve have. cipher: public static void encrypt(string _passphrase, string _loginstring) _loginstring => string loginstring = userfield.gettext() +"~"+ passfield.gettext() so i'm looking improve using .getpassword(). suggestions? idea, yes amateur, build string char[] , use it, kind of defeats purpose of not using passfield.gettext(). btw fun exercise security , efficiency isn't requir...

c - Get number of digits of a number -

i have number this: int num = 36729; , want number of digits compose number (in case 5 digits). how can this? use formula: if(num) return floor(log10(abs((double) num)) + 1); return 1;

html - Javascript - get span by the class? -

possible duplicate: how element class in javascript? i need text inside of span. span has no id. has class. there 1 span class. know how can span element in javascript? thanks! <span class="galleria-current">1</span> this different how element class in javascript? asking more generic "get element class", in case there's easier way spans, plus question replacing text, whereas want get innerhtml in case. yes, can use document.getelementsbyclassname() . this return array of elements classname. first 1 accessed this: var span = document.getelementsbyclassname("galleria-current")[0]

javascript - jQuery multi select widget with a selectable optgroup -

Image
i looking jquery widget looks following: it allows have several groups example: group 1 - sub 1 1 - sub 1 2 - sub 1 3 group 2 - sub 2 1 group 3 - sub 3 1 - sub 3 2 clicking on group 1 example, select inside, , clicking again deselect. , should able collapse groups better navigation. seen in image (the small arrow on left side) is there widget out there? thanks the jquery: $(document).ready ( function () { $('.parent').click(function () { var set = false; if ($(this).is(':checked')) set = true; $(this).parent().find('ul li').each( function () { var input = $(this).find('input'); input.attr('checked', set); }); }); $('span').click(function () { if ($(this).text() == '-') $(this).html('+'); else $(this).html('-'); $(this).parent().find('ul li').each( fun...

twitter bootstrap - Drupal dynamic module for responsive slideshow -

i working on drupal responsive theme.for creating own custom theme. for making responsive have used twitter bootstrap. have used carousel plugin slideshow works in html. the images in slideshow static have hard-coded there path.but in drupal want choose images dynamically in wordpress or joomla module. is possible? if not there slideshow module drupal can solve problem? in advance flexslider excellent module this. unfortunately it's not quite configurable views slideshow, views slideshow requires hacking responsive inserts width/height attributes directly in dom.

jquery - Loop HTML5 Videos on "ended" Event -

an html5 video plays. once has finished, script below called, incriments next video adds next line , begins playing it. how turn loop once second video finishes playing, append third video, , on? <div> <video id="video0" autoplay> <source src="video0.mp4" /> </video> </div> . var i=0 $('video'+i).on("ended", function() { i++; $(this).parent().append('<br /><video id="video' + + '" autoplay><source src="video' + + '.mp4" /></video>'); }; updated answer: after re-reading question , seeing changes, here logic should you're asking... var = 0; var numvideos = 5; var addvideo = function() { i++; var nextvideo=$('<video id="video' + + '" autoplay><source src="video' + + '.mp4" /><...

excel - Macro doesn't run when data is refreshed? -

i have written following code detect change in value of cell , run macro, when data refreshed due data connection code doesn't work. private sub worksheet_change(byval target range) if target.address = "$a$2" if target.value = 1 taskid = shell("c:\imawesome.bat", vbnormalfocus) end if if target.value = 0 taskid = shell("c:\sender.bat", vbnormalfocus) end if end if end sub the code works when manually enter data in cell. please suggest code runs when data refreshed. following microsoft article kb213187 , assuming data connection querytable you can try this create new module , put code in it public withevents qt querytable private sub qt_beforerefresh(cancel boolean) 'do stuff here end sub then on module create class dim x new class1 sub initialize_it() set x.qt = thisworkbook.sheets(1).querytables(1) end sub and make sure initialize_it runs every time open document. be aware code works 1 qqu...

linux - How to release socket? -

i'm making little tcp server , processes number of requests via threads. when server shutting down leaves unclosed sockets. how can close them automaticaly or somehow release on new launching of server? number of sockets big , don't want manage them hands. any ideas? where sockets created? within new thread or before thread started? if it's within thread, consider using pthread_cleanup_push() install handler closes socket (if it's still open) when thread exits.

ios - Custom ipad table view design -

Image
i want create ipad application , feel following: what best standard way left menu, not want subclass class. what best way table cell in screenshots. please advice, use left table here , subclass uisplitview or set background color image, right table uitableview located in adjusted uiviewcontroller frame.

Strange recursion optimization by java -

i came across weird results when trying answer question: how improve performance of recursive method? but don't need read post. i'll give relevant context here. might seem lengthy isn't complicated if read through once. hope interesting all. context, syra(n) = { 1 if n=1; n + syra(n/2) if n even; , n + syra(3n+1) if n odd } and syralen(n) = no. of steps calculate syra (n) e.g, syralen(1)=1 , syralen(2)=2 since need go 2 steps. syra(10) = 10 + syra(5) = 15 + syra(16) = 31 + syra(8) = 39 + syra(4) = 43 + syra(2) = 45 + syra(1) = 46 . syra(10) needed 7 steps. therefore syralen(10)=7 and finally, lengths(n) = syralen(1)+syralen(2)+...+syralen(n) the question poster there trying calculate lengths(n) my question recursive solution op has posted (which second snippet in question). i'll repost here: public class syralengths{ int total=1; public int syralength(long n) { if (n < 1) ...

computer science - Optimal update frequency -

i have dataset on data mining operation performed. want base frequency of performing data mining operation on frequency data updated. there equation give me optimal mining frequency on basis of data update frequency? if not, , wanted derive own, how go it? if wanted include more variables? need pointers reading materials if there available. thank you. this isn't cs problem though sounds 1 (unless it's homework problem... i'll assume have real world problem solve). assume if "data mining" doing more running queries against live oltp database (such setting cube on separate system). it's going boil down user problem. answer going depend on: the patterns in data capturing (is cyclical i.e. hourly/daily/weekly). updates more frequent once cycle not useful. if it's event based, , events not happening continuously, updating mining system more incoming events useless. can collect data transform data-mining setup without bogging down users or syste...

ruby - CURSOR_NOT_FOUND - my cron jobs started dying in the middle -

a cron job running years started dying after 80% completion. not sure if because collection results steadily growing , reached critical size (does not seem big me) or other reason. not sure how debug this, found user @ whom job died , tried run job user, got cursor_notfound message after 2 hours. yesterday died after 3 hours of running users. still using old mongoid (2.0.0.beta) because of multiple dependences , lack of time change it, mongo date (i know bug in versions before 1.1.2 ). i found 2 similar questions neither of them applicable. in this case , used mopped not production ready. , here problem in pagination. i getting error message mongodb cursor.refresh() cursor xxxxxxxxx rake aborted! query response returned cursor_not_found. either invalid cursor specified, or cursor may have timed out on server. any suggestions? a "cursor not found" error mongodb typically indication cursor timed out (after 10 minutes of inactivity) potentially indicate cl...

Rename .app on OSX using Qt -

i writing updater application downloads files file server. here sequence of operations: 1) download file server. 2) rename existing .app (how to?) 3) move downloaded app appropriate location. is there best practice on osx rename application programmatically? have tried qdir::rename() ? http://qt-project.org/doc/qt-4.8/qdir.html#rename i'm windows/linux qt user can't out on best practices os x.

sql - Unique clustered index on two columns for an indexed view -

i'm trying setup indexed view on table doesn't have unique id. has 2 unique identifiers if combined unique it's row. i'm having trouble creating unique clustered index indexed view requires when found thread on msdn folks agree possible create unique clustered index out of 2 columns indexed view @ http://social.msdn.microsoft.com/forums/en/transactsql/thread/f2c99845-3af1-46e8-9b52-363c24988744 but life of me, can't figure out how create it. i'm rolling query, doesn't seem cut it. create unique clustered index [pk] on myview ( myid1, myid2 ) error: the create unique index statement terminated because duplicate key found object name 'dbo.myview' , index name 'pk'. duplicate key value (71cd9b68-1a9e-47bc-bc6b-0008b230a6d8, 0e64aa3a-0631-4caf-82d9-73609ee79b19). the 2 ids listed duplicates ids myid2. so, how create unique clustered index here? well error message seems suggest there more 1 record myid1 = 71cd9...

pdf - Warnings in command line become errors in php with ghostscript -

i trying use ghostscript scan pdf , tell me pages color , black , white. have written script prints out each page , color ghostscript. when run script using command line following warning: page 56 **** warning: short look-up table in indexed color space padded 0's. this didn't seem problem because script continued until did 356 remaining pages. when ran script in php using exec() or system() functions following @ page 56: page 56 error: /ioerror in --run-- operand stack: --dict:11/20(l)-- --dict:10/18(l)-- 3092695 indexed devicecmyk 56 (\000\000\000\000\b\001\016\000\033\0040\000\005\001\t\000\002\000\003\000\)\007k\0008\bh\000n\017\224\000w\016\247\000r\034\327\000t\033\334\000\016\001\036\000d\t\177\000]\025\264\0003\007b\000s\021\234\000m\032\317\000\275t\007\000o9\t\000i\027\311\000;\to\000c\026\272\000,\006t\000\035\0047\000\022\002#\000\177jj\016uab\006r^_\005\f\t\t\000~ii\r\204oo\024sbc\000\005\003\003\000]kl\000o[\\\003\277\255\253\346\034\025\027\000@34\...

ruby - Issue installing 1.8.7 p358 under RVM -

after getting xcode rvm install 1.9.3 works totally fine. however, rvm install 1.8.7 throws following error. ~ ☺ rvm install 1.8.7 installing ruby source to: /users/jordanscales/.rvm/rubies/ruby-1.8.7-p358, may take while depending on cpu(s)... ruby-1.8.7-p358 - #fetching ruby-1.8.7-p358 - #extracting ruby-1.8.7-p358 /users/jordanscales/.rvm/src/ruby-1.8.7-p358 error running 'tar xjf /users/jordanscales/.rvm/archives/ruby-1.8.7-p358.tar.bz2 -c /users/jordanscales/.rvm/tmp/rvm_src_30581 ', please read /users/jordanscales/.rvm/log/ruby-1.8.7-p358/extract.log there has been error while trying extract source. halting installation. there has been error fetching ruby interpreter. halting installation. please aware installed ruby requires 2 patches compiled on date linux system. may have known , unaccounted security vulnerabilities. please consider upgrading ruby 1.9.3-194 have of latest security patches. ~ ☺ the log reads [2012-06-04 17:06:23] tar xjf /users/...

java - Is there a way for selecting extra fields - not to be saved - in hibernate? -

i want execute following sql in hibernate: select emp.*, utilspkg.getemployeedisplayname(emp.id) employee emp; so far good... thing - need fetched entity - can update employee. of course pl\sql function not updateable nor part of actual table... how can generate such entity in hibernate - field calculated , not updateable? many thanks! using @formula annotation, explained in hibernate documentation : sometimes, want database computation rather in jvm, might create kind of virtual column. can use sql fragment (aka formula) instead of mapping property column. kind of property read (its value calculated formula fragment).

Why is SSIS complaining that "There is a partial row at the end of the file"? -

Image
i'm importing flat file database using data flow task in ssis. file simple: contains 3 comma-separated values per row. whenever run task, however, receive warning flat file component: warning: 0x8020200f: there partial row @ end of file. this warning seems happen regardless of size of file: handful of rows in file, visually validated (with extended characters , whatnot visible) still receive it. moreover, doesn't seem matter whether have blank row @ end of file or end without trailing cr+lf. how can rid of warning can run package warnaserror enabled? (btw, seems else may have had similar problem in there partial row @ end of file , though wasn't of question.) i have found 3 things try if encounter problem. in @ least 2 out of 3 cases, ssis ignoring rows of input file above warning show it. because of that, i not recommend ignoring warning! step 1: verify flat file valid this error appear when have invalid input file. can hard detect if in...

android - PACKAGE_ADDED BroadcastReceiver doesn't work -

i have broadcast receiver registered in manifest: <application ...> <receiver android:name="com.some.pkg.newappreceiver" > <intent-filter> <action android:name="android.intent.action.package_added" /> </intent-filter> </receiver> </appcication> and receiver: public class newappreceiver extends broadcastreceiver { private static final string tag = "newappreceiver"; @override public void onreceive(context context, intent intent) { log.d(tag, "intent: " + intent.getaction()); } } and nothing received when install apk manually or android market . why? did run app contains broadcastreceiver before installing other apps? starting @ api version, broadcastreceivers not work till execute app. put activity , execute it. also , don't forget add following broadcastreceiver: <data android:scheme="package" /> ...

Best way to hand a WAR file from one Maven project to another, to use with Embedded Jetty? -

i thought simple, having problems: project1 of type war. creates entire webapp .war file, including apache modules (solr/lucene), , of our custom code. project2 existing application. needs launch embedded jetty queries against project1's war file. (see code below) main problem: when project2 instantiates jetty, needs pass in full path war file, changes each time. maven adds version number stuff project1's war file. assemblies rescue? i'm able custom assembly work, can't rid of versioning stamp project1. but wind project1-1.4.1-20120530.233546-2.war. it's in more convenient place, name still weird. jetty code in project2: // context webappcontext webapp = new webappcontext(); webapp.setcontextpath("/"); string jettyhome = system.getproperty( "jetty.home", ".." ); string fullwarname = ...; // project1's war file. path changes webapp.setwar( fullwarname ); // server ser...

html - Elements of website don't work in IE -

on site i'm working on high school basketball team, elements don't work in internet explorer. site hermantownbasketball.com. boys basketball sidebar should have nested drop down menus, 1 when mouse on team, such "high school" , when mouse on grade under team, such 9th grade. works fine in chrome, however, can't work in version of internet explorer. below part of html , corresponding css using. unfortunately, don't know enough css know part of code ie doesn't or how fix it. any appreciated! html <span class = "boyitem"> <h3>high school</h3> <li class="group"> <h4>9th grade</h4> <div class = "nested">schedule</div> <div class = "nested">events</div> <div class ="nested">forms</div> <div class ="nested">calendar</div> </li> <li class="group"> ...