Posts

Showing posts from April, 2011

javascript - doesn't work within a -

javascript - <a> doesn't work within a <div> - i have button 3 states (three different images) , works , looks great except primary function of button - link other document:) when it's clicked, nil happens. need utilize javascript or <input> or <button> ? i've tried <button> tag, 3 states didn't work. and <a id="backbutton"> ... doesn't work either. #backbutton{ width: 100px; height:100px; background-image: url('../obrazky/fs/back_up100.png'); } #backbutton:hover{ background-image: url('../obrazky/fs/back_hover100.png'); } #backbutton:active{ background-image: url('../obrazky/fs/back_down100.png'); } <div id="backbutton"><a href="index.html"></a></div> use #backbutton a{display:block;width:100%;height:100%;} to create link within div fit container.. javascript html css

c - Are Wndproc and hook in the main thread? -

c - Are Wndproc and hook in the main thread? - sorry dumb question, wndproc , hooks in main thread (when called)? if mean can not utilize them build buffer keyboard input? your window procedure (and subclassed window procedures, hooks, etc) run in thread called createwindow (it's requirement same thread later process message queue, window procedures run when main message dispatch loop calls dispatchmessage ). not sure mean "build buffer keyboard input". c windows

java - Package modifier produces error -

java - Package modifier produces error - eclipse giving me error when defining top level class bundle modifier, error : syntax error on token "package", delete token. my code simpy: package class myclass { ... } my google-foo seems broken, help great! please inquire questions necessary... thanks! when want delcare class bundle private, should omit modifier. package keyword used define packages. java package access-modifiers

cocoa - NSFetchRequest with distinct values and expression -

cocoa - NSFetchRequest with distinct values and expression - i have create nsfetchrequest iphone app returns same results next sql statement: select week , year , sum(duration) totalduration mytable grouping year , week i've tried solve next code: nsexpression * durationexpression = [nsexpression expressionforfunction:@"sum:" arguments:[nsarray arraywithobject:[nsexpression expressionforkeypath:@"duration"]]]; nsexpressiondescription * durationexpressiondescription = [[[nsexpressiondescription alloc] init] autorelease]; [durationexpressiondescription setexpression:durationexpression]; [durationexpressiondescription setexpressionresulttype:nsdoubleattributetype]; [durationexpressiondescription setname:@"totalduration"]; nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"myentity" inmanagedobjectcontext:managedobjectcontext]; nsarra...

CUDA: How to check for the right compute capability? -

CUDA: How to check for the right compute capability? - cuda code compiled higher compute capability execute long time on device lower compute capability, before silently failing 1 day in kernel. spent half day chasing elusive bug realize build rule had sm_21 while device (tesla c2050) 2.0 . is there cuda api code can add together can self-check if running on device compatible compute capability? need compile , work devices of many compute capabilities. there other action can take ensure such errors not occur? in runtime api, cudagetdeviceproperties returns 2 fields major , minor homecoming compute capability given enumerated cuda device. can utilize parse compute capability of gpu before establishing context on create sure right architecture code does. nvcc can generate object file containing multiple architectures single invocation using -gencode option, example: nvcc -c -gencode arch=compute_20,code=sm_20 \ -gencode arch=compute_13,code=sm_13 ...

objective c - Memory Leak with SubstringWithRange NSString -

objective c - Memory Leak with SubstringWithRange NSString - running programme through leaks tool in x-code, points function main cause of memory leaks. + (nsmutablearray *) getcolumns:(nsstring *) devicehtml { nsmutablearray *ret = [[[nsmutablearray alloc] init] autorelease]; nsregularexpression *m = [[nsregularexpression alloc] initwithpattern:@"<td[\\w\\w\\d\\s</>]*?>[\\w\\w\\d\\s]+?</td>" options:nsregularexpressioncaseinsensitive error:nil]; nsarray *results = [m matchesinstring:devicehtml options:nsmatchingcompleted range:nsmakerange(0, [devicehtml length])]; [m release]; (nstextcheckingresult * res in results) { nsstring *cleaned = [devicehtml substringwithrange:[res range]]; int firstclose = [cleaned rangeofstring:@">"].location; int cleanedlength = [cleaned length]; nsstring *cleaned1 = [cleaned substringwithrange:nsmakerange(firstclo...

Replace only whole word in javascript -

Replace only whole word in javascript - possible duplicate: match , replace whole words in javascript i want replace in javascript word "microsoft" "stackoverflow". but want replace whole word - don't want "microsoft microsftttt" turned "stackoverflow stackoverflowttt". you can add together ' ' begin of string & end of string, replace ' microsoft ' ' stackoverflow ' , cutting ' ' , added before it javascript

sql server 2005 - How to use DECLARE and SELECT in one line? -

sql server 2005 - How to use DECLARE and SELECT in one line? - i using asp script i want utilize "declare" 1 table , display table records using "select" statement.... <% rs.open "declare @product1 table (rooms varchar(15), adults varchar(15))insert @product1 values ('superior','1')insert @product1 values ('standard','1') insert @product1 values ('deluxe','1') select * @product1", conn, 3, 3 if not rs.eof response.write " working" end if rs.close %> when using rs.open getting error in "if condition" adodb.recordset error '800a0e78' operation not allowed when object closed. sql-server-2005 asp-classic ado

objective c - "Test After Build" option in XCode 4 not working -

objective c - "Test After Build" option in XCode 4 not working - so, having bear of time figuring 1 out. have looked around, , cannot seem find info on this. what want have unit tests run every time build code in xcode. have read number of posts, including this question here. have followed instructions letter, , build not run tests. what have done: my test suite target dependency of main build my main build has "test after build" set yes all of tests under "test" phase in scheme there, , checked if run tests manually - through cmd+u or menu - tests run. have added failing test seek , forcefulness build fail - can sure running. build continues pass fine, , tests never run. i positive have missed step in here, life of me cannot find documentation related it. have other advice or steps should doing? it doesn't matter whether or not "test after build" set yes or no in something.app target. necessary set "test ...

php - __autoload not respected when testing with PHPUnit -

php - __autoload not respected when testing with PHPUnit - how can create phpunit respect __autoload functions? for example, have these 3 files: loader.php function __autoload($name) { echo "foo\n"; require_once("$name.php"); } test.php require_once("loader.php"); class footest extends phpunit_framework_testcase { function testfoo() { new foo(); } } foo.php require_once("loader.php"); new foo(); as expected php foo.php errors out, saying file "foo.php" doesn't exist. testfoo() function errors out saying there no such class foo , , never echos "foo\n" line. this expected behavior. see phpunit bugtracker entry: upgrading 3.5.10 has broken function of "autoload" as of phpunit 3.5: phpunit uses autoloader load classes. if tested code requires autoloader, utilize spl_autoload_register() register it. quick fix: the alter required add toge...

How do I update a document in Solr PHP? -

How do I update a document in Solr PHP? - hi can update document in solr php without deleting first , adding whole new document? when want update document, phone call function "adddocument" same set of compulsory fields. solr internally update document. solr not back upwards updating individual fields in document, if thats looking for. source: solr-139 hope helps! php solr

.Net Xml Serialization: how to collapse misc children nodes to text? -

.Net Xml Serialization: how to collapse misc children nodes to text? - i'd utilize xmlserializer deserialize next structure: <modules> <module name="1"> <config> <miscnodes1/> ... </config> </module> <module name="2"> someconfigstring1;someconfigstring2; </module> </modules> to .net classes that: [xmlroot("modules")] class config { [xmlelement("module"); public list<module> modules { get; set; } } class module { [xmlattribute("name")] public string name { get; set; } [???] public string config { get; set; } } i'd collapse miscellaneous children nodes within ./modules/module string: "<config><miscnodes1/></module>" , "someconfigstring1;someconfigstring2;" (just if phone call innerxml element) xmltext doesn't help me. how can ? thank in advance! ...

asp.net mvc - records being deleted when creating and adding new record via Linq To SQL & MVC3 -

asp.net mvc - records being deleted when creating and adding new record via Linq To SQL & MVC3 - i trying add together new comment comment table records in table beingness deleted exception of 1 added. example: allow have existing comment in database client 1. want add together new comment. in controller have following: list<customercomment> comments = _commentsrepository.customercomments.tolist(); customercomment newcomment = new customercomment() { custid = 1, revisionnumber = revnumber, comment = comment, client = _commentrespository.getcustbyid(1), commentdate = datetime.now, userid = 24, users = _commentsrepository.getuserbyid(24) }; comments.add(newcomment); _commentsrepository.savecomment(); in repository have following: public int32 savecomment(customercomment comment) {...

iPhone Developer License -

iPhone Developer License - i wanted know if have iphone developer enterprise license, possible distribute our apps limited number of users (of our choice) through app store? in other words, our iphone apps visible limited number of users (whom have selected preview our apps) also, there other way distribute our apps other app store? thanks, with ios developer enterprise licence able distribute apps limited number of users not through appstore, in fact apps in appstore available every user. able sign , distribute (via wi-fi or 3g) own apps create them run only on selected devices, though. called in-house distribution . iphone

Pass datetime to controller action with jquery-ajax -

Pass datetime to controller action with jquery-ajax - how pass datetime using jquery ajax controller action? using jquery ui datepicker ie.textbox , calendar control. the action still controller/action/11/12/2011 doesn't work...any help please? this have: $.ajax({ url: '<%: url.action("mypartial", "mycontroller") %>/' + datestring, type: "get", datatypestring: "html", success: function (response, status, xhr) { var container = $("#mycontainer"); container.html(response); }, error: function (xmlhttprequest, textstatus, errorthrown) { var container = $("#mycontainer"); container.html('<div class="error">an error occurred</div>'); } }); where var datestring = $('#mydate').val(); if have action method...

google app engine - AppEngine task to create many entities -

google app engine - AppEngine task to create many entities - i'm building application people attending events. need create ticket entity subset of person entities, specific event. amount of people may exceed 50,000 entities. obviously can't for-loop iterate on person query , generate these tickets. how construction on app engine, there way take advantage of mapreduce? you may want take @ deferred library. can spool bunch of task queues in parrallel work want. may want @ mapper illustration class in google docs may help force in right direction. google-app-engine gae-datastore mapreduce

embedded - Best scripting language for cross compiling to ARM -

embedded - Best scripting language for cross compiling to ARM - i looking "best" scripting language interpreter cross compiling arm processor. here requirements "best": its small. ideally, i'd able decide parts of language , "standard" libraries supported. (for instance: file system, nah don't want that. floating point math, nope don't want either.) its easy. ideally, i'd documentation/tutorial/examples on how cross-compile. the goal: i'm writing small, simple web server in embedded arm device , i'd string processing easily. code written in c. i'd server , system-level code in c. i'd write web "application" in scripting language. language features i'm interested in are: built-in string support built-in regex support built-in map back upwards (i.e key-value pairs object) i'd "best" come next list: perl, python, ruby, lua. open other language suggestions. i consid...

"Rails by Example" authentication implementation -

"Rails by Example" authentication implementation - in michael hart's book code used implement authentication: module sessionshelper def sign_in(user) cookies.permanent.signed[:remember_token] = [user.id, user.salt] #permanent # -alternatively- # cookies.signed[:remember_token]={ # :value => [user.id, user.salt], # expires => some_time.from_now # } current_user = user end def current_user=(user) @current_user = user end def current_user homecoming @current_user ||= user_from_remember_token end private def user_from_remember_token #passes array of length 2 parameter -- first slot contains id, #second contains salt encryption user.authenticate_with_salt(*remember_token) end def remember_token #ensures homecoming of double array in event #cookies.signed[:remember_token] nil. cookies.signed[:remember_token] || [nil,nil] end end it it's job we...

ruby on rails - What's the point of using Resque with Redis To Go for background tasks -

ruby on rails - What's the point of using Resque with Redis To Go for background tasks - if point of having tasks calling external services (such sending emails) sent background tasks , workers remove time consuming tasks main app, don't understand why using resque redis go such great idea. isn't redis go external service in case wouldn't defeat purpose since storing key/values queue on redis go unpredictable , potentially time consuming itself? edit the reason i'm confused hadn't set workers , queue generated (and operations waiting because there no workers) resque on redis go. i'm assuming means initial redis go write done main thread. the main reason utilize background workers main thread not tied running task. using resque, allows tasks executed outside main thread. many reasons. biggest slow operations not cause main thread hang, blocking out functionality until request done. redis go remote redis database. in main thread, operation ...

Is a python script aware of its stored location path? -

Is a python script aware of its stored location path? - /home/bar/foo/test.py: i trying test.py print /home/bar/foo irrespective of run script from: import os def foo(): print os.getcwd() test run: [/home/bar $] python /home/bar/foo/test.py # echoes /home/bar [/tmp $] python /home/bar/foo/test.py # echoes /tmp os.getcwd() not function task. how can done otherwise? try this: import os.path p = os.path.abspath(__file__) python

python - How to populate shelf with existing dictionary -

python - How to populate shelf with existing dictionary - lets have large, 100s of megabytes, dictionary want create on disk shelve. i'm using pypar utilize mpi generate cleaned bits of master list. what's best way accomplish this? example: # much before masterdict = shelve.open( 'ashelvefile' ) # .. . . . . # work out parts of masterdict maintain # , set acleandict # utilize mpi pypar send cleaned bits master rank if pypar.rank() == 0: tempdict = {} p in range(1,pypar.size()): tempdict.append(pypar.receive(p)) l1 in tempdict: l2 in l1: realdict.append(l2) p in range(1,pypar.size()): pypar.send(realdict,p) # realdict has cleaned bits # send other hosts else: pypar.send(acleandict, 0 ) acleandict = pypar.receive( 0 ) # replace masterdict acleandict # note: cannot send shelve dictonaries using pypar # insert stackover flow code here. here shelve simple dictionary , create accessibly via key mydict : import...

php - How to validate given data in ORM? -

php - How to validate given data in ORM? - kohana's orm comes built in kohana's validation. as much understood, validates fields will be added database. won't work me because need validate fields come $_post (in simple speaking). let me give example. in controller: $data = arr::extract($this->request->post(), array('username', 'password', 'password_repeatedly', 'email')); seek { orm::factory('user')->sign_up($data); $this->request->redirect('sign-in'); } catch(orm_validation_exception $exception) { $errors = $exception->errors('error_messages'); echo 'there errors:<br />'; echo debug::dump($errors); exit; } variable $data array need validate. method sign_up() custom method in orm model create user. sorry "echo'es" , "exit's" in controller - i'm debugging... my orm model looks this: public function rules()...

c++ - Boost error in xcode -

c++ - Boost error in xcode - i new boost library. dragged , drop boost folder xcode , entered header search path. when compile giving error #if defined(boost_asio_header_only) # error not compile asio library source boost_asio_header_only defined #endif how prepare this? you can't drop boost source xcode , build it. utilize build instructions boost documentation. c++ xcode boost

Declaration statements in C -

Declaration statements in C - i seem have problem declarations screwing math. advice or suggestions highly welcomed. here's code: int num1, num2, num3, num4, op, ; op = ((1==num3) || (2==num4)); num3 = (num1 + num2); num4 = (num1 * num2); i've been trying lots of arrangements , re-assignments. lot has compiled, when 5 + 5 = 2659043, there's problem... not sure you're trying do, code doing: int num1, num2, num3, num4, op, ; this line informs c compiler needs allocate space 5 integers (num1, num2, num3, num4, op), these integers can used variables until scope expires. not sure why have lastly ',' might want remove that. op = ((1==num3) || (2==num4)); if num3 1, or num4 = 2, set op 1 (true). otherwise, set op 0 (false). num3 = (num1 + num2); self-explanatory: add together num1 , num2 , set sum num3. num4 = (num1 * num2); self explanatory: multiply num1 , num2 , set product num4. immediately see issue p...

c - Confusing language in specification of strtol, et al -

c - Confusing language in specification of strtol, et al - the specification strtol conceptually divides input string "initial whitespace", "subject sequence", , "final string", , defines "subject sequence" as: the longest initial subsequence of input string, starting first non-white-space character of expected form. subject sequence shall contain no characters if input string empty or consists exclusively of white-space characters, or if first non-white-space character other sign or permissible letter or digit. at 1 time thought "longest initial subsequence" business akin way scanf works, "0x@" scan "0x" , failed match, followed "@" next unread character. however, after discussion, i'm convinced strtol processes longest initial subsequence of expected form, not longest initial string initial subsequence of possible string of expected form. what's still confusing me language in ...

android - If we extend the httpclient somehow to capture some statistics, media player will use our extended Httpclient or not? -

android - If we extend the httpclient somehow to capture some statistics, media player will use our extended Httpclient or not? - i'm trying capture statistics number of 302's , 200 oks or time takes client receive content streamer (time takes actual request (url) http client till http client sends content media player). cleanest way extend httpclient code. challenge me know if media player (any kind) utilize extended version of httpclient or not. appreciate if can help me @ to the lowest degree based on experience think this. cheers, stz the challenge me know if media player (any kind) utilize extended version of httpclient or not. it not. starters, don't know if uses httpclient . if does, own httpclient subclasses not known mediaplayer . android httpclient media player

html - PHP E-mail Form: Different E-mails For Dropdown Menu -

html - PHP E-mail Form: Different E-mails For Dropdown Menu - i've set php e-mail form , works fine. however, i'm not sure how create different subject selections send different e-mail addresses. please help me? give thanks you. html: <label><strong>subject:</strong></label> <select name="subject" size="1"> <option value="general feedback">general feedback</option> <option value="book information">book information</option> <option value="business inquiries">business inquiries</option> <option value="website related">website related</option> </select> php: <?php if(isset($_post['email'])) { // edit 2 lines below required $email_to = "the official website of ricky tsang <ricky@rickytsang.ca>"; $email_subjec...

Can I use Self Tracking Entities and DBContext in Entity Framework 4.1? -

Can I use Self Tracking Entities and DBContext in Entity Framework 4.1? - i want know if dbcontext (ef 4.1) supports self tracking entities. if yes, how can that? no unless rewrite template back upwards them. current template dependent on objectcontext api. entity-framework-4.1 self-tracking-entities dbcontext

web hosting - Suitability of deploying python 2.7 apps using external (PyPi) packages in major hosts -

web hosting - Suitability of deploying python 2.7 apps using external (PyPi) packages in major hosts - i writing python programme processing files (no django involved). need zodb3 , whoosh hosted on http://pypi.python.org. needs deployed in major host bluehost or hostgator. my questions are: can depend on reliable python 2.7 back upwards major hosts? can back upwards other packages (one host has list of supported packages , tells contact tech back upwards more packages), if available easy_install interface? is pain set up? will selection of zodb (object persistence library, part of zope) cause problems? it seems dumb question, can save weeks of time. some relevant details: file processing, no django required. zodb object persistence. dont need zodb store can readily reconstructed. no cannot depend on kind of python back upwards hoster or operating system. build own portable python distro , include 3rd party modules need. have 1 tarball install on ...

c# - Listbox item stay focused after selection -

c# - Listbox item stay focused after selection - i don't know if title express want. have listbox in wpf generate many elements. when click on element while still generating want selected item not move downwards list, cannot see anymore, want remain in exact position click on it. if possible, can point ideas on how in c#? thanks. assuming thought , using winforms step 1: determine index of selected item in source. step 2: when adding items listbox split listbox @ index item insert item @ point, add together on remainder of items, while making sure you've removed item if elsewhere in list. code: //let's assume know how position of item when clicked , save //item variable called originalitem public void puttheiteminthesamespot() { var listboxitems = (list<integer>)yourlistbox.datasource; var originalclikeditem = originalitem; var toppart = new list<integer>(); (i = 0; < itemposition; i++) { toppart....

python - Google app engine: Queries -

python - Google app engine: Queries - i have table foo foos stored , if log in via browser , list foos there 1 foo id=12. have code: logging.info(fid) q = db.gqlquery("select * foo id = :1", fid) logging.info(list(q)) which prints 12 [] if q.fetch(4) still gives me index out of range. doing wrong? help! read doc. can't query raw id, need create key object. python google-app-engine

python - Exception thrown in multiprocessing Pool not detected -

python - Exception thrown in multiprocessing Pool not detected - it seems when exception raised multiprocessing.pool process, there no stack trace or other indication has failed. example: from multiprocessing import pool def go(): print(1) raise exception() print(2) p = pool() p.apply_async(go) p.close() p.join() prints 1 , stops silently. interestingly, raising baseexception instead works. there way create behavior exceptions same baseexception? i have reasonable solution problem, @ to the lowest degree debugging purposes. not have solution raise exception in main processes. first thought utilize decorator, can pickle functions defined @ top level of module, that's right out. instead, simple wrapping class , pool subclass uses apply_async (and hence apply ). i'll leave map_async exercise reader. import traceback multiprocessing.pool import pool import multiprocessing # shortcut multiprocessing's logger def error(msg, *args): ...

c++ - Knowing the number of template parameters in the declaration -

c++ - Knowing the number of template parameters in the declaration - if have, template<typename t1, typename t2, int n> class x {}; is there way, can know class x has 3 template arguments ? use case in brief: there 2 library classes ptr<t> (for normal pointer) , ptr_arr<t,n> (for pointer array). these 2 interacting class in next way: template<typename t> void clear(const t &obj) { if(t::args == 1) destroy(obj); else destroy_arr(obj); } so, thought if have handy way of knowing number of parameters, create easy. however, larn need alter business logic there cannot such way. there no standard way (unless utilize variadic sizeof(args...) in c++0x) that's beside point -- question wrong. use overload resolution. template <typename t> void clear (ptr<t> & obj) { destroy (obj); } template <typename t, int n> void clear (ptr_arr<t,n> & obj) { destroy_arr (obj); } c++ temp...

web config - WCF Web API Configuration File to IIS -

web config - WCF Web API Configuration File to IIS - i have implemented restful service wcf web api , want publish in iis. during developing process using service console application , configuration made through api. i'm trying publish service asp.net application , way see somehow move configuration web config file. here coded configuration: var cfg = httphostconfiguration.create() .addmessagehandlers(typeof(allowcrossdomainrequesthandler)); using (var host = new httpconfigurableservicehost(typeof(restfulservice), cfg , new uri("http://localhost:8081"))) { var endpoint = ((httpendpoint)host.description.endpoints[0]); //assuming 1 endpoint endpoint.transfermode = transfermode.streamed; endpoint.maxreceivedmessagesize = 1024 * 1024 * 10; // allow files 10mb host.open(); console.writeline("host opened @ {0} , press key end", host.description.en...

html - Help with Image sizing Issue in ie -

html - Help with Image sizing Issue in ie - i have markup, (i know not utilize css - restriction in environment) goes this: <table width="100%" cellpadding="5"> <tr><td width="60%"> <img src="../images/oracle_memory.gif" alt="oracle_memory.gif" width="100%"/> </td> <td> </td> </tr> </table> in ie, image shows @ 100% of original size, in other browsers (chrome, firefox) image scales fill 100% of cell size - intended... is there ie specific hack or syntax create image behave consistently in browsers? tia you setting width of image rather of style of image. change: <img src="../images/oracle_memory.gif" alt="oracle_memory.gif" width="100%" /> into: <img src="../images/oracle_memory.gif" alt="oracle_memory.gif" style="width:100%;" /> i think ie right case. h...

python - GDAL Raster Output -

python - GDAL Raster Output - i'm trying create .tif file using gdal in python. it's creating file, saying "no preview available" whenever browse it. right now, i'm trying create re-create of input file. here's code: gdal.allregister() inds = gdal.open("c:\\documents , settings\\patrick\\desktop\\tiff elevation\\ebk1km\\color_a2.tif") if inds none: print 'could not open image file' sys.exit(1) else: print "successfully opened input file" rows = inds.rasterysize cols = inds.rasterxsize myband = inds.getrasterband(1) elev_data = myband.readasarray(0,0,cols,rows) driver = inds.getdriver() outds = driver.create('c:\\documents , settings\\patrick\\desktop\\tiff elevation\\ebk1km\\new.tif', cols, rows, 1, gdt_int32) if outds none: print "couldn't open output file" sys.exit(1) outband = outds.getrasterband(1) outdata = numpy.zeros((rows,cols),numpy.int16) outband.writearray(elev_dat...

class - help with c++ classes, pointers n such -

class - help with c++ classes, pointers n such - i have project i'm implementing dijkstra's shortest path algorithm using c++ classes. uses opengl certainly separate problems. need insight on i'm doing wrong in dijkstra class method. here relevant code: class node { public: glfloat x, y, z; int numlinks; node *link1; node *link2; glfloat distance; node *previous; node(glfloat x, glfloat y, node *link1, node *link2); node(glfloat x, glfloat y, node *link1); node(); node(glfloat x, glfloat y); ~node(); bool dijkstra(node* graph[], node *source, node *target); //returns true if path target found int dist(node &n1, node &n2); }; int node::dist(node &n1, node &n2) { glfloat d = sqrt((pow((n2.x - n1.x), 2)) + (pow((n2.y - n1.y), 2))); homecoming d; } bool node::dijkstra(node* graph[], node *source, node *target) { queue<node>...

Strip Html tags from a SQL result -

Strip Html tags from a SQL result - how strip html tags several rows in sql select query? i saw function sql server – 2005 – udf – user defined function strip html – parse html – no regular expression works think single select output select has many output rows. you should able utilize function cited on multirow result set. select dbo.udf_striphtml(yt.yourhtmlcolumn) yourtable yt html sql sql-server strip

Polynomial with Specific roots -

Polynomial with Specific roots - is there way find polynomial having specific roots i.e., 17, 29, 33 etc. polynomial should satisfy these values. there programming library available accomplish this. (x-17)(x-29)(x-33) have roots mention. if need polynomial evaluating @ points, form should enough. if need of coefficients, best bet using polynomial library multiply binomials. polynomial-math

c++ - Disabling "bad function cast" warning -

c++ - Disabling "bad function cast" warning - i'm receiving next warning: warning: converting 'void (myclass::*)(byte)' 'void (*)(byte)' this because need pass argument fellow member function instead of ordinary function. programme running correctly. i'd disable warning (wno-bad-function-cast doesn't work c++) or implement different way pass fellow member function. no. take warning seriously. should rather alter code handle scenario. pointer fellow member function( void (myclass::*)(byte) ) , normal function pointer ( void (*)(byte) ) exclusively different. see link. cannot cast them that. results in undefined behavior or crash. see here, how different: void foo (byte); // normal function struct myclass { void foo (byte); // fellow member function } now may sense that, foo(byte) , myclass::foo(byte) have same signature, why function pointers not same. it's because, myclass::foo(byte) internally resol...

post - Multiple jQuery Functions? -

post - Multiple jQuery Functions? - i have chat on site runs on jquery. however, problem on ie9, when user presses come in on input text field submits twice. assuming may thinking has click button? any help? <script> $('#message').keypress(function(event){ var keycode = (event.keycode ? event.keycode : event.which); if(keycode == '13') { sendpostmessage(); } }); $('#sendmessage').click(function(event){ if(this.disabled == true) { alert('meh'); } var tosend = $('#message').val(); if(tosend.length > 1 && tosend.length < 160) { sendpostmessage(); //alert('you sending message.' + tosend); } else { alert('invalid message.'); this.disabled = true; window.settimeout(function(){ $('#sendmessage').removeattr('disabled'); }, 3000); } }); jquery.fn.compare = fun...

winforms - About threading in .NET -

winforms - About threading in .NET - below code sample presenting design of windows form utilize in windows ce application. we having unresolved problems in our application, , suspect problem comes thread used here background worker (since class backgroundworker not available in windows ce). you can see lock object used prevent multiple instances of myworker . is right way prevent multiple instances of such "worker"? work expected? singleton worker better? public class mainform : form { private object mylock = new object(); private bool isworkerstarted = false; private thread worker; public mainform() { } public void btn_click() { lock(mylock) { if(!isworkerstarted) { myworker worker = new myworker(); worker.startevent = new eventhandler(threadstart); worker.endevent = new eventhandler(threadstop); workerthread = new thread(worker.dowork); ...

html - Greasemonkey script for auto-fill form and submit automatically -

html - Greasemonkey script for auto-fill form and submit automatically - as title suggests, want brute-force (don't pay attention, useless information) using grease-monkey script trying each word/alphabet provide. think jquery more easier javascript , embed jquery in it. sec thing thats bugging me submit form specific value. and there way store values...like if "abcd" did not work in input field page refresh un-intelligent script won't able observe word did not work already..and seek same "abcd" word again. sorry vague details var lasttried = parseint(gm_getvalue("last", "-1")); //gm_* not work on chrome best of knowledge, have utilize cookies in case. if((docik.location.href == addressa) || (docik.location.href == addressa?error)) //for example, pseudo code { if(lasttried < wordstotry.length){ lasttried++; form.data.value = wordstotry[lasttried]; //form.data.value more pseudo code, wordstotry array o...

Generate html from plain text with formatting markers in Python 3 -

Generate html from plain text with formatting markers in Python 3 - i have written set of python 3 scripts take formatted text file , move info sqlite database. info in database used part of php application. info in text file has formatting markers bold , italics, not in intelligible browser. formatting scheme this: fi:xxxx (italics on word xxxx (turned off @ word break)) fi:{xxx…xxx} (italics on word or phrase in curly brackets {}) fb:xxxx (bold on word xxxx (turned off @ word break)) fb:{xxx} (bold on word or phrase in brackets {}) fv:xxxx (bold on word xxxx (turned off @ word break)) fv:{xxx…xxx} (bold on word or phrase in brackets {}) fn:{xxx…xxx} (no formatting) i convert each line of source text (1. line containing string, using html tags instead of source formatting , 2. line, containing string stripped of formatting markers). need formatted , stripped line each source line, if no formatting markers used on line. in source d...

c++ - Selecting the path file for QTableWidgetItem qt -

c++ - Selecting the path file for QTableWidgetItem qt - hi i'm trying path name link image viewer wont link error on path = (currentdir.absolutefilepath(item->text()) ); can help me. created in qt c++ void window::open(int row, int /* column */) { qtablewidgetitem *item = filestable->item(row, 0); qstring path; path = currentdir.absolutefilepath(item->data(qt::displayrole)).tostring(); qgraphicsview* w = new qgraphicsview(); qgraphicsscene *scn = new qgraphicsscene( w ); w->setscene( scn ); qpixmap pix (path); scn->addpixmap( pix ); w->show(); } ` replace item->text() with (item->data(qt::displayrole)).tostring(); and see if works. m not sure. copy entire line , replace urs. u misplaced brackets thats why u getting error. path = currentdir.absolutefilepath(( item->data(qt::displayrole) ).tostring()); ...

Re-use a hardcoded value in multiple function calls in PostgreSQL query -

Re-use a hardcoded value in multiple function calls in PostgreSQL query - i have functions in postgresql 9.0 homecoming table results. thought behind these homecoming info @ time, eg. create function person_asof(effective_time timestamp time zone) returns setof person ... create function pgroup_asof(effective_time timestamp time zone) returns setof pgroup ... i can query them if tables, joins , all: select * pgroup_asof('2011-01-01') g bring together person_asof('2011-01-01') p on g.id = p.group_id this works fine, there trick can utilize specify effective time once? i tried this: select * (select '2010-04-12'::timestamp ts) effective, pgroup_asof(effective.ts) g bring together person_asof(effective.ts) p on g.id = p.group_id ...but fails error: function look in cannot refer other relations of same query level , putting main query sub-query doesn't help, either. this have wanted in past not possible yet, there may h...

iphone - How to change the alpha of a UILabel by tapping? -

iphone - How to change the alpha of a UILabel by tapping? - i have ios (4.0) app alter alpha of specific uilabel of taping anywhere on screen. don't have interface done programmatically, used interface builder place labels things on screen. how can utilize tap gesture alter alpha of specific uilabel in program? thanks in advance! in viewdidload: uitapgesturerecognizer *onetap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tapaction:)]; [onetap setnumberoftapsrequired:1]; [onetap setnumberoftouchesrequired:1]; [self.view onetap]; then define method: -(void)tapaction:(uigesturerecognizer *)gesture { [self.yourlabel setalpha:0.5f]; // set alpha whatever want, or animate fade, whatever } iphone ios uilabel alpha

how to turn the output of a require statement into a string in php -

how to turn the output of a require statement into a string in php - im working big team, , im making functions homecoming html code, , im echoing result of functions final page. thing is, need scrap of code developed other fellow member of team, , need string, code available php file im supposed include or require within page. since im not writing ht;ml page, function generate code, need turn resulting html of require statement string concatenate code generated function. is there way evaluate require , concatenate result strings? ive tried function eval(), didnt work, , read thing get_the_content(), isnt working either. dont know if need import something, think have wordpress, , im using raw php. thanks help!!! =) try ob_...() family of functions. example: <?php function f(){ echo 'foo'; } //start buffering output. output sent internal buffer instead of browser. ob_start(); //call function echos stuff f(); ...

Regex to find text immediately following 1st occurrence of a word -

Regex to find text immediately following 1st occurrence of a word - say i'm looking @ stream of web page, , near top says about 367 results etc etc. number (of results) next word about regex. have example? or bone-head tutorial matter? thanks. you'll want capture first grouping in regex /\babout\s+(\d+)/ regex

loops - Jquery help, looping an animation -

loops - Jquery help, looping an animation - i'm jquery noob, how loop this? if possible, can neaten aswell works same less code? $(document).ready(function() { speech_animation(); }); function speech_animation(){ $( "#b-block_wrap" ).delay(1000).fadein(500).animate({ top: 0}, {duration: 500,}); $( "#p-block_wrap" ).delay(2000).fadein(500).animate({ top: 0,}, {duration: 500,}); $("#first_wrap").delay(5500).fadeout(500); $( "#g-block_wrap" ).delay(6000).fadein(500).animate({ top: 0}, {duration: 500,}); $( "#y-block_wrap" ).delay(7000).fadein(500).animate({ top: 0}, {duration: 500,}); $("#second_wrap").delay(10500).fadeout(500); } you can utilize phone call in lastly function phone call lastly function phone call finished, phone call itself. $(document).ready(function() { speech_animation(); }); function speech_animation(){ $( "#b-block_wrap" )...

syntax - Is there any easier way of creating overload for methods in C#? -

syntax - Is there any easier way of creating overload for methods in C#? - this general programming uncertainty rather specific one. state example. suppose i'm creating messagebox class of mine own, , want .show() method implemented 21 overloads. can shown below. public static void show(string x){} public static void show(int x){} public static void show(param x){} public static void show(param2 x){} public static void show(string x, param y){} . . . . public static void show(param x, param y){} writing 21 such methods becomes quite hassle. there simpler way this? like, public static void show(string x, string y, int i, param p, ...... param21st z) { if (//see arguments , decide) //do stuff ignoring rest of arguments; else if (//passed arguments of these type) //then stuff. else if (so , so) // , so. } note: 1. know there can arguments wouldn't create single function big can exceed size of separately written 21 different ...

Android AsyncTask - avoid multiple instances running -

Android AsyncTask - avoid multiple instances running - i have asynctask processes background http stuff. asynctask runs on schedule (alarms/service) , sometime user executes manually. i process records sqlite , noticed double-posts on server tells me sometime scheduled task runs , @ same time user runs manually causing same record read , processed db twice. remove records after processed still this. how should handle ? maybe organize kind of queing? you can execute asynctask's on executor using executeonexecutor() to create sure threads running in serial fashion please use: serial_executor . misc: how utilize executor if several activities accessing db why don't create sort of gateway database helper , utilize synchronized block ensure 1 thread has access @ instant android

email - OSX/postfix: Unable to send mail with PHP mail() -

email - OSX/postfix: Unable to send mail with PHP mail() - some while ago i've installed xampp on mac osx machine. without ever doing relative configuration myself, php mail() function worked beautifully. since few weeks, without apparent changes, stopped working. it worked both own isp , 1 of clients' isp. doesn't work either suspect it's local problem. also, mail service create postfix, suspect not xampp/php issue. does have experience this? recent postfix mail.log jul 11 10:20:57 mymac postfix/master[9012]: daemon started -- version 2.5.5, configuration /etc/postfix jul 11 10:20:57 mymac postfix/qmgr[9014]: 3d6271033872: from=<nobody@mymac.local>, size=3061, nrcpt=1 (queue active) jul 11 10:20:57 mymac postfix/qmgr[9014]: 6083b1033897: from=<nobody@mymac.local>, size=3061, nrcpt=1 (queue active) jul 11 10:20:57 mymac postfix/qmgr[9014]: 765e210338c9: from=<nobody@mymac.local>, size=3061, nrcpt=1 (queue active) jul 11 10:20:57 mymac...

c# - ASP.NET, Webservice response as a download link for Android -

c# - ASP.NET, Webservice response as a download link for Android - because webservice supposed consumed using android device, based on friend had told me, said way have download file , read there. this project not going live, demonstrated on 1 computer. file can saved in c:\ folder, instead of live server. so right trying find way homecoming download file link, instead of original xml format. download link format looking .xml. my web service in format: i have location.cs public list<locations> ws(string parameter) { list<locations> abc = new list<locations>(); // on here populate abc list objects. homecoming abc; } as far asp.net , c# part concered can . whenever have file info should write file . , phone call function passing path , file name want appear other end . //forces download/save rather opening in browser// public static void forcedownload(string virtualpath, string filename) { response.clear(); response.addhea...

javascript - Jquery ZeroClipboard or Zclip nothing in clipboard IE 8 and 7 -

javascript - Jquery ZeroClipboard or Zclip nothing in clipboard IE 8 and 7 - i'm using jquery plugin zclip or zeroclipboard copies content clipboard via button or link. info re-create , links/buttons activate loaded using ajax needs utilize plugin, attach elements after have loaded so: $('#ajaxbutton').live('click', function() { $.ajax({ type: "post", url: "ajax.php", success: function(msg){ $('a.ajaxcopymulti').zclip({ path:'js/zeroclipboard.swf', copy:function(){ homecoming $('p#ajaxdescription').text(); } }); }); }); and in ajax.php example: <p id="ajaxdescription">ajax description copied clipboard</p> <p><a href="#" id="ajaxcopy">click here re-create above text</a></p> works other browsers ie 7 , ie 8. error: unknown runtime error: zeroclipboard.js, line 135 character 3...

c# - sql type float, real, decimal? -

c# - sql type float, real, decimal? - well in database had colum cost of 1 product had float , problem if saved since c# application 10.50 .. in query returns 10,50 , if update error 10,50 cant convert float ... or so.. , if saved decimal , in queries within sql management .. ok.. in c# application... same error.. 10.50 retuns 10,50 dont know why, , how solved it.. unique solution saved varchar ... i think setting in windows regional , language decimal symbol wrong.please set dot , 1 time again test it. c# sql floating-point decimal

android - View html code for a webpage on Tablets -

android - View html code for a webpage on Tablets - like net browsers allow users view html or other source code of of web pages visit. need view source code , there go. using android tablet on paypal website , wondered if there way code it. paypal website offers pop-up screen on top of page saying download android app. want know how add together feature on site. use android default web browser: javascript:alert(document.documentelement.innerhtml); and android google chrome browser: view-source:http://www.yoursite.com android html browser

android - Can I use the ADB to see if my application is successfully writing to a text file? -

android - Can I use the ADB to see if my application is successfully writing to a text file? - my application stores info writing text file, when seek open , read text file programme doesn't recognize i've written in text file. i've decided seek utilize adb see if can find txt file, when go data.app , seek open file - com.benbaltes.android-fields2.apk says can't cd app. is there anyway can check , poke around files in app? rooted , have su access it depends on how create text file, can poke around. take within /data/app-private or /data/data/your_package_name/ . can utilize adb shell start shell on device/emulator, , cat works print text file (any file, actually) console. the apk file not info written -- that's distribution file app. android file adb writing

c# 4.0 - How to tackle/fix SimpleFSLock in Lucene -

c# 4.0 - How to tackle/fix SimpleFSLock in Lucene - i error when update or add together lucene documnet. know happens when indexwriter beingness used other resource simplefslock excetion , in scenario close indexwriter there no chance of indexwriter beingness opened. is there way if exception can prepare this. edit : static object mylock = new object(); public static void adddocument(//some params) { lock (mylock) { seek { //i exception thrown on below line [not sure might file have been locked due other resource accessing : how can free lock] indexwriter author = new indexwriter(getfileinfo(indexname), analyzer, false); writer.adddocument(*//some document //*); writer.optimize(); writer.close(); } grab (exception ex) { log.logwarn(null, ex.message); ...

(Partial) database synchronization with mysql -

(Partial) database synchronization with mysql - i'm looking solution able synchronize, upon request, selection of tables between live mysql database local database. if there no specific solution this, solution synchronizing local , live databases? the desktop db manager sqlyog has "job scheduler" tool setting things this. requires professional or enterprise license(cheaper sound), 30-day trial full-featured if want check out first. mysql database

statistics - Are overlapping sub-arrays of a byte array independent enough to use as hash function(s) for Bloom Filter? -

statistics - Are overlapping sub-arrays of a byte array independent enough to use as hash function(s) for Bloom Filter? - i have next question in context of bloomfilter. bloomfilters need have k independent hash functions. let's phone call these function h1, h2, ... hk . independent in context means value have little correlation (hopefully zero) when applied same set. see algorithm description @ http://en.wikipedia.org/wiki/bloom_filter (but of course, know page within out :). now, assume want define hash functions using n bits (coming crypto function if must know, it's not relevant question), independent each other themselves. if want more context can read http://bitworking.org/news/380/bloom-filter-resources doing similar. for example, assume want define each h (pardon pseudo-code): bytes = md5(value) h1 = bytes[0-3] integer h2 = bytes[4-7] integer h3 = bytes[8-11] integer ... of course of study run out of hash functions quickly. 4 in md5 example. ...

eclipse - ResourceException when creating IMarker on IFile (linked resource) -

eclipse - ResourceException when creating IMarker on IFile (linked resource) - i have problems updating "old" eclipse plugin. here , original plugin did: (parse compiler output on console file name , error info --> still works) --> set link location within file --> set marker location in file what did in past ifile path string of file , generated link , marker it: ifile ifile; iworkspace workspace = resourcesplugin.getworkspace(); ipath path = new path(filename); ifiles[] files = workspace.getroot().findfilesforlocation(path); ... ifile = ifiles[0]; map attributes = new hashmap(); attributes.put(imarker.severity, new integer (severity)); markerutilities.setlinenumber(attributes, linenumber); markerutilities.setmessage(attributes, message); markerutilities.createmarker(ifile, attributes, imarker since findfilesforlocation deprecated, tried find way not succeeding whatsoever. using changed code ifile results in exception: org.eclipse.core....

sql server - Index hints cannot be specified within a schema-bound object -

sql server - Index hints cannot be specified within a schema-bound object - i receive error message when altered view "index hints cannot specified within schema-bound object." how can solve problem? indexed views cannot altered; have dropped , re-created. sql-server view alter

.net - Why doesn't the compiler (or the runtime) do the InvokeRequired pattern for me? -

.net - Why doesn't the compiler (or the runtime) do the InvokeRequired pattern for me? - why isn't cross-thread ui update safety handled automatically? to ensure thread-safety when potentially updating ui thread have write if (control.invokerequired()) invoke(..) pattern, or equivalent. runtime observe when i'm calling ui-updating method thread , marshal phone call me? must know when needed because throws exception if seek without necessary precautions. could compiler apply pattern me on every ui update call? if cause unacceptable overhead, perhaps feature controlled application attribute (the developer apply attribute when writing multi-threaded application in cross-thread ui updates going happen). i can imagine several potential answers: either it's dumb thought because , or it's impossible/impractical because , or isn't seen add together plenty value justify cost of development. i can't reply why although inquire if feature worth...

Wordpress - Permalinks and folders (.htaccess ?) -

Wordpress - Permalinks and folders (.htaccess ?) - i have wordpress website permalinks post name. have new template on specific page uses files same url path, , can't alter that. how can create wordpress access requested page (example.com/meniu/) , ignore folder name same name? (example.com/menu/swf/) thank you! this .htaccess. how can add together exclusions? <ifmodule mod_rewrite.c> rewriteengine on rewritebase /club/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /club/index.php [l] </ifmodule> you prepend rule exclude directory: rewritecond %{request_uri} ^/menu rewriterule . /club/index.php [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /club/index.php [l] wordpress .htaccess mod-rewrite url-rewriting

Android back button problem -

Android back button problem - say have 3 activities in application: a, b , c. flow though application is: -> b -> c. once @ c, pressing button take user b. if user presses button time got a, , if press 1 more time, exit application. objective: when user presses button on c, should go , not b, , if press time, exit app. problem: when overriding button on activity c launch activity appears ok. if user presses button again, homecoming activity c. , pressing button switches between activity , activity c. i guess activity stack looks like: open app: a go b: a, b go c: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a ...etc so seems error launch new activity when button on c pressed? anyway, advice on how implement behaviour. thanks, jack you can add together finish() in onstop() method of activity b. this way, when activity b no longer visi...