Posts

Showing posts from January, 2012

objective c - UitextField resignFirstResponder does not work in scroll view -

i have 2 functions resignfirstresponder neither of them works when textfields in scrollview my functions: -(bool)textfieldshouldreturn:(uitextfield *)thetextfield { if (thetextfield == textfield1) { [textfield1 resignfirstresponder]; } if (thetextfield == textfield2) { [textfield2 resignfirstresponder]; } if (thetextfield == textfield3) { [textfield3 resignfirstresponder]; } return yes; } - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; [textfield1 resignfirstresponder]; [textfield2 resignfirstresponder]; [textfield3 resignfirstresponder]; } i have linked scroll view in ib, can not find out why not works there when click outside of scrollview.so responds view, why?i thougth [[event alltouches] anyobject] respond alltouches @ anyobjects thanks help wouldn't bit more elegant add transparent view inherits uicontrol s

c# - Cannot invalidate in loops? -

i have following code: for(int i=0;i<10;i++) { graphics.drawimage(image, i*20,50); invalidate(); } but redrawns after loop. why? edit: making simple movement , wants update after each step. because invalidate not repaint immediately, tells repaint needed. when method completed, , program idle again, repaint performed. the quick , dirty solution add application.doevents() after invalidate call, suggest rewriting logic use timer or similar instead of using loop animate.

objective c - Caching data on the iphone. Max size of stored data -

i discussing requirements of app , little lost few things. 1) getting data web server via json. user wants data cached month there no unnecessary data usage. concern data base on webserver 300mb in size. if user active mean there lot of data cached on phone. there limit amount of storage can use? 50mb of cached data realistic store? 2) if store data, best way handle it? since need able search , manage data device. realistic request client, or iphone not suited kind of operation. best not cache data @ , pull down json required. many thanks, -code you can use coredata framework sqlite storage. according accepted answer this question , there no specific limit how data can store other device's flash storage size.

java - Does Spring support PersistenceContextType.EXTENDED? -

a @stateful ejb can use persistencecontexttype.extended reusing same entitymanager across multiple transactions. useful in implementing conversational scopes. spring have support this? there short discussion of in implementing daos based on plain jpa : the @persistencecontext annotation has optional attribute type, defaults persistencecontexttype.transaction . default need receive shared entitymanager proxy. alternative, persistencecontexttype.extended , different affair: results in so-called extended entitymanager , not thread-safe , hence must not used in concurrently accessed component such spring-managed singleton bean. extended entitymanagers supposed used in stateful components that, example, reside in session, lifecycle of entitymanager not tied current transaction rather being application. so no, doesn't sound spring supports them.

c# - Do I need to worry about Process in foreach loop -

here piece of code, run through process , when finds right process, code sends message. question happened 'proc', how dispose process. //get other (possible) running instances process[] processes = process.getprocesses(); foreach (process proc in processes) { if (proc.processname.tolower() == processname.tolower()) { sendmessage(proc.mainwindowhandle, (uint)message, intptr.zero, intptr.zero); } } thanks in advance, harsha in general terms don't need worry disposing or deallocating objects, unless object implements idisposable interface. if should either call dispose() method on manually when you're finished, or wrap using statement have called automatically: using (var disposableobject = new disposabletype()) { // work disposableobject }

qt - read a text file to QStringList -

i have text file. need read qstringlist. there no line seperators. mean each line in text file in new line. there anyway can this? i assume every line should separate string in list. use qtextstream::readline() in cycle , on each step append returned value qstringlist. this: qstringlist stringlist; qfile textfile; //... (open file reading, etc.) qtextstream textstream(&textfile); while (true) { qstring line = textstream.readline(); if (line.isnull()) break; else stringlist.append(line); }

c# - How to export movie from Powerpoint 2010? -

how export embedded video powerpoint 2010 external file programmatically using ms office pia (primary interop assemblies) or other ways? embedding video in presentation new feature in powerpoint 2010 , can't find solution this. pptx files compressed archives. embedded video should stored within somewhere, possibly under media folder i'm not sure. you can use dotnetzip extract media , save like. note means don't need use pias @ preferable if you're doing on server instance.

blackberry - How can use same listfield for displaying elements,and new elements will getwhenuser click on existing listfield elements -

in app, displaying listfield indefinte no of elements(the elements gets json returned webserver). first app displays elements(item 1,item2,..),and user click in 1 of them.the same listfield object reloaded new elements. since there variable no of elements switch-case in navigationclick willn't work.if 1 have idea please help. the magic of list field lies on vector or array of object use represent each row. < p.s. expect understand , have pretty hands on experience on drawlistrow() method> suppose have list level 1. show title(string) , subtitle(string). , on click of each item have list renders same data (again title , subtitle) , n levels rendering same. if situation can 1 thing, change collection of list everytime. i.e. if use array, change contents of array. if use vector change vector. if rendering of list row changes have 2 options, 1. can handle flags in same drawlistrow() method or you have write new class , new drawlistrow() method

Streaming large amounts of data from sql server to an Excel file via c# web service -

so i'm trying results stored proc (200k rows+) excel file asp.net having few difficulties. don't think csv option client want numbers formatted correctly. i've tried 3 third party excel libraries have fallen on data , using gigabytes of memory. i've wrote code generate excel xml file , runs file on 300megs. if open , save native excel file gets down 30megs. @ moment best solution zip xml file on server gets down 7megs user still going end huge file once unzipped. ideally i'd find third party excel library can write native excel file 200,000+ rows without killing server, ideas? here's quick poc made writes 3 columns of 255 characters 200,000 times (600,000 cells). final file comes in @ 4.85mb on machine. string exportfile = system.io.path.combine(environment.getfolderpath(environment.specialfolder.desktop), "test.xlsx"); string dsn = string.format("provider=microsoft.ace.oledb.12.0;data source={0};extended pro

what is a HTTP response code variant in Panels 3 Drupal -

dear friends.i using panels 3 in drupal 6.2. while creating page panel option variant type can either select panel or http response code. query http response code option for.i tried add panel using option nothing seems working.please me. thanks , regars creating page variant using http response code allows redirect display intended path 404 page not found, 403 access denied, or 301 redirect. use first 2 keep user accessing specific site display page or redirect them page choose. if not working, check defined path page definition, position of variant in list (panels display first variant meets criteria), or contexts applying page

themes - Multiple alternate stylesheets -

suppose site configurable, , has few orthogonal settings controlled alternate stylesheets. example, main menu can @ top or on left, , background colour can red or blue. is there way define multiple sets of alternate stylesheets can replace 'theme' each set? i'm looking this: <link rel="stylesheet" set="background" title="red" /> <link rel="alternate stylesheet" set="background" title="blue" /> <link rel="stylesheet" set="main-menu" title="left" /> <link rel="alternate stylesheet" set="main-menu" title="top" /> no can't that. 3 ways are: have set of sheets on server, , serve correct one use inline css combination of both. load unchangable classes in external css, use inline style sheet set customisable values.

Phishing And CSS position:absolute -

how css position:absolute rule helps phishing? can me out, i'm confused :( look section called "overriding page content" here . it's not absolute positioning "helps" phishing, not more cars "help" drunk driving. tool can used malicious purposes. for example, you're running website users can login , post comments. don't sanitize input , output , user determines can post pure html content heart's content. decides craft post includes absolute-positioned div mimics login form identically , positioned on top of it, obscuring form. new form posts login credentials his site instead of yours, , redirects users page. the users, not suspecting has changed, enter login credentials. they're presented same page again. maybe try again, maybe click on "forgot password," maybe give up, etc. either way, has login credentials. did of users register on site same credentials use login email? employer? bank?

c++ - linking error for libs in VC++ -

in project exist 2 sub project. main project shopgui other ones 'connection' , 'log' build @ first log.lib file log project add connection project , build connection.lib then try use connection in main project(shopgui) have linking error. error said in connection.lib(client.obj) : error lnk2019: unresolved external symbol "public: void __thiscall log::print....." thanks herzl libraries don't link in dependent libraries. you'll need link shopgui both sub project libraries.

Automated Testing in Apache Hive -

i embark on project using apache hadoop/hive involve collection of hive query scripts produce data feeds various down stream applications. these scripts seem ideal candidates unit testing - represent fulfillment of api contract between data store , client applications, , such, it's trivial write expected results should given set of starting data. issue how run these tests. if working sql queries, use sqllite or derby bring test databases, load test data , run collection of query tests against them. unfortunately, unaware of such tools hive. @ moment, best thought have test framework bring hadoop local instance , run hive against that, i've never done before , i'm not sure work, or right path. also, i'm not interested in pedantic discussion if doing unit testing or integration testing - need able prove code works. hive has special standalone mode, design testing purposes. in case can run without hadoop. think need. there link documentation: http:/

asp.net - PopupControlExtender -

i trying add new asp.net page existing asp.net website contain scriptmanager. on asp.net page using "popupcontrolextender". when try run website shows me error "use toolkitscriptmanager instead of scriptmanager". is way use scriptmanager instead of toolkitmanager or thier effect on ready existing pages after using toolkitscriptmanager instead of scriptmanager? the toolkitmanager inherits scriptmanager. using scriptmanager work toolkitmanager. can read more here: http://blog.turlov.com/2008/05/scriptmanager-vs-toolkitscriptmanager.html

COCOA NSString indexOf? -

i have nsstring *url need know if string @"iframe" in nsstring url , use in if can handle things differently i example if statment try nsrange range = [url rangeofstring: @"iframe"]; if (range.location == nsnotfound) ...

vba - In excel, want to only sum certain values(not as easy as SUMIF)? -

so have 2 columns on named program , 1 cost values. 3 programs abc, a, b, , c. want sum costs of programs contain a. contain b. , contain c. abc included in sums. problem these programs spreadsheet has filter on messes sumif up. can help? here example of mean: program cost 5.00 b 4.00 abc 9.00 2.00 so want in 3 separate cells "sum a"=16.00, "sum b"=13.00, "sum c"=9.00. item | total | 16 b | 13 c | 9 assuming above range in a1:b5, first formula following array formula: {=sum(if(iserror(find(b6,$a$1:$a$5)),0,$b$1:$b$5))} you create array formula entering formula , holding down ctrl+shift keys while hit enter. in solution, i've created area calculate totals , have column (called item in case) indicates letter see in original column. if trying enter using vba, use formulaarray property: selection.formulaarray ="sum(if(iserror(find(b6,$a$1:$a$5)),0,$b$1:$b$5))" up

MySQL names resolution order in query -

i switched in app sqlite mysql i have nested queries (the number variable it's useful me keeping same names) this: select date_format(datetime, '%y-%m-%d %h:00:00') datetime ( select datetime (...) t ) t group datetime in sqlite group datetime evaulated on formatted date grouping takes place while in mysql plain passed datetime used have no grouping. to better explain works in mysql brakes cycle having rename columns and/or tables as @ each loop: select date_format(datetime, '%y-%m-%d %h:00:00') new_datetime ( select datetime (...) t ) t group new_datetime so, there way make mysql group datetime want? if want group formatted datetime, pass group clause: group date_format(datetime, '%y-%m-%d %h:00:00') this avoid multiple rows on different minutes/seconds. to avoid calling date_format twice, can use like: select @dtm := date_format(datetime, '%y-%m-%d %h:00:00') datetime tablename t group @dtm

github Fork question -

if have forked project , started work on it, fork belong me or belong owner of original source ? also if code pretty has gone being procedural oo aswell going sqllite mysqli can create own project , use code ? it belongs you, can whatever want.

byte - Help needed with reading data from server in java -

i having bit of trouble datainputstreams, so have data coming local server, know bytes read in follow format 0x01 specify string then random amount of bytes followed trailing 0x00 0x00, i having trouble reading server though, here method reading public static string convertfromserver(datainputstream dis) throws ioexception{ //buffer hold bytes being read in bytearrayoutputstream buf = new bytearrayoutputstream(); if(dis.read() != -1){ //check see if first byte == 0x01 if(dis.read() == 0x01){ //check if byte dosnt equal 0x00, need check if 0x00 0x00 while(dis.read() != 0x00){ buf.write(dis.read()); } } if(dis.read() == 0x03){ while(dis.read() != 0x00){ buf.write(dis.read()); } } } string messagerecevied = new string(buf.tobytearray()); return messagerecevied; } if little ambiguous let me know. i getting data , not correct, send across byte ar

Can you pass a LINQ table to a function? -

i want send linq table (entity) parameter function value in select{}. purpose return value based on several properties of table/entity, , don't want of logic determines return value in linq statement. basically, line 'value = getvalue(tbl)' possible? public class myclass { public int value { get; set; } } //some general function determine return value multiple properties private int getvalue(myentity cls) { if (cls.var1 == 1) return var2; if (cls.var1 == 2) return cls.var2 - cls.var3; return -1; } public list<myclass> getstuff(int itype) { list<myclass> myclass = (from tbl in context.myentity tbl.mytype == itype select new myclass { value = getvalue(tbl) }).tolist<myclass>(); return myclass; } linq entities designed convert entire linq query equiv

php - CakePHP changing virtual fields at runtime -

i have product model multi site application. depending on domain(site) want load different data. for example instead of having name , description fields in database have posh_name, cheap_name, posh_description, , cheap_description. if set this: class product extends appmodel { var $virtualfields = array( 'name' => 'posh_name', 'description' => 'posh_description' ); } then works, whether accessed directly model or via association. but need virtual fields different depending on domain. first creating 2 sets: var $poshvirtualfields = array( 'name' => 'posh_name', 'description' => 'posh_description' ); var $cheapvirtualfields = array( 'name' => 'cheap_name', 'description' => 'cheap_description' ); so these 2 sets, how assign correct 1 based on domain? have global function called ischeap() lets me know if on lower

jQuery UI weirdness -

i'm new jquery keen learn. because of i'm using jsfiddle have play , see can done - nothing serious, playing animation, etc.. specifically, ability animate between 2 classes. getting point, can have @ , let me know why need .delay work? http://jsfiddle.net/ps4xn/2/ $('div').click(function() { if ($(this).hasclass('clicked')) { $(this).delay(1).removeclass('clicked', 5000, 'easeinelastic'); } else { $(this).delay(1).addclass('clicked', 5000, 'easeinelastic'); } }); so far can tell, should able rid of 2 .delays, when do, doesn't work. let's simplify things. non-animated version (jsfiddle) : $('div').click(function() { $(this).toggleclass('clicked'); }); correctly animated version (jsfiddle) correctly animated version (jsbin) $('div').click(function() { $(this).toggleclass('clicked', 5000, 'easeinelastic'); }); the

ruby on rails 3 - Connecting to a mysql db using RoR 3, sqlite3 -

surely newb question learning ror , can't find simple answer relatively simple need. i want use sqlite3 app's database, connect mysql database return data. i've tried install gem mysql, won't install whatever reason. tried use mamp mysql lib rejected well. using: - rails 3 - ruby 1.9 - mac os x snow leopard any in matter appreciated! check out gem mysql2 ; in readme, section entitled "usage" may helpful you.

.htaccess - htaccess apache mod_rewrite & authentication: strange behavior -

i have created query based authentication on apache server, i've got strange behavior apache, , can't find way out of this. here .htaccess code: rewriteengine on rewritecond %{query_string} p=1 rewriterule ^(.*)$ $1?map=$1 [e=authme:1] order deny,allow deny env=authme authtype basic authname "login required" authuserfile /var/www/test/.htpasswd require valid-user satisfy i expect apache @ query string p=1. if found environmental variable set (authme=1). works fine! expect authentication required (deny env=authme) if p=1 present in query string. stuffs works wonderfully if call browser main index file (in case index.php), does not work @ all if call other file in same directory. environmental variable correctly set (i can check php), no authentication required. i can not understand why. appreciated! more info can found here do have other rewrite rules after one? have tried making last [l] rule? have tried in second browser has never authentica

php - How to pull numbers from a string with curly brackets? -

i have test string this: digit{digit}digit i want break string 3 variables. example, 40{1}2 should split 40 1 2. string big 2034{345}1245 . assume regex best way split string. here's have far: $productid = preg_match('/(.*?){/', $product); $productoptionid = preg_match('/{(.*?)}/', $product); $optionvalueid = preg_match('/}(.*?)/', $product); no need regular expressions here: $str = '40{1}2'; sscanf($str, '%d{%d}%d', $part_1, $part_2, $part_3); // $part_1 equal: 40 // $part_2 equal: 1 // $part_3 equal: 2 with method, variables typecast integers.

Creating a model within a model in Rails -

is possible create model object within model form? let's have article model , term model have has_and_belongs_to_many relationship through join table. (terms tags, have definition column.) i want user able add terms article when editing (probably using check boxes), user able create new term if can't find in list. how can done? want user able create term definition inside article edit form. possible? read "nested objects" or "nested attributes". might starting point: http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes

linux - mount system call -

i stuck @ finding correct usage of mount() system call should replacment command $mount -t ext3 -oloop /test /mount please help. thanks try: $ strace mount -t ext3 -oloop /test /mount and see there 2 number of system calls involved - 1 setting loopback block device , actual mount

php - Is it possible to pass an unset variable to a function or otherwise validate forms without isset()? -

i've got project passes json between frontend , backend. so, frontend php generate statement { "command" : "getuser", "parameters" : { "userid" : 1 } } , send backend. backend executes if ($command == 'getuser') { validate($parameters['userid']); if ($this->valid) { <<get user>> } } validate checks variable , sets $this->valid . creates error message if necessary. want create error message in case front end passes in { "command" : "getuser", "parameters" : "" } . in case, $parameters['userid'] never set, , validate() complain passed unset variable. i've come 2 solutions. first solution set $parameters['userid'] = "unset" before loading in json, , check in validator. other solution use if (isset($parameters['userid'])) { validate($parameters['userid']); } else { echo("error"); } it'd

Does anyone have a nice awk for svn log output? -

i want search commit messages string, it's easy pipe svn log grep, because message , rev on separate lines, it's little more complicated. i.e. svn log ./ | searchsvnmessages.awk artf29999 ------------------------------------------------------------------------ r9303 | myuser | 2011-02-22 15:13:47 -0800 (tue, 22 feb 2011) | 1 line artf29999: adjusting skin ------------------------------------------------------------------------ r9302 | myuser | 2011-02-22 14:11:06 -0800 (tue, 22 feb 2011) | 1 line artf29999: adding skinning. ------------------------------------------------------------------------ r800 | myuser | 2011-02-22 09:44:36 -0800 (tue, 22 feb 2011) | 1 line artf29999: adding functionality. i hoping else had done dirty work piggyback on? if need search first line of each log entry , using gnu grep, can svn log . | grep -b2 artf29999 .

c# - Styling ListView(for custom template) WPF -

i have few questions styling listview. example have style: <style x:key="mylistview" targettype="{x:type listview}"> <setter property="background" value="{dynamicresource {x:static systemcolors.windowbrushkey}}"/> <setter property="borderbrush" value="{staticresource listborder}"/> <setter property="borderthickness" value="1"/> <setter property="foreground" value="{dynamicresource {x:static systemcolors.controltextbrushkey}}"/> <setter property="scrollviewer.horizontalscrollbarvisibility" value="hidden"/> <setter property="scrollviewer.verticalscrollbarvisibility" value="auto"/> <setter property="scrollviewer.cancontentscroll" value="false"/> <setter property="verticalcontentalignment" value="center"/> <sett

WPF ComboBox Binding to Enumeration -

i have combo box has itemssource bound enumeration using objectdataprovider, , selecteditem property bound property of businessobject. reason it's binding selecteditem first , itemssource second, therefore overwriting default on businessobject property. ideas why , possibly fix? in advance. xaml: <collectionviewsource x:key="units"> <collectionviewsource.source> <objectdataprovider methodname="getnames" objecttype="{x:type sys:enum}"> <objectdataprovider.methodparameters> <x:type typename="bo:unit"/> </objectdataprovider.methodparameters> </objectdataprovider> </collectionviewsource.source> </collectionviewsource> <combobox grid.column="1" horizontalalignment="right" width="80" itemssource="{binding source={staticresource units}}" selected

assembly - Numbers of opcodes in instruction -

is there other (faster) way it? x86 architecture here wrote far. #include <cstdio> #include <cstdlib> typedef unsigned int uint; typedef unsigned char byte; byte getinstructionlength(byte * data); int main() { //get mod //hex:bin 0x00:00 0xc0:11 0x40:01 0x80:10 //printf("opcode 0x%x mod: 0x%x\n", opcode, opcode&0xc0); //get r //hex:bin 0x28:101 0x30:110 0x8:001 //printf("opcode 0x%x reg: 0x%x\n", opcode, opcode&0x38); //get m //hex:bin 0x07:111 0x2:010 0x1:001 0x6:110 0x0:000 0x3:011 0x4:100 0x5 101 //printf("opcode 0x%x r/m: 0x%x\n", opcode, opcode&0x07); for(byte opcode=0x0; opcode < 255; opcode++) { printf("opcode 0x%x mod: 0x%x reg:0x%x m:0x%x\n", opcode, opcode&0xc0, opcode&0x38, opcode&0x07); } return 0; } byte getinstructionlength(byte * data) { if(data[0] >= 0x3f && data[0] <= 0x61) return 1; //one opcode

c# - XML via database -

i have list of strings,the list constant , won't changed, there 12 strings. inside database table have column index string. don't think it's wise hold separate table hold strings because never changed neither save string self inside column. so option hold list in other type. what holding strings in xml file , using linq-to-xml load them dictionary. if thi better, performance wise, using datatable? those strings cached sql server , apply no performance hit. give flexibility in case have multiple applications sharing same database. overall keep in database unless have/expect millions database hits.

Python 2.7.1: Inconsistent output from os.path.isdir() -

i'm building python iso generation app, , i'm getting wierd output os.path.isdir(). i'm running arch linux python 2.7.1. i have following folder structure: /home/andrew/create_iso/raw_materials/ /home/andrew/create_iso/raw_materials/test_cd/ [andrew@cydonia raw_materials]$ ls -l total 4 drwxr-xr-x 3 andrew andrew 4096 feb 23 10:20 test_cd as can see, test_cd/ normal linux folder. however, when run os.path.isdir(), different results depending on whether it's part of loop or whether hard code it. import os >>>for folders in os.listdir('/home/andrew/create_iso/raw_materials/'): ... os.path.isdir(folders) false >>>os.path.isdir('/home/andrew/create_iso/raw_materials/test_cd') true i thought maybe there wierd in output i'm getting os.listdir(), seems check out: >>>os.listdir('/home/andrew/create_iso/raw_materials/') ['test_cd'] any idea why it's treating these cases different? in advance

datetime - How can I change timezones in a php date? -

i have date stored in database in format: 2011-02-23 13:00:00 i need return in iso8601 format, needs set specific time zone (which not time zone of server.) want return this: 2011-02-23t13:00:00-0600 using code: echo date(date_iso8601, strtotime("2011-02-23 13:00:00")); i this: 2011-02-23t13:00:00+0000 is there way reset time zone in date or strtotime function, or need strip off 5 rightmost characters , concatenate desired timezone stamp remaining date/time? edited add: although did accept solution below of using new datetime , setting new datetimezone, found easier way if don't need keep resetting time zone: date_default_timezone_set('america/chicago'); $starttime = date(date_iso8601, strtotime("2011-02-23 13:00:00")); you use datetime class. datetime objects can initialized specific time zone, , transposed others. modified manual: $date = new datetime('2011-02-23 13:00:00', new datetimezone('pacific/na

c# - Map many to many relation in entity framework -

Image
i have sql server database , c# win forms application , using entity framework. in database have following tables : table joint( jointid firstname fathername lastname) which represent joint in gym , every joint has closet, , every joint has 1 closet , each closet can rent 1 joint. thought 1 one relation don't know if it's true anyway closet table : table closet( closetid number) but @ same time want keep history each closet because maybe rent 2 months , else rent same closet after first 1 want know each joint rent closet, , want know own know , how payed rent of closet, want start time, end time, price. at last figured out want third table between above tables , many many relation created : table closethistory( jointid fk closetid fk starttime endtime price) and think right not sure , not problem. problem when update entities database relation between joint , closet not created , create joint entity stand a

android - Passing Extras to listView ArrayAdapter -

i have 2 buttons, when click them, launches new listview activity. before starts activity, make bundle, putstring depending on button clicked , putextras. in listview activity, have 2 string arrays. want arrayadapter getextras , read variable know button pressed there , i'll know string array load arrayadapter. here idea arrayadapter doesn't accept string, though s = name of 1 of string arrays. also, i'm not sure if i'm approaching in best way. bundle b = this.getintent().getextras(); string s = b.getstring("text"); setlistadapter(new arrayadapter<string>(this, r.layout.list_item, s)); the array adapter takes list of objects third parameter documentation on public constructors suggests (source developer android ): constructor arrayadapter(context context, int textviewresourceid, t[] objects) constructor arrayadapter(context context, int resource, int textviewresourceid, t[] objects) constructor arrayadapter(context context, i

regex - Help parsing string (City, State Zip) with JavaScript -

i've got string following format: city, state zip i'd city , state string. how can javascript? edit: note doesn't mention has zip code when gets here, if helps in solution ~~ drachenstern var address = "san francisco, ca 94129"; function parseaddress(address) { // make sure address string. if (typeof address !== "string") throw "address not string."; // trim address. address = address.trim(); // make object contain data. var returned = {}; // find comma. var comma = address.indexof(','); // pull out city. returned.city = address.slice(0, comma); // after city. var after = address.substring(comma + 2); // string after comma, +2 skip comma , space. // find space. var space = after.lastindexof(' '); // pull out state. returned.state = after.slice(0, space); // pull out zip code. returned.zip = after.substring(space + 1); //

php - Count the tweets from time x until time y -

i trying make application using twitter api, , helpful able count number of tweets mention given word in specified time (from time x time y). time short, matter of seconds. does 1 know way of doing this? thanks you can use twitter streaming api collect tweets include specific word, , count tweets match. streaming api lets track 400 words.

Can you get the parent GTK window from a widget? -

i have custom widget , needs launch messagedialog , in order me put message dialog on top of window widget in need access parent gtk.window. there way parent gtk window? thanks the gtk docs suggest: gtkwidget *toplevel = gtk_widget_get_toplevel (widget); if (gtk_widget_is_toplevel (toplevel)) { /* perform action on toplevel. */ } get_toplevel return topmost widget you're inside, whether or not it's window, is_toplevel check. yeah mis-named since code above "get_toplevel()" immediate "is_toplevel()" (most likely, get_toplevel() should called else).

Deserialize django json data dump one record at the time? -

i`m trying read file json-data, use loads(data) simplejson method , extract create dictionary representing values each column in record, instead of using "standard" or documented way of : for obj in serializers.deserialize("json", data): # obj because want avoid creating django orm objects each record, want dictionary representing each object can insert database using plain sql gain speed. problem loads(data) needs read data memory , want avoid keep memory usage low , read entry entry in json-data. possible iterator yields data 1 record? , secondly, can skip entire creation of django orm objects when deserializing json data , dictionary of values? input , thoughts welcome. thanks time. if don't want create orm objects, there's no point in using django deserialization methods. load json using underlying simplejson library: from django.utils import simplejson my_data = simplejson.loads(data)

php can't execute a perl script via exec -

i'm trying execute perl script php. perl script reading webpage , producing xml file data. if exec via shell works expected when i'm trying automate whole thing via php nothing works. i've tried this: exec("perl /absolute/path/to/perl/script/parser.pl", $output, $result); when echo $result variable displays 2 . i've switched php safe_mode on , off several times nothing changed. tried set safe_mode_exec_dir without positive results. when exec simple ls exec("ls", $output, $result); everything goes well, list of files , $result 0 . the perl script has chmod 777 not problem of permission. folder has 777. i'm sure issue server i'm not able find out what. any appreciated. thanks you need specify full path perl executable. try typing which perl see full path is, place full path in exec call.

How to read a section from web.config on IIS7 w/ .net 4 in C# -

i've got following section in web.config: <system.webserver> <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="0.00:00:30" /> <remove fileextension=".ogv" /> <mimemap fileextension=".ogv" mimetype="video/ogg" /> <remove fileextension=".webm" /> <mimemap fileextension=".webm" mimetype="video/webm" /> <!-- , bunch more... --> </staticcontent> <!-- ... --> </system.webserver> here's i'm trying in psuedo-code: var ext = ".ogg"; var staticcontentelements = getwebconfig().getsection("system.webserver/staticcontent").childelements; var mimemap = staticcontentelements.where(c => c.getattributevalue("fileextension") != null && c.getattributevalue("fileexten

spring - IllegalAnnotationsException: domain.NewsletterType does not have a no-arg default constructor -

caused by: com.sun.xml.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions xxx.tools.newsletter.domain.newslettertype not have no-arg default constructor. problem related following location: @ xxx.tools.newsletter.domain.newslettertype @ public xxx.tools.newsletter.domain.newslettertype xxx.tools.newsletter.domain.newsletter.gettype() @ xxx.tools.newsletter.domain.newsletter @ public xxx.tools.newsletter.domain.newsletter xxx.commons.user.ws.domain.sweepstakeresponse.getreminderemail() @ xxx.commons.user.ws.domain.sweepstakeresponse at com.sun.xml.bind.v2.runtime.illegalannotationsexception$builder.check(illegalannotationsexception.java:102) @ com.sun.xml.bind.v2.runtime.jaxbcontextimpl.gettypeinfoset(jaxbcontextimpl.java:472) @ com.sun.xml.bind.v2.runtime.jaxbcontextimpl.<init>(jaxbcontextimpl.java:302) @ com.sun.xml.bind.v2.runtime.jaxbcontextimpl$jaxbcontextbuilder.build(jaxbcontextimpl.java:114

java - Manipulate an image without deleting its EXIF data -

using imageio, have problem of transforming image file, , after overwriting it, loses of exif data. there way preserve without first extracting it, caching it, , resetting it? here solution using combination of imageio, imgscalr , apache commons-imaging. it's pity there's no single library combines reading image metadata, making rather excessive on memory usage; improvements welcome. import java.awt.image.bufferedimage; import java.io.bytearrayinputstream; import java.io.bytearrayoutputstream; import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import javax.imageio.imageio; import org.apache.commons.imaging.imagereadexception; import org.apache.commons.imaging.imagewriteexception; import org.apache.commons.imaging.imaging; import org.apache.commons.imaging.common.iimagemetadata; import org.apache.commons.imaging.formats.jpeg.jpegimagemetadata; import org.apache.commons.imaging.formats.jpeg.exif.exifrewriter; import org.apache.comm

git svn - How to I update the path to a moved git-svn remote branch -

i have been using git , git-svn while have moved out svn repository server location. wondering need git @ new remote path can continue before. have tried changing url in config @ new repo when try git svn rebase : unable determine upstream svn information working tree history the svn repo same has moved locations url. thanks in advance. you need change svn-remote.svn.url . can view so % git config --get svn-remote.svn.url and set this: % git config svn-remote.svn.url http://foo/bar or via editor: % git config -e

internet explorer 7 - CSS Overflow incorrect in IE7 -

i have problem ie7, noticed couple days ago floated divs overfloating way out of box left here problem: http://www.locksmith-service-rockville-md.com/door-knob-lever-set i have been trying figure out past 3 days, far out success, can tell me doing wrong here? thanks in advance you kept changing live site, i'm confused. make sure #left-side does not have overflow: auto . on div .views-row-odd, div .views-row-even , remove clear: right . (this change doesn't seem required, don't see need clear: right here) from html source code, remove <div class="space"></div> . that's not way space @ top; it's causing problems . do changes live site, , let me know think. if that's far in different browsers you're testing in, can see adding in spacing, using different method.

wcf - Any code examples of SpnegoContextToken with Java client? -

i'm trying write java code run on windows consume wcf webservice that's using spnegocontexttoken. have working example can share? not sure if current metro (2.1) supports spnegocontexttoken. grateful advice. thanks!!! you should check http://spnego.sourceforge.net/protected_soap_service.html further details. also interesting are http://waffle.codeplex.com/ and http://spnego.java.net/

javascript - Location of image resources -

i have plugin runs off customer's websites. plugin @ http://mycompany.com/tool.js , , needs pull in images. problem javascript seems try pull images customer's site, rather own site. here js: button.style.csstext = 'position:absolute;top:-20px;right:-20px;background-image:url(/resource/button.png); in above js, the retrieval url customer.com/resource/button.png (the site plugin runs), rather sites mycompany.com/resource/button.png. note cannot use absolute paths, become pain between environments (test/prod) , because image retrieval must use http/https based on client environment (otherwise can errors if http used on https site). just replace background-image:url(http://mycompany.com/resource/button.png);

asp.net - Breadcrumbs SiteMapPath and SEO-Friendly Routing -

Image
i have routing set follows: void registerroutes(routecollection routes) { routes.mappageroute("", "home", "~/default.aspx"); ...... } i'm implementing breadcrumbs using sitemappath control: <asp:sitemappath id="sitemappath1" cssclass="breadcrumbs" runat="server"> </asp:sitemappath> web.sitemap set follows: <?xml version="1.0" encoding="utf-8" ?> <sitemap xmlns="http://schemas.microsoft.com/aspnet/sitemap-file-1.0" > <sitemapnode url="home" title="home" description="home"> <sitemapnode url="~/about" title="about" description="about"> <sitemapnode url="~/history" title="history" description="history" /> </sitemapnode> </sitemapnode> </sitemap> my problem when na

xamarin.ios - MonoTouch - Running in Debug results in "Could not insert pending Breakpoint" -

i've done clean all, i've reset simulator, can't explain why following: (see 'resolved pending breakpoint' line, , 'could not insert') loaded assembly: /developer/monotouch/usr/lib/mono/2.1/monotouch.dll [external] loaded assembly: /developer/monotouch/usr/lib/mono/2.1/system.core.dll [external] loaded assembly: /users/drisszouak/projects/zenvelopes/zenvelopes/bin/iphonesimulator/debug/zenvelopes.exe resolved pending breakpoint @ 'envelopeviewcontroller.xib.cs:76' void zenvelopes.envelopeviewcontroller:handlebtnnewenvelopeclicked ():0. not insert pending breakpoint @ 'envelopeviewcontroller.xib.cs:69'. perhaps source line not contain statements, or source not correspond current binary. loaded assembly: /developer/monotouch/usr/lib/mono/2.1/mono.data.sqlite.dll [external] loaded assembly: /developer/monotouch/usr/lib/mono/2.1/system.data.dll [external] loaded assembly: /developer/monotouch/usr/lib/mono/2.1/system.dll [external] loaded as

java swing form hang -

i developing application in java swing(desktop) communicate device through serial port.the problem hangs when communication lost device.and unable close form until don't end .exe in window task mannager.what should solution can close forms. i'm guessing communicating other application using event dispatch thread. if other application hangs gui becomes unresponsive. i suggest use separate thread communicate other device. read section swing tutorial on concurrency more information.

iphone - CLLocation header is always -1 -

hey guys, trying build app use compass point in direction of predetermined location, trying understand how make basic compass. followed guide, "-1" header, , have gotten work once, , haven't changed code since. ideas helpful. #import <uikit/uikit.h> #import <corelocation/corelocation.h> @interface trackerviewcontroller : uiviewcontroller <cllocationmanagerdelegate> { } @property (nonatomic, retain) cllocationmanager *locationmanager; @property (nonatomic, retain) iboutlet uiswitch *toggle; @property (nonatomic, retain) iboutlet uiimageview *compass; @property (nonatomic, retain) iboutlet uilabel *headinglabel; -(ibaction)toggleswitch; @end and implementation file... #import "trackerviewcontroller.h" @implementation trackerviewcontroller @synthesize locationmanager; @synthesize toggle; @synthesize compass; @synthesize headinglabel; - (ibaction)toggleswitch { if(self.toggle.ison) { [self.locationmanager startupdatinghead

php - Using a dropdown menu in a form for a SELECT statement with SQL -

thank reading question. i building form let users search db cards used in collectible card game. want include dropdown menu let users narrow search down specific card expansion. here dropdown menu: <select name="expsn" onchange="this.submit()"> <option>all expansions</option> <option value="core">core</option> <option value="som">shadows of mirkwood</option> and here select statement: $sql = "select * carddb expsn ='" . $_post['expsn'] . "' , type='hero' "; this works when selecting either core or mor, if dropbox left blank "all expansions" passed $_post['expsn']. (i use echo $sql; output select statement). how can set default return card expansions. i have spent last few weeks learning php , sql online, possible whole approach here wrong , not scalable, 'big picture' appreciated. thank you.

algorithm - Procrustes analysis / Finding the Angle Between two images represented by two sets of 2d points -

if have 2 sets of points can rotate 1 around procrustes analysis align 1 other. but suppose these 2 sets of points each attached images , rotate images well. there way can rotate image, instead of rotating points? tutorial there uses dot product rotation (solve u, s, v = svd(p1', p2) , p2 . v . u' , p' transposed p) however doesn't tell me angle between images is. the page on wikipedia calculates angle between each pair of points think. maybe i'm asking impossible? if rotate first set of points align first, can't rotate respective images angle well? point being, angle that? i noticed v . u' gives me 2 x 2 matrix seems rotation matrix (there's wikipedia page can't link there due posting priviledges). got sin , cos of third , first elements , used arctan2, results i'm getting kind of weird. know have transformed radians i'm not convinced i'm doing right. trying rotation gives me on gimp makes seem it's not want, i'

asp.net ajax update panel -

i have asp.net webpage , im using ajax timer trigger set refresh every 5 seconds. have few tables under update panel background image. works fine except first time updates, table images flickers. after that, not flicker when updates. ideas?? i think occurs backgroung image takes time loads. please keep background iamge minimum size possible , add single html image on page image hidden. there on page , no need reloaded each , every time.

firefox addon - How to get Selected Text into a Variable or a variable from a Database? -

i working on firefox extensions. extension works follows: whenever user double clicks word on page(any webpage), word selected must stored in variable , sent server find meaning database. when he/she single clicks @ other place in same document popup showing meaning db should disposed. any answers? how write firefox addon? more or less official "how started" question firefox addons. add event listener browser ( gbrowser ) listen click events. easiest way make server call using xmlhttprequest. that's enough started. come more specific questions when stuck. luck!

Is there a way to write iphone and android apps using visual studio and c#? -

is there way write iphone , android apps using visual studio , c#? if make phone app can write android, iphone, , windows without havong write in 3 different languages? xamarine approach. can create both android , iphone/ipad apps.

PHP MySQL authentication error -

i have created html form (demo.html) & post it's value php file (demo1.php). created database in mysql & wrote connection code in php file (demo1.php) gives following error warning: mysql_connect() [function.mysql-connect]: access denied user 'root'@'localhost' (using password: yes) in c:\xampp\htdocs\demo1.php on line 8 error connecting mysql <?php // contact database $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('error connecting mysql'); //$conn = mysql_connect("localhost","root","password") or die ('error connecting mysql'); $dbname = 'test'; mysql_select_db($dbname,$conn); //$connect = mysql_connect("localhost", "root", "pass") or die ("error , check server connection."); //mysql_select_db("test"); //get data in local variable $v_

css - Internet Explorer Issue with color profiles on rounded corners using images -

Image
i using images provide rounded corners internet explorer images different shade actual border in ie. not case in google chrome or firefox. in ie image corners different shade rest of border. think because of "color profiles" still don't know how fix issue. if using pngs create corner need strip gamma information out ie. great tool pngoptimizer: http://psydk.org/pngoptimizer.php

datasource - How do I call DSOperationType.REMOVE to remove the selected record from a drop-down grid? -

i trying delete selected record drop-down grid. in trying this, i've far learned dsoperationtype.fetch called when fetchdata() method called on valuesmanager class. want know line should executed calling dsoperationtype.remove . or there better way accomplish task? dsoperationtype.remove called when removing data/row list grid or tree grid. can triggered functionally calling listgrid.removedata(somedata) or listgrid.removeselecteddata(); but combobox/selectbox (dropdown) type item there no functionality remove data list can selected list of data (while loading data list fetch operation called). you can implement functionlity indirectly using combobox/selectitem listgrid - (ex:http://www.smartclient.com/smartgwt/showcase/#dropdown_grid_combobox_category). in listgrid can have remove data functionality. check other types of functionality can implemented combobx http://www.smartclient.com/smartgwt/showcase/#multi_select_combobox_category

query optimization - MySQL compare data from date ranges prior to the current row and count() them -

this in reference still-open question here - want try approach differently. i have mysql table 2 pieces of information: order_date , email_address . exhaustive , non-distinct, meaning there duplicates if happened make more 1 purchase per-day. i need following report in few queries possible, one: yyyy-mm | number_emails_this_month | numer_emails_repeated_prior where sample output query result this: yyyy-mm | number_emails_this_month | numer_emails_repeated_prior 2010-02 23423 1231 2010-03 4422 2234 2010-04 1424 650 any appreciated! i not sure understand number_emails_repeated_prior . if post short example of data , corresponding example of wanted results helpful. taking guess aiming for, number of emails specific user per month need is: select date_format(order_date, '%y-%m') `yyyy-mm`, count(email_address) `number_emails_this_month ` table_name email_address = 'some@address' g

iphone - How can I change the speed of the keyboard slide in/out animation? -

i confuse small test app.when on textfield keyboard comes want increase keyboard time.can tell me how can increase time of keyboard , down? the speed of system keyboard can retrieved via uikeyboardanimationdurationuserinfokey , read-only. update: how values. in notification listener: - (void)keyboardwillshow:(nsnotification*)notification { nsdictionary* userinfo = [notification userinfo]; nstimeinterval animationduration; uiviewanimationcurve animationcurve; [[userinfo objectforkey:uikeyboardanimationcurveuserinfokey] getvalue:&animationcurve]; [[userinfo objectforkey:uikeyboardanimationdurationuserinfokey] getvalue:&animationduration]; }

How to get the latest document created by category in View using lotus notes -

how latest document created category in view using lotus notes @formula? since using @formula language, assume need data document , not notesdocument object (for need write lotusscript). if case, suggest using @dblookup function hidden view (view name surrounded in parentheses) first sorted column - category you'll use , second sorted column - function @created , sorted descending, first matching document most-recent one. you can use @dblookup retrieve non rich-text field document, or pre-calculated value third (fourth, etc.) column (which include plain text, extracted rich-text field). to sure access most-recently created document matches criteria, view need refresh automatically , need specify "nocache" in @dblookup . like: @dblookup("":"nocache"; @dbname; "(mylookupview)"; "category"; 3) does achieve you're trying do?

sql server - TABLOCK vs TABLOCKX -

what difference between tablock , tablockx http://msdn.microsoft.com/en-us/library/ms187373.aspx states tablock shared lock while tablockx exclusive lock. first maybe index lock of sorts? , concept of sharing lock? big difference, tablock try grab "shared" locks, , tablockx exclusive locks. if in transaction , grab exclusive lock on table, eg: select 1 table (tablockx) no other processes able grab any locks on table, meaning all queries attempting talk table blocked until transaction commits. tablock grabs shared lock, shared locks released after statement executed if transaction isolation read committed (default). if isolation level is higher , example: serializable , shared locks held until end of transaction. shared locks are, hmmm, shared. meaning 2 transactions can both read data table @ same time if both hold s or lock on table (via tablock ). however, if transaction a holds shared lock on table, transaction b not able grab exclusi

What is Javas answer to Winforms / WPF / Silverlight in 2011 -

this question has answer here: what java's answer wpf? [closed] 3 answers we doing evaluation of use client technology, wondering java has offer. i know close duplicate question: what java's answer wpf? but answer in above question on 2 years old, answer today different. i think javafx still lives. can check eclipse rich ajax platform too. think suitaible answer silverlight.

facebook - FB like placement changes in IE6 -

i have implemented fb button in page.. works fine in browsers not in ie6. in ie6 firstly comes fine , after few seconds shifts left.. thank in advance help... yeah ie pain, maybe can load css on browser detected <!--[if ie 6]> <link rel="stylesheet" type="text/css" href="css/somecss_for_ie6.css"/> <![endif]-->

windows installer - How do I set the MSI exit-code to 0 if product is already installed using WiX? -

i have following line in wix setup check if current version installed: <upgradeversion onlydetect='yes' property='newproductfound' minimum='$(var.productversion)' includeminimum='no' /> the msi exits message , exit code "1638". however, msi part of bootstrapper chains multiple msis - , want bootstrapper continue , install following msis. how tell wix/msi exit exit code 0 , no message dialog? i modify bootstrapper rather prefer set exit code 0. (the exact exit code is: error_product_version - "another version of product installed. installation of version cannot continue. configure or remove existing version of product, use add/remove programs on control panel.") it seems wixexitearlywithsuccess custom action need.

Tab vs Space indenting (Dreamweaver vs NetBeans) problem -

i use dreamweaver @ work , netbeans ide @ home, in both cases project stored @ github. problem netbeans seems constructing code indenting out of spaces , when opened in dreamweaver or exported github, indenting here , there breaks (moves unexpectedly further intended or vice versa), although when opened again in netbeans, goes normal. has been pain time already. there resolution this? i should @ work (and me including) prefer tab indenting. it depends on ide's definition of tab. there options within ide indent using tab turn tab given number of spaces. indent using tab have ide turn 3 spaces. means doesn't matter (or else) use read code later indets same. in netbeans need in code editor options have no idea find settings in dreamweaver.

html - Ignore formatting certain sections in Visual Studio 2010 -

i know lot have asked how tweak formatting options in visual studio, there way instruct visual studio ignore sections of document? my problem have velocity template, visual studio not know how format specific tags, ends making template invalid. in visual studio, have associated templates html editor, there way syntax highlighting? you might want try cvsi , although don't think supports vs2010, can send patch make work ;-)

iphone - Calculate angle for rotation in Pie Chart -

i want rotate image around center point.the problem facing need angle calculate in touch moved event (i dont want use multi touch).i current using below code - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ nsarray *alltouches = [touches allobjects]; gesturestartpoint = gesturemovedpoint;//i getting gesturestartpoint on touch began event gesturemovedpoint = [[alltouches objectatindex:0] locationinview:[self superview]]; nslog(@"gesturemovedpoint = %@",nsstringfromcgpoint(gesturemovedpoint)); } cgfloat previousangle = [self anglebetweenpoints:gesturestartpoint second11:gesturemovedpoint]; // atan2(gesturemovedpoint.y - gesturestartpoint.y, gesturemovedpoint.x - gesturestartpoint.x) * 180 / m_pi; cgfloat currentangle =atan2(self.transform.b, self.transform.a);//atan2(gesturemovedpoint.y - gesturestartpoint.y,gesturemovedpoint.x - gesturestartpoint.x) * 180 / m_pi; cgfloat angletorotate = currentangle - previousangle; float xpoint = (((atan2(

architecture - Best approach to Architect the integration of two separate databases? -

i've ran following questions @ work, , don't have experience or knowledge in order answer them, i'm hoping of wiser folk may able point me in right direction, answers appreciated! scenario we have 2 aspects of business using separate databases, human resources , operational areas (homecare). human resources keep track of company’s employees, shift patterns, absence, pay etc. homecare keeps track of client information, home visits, visit dates , employee/s responsible providing visit. these 2 systems separate , we’re in process of looking @ ways integrate them. additionally, we’re looking @ how organise our code looks @ these 2 databases, reusable, organised libraries. we have 3 applications re-using humanresources.dll, responsible communicating ef 4 object context, contained in library. object context mirror image of database stands. questions we’re add fourth application use data in hr database. do we: create new ef data model,