Posts

Showing posts from September, 2014

database - Android SQLite DB location -

database - Android SQLite DB location - is possible store applications sqlite database in other location define instead of default /data/data//databases location? thanks this might helpful. demonstrates how store db in assets folder of app, (though re-create on db /data/databases database, i'm not sure if help situation.) could give little more context why want store database elsewhere? android database sqlite

documented android app memory limitation -

documented android app memory limitation - i have came across blogs describing memory limitation imposed android scheme on running app, couldn't find official document of such topic, can points me place mentioned in android official document? thanks. the documentation may want activity manager official documentation. take @ listed methods there, such getlargememoryclass(), getmemoryclass(), getmemoryinfo(activitymanager.memoryinfo outinfo), etc hope helps. android memory document limit

ruby on rails - ActiveRecord: Produce multi-line human-friendly json -

ruby on rails - ActiveRecord: Produce multi-line human-friendly json - using activerecord::base.to_json do: user = user.find_by_name 'mika' {"created_at":"2011-07-10t11:30:49+03:00","id":5,"is_deleted":null,"name":"mika"} now, have is: { "created_at":"2011-07-10t11:30:49+03:00", "id":5, "is_deleted":null, "name":"mika" } is there alternative this? it great have global option, behaviour set depending on dev/live environment. i'll go out on limb , "no, there no such option". afaik, json encoding handled activesupport rather activerecord. if @ lib/active_support/json/encoding.rb activesupport gem, you'll see lot of monkey patching going on add together as_json , encode_json methods core classes; as_json methods used flatten things time, regexp, etc. simpler types such string. interesting monkey ...

sql - Mysql Indexing problem with multiple 'or' and 'and' -

sql - Mysql Indexing problem with multiple 'or' and 'and' - i've big database beingness used record events occurring. it's ticketing system. now, since stored info different status know action on ticket in same column i've utilize multiple 'or' in statement know current status in ticket. for example: 1 ticket opened, 2 acknowledgement, 3 event closed. query select events 1,2,3 be: select * tbl_name status in (1, 2, 3) , event_id = 1; i've created indexes id field, , index event_status event_id , status field. now, when run explain on query doesn't utilize event_status index rather uses other existing index event_status_dept consist of event_id, status , department. if utilize 2 fields in in i.e 'in (1,2)' statement, uses event_status index otherwise uses other index i.e event_status_dept. don't know wrong statement. i don't think wrong query. optimizer uses best index can find acc...

objective c - iPhone - Convert CTFont to UIFont? -

objective c - iPhone - Convert CTFont to UIFont? - i trying convert ctfont uifont without losing of styles , attributes such as: font name font size font color underlines bold italic etc ctfontref ctfont = ...; nsstring *fontname = [(nsstring *)ctfontcopyname(ctfont, kctfontpostscriptnamekey) autorelease]; cgfloat fontsize = ctfontgetsize(ctfont); uifont *font = [uifont fontwithname:fontname size:fontsize]; color , underline not attributes of font. bold , italic part of font name. iphone objective-c uifont ctfont

objective c - How can I move MkMapView.userLocation on iPhone? -

objective c - How can I move MkMapView.userLocation on iPhone? - i want create application need userlocation, mkmapview.userlocation readonly, can't change. how can utilize it? can setting userlocation mymap.userlocation=mycurrentlocation; any code need create easy? you need cllocationmanager current location of user updated. locationmanager:didupdatetolocation:fromlocation: method of cllocationmanagerdelegate update current user location. you may follow this tutorial larn implement it. iphone objective-c ios cocoa-touch mkmapview

iPad's splitViewController returns null -

iPad's splitViewController returns null - i have code, - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsuinteger row = indexpath.row; window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; uiviewcontroller <substitutabledetailviewcontroller> *detailviewcontroller = nil; if (row == 0) { firstdetailviewcontroller *newdetailviewcontroller = [[firstdetailviewcontroller alloc] initwithnibname:@"firstdetailview" bundle:nil]; detailviewcontroller = newdetailviewcontroller; } if (row == 1) { seconddetailviewcontroller *newdetailviewcontroller = [[seconddetailviewcontroller alloc] initwithnibname:@"seconddetailview" bundle:nil]; detailviewcontroller = newdetailviewcontroller; } if (row == 2) { view31 *newdetailviewcontroller = [[view31 alloc] initwithnibname:@"view31" bundle:nil]; detailviewcontroller ...

c++ - doubt about way to lock a boost mutex -

c++ - doubt about way to lock a boost mutex - boost::recursive_mutex m; m.lock(); versus boost::lock_guard<boost::recursive_mutex> lock( mutex_ ); is there advantage utilize first form? sec form provide raii mecanism, or there others advantages ? the advantage of using lock_guard release lock when goes out of scope. eliminates need manually release lock , reduces chance of forgetting so. boost::recursive_mutex mylock; { boost::lock_guard<boost::recursive_mutex> lock( mylock ); // if(false == do_something()) { return; // "lock" goes out of scope , unlocks 'mylock' it's destructor. } } // "lock" has gone out of scope , unlocked 'mylock' it's destructor. c++ boost mutex

apache - Two regex rewrite rules to redirect 404 urls -

apache - Two regex rewrite rules to redirect 404 urls - i having next 2 urls give me nasty 404 errors prepare adding rewrite rules apache , must recongnize don't understand regular expressions plenty able write right rules. first url http://www.example.com/fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/function.strtotime must redirect same url without /function.strtotime @ end. second url, nasty one. http://www.example.com/casas/casas_en_malaga/malaga/malaga/ strict standards: variables should passed reference in /var/www/vhosts/eldeposit.com/httpdocs/protected/helpers/search.php on line 1398/casas/casas_en_malaga/malaga/malaga/venta-vivienda-29-473-24693-0-0 this 1 must remove part strict standards error. don't know if can done regular expressions or improve programme in php 1) utilize rule -- remove function.strtotime end of url (by using 301 permanent redirect) regardless of how deep part in url (i.e. work example....

objective c - Addsubview issues -

objective c - Addsubview issues - i pretty new in coding in objective-c , have been stucked couple of hours view management issue. based on matt gemmel roudedfloatingpannel, display nsimage nice semi-transparent rounded background. //create transparent window window = [[transparentwindow alloc] initwithcontentrect:contentrect stylemask:nsborderlesswindowmask backing:nsbackingstorebuffered defer:no]; //add rounded background [window setcontentview:[[roundedview alloc] init]]; //get running application nsarray *runningapps = [[nsworkspace sharedworkspace] runningapplications]; //prepare test image view nsimage *image = [[runningapps objectatindex:9] icon]; nsimageview *img = [[nsimageview alloc] init]; [img setimage:image]; //display icon [[window contentview] addsubview:img]; it seems doing wrong, background displayed. help me on ? thanks in advance. gael. first of all, leaking objects: [window setcontentview:[[roundedview...

jquery - Update title of Dialog from the source of Iframe -

jquery - Update title of Dialog from the source of Iframe - i made dialog,iframe var $frm = $('<iframe />').attr('id','ifrmtv'), $dialog = $('<div />').dialog({ autoopen: false, width: 'auto', hight: 'auto' }); then after info processing set $frm source , show dialog like: $frm.attr('src', 'http/wmp.htm').appendto($dialog); $dialog.dialog({title: 'title'}).dialog('open'); i know if there way in wmp.htm code alter title of dialog. jquery_ui generate span class ui-dialog-title shouldn't accessible wmp.htm. help appreciated. the page http/wmp.htm loading within iframe should load jquery. not necessary, create consistent when looking ui-dialog-title element. note: read this lowercase , uppercase urls. now, within iframe, can access parent container using window.parent and, using jquery, access element $('selector', window.parent.document) . now...

java - Subsequence of a string -

java - Subsequence of a string - i have write programme takes string argument s , integer argument k , prints out subsequences of s of length k. illustration if have subsequence("abcd", 3); the output should be abc abd acd bcd i guidance. no code, please! thanks in advance. update: i thinking utilize pseudocode: start empty string append first letter string append sec letter append 3rd letter print so-far build substring - base of operations case homecoming sec letter append 4th letter print substring - base of operations case homecoming first letter append 3rd letter append 4th letter print substring - base of operations case homecoming 3rd letter append sec letter append 3rd letter append 4th letter print substring - base of operations case homecoming 3rd letter homecoming sec letter append 3rd letter append 4th letter homecoming 3rd letter homecoming 4th letter...

js & jQuery not being enabled with CKEditor -

js & jQuery not being enabled with CKEditor - i have been developed webpage enables drag & drop feature elements using js & jquery functions. it's working perfectly. used ckeditor , integrated web page unable drag & drop elements, why ? simple page: works , can drag & drop elements <html> <head> <link rel="stylesheet" href="jquery.ui.all.css"/> <script src=jquery.js"> </script> <script src="jquery_drag_drop.js"> </script> <head> <body> <div id="main_div_of_the_page"> <div id="element_1"> <input type="button" class="manage_to_all_properties_src"/> </div> <div id="element_2"> <input type="button" class="manage_to_all_properties_src"/> </div> </div> </body> </html> now integrating page ckeditor, (drag & drop...

objective c - iPhone: Do I need to implement all methods for UIScrollViewDelegate (or any delegate) -

objective c - iPhone: Do I need to implement all methods for UIScrollViewDelegate (or any delegate) - suppose create uiviewcontroller uiscrollviewdelegate. do need implement methods delegate, or can implement 1 care about? if cmd + click in xcode have declared implement protocol <uiscrollviewdelegate> xcode take header file protocol defined. here can see of methods uiscrollviewdelegate declared @optional hence can implement ones want. if prefer documentation apple marks required methods required method in tasks section. additionally compiler show warnings if conform protocol not implement required methods. iphone objective-c

assembly - how to make a 'backspace' program in C? -

assembly - how to make a 'backspace' program in C? - i creating library function print , scan using assembly language , c. when entering datas getting print,but problem when press backspace button cursor moving backwards(but not deleting anything)..i want backspace button work properly(ie,to delete previous character) so there programme that.please help me. the simple, albeit hackish, way write backspace characters ( \b ) console. for example: #include <stdio.h> int main() { printf("testing"); fflush(stdout); printf("\b\b\b"); fflush(stdout); homecoming 0; } but type of thing should handled terminal driver. don't mention operating scheme you're targeting in question. c assembly

create user defined function in sqlite android? -

create user defined function in sqlite android? - i developing 1 application need create sqlite function distance, have 2 fields latitude , longitude in database, , want find near locations using function, have developed application in iphone, have implemented functionality using sqlite3_create_function calling callback function, give me distance. but problem is: can not able create function in sqlite using android, know improve way nearby locations sqlite using android? the other problem sqlite not back upwards sin, cosine functions calculate distance between points. hello jignesh, in view, there 2 solutions problem. 1. utilize javascript perform functions create necessary functions in javascript , utilize result update/query sqlite. javascript suited trigonometry; sine, cosine , tangent. javascript can calculate advanced mathematical problems extremely fast. example: calculating reply next problem the sum of squares of first 10 natural numbers is...

Using grep to extract html from container tags -

Using grep to extract html from <div> container tags - i have page has many posts different authors. want posts user page of posts. how can set grep @ each post's html block in page author, print content of post file? post construction like <!--begin msg number #####--> [useless junk i'm not interested in here] <span class="author vcard"><a class="url fn" href='url here'>user a</a>&nbsp;</span> [more junk] <div class='post entry-content '> <!--cached-some date string--> here's text want extract </div> [more junk] <hr /> i think construction grep /pattern/ output file but need explicitly tell hunt between <!-- begin msg ... --> and <hr /> tags bound post, or grep smart plenty automatically? i'm worried when grep finds pattern of user a, print post contents file instead of partic...

sorting a table in descending order in Lua -

sorting a table in descending order in Lua - i can not work: tbl = { [1] = { ['etc2'] = 14477 }, [2] = { ['etc1'] = 1337 }, [3] = { ['etc3'] = 1336 }, [4] = { ['etc4'] = 1335 } } = 1, #tbl table.sort(tbl, function(a, b) homecoming a[i] > b[i] end) print(tbl[i] .. '==' .. #tbl) end getting error: effort compare 2 nil values this follow-on table value sorting in lua how this? tbl = { { 'etc3', 1336 }, { 'etc2', 14477 }, { 'etc4', 1335 }, { 'etc1', 1337 }, } table.sort(tbl, function(a, b) homecoming a[2] > b[2] end) k,v in ipairs(tbl) print(v[1], ' == ', v[2]) end organizing info way made easier sort, , note phone call table.sort once, not 1 time per element of table. , sort based on sec value in subtables, think wanted. sorting lua lua-table

Where in django docs i can find more info on "_Meta.get_field_by_name" -

Where in django docs i can find more info on "_Meta.get_field_by_name" - i want read more info function can utilize _meta .fields , get_field_by_name not find in django official docs. can give links on docs explain function avaiable _meta here's reason why not much documentation available in official docs: _meta named according python convention underscore denotes variable private attribute. so _meta (generally) django's internal uses , mechanics not guaranteed remain unchanged on time. consequently using not encouraged. nevertheless, here's relevant link first page google search: http://readthedocs.org/projects/django-model-_meta-reference/ django django-models documentation

os.path.exists not working properly on Python CLI -

os.path.exists not working properly on Python CLI - i've python 2.5.x on windows 7 machine. os.path.exists('c:') # returns true os.path.exists('c:\users') # returns true os.path.exists('c:\users\alpha') # returns false, when alpha user on machine i've given read/write permissions cli i'm using. possible reason ? inside quotes, '\' escapes next character; see reference on string literals. either double backslashes like: os.path.exists('c:\\users\\alpha') to escape backslashes themselves, utilize forwards slashes path separators michael suggests, or utilize "raw strings": os.path.exists(r'c:\users\alpha') the leading r cause python not treat backslashes escape characters. that's favorite solution dealing windows pathnames because still people expect them to. python python-module

javascript random flashing words -

javascript random flashing words - here's fun little script i'm trying make. flash words array random colors array. (i'm thinking having moving bg type deal.) i'm having problems creating sort of loop cause words "flash/change" far alter on page reload. *new* changed 1 function... , works!! seems uses browsers memory or , crashes.... oops... there clear memory or javascript should use?? <html> <head> <style> body { color:black; } #quotes { } </style> </head> <body> <script type="text/javascript"> function showquote() { pickwords = [ "hi!", "welcome!", "hello!" ] var word22 = pickwords[math.floor(math.random()*pickwords.length)]; pickcolors = [ "#aa2233", "#00cc44", "#f342aa" ] var color22 = pickcolors[math.floor(math.random()*pickcolors.length)]; var top22 = (math.floor(math.random()*800)); var le...

c - Two mains in program -

c - Two mains in program - here situation: need send info neighbor(socket) , switch listening mode. ive got client part in client.c , listens, , server part in server.c - sends data. using sockets need have main() in both of them. how should them "cooperate" together, both mains s not going result in error? or other ideas how solve issue sending , listening? thanks in advance! lucas you can create 2 executables sources. each of them have own main . or, can create single executable , allow fork process or create thread. when creating new thread you'll specify sec "main" thread function. when fork -ing, should create 2 functions main_server , main_client , allow actual main decide of them call, after fork . see snippet: int main_server(int argc, int argv){ //todo: finish homecoming 0; } int main_client(int argc, int argv){ //todo: finish homecoming 0; } int main(int argc, int argv){ //todo: parse args , argv_serv...

memory - ios app crashes when loading image from html string -

memory - ios app crashes when loading image from html string - in app in web view page trying load images html string. there around 27 images. app getting crashed , in error study says memorywarning2. how overcome problem....please help me friends you're loading many, big images memory @ 1 time. unless need web view, utilize uiimageview s in uiscrollview , handle memory usage yourself. if must utilize web view, maybe utilize smaller images. ios memory warnings

java - can't make http request on port other than 80 -

java - can't make http request on port other than 80 - my java programme hitting "http://url:port" kind of url fetch data. on local windows machine deployed on tomcat 6, working fine. on production linux machine having tomcat 6 on it, gives me connection timeout. ironically, if nail url without port number, bring me output not port. not finding clue, please help. the snippet of code using connect , fetch info is: httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget("59.162.167.36:80/api/…"); httpget.setheader("user-agent", "useragent: mozilla/5.0"); httpresponse response = httpclient.execute(httpget); httpentity entity = response.getentity(); one obvious possibility firewall in front end of production machine blocking access port. check firewall. java http url port

sql - PostgreSQL: trying to find miss and mister of the last month with highest rating -

sql - PostgreSQL: trying to find miss and mister of the last month with highest rating - at my drupal website users can rate each other , timestamped ratings stored in pref_rep table: # select id, nice, last_rated pref_rep nice=true order last_rated desc limit 7; id | nice | last_rated ------------------------+------+---------------------------- ok152565298368 | t | 2011-07-07 14:26:38.325716 ok452217781481 | t | 2011-07-07 14:26:10.831353 ok524802920494 | t | 2011-07-07 14:25:28.961652 ok348972427664 | t | 2011-07-07 14:25:17.214928 de11873 | t | 2011-07-07 14:25:05.303104 ok335285460379 | t | 2011-07-07 14:24:39.062652 ok353639875983 | t | 2011-07-07 14:23:33.811986 also maintain gender of each user in pref_users table: # select id, female pref_users limit 7; id | female ----------------+-------- ok351636836012 | f ok366097485338 | f ...

sql - Restrict database tree depth -

sql - Restrict database tree depth - typically when represent parent kid hierarchy have table follows (i might add together additional depth columns speed things up), parents , children both foreign key relationships rows same entity table. entity relationships composite pkey kid id parent id what trying figure out how limit depth of tree one. in other words, if parent of child, how prevent parent beingness kid in itself, impossible have grandparents or further? depending on rdbms, can handle in insert/update trigger. restricting parent not kid shouldn't bad (although hate using triggers more necessary). if trying limit number of levels (say 100) might start run performance issues. in ms sql server can utilize user-defined functions in constraints. there limits however, don't know if work here. i'll seek test though. edit: i tested on ms sql server 2008 , looks works correctly: create function dbo.is_child (@parent_id int) returns bit begin...

Minimal Java webserver with JSP support -

Minimal Java webserver with JSP support - what of smallest java webservers jsp support? looking how implement jsp back upwards using built-in code. or there no such thing? things out there, full-blown j2ee webservers? the purpose of getting of jsp component(s) can utilize them in our own webserver. take @ jetty: http://jetty.codehaus.org/jetty/ jetty used in wide variety of projects , products. jetty can embedded in devices, tools, frameworks, application servers, , clusters. see jetty powered page more uses of jetty. java jsp webserver

iphone - How to push a view from a web page? -

iphone - How to push a view from a web page? - suppose app load local web page stored in app bundle. want force view or nowadays view when user click link or image within web page. how this? let's create general question: how communicate app local web page? thank you. use "webview.request.url.absolutestring" request-string of clicked link in delegate-method "webviewdidfinishload:" or "webviewdidstartload:". can scan url special substring. for illustration create link ".../index.php?iphone_action=abcdef". in delegate-methods can check if link has substring "?iphone_action=" , if does, set part of link, whick follows "?iphone_action=" in nsstring. (in our illustration "abcdef"). depending on value of nsstring fire action in app. iphone objective-c

three20 - How to make the blue bar on the top disappear for tttableview with list datasource (program running on ios 5 beta) -

three20 - How to make the blue bar on the top disappear for tttableview with list datasource (program running on ios 5 beta) - there bluish bar appearing on top of tttableview when programme running on ios 5 beta, not there if run programme on ios 4.3. table configured utilize list datasource. know problem be? tableview api changed in someway ios 5? thanks. it caused subtle of import alter apple made in uitableview behavior section headers , footers. if implement tableview:viewforheaderinsection: or tableview:viewforfooterinsection: delegate methods must implement tableview:heightforheaderinsection: , tableview:heightforfooterinsection: delegate methods. the blank section header seeing caused returning 'nil' '...viewfor...' methods not returning 0 '...heightfor...' methods. three20

bluetooth - Commands for Tx Power, Rx Power and RSSI -

bluetooth - Commands for Tx Power, Rx Power and RSSI - i have looked far , wide, on bluez.org , android developer forum, http://developer.android.com/resources/community-groups.html have been unable find solution looking for. could please assist me find out commands modify values of tx power, , valued of received powerfulness (rx power) , rssi. much appreciate it. daud there no standard or public apis set transmit power, typically interface given bluetooth chip vendor via custom driver apis able set maximum transmit powerfulness of device. for rssi can value device discovery - in android action_found intent has android.bluetooth.device.extra.rssi can contain rssi remote device. bluetooth

java - Drawing to a SurfaceView in Android -

java - Drawing to a SurfaceView in Android - i'm trying very simple drawing surfaceview can't working. there no exceptions, don't see result either. more precisely, i'm trying create surfaceview , fill single colour. here goes code: public class svetlinsurfaceviewtestactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); surfacerenderer renderer = new surfacerenderer(this); setcontentview(renderer); } } class surfacerenderer extends viewgroup implements surfaceholder.callback { private final string tag = "svetlin surface renderer"; surfaceview msurfaceview; surfaceholder mholder; public surfacerenderer(context context) { super(context); msurfaceview = new surfaceview(context); addview(msurfaceview); // install surfaceholder.callback notified wh...

asp.net - is it possible to stop search engines indexing pages with certain querystring parameter -

asp.net - is it possible to stop search engines indexing pages with certain querystring parameter - i using asp.net datapager , noticed search engines wouldn't able crawl links created, added querystring parameter , see crawl links. the problem have eventially end multiple urls same page. is possible stop search engines indexing pages query string parameter such as: ?pg= so search engine follow these links not index: http://domain.co.uk/news/07-04-2011/bank-of-england-base-rate?pg=3 http://domain.co.uk/news/11-03-2011/client-feedback-from-employee-relocation?pg=6 but index: http://domain.co.uk/news/07-04-2011/bank-of-england-base-rate http://domain.co.uk/news/11-03-2011/client-feedback-from-employee-relocation thanks help j. i'm pretty sure can accomplish robots.txt with google can specify parameters want exclude webmaster tools. you trap useragent , crash page when it's bot ... asp.net vb.net indexing robots.txt datapager

c++ - how to use gsoap without installing it in ubuntu? -

c++ - how to use gsoap without installing it in ubuntu? - i working in c++ under ubuntu. there way using gsoap without installing it? i did install it. i've copied gsoap dependencies....and delete , seek see if it's working. what opinion? thx. appreciate gsoap compile-time tool, there's no runtime stuff leave installed. moment compiled c++ side wrappers library or exe, need ship files wrap access target language (python, java, whatever chose). you can safely uninstall gsoap , test. c++ ubuntu gsoap

spring - Slow java builds, I like to make small incremental changes and view the page in the browser -

spring - Slow java builds, I like to make small incremental changes and view the page in the browser - i have mbp i7 processor. i create little changes in code , view in browser, find building spring mvc app (using intellij) , pushing tomcat takes long time. is there can use jrebel. provides hot code swapping , integrates lot of major frameworks provide configuration reloading, too. it's simple set , use. offer 1-month trial, , can additional 3 months via special summer program. java spring spring-mvc

java - Characters not displayed in endElement() of SAX parser -

java - Characters not displayed in endElement() of SAX parser - i have received xml response server in format below.(response edited) 1. hello 2. world hello , world nowadays in separate lines within message tag. able display hello world in characters(). failed same in endelement(). how content in multiple lines within same tag in endelement() of sax parser. no, correct. characters() supposed getting hello , world, not endelement() . end element signals end of tag , characters gets in between tag. if want in endelements() 1.hello 2.world why not create variable top? instance. private string message = null; @override public void endelement(string uri, string localname, string qname) throws saxexception { system.out.println(message); //or whatever want message } @override public void characters(char ch[], int start, int length) throws saxexception { if(ismessage){ //ismessage set when run startelement , runs <message> block. ...

java - Apache Commons Email and Reusing SMTP Connections -

java - Apache Commons Email and Reusing SMTP Connections - currently using commons email send email messages, have not been able find way share smtp connections between emails sent. have code following: email email = new simpleemail(); email.setfrom("example@example.com"); email.addto("example@example.com"); email.setsubject("hello example"); email.setmsg("hello example"); email.setsmtpport(25); email.sethostname("localhost"); email.send(); which readable, slow when big amount of messages, believe overhead of reconnecting each message. profiled next code , have found using reusing transport makes things 3 times faster. properties props = new properties(); props.setproperty("mail.transport.protocol", "smtp"); session mailsession = session.getdefaultinstance(props, null); transport transport = mailsession.gettransport("smtp"); transport.con...

validation - How to replace field value in a Drupal Webform's validator? -

validation - How to replace field value in a Drupal Webform's validator? - in drupal webform, i'd alter submitted value (e.g. strip non-numeric character) when going through validator. i follow validator readme add together in hook_webform_validation_validators , implement hook_webform_validation_validate hook. cannot locate homecoming parameter alter submitted webform value. for example, if user enters $12,340 , i'd fail submission , update webform value 12340 .when user submits sec time, new value 12340 pass validator , saved. i don't think webform validation module allows alter submitted values. i've looked @ how implements validation , can similar in own module if want alter submitted value. the next code taken in part http://fleetthought.com/adding-additional-cck-validation-function-field-using-hookformalter , webform validation module code. function your_module_name_form_alter(&$form, &$form_state, $form_id) { if (strpo...

What kind of DB support does Infinispan offer? -

What kind of DB support does Infinispan offer? - i don't want utilize infinispan info source. kind of db back upwards offered? hibernate 2nd-level cache necessary? infinispan can configured persistent cache loader , amongst supported options, jdbc based cache stores supported. can find them, including jdbc one, in https://docs.jboss.org/author/display/ispn/cache+loaders+and+stores - there're sample configurations there too. infinispan

uiview - Push notification to view iPhone -

uiview - Push notification to view iPhone - i have got force notification working next thing want open relevant view when clicking on notification. in appdelegate.m in didfinishlaunchingwithoptions , have following: nsstring *params=[[launchoptions objectforkey:@"uiapplicationlaunchoptionsremotenotificationkey"] objectforkey:@"alerttype"]; if ([params length] > 0 ) {//app launch when view button of force notification clicked if (params == @"sc") { alerts *alerts = [[alerts alloc] initwithnibname:@"alerts" bundle:nil]; [[self navigationcontroller] pushviewcontroller:alerts animated:yes]; [alerts release]; } else { } } however, in line: [[self navigationcontroller] pushviewcontroller:alerts animated:yes]; , warning comes saying method '-navigationcontroller' not found (return type defaults 'id'). how can rectify warning , right in trying force relevant view in didfinis...

sql server 2008 - SQL - Multiple Table Joins -

sql server 2008 - SQL - Multiple Table Joins - hi maybe can help me here ... have slight problem sql statement. ( on ms - sql server 2008) have 6 tables looking this id / company / month / closedtimestamp / different info now need (preferrable in 1 statement :p) count of datasets each table grouped company , month @ time looks this. , there thing not tables need have info company , month there can 0 result count(*) select count(*) c, month, company table1 closedtimestamp null grouping company, month order company i can tables , pick out results each company ... if has thought appreciate :) sorry forgot ... result should this: company / month / counttable1 / counttable2 / counttable3 / ..... test 02 1 0 50 if it's not possible in 1 statement have create work way. :) thanks lim if db normalized query much simpler. because, company , month spread across 6 tables, need create union of tables in order...

Mobile Web Application Analytics Tools -

Mobile Web Application Analytics Tools - what analytics tools available mobile web similar "flurry" meant mobile native applications? piwik piwik open-source web analytics application developed using php , mysql. has "plugins" scheme allows utmost extensibility , customization. install plugins need or go overboard , install them – selection you. plugins system, can imagine, opens possibilities create own custom extensions. thing’s lightweight – download’s 1.9mb. firestats firestats simple , straight-forward web analytics application written in php/mysql. supports numerous platforms , set-ups including c# sites, django sites, drupal, joomla!, wordpress, , several others. resourceful developer needs moar cowbell? firestats has excellent api assist in creating own custom apps or publishing platform components (imagine: displaying top 10 downloaded files in wordpress site) based on firestats data. snoop snoop desktop-based application runs ...

Firewall and FTP Directory Listing in C# -

Firewall and FTP Directory Listing in C# - i trying directory listing of ftp site having issues connecting , retrieving listing. believe problem windows firewall windows 2008 server r2. here code: seek { // object used communicate server. ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://127.0.0.1"); request.method = webrequestmethods.ftp.listdirectorydetails; request.usepassive = false; // illustration assumes ftp site uses anonymous logon. request.credentials = new networkcredential("user", "pass"); request.proxy = httpwebrequest.defaultwebproxy; ftpwebresponse response = (ftpwebresponse)request.getresponse(); stream responsestream = response.getresponsestream(); streamreader reader = new streamreader(responsestream); label1.text = reader.readtoend(); reader.close(); ...

what's the keycode for power off button on blackberry -

what's the keycode for power off button on blackberry - i want close background thread when user click powerfulness off button. main screen disappear when button clicked later browser screen appear. how stop ui background thread . and what's keycode powerfulness off button on blackberry.? pls reply me... try utilize (char) keypad.key_end keycode grab powerfulness off button click. in thread can utilize boolean iscancelled flag while , if in thread code interrupt setting true value. see using threads in j2me applications. remember clean thread connections blackberry

html - Lazarus/Pascal: how do I show web content within a form -

html - Lazarus/Pascal: how do I show web content within a form - i'm planning on building application simplifies web design. intent using lazarus/freepascal this. my question is, how show html content on lazarus form appear on browser? thanks! since fpc cross-platform not know in advance webbrowser user have installed cannot embed twebbroser. there controls available embed specific engine gecko or webkit. read on wiki: http://wiki.freepascal.org/webbrowser , in lastly part of page. html forms browser webforms lazarus

c++ - Can makefile.am set LDADD for a set of target? -

c++ - Can makefile.am set LDADD for a set of target? - i placed unit tests within same directory of source code. how set ldadd in makefile.am these unit tests utilize specific libraries (e.g google test)? the contents of ldadd used target unless variable overridden target_ldadd . if have many unit tests, , few actual programs, may utilize ldadd unit tests , override each programme different linking requirements. ldadd = libtest.a # used default targets # unit tests, using above ldadd check_programs = 1 2 3 one_sources = one.c two_sources = two.c three_sources = three.c # main programme bin_programs = main main_sources = main.c main_ldadd = # override ldadd setting. a similar illustration can found in the documentation of ldadd . c++ unit-testing automake googletest

dom - Is it safe to modify the document Object in javascript? -

dom - Is it safe to modify the document Object in javascript? - i'm wondering if can modify document object this, guarantee existence of document.getelementsbyclassname(), or if there limitation on modifying document in browsers: if(typeof document.getelementsbyclassname !== 'function') document.getelementsbyclassname = function(class_name){ // custom function }; yes, can. document object behaves every other object in javascript, it's extensible. javascript dom object

html - One div seems to be swallowed up by another -

html - One div seems to be swallowed up by another - i have page: http://www.comehike.com/outdoors/birds/birds.php the left side (on middle) has list of birds. reason, web page renders half of bird list. if view-source, see entire bird list. if @ page in firebug, shows spacing of divs expected it, reason, top part of list of birds doesn't appear. any thought why happening? thanks! you're missing quote @ end of style declaration parent div. <div bird.php?bird_id="10501"" birds="" outdoors="" www.comehike.com="" http:="" style="width: 275px; float: left;> needs be <div bird.php?bird_id="10501" birds="" outdoors="" www.comehike.com="" http:="" style="width: 275px; float: left;"> html css firebug styling

xcode - Memory leaking problem in iphone app -

xcode - Memory leaking problem in iphone app - i created 1 method below one: + (jsonmanager *)getinstance { if (!instance) { instance = [[jsonmanager alloc] init]; } homecoming instance; } and need utilize same method in different view...if release 1 first view working fine , if trying navigate sec view app crashing. can 1 please allow me know need release object thanks in advance this appears singleton. should not releasing in first view. want utilize same instance throughout lifetime of application. if not requirement, should provide mechanism set instance variable nil pointing deallocated object 1 time release it. think not case. iphone xcode memory-leaks

Python datetime format mask -

Python datetime format mask - i have next datetime format parse datetime object in python: wed, 13 jul 2011 09:11:14 +0200 what format mask should utilize +0200 part? means +2 hours. the thing can't find man page on net datetime format masks. it depends fro mean "parsing". should happen timezone information? if intend purely discard it, can instantiate naïve datetime object suggested fredrik in answer. if intend retain info must create aware datetime object setting tzinfo attribute of datetime instance. this relevant documentation. hth! python

c# - Connect to SqlServer with socket programming -

c# - Connect to SqlServer with socket programming - i'd know if socket programming can connect me sql server , execute procedures, homecoming resultsets , ...., in other words how how can develop own ado.net?? prefer solution c++ or c#.net stuff. for academic exercise kind of work tds protocol described @ tabular info stream protocol specification , there free implementation @ freetds. have real motive re-invent wheel? c# c++ sql-server database ado.net

wpf - CompositionTarget.TransformToDevice contains unexpected matrix values, but why? -

wpf - CompositionTarget.TransformToDevice contains unexpected matrix values, but why? - i'm using pixellab's bot (bag o' tricks) reorderlistbox control, i've noticed major slowdowns on mousedown of list item. i've tracked downwards way command creates dragpreviewadorner , getcurrentdpi method, implemented as: matrix m = presentationsource.fromvisual(visual) .compositiontarget .transformtodevice; x = 96 / m.m11; y = 96 / m.m22; thing is, list items, m11 , m22 coming tiny numbers, thereby giving big dpi (x = 100000, , y = 5500). consequently, calling code ends creating enormous in-memory bitmap, in turn causes delay when garbage collected. my question is: might causing these seemingly erroneous values in transform? looks fine on-screen. :-/ thanks. wpf dpi

c# - What Is the appropriate way to report progress to a WPF view from a TPL task? -

c# - What Is the appropriate way to report progress to a WPF view from a TPL task? - i trying read big number of rows database in little "chunks" or pages , study progress user; i.e., if i'm loading 100 "chunks" study progress each chunk loaded. i using tpl in c# 4.0 read these chunks database , hand off total result set task can utilize it. sense tpl gives me improve command on task cancellation , hand off backgroundworker, etc., there doesn't seem built in way study progress of task. here solution i've implemented study progress wpf progress bar , want create sure appropriate , there's not improve approach should taking. i started creating simple interface represent changing progress: public interface inotifyprogresschanged { int maximum { get; set; } int progress { get; set; } bool isindeterminate { get; set; } } these properties can bound progressbar in wpf view , interface implemented backing viewmodel respons...

Preview Excel, Word, PDF in Web browser -

Preview Excel, Word, PDF in Web browser - except google docs there technology allow me provide preview excel, word, pdf within browser without having download & installing new (of course of study excpect have @ to the lowest degree porgrams running on computer) you can save files html in word/excel. pretty sure acrobat lets pdf too. automate process using vba office docs. excel pdf ms-word preview

jquery - Best Approach For Updating Page from php -

jquery - Best Approach For Updating Page from php - i have script processes 100 rows of info within foreach loop. have page has submit button , script iterates append info row div on page- giving feedback user. it's different of examples im seeing online in php script posting multiple times instead once. input due nature of http, best bet might utilize ajax. my thoughts send ajax request script, , 1 time script done , sends response, parse response , set div. php jquery asynchronous

design - What is the purpose of the "Most Recent" tab in an iOS application? -

design - What is the purpose of the "Most Recent" tab in an iOS application? - what should "most recent" tab in ios application contain? ios human interface guidelines document says: show recent item i have next questions: does mean view should contain single item, not collection of items? if so, element depicting more recent items? example, if had news reader , tab containing latest news, tab icon appropriate list of latest news? i think acceptable have collection of items, not 1 item. for latest news, utilize kind of clock, or antenna broadcasting news, or maybe thunder... creative. have @ usa today iphone app - has globe icon. ios design user-interface guidelines

How stop resizing...?with Javascript -

How stop resizing...?with Javascript - how stop resizing... resizable=no doesnt work help me guys! window.open('http://www.artechin.com/emre/puanhesap.html', 'puan', 'toolbar=0,status=0,width=500,height=423,resizable=no'); they stopped firefox 3 - have been security problems, thought nowadays not hide url. javascript

How do I create a new data frame based on a table I generated by R? -

How do I create a new data frame based on a table I generated by R? - i csv file thousands of rows , few columns. please see next illustration of file like: subject duration 1.3 b 6.7 c 3.2 2.5 d 2.7 e 99 f 8.4 g 12.5 h 19.7 z 3.2 56 b 9.4 . . . . . . please notice same subject, duration might vary. want add together duration each particular subject, example, want know total duration subject a, total duration subject b, etc. have many subject titles cannot manually type every single subject , inquire answer. want find out sum of duration each subject, , create new info frame or new file have subject name corresponding total duration. thank much in advance!!!!!! here's base of operations version might work. borrowed i...

gps - How to check if iPhone's current location is within a specific region with mapkit -

gps - How to check if iPhone's current location is within a specific region with mapkit - in ios app, mapkit object displays user's current location , zooms in on it. i set code if statement happen when user within specified geographic part (a specific country, city etc). any help hugely appreciated. thanks, roy some resources found useful. cllocationmanager class reference clregion class reference core location part monitoring iphone gps mapkit

java - Identify library file/Source that contains native method implementation -

java - Identify library file/Source that contains native method implementation - how identify library file contains implementation of native methods ? ex. public native string intern(); where can find implementation (source code) of string.intern() method ? found reply string.intern() quick google search constant pool symbol table cpp : symbol table hpp yet find reply generic way identify native implementation/library java implementation native native-code

php - Creating a Form for a Competition that can only be submitted once per user -

php - Creating a Form for a Competition that can only be submitted once per user - i've create facebook app 1 time user has liked page sent reveal page contains entry form competition, is there method create user can submit form once? is there method create user can submit form once? i think first need authenticate user(facebook you?). assume using like below: <?php $app_id = "your_app_id"; $canvas_page = "your_canvas_page_url"; $auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page); $signed_request = $_request["signed_request"]; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); if (empty($data["user_id"])) { echo("<script> top.location.hre...

Finding a Primary Key Constraint on the fly in SQL Server 2005 -

Finding a Primary Key Constraint on the fly in SQL Server 2005 - i have next sql: alter table dbo.ps_uservariables drop constraint pk_ps_uservariables; alter table dbo.ps_uservariables add together primary key (varnumber, subjectid, userid, datasetid, listid, uservartitle); since have multiple environments, pk_ps_uservariables constraint name different on different databases. how write script gets name adds script? while typical best practice explicitly name constraints, can them dynamically catalog views: declare @table nvarchar(512), @sql nvarchar(max); select @table = n'dbo.ps_uservariables'; select @sql = 'alter table ' + @table + ' drop constraint ' + name + ';' sys.key_constraints [type] = 'pk' , [parent_object_id] = object_id(@table); exec sp_executesql @sql; alter table dbo.ps_uservariables add together constraint ... sql sql-server sql-server-2005 primary-key

visual studio 2010 - How to get IVsBuildableProjectCfg to subscribe to build events? -

visual studio 2010 - How to get IVsBuildableProjectCfg to subscribe to build events? - i trying instance of ivsbuildableprojectcfg object, have no clue how it. i can dte project and/or ivshierarchy object representing each active project without problem. how instance of ivsbuildableprojectcfg per project? ideally, want hook build event of each project know whether or not each build successful, hooking solution see if overall build fired. (i tried using dte2.buildevents , handler never fire when ran debugger.) thanks! here's how can active ivsbuildableprojectcfg given ivshierarchy phone call pphierarchy below: ivssolutionbuildmanager buildmanager = (ivssolutionbuildmanager)getservice(typeof(svssolutionbuildmanager)); ivsprojectcfg[] ppivsprojectcfg = new ivsprojectcfg[1]; buildmanager.findactiveprojectcfg(intptr.zero, intptr.zero, pphierarchy, ppivsprojectcfg); ivsbuildableprojectcfg ppivsbuildableprojectcfg; ppivsprojectcfg[0].ge...

c# - How can I access a "private virtual" property starting with Underscore through Reflection -

c# - How can I access a "private virtual" property starting with Underscore through Reflection - i trying access next property using reflection because don't have original source code (suppose decompiled through reflector). seems special beingness "private virtual" or maybe because has "_" in origin of property. can access other private properties no problem except one. can't figure out doing wrong: private virtual string _myproperty { { homecoming this.__myproperty; } [methodimpl(methodimploptions.synchronized)] set { this.__myproperty = "blah"; } } i tried access using reflection following: reflectionhelper.getpropertyvalue(<class of above property>, "_myproperty") using next method in reflectionhelper class: public shared function getpropertyvalue(byval obj object, byval prop string) object dim objecttype type = obj.gettype() ...

exception - why Java throws a NumberFormatException -

exception - why Java throws a NumberFormatException - i got exception while parsing string byte string str ="9b7d2c34a366bf890c730641e6cecf6f"; string [] st=str.split("(?<=\\g.{2})"); byte[]bytes = new byte[st.length]; (int = 0; <st.length; i++) { bytes[i] = byte.parsebyte(st[i],16); } that's because default parse method expects number in decimal format, parse hexadecimal number, utilize parse: byte.parsebyte(st[i], 16); where 16 base of operations parsing. as comment, right. maximum value of byte 0x7f. can parse int , perform binary , operation 0xff lsb, byte: bytes[i] = integer.parseint(st[i], 16) & 0xff; java exception numberformatexception

mysql results error on php -

mysql results error on php - hello below code query submit from.. no of rows correctly count , show in page , result rows not show in page , show "no results found, please search again", cant find error on code, can help find it.. <? ### debug $debugp = 0 ; ### end debug include 'db_connector.php'; require_once('myfunctions.php'); include('header.php'); #defauts $maxrows_p = 10; $pagenum_p = 0; if (isset($_get['pagenum_p'])) { $pagenum_p = $_get['pagenum_p']; } $startrow_p = $pagenum_p * $maxrows_p; $limit = ' limit '.$startrow_p.', '.$maxrows_p; ## start building sql varables advanced search ###add city if(isset($_request['city']) && ($_request['city'] != '')) $search[] = ' city = "'.$_request['city'].'"'; ###add state if(isset...

jquery - Animate scroll to ID on page load -

jquery - Animate scroll to ID on page load - im tring animate scroll particular id on page load. have done lots of research , came across this: $("html, body").animate({ scrolltop: $('#title1').height() }, 1000); but seems start id , animate top of page? the html (which half way downwards page) simply: <h2 id="title1">title here</h2> any suggestions? adi you scrolling height of element. offset() returns coordinates of element relative document, , top param give element's distance in pixels along y-axis: $("html, body").animate({ scrolltop: $('#title1').offset().top }, 1000); and can add together delay it: $("html, body").delay(2000).animate({scrolltop: $('#title1').offset().top }, 2000); jquery scroll jquery-animate

c# - Conversion of a Varchar Datatype to a datetime resultant in an out of range -

c# - Conversion of a Varchar Datatype to a datetime resultant in an out of range - i have problem. can' identify mistake... int dt = convert.toint32(items.rows[t1]["f14"].tostring().trim()); int mn = convert.toint32(items.rows[t1]["f15"].tostring().trim()); int yr = convert.toint32(items.rows[t1]["f16"].tostring().trim()); string dtstring = mn.tostring().trim() + "/" + dt.tostring().trim() + "/" + yr.tostring().trim(); datetime regexp = convert.todatetime(dtstring); exp_date datetime field in sqlserver. string mydtqry = "update mytable set exp_date='" + regexp + "' mytable.id_no='" + almidno + "'"; but i'am getting error: conversion of varchar datatype datetime resultant in out of range well, approach task differently: after getting day, month , year integers wouldn't stick them , parse them. use: // note meaningful variable names here, btw... date...

jquery - Get Ajax GET request parameters on my aspx page -

jquery - Get Ajax GET request parameters on my aspx page - i sending checkbox value 1 asp page another. i using jquery create ajax request: $.ajax({ url: 'http:myurl.aspx', type: 'get', data: datatobedeleted, success: function () { alert('yay') }, error: function () { alert("data not deleted"); } }); how values in myurl.aspx page? tried request.querystring["data"] , request.querystring["datatobedeleted"] both gives no data. am doing incorrectly? it depends on construction of datatobedeleted parameter. for example, if have: datatobedeleted = {"id1": "10", "id2": "20"}; //object format or datatobedeleted = "id1=10&id2=20"; //string format then read in server this: string id1 = request.querystring["id1"].tostring(); string id2 = request.querystring["id2"].tostring(); hope helps. cheers jqu...

How could i use javascript (probably jQuery) on a hyperlink to slide and fade the page away before moving on to the page the user clicked? -

How could i use javascript (probably jQuery) on a hyperlink to slide and fade the page away before moving on to the page the user clicked? - if have link on page, want link (and if can done through css or something, links) create entire body slide off left fades white. also, of pages these links go designed else don't have clue how do: fade white, , slide on right. help appreciated! this great tutorial: http://www.onextrapixel.com/2010/02/23/how-to-use-jquery-to-make-slick-page-transitions/ javascript jquery html

DirectShow RGB-YUV filter -

DirectShow RGB-YUV filter - i encode video in app vp8. utilize rgb24 format in app vp8 directshow filter accepts yuv format (http://www.webmproject.org/tools/#directshow_filters). i've googled "rgb yuv directshow filter" no success. don't want write filter myself scratch, appreciate if help me info on find such filter. thanks! you seek geraint davies' yuv transform filter see if supports conversion. directshow rgb yuv vp8

ruby on rails - i18n for select boxes -

ruby on rails - i18n for select boxes - i have model named role. , using helper below in form. there way alter value of name attribute language? <%= f.collection_select :role_id, role.all, :id, name, {} -%> locales/de.yml de: role: admin: "something" editor: "something something" in model: class role < activerecord::base def translated_name i18n.t(name, :scope => 'role') end end in view: <%= f.collection_select :role_id, role.all, :id, :translated_name -%> ruby-on-rails internationalization rails-i18n

SAXNotRecognizedException while using gdata api's for youtube integrating in android? -

SAXNotRecognizedException while using gdata api's for youtube integrating in android? - i integrating youtube in android app. using gdata youtube library same. ` youtubemanager ym = new youtubemanager(clientid); list<youtubevideo> videos; seek { videos = ym.retrievevideos(textquery, maxresults, filter, timeout); (youtubevideo youtubevideo : videos) { system.out.println(youtubevideo.getwebplayerurl()); system.out.println("thumbnails"); (string thumbnail : youtubevideo.getthumbnails()) { system.out.println("\t" + thumbnail); } system.out.println(youtubevideo.getembeddedwebplayerurl()); system.out.println("************************************"); } } grab (exception e) { // todo auto-generated grab block e.printstacktrace(); } ` i have imported jar's under, activation.jar apache-...

graphics - Android Overlay a portion of bitmap on top of another using a clipping path (or any other method) -

graphics - Android Overlay a portion of bitmap on top of another using a clipping path (or any other method) - android 2.1 or greater suppose have 2 images same size, 1 donut shape transparency in middle , outside donut. the other square image same size donut if overlayed (the donut not visible since square on top of z stack) what create clipping path or method display portion of square bitmap falls within donut using starting , stopping angle (which alter on time) so instance show portion of bluish square within donut starting @ 0 degrees , ending @ 40 degrees, 180 , 270 degrees. produce this. not sure start, have ideas? haven't tried myself clippath(path path) might looking for. hard part setup right path clipping with. android graphics path 2d clipping

Nonsequential Ruby Error Output in Netbeans Console -

Nonsequential Ruby Error Output in Netbeans Console - i'm trying started using netbeans 7.0 rails development, , using latest ruby plugin. record switched default 1.8.7 interpreter point local 1.9.2 ruby installation, issue seems happen both interpreters. when ruby encounters error in code, error output shown @ random points in console output. have expected print error encountered, looks error stream , normal output stream beingness updated on different threads. give example...with code: (0..10).each { |o| puts "normal output" } invalidsytax! i triggering syntax error on sec line, error output can vary. example: normal output normal output normal output ~/learnruby/lib/ch1_ex2.rb:41:in `<main>': undefined method `invalidsytax!' main:object (nomethoderror) normal output normal output normal output normal output normal output normal output normal output normal output and... ~/learnruby/lib/ch1_ex2.rb:41:in `<main>': undefined ...