Posts

Showing posts from January, 2013

Java md5, the PHP way -

i have been working on hours, can't work. basically developing rest client in java rest server in php. both client , server have compute md5 of string , server compare them authentication (kinda). on server, php code is: md5("gettokenapi_keybf8ddfs845jhre980543jhsjfro93fd8capi_ver1tokeniud9er£jdfff"); that generates: 4d7b2e42c3dfd11de3e77b9fe2211b87 nice! here code client: import java.security.*; .... string s = "gettokenapi_keybf8ddfs845jhre980543jhsjfro93fd8capi_ver1tokeniud9er£jdfff"; byte[] bytesofmessage = s.getbytes("utf-8"); messagedigest md = messagedigest.getinstance("md5"); byte[] thedigest = md.digest(bytesofmessage); system.out.println("string2: " + thedigest); system.out.println("string3: " + new string(thedigest)); that generates: string2: [b@42e816 string3: m{.b�����{��!� how can java compute md5 sum same way php does, please? thanks, dan give try: public ...

How to get the formula cell value(data) using apache poi -

i using apache poi3.5 , java 1.6 application. here, have 1 problem using formula... my cell has formula(sheet2!c10) , data inside cell string type...how access cell want display formula. my cell has formula(sheet2!c11) , data inside cell number type...how access cell want display formula. my cell has formula(sheet2!c10) , data inside cell date type...how access cell , want display formula. for formula cell, using poi3.8. workbook xlsworkbook = null; cell cell = null; formulaevaluator formulaeval = xlsworkbook.getcreationhelper().createformulaevaluator(); string value=formulaeval.evaluate(cell).formatasstring();

many to many - List object properties delimited by comma in CodeIgniter with DataMapper OverZealous Edition -

i have 2 classes - students , groups many-to-many relationship. on student page, want show details , list groups belongs to, delimited comma. students controller: class students extends controller { function __construct() { parent::__construct(); } function index() { $this->get_all_students(); } function get_all_students() { $s = new student(); $data['students'] = $s->select('id, name, email')->get(); $this->load->view('students', $data); } function view($id) { $s = new student(); $s->get_by_id($id); $s->groups->get(); $data['student'] = $s; $this->load->view('student_view', $data); } } i can student's details in student_view: name: <?php echo $student->name; ?> e-mail: <?php echo $student->email; ?> groups: <?php foreach ($student->groups $group) : ?> <?php echo anchor("/groups/$gro...

Android text clipping problem with EditView inside a TableLayout -

Image
i've got small clipping problem haven't been able solve using edittext view in tablerow. whatever try, edittext view either clipped (attached screenshot), or, if set shrinkcolumns either 0 or 1, label text disappears (and edittext view takes whole width). layout follows: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="10dip"> <tablelayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <tablerow android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:paddingright="10dip" android:layout_...

web applications - How to graph mixed data series with total 500k points -

i need draw graph of response time of various requests webapp. have parsed access logs application produce data file in following format: datetime,responsetime,requesttype for example: 09/nov/2010:21:00:00,0.002,event 09/nov/2010:21:00:01,0.040,action my data file has 500k lines different request types mixed up. lines ordered time. what best tool drawing 500k points on 1 graph line per request type, time along x axis , response time along y axis? in end wrote java program parse data fewer data points graph in excel. code specific particular use case won't bother paste in here.

Tutorial To learn about java mobile application development -

i want develop java mobile applications.i not find best tutorial.can 1 guide me best , easiest tutorial. thanks in advance . j2me 1. http://www.j2meforums.com/wiki/index.php/tutorials 2. http://www.java2s.com/tutorial/java/0430_ j2me/catalog0430 _j2me.htm 3. http://developers.sun.com/mobility/learn/midp/getstart/

Generate Excel Spreadsheet from CSV (ASP.NET C#) -

possible duplicate: create excel (.xls , .xlsx) file c# i have code generates zip file contains multiple csv files , streams user (no file saved on server). however, want create excel workbook instead (can traditional xls or office open xml xlsx format) each csv 'file' being spreadsheet. how can this, without resorting office automation on server or commercial 3rd party component? you can use oledb generate simple tables in excel files. note need generate temp file on server. example . note example incorrect , needs use oledbconnectionstringbuilder , this: oledbconnectionstringbuilder builder = new oledbconnectionstringbuilder(); if (isopenxml) builder.provider = "microsoft.ace.oledb.12.0"; else builder.provider = "microsoft.jet.oledb.4.0"; builder.datasource = filename; builder["extended properties"] = "extended properties=\"excel 8.0;hdr=yes;\"" using (var con = new oledbconnecti...

WPF: How to implement joystick as alternative input device (C#) -

i'm working on simple point-and-click game young children. because children have physical limitation give them possibility use joystick alternative input device. can give me advice, tips or sample c# (or vb.net) code on how implement this? i rather not use directx think overkill type of game. thanks! update: i read of information on given links. tried directinput vs 2010, error reference cannot found. searched net solution, on many places read directx obsolete , should use xna. information find xna windows phone , xbox. on microsoft xna developer center if want develop windows have use directx , brings me square one! can me on track? want use joystick in windows wpf application , i'm using vs 2010 c#. thanks. using directinput library, can read input joystick. not have use directx render output, using input. some handy links: coding 4 fun from msdn

java - Multiple Uploads of unknown number of files to S3 with JetS3t -

from sample code examples of jets3t code follows: if don't know number of files downloaded beginning? e.g application thumbnails in s3, , client application user scrolls through list of thumbnails. download objects local files the multi-threading services provide method download multiple objects @ time, use must first prepare somewhere put data associated each object. obvious place put data file, let's go through example of downloading object data files. download our objects files first must create downloadpackage class each object. class simple container merely associates object file, object's data written. create downloadpackage each object, associate object output file. downloadpackage[] downloadpackages = new downloadpackage[5]; downloadpackages[0] = new downloadpackage(objects[0], new file(objects[0].getkey())); downloadpackages[1] = new downloadpackage(objects[1], new file(objects[1].getkey())); downloadpackages[2] = new downloadpac...

c++ - How to use libavcodec in Qt4? -

how use libavcodec in qt4 access individual video frames? after verifying video stream can decoded libavcodec compiling this example , moved source code c++ program. av_open_input_file() unable open video file (returning errorcode: -2). the call looks right now: ... // register formats , codecs avcodec_register_all(); // open video file qstring videofilename("/absolute/path/to/video.avi"); // somewhere else in application const char* filename = videofilename.tostdstring().c_str(); int err = 0; if((err = av_open_input_file(&pformatctx, filename, null, 0, null)) != 0) { doerrorhandling(err, filename); // err = -2 } when @ const char* filename inside debugger looks correct. making basic mistake in mixing c , c++ code (for first attempt dumped code example constructor of class)? note : in order application compile include headers this: extern "c" { #define __stdc_constant_macros // uint64_c #include <libavcodec/avcodec.h> #include <li...

LinQ to XML; query descendants using parent node value -

hi have following xml structure: <root> <persons> <personlist category="employee"> <person name="john" id="5" /> <person name="mary" id="10" /> </personlist> </persons> </root> i looking use linqtoxml , in order list of available person can write query: var persons = p in mydoc.descendants("person") select p; now, have in order person where category in personlist element = specific value? can't use parent because need specify personlist element structure of xml may different 1 not element name. possible? it sounds you're looking for var people = mydoc.descendants("personlist") .where(p => p.attribute("category").value == something) .descendants("person"); if want category of specific <person> element, can write var category = elem.ancestorsandself("pe...

c# - Getting "Internal .Net Framework Data Provider error 30" error when column has NULL value -

i have simple .net console program uses odbcdatareader fetch rows advantage local server. using system dsn defined via odbc administrator on windows 7. data source uses advantage streamlinesql odbc driver v 10.00.00.03 , following params: database path: table type: advantage available server types: local server (als) the program works fine until encounters row has null value in column. exception: system.invalidoperationexception caught message=internal .net framework data provider error 30. source=system.data stacktrace: @ system.data.providerbase.dbbuffer.validate(int32 offset, int32 count) @ system.data.providerbase.dbbuffer.ptrtostringuni(int32 offset, int32 length) @ system.data.odbc.odbcdatareader.internalgetstring(int32 i) @ system.data.odbc.odbcdatareader.getvalue(int32 i, typemap typemap) @ system.data.odbc.odbcdatareader.getvalue(int32 i) @ system.data.odbc.odbcdatareader.isdbnull(int32 i) @ odbctest.program....

linux - Shell scripting for login -

is there way login machine specifying password in script itself?? ssh-keygen wont work me need specify in script #!/bin/sh ssh root@201.1.192.21 mysqldump -uroot -pxxxxxx > backup/a.sql you can use expect .

windows xp - How to wrap words/lines in NetBeans IDE 6.9.1? -

i searched "wrap" in keyboard mappings without success. don't see option in menu neither. edit: thinking result let's in notepad2 pressing ctrl+w (or selecting view -> word wrap). i'am asking toggling such word wrap are talking "soft wrapping"? is, there no line breaks inserted text file, each line wrapped fit in editor window? netbeans doesn't support that. hard believe, know. think might coming in 7.0 version, i'm not sure.

python - Rewrite this loop function with range -

is possible rewrite loop: for k,n in [[aa,1],[ab,2], [ac,3], [ad,4], [ba,5], [bb,6], [bc,7], [bd,8], [ca,9],[cb,10],[cc,12],[cd,13],[da,14],[db,15],[dc,16],[dd,17],...zd,220]]: with 2 range functions or "list multiplication"? have tried sorts of approaches, none worked far. thank you. if have objects in list quite simple: object_list = [aa, ab, ... ] n, k in enumerate( object_list, start=1): ... so should way put them in list instead.

javascript - What is the difference between x++ and ++x -

possible duplicate: incrementing in c++ - when use x++ or ++x? what difference between x++ , ++x ? x++ executes statement , increments value. ++x increments value , executes statement. var x = 1; var y = x++; // y = 1, x = 2 var z = ++x; // z = 3, x = 3

cocoa - "Open With" menu for remote files -

i'm getting troubles getting applications associated remote file how has url like: "http://servername/folder/file.png". the code use is: ... nsurl *url = [nsurl fileurlwithpath:@"http://servername/folder/file.png"]; nsarray *apps = (nsarray *)lscopyapplicationurlsforurl((cfurlref) url,klsrolesall); ... i try using urlwithstring: result same. correct approach this? edit after joshua replay: sorry may bad redaction. problem lscopyapplicationurlsforurl call return nil. first, -fileurlwithpath: expects file system path @"/users/me/desktop/myfile.png" . second, don't "same" results , wrong them, it's difficult tell problem is. the docs this: if item url’s scheme file (designating either file or directory), selection of suitable applications based on designated item’s filename extension, file type, , creator signature, along role specified inrolesmask parameter; otherwise, based on url sche...

c - Recovering IP/Port from Socket Descriptor -

i'm writing a clone of inetd in must run server prints ip , port of client connecting it. as overwrite stdin , stdout socket descriptor, my initial solution recover sockaddr_in structure, contains needed information. doing getsockname() , however, returning empty structure, bits set 0. any idea of wrong approach? there other approaches can use recover ip/port? thanks as r.. pointed out, should use getpeername . both function , getsockname take file descriptor first argument, not stream pointer ( file * ). use fileno(stdin) file descriptor standard input (or hard-code stdin_fileno , it's constant). also, last argument getsockname , getpeername should pointer socklen_t , not constant, , should use sockaddr_in tcp/ip: struct sockaddr_in peeraddr; socklen_t peeraddrlen = sizeof(peeraddr); getpeername(stdin_fileno, &peeraddr, &peeraddrlen); see complete example here .

nhibernate linq: projection to DTO and columns -

i've upgraded linq provider new ast one. (nh3 on nuget) with previous provider using linq "inline projections dto" e.g. from o in session.query<myobject>() select new myobjectdto { name = o.name, subname = o.otherobject.name, sub2name = o.otherobject2.name } and generate select o.name, sn1.name, sn2.name ..... join.... join.... statement. once upgraded provider found lot of select statements being fired off. (my projected object more complex above). have come accross fetch/fetchmany, might number of queries, far can tell means full object come each flattened field require. is there way can smallest possible number of columns required projection selected, rather loading full object graph project with? thanks, chris it must usage of result (like iterating many times iqueryable), odd mappings, or complexity removed example. i tried exact query, , 1 sql statement generated.

animation - JQuery - .preventDefault() -

using code below have hide show effect applied table cells have width expanded , collapsed. problem when link clicked, text shows up, table resizes text disappears. unclicked text remain hidden throughout , not flash on screen. think might have preventdefault or return false when i've tried these has stopped table working @ after first click. not sure i'm doing wrong. as always, appreciated. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>levels of progression</title> <style> body{font-family:arial, helvetica, sans-serif; font-size:80%;} table td{vertical-align:top; padding:5px;} table td div{width:80px; overflow:hidden; display:none;} table td .togglesection1{width:200px; display:b...

c# - Dropdown gets cleared -

i have 1 asp.net application, in have 1 dropdown binded dataset. after selecting 1 item, drop down gets cleared value, how can resolve issue? this dropdown list in design page: <asp:dropdownlist id="ddlproduct" runat="server" cssclass="textentry" width="300px" autopostback="true" onselectedindexchanged="ddlproduct_selectedindexchanged"> </asp:dropdownlist> and binding code shown below. protected void page_load(object sender, eventargs e) { if (!ispostback) bindproductddl(); } private void bindproductddl() { products objproducts = new products(); dsproducts dsproduct = new dsproducts(); listitem olst = default(listitem); olst = new listitem(" select", "0"); dsproduct = objproducts.getdataset(""); ddlproduct.datasource = dsproduct; ddlproduct.datatext...

How to write parallel code with Haskell vectors? -

one 1 hand, in haskell vector a seems preferred type use array of numbers. there (incomplete) vector tutorial . on other hand, control.parallel.strategies defined in terms of traversable . vector library doesn't provide these instances. the minimal complete definition of traversable t should define foldable and traverse :: applicative f => (a -> f b) -> t -> f (t b) sequencea :: applicative f => t (f a) -> f (t a) i don't see how sequencea can defined data.vector.unboxed.vector . so, best approach writing parallel code unboxed vectors? defining new ad hoc strategies evalvector or using par , pseq explicitly or using plain data.array instead of vectors? p.s. plain array s parallelizable without problems: https://gist.github.com/701888 it's hack job parvector worked me: import qualified data.vector v import control.parallel.strategies import control.parallel import control.deepseq ack :: int -> int -> int ack 0 n = n...

c - What is this widget called in GTK? -

i wondering have gtk.textviewwidget display contents of widget. wondering there way make type of computer properties dialog box there different panels @ top , 1 can click on 1 of them display contents of property. can give me advice on how proceed making this? sounds need gtknotebook .

Nhibernate Where Condition -

i want generate condition in nhibernate below can 1 me out select id,name employee (id=@id or id null) want code generate condition. you should check out documentation here: http://nhibernate.info/doc/nh/en/index.html#querycriteria-narrowing a solution using criteria api is: session.createcriteria<employee>() .add(restrictions.eq("id", id) | restrictions.isnull(id));

Why are Map and Set aliased in scala.Predef? -

9 times out of 10, using map , set behave expect would, unexpectedly hit error: type mismatch; [info] found : scala.collection.set[string] [info] required: set[string] as example, repl: scala> case class calculator[+t](name: string, parameters: set[string]) defined class calculator scala> val binding=map.empty[string, string] binding: scala.collection.immutable.map[string,string] = map() scala> calculator("hello",binding.keyset) <console>:9: error: type mismatch; found : scala.collection.set[string] required: set[string] calculator("hello",binding.keyset) ^ i think understand error, is, function call on aliased types return actual types. and seems me solution import un-aliased types. upon every other file in project generate type mismatch errors, have import in each file. leads question ask in title -- purpose of alias in predef, if need import actual package anyway? is understandi...

sql server - Help identifying forum spammers via a SQL query? -

i have simple query can run against database return abnoralities in time threshold users post our forum. if have following database structure: threadid | userid | postauthor | postdate | 1 1000 spammer 2010-11-14 02:52:50.093 2 1000 spammer 2010-11-14 02:53:06.893 3 1000 spammer 2010-11-14 02:53:22.130 4 1000 spammer 2010-11-14 02:53:37.073 5 2000 realuser 2010-11-14 02:53:52.383 6 1000 spammer 2010-11-14 02:54:07.430 i set threshold instance, if 3 posts, same user, fall within time period of 1 minute, poster may spamming forums. in turn, return user 'spammer' in query, number of posts made within allotted time. in above example, spammer posted 4 messages within time period of 1 minute, result of query may following: userid | postauthor | postcount | datestart | dateend 1000 spammer 4 2010-11-14 02:52:50.093 2010-11-14 02:5...

emacs - A rather naff limitation of ropemacs encountered with multiple name bindings -

i getting disappointing completion , go-to-definition results ropemacs in places use multiple name-bindings same object. considering contrived , stylistically challenged example code below, know why rope not presenting completions or go-to-definition results? project code sample: from package import bigobjectwithlotsofmethods class global: variable = none big = bigobjectwithlotsofmethods() global.variable = big emacs behaviour in question: when enter: big. then type m-/ , list of candidate method names expected. hurray rope! yet on other hand when enter: global.variable. for example, , type m-/ following in emacs minibuffer: completions global.variable.: [no match] furthermore, please imagine fire() method of bigobjectwithlotsofmethods typing c-c g on code global.variable.fire() not take me definition of fire() expected rather outputs following in emacs minibuffer: cannot find definition! since global.variable represents name bindin...

javascript - clearing a input field if it is invalid -

i using validation plugin. trying figure out how clear text field, if field invalid . my javascript code follows $(document).ready(function() { $("#enrollform").validate({ rules: { email: { required: true, email: true }, vemail: { required: true, email: true, equalto: "#email" }, offer_code: { required: false, remote: "check_code.php" } } });}); i trying clear out field called offer_code if field invalid. possible in validate function? alex check out: http://docs.jquery.com/plugins/validation/valid the example: $(document).ready(function() { $("#enrollform").validate({ rules: { email: { required: true, email: true }, vemail: { required: true, email: true, equalto: "#email" }, ...

recursion - Java - recursive binary search help -

the following code how i'm trying create recursive binary method.. public static int binarysearch(comparable[] objarray, comparable item) { int lower=0; int upper=objarray.length -1; int = -1; int compareresult; boolean found = false; while ((lower<=upper) && (!found)) { i=(lower+upper)/2; compareresult=item.compareto(objarray[i]); if(compareresult<0) { upper=i-1; } else if (compareresult>0) { lower=i+1; } else { found=true; } } return compareresult; } i feel thought i'm not doing correctly...any suggestions? -d you using loop. in order method recursive, needs call until reaches breaking condition. check out wikipedia's example . essentially, "while" condition condition breaks recursion (i.e. stops method calling itself), ...

iphone - Dynamically Load Classes in Objective-C? -

is there way #import class string in objective-c @ run time? methods produce similar result welcome. edit: i want access class name determine @ runtime. this: nsstring *classname = getclassname(); class myclass = loadclass(classname); myclass *myvar = [[myclass alloc] init]; is there way without putting static #import directive myclass @ top of file? the #import directive not "import" class — inserts text named file current file. isn't useful @ runtime after source has been compiled. what want create bundle classes , dynamically load bundle . in order able talk classes core program, you'll want have common protocol bundled classes implement.

math - Why won't this small function(drawing a circle in opengl) compile in c? -

i'm doing experiments opengl in c linux. i've got following function draw circle given parameters. i've included #include <stdlib.h> #include <math.h> #include <gl/gl.h> #include <gl/glut.h> however when compile: gcc fiver.c -o fiver -lglut i get: /usr/bin/ld: /tmp/ccgdx4hw.o: undefined reference symbol 'sin@@glibc_2.2.5' /usr/bin/ld: note: 'sin@@glibc_2.2.5' defined in dso /lib64/libm.so.6 try adding linker command line /lib64/libm.so.6: not read symbols: invalid operation collect2: ld returned 1 exit status the function following: void drawcircle (int xc, int yc, int rad) { // // draw circle centered @ (xc,yc) radius rad // glbegin(gl_line_loop); // int angle; for(angle = 0; angle < 365; angle = angle+5) { double angle_radians = angle * (float)3.14159 / (float)180; float x = xc + rad * (float)cos(angle_radians); float y = yc + rad * (float)sin(angle_radians); glvertex3f(...

Problem running compiled Python script -

this question has answer here: how can executable's current directory in py2exe? 3 answers so have compiled python script py2exe according this answer . there no errors during compilation, went fine. when run script cmd this: c:\users\richard\dist\backprop3.exe 60 this output get: c:\users\richard>c:\users\richard\dist\backprop3.exe 60 traceback (most recent call last): file "backprop3.py", line 209, in <module> file "backprop3.py", line 175, in demo nameerror: global name '__file__' not defined c:\users\richard> which referring line: image = image.open( os.path.dirname( os.path.abspath( __file__ ) )+"/backprop-input.bmp" ) that line loads image current directory. problem? __file__ not work within py2exe. because module inside .exe , there nothing set __file__ give python file. see ...

How to search for Java API methods by type signature? -

are there open-source tools available support searching java methods set of parameter types , return type? as example, i'm looking method generate hash code array of ints. search method takes int[] parameter , returns int: int[] -> int yielding java.util.arrays#hashcode(int[]) ... or may want find method takes string, , character replace, , character replace with. search matching method: string, char, char -> string yielding java.lang.string#replace(char, char) ... ideally i'd java equivalent haskell's hoogle , supports searching functions type signature. i'd expect tool to: ignore order of parameters include methods accept 'wider' types parameters (e.g. superclasses) include methods return 'narrower' types return values (e.g. subclasses) treat 'self' value parameter instance methods (e.g. 'string -> int' include string#hashcode) i'm aware many ides support searching methods take or return giv...

javascript - Is there a way to call a Rails 3 function from a link_to tag, using :remote => true? -

in rails 3 app, have list of questions. each question has "question number" designates order in table/list. i'm trying implement "move up" link decrement question's number move in list (1 @ top), , increment number of question had number. i'm stuck on how call rails function, either in controller or model, question table view. ideally want like: <%= link_to 'move up', question.moveup(question.id), :remote => true, :update => "questions_table" %> but doesn't seem possible combination of "onclick", "remote_function", etc i've looked into. i've tried call function in controller url, this: <%= link_to "move up", :url => {:controller => "questions", :action => "moveup"}, :remote => true %> but keeps searching url appending edit?url[controller]=questions&url[action]=moveup not want. there straightforward way call function...

visual studio 2008 - How do I add the time to a date field in a CR report? -

Image
i've got couple of crystal reports xi release 2 reports part of com interopform's app, included in vb6 app. both of these reports display date datetime field in sql server database. they've worked fine last 3 years or so. now i've been tasked showing time portion of data. i've got both of .rpt files opened in cr 11 r 2 designer, , looking @ format editor. under date tab don't see display both date , time of data. (unless system default long format, i'm not sure of on each of users' machines. in fact, frankly don't know how check on own machine, windows xp pro machine sp3 installed.) anyway, i've taken under custom style, again don't see there allow me display time portion of datetime field database. how display both date , time, datetime field in database? you should see quite few options. if view looks attached picture, you're go. if see bunch of formats numbers, date not stored in correct format. fixed making c...

mysql - Database type and engine for medium scale user content website -

using mysql basic storage of system/user data. need store/search messages (adding webmail functionality), , have analytic (on fly reports/graphs current , historical data, kind of data wearhouse) + means need store historical data. so question is: 1) use mysql or use separate databases messages, analytics/historical data/user data? there live feeds on site heard mysql isn't with. 2) tables use mysql innodb enough or need more advanced engines tukodb? for messaging friend mentioned use non relational database instead of mysql. if use separate datbase types adds int headache of keeping them in sync , given 24-7 user content site, cant have downtime. -- website high traffic user content website, lots of reads/writes no money need depend less on servers/hardware , more on database/software keep me afloat, hence open free/open source databases , database engines. before answering question directly should concerns premature . lot of assumptions wrong before have wo...

iphone - Facebook URL User Profile Scheme -

the recent updates facebook application have broken of custom url schemes, until calling: fb://profile/12345 would open fb iphone app profile of user facebookid 12345 this however, no longer case. have been trying find out if url has been replaced different one, no luck. has clues? i can profile webpage via http://www.facebook.com/profile.php?id=1234567890 , not sure how translate iphone app. last update facebook app on friday, have been change app. here's post on update. claims compatible ios 4.1, poster claims previous versions have new bugs (so backend might have changed). http://www.facebook.com/iphone/posts/176886075659410

wpf - Adding Text inside a Shape -

i have custom wpf control myline should represent or not text in middle. public class myline : shape { public double x1, y1, x2, y2; public bool istextdisplayed; public string caption; protected override system.windows.media.geometry defininggeometry { { var geometrygroup = new geometrygroup(); if (istextdisplayed) { // calculate text point var midpoint = new point((x1 + x2) / 2.0, (y1 + y2) / 2.0); // add textblock caption text in point // ??? } // add line geometrygroup.children.add(new linegeometry( new point(x1, y1), new point(x2, y2))); return geometrygroup; } } } how should add textblock (or label) here? i tried add formattedtext inside, nok, because draws text line fat brush , impossible read something. edit adding visual child public myline() : ...

android - FrameLayout for drawing overlays in a game? Battery? -

i've got game, custom view class draws gameboard. i'm thinking of drawing elements on separate layer above gameboard. in view's canvas code, since won't change frequently, thinking of introducing frame layout display top layer: <framelayout> <linearlayout /> // game board <linearlayout background="#00000000"/> // stuff cards, other overlays. </framelayout> vs <linearlayout /> // game board, draw cards etc on every ondraw() call myself. i'm not sure route take, reason wouldn't framelayout because i'm not sure if has impact on battery life. everytime ondraw() called, system has alpha composition of 2 layers. more battery consuming drawing elements layer myself in canvas on every frame? hard answer since i'm not sure how complex drawing yet, general opinions? thanks surely alpha composition adds processor working harder. question if significant. know premature optimisation evil. the way ...

NHibernate - Only persist changes when a save/update call is made -

nhibernate auto saves changes made object regardless of whether make session.save/update call or not when committing transaction. eg. session.begintransaction(); user user = repos.getuser("tony"); user.age = 34 transaction.commit(); age updated. can annoying when want object db , make changes without changes being saved. can session.evict object, lose ability load proxies. is there way nhibernate persist changes if save/update call made? update: thanks responses, no 1 told me how (and may not possible) going leave unanswered. you should wrap db calls in transaction , commit transaction close it. i doing because there complex sorting of results isn't possible via sql/nhibernate. unfortunately nhibernate assumes want save new order db. my workaround add property transaction attribute [transaction(onlyread = true)] causes use flushmode.never i think future work make sure make changes want persist. pity there isn't option save when explicitly call...

c# - WaitAll limitation -

i heard there limitation when using waitall on multiple threads (# of threads wait?). can give details? i think restriction referring not on number of threads ; on number of handles being waited on. msdn page waithandle.waitall(waithandle[]) : on implementations, if more 64 handles passed, notsupportedexception thrown. on rare occasion issue has cropped, have worked around with: waithandle[] handles = ... foreach(var waithandle in handles) waithandle.waitone(); for completeness, other restrictions appear be: if array contains duplicates, call fails duplicatewaitobjectexception. the waitall method not supported on threads have stathreadattribute.

Java Reflection/Generic -

given following 3 classes how can use reflection call initialize function parent class(es) , subclass: public class test { public static void main(string[] args) { extendedelement ee = new extendedelement(); initialize(ee); } public static void initialize(element element) { system.out.println(element.getclass()); initialize(element.getclass()); } public static void initialize(class clazz) { system.out.println(clazz.getclass()); } } public class element { protected string value; public string getvalue() { return value; } public void setvalue(string value) { this.value = value; } } public class extendedelement extends element { protected string extendedvalue; public void setextendedvalue(string extendedvalue) { this.extendedvalue = extendedvalue; } public string getextendedvalue() { return extendedvalue; } } i'm not quite sure on how paramertize initialize function in tes...

cryptography - Windows CryptoAPI: CryptSignHash with CALG_SHA_256 and private key from MY keystore -

i trying generate digital signatures on windows (from xp sp3, testing windows 7) cryptoapi compatible following openssl commands: openssl dgst -sha256 -sign <parameters> (for signing) openssl dgst -sha256 -verify <parameters> (for validation) i want use private key windows "my" keystore signing. i managed sign files using sha1 digest algorithm using following cryptoapi functions (omitting parameters brevity): certopenstore certfindcertificateinstore cryptacquirecertificateprivatekey cryptcreatehash (with calg_sha1) crypthashdata cryptsignhash the generated signature compatible "openssl dgst -sha1 -verify" (once byte order reversed). my problem is: when try use calg_sha_256 cryptcreatehash, fails error 80090008 (nte_bad_algid). googling around , found needed use specific provider (prov_rsa_aes) instead of default one. since have provider handle, need replace cryptacquirecertificateprivatekey cryptgetuserkey. modified program like: crypta...

android - launch facebook app from other app -

how can launch facebook app app in android? to start default launcher activity: intent intent = new intent("android.intent.category.launcher"); intent.setclassname("com.facebook.katana", "com.facebook.katana.loginactivity"); startactivity(intent); i did research, because wanted find out :). found ways how start different activities easily. can not guarantee work after upgrades of facebook. tested current facebook app , works. @ least tested "adb shell" using "am start .....". basic is: string uri = "facebook://facebook.com/inbox"; intent intent = new intent(intent.action_view, uri.parse(uri)); startactivity(intent); the facebook.com part not checked. can type: "facebook://gugus.com/inbox" having same effect. how in adb. 1. start adb shell through console: "adb shell" 2. run: "am start -a android.intent.action.view -d facebook://facebook.com/inbox" this start inbox acti...

c# 3.0 - Could not authenticate with OAuth -

i using tweetsharp , trying play twitter application. @ present simple console application. i have searched in net , found articles of them stating after august 16th 2010, basic authentication twitter no longer applicable. instead oauth has come place. henceforth, have gone twitter apps , created 1 me.(since it's desktop application, choose application type client , not browser.) these various information got consumer key : nxdgjunklu65cw38ea1rt consumer secret :joomsrgpthct9hfjgqotpxsczwi5k8zkipoc1ytfo request token url : https://twitter.com/oauth/request_token access token url : https://twitter.com/oauth/access_token authorize url: https://twitter.com/oauth/authorize as basic step have planned that, write/post tweet wall. henceforth, made following(some code has been taken web using reference) string consumerkey = "nxdgjunklu65cw38ea1rt"; string consumersecret = "joomsrgpthct9hfjgqotpxsczwi5k8zkipoc1ytfo"; fluenttwitter.setcli...

How to send SMS using c# -

i want send sms using c# coding use smslib ( http://smslib.org/download/ ) you may find working codes here, had worked using java platform, , works fine. try c#. all need gsm moden,connect usb , provide proper port number in availaible code @ smslib website. download http://smslib.org/download/files/smslib.net-v3.5.0.zip you find c# herein.

qtip jqgrid selector question -

i want use qtip jqgrid , show different image depending on row selected within jqgrid. path of image within jqgrid hidden cell. have looked around can't find documentation on if jqgrid has relevant row selector used. know selector want or if should trying different approach altogether? the selector worked far below entire grid. have tried few things specify row nothing has worked. appreciated. $('#gridtable').qtip({ content: 'some text', show: 'mouseover', hide: 'mouseout', position: { corner: { target: 'topleft', tooltip: 'bottomleft' } } }); my solution place icon within each row had wine image , assign id of row. meant each row given unique class hover over. not pretty worked. if((gridrow['photo'] != "false")) { $("#gridtable2").jqgrid('setrowdata',i...

asp.net mvc - MVC Jquery Dialog: modal:true prevents the dialog from rendering -

i using mvc2 on vs2010 express edition. i have (simplified) page includes renderpartial dialog. dialog supposed pop when button clicked. however, if include modal:true 1 of dialog options, when button clicked nothing happens. dialog not pop up. when remove modal:true dialog options dialog pops expected , closed expected. please help. have sent time researching problem , can't find anything. when @ first had list several options specified dialog , not poping up, removed them 1 one find out if of them causing problem, , sure enough when removed modal dialog rendered on clicking button. adding option modal: true stopped rendering of dialog again. these in master page: <link href="<%=resolveurl("~")%>app_themes/smoothness/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" /> <%=html.script("~/scripts/jquery-1.4.2.min.js")%> <%=html.script("~/scripts/jquery-ui-1.8.2.cu...

migration - Can an MSDE 2000 database be deplolyed to SQL Server 2000? -

i developing web application using sql server 2005 database, need deploy database sql server 2000 in production environment. we don't have license sql server 2000 (we've got 2005), , i've come accross range of incompatibilites , issues when migrating db 2005 2000. i hoping switch development db on msde 2000, , depoy sql server 2000 when in production. will work? msde compatible sql server 2000? how easy migrate 1 other? simple backup , restore? yes. and simple backup , restore. caveat: sure both server , dev machine running same service pack. iirc, matter. msde have feature limitations, long aren't using features supported on full server version, should fine.

Not getting complete text while Animation on Canvas : Android, -

i want animated text in android should run left right on screen. eg. want text private static final string quote = "nobody uses java anymore. it's big heavyweight ball , chain."; running right left using animation. however, text gets truncated "nobody uses java anymore. it's" in portrait mode , "nobody uses java anymore. it's big heavyweight" in landscape mode. this code have used paint paint = new paint(); paint.setcolor(color.blue); private static final string quote = "nobody uses java anymore. it's big heavyweight ball , chain."; paint.settextsize(20); paint.setantialias(true); int len= quote.length(); canvas.scale(1,-1); canvas.drawtext(quote, 0, len-1, 100, 60, paint); canvas.drawtext(quote,0,100 , paint); createanim(canvas); private void createanim(canvas canvas) { anim2= new translateanim...

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

i'm using devexpress grid , i'm trying 'country' column display header filter properly: <dx:gridviewdatacolumn caption="country" fieldname="countryname" showincustomizationform="true" visible="false"> <settings allowheaderfilter="true"/> </dx:gridviewdatacolumn> if 'country' column set visible='true', header filter displayed should(it shows value option list). however, want 'country' column hidden, available in customization window(like in code above). in case, when column dragged outside customization window , grid , header filter clicked, javascript error encountered: element null element.addeventlistener(eventname, func, true); is known bug? there workarounds? set aspxgridview.settings.showheaderfilterbutton property true resolve problem. the following markup works fine me (i using dxperience 10.1.7): <asp:accessdatasource id="accessda...