Posts

Showing posts from September, 2013

iphone - Adding a viewController as subView programmatically -

i building iphone app. i need display settings menu user when button clicked. menu not covering whole screen , there specific location want appear. how should that? i understand how set hidden property of subview give illusion subview not onscreen. however, need view controller subview ( meaning .m , .h files well). how can add subview programmatically @ specific location. thank much what describing behavior of uipopovercontroller. unfortunately, available use on ipad's , not iphone's or ipod touches. if want develop need develop scratch. it's not ui pattern see on iphone due screen size, imagine need build custom uiview , add main window view specific size (smaller screen size) , view's frame.origin set value other (0,0). just make sure trying achieve falls within apple's human interface guidelines.

python - Cannot edit text in chart exported by Matplotlib and opened in Illustrator -

i exporting charts matplotlib , editing them in illustrator. it's great can edit lines, text comes in lines, cannot change fonts, edit text, etc. i've exported eps, pdf, , ps same issues. i'm using matplotlib version 1.0.1 python 2.7.1 on osx snow leaopard. i appreciate insights offered! tried using pdf2ps suggested here , did degrade quality of image without making text rendered real text. pdftops looked nicer, still can't edit text results. you can edit text in acrobat/illustrator if set pdf.fonttype 42 (truetype), , export in pdf. can set in ~/matplotlib/matplotlibrc : pdf.fonttype : 42 # output type 3 (type3) or type 42 (truetype) ..or dynamically: >>> import matplotlib mpl >>> mpl.rcparams['pdf.fonttype'] = 42 apparently defaults type3 acrobat/illustrator can't deal with.

Android Display a list using ListView -

i trying display list after clicking button on android. this code: //button after clicking should display list final button button4 = (button) findviewbyid(r.id.widget30); button4.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { intent myintent = new intent(v.getcontext(), testlistactivities.class); startactivity(myintent); } public class testlistactivities extends activity { string[] listitems = {"game1", "game2", "game3", "game4"}; public listview la; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main2); la=(listview)findviewbyid(r.id.widget50); la.setadapter(new arrayadapter<string>(this, r.layout.main2, listitems));

html - Prevent hash change -

i have 3rd party flash object embedded in webpage changes hash location when click on it. don't want , don't have access flash source. there way prevent flash object changing hash? no, best thing can overlay transparent png on flash movie block click event entering movie.

ruby on rails - Using helpers in ActionMailer -

how access helpers within actionmailer ones have created? i have tried: how use view helpers in actionmailer views? own created helper didn't work. advise? this has worked me in past in rails 3: class ordermailer < actionmailer::base helper :application, :orders, :products ... end my custom helpers orders , products.

Java ME record store problem -

i save data record store. if aplication running works fine, when restart aplication data in record store lost. here load command: try { int i=1; display.setcurrent(list2); recordstore rs = recordstore.openrecordstore("recordstore", true); recordenumeration re= rs.enumeraterecords(null, null, true); adresaurl ad = new adresaurl(); system.out.println("nacteno"); while(re.hasnextelement()){ byte br[] = rs.getrecord(i); ad.setpopis(new string(br)); br = rs.getrecord(i+1); ad.seturl(new string(br)); system.out.println(ad.getpopis()); system.out.println(ad.geturl()); i+=2; adresy.addelement(ad); list2.append(ad.getpopis(), null); system.out.println("nacteno2"); } recordsto

Multidimensional Arrays lengths in Java -

i need find lengths of multidimensional array non equal indices. for example, have int[][] pathlist = new int[6][4] without hard-coding indices, need find '6' , '4'. i can find 6 pathlist.length how obtain '4'? this give length of array @ index i pathlist[i].length it's important note unlike c or c++, length of elements of two-dimensional array in java need not equal. example, when pathlist instantiated equal new int[6][] , can hold 6 int [] instances, each of can different length. so when create arrays way you've shown in question, may do pathlist[0].length since know have same length. in other cases, need define, specific application what length of second dimension means - might maximum of lengths elements, or perhaps minimum. in cases, you'll need iterate on elements , read lengths make decision: for(int = 0; < pathlist.length; i++) { int currlen = pathlist[i].length; }

math - Difference between 12Log2 and Log[2,12]? -

my math pretty weak, , i'm having confusion on differences. i'm trying find out midi formula, output frequency when have midi value midinumber = 69+12* log2(440/frequency) so derived frequency = (-69 + 5280 log2 + midinumber)/(12 log2) if plugin things works correctly 440 = (-69 + 5280 log2 + 69)/(12 log2) if though things not work correctly (-69 + log[2, 5280.] + 69)/log[2, 12.] this output in programming, don't know difference between 2 equations. maybe it's 12*log2, 12*log2[1] or, ...? no idea. part of confusion seems treating log2(n) log2 * n. log2 function, inverse of 2^x. so derivation should go follows: midinumber = 69 + 12 * log2(440 / frequency) midinumber - 69 = 12 * log2(440 / frequency) (midinumber - 69) / 12 = log2(440 / frequency) 2^((midinumber - 69) / 12) = 440 / frequency frequency = 440 / 2^((midinumber - 69) / 12)

jogl - OpenGL find distance to a point -

i have virtual landscape ability walk around in first-person. want able walk slope if 45 degrees or less. far know, involves translating current position out x units finding distance between translated point , ground. if distance x units or more, user can walk there. if not, user cannot. have no idea how find distance between 1 point , nearest point in negative y direction. have programmed in java3d, not know how program in opengl. barking problem @ opengl barking wrong tree: opengl's sole purpose drawing nice pictures screen. it's not math library! depending demands there several solutions. how i'd tackle problem: normals calculate proper shading give slope of each point. heightmap (=terrain) in xy plane , gravity vector g = -z , normal force terrain_normal(x,y) · g . normal force is, "pushes" feet against ground. without sufficient normal force, there's not enough friction convey muscles force movement perpendicular ground. if @ normal force

Windows automation with Applescript and WINE -

can automate windows application running on wine applescript? if not, there way script windows app on wine osx? i've not tried wine parallels gui scripting , send keystrokes directly application. here's blog post wrote on it. (although use python + appscript scripting primarily) http://www.libertypages.com/clarktech/?p=1496 note send each character separately in script. can send full strings. abstracted out can add delay if necessary. have function sending strings. if you're not familiar gui scripting i'd @ following tutorial: http://www.macosxautomation.com/applescript/uiscripting/index.html

powershell - Scripting using powerCLI Scripts -

is possible scripting using powercli scripts automate vm creation using notepad? or powercli developing tool? how go studying powercli scripting scratch automate vm creation? more or less 2 months ago, started learning powershell because needing of using powercli :). powercli best choice scripting vmware vsphere automation. when start powercli command line tool can work there inside powershell. furthermore, can use included cmdlets (more 200) vmware vsphere automation. scripting powercli same scripting powershell. try it! to started: getting started powercli home community discussions online reference note won't find here @ stackoverflow lot of answerers powercli (i think and, anyway, unless me , other). fact @jpblanc created new tag proof. if want support in scripting questions go directly vmware community, find there. note notepad do not use notepad. use powershell ise or vim or notepad++.

excel vba - Matching and Sorting Two Columns for Bank Reconciliation -

hi need preparation of bank reconciliation report. say, have 2 sheets, 1 sheet contain id code current month , other sheet contain id code previous month. this: col. (sheet 1) | col b (sheet 2) | d b | c c | e d | b e | f i want macro automatically sort , match 2 columns ending this: col. (sheet 1) | col b (sheet 2) | b | b c | c d | d e | e take note f in column (sheet 1) deleted because has no match in col. b. please me this, new when comes excel vba. you can without macro, cleaner. use countif() function determine matches 1 column other, delete rows if countif() zero, can use vlookup() , you're there. hope helps.

Getting UTF-8 encoded RSS Feed into PHP - garbage characters -

i'm attempting pull in rss feed website , display on own. i'm using library called rsslib.php, here relevant function function rss_retrieve($url){ global $rss_content; $doc = new domdocument(); $doc->load($url); $channels = $doc->getelementsbytagname("channel"); $rss_content = array(); ... the rss feed has <?xml version="1.0" encoding="utf-8"?> @ top and page i'm displaying on has meta content type set utf-8 yet, i'm getting following coming through in content.... €™ in place of apostrophes i've used htmlentities , this: $text = trim(htmlentities($child->wholetext, ent_quotes, "utf-8")); where $child instance of domtext . also works other domnode properties far know.

algorithm - Why is an "unstable sort" considered bad -

just wondering if explain why "unstable sort" considered bad? don't see situations matter. care provide one? if have gui allows people sort on individual columns clicking on column, , use stable sort, people know can multi-column sort on columns a,b,c clicking on columns c,b,a in order. because sort stable, when click on b records equal keys under b still sorted c after clicking on b records sorted b, c. similarly, after click on a, records sorted a, b, c. (unfortunately, last time tried on microsoft product or other, looked didn't use stable sort, it's not surprising trick not better known).

image not upload to php server , no response from servre on android -

i doing app uploading image php server android , php server return url response request. checked no problem in php server side works fine iphone. in android cannot response. have checked php server image not uploaded. not know problem in code , how response. there setting needed? code : public class upload extends activity { inputstream is; @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.main); bitmap bitmaporg = bitmapfactory.decodefile("/sdcard/imageq.png"); bytearrayoutputstream bao = new bytearrayoutputstream(); bitmaporg.compress(bitmap.compressformat.png, 90, bao); byte [] ba = bao.tobytearray(); string ba1=base64.encodebytes(ba); arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("image",ba1)); try{ httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://xxxxxxxxxx/xxxxxx/u

How to define a new Charset in Java/Android? -

in taiwan have character encoding called "unicode @ 1 (uao)", extension big-5 not supported java , android. code page in http://moztw.org/docs/big5/table/uao241-b2u.txt my question is, how can build string object byte array data, using charset? guess extend string class , in it, have no idea how create new charset. you can add own charset implementation writing charsetprovider , registering via service discovery mechanism. you'll need extend charset , implements newdecoder , newencoder methods return appropriate charsetdecoder , charsetencoder respectively.

Python - Graph Data Structure - How Do I Implement Breadth-First Search to Find Reachable Vertices Correctly -

in python, have graph class has dictionary of vertex objects. each vertex object has dictionary of edges (which consist of starting node, ending node, , weight...imagine end of arrow pointing node cost-to-travel number assigned it). with these classes, i'm graphing--well, graph--for time takes planes fly city city. graph, i'm supposed determine shortest-path (fastest-path) between 2 nodes using dijkstra's algorithm. i'm supposed determine vertices reachable starting vertex. i'm able add edges , delete edges (and consequently, add nodes) in graph. however, life of me, can not seem figure out simple way implement dijkstra's algorithm or breadth-first search (to determine reachable vertices) using data structures have created. if suggest need alter or implement these algorithms work correctly, appreciate help. is homework assignment have been working on week, many hours per day, , can't seem passed wall. again, appreciate advice or help. i'm not

java - How to I find out the size of a GZIP section embedded in firmware? -

i analyzing firmware images contain many different sections, 1 of gzip section. i able know location of start of gzip section using magic number , gzipinputstream in java. however, need know compressed size of gzip section. gzipinputstream return me uncompressed file size. is there has idea? you can count number of byte read using custom inputstream. need force stream read 1 byte @ time ensure don't read more need. you can wrap current inputstream in this class countinginputstream extends inputstream { final inputstream is; int counter = 0; public countinginputstream(inputstream is) { this.is = is; } public int read() throws ioexception { int read = is.read(); if (read >= 0) counter++; return read; } } and wrap in gzipinputstream. field counter hold number of bytes read. to use bufferedinputstream can do inputstream = new bufferedinputstream(new fileinputstream(filename)); // read data

url encoding - Encode file path properly using python -

i trying open files getting path dictionary. of file names have commas (,) , other such characters when used give "no such file found error" for instance following file path not open: foo,%20bar.mp3 if characters commas exist should encoded : foo%2c%20bar.mp3 can tell me how this? you may need pathname2url python 2.x ( docs ) >>> urllib import pathname2url >>> pathname2url('foo, bar.mp3') 'foo%2c%20bar.mp3' python 3.x ( docs ) >>> urllib.request import pathname2url >>> pathname2url('foo, bar.mp3') 'foo%2c%20bar.mp3'

scala - Preferred way of processing this data with parallel arrays -

imagine sequence of java.io.file objects. sequence not in particular order, gets populated after directory traversal. names of files can this: /some/file.bin /some/other_file_x1.bin /some/other_file_x2.bin /some/other_file_x3.bin /some/other_file_x4.bin /some/other_file_x5.bin ... /some/x_file_part1.bin /some/x_file_part2.bin /some/x_file_part3.bin /some/x_file_part4.bin /some/x_file_part5.bin ... /some/x_file_part10.bin basically, can have 3 types of files. first type simple ones, have .bin extension. second type of file 1 formed _x1.bin till _x5.bin . , third type of file can formed of 10 smaller parts, _part1 till _part10 . know naming may strange, have work :) i want group files ( pieces of file should processed ), , thinking of using parallel arrays this. thing i'm not sure how can perform reduce/acumulation part, since threads working on same array. val allbinfiles = allbins.toarray // array of java.io.file i thinking of handling that: val mapacumulator =

patch - SVN rebase branch from trunk -

hallo all. have java project using svn scm. have trunk line have production_line , branches next releases. when found bug in production fix on trunk , release software. take fix on branches without closing them. possibile? kind regards massimo if need fix in development branches, merge fix using: svn merge -rxxx:yyy <path_to_trunk> where xxx revision prior fixes , yyy last of fix commits. usually should not need because development branches contain changes going merged trunk has fix.

bug tracking - How to file a Bug on issues found in code review using ReviewBoard? -

we start using http://www.reviewboard.org/ . possible bugs filed in addition comments on issues? according review board manual , possible submit issues on review itself, have not found indication 1 can submit defect defect tracking system while conducting code review.

Drop-Down List Enum ASP.NET MVC Using AttributeDescription Field -

based on post: how create dropdownlist enum in asp.net mvc? i want exact same thing, except using attributedescription field enum, example: [descriptionattribute("1 star")] onestar = 1, [descriptionattribute("2 stars")] twostar = 2, [descriptionattribute("3 stars")] threestar = 3, [descriptionattribute("4 stars")] fourstar = 4 the solution given in prior link show "onestar" in text field of drop down, whereas i'd want see "1 star". i've seen few posts relating this, solutions quite verbose. you may try among lines: public static selectlist toselectlist<tenum>(this tenum enumobj) { var enumtype = typeof(tenum); var fields = enumtype.getfields( bindingflags.static | bindingflags.getfield | bindingflags.public ); var values = enum.getvalues(enumtype).oftype<tenum>(); var items = value in values field in fields let descriptionattribute =

Android image scaling in the Gallery -

i have 2 images in gallery view. first add 80x80 image, , bigger 1 (400x400). want both images displayed 80x80 match size of first image. if hardcode size image.setlayoutparams(new gallery.layoutparams(80, 80)); image.setscaletype(imageview.scaletype.center_inside); all goes ok. if try evade hardcoding in case first image changed image.setlayoutparams(new gallery.layoutparams(layoutparams.wrap_content, layoutparams.match_parent)); image.setscaletype(imageview.scaletype.center_inside); the big image displayed 400x80, , not scaled: central slice of visible. how can make images in gallery scaled match size of first added image without specifying size directly? try image.setlayoutparams(new gallery.layoutparams(layoutparams.match_parent, layoutparams.match_parent)); image.setscaletype(imageview.scaletype.center_inside);

dojo - When declaratively creating a dojox.grid.DataGrid - how to specify nested data in the field attribute? -

i'm creating dojox.grid.datagrid in dojo 1.6 following notation: <table dojotype="dojox.grid.datagrid"> <thead> <tr> <th field="id">id</th> <th field="contact.name">name</th> <th field="contact.tel">telephone</th> <th field="contact.birthdate.time">birthday</th> </tr> </thead> </table> the data looks this: [{ 'id':1, 'contact':{ 'name':'doh', 'firstname':'john', 'tel':'123-123456', 'birthdate':{ 'javaclass':'java.sql.timestamp', 'time':1234567893434}} }] id rendered corectly, others render "...". have tried specify formatter, setting base object "contact" field , returning field.name example. works in far correct value displayed, sorting uses base object. i think there m

c# - Fill DataTable from LinqDataSource -

how obtain datatable linqdatasource? i have found datatableextensions.copytodatatable() method, can't work out how use linqdatasource. you can do ienumerable<datarow> query = ...; datatable.datasource = query.copytodatatable<datarow>();

SQL Server: select without order -

i using where in condition in sql server. want result without order, because gave list 'where in' condition. for example select * blabla column in ('03.01.ko61.01410', '03.02.a081.15002', '03.02.a081.15016', '03.02.a081.15003', '02.03.a081.57105') how can do? due experience, sql server randomly order result set where-in clause if not specify how order it. so, if want order where-in conditions, must define data item order passed. otherwise, sql server randomly order resultset.

gcc - Disabling system calls in C++ -

is possible disable system calls when compiling c++ code? , if is, how that? and extend question bit. wish make program not able interact operating system, except file reading , writing. possible this? edit: not able interact os, mean not able change in os, creating, editing or deleting something. main concern system calls, in cases intended harmful. this grading programs, running other people code. programs solve various algorithmic problems, there no need advanced features. basic (more or less) stl usage , classic code. there no external libraries (like boost or that) or multiple files. yes, it's possible. take @ source code geordi see how it. geordi irc bot compiles, links , runs c++ code under environment system calls disabled.

java - Problem gzipping HttpPost body using Apache Client 4.1.1 -

i need send httppost body gzipped, server accepts non gzipped data prefer gzipped, im trying convert existing workign code use gzip data set with httpmethod.setentity(new urlencodedformentity(namevaluepairs)); ive tried sublclassing httpentitywrapper static class gzipwrapper extends httpentitywrapper { public gzipwrapper(httpentity wrapped) { super(wrapped); } public void writeto(outputstream outstream) throws ioexception { gzipoutputstream gzip = new gzipoutputstream(outstream); super.writeto(gzip); } } and changed httpmethod.setentity(new gzipwrapper( new urlencodedformentity(namevaluepairs))); and added if (!httpmethod.containsheader("accept-encoding")) { httpmethod.addheader("accept-encoding", "gzip"); } but request time outs think there must wrong gzipwrapper im not sure what. on note looked @ http://hc.apache.org/httpcomponents-clien

scala - How to generate transitive closure of set of tuples? -

what best way generate transitive closure of set of tuples? example: input set((1, 2), (2, 3), (3, 4), (5, 0)) output set((1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4), (5, 0)) //one transitive step def addtransitive[a, b](s: set[(a, b)]) = { s ++ (for ((x1, y1) <- s; (x2, y2) <- s if y1 == x2) yield (x1, y2)) } //repeat until don't bigger set def transitiveclosure[a,b](s:set[(a,b)]):set[(a,b)] = { val t = addtransitive(s) if (t.size == s.size) s else transitiveclosure(t) } println(transitiveclosure(set((1,2), (2,3), (3,4)))) this not efficient implementation, simple.

asp.net mvc 2 forward request -

how can forward request controller url in app have route defined for? thanks -- mb redirecttoroute or redirecttoaction should trick.

java - Comparable type Sorting in a Vector int or String -

in trying sort out intv , stringv using getsmallestvalue method. tried different ideas not seems working. have bright ideas how implement getsmallestvalue method? public class test { public static comparable getsmallestvalue(vector<comparable> a) { comparator com = collections.reverseorder(); collections.sort(a, com); return (comparable) a; } public static void main(string[] args) { vector<comparable> intv = new vector<comparable>(); intv.add(new integer(-1)); intv.add(new integer(56)); intv.add(new integer(-100)); int smallestint = (integer) getsmallestvalue(intv); system.out.println(smallestint); vector<comparable> stringv = new vector<comparable>(); stringv.add("testing"); stringv.add("pti"); stringv.add("semestergoes"); string smalleststring = (string) getsmallestvalue(stringv); sys

c# - Look for words in strings with LINQ -

c# or vb.net suggestion welcome. i have following code: dim sometext = "stack on flow community" dim someword = "over community" if sometext.contains(someword) response.write("word found.") else response.write("no word found.") end if function contains looks next words left right. sometext.contains("over stack") returns false sometext.contains("stack community") returns false i want of these return true long there words exist in string. is there existing function cover case regardless of words position in string? words.split(' ').any(sometext.contains)

ruby - understand self for attr_accessor class method -

class test class << self attr_accessor :some def set_some puts self.inspect = 'some_data' end def get_some puts self.inspect end end end test.set_some => test puts test.get_some.inspect => test nil here above find self test not returning some_data output. but while modified in following way returns expected output class test class << self attr_accessor :some def set_some puts self.inspect self.some = 'some_data' end def get_some puts self.inspect self.some end end end test.set_some => test puts test.get_some.inspect => test some_data what differences? edit now in first example if set some method as test.some = 'new_data' puts test.some.inspect #=> new_data test.set_some puts test.get_some.inspect => new_data now made me more confused. some = :foo makes ruby think should create new local variable name so

oracle - Not able to execute sql query -

select tt.threshold_id (select sum(amount) on (partition tt.threshold_type order tt.threshold_type ) amt cash_transactions) cash, thresholds tt tt.threshold_amount < cash.amt the rdms involved oracle error " ora-00904: "tt"."threshold_type": invalid identifier" what want query : threshold table contains column threshold type contain column name of cash transactions table and each record threshold table need compare sum(amount) group threshold type cash transactions table . and amount fetched compared threshold_amount of the threshold table and need select threshold_id thresholds table: threshold_id threshold_type threshold_amount ============================================================ threshold_1 p_id 450 threshold_2 p_id,to_acc_main_num 100 cash transactions table: tran_inst_id p_id amount to_acc_mai

html - Float 2 columns e.g .col but remove margin from 1 of them? -

if have container 820px wide , want float 2 columns within styles below how can remove margin second column? <style> #container{ width: 820px; } .col{ float: left; width: 400px; margin-right: 20px; } </style> you use .col:last-child browser support isn't :first-child ( :last-child css3 selector). so try this... .col { float: left; width: 400px; } .col:first-child { margin-right: 20px; }

cocoa touch - UINavigationController with TTNavigator -

i using uinavigationcontroller in appdelegate basis views , using ttnavgitor antother flow starting tttableviewcontroller. when use ttnavigator reason have 2 problems: after choose 1 of rows there no button in viewcontroller loaded the transition not animated when selecting row in table i using basis of three20 examples: - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { if (self = [super initwithnibname:nibnameornil bundle:nibbundleornil]) { self.title = @"settings"; self.navigationitem.backbarbuttonitem = [[[uibarbuttonitem alloc] initwithtitle:@"settings" style:uibarbuttonitemstylebordered target:nil action:nil] autorelease]; self.tableviewstyle = uitableviewstylegrouped; ttnavigator* navigator = [ttnavigator navigator]; navigator.supportsshaketoreload = yes; navigator.persistencemode = ttnavigatorpersistencemode

c# - Need advice on referencing a Managed COM Server (EXE) from Client Application -

i have managed com out of process server exe in c# exposing application object model automation working fine. can access unmanaged code (for example, vc++) , starts out of proc server , every works through com, using type library created server exe. when try , managed code, c# client application, reference server exe, loads server in-process client application. how can work managed code , run has out of process server in own process? what trying expose application object model in com on application can automated used unmanaged code , managed code, similar how microsoft office. works fine under unmanaged code through com, trying same managed code instantiates object in-process. c# example: myapp.application app = new myapp.application(); would instantiate object want start out of process com server well. missing here, wondering if has advice on or look. i found answer in this article: regardless of whether implementation .net assembly class library dll

java - Node.getTextContent() is undefined in Node -

in project facing problem stating the method gettextcontent() undefined type node i using jdk 1.5, can tell me about. if getting problem in eclipse , tested solution be: java build path → order , export , select jre system library , move top

iphone - How to a clickable url / email / phone number on UITextView -

i receiving server response sting can contain url or email address or phone number ie same string can have 3 of them or 1 number , couple of url. nothing fixed. i using uitextview show sting on device. want these url/email/phone number show hyperlink , on clicking these hyperlink user should able see webpage if url, draft , send email if email address or call number when clicked on number hyper link can suggest me way this. or suggest other data view used can make things easy set data detector types of uitextview . there number of options: uidatadetectortypephonenumber uidatadetectortypelink uidatadetectortypeaddress uidatadetectortypecalendarevent uidatadetectortypenone uidatadetectortypeall so, in case, you'd do: self.mytextview.datadetectortypes = uidatadetectortypeall;

iphone - white screen before MPMoviePlayerViewController -

i streaming video server, works using mpmovieplayerviewcontroller . but problem if size of video big white screen show before mpmovieplayerviewcontroller connects , starts playing video. annoying, , have no clue how fix it. code using play video: nsstring *videourlstring = @"http://serveradress/test/videotest/starwars.mp4"; nsurl *videourl = [nsurl urlwithstring:videourlstring]; mpmovieplayerviewcontroller *movieplayerview = [[[mpmovieplayerviewcontroller alloc] initwithcontenturl:videourl] autorelease]; [self presentmovieplayerviewcontrolleranimated:movieplayerview]; try this: movieplayerview.view.backgroundcolor = [uicolor blackcolor]; resource: mpmovieplayercontroller shows blank white screen before launch?

c# - Starting internet explorer in open tab -

if system.diagnostics.process.start("iexplore.exe", url); opens new browser session, how open new browser window in existing version of internet explorer? thanks try process.start(url) open new tab if browser running, otherwise open default browser , shows page.

finite automata - Advantages/Disadvantages of NFA over DFA and vice versa -

what relative pro's , con's of both dfa's , nfa's when compared each other? i know dfa's easier implement nfa's , nfa's slower arrive @ accept state dfa's there other explicit, known advantages/disadvantages? the advantage of nfa's on dfa's property, "choose right path". since cannot in algorithm "choose right path", conversion nfa dfa works, creating dfa states symbolize multiple nfa states. thus, when nfa in state , has choice go a,b or c next state in dfa {a,b,c}. this explains advantages , disadvantages: dfa's can implemented easier since next state determined function. nfa's allow user easier express want, because nfa can choose between many path's.

c - What is a file with extension .a? -

i downloaded this: https://github.com/mongodb/mongo-c-driver and i'm trying use inside c program, don't know generated .a files. they? couldn't find info, not in gcc manual. and built so: scons --c99 also, can use c99 libraries c89 program? .a files static libraries typically generated archive tool . include header files associated static library , link library when compiling.

rename the cobertura.ser file in tomcat/bin when i deployed my web application in tomcat -

i deploed web application instrumented cobertura through war file in tomcat 6,it works well! in th path tomcat/bin found d:/dev/../module1/target/cobertura/cobertura.ser,normal according me. want know,how can rename file(d:/dev/../module1/target/cobertura/cobertura.ser) cobertura.ser automatically when deploy web application ps:my web app multi modules web app. answers!

java - Android upload - phone lagging -

hello i'm using class upload image. problem phone stops untill file uploaded. example image large 1.5mb , phone 'freezes' 10~20 seconds depends of internet speed. it's not slowest mobile, guess problem in script. package com.project; import java.io.datainputstream; import java.io.dataoutputstream; import java.io.file; import java.io.fileinputstream; import java.net.httpurlconnection; import java.net.url; import android.app.activity; import android.content.sharedpreferences; import android.os.bundle; import android.util.log; public class upload extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.post); } } class uploadclass { string pathtoourfile; string getid; boolean uploadfile() { httpurlconnection connection = null; dataoutputstream outputstream = null; datainputstream inputstream = null;

java - ANT creating a WAR file and excluding a word -

when building war file want exclude files have word "test" in them. there way exclude files in 1 exclude tag? yes, using in <fileset> : <exclude name="**/*test*"/> in fact, first example in ant manual <fileset> .

php - Configuring subdomains in Eclipse PDT & xDebug -

i'm trying set local environment developing , testing existing php application. i've chosen eclipse pdt ide , xdebug debugging module. when testing individual files on server's document root, things work perfectly. however, folders in project need resolve subdomains when running debugger: /index.php -> hostname/index.php /control/index.php -> control.hostname/index.php /support/a/b.php -> support.hostname/a/b.php is there way accomplish kind of set up? i've tried using path mappings under php server settings, doesn't seem affect url eclipse generates when start debugging. many thanks! you need setup 1 webserver per subdomain , path mapping according it. start debug session fitting webserver setting then.

android - types of decoder for xml -

This summary is not available. Please click here to view the post.

php - Attach JQuery Autocomplete to a text field which is loaded by Ajax call -

i have simple web application in have created wizard, each wizard page contains different form fields populated database, user presses next page data retrieved server using ajax call. here code of page retrieved server against ajax call. making simple understand.. function printadalertwizardstep($step) { switch($step) { case 1: //step of wizard, first step print "welcome alert wizard,..."; break; case 2: //second step of wizard contains text field want attach autocomplete list. ?> <table> <tr> <td>keywords</td> <td><!-- text field want attach autocomplete --> <input id="nalertkw" name="nalertkw" size="10" type="text"> </td> </tr> </table> <?php break; } } } a

CakePHP Form Helper input date -

i have following code in view: $this->form->input('born'); which date field , i'm see if possible have different empty text each select box like: [month |v][day |v][year |v]. has come across doing this? appreciated. you can this: echo $this->form->input('born', array( 'label' => 'date of birth', 'dateformat' => 'dmy', 'minyear' => date('y') - 70, 'maxyear' => date('y') - 18 )); they dropdowns not empty text fields. can read more form helper , automagic forms here: http://book.cakephp.org/#!/view/1390/automagic-form-elements

ruby - Generate Unique Random String With Letters And Numbers In Lower Case -

how can fix code generates unique random letters , numbers in lower case? api_string = (0...32).map{65.+(rand(25)).chr}.join at moment, generates letters. if using ruby 1.9.2 can use securerandom: irb(main):001:0> require 'securerandom' => true irb(main):002:0> securerandom.hex(13) => "5bbf194bcf8740ae8c9ce49e97" irb(main):003:0> securerandom.hex(15) => "d2413503a9618bacfdb1745eafdb0f" irb(main):004:0> securerandom.hex(32) => "432e0a359bbf3669e6da610d57ea5d0cd9e2fceb93e7f7989305d89e31073690"

android - best practice for UI management in app with omnipresent tabbar -

i'm working on android app having visible tabbar. however, each tab potentially contains many nested "screens". of course back-button needs handle correctly. i've spent of day finding out what's best architecture achieve this. there several similar questions on stackoverflow, couldn't find answer working me. 2 proposals found , tried out: switch view, see here work activitygroup, see here another approach thought implement "screens" normal activities , have them have own tabbar (but looking same, user doesn't change). i've seen should possible without redundant code using include statement in layout xml , maybe create common base class "customactivity" configures tabbar. however since i'm not yet experienced android, wanted ask here before spending more time try , error style. approach makes sense? if not, better solution? btw: proposals mentioned above didn't work me because neither button worked me.

google maps api 3 - the anchor by default -

by default, anchor of icon created markerimage located along center point of bottom of icon. how indicate want use default value ? var icon= new g.markerimage('images/house.png', new g.size(32, 32), new g.point(0,0), new g.point(16, 32)); or var icon= new g.markerimage('images/house.png', new g.size(32, 32), new g.point(0,0), ); the anchor point optional can choose specify in constructor or not. you. either way should work.

.net - Gzip a directory that has subdirectories using GZipStream class with C#? -

this msdn site has example gzip file. then, how can gzip whole directory sub directories in it? since gzip works on files, suggest tar directory , gzip generated tar file. you can use tar-cs or sharpziplib generate tar file.

Prevent multiple POST in asp.net mvc application -

how prevent user posting same data action multiple times if keep clicking submit button? i know in php, there way prevent multiple submission, not see asp.net mvc. there any? you disable submit button using javascript. example jquery: $(function() { $('form').submit(function() { $('#idofsubmitbutton').attr('disabled', 'disabled'); }); }); note might not 100% reliable example user have javascript disabled or worse: have malicious intents , automate http post requests.

best api for develop with maps web application google-maps vs bing-maps -

i'm need develop , web application uses maps, , have 2 option in reach goal. google maps or bing maps, concern it's witch it's better documentation it's important implementation web application develop in .net fast learning curve i need recommendations because point of view both completed tools solve problem. thanks i recommend google maps. fabulous documentation code playground very fast learning curve with new v3 api don't need api key cheers

java - UTF-8Characters not displayed correctly in -

we working on project school, project mandatory tri-lingual (dutch, english , french) , answer "change english not do". all our classes , resource files encoded in utf-8 format, , alle non-standar english characters diplayed correctly in classes themself. the problem once try display our text, alle non-standard english characters distorted. we hear alot due encoding issue, sincerly doubt that, since our whole project encode in utf-8. here extract french resource bundle: videosettings = réglages du vidéo soundsettings = réglages du son keybindsettings = keybind paramètres languagesettings = paramètres de langue difficultysettings = paramètres de difficulté exitsettings = sortie les paramètres and results in these following displayed strings. display result provided resourcebundle extract i gratefull solution problem edit for info building desktop app using swing. you didn't show code, read resource files. if use propertyresourcebundle input

Rails 2.3+Rake: monkey patch method of class used in rake task -

how monkey patch method of class used in rake task? in particular want redefine method synthesis::assetpackage#compress_js of asset:packager plugin. tried place redefinition in rakefile in rails_root , didn't work. i'd rather not change plugin directly. you have redefine after synthesis gets loaded. guess app's rake tasks (rails.root/lib/tasks/*.rake) loaded after plugins, try moving monkey-patch there. in general, shouldn't modify rails app's rakefile directly anyway; put custom rake tasks or other customizations lib/tasks/*.rake.

ssh - DSA vs RSA: how can you tell -

does have tool use in order differentiate rsa public key vs dsa public key? have 2 ssh .pub files , need know if they're rsa or dsa. as noted in other answer, since file in ssh.com format, can convert openssh format , open file check ssh-dsa or ssh-rsa : to convert ssh.com key openssh format use: ssh-keygen -i -f ssh_key.pub ssh-keygen manpage -i option read unencrypted private (or public) key file in ssh2-compatible format , print openssh compatible private (or public) key stdout. ssh-keygen reads `secsh public key file format'. option allows importing keys several commercial ssh implementations. -f specifies filename of key file. source: http://landru.uwaterloo.ca/cgi-bin/wiki.pl?openssh_-_ssh.com_interoperability

android - Problems while trying to see the route between two locations using Google Maps -

i'm using background thread read sqlite database gps data...and store in geopoints.....after finish reading data wanna use intent in order see route described data. here code: protected list<geopoint> doinbackground(dbadapter... db) { try { db[0].opendatabase(); cursor c = db[0].getalldata(); if (c.movetofirst()) { { longitude = integer.parseint(c.getstring(0)); latitude = integer.parseint(c.getstring(1)); p = new geopoint(latitude, longitude); geopointsarray.add(p); } while (c.movetonext()); } c.close(); db[0].close(); } catch (exception e) { log.d("eroare", "doinbackground", e); } return geopointsarray; } protected void onpostexecute(list<geopoint> geopointsarray) { int = geopointsarray.size(); srcplace = geopointsarray.get(1); destplace = geopointsarray.get(i); in

Python bytearray ignoring encoding? -

i've got chunk of code reads binary data off string buffer ( stringio object), , tries convert bytearray object, it's throwing errors when value greater 127, ascii encoding can't handle, when i'm trying override it: file = open(filename, 'r+b') file.seek(offset) chunk = file.read(length) chunk = zlib.decompress(chunk) chunk = stringio(chunk) d = bytearray(chunk.read(10), encoding="iso8859-1", errors="replace") running code gives me: d = bytearray(chunk.read(10), encoding="iso8859-1", errors="replace") unicodedecodeerror: 'ascii' codec can't decode byte 0xf0 in position 3: ordinal not in range(128) obviously 240 (decimal of 0xf0) can't fit in ascii encoding range, that's why i'm explicitly setting encoding. seems ignoring it. when converting string encoding, original encoding taken ascii if str or unicode if unicode object. when creating bytearray , encoding parameter re

c++ - Errors while compiling MPI -

i trying compile code in c++ using code : https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2 . i use following command compile: mpiicpc -o <filename> xxxx.cc -lmpi after compile, errors seem refer 2 functions have defined in source code print output values , mpi isend , mpi irecv. specifically, 2 types of errors error: identifier "variable" undefined error: few arguments in function call: mpi_isend/mpi_irecv , mpi waitall(); finally, exists message: compilation aborted xxxx.cc (code 2). could please point must doing wrong while defining variables? here excerpt of source code (the code in entirety available @ https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2 ): int main (int argc, char *argv[]) { int my_rank; int p; int source; int dest; int tag = 0; //allocating memory double *a = new double[rows*sizeof(double)]; double *b = new double[rows*sizeof(double)]; .... .... ....

html - Weird CSS issue -

i've been having weird css issue trying repeat image header , reason not working, here code, doing wrong? body { background:url(images/bg.png) repeat 0% 0%; font-family: 'helvetica neue', arial, verdana, sans-serif; margin: 0; padding: 0; } /* part not working showing header in original size trying make repeat*/ #header { width: 100%; background: url(header.png) repeat-x; height:44px; } html: <div id="wrap"> <div id="header"> </div> </div> it's path. header.png in same path css document? if not, use relative pathing, ex: width: 100%; background: url(../header.png) repeat-x; height:44px; add ../ each sub folder in image lies.

detect url tags site.com/page.php#anycontent -

how can identify type of tags eg: site.com/file.php#inbox or site.com/another.php#spam like gmail.. detect #inbox #spam #mycontent i try $_server['request_uri'] not work... the hash part (everything after , including # character) not sent server. client side (javascript) can read , use it. the hash property can requested javascript location objects: location.hash . if want pass data page, use parameters: page.php?key=value in php, can use $_get['key'] retrieve value .

java - Big list of events in GWT EventBus -

in examples provided google web toolkit adding event handlers in 1 class whole application. as in - module1, 2 , 3 events registered in main appcontroller class. find bit monolithic , not better when using mvp pattern declare method called bind() in each of presenters follows: public class mytestpresenter implements presenter{ private void bind() { testevent.eventbus.addhandler(testevent.type, new testeventhandlerimpl() ) } } public class testevent { public static simpleeventbus eventbus = new simpleeventbus() } query is: if our application huge - using 1 eventbus populate more thousand events in - or design in such way have separate instances of event bus each module?. any cost of keeping static event bus field. better design give it's instance classes - passing around classes through constructor each presenter class having it's reference seems bit of clutter ... what activity , places in gwt when comes event handling? - can