Posts

Showing posts from January, 2011

javascript - I need to slider work with mouse wheel -

javascript - I need to slider work with mouse wheel - please see url: http://whipwap.co.uk/shopsense/slider_example/slider_test.html and code : $(document).ready(function(){ $("#content-slider").slider({ mousewheel:true, animate: true, change: handlesliderchange, slide: handlesliderslide }); }); now want slide mouse wheel.how can this. looking support. thanks, deepak in $(document).read() add together code: $("#content-slider").bind('mousewheel', function(event, delta) { var newvalue = $(this).slider("value"); var step = $(this).slider("option", "step"); if (delta > 0) newvalue += step; else newvalue -= step; $(this).slider("value", newvalue); }); you might want decrease animation length or clear queue in handlesliderchange() , because sliding becomes jittery when using mous...

opening a 32bit visual C# project in 64bit OS -

opening a 32bit visual C# project in 64bit OS - i've built project in micorosft visual c# in 32bit windows scheme , , works fine there need able open project , little bit of work on other scheme has 64bit windows. there way can that? .net architecture-independent. work out-of-the-box. if uses p/invoke, you'll need create sure you're using int , intptr correctly work on 64-bit systems too. if uses 32-bit-only com libraries, you'll need set target platform x86 rather any cpu . c# visual-studio-2010 32bit-64bit

java - Is a logger per class or is a set of loggers that are accessed by the entire application perferred? -

java - Is a logger per class or is a set of loggers that are accessed by the entire application perferred? - i have project in java, , create 7 loggers accessed facade every point of program. in internet, see lot of examples witha logger in each class. what recommended way logging? a logger in each class improve , more easy extend. reason define 1 logger in 1 class separate real logging api logger's configuration (format, persistence) easily. have worked more 1 big , complex java software (> 1 1000000 lines of code), utilize 1 logger per class. also, define "one logger per class" doesn't mean each class utilize different logger instance. class foo { private static final logger log = logger.getlogger( foo.class ); } class bar { private static final logger log = logger.getlogger( bar.class ); } whether 2 logger used above using same logger instance if not sure above code. normally, there configuration place (in property file or in...

eclipse - Code Obfuscator for any Java Project -

eclipse - Code Obfuscator for any Java Project - i searching java code obfuscator 1 in netbeans j2me project , in android project in eclipse- works any (not j2me) java project in eclipse , netbeans. is there plugin or external application , looking for? proguard established standard, guess java eclipse plugins netbeans obfuscation

javascript - send data from a new window to previous window in php -

javascript - send data from a new window to previous window in php - i have image in main.php file : <img src="..\images\image.gif" class="cur" onclick="imgwin();"> when click on image below function has called : function imgwin() { imagewin=window.open("../pages/img.php","imagewin","toolbar=no,width=500,height=200,directories=no,menubar=no,scrollbars=yes"); } this function opens img.php in new window img.php file : <html> <head> <title>upload image</title> </head> <body> <form name="imgform" method="get" action="#"> address : <input type="file" name="imgurl" size="50"> description : <input type="text" name="description" size="50"> <input type="submit" value="sumbit...

ruby on rails - Activerecord opitimization - best way to query all at once? -

ruby on rails - Activerecord opitimization - best way to query all at once? - i trying accomplish reducing numbers of queries using activerecord 3.0.9. generated 'dummy' 200k customers , 500k orders. here's models: class client < activerecord::base has_many :orders end class orders < activerecord::base belongs_to :customer has_many :products end class product < activerecord::base belongs_to :order end when using code in controller: @customers = customer.where(:active => true).paginate(page => params[:page], :per_page => 100) # select * customers ... and utilize in view (i removed haml codes easier read): @order = @customers.each |customer| customer.orders.each |order| # select * orders ... %td= order.products.count # select count(*) products ... %td= order.products.sum(:amount) # select sum(*) products ... end end however, page rendered table 100 rows per page. problem kinda slow load becaus...

mysql - Selecting top 3 items per customer -

mysql - Selecting top 3 items per customer - possible duplicate: how select maximum 3 items per users in mysql? i have sql table 3 columns: customernumber, item, count there 125 items in table; each row contains client number item number , number of times client has bought it. i'd have query each client , top 3 items. how go doing this? set @i := 0; set @cn = -1; select customernumber, item, `count` ( select customernumber, item, `count`, case when customernumber != @cn @i := 0 else @i := @i + 1 end i, @cn := customernumber t order customernumber, `count` desc ) ss < 3 mysql sql

java - JNotify and File Reader conflicting each other -

java - JNotify and File Reader conflicting each other - i implemented jnotify determine when new file arrives in particular directory, and, when file arrives, send filename on function, follows: public class filedetector { messageprocessor mp; class listener implements jnotifylistener { public void filecreated(int wd, string rootpath, string name) { print("created " + rootpath + " : " + name); mp.processmessage(rootpath + "\\" + name); } } } the function mp.processmessage tries open file, maintain getting error file in utilize process. however, file has been created, other process might using jnotify. i set couple of print statements, , appears function mp.processmessage beingness called before listener's print function. have suggestion how might resolve this, beyond putting entire message processi...

sql - MySQL: Any suggestions to improve best match Stored Procedures -

sql - MySQL: Any suggestions to improve best match Stored Procedures - for project working on have scan key best match. these scan causing lot of load on our test system. body thought how can improve this? tried temporary tables , cursors. an illustration of code using: set keylength = (length(key)-1); while keylength >=1 select count(*) resultcount keytable screeningkey = (select substring(key)-,1,keylength)); if (0 < resultcount) select screeningkey bestmatchscreeningkey keytable , screeningkey = (select substring(key)-,1,keylength)); /*go step4*/ leave step4; end if; set keylength = keylength-1; end while; instead of using select count(*) utilize if exists . if exists can stop scanning finds match, while count(*) needs go through entire table tally count. so, end like: (i don't utilize much mysql, i'm not sure on syntax , copy-pasted syntax doesn't quite right me...) set keylength =...

What is the easiest way to use Sqlite in D program on Ubuntu? -

What is the easiest way to use Sqlite in D program on Ubuntu? - i suppose using phobos.etc.c.sqlite3 binding. compiling sqlite3.c using c compiler create .o file , link program. which c compiler should use, , compiler flags? possible link sqlite3.o dmd in 1 step, without calling linker separately? or there other easier way? answer: how sqlite going d on 64bit ubuntu install sqlite dev sudo apt-get install libsqlite3-dev compile dmd test.d -l-ldl -l/usr/lib/x86_64-linux-gnu/libsqlite3.a test.d import std.stdio, std.string, etc.c.sqlite3; void main () { sqlite3* db; auto ret = sqlite3_open (tostringz("mydb.s3db"), &db); writeln (ret); } -ldl switch needed because of sqlite3 linking problems you can utilize binding available sqlite library (of appropriate version, certainly), without having manually compile object file. have done in c: you'd #include <headers> , add together -llibrary compiler flags. same here — im...

c++ - XP app won't increase cpu utilization -

c++ - XP app won't increase cpu utilization - i trying prepare problem legacy visual studio win32 un-managed c++ app not keeping input. part of solution, exploring bumping class , thread priorities. my pc has 4 xeon processors, running 64 bit xp. wrote short win32 test app creates 4 background looping threads, each 1 running on own processor. code samples shown following. problem when bump priorities extreme, cpu utilization still less 1%. my test app 32 bit, running on wow64. same test app utilizes less 1% cpu utilization on 32 bit xp machine. administrator on both machines. else need work? dword __stdcall threadproc4 (lpvoid) { setthreadpriority(getcurrentthread(),thread_priority_time_critical); while (true) { (int = 0; < 1000; i++) { int p = i; int reddish = p *5; theclassprior4 = getpriorityclass(theprocesshandle); } sleep(1); } } int apientry _twinmain(...) { ... theproce...

Facebook AppRequests redirect user to a Page Tab -

Facebook AppRequests redirect user to a Page Tab - when sending apprequest using page tab: fb.ui({ method : 'apprequests', message : 'message', title : 'friend' }, function (response){})); i want receiving user directed page tab , not canvas application page. there redirect_uri parameter that's no documented or should hard refresh on canvas? also know if can forcefulness user select 1 friend in dialog in used possible in old requests widget? thoughts appreciated if user clicks 'accept' on request, sent canvas page url of app sent request. url contain additional parameter request_ids, comma delimited list of request ids user trying deed upon: https://apps.facebook.com/[app_name]/?request_ids=[request_ids] you can redirect fan page tab. atul agrawal, founder, ascratech.com facebook

Magento/PHP - Modifying the MySQL Queries Underlying the Front-End Product Search Box -

Magento/PHP - Modifying the MySQL Queries Underlying the Front-End Product Search Box - currently, mysql database queries supply results product search field on front end end seem utilize "or" linking criteria in clause of queries. the reason assume using "or" because if search "green , reddish plaid shirt", every product "red" (including "bored", "stored", etc), every product "green", every product "plaid", , every product "shirt". now if can find out in code queries beingness constructed, should able alter "and" , end queries this: select `product_id` `products` `search_index` '%red%' , `search_index` '%green%' , `search_index` '%plaid%' , `search_index` '%shirt%'; i haven't been able find info searching google or magento's forums. i've been poking around app/code/core/mage/catalogsearch/ have not found mother lode yet. ...

Blackberry and Windows phone 7 publishing of trivial app -

Blackberry and Windows phone 7 publishing of trivial app - we have mobile version of our web site works on mobile screen resolutions , sizes. now, build simple app blackberry , windows phone 7. app trivial - after click on icon, opens web browser , send our mobile web site. windows os shortcut place on desktop. can tell me if blackberry , windows phone 7 policies allow such app published? example, apple rejected us. i can't speak blackberry, requirement 2.10 wp7 application certification requirements: your application must have distinct, substantial , legitimate content , purpose other simply launching webpage. so reply seems no on wp7 marketplace. there reason want create app anyway? on wp7, users can pin tile home screen launch website they've pinned. encourage users on wp7 , you'll same effect (except site won't appear in app list). windows-phone-7 blackberry

Parsing "true" / "false" in Java -

Parsing "true" / "false" in Java - what's utility method parses boolean string properly? mean "true" => true "false" => false "foo" => error the parse methods in java.lang.boolean dodgy - don't distinguish "false" "foo". else in java libraries (or guava, or commons lang) properly? yes it's couple lines, rather not write any line shouldn't have to. :-) check out boolean utils form apache commons : boolean utils api converts string boolean throwing exception if no match found. null returned if there no match. booleanutils.toboolean("true", "true", "false") = true booleanutils.toboolean("false", "true", "false") = false java parsing text-processing

oracle - SQL help with MAX query -

oracle - SQL help with MAX query - i have table of countries named bbc(name, region, area, population, gdp) i want table region, name , population of largest ( populated) countries region. far i've tried this: select region, name, max(population) bbc grouping part it gave me error message : ora-00979: not grouping expression i tried alter grouping region, name, doesn't give me right table here's easiest , shortest way it, since oracle has tuple testing, can create code shorter: first, max population on each region: select region, max(population) bbc grouping part then test countries against it: select region, name, population bbc (region, population) in (select region, max(population) bbc grouping region) order part if want back upwards many rdbms, utilize exists: select region, name, population bbc o exists (select null -- neutral. doesn't invoke cargo cult programming ;-) bbc ...

asciiencoding - Convert ascii files into normal human-readable file -

asciiencoding - Convert ascii files into normal human-readable file - i have got ascii files , want convert them maybe excel or tab/csv delimited text file. file table field name , field attributes. includes index name, table name , field(s) index if required depending on software. don't think necessary think of this. well, field name , field attributes enough, hope so. want info hidden inside. can experts help me done. the lines this: 10000001$"word" word$10001890$$$$495.7$$$n$$ 10000002$11-word-word word$10000002$$$$$$$y$$ 10000003$11-word word word$10033315$0413004$$$$$$n$$ 10000004$11-word word word$10033315$$$$$$$y$017701$ the general answer, before knowing ascii file in details, operating system, , on, be: 1 - cutting top n-lines, containg info don't want. leave filds names, if want to. 2 - check if fields separated mutual character, example, 1 comma , 3 - import file within spreadsheet program, excel or openoffice calc. in oocalc, ...

Optimal PNG images for Android -

Optimal PNG images for Android - a long time ago came across video 1 of android developers giving introductory lecture android. @ 1 point during lecture mentions android optimized formatted pngs. can't find video or reference formatting. know? are referring android .9 png's? if here link android png .9 png themes youtube video hope helps android

virtualhost - Apache Error Document is not working -

virtualhost - Apache Error Document is not working - i running apache2 webserver in linux environment.i want redirect users customized error pages.so have created error pages & created symbolic link in htdocs this. static-files -> /app/static-files. , in httpd.conf file have created virtual host definition , included error pages below: namevirtualhost m.mydomain.com:80 <virtualhost m.mydomain.com:80> documentroot "/app/httpd-2.2.15/htdocs" servername m.mydomain.com:80 <directory "/static-files/html/error_pages"> options followsymlinks order allow,deny allow </directory> errorlog /app/httpd-2.2.15/logs/error_my_log errordocument 400 /static-files/html/error_pages/error_400.html errordocument 401 /static-files/html/error_pages/error_401.html errordocument 403 /static-files/html/error_pages/error_403.html errordocument 404 /static-files/html/error_pages/error_404.html erro...

SQL get the value above(larger) and below(smaller) of an inbetween value in a select statement -

SQL get the value above(larger) and below(smaller) of an inbetween value in a select statement - i have table containing 2 columns "allowable" , "thickness". the thickness values allow 1.2 2 3 4,3 i'm trying write udf can take thickness (eg2.3) , interpolates allowable values. question if there smart (or maybe out of box) function returns upper , lower thickness value need (2 , 3). regards, lumpi i'm using ms sql server 2008.. select 'max', max(thickness) value thicknesses thickness < requirement union select 'min', min(thickness) value thicknesses thickness > requirement sql select

jsf - How do I make a RichFaces rich:panel behave like a link? -

jsf - How do I make a RichFaces rich:panel behave like a link? - i have simple rich:panel . behave 1 big link page. possible? how? for example: section rich:datagrid in richfaces manual show grid of auto descriptions. suppose wanted create each panel link detailed page car, how that? the illustration based on richfaces 3: <rich:panel> <a4j:support event="onclick".../> </rich:panel> or this: <a4j:outputpanel> <a4j:support event="onclick".../> <rich:panel></rich:panel> </h:outputpanel> jsf richfaces hyperlink

php - How do I invoke my C++ binaries via the CGI interface? -

php - How do I invoke my C++ binaries via the CGI interface? - i'd convert php solution c++ solution. have server-side written in php - not much code, under one thousand lines. can rewrite no problem - don't need utilize hip-hop or similar automations. the question how install/configure right software back upwards c++ code on server side. not know how invoke binaries web server via cgi. php easy, install xampp or similar write php , pretty much , going. however, want run c++. thanks three basic options: do whole thing in c++, making programme standalone web server (possibly proxying through apache provide things ssl, static media, authentication etc.) run c++ in cgi-bin, through apache make php wrapper shells out c++ part (this nice alternative if performance-critical part small, can still utilize comfort php's garbage collection , string manipulation gives you) php c++ mysql linux apache

Why does .NET IL always create new string objects even when the higher level code references existing ones? -

Why does .NET IL always create new string objects even when the higher level code references existing ones? - background: have xml document containing thousands of pseudocode functions. i've written utility parse document , generate c# code it. here's simplified snippet of code gets generated: public class someclass { public string func1() { homecoming "some value"; } public string func2() { homecoming "some other value"; } public string func3() { homecoming "some value"; } public string func4() { homecoming "some other value"; } // ... } the of import takeaway each string value may returned multiple methods. assumed making minor alter methods instead homecoming references static fellow member strings, both cutting downwards on assembly size , cut down memory footprint of program. example: public class someclass { private const string _some_value = "some value"; private const ...

ruby on rails - const_missing error when changing I18n backedn -

ruby on rails - const_missing error when changing I18n backedn - i'm trying upgrade i18n backend of application utilize database instead of yml files internationalization. i'm next steps found i18n-active_record gem found here: https://github.com/svenfuchs/i18n-active_record. unfortunately, aws-s3 gem seems conflicting somehow can't start server or console 1 time create locale.rb initializer. here summary of steps i'm following: gem "i18n-active_record", "~> 0.0.2" create new file config/initializers/locale.rb within locale.rb i18n.backend = i18n::backend::database.new restart localhost server load initializer error message /users/user_name/.rvm/gems/ree-1.8.7-2010.02@app/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant i18n::backend::database (nameerror) ...(several more lines) any help or insight appreciated! although readme in github says so, don't think database con...

How do I get text from a website using PHP? -

How do I get text from a website using PHP? - so, i'm working on php script, , part of needs able query website, text it. first off, need able query website url, need able text text website after query, , able homecoming text out of function. how query website , text it? the easiest way: file_get_contents() that source of web page. you want bit more finish though, curl, improve error handling, , setting user-agent, , not. from there, if want text only, going have parse page. that, see: best methods parse html php php website

location - nginx on separate server proxy_pass to multiple rails apps with sub URI on passenger standalone in different boxes -

location - nginx on separate server proxy_pass to multiple rails apps with sub URI on passenger standalone in different boxes - i have requirement, there multiple rails applications. each application deployed in 2 app servers, (app1 , app2) , load balanced through nginx on separate server (lb). the lb box contains plain vanilla nginx without passenger plugins. rails applications deployed on passenger stand alone. all rails applications need run on same domain different sub_uri, below http://www.example.com/rails1 http://www.example.com/rails2 i have lb box nginx configuration below. http { ... upstream rails1_cluster { ip_hash; server app1.server:3001; server app2.server:3001; } upstream rails2_cluster { ip_hash; server app1.server:3002; server app2.server:3002; } ... server { server_name www.example.com; ... ... location /rails1 { ...

user interface - jQuery Panels - Toggle one DIV closed before Toggling open another one! -

user interface - jQuery Panels - Toggle one DIV closed before Toggling open another one! - i have next code. i wondering if there way observe if panel toggled on , if so, automatically toggle off before toggling 1 on? observe should happen when user clicks buttons. i tried adding "hide" function each panel function didn't work desired. current code: $(function() { $("#panel-2-button").click(function() { $("#content-inner-panel-2").toggle("slide", { direction: "left" }, 1000); }); $("#panel-2-button-medium").click(function() { $("#content-inner-panel-2-medium").toggle("slide", { direction: "left" }, 1000); }); $("#panel-2-button-large").click(function() { $("#content-inner-panel-2-large").toggle("slide", { direction: "left" }, 1000); }); $("#panel-3-button").click(funct...

Is there a generic way to do comparison both numeric and string in Perl? -

Is there a generic way to do comparison both numeric and string in Perl? - as knows, numeric's comparing uses different operators string's. there generic way comparing both numeric , string in perl ? should check value numeric or string before doing comparison? freshman in perl. please help if have idea. thanks. in add-on ways mentioned, when using perl > 5.10.1, smart matching can used. @ lines 29 .. 32 in referenced table. if 1 operand number, numeric comparing used, otherwise fallback string. string perl numeric

c# - Can you compare Fluent NHibernate with xml configuration mapping files? -

c# - Can you compare Fluent NHibernate with xml configuration mapping files? - what should take consideration if need take between fluent nhibernate , standard xml mapping files of nhibernate? can compare prominent differences should aware of? several things , mentioned perchance duplicate question main 1 can think of can alter xml files without code recompile cannot alter mappings in fluent without recompiling because nature compiled. that said can have mappings assembly , patch that. whatever changes create need run through integration tests. aside fluent nhibernate can confusing nhibernate users because mix terms own should start xml file mappings until totally understand whats going on migrate fluent if don't need alter mappings without recompilation reads better. however don't forget adding layer of abstraction on top own quirks can create interesting debugging. c# .net nhibernate fluent-nhibernate

How to find all XML elements by tag name in Groovy? -

How to find all XML elements by tag name in Groovy? - how can find elements in xml tag name in groovy (gpath)? i need find car elements in document: <records> <first> <car><id>378932<id></car> </first> <second> <foo> <car><name>audi</name></car> </foo> </second> </records> this tried , failed: def xml = new xmlslurper().parse(file) assert xml.car.size() == 2 this how works: def xml = new xmlslurper().parse(file) def cars = xml.depthfirst().findall { it.name() == 'car' } assert cars.size() == 2 xml groovy

php - How to get the current Browser in a Selenium RC Test? -

php - How to get the current Browser in a Selenium RC Test? - i'm coming problem still can't solve after hours of hard googling : lastly chance... i have simple php page (let's "bad_request.php") respond 400 bad request status code : <?php header('status: 400 bad request', false, 400); header($_server['server_protocol'].' 400 bad request', false, 400); exit('error message'); ?> i have selenium rc test case defined set of browsers : static public $browsers = array( array( 'name' => 'google chrome 12 on win7', 'browser' => '*googlechrome' ), array( 'name' => 'internet explorer 9 on win7', 'browser' => '*iehta' ), ... ) and have test method opens "bad_request.php" , check status code , error message. the thing browsers don't have same behavio...

android - How we can use Context class? -

android - How we can use Context class? - i android developer.i doing r&d on context. know can extend class context class not able find out functionality should utilize this. can body help me? it interface allows access various application components.. , responsible accessing info of other applications.. android android-context

ms word - Controlling table row height for document in poi -

ms word - Controlling table row height for document in poi - i trying draw table in poi using xwpf component using below code // inputstream in= temp.class.getresourceasstream("sample.docx"); xwpfdocument doc = new xwpfdocument(); xwpftable table=doc.createtable(2,2); // ctdecimalnumber rowsize = table.getcttbl().gettblpr().gettblstylerowbandsize(); // rowsize.setval(new biginteger("10")); // table.getrow(1).setheight(0); table.getrow(0).getcell(0).settext("row-0-cell-0"); table.getrow(0).getcell(1).settext("row-0-cell-1"); table.getrow(1).getcell(0).settext("row-1-cell-0"); table.getrow(1).getcell(1).settext("row-1-cell-1"); fileoutputstream out = new fileoutputstream("simpletable.docx"); doc.write(out); out.close(); it draws table height of cells big , width not falls in place. saw in note table supposed auto fit per content....

batch processing - Perform record-matching within a table on FIFO basis -

batch processing - Perform record-matching within a table on FIFO basis - i have scenario need match records within table on fifo basis. table construction looks below - table - order_request id, request_type, qty, crtd_ts 10, buy, 15, 15:00 12, buy, 6, 15:25 15, sell, 5, 15:35 16, sell, 6, 16:00 18, buy, 15, 16:30 19, sell, 20, 16:33 20, sell, 4, 17:45 22, sell, 1, 18:02 given sample info above - thought able match records purchase , sell request types, starting oldest, , jumping through records orderly if necessary. so, in case - id(10), match id(s) 15, 16 , 19 id(12), match id 19 id(18), match id(s) 19, 20 , 22 this table have many records, , wondering best approach is. should utilize batch framework spring batch sequentially process these records ? won't able leverage parallel or multi-threaded processing, , single-thread processing take long time. is there way sql ? don't know answer. any advice or tips ? thanks! matching batch-...

c# - DefaultIfEmpty in LINQ-to-SQL join causing duplicates -

c# - DefaultIfEmpty in LINQ-to-SQL join causing duplicates - here extract of query: ... bring together p in dc.pods on c.id equals p.consignment pg pgg in pg.defaultifempty() ... what query should 'pods' associated consignment, store ienumerable object (which seems work) can run through when querying main ienumerable generated query. the problem is, getting duplicate main rows defaultifempty line, happens when row has multiple pods - it's returning row each pod, incorrect. if take out pg.defaultifempty() line, seems work bit better, still want rows without pods. any ideas guys? forgive me if i'm off on intention because can't see finish construction of info or initial from or final select clause in query excerpt. i'm posting think solution based on snippet , sample info constructed. allow me know if i'm off , i'll right it. if want list of rows of consignments pods, each consignment pod on own line, (keep in mind from...

Qt "Copy/Paste/Cut" -

Qt "Copy/Paste/Cut" - well, i'm doing text editor, write text "qplaintextedit" i'm having issues, i'm trying in "edit" menu, alternative copy/paste/cut. with re-create meant, select text in editor, open edit menu, click re-create , sends clipboard. paste, pastes copied? cut, cuts selected text. qtextedit has slots copy , paste , cut . so, need connect signals these slots , have c-c\c-v functionality. can in qdesigner without coding. qt copy paste cut

javascript - RegEx expression -

javascript - RegEx expression - i'm using javascript , grateful pattern matches 1 through 6 digits followed optional .nn . so, in end i'd have function returns true strings match patterns these: nn nnn nn.nn nnnnn.nn nnnn nnnnnn.nn nnnnnn (where n digit). thanks!! you can /^\d{1,6}(.\d\d)?$/ js like: /^\d{1,6}(\.\d\d)?$/.test(str) javascript regex

android - Camera intent with GPS enabled -

android - Camera intent with GPS enabled - is there way launch photographic camera app via intent gps turned on, returned photo geo-tagged? this isn't possible camera-intent. whether utilize api geo-tag (since need current latlon) or take image using intent , edit exif-header. to add together geotag, can utilize setgpslatitude() , setgpslongitude() -methods android gps camera android-intent

c# - Smallest difference between two angles? -

c# - Smallest difference between two angles? - i'm trying calculate smallest difference between 2 angles. this current code (a slight variation of found online): float a1 = mathhelper.todegrees(rot); float a2 = mathhelper.todegrees(m_ftargetrot); float dif = (float)(math.abs(a1 - a2); if (dif > 180) dif = 360 - dif; dif = mathhelper.toradians(dif); it works fine except in cases @ border of circle. illustration if current angle 355 , target angle 5 calculates difference -350 rather 10 since 365 degrees equal 5 degrees. any ideas on can create work? you had it. take dif modulus 360 before checking see if greater 180: float a1 = mathhelper.todegrees(rot); float a2 = mathhelper.todegrees(m_ftargetrot); float dif = (float)math.abs(a1 - a2) % 360; if (dif > 180) dif = 360 - dif; dif = mathhelper.toradians(dif); edit: @andrew russell made great point in comments question , solution below takes advantage of mathhelper.wrapangle method sugges...

php - CodeIgniter Custom Errors for Forms? -

php - CodeIgniter Custom Errors for Forms? - i using <?php echo validation_errors(); ?> display ci errors , wondering if possible include custom errors (like if username/password incorrect?). i tried $this->form_validation->set_message("password or username incorrect"); however didn't work. idea? thanks! it's possible callback. http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks php codeigniter

javascript - Remove apostrophe from a string -

javascript - Remove apostrophe from a string - i working within programme allows me reference database fields using syntax such {cli:firstname}, references client's first name. programme allows me utilize html , java script display web page within window within program. the problem having have written lot of pages , scripts display right information, have found problem. have scripts pass database field function such as function a('{cli:firstname}'},'{cli:lastname}'){ logic; } i pass way because function in external .js file. programme using not allow me reference database field straight except in .html file displaying in window in program. therefore, every function in .js has similar parameter list. can write function in header of page , straight access database field without passing field parameter, causes other problems, , moved scripts out due speed , other limits in programme displaying web page. the problem occurs when seek pass datab...

url rewriting - .htaccess conditional redirect question -

url rewriting - .htaccess conditional redirect question - i'd utilize .htaccess redirect if there particular subdirectory present. basically, i'd redirect http://www.mydomain.com http://www.mydomain.com/install if install subdirectory exists. i know need rewritecond. far, have. rewriteengine on rewritecond %{request_filename} -d i'm not sure else create work. need help understanding how .htaccess works. i'd combine rewriting www. please help? this should work, update path install folder in rewritecond: rewritecond /var/www/domain/htdocs/install -d rewriterule .* install/ [l] .htaccess url-rewriting

events - Is there a way to detect find on the page searches in javascript -

events - Is there a way to detect find on the page searches in javascript - each browser has find on page functionality (ctrl+f). there way observe user searches in javascript attach additional actions. of course of study can seek hook ctrl+f or cmd+f shortcut, if works on "some" browsers, way know user pressed shortcut , search something. if browser allows overwrite shortcut, farther block default behavior , implement own search logic on site. considered times bad practice. overwritting native browser behavior pretty pretty bad. on other hand, there no "event" gets triggered when browser executed search process. in short words, no, there no way observe or hook search process javascript (if there one, it's never gonna cross browser compatible). javascript events find

jquery - Listen for change to Javascript object value -

jquery - Listen for change to Javascript object value - is possible (using jquery or otherwise) hear alter in value of non-dom javascript object (or variable)? so, instance, have: function myobject() { this.myvar = 0; } var myobject = new myobject(); myobject.myvar = 100; is there way hear when value of myvar changes , phone call function? know utilize getter/setters, aren't supported in previous versions of ie. if ie important, guess not interested in watch but seems have written shim makes question duplicate javascript - watch object properties changes javascript jquery

css - Does Aptana 3 recognize CSS3? -

css - Does Aptana 3 recognize CSS3? - while learning css3 realized aptana studio 3 doesn´t recognize css3 source. have updated latest features ide still trying utilize css2. error css3 background statement: background: rgba(255, 255, 255, 0.1); valueerror: background (http://www.w3.org/tr/rec-css2/colors.html#propdef-background) many values or values not recognized. do have install particular plugin aptana?? edited jul 26th 2011, bug still there after automatic update. the problem css validator that's included (which comes w3c) not css 3. there plans replace that, in mean time, easiest thing either filter particular warning, or disable altogether. to so, go preferences > studio > validation , take css. there can disable validation, or add together filter of ".too many values or values not recognized." more information: http://wiki.appcelerator.org/display/tis/adding+custom+error+message+filters+to+the+problems+view css css3 aptana...

javascript - Do Google JS APIs collide with JQuery or Mootools? -

javascript - Do Google JS APIs collide with JQuery or Mootools? - making assumptions while starting big development project can cost me much time later. there reason afraid combining either jquery or mootools (latest releases) google js apis? google js api compatible jquery. i've developed few projects using both. javascript jquery mootools google-api combinations

Cleaning up binary blobs in a git repository -

Cleaning up binary blobs in a git repository - we have binary file in our git repository. it's around 2mb in size. one of our developers accidentally committed file bundled of dependencies, bumped file around 40mb. of course of study committed fixed version, main repository still has useless chunk of 40mb of binary info not need. can guarantee never need file's history specific commit (or other commit matter - it's compiled binary, have source versioned anyway). how can remove blob of info restore repo size? simple git gc doesn't suffice, , think need lower-level hacking not familiar with. if can create file source code, doesn't belong repository @ all. if want remove version of file repository, have rebase repo, ideally using git rebase -i . problem it's rewriting history , shouldn't commits public (that is, shared between multiple users). see recovering upstream rebase how create work if want to. after rebase, file remain in r...

.NET VSTO Add In for Excel 2007 not loading config. Issue on one machine only! -

.NET VSTO Add In for Excel 2007 not loading config. Issue on one machine only! - we have vsto add together in excel 2007. works on machines in our office except one. happened after ms updates lastly week. basically, add-in won't recognize config file, on specific machine. uninstalled/reinstalled application, excel, updates without success. did total win 7 reinstall, loaded excel, our app, , got same issue. have him running our app on vm xp , it's fine. no 1 else in organization having issue. not sure else @ point since total windows reinstall did nothing. help appreciated. thanks. solution: start > run > regedit > hkey_current_user\software\microsoft\office\excel\addin\youraddinname\ edit manifest key, from: manifest="c:\program files\\wordaddin.vsto|vstolocal" to: manifest="file:///c:\program files\\wordaddin.vsto|vstolocal" to create work in deployment, right click on setup project in solution explorer > ...

database permissions - Cannot find the symmetric key in SQL Server 2008 -

database permissions - Cannot find the symmetric key in SQL Server 2008 - i have permissions issue regard using symmetric key under specific user name when stored procedure executed. despite running grant command on certificate::mycert myuser grant view definition on symmetric key::mykey myuser i still same error: cannot find symmetric key 'mykey', because not exist or not have permission. the master key, certificate , symmetric key set under database user name relates to. if run sp under windows authentication works fine. here's stored procedure: open symmetric key mykey decryption certificate mycert insert sp_password (billencryptpassword) values(encryptbykey(key_guid('mykey'),@billencryptpassword)) homecoming @@identity close symmetric key mykey what have missed? i having same problem while running sysadmin. to work around closing open keys works fine. i'd much rather close had open though. close symm...

Rails CanCan and dynamically generated Abilities -

Rails CanCan and dynamically generated Abilities - i utilize cancan on top of mongoid based rails 3 application. introduce general models user, role , privilege. authorization scheme shall authorize @ per action base. hence want store action x roles privilege objects. now when comes ability dsl generate abilities dynamically after_save hook in proivilege model. results in problem in production mode, cause these runtime changes impact server process privilege changes made. on other hand 1 reevaluate (the users) abilities before_filter in every controller. slowed downwards every request. just now, undecided how solve problem. thankful every suggestion. regards felix cancan uses simple authorization scheme based on role column on user model. here links: abilities role based authorization why need dynamically set privileges? unless have compelling reason introducing unnecessary complexity. define roles need right abilities (you can on controller/action basis...

Android Streaming Wav Audio Error: MediaPlayer Prepare failed: status=0x1 -

Android Streaming Wav Audio Error: MediaPlayer Prepare failed: status=0x1 - we streaming sound via http ffserver/ffmpeg on angstrom linux. ffmpeg sound codec pcm signed 16-bit little endian "pcm_s16le". ffmpeg stream format "wav". both of these claimed supported on android here: http://developer.android.com/guide/appendix/media-formats.html#core vlc finds , plays stream without problems. under vlc "codec details", says: type: audio, codec: pcm s16 le (araw) channels: stereo sample rate: 48000 hz bits per sample: 16 we built simple test application below pick , play stream in android , error: java.io.ioexception: prepare failed.: status=0x1 we checked http header using http debugger pro. response header items (when playing via vlc) are: [response]: http/1.0 200 ok pragma: no-cache content-type: audio/x-wav we have been searching web help on issue on 2 days , have come empty-handed. help greatly appreciated. ------------test app...

nested attributes - Implement 1:N relation in postgreSQL (object-relational) -

nested attributes - Implement 1:N relation in postgreSQL (object-relational) - i'm struggling postgresql, don't know how link 1 instance of type a set of instances of type b. i'll give brief example: let's want set db containing music albums , people, each having list of favorite albums. define types that: create type album_t ( artist varchar(50), title varchar(50) ); create type person_t ( firstname varchar(50), lastname varchar(50), favalbums album_t array[5] ); now want create tables of types: create table person of person_t oids; create table album of album_t oids; now want create db object-realational gets, don't want nest album "objects" in row favalbums of table person, want "point" entries in table album, n person records can refer same album record without duplicating on , over. i read manual, seems lacks vital examples object-relational features aren't beingness used often. i'm familiar realational model,...

Java Swing: List Models and Collections -

Java Swing: List Models and Collections - i writing programme having lot of code duplication between gui aspect , info storage aspect, , wondering if proposed solution follows acceptable design principles. basically, have info objects, have list holding more information. gui displays object, , jlist displays info in info object's list. in gui, users can add together or remove info object's list, , visually reflected in jlist. however, results in me having maintain gui jlist , object list separately: private void addinformation(string s) { this.listmodel.addelement(s); this.dataobject.getlist().add(s); } (obviously simple illustration idea). means i'm using twice much memory holding both lists. acceptable me create class implemented both listmodel , list interfaces , need update single combined list/listmodel? i'm still studying @ uni , want create project best perchance can in terms of maintainability others , adherence best practices...

windows phone 7 - Use hardware search button -

windows phone 7 - Use hardware search button - i have experience android's search functionality described here: http://developer.android.com/guide/topics/search/index.html, haven't been able find similar windows phone 7. alternatively, best approach provide search functionality within windows phone application? the search scope within application itself, , while possible implement myself, i'm looking follows ui guidelines of windows phone 7, , perchance interface provide search results app, when search button pressed while app in background. you responsible handling search within app. there no wp7 specific guidelines or tools available. what's best within context of app. you cannot integrate built in search facility include app specific results returned part of bing search. search windows-phone-7

reading a block of lines in a file using php -

reading a block of lines in a file using php - considering have 100gb txt file containing millions of lines of text. how read text file block of lines using php? i can't utilize file_get_contents(); because file large. fgets() read text line line takes longer time finish reading whole file. if i'll using fread($fp,5030) wherein '5030' length value has read. there case won't read whole line(such stop @ middle of line) because has reached max length? i can't utilize file_get_contents(); because file large. fgets() read text line line takes longer time finish reading whole file. don't see, why shouldn't able utilize fgets() $blocksize = 50; // in "number of lines" while (!feof($fh)) { $lines = array(); $count = 0; while (!feof($fh) && (++$count <= $blocksize)) { $lines[] = fgets($fh); } dosomethingwithlines($lines); } reading 100gb take time anyway. php file fgets fread

Python Thread: can't start new thread -

Python Thread: can't start new thread - i'm trying run code: def videohandler(id): try: cursor = conn.cursor() print "doing {0}".format(id) info = urllib2.urlopen("http://myblogfms2.fxp.co.il/video" + str(id) + "/").read() title = re.search("<span class=\"style5\"><strong>([\\s\\s]+?)</strong></span>", data).group(1) image = re.search("#4f9eff;\"><img src=\"(.+?)\" width=\"120\" height=\"90\"", data).group(1) link = re.search("flashvars=\"([\\s\\s]+?)\" width=\"612\"", data).group(1) id = id print "done {0}".format(id) cursor.execute("insert videos (`title`, `picture`, `link`, `vid_id`) values('{0}', '{1}', '{2}', {3})".format(title, picture, link, id)) print "added {0} database"...

compile a stream of data in C? -

compile a stream of data in C? - is possible compile stream of info rather compiling .c file using gcc? example, possible instead of having code stored in xyz.c file, can straight compile code? use gcc options -x , - $ echo -e '#include <stdio.h>\nmain(){puts("hello world");return 0;}' | gcc -xc -ogarbage - && ./garbage && rm garbage hello world the single line command above made of next parts: echo -e '#include <stdio.h>\nmain(){puts("hello world");return 0;}' # "source" | # pipe gcc -xc -ogarbage - # compile && # , ./garbage # run && # , rm garbage ...

php - separate a string into multiple queries -

php - separate a string into multiple queries - lets have string so $string = "12 days of terror"; and want break downwards string @ each space , insert each word db. the table: tags columns: movie , tagname value: 102 , $string how write query this? just split string using explode: http://php.net/manual/en/function.explode.php , insert each tag in table. php mysql

webview - SVG support in Android -

webview - SVG support in Android - we going develop android application show autocad drawing file in svg format in ecma script using. have tested application in emulator , opened svg file in webview. our problem ecmascript in xml tags not executed in webview in android. know android supporting svg 3.0 only. not back upwards ecmascript in svg? thanks in advance final string mimetype = "text/html"; final string encoding = "utf-8"; final string html = "<p><img height=\"600px\" width=\"600px \"src=\"file:///android_asset/drawing3.svg\" /></p>"; webview wv = (webview) findviewbyid(r.id.webview_component); wv.getsettings().setjavascriptenabled(true); wv.loaddatawithbaseurl("fake://not/needed", html, mimetype, encoding, ""); ragards shibu android (3.0 , later) supports svg ecmascript. the problem ecmacript in sv...

svn - Seeing files that will be updated in Cornerstone -

svn - Seeing files that will be updated in Cornerstone - is there way, in cornerstone, see files update locally svn before doing in cornerstone? right jump command line , use svn status -u seems should able done in app , i'm missing it. i looking alternative well. i've emailed zennaware back upwards see if there global preference option, seems have set each working re-create check out. first select working copy, in menu select view > show repository status. alternatively, can right-click on working re-create , select show repository status. adds new filter filter bar called "newer in repository". svn cornerstone

oracle - How to use SQL 'IN' (or 'ANY') operator with VARRAY in PL/SQL -

oracle - How to use SQL 'IN' (or 'ANY') operator with VARRAY in PL/SQL - my .net code using odp.net phone call stored procedure many times operate on various rows in many tables. .net code has array of rows change. 1 parameter changes in each call, , i'd pass array .net pl/sql operate on multiple rows (the number of rows change). i've passed array .net pl/sql using: type number_arr table of number(10) index pls_integer; procedure "blah" (foo in number_arr); note believe number_arr called varray, i'm not positive that, , if wants right me, please (as comment), might contributing confusion. but now, in pl/sql, have many update statements used like: update t set = b = foo; when foo wasn't array. want write: update t set = b in (foo); but syntax doesn't seem work. , i've been unable find illustration oracle combines utilize of varray , 'in' (or 'any', etc.). , i've seen answers how sql...

amazon s3 - How do s3cmd and Tim Kay's aws script compare to one another, feature-wise? -

amazon s3 - How do s3cmd and Tim Kay's aws script compare to one another, feature-wise? - how s3cmd , tim kay's aws script compare 1 another, in terms of: feature richness ? ease of utilize , maintenance ? please tell me if belongs serverfault or somewhere else. please consider powershell command line interface comes cloduberry explorer freeware . windows though http://cloudberrylab.com/default.aspx?page=amazon-s3-powershell amazon-s3 amazon-ec2

jquery - Resolution independent websites? (Or, "Scaling an entire website to fill the browser") -

jquery - Resolution independent websites? (Or, "Scaling an entire website to fill the browser") - i'm working on project benefit filling whole screen -- it's 1 7000px-long page giant background filling whole length (probably chopped separate pieces , loaded in intelligent sequential fashion in final version), 5 or 6 different segments/areas/slides (basically, "content areas") scroll down. at top navigation bar fills entire horizontal width of design. below it, on background, bunch of different elements, placed @ specific positions on background. placement on background critical each element specific section of page. it seems me doing http://windyroad.org/2007/05/18/resolution-independent-web-design/ really useful. alas, that's 2007 , seems more proof-of-concept anything. plus seems bad thought resize 1000x7000px image php every time resizes browser window (or worse, 5 1000x1000 images!). i've used jquery scripts scale background image fil...

Measure average DC power in Simulink -

Measure average DC power in Simulink - i want measure powerfulness losses of igbts , diodes in powerfulness electronics circuit cant find in simulink library block average dc power.active & reactive powerfulness blocks useless because refers ac circuits. thank you. i have same question, solution far utilize integral block(i'm using discrete system) external reset enabled, interfaces scheme clock goes through mod block, whatever interval on average function modulus. triggers reset of running integral every "modulus" time steps. i'm not quite sure if there's improve way, se simulink

SQL Like search in LIST and LINQ in C# -

SQL Like search in LIST and LINQ in C# - i have list contains list of words needs excluded. my approach have list contains these words , utilize linq search. list<string> lstexcludelibs = new list<string>() { "config", "boardsupportpackage", "commoninterface", ".h", }; string strsearch = "boardsupportpackagesamsung"; bool has = lstexcludelibs.any(cus => lstexcludelibs.contains(strsearch.toupper())); i want find out part of string strsearch nowadays in lstexcludedlibs. it turns out .any looks exact match. there possibilities of using or wildcard search is possible in linq? i have achieved using foreach , contains wanted utilize linq create simpler. edit: tried list.contains doesn't seem work you've got wrong way round, should be:- list<string> lstexcludelibs = new list<string>() { "config", "boardsupportpackage", "commoninterface", "...

c# - webservices change namespace prefix of ASMX Web Service Return -

c# - webservices change namespace prefix of ASMX Web Service Return - i creating webservices , using overall namespace : [webservice(namespace = "www.abcdef.com")] when inquire wsdl gives me namespace xmlns:abc="www.abcdef.com" i alter abc prefix else. there way alter it? untested give shot: [webservice(namespace = "http://mynamespace/")] public class service1 : system.web.services.webservice { [xmlnamespacedeclarations] public xmlserializernamespaces xmlns { { xmlserializernamespaces xsn = new xmlserializernamespaces(); xsn.add("me", "http://mynamespace/"); homecoming xsn; } set { /* needed xml serialization */ } } } c# .net web-services namespaces

jquery - Can I Modify this Javascript to Print Images from Div? -

jquery - Can I Modify this Javascript to Print Images from Div? - i have div in page layout print. have worked through sample code on how , come following: <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> <script type="text/javascript"> function printelem(elem) { popup($(elem).text()); } function popup(data) { var mywindow = window.open('', 'print_div', 'height=400,width=600'); mywindow.document.write('<html><head><title>print window</title>'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.document.close(); mywindow.print(); homecoming true; } </script> then in body of html place next button: <input type="button" value="print div...

scala - Global onException to handle multiple RouteBuilder classes -

scala - Global onException to handle multiple RouteBuilder classes - i need create onexception, global on whole route builders have in order not rewrite same line every route builder create . current scope exception handler camel context specific route builder . need create route builder classes ,r1 , r2, utilize same onexception().process. the current working onexception utilize : def configure { onexception(classof[customexception]).process(exceptionprocessor). process(doextraprocess) from(address). process(dosmth). process(dosmthelse) } when have moved onexception() line configre method on class level next : onexception(classof[customexception]).process(exceptionprocessor). process(doextraprocess) def configure { from(address). process(dosmth). process(dosmthelse) } i got error : caused by: org.apache.camel.failedtocreaterouteexception: failed ...

Ignore future changes to a file in Mercurial, but still track it -

Ignore future changes to a file in Mercurial, but still track it - possible duplicate: mercurial: how ignore changes tracked file i have file in mercurial repository want have stand illustration configuration file, while i'm developing want create specific changes don't want tracked, database password. tried adding file .hgignore , mercurial still notices modifications. can have file "tracked" in mercurial repository, yet ignore future local changes file without removing repository itself? i don't think capability exists (love see else's reply alternative though :) ). alternative i've used check file source command named "config.template" (as example). app uses file named "config", create copying template file. create sure "config" file excluded in .hgignore file don't accidentally check in sometime. mercurial

r - Detecting single keystrokes -

r - Detecting single keystrokes - several times have wanted observe single keystrokes in r have failed find else readline() or similar. an illustration interactive plotting or info browsing , able alter parameter values arrow keys , automatically update plot. of course of study utilize readline() , have user input "u" instead of arrow don't find elegant. could done system() command reading stdin in way? edit: have been told elsewhere stdin wait enter-stroke before doing , catching keystrokes scheme specific , tricky accomplish. if knows how on ubuntu 10.10 or other linux/unix scheme i'd glad know. very os-dependent solution. first c code in getkey3.c: #include <stdio.h> #include <termios.h> #include <unistd.h> void mygetch ( int *ch ) { struct termios oldt, newt; tcgetattr ( stdin_fileno, &oldt ); newt = oldt; newt.c_lflag &= ~( icanon | echo ); tcsetattr ( stdin_fileno, tcsanow, &newt ); *...

osx - How to make an alias of a command which accepts an argument and is executed on background? -

osx - How to make an alias of a command which accepts an argument and is executed on background? - i want create alias open file gui editor on background command line. tried: alias new_command="editor_path &" new_command file open editor without loading file. the & ending command, not seeing file argument. can't utilize alias if want substitute filename string command ampersand on end. from bash manpage: there no mechanism using arguments in replacement text. if arguments needed, shell function should used (see functions below). consider creating shell function: function new_command { editor_path "$1" & } osx unix command-line text-editor alias

wpf - How do I retain carriage returns while moving data from a web service into Sql Server 2005? -

wpf - How do I retain carriage returns while moving data from a web service into Sql Server 2005? - my carriage returns lost when inserted sql server 2005 nvarchar parameter coming web service. know carriage returns exist in web service fields because when bind same info wpf combobox see returns occurring in proper locations. the code looks this: string insertsql = "insert mytable (fieldwithcrlf,...) values (@fieldwithcrlf,...)"; dbconn.open(); using (sqlcommand cmd = new sqlcommand(@insertsql, dbconn)) { cmd.parameters.add("@fieldwithcrlf", sqldbtype.nvarchar, 4000); ... } foreach (webservicerecord rec in alldatafromwebservice) { cmd.parameters["@fieldwithcrlfr"].value = rec.fieldwithcrlffromwebservice; ... cmd.executenonquery(); } how can retain carriage homecoming / line feeds stored in sql server fields? first, should see if cr/lfs in database. in sql server management ...

c# - Create a dictionary from a semicolon separated string using linq -

c# - Create a dictionary<string,string> from a semicolon separated string using linq - so have string like: "some key:some value; john:doe;age:234" i wrote method takes string , returns a: dictionary<string,string> was curious if via linq? assuming delimiters cannot appear in keys or values: var dict = str.split(';') .select(s => s.split(':')) .todictionary(a => a[0].trim(), => a[1].trim())); this not fastest way it, simplest. you utilize regex: static readonly regex parser = new regex(@"([^:]):([^;])"); var dict = parser.getmatches(str) .cast<match>() .todictionary(m => m.groups[0].value.trim(), m => m.groups[0].value.trim() ); c# linq