Posts

Showing posts from 2011

smartgwt - Smart gwt window position -

how make window popup in specific location on page? don't see straightforward way of doing this, i'm using window.centerinpage() using underlying setrect() method of canvas: canvas.setrect(int left, int top, int width, int height) window.setrect(250, 100, 500 500); remember redraw needed. or, if you're using gwt window, can achieve using window.open(string url, string target, string features) method, specified here . window.open(url, "newwindow", "left=250,top=100,width=500,height=500");

select nonblank cells, filter, and copy and paste excel vba -

just title says i'm trying select cells not blank in first column select whole selection. macro loops through , counts rows int column until not blank find selection. filter. remove duplicates. copy , paste new sheet. i'm getting debug error , wondering if me out code. have: sub sum() dim countrow integer countrow = 2 until isempty(cells(countrow, 1)) countrow = countrow + 1 loop selection.autofilter activecell.select activesheet.range(cells(1, 1), cells(7, countrow)).autofilter field:=4, criteria1:="=yes*", _ operator:=xland countrow = 2 until isempty(cells(countrow, 1)) countrow = countrow + 1 loop selection.autofilter activecell.select activesheet.range(cells(1, 1), cells(7, countrow)).select selection.copy sheets.add after:=sheets(sheets.count) activesheet.paste application.cutcopymode = false activesheet.range(cells(1, 1), cells(7, countrow)).removeduplicates columns:=array(1, 7), _ header:=xlyes end sub activesheet.range(cells(1...

Look up value in Django json object -

in django view have object state_lookup = {"alabama":"al", "alaska":"ak", ... "wyoming":"wy"} how pass state name object , abbreviation in return? python dictionaries can accessed in same way lists. here example. state_lookup = {"alabama":"al", "alaska":"ak", ... "wyoming":"wy"} state = 'alabama' abbrev = state_lookup[state] # abbrev should 'al'

find - vba-excel meaning of <> (angled brackets or greater-than and less-than symbols) -

i working find functions in vba excel, when ran problems pulled example code provided in excel. took code illustrates basic find function , pasted macro. on running macro, "runtime error '91'" , debugger highlights line of code containing angled brackets <>. these part of code cannot understand. can tell me these brackets represent? sub examplefindreplace() worksheets(1).range("a1:a500") set c = .find(2, lookin:=xlvalues) if not c nothing firstaddress = c.address c.value = 5 set c = .findnext(c) loop while not c nothing , c.address <> firstaddress end if end end sub the <> operator means c.address is not equal to firstaddress . in c-style language equivalent c.address != firstaddress . side note, think getting error 91 (object variable or block variable not set.) because line of code loop while not c nothing , c.address <> firstaddress try execute second condition ( c.address ...

C# Referencing a dataSets property without using it's name -

anyone know how reference dataset example if called dataset5 , don't want use it's name. for example if use call display particular tables cell value messagebox.show(dataset5.tables[0].rows[0][0].tostring()); how can same above using indexing can throw in incrementing loop similar below doesn't work. hoping maybe it's either part of array of form elements or components way can access below. messagebox.show(datasets[24].tables[0].rows[0][0].tostring()); using sharpdevelop if want call datasets index have have array of dataset. dataset[] alldatasets = new dataset[5]; even better if put datasets in list. ie. list<dataset> listdatasets = new list<dataset>(); listdatasets.add(new dataset()); listdatasets[0].tables[0].rows[0][0].tostring();

branch - Help understanding the benefits of branching in Mercurial -

i've struggled understand how branching beneficial. can't push repo 2 heads, or 2 branches... why ever need/use them? first of all, can push 2 heads, since don't want that, default behavior prevent doing it. can, however, force push go through. now, branching, let's take simple scenario in non-distributed version control system, subversion. let's assume have colleague working in same project you. current latest changeset in subversion repository revision 100, both update locally both of have same files. ok, colleague has been working on changes couple of hours now, , commits. brings central repository revision 101. you're still on revision 100 locally, , you're still working on changes. at point, complete, , want commit, subversion won't let you. says have update first, start update process. the update process wants take changes, , pretend started revision 101 instead of 100. if changes not in conflict whatever colleague committed...

sql - query between 2 rows -

have question. i'm doing select need grab 2 rows. have value of 13000.00000. need grab both rows 2 , 3 since falls between 10000 (min range) , 15000 (min range) this statement pulls in row 2. select * table1 13000 between table1.min_range , table1.max_range; table1 row min_range max_range return_value 1 0.00000 9999.99900 1.15 2 10000.00000 14999.99900 1.25 3 15000.00000 19999.99900 1.35 4 20000.00000 24999.99900 1.14 you want first row falls below input , first row falls above input, both using min_range descriminator: select top 1 * table1 table1.min_range < @input order min_range desc union select top 1 * table1 table1.min_range >= @input order min_range; this feels solution window function, maybe can post.

Mathematica - StringMatch Elements Within a List? -

i have functions returns cases table match specific strings. once cases match strings, need search each case (which own list) specific strings , command. know how turn whole big list of lists 1 string, , 1 result (when need result each case). uc@encodetable; encodetable[id_?personnelq, f___] := cases[#, x_list /; memberq[x, s_string /; stringmatchq[ s, ("*ah*" | "*bh*" | "*gh*" | "*kf*" | "*mn*"), ignorecase -> true]], {1}] &@ cases[memoizetable["personneltable.txt"], {_, id, __}] that function returning cases table which[(stringmatchq[ tostring@ encodetable[11282], ("*bh*" | "*ah*" | "*gh*" ), ignorecase -> true]) == true, 1, (stringmatchq[ tostring@ encodetable[11282], ("*bh*" | "*ah*" | "*gh*" ), ignorecase -> true]) == false, 0] that function supposed return 1 or 0 each case returned firs...

c# - data between page, accessing values WP7 -

mainpage.cs usr = new user[count_friends]; (int = 0; <count_friends; i++) { usr[i].uid = (int) response["response"][i]["uid"]; usr[i].first_name = response["response"][i]["first_name"].tostring(); usr[i].last_name = response["response"][i]["last_name"].tostring(); usr[i].isonline =convert.toboolean((int) response["response"][i]["online"]); } friends.cs public friends() { initializecomponent(); var onl_friends = n in usr n.isonline == true select n; foreach (var x in onl_friends) debug.writeline(x.first_name + " " + x.last_name); } but usr not defined.how can use 'usr' in friends.cs use in mainpage.cs? public struct user { pu...

c# - How can I use IMultipleResults AND return Output Parameters from a SQL Stored procedure? -

i have sql stored procedure accessing using linq-to-sql. returning multiple resultsets couple output parameters. works when run procedure query within sql, when try access c# code, not want work. 'userhasaccesstooption' parameter returns false, though set true in stored procedure. again, returns , allows me browse other resultsets returned stored procedure, not return sql output parameters. here code access stored procedure , return imultipleresults object: [functionattribute(name = "dbo.getoption")] [resulttype(typeof(option))] [resulttype(typeof(loanpurpose))] [resulttype(typeof(loantype))] [resulttype(typeof(user))] [resulttype(typeof(client))] [resulttype(typeof(organizationfinancialitem))] public imultipleresults getoption( int? optionid, int userid, bool getclients, bool getotherorganizationusers, bool getloanpurposes, bool getloantypes, bool getorganization...

performance - How can I improve the speed of my Makefile? -

i building multiple binaries in c++ & cuda couple of files in fortran. found this question , i'm having similar problem. user asked me re-build 3 year old version of repository (before had performed massive migration , renaming) , shocked see how built . impossible / incredibly time consuming determine of changes between version , caused build take friggin' long. however , noticed in answer's comment aforementioned question: in particular, remember use := instead of =, := expansion immediately, saves time. – jack kelly mar 23 @ 22:38 are there other suggestions should aware of? note: i use 'include' paradigm each directory want build has module.mk file directly included 1 , makefile. i use several functions like: (markdown..) # # cuda compilation rules # define cuda-compile-rule $1: $(call generated-source,$2) \ $(call source-dir-to-build-dir, $(subst .cu,.cubin, $2)) \ $(call source-dir-to-build-dir, $(subst .cu,.ptx, ...

mercurial - Why is "hg push" so much bigger than .hg? -

my project's .hg directory 40mb. if hg push --verbose --debug empty remote repository see sending hundreds of mbs. overhead coming from? update : hg bundle -a generates 35mb file. here stripped-down version of output i'm seeing: pushing https://jace.googlecode.com/hg/ using https://jace.googlecode.com/hg/ sending between command using auth.default.* authentication jace.googlecode.com certificate verified sending capabilities command using auth.default.* authentication capabilities: branchmap lookup unbundle=hg10un,hg10ugz,hg10bz changegroupsubset sending heads command using auth.default.* authentication searching changes common changesets 71818a195bf5 sending branchmap command [...] bundling: <filenames> sending unbundle command sending xxx bytes [...] sending: xxx/xxx kb this known python bug. because of way python http library work, first sends data, server replies needs auth, , resends data. with recent mercurial (starting @ 1.9) can use alternati...

c - Virtual Memory allocation without Physical Memory allocation -

i'm working on linux kernel project , need find way allocate virtual memory without allocating physical memory. example if use : char* buffer = my_virtual_mem_malloc(sizeof(char) * 512); my_virtual_mem_malloc new syscall implemented kernel module. data written on buffer stocked on file or on other server using socket (not on physical memory). complete job, need request virtual memory , access vm_area_struct structure redefine vm_ops struct. do have ideas ? thx this not architecturally possible. can create vm areas have writeback routine copies data somewhere, @ level, must allocate physical pages written to. if you're okay that, can write fuse driver , mount somewhere, , mmap file it. if you're not, you'll have write() , because redirecting writes without allocating physical page at all not supported x86, @ least.

Retrieve IMAP email based on date AND time? -

i'm trying retrieve email using imap that's less number of hours old. i've looked on specifications, , there since method accepts rfc date. however, ignores time , timezone. there method can use retrieve email based on date time? thanks rfc 5032 documents within extension introduces search keyword younger , you're looking for. for example, search emails less 2 hours old: a search younger 7200

java - Simple export and import of a SQLite database on Android -

i trying implement simple sqlite export/import backup purposes. export matter of storing copy of raw current.db file. want import delete old current.db file , rename imported.db file current.db . possible? when try solution, following error: 06-30 13:33:38.831: error/sqliteopenhelper(23570): android.database.sqlite.sqlitedatabasecorruptexception: error code 11: database disk image malformed if @ raw database file in sqlite browser looks fine. i use code in sqliteopenhelper in 1 of applications import database file. edit: pasted fileutils.copyfile() method question. sqliteopenhelper public static string db_filepath = "/data/data/{package_name}/databases/database.db"; /** * copies database file @ specified location on current * internal application database. * */ public boolean importdatabase(string dbpath) throws ioexception { // close sqliteopenhelper commit created empty // database internal storage. close(); file newdb...

php - Mod Rewrite and java script popup -

hello facing issues mod_rewrite applied javascript pop-up. code rewrite part : rewriteengine on rewriterule ^([^/]*)\.html$ /popup.php?id=$1 [l] but not working. sure mod_rewrite working on server because it's working joomla, , can see mod_rewrite loaded in <?php phpinfo(); ?> this code open javascript popup <script> var newwindow; function box(url) { newwindow=window.open(url,'name','height=640,width=750'); if (window.focus) {newwindow.focus()} } </script> ... ... ... <td><a href="javascript:box('/popup.php?id=<?php echo $id; ?>');">click details</a> </font></td> thanks in advance help. lateredit: this content of .htaccess options +followsymlinks rewriteengine on rewriterule ^([^/]*)\.html$ /popup.php?id=$1 [l] rewritecond %{query_string} mosconfig_[a-za-z_]{1,21}(=|\%3d) [or] rewritecond %{query_string} base64_encode.*\(.*\) [or] rewritecond %{query_string} (\<|%...

algorithm - Aggregate/Extrapolate sparse samples in multi-dimensional space -

Image
imagine there function evaluates elevation of surface given floating point x , y coordinate (and additional components in accordance dimensionality): double computeelevation(double x, double y, ...., double z) { } this not analytic function , derivatives cannot computed. need find direction in surface steepest given {x, y} pair. single evaluation expensive (think seconds or minutes in worst case scenarios). my typical approach in 2d case sample surface in n locations adjacent {x, y}, fit curve through samples , search curve highest point, search not suffer expensive evaluation: in above image p0 given coordinate. {s0, s1, s2, s3} 4 random-ishly placed samples around p0 , pm highest point on curve. thus, vector pm-p0 direction of steepest ascent. but have no idea how scale n dimensions, or whether there smarter algorithms doing this. the number of dimensions potentially quite large (dozens hundreds), whatever method end using must work when there fewer samples there di...

http - Most secure way to secure Jersey REST Services -

i'm looking advice. have system , running on amazon cloud instance bunch of rest services running on jboss. next step secure these services there credit card information flowing through them. need authentication question is, secure methods 1 can use rest services? ssl ca certs of course encrypt data using ca i'll start of course. go daddy reputable this? or have shell out alot of money verisign? for authentication, sufficient basic auth or maybe having caller sign request somehow? other methods? oh forgot mention, client application ipad application. advice. you want able protect man in middle attacks , prevent replaying of requests. time there payment related information being relayed opt signing request using nonce , timestamp. involves signing request using shared secret between client , server. secret can passed 1 time on login. use timestamp , client generated unique nonce value part of signed bytes. these values passed headers in request server can re...

actionscript 3 - How do I use a local XML file as a DataProvider for a Spark List control in Flex 4.5? -

i building android app in flash builder 4.5 using flex 4.5.1 , having hardest time using locally stored (/data/data/app-name/db/pellets) xml file dataprovider spark list control . i've looked on net past 3 days , have tried bunch of different ways code working no avail. i have skinnablepopupcontainer spark list control (list1) i'd populate " name " element in locally stored xml file (pelletdb.xml) contains 170 entries 6 elements each. xml looks this: <tin> <pellet> <caliber>0.177</caliber> <name>aa field</name> <bc>0.0210</bc> <weight>8.400</weight> <style>n/a</style> <material>lead</material> </pellet> <pellet> <caliber>0.177</caliber> <name>beeman bearcub</name> <bc>0.0110</bc> <weight>8.000</weight> <style>n/a</style> <material>lead</mat...

html - IE doesn't support relative paths in the base element when referencing CSS files -

i have site uses base tag set absolute path relative urls. works fine in browsers tested in, except ie (big surprise). based on request ie making css file, seems not notice base tag. acknowledge base tag else on page. why happening? can done it, besides using absolute path reference css file? here code: <!doctype html> <html><head> <title>base test</title> <base href="/basetest/"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div>foo</div> </body></html> this in basetest/style.css file: div { background: yellow; } edit: same thing seems happen images too. of tests did in ie9. problem came in standards mode, ie8 , ie7 compatibility modes. edit 2: works fine if specify absolute url. didn't know support relative urls recent feature. may abandon plan use base tag avoid repeating paths, unless can find way (like maybe js ha...

lua - Corona SDK - frame-by-frame animation and accelerometer problem -

we doing game moving objects around frame-by-frame , using accelerometer. we have hooked on 2 events - drawing frame , acc. the problem is, after receive acc event, put x value in variable. then use variable move object on screen, there considerable slow down. ( turn phone, , after second object moving properly, second way game, expect immediate response). what doing wrong? there workaround this, or can give params accelerometer? unfortunately serious problem - real blocker. if not work, have find solution (not corona) implementing game. thanks in advance!!! danail ps: here's source: local lastxgravity = 0 local function move(event) eventtime=event.time elapsedtime = eventtime - lastdrawtime lastdrawtime = eventtime xspeed = lastxgravity local xmoved = xspeed * elapsedtime object.x= object.x + xmoved end function acc(event) lastxgravity = event.xgravity end runtime:addeventlistener("acceleromet...

sql - Full text search with php -

i not results following query: "select * test2 match(txt) against('hello' in boolean mode)" while test2 looks like: id | txt 1 | ... 2 | ... 3 | ... 4 | ... .. | ... txt 30 characters long (text) , fulltext. have 16 records (tiny db) , word hello placed in every record in txt along other words. wanted know how full-text search works. 0 results , can't understand why. there 2 reasons not getting results: reason 1: search word 'hello' occurs in many rows. a natural language search interprets search string phrase in natural human language (a phrase in free text). there no special operators. stopword list applies. in addition, words present in 50% or more of rows considered common , not match. full-text searches natural language searches if no modifier given. source: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html reason 2: search word 'hello' on stop-word list. word on stopword list ne...

java - Equation-driven smoothly shaded concentric shapes -

Image
background looking create interesting video transitions (in grayscale). problem given equations represent closed, symmetrical shape, plot outline , concentrically shade shape towards centre. example consider following equations: x = 16 * sin(t)^3 y = 13 * cos(t) - 5 * cos(2 * t) - 2 * cos(3 * t) - cos(4 * t) t = [0:2 * pi] when plotted: when shaded, resemble (not shown shaded, sufficient show idea): notice shading darkest on outside (e.g., #000000 rgb hex), lightens fills centre. centre white (e.g., #ffffff) dot. questions what expedient way produce high-resolution, concentrically shaded grayscale images, such shaded heart above? what such closed, symmetrical shapes formally called? thank you! ideas use library such http://code.google.com/p/jmathplot/ use gnuplot use r plot using wolfram alpha, use imagemagick create smaller concentric versions try in r: # create palette greyscale <- colorramppalette(c("black","w...

actionscript - No code highlights in fx:Script of flash builder 4.5 -

it seems codes inside fx:script blocks black no highlights. that's pretty inconvenient. can please let me know how turn on? thanks! first check active perspective "flash". window->preferences. on left side of window expand flash builder->editors->syntax coloring. on right side can set colors actionsscript, css , mxml. if after tinkering around cannot fix problem try delete "adobe flash builder 4.5" folder located in user's folder. hope helps

jquery unbind function event once executed -

hi folks, please me fix : suppose call same javascript function anchors different parameter <a id="edit1" onclick="foo(1)"></a> <a id="edit2" onclick="foo(2)"></a> function foo(id) { // let's code here hide clicked anchor , show new anchor cancel-edit id } the scenario : i clicked in first anchor - first anchor replaced new anchor : how can disable function, when click in second anchor nothng. now suppose clicked in anchor id cancel-edit pull anchor id edit1 , reactivate foo function when reclick in second anchor execute again foo function... i hope it's clear :x ! in advance. if want disable elements after 1 clicked, set flag: var enabled = true; function foo(id) { if( enabled ) { // run code enabled = false; } } it continue run, code in if statement not after first click. function stop() { // replace original anchor enabled = true; // enab...

powershell - How one can know who modified my files in my shared folder? (Using scripting or coding methods) -

i have windows 2003 server shared folder people can edit xml files in shared folder (the folder contain xml files). although intention freely allow people edit files within, track modified them. i have done research have understand can use .net library called system.io.filesystemwatcher track when create / modify / delete file in folder, doesn't tell me did it. i have found out how above using windows powershell (http://dereknewton.com/category/powershell/), , hoping if there coding method similar how 1 uses system.io.filesystemwatcher track file system events find out modified files. it great if can give me pointers on how can track modified files using windows powershell (preferred), or using other scripting or coding methods. thanks , best regards! you can turn on auditing folder on server, , windows store file access information in system audit event log. can read information out of there, if (or can view directly in event viewer).

ms access 2007 - How to Hide Ribbon except when deving -

i using access 2007 , creating invoicing system parent's business. when i'm developing in access, able see ribbon nav, , object nav on over left. when push out them use, hide of junk. is there easy way enter access db "dev" giving of options, when opened end user, see forms have autoexec'd open when database opened? to toggle navigation pane, use f11. toggle ribbon, ctrl+f1 --- minimizes ribbon rather hides completely. if want similar vba code: 'hide navigation pane docmd.selectobject actable, , true docmd.runcommand accmdwindowhide 'unhide navigation pane docmd.selectobject actable, , true 'hide ribbon docmd.showtoolbar "ribbon",actoolbarno 'unhide ribbon docmd.showtoolbar "ribbon",actoolbaryes an easy way distinguish between development , production versions of application place them in separate folders. if currentproject.path "*dev*" 'do want development mode else 'do w...

android - spinner expanding beyond screen bounds -

i have layout contains tablelayout 3 rows. each row has textview , spinner. spinners' column set stretch. problem spinners stretching off edge of screen when contain long string. them truncate string instead. here's screenshot of problem: http://www.comicfanboy.net/images/screenshot.png and here's xml layout: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/settings_scrollview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_horizontal"> <linearlayout android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingleft="3dp" android:paddingright="3dp"> <textview android:id="@+id/textview1" android:layout_height="wra...

php - Can the Facebook Graph API supply me an array of friends who use an app I created? -

i'm trying find information shows how can list of friends use facebook app created. possible? you can use follow fql query: select uid, name user has_added_app=1 , uid in (select uid2 friend uid1 = me()) this better using deprecated old rest api method.

Gradually porting PowerBuilder/C++ application to C#/WPF or Winforms -

i have chance start porting legacy application written in c++/powerbuilder c#. have feature sprint launches independent dialog , went through exercise of creating ccw dll managed implementation of feature, called c++. decided use wpf views in managed dll. far good, able inter operate managed dll, including launching wpf window sample mfc app. there several reasons motivating strategy: i have bunch of re-usable manage dlls came being recent redesign of 10 year old legacy app. i experienced in c# compared c++ find myself battling language syntax , intellisense. fwiw, our company better in investing in tooling although not change dislike c++ syntax, header files , inconsistencies......of approach. for desktop apps atleast kind of applications develop, think c# way go. 4.there future plans re-write app, , not want repeat myself, hence temptation start designing things right, can, @ stage. i not have alot of c++ help. however, have concerns , questions: is piecemeal ...

android - Animation while changing orientation -

is possible set animation when move activity in landscape view activity in portrait view ? it's possible, not trivial. add property <activity> in androidmanifest.xml file: android:configchanges="orientation|keyboard|keyboardhidden" then, override activity's onconfigurationchanged , perform animation there.

java - How Ellipse to Ellipse intersection? -

i'm using java. ellipse2d s1=new ellipse2d.float(0,0,100,100); system.out.println(s1.intersects(99, 30, 100, 100)); should return false return true. how find intersection between 2 ellipse? thx cademia has useful api can downloaded here . class cib.util.geo.geo2d has method geo2d#intersection calculates intersection points between 2 ellipses. hope you. thanks.

database - NHibernate on a table with two "primary" keys -

i'm learning nhibernate in order layer on rather peculiar legacy database. other applications use same live database, can't make changes affect them. i've run problem because 1 table, represents hardware devices, has 2 columns used de facto primary keys. 1 real primary key, auto-generated row id. other unique , non-null hardware serial number. many other tables in database have foreign-key relationship table. however, of them use real primary key - integer row id - foreign key, , use hardware id of device instead. note in practice hardware id , row id, once paired, remain paired. will able create mappings deal in nhibernate, or need create views give me more standardized schema, , use instead of triggers make them updatable? the db in use mssql 2000, in case makes difference. in situation following: public class hardwaredevice{ public virtual int id {get; set;} public virtual string serialnumber {get; set;} //other stuff } public cla...

ruby - Rails real-time logger on webpage? -

i'm transferring ruby app once made rails. app calculations take while (up infinity (in theory) if :p). show user status of everything, used console. now, obviously, want browser show this. does has pointers start reading/exmples/gems/ideas? i'm pretty new web development, i've heard of jquery, possibly trick? as per understanding have 2 options this 1 - using kind of server push method implemented. may use following components juggernaut (http://juggernaut.rubyforge.org/ ) http://www.ape-project.org/ 2 - using periodicalupdater jquery. send request server in given time interval. you can populate db table, mem-cache or datastore status , write method read , return value, method can called via ajax.periodicalupdater i have done this, killing performance request server (in mycase every 5 seconds) even though haven't done, prefer server-push option methodical way go hth cheers sameera

javascript - drawing html5 video on a canvas - on iPad -

i'm drawing video on canvas, works fine safari / chrome / firefox / opera, on ipad, though video plays, (correct codec, etc) never rendered on canvas, basically call : canvas.getcontext("2d").drawimage(video, 0, 0); when video playing, , stop doing when video paused or ended. is there else should consider? clearing canvas? for safari on ipad not supporting feature. there limits on attributes , events of canvas tag , video tag of html5 particularly on ipad. attributes , events of canvas , video tags work fine on desktop browsers wont work on ipad. personal experience too.

hash - Java: Retrieving object from the set just by computing its hashcode -

i have created event class. can see, both hashcode , equals methods use id field of type long. public class event { private long id; private map<string, integer> terms2frequency; private float vectorlength; @override public long hashcode() { return this.id; } @override public boolean equals(object obj) { if (this == obj) return true; if (obj == null) return false; if (getclass() != obj.getclass()) return false; event other = (event) obj; if (id != other.id) return false; return true; } i store objects of class in hashset collection. set<event> events = new hashset<event>(); since hash computation field of type long i'd retrieve elements events hashset computing hash of id. e.g.: events.get(3); is possible or should use hashmap it: map<long, event> id2event = new hashmap<long, event>(); ? you should absolutely not rely on hash code uniqueness. long has 2 64 pos...

java - Running Eclipse aplication or applet with permissions -

i have applet run in command line this: "c:\program files (x86)\java\jdk1.6.0_21\bin\appletviewer.exe" -j"-djava.security.policy=java.policy.applet" cw11.html how can run applet in eclipse java.policy.applet permissions? its long time since wrote applet, should able creating new applet run configuration. choose run -> run configurations menu. right click "java applet" , choose "new". give run configuration name. select project , applet class. choose "arguments" tab , enter security policy vm argument. click "run" , off go.

android - How to locate tabs on the left side of screen? -

i implemented simple tab layout following tuturial . in tutorial, tabs located on top of screen. there way locate tabs on left side of screen instead of locating tabs on top? how change layout xml file ? <?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp"> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <framelayout android:id="@android:id/tabconten...

Wordpress; image not appearing post loop -

i have post before, didn't conclusive answer i'm hoping can me. have setup custom post types, , them, custom fields using wordpress 3's ui. one of fields have set called banner_image, in loop, doesn't output image. <?php echo get_post_meta($post->id, 'banner_image', true); ?> this outputs id number of post. if set function false, array id in , nothing else. how path image? can't work out , googling reveals sea of content not related problem, it's real difficult 1 search you're hope! many thanks, michael. <?php global $post; $tmp_post = $post; $args = array( 'post_status' => 'publish', 'post_type' => 'work', 'order' => 'desc' ); $myposts = get_posts( $args ); foreach( $myposts $post ) : setup_postdata($post); ?> <?php if( get_post_meta($post->id, 'show_in_home_banner', true) == "yes" ) { ?> <li c...

java - Handling very large amount of data in MyBatis -

my goal dump data of database xml file. database not terribly big, it's 300mb. problem have memory limitation of 256mb (in jvm) only. cannot read memory. i managed solve problem using ibatis (yes mean ibatis, not mybatis) calling it's getlist(... int skip, int max) multiple times, incremented skip . solve memory problem, i'm not impressed speed. variable names suggests method under hood read entire result-set skip specified record. sounds quite redundant me (i'm not saying that's method doing, i'm guessing base on variable name). now, switched mybatis 3 next version of application. question is: there better way handle large amount of data chunk chunk in mybatis? there anyway make mybatis process first n records, return them caller while keeping result set connection open next time user calls getlist(...) start reading n+1 record without doing "skipping"? no, mybatis not have full capability stream results yet . edit 1: if don...

asp.net mvc 3 - jqGrid dose not work when i run from IIS 7.2 (virtual directory) -

Image
expert, i have created 1 application , implemented jqgrid add, edit , delete, this working fine running visual studio 2010. now created virtual directory application , trying access index page not displaying because jqgrid not loaded giving me following errr: error: jquery("#list").jqgrid not function source file: http://localhost/cafm/tabmaster line: 58 here jqgrid code snippet. jquery(document).ready(function () { alert(jquery("#list")); jquery("#list").jqgrid({ url: '/tabmaster/jqgridgetgriddata', datatype: 'json', mtype: 'get', colnames: ['col id', 'first name', 'last name'], colmodel: [ { name: 'colid', index: 'colid', width: 100, align: 'left', searchoptions: { sopt: ['eq', 'ne', 'cn']} }, { name: 'firstname', ind...

speech recognition - Problem in Pocketsphinx demo on Android -

i try download , run offline voice recognization demo link - http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/ . m install , run demo project on device, when push , hold button , when release button, try convert text. textfield "your text goes here" becomes empty not displaying result, i.e. text of speak. please 1 run demo successfully, me better suggestion. thanks in advance. in experience, text field stays blank when there error in configuration native pocket sphinx code. errors encountered pocketsphinx should printed log file. figure out pocketsphinx log file is; set using setlogfile(string path) function. 1 of things happens me quite mismatch between words in dictionary , words in language model/grammar. since haven't edited those, i'd wrong path 1 of them. log file tell couldn't loaded.

objective c - iPhone: Efficiently downloading images from a URL into iPhone App -

in iphone app , need display images server. i need download , save urls. there 20 images need download. what way out in performance doesnt decrease? i have tried using nsdata convert images nsdata , saving app takes lots of time. what more easier , efficient way out? i recommend using asihttprequest download images asynchronously, , display them when they're ready. using asynchronous interface of class, app can responsive , continue operate while, in background, wait data loaded. asihttprequest open source , free use: http://allseeing-i.com/asihttprequest/

plugins - Tips on creating a plug-in architecture for WPF -

i'm making switch winforms wpf. in winforms have plug-in architecture user control hosted in winform. have suggestions on creating plug-in architecture wpf? want rally forces of developers in community further extend products believe in extensible framework apps. i'm starting wpf i'm not sure best way go this. thank you. have managed extensibility framework

unit testing - Branch-coverage with Cobertura plugin for the Play! Framework -

i'm using play! framework cobertura module code coverage. works fine, unfortunately, module seems have no (obvious) option make branch coverage reports too. how enable branch coverage in cobertura module? or in other words, how test branch coverage in play application? branch coverage magically appears in report now, maybe there time , didn't see it. bad.

In Java, what is the difference between this.method() and method()? -

is there difference between calling this.method() , method() (including performance difference)? the time matters if using outerclass.this.method() e.g. class outerclass { void method() { } class innerclass { void method() { outerclass.this.method(); // not same method(). } } }

Getting value from radiobox in Tkinter - Python -

i'm trying create gui in python using tkinter module, , part of involves giving user option of 2 radioboxes, , select 1 want. depending on box tick, runs different functions return different results - results want use outside of window class. don't know how send value inside class outside class; i'm sure simple can't life of me work out. my current code is: class batchindiv(): def __init__(self, master): self.master=master self.startwindow() self.b=0 def startwindow(self): self.var1 = intvar() self.textvar = stringvar() self.label1=label(self.master, text="batch or indivdual import?") self.label1.grid(row=0, column=0) self.label2=label(self.master, textvariable=self.textvar) self.label2.grid(row=2, column=0) self.rb1 = radiobutton(self.master, text="batch", variable=self.var1, value=1, command=self.cb1select) self.rb1.grid(row=1, column=0, sticky=w) self.rb2 = ra...

javascript - Is there any dynamic line chart in jquery? -

i want line graph or chart moves dynamically windows task manager (performance tab). there plugin that? check out highcharts. http://www.highcharts.com/demo/dynamic-update

Observer Pattern - How to handle unexpected changes? -

what kind of mechanism used update object... unless checking has changed , instruct subject/observed push state... what mean instance object changes state, how should handle change, should mark changed, how let observers know has changed without having checking if object observing has changed or not... how handle unexpected changes , eliminate them our notifications? there whole callback thing, event listeners, etc... use don't understand, use black box, know bit more internals of such mechanisms. there lot of different mechanisms track changes of object. the first alternative use indeed observers. implies every method changes data in object, calls observers. in practice it's best put in 1 function, this: class myclass { public: void setvalue(int value) { m_value = value; notifyobservers(); } private: void notifyobservers() { (auto it=m_observers.begin();it!=m_observers.end();++it)...

php - Fire event when text in textarea is changed -

does know how pickup if text within <textarea> has been modified using jquery? you have bind change , keyup on text area. the change prevent context-menu pasting, , keyup fire every keystroke. $('#textarea').bind('change keyup', function() { alert('handler .change() called.'); });

java - How to get path of checked picture using checkbox from grid view of photo Gallery in android -

i trying path of photo gallery in grid view. gallery consists of each thumbnail attached checkbox. here whole code: public class gridgallery extends activity { arraylist<string>list; alertdialog.builder alert; private button send; gridview gridview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.grid_gallery); datamodel dbmodel = new datamodel(this); list = dbmodel.selectall(); alert = new alertdialog.builder(gridgallery.this); send = (button)findviewbyid(r.id.send_message); gridview = (gridview) findviewbyid(r.id.sdcard); gridview.setadapter(new imageadapter(this)); gridview.setclickable(true); gridview.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> arg0, view view, int pos, long id) { // todo auto-generated method stub ...

asp.net mvc - different applications splited by areas? -

i allready have programmed small applications, database design simple, 1 normalized database containing datas need application. now want try programm bigger: there should 4 websites build mvc3. websites should use 1 sql-membership-database , tables contacts , on should shared between diferent pages too. now question is: how start? should put applications 1 mvc3-application , seperate them using areas? is there have got tipps ore experiances in creating huge (for me huge ;-)) applications this? lot of , greetings hw your idea use areas work. might need create custom roles restrict access 4 areas. you want search on asp.net mvc multi-tenancy. link http://weblogs.asp.net/zowens/archive/2010/05/26/multi-tenant-asp-net-mvc-introduction.aspx begins whole series on multi-tenancy.

Android refresh current activity -

i want program android app refresh current activity on buttonclick. have 1 button on top of activity layout job. when click on button current activity should reload again - device restart. thanks public void onclick (view v){ intent intent = getintent(); finish(); startactivity(intent); }

vba - Excel: What code should I write to select multiple cells directly above cells that have a certain value? -

i have column of numbers in order. in column, of numbers 99999999. need select cells directly above number. here example, need select cells highlighted bold: 63012097 63012097 63012097 63133638 63133638 99999999 99999999 63048742 63048742 63020783 63066755 63167680 99999999 99999999 63033618 63033618 63033618 63033618 63033618 63033618 63033618 63033618 63033618 63033618 99999999 99999999 63005597 63005597 99999999 99999999 63099456 63099456 63099456 63099456 63099456 99999999 99999999 63029683 63029683 i wanted show data column ignore bullet points ;) i have 723,950 rows of isn't possible manually either. can help? thank you! :d i'm not sure want cells once you've selected them. if want them highlighted in example, can use excel's conditional formatting feature. just select column of data. in excel 2007, go home -> conditional formatting -> new rule.... there, select "use formula determine cell...