Posts

Showing posts from April, 2015

groovy: use brackets on method calls or not? -

this general question whether people should using brackets on method calls take parameters or not. i.e. def somefunc(def p) { ... } then calling: somefunc "abc" vs... somefunc("abc") is question of consistency, or there specific use cases each? it's question of consistency , readability, note groovy won't let away omitting parentheses. one, can't omit parentheses in nested method calls: def foo(n) { n } println foo 1 // won't work see section entitled " omitting parentheses " in style guide .

java ee - Why to use jsp:forward -

as per personal opinion, jsp display output. , separated java class (say servlet/action etc) writing rest programming logic. java code may require on jsp page display output correctly. writing code on jsp processing purpose redirecting jsp, useful if jsp has features other java classes/servlet/action dont have. please tell me real time applications should use jsp:forward . as per personal opinion, jsp has no features other java classes/servlet/action don't have. a jsp servlet in disguise.

android - call static method of Activity class when it's used in Intent creation -

i glad have chance call static method of activity class whenever it's used create intent. example have static reset method must called before every activity launch, , trick use looks like: myactivity.reset(); intent intent = new intent(getbasecontext(), myactivity.class); ... startactivity(intent); is there way via reflection or somehow else call such static method when class being used?

html - 2 divs aligned side by side, how to make right div fill width 100%? -

i'm wondering best way go doing is... i have 3 div s: a div#container width=100%; holds 2 inner div s a div#inner_left width changing dynamically, no wider 200px (will hold product image) an div#inner_right width should fill rest of space in container (will contain text describe product shown) #container { width:100% } #inner_left { display:inline-block: max-width:200px; } #inner_right { display:inline-block; width:100%; } the problem div#inner_right creates line break , fills entire width. how can make them align next each other, right div accounting width taken left div (which changes dynamically?). i've gotten work other ways, i'm looking clean solution... any css noob appreciated! have @ " liquid layouts " can describe you're talking about. you're looking this one . in example, try setting display inline. however, won't technically able use block level elements in it, have @ links posted

iphone - Best way to avoid memory leaks for Multiple Buttons in UITableViewCell -

Image
i've got array of buttons in uitableviewcell. populated them through cellforrowatindexpath method, tableview gets sluggish though have released everything. should using custom uitableviewcell populate? suggestions on how make smooth possible user great. screenshot below. you create custom cell / custom view pair specific cell, can draw yours buttons in drawrect:. however, draw buttons image wouldn't able tap them, guess can create uitapgesturerecognizer cell (you'd still have figure out button pressed examining x,y values). still, don't see point in adding tag buttons inside uitableviewcell. come alternate design in ui, i.e. uiview presented on top of table, or modal controller maybe.

html - How do I set correctly vertical align middle on image -

Image
example have set master div 100px height. in div have 1 logo want vertical-align:middle; here example http://jsfiddle.net/c7me7/ i want logo auto align middle without have padding or margin . output should let me know updated: works. #top { height:100px; background:#000; padding:0 20px;line-height:100px;} #logo img {vertical-align: middle;} see - http://jsbin.com/utuye5/2

android - logcat indicate error? -

hi create simple andengine application...now logcat indicate error....what mistake made application..... 02-09 13:05:01.560: error/andengine(280): failed loading bitmap in assettexturesource.assetpath: ggg 02-09 13:05:01.560: error/andengine(280): java.io.filenotfoundexception: ggg 02-09 13:05:01.560: error/andengine(280): @ android.content.res .assetmanager.openasset(native method) 02-09 13:05:01.560: error/andengine(280): @ android.content.res .assetmanager.open(assetmanager.java:313) 02-09 13:05:01.560: error/andengine(280): @ android.content.res .assetmanager.open(assetmanager.java:287) 02-09 13:05:01.560: error/andengine(280): @ org.anddev.andengine.opengl .texture.source.assettexturesource.<init>(assettexturesource.java:46) 02-09 13:05:01.560: error/andengine(280): @ org.anddev .andengine.opengl.texture.region.textureregionfactory .createfromasset(textureregionfactory.java:66) 02-09 13:05:01.5

c# - Using InfoPath for importing and exporting data -

the application i'm writing has need solution following situation: salesman , customer located offsite. finalizing list of requirements, , input business data @ point need inputed in onsite database. my idea salesperson gets infopath document completed default values , heads on customer. while @ customer document updated satisfy customer's need. must cover document passed , forth email between salesperson , customer. when salesperson returns office uploads infopath database , order updated few user interactions. now questions: is workable/sensible solution? other suggestions how solve this? how ensure form , data stays when salesperson takes document on usb stick or it's emailed customer? how (with c# code) fill form default values? how read changes? sharepoint not option. some issues need think about will customer have infopath installed , therfore may not able view document. if email document or need customer view it, data transmitted poi

Copying an Blend Storyboard -

i have expression blend 3 solution, has few images(my buttons). have storyboard plays effect/animation/fade-in on button. can copy storyboard other buttons or must go each animation on it's own? you should store storyboards style , apply yours buttons. here can read templates: http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-7-using-control-templates-to-customize-a-control-s-look-and-feel.aspx here can @ using visualstatemanager (and storyboard in in) withing template: http://msdn.microsoft.com/en-us/library/system.windows.visualstategroup(v=vs.95).aspx

c# - how to create RDLC form dynamically in run time and how to save it? -

how create rdlc form dynamically in run time , how save it? you need understand report definition language , based on create xml file , save rdlc extension. if want handle report events, need emit generate dynamic .net code.

mysql - Large PHP Arrays pagination -

i have array has on 10k results (generated mysql query) , wonder best practice paginate it? extract data first split pages or there faster/best way? use mysql's limit syntax retrieve desired results database before reaches php code. something this: $offset = 0; $per_page = 25; $query = "select * `blah` limit $offset, $per_page"; ...

Java Socket Can't Connect to Own Computer -

my program works fine when do socket s = new socket("127.0.0.1", 10000); but when replace localhost own external ip adress, fails gives? throws unknownhostexception immediately, though can ping external ip fine. stack trace: java.net.connectexception: connection refused: connect @ java.net.plainsocketimpl.socketconnect(native method) @ java.net.plainsocketimpl.doconnect(plainsocketimpl.java:333) @ java.net.plainsocketimpl.connecttoaddress(plainsocketimpl.java:195) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:182) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:366) @ java.net.socket.connect(socket.java:529) @ java.net.socket.connect(socket.java:478) @ java.net.socket.<init>(socket.java:375) @ java.net.socket.<init>(socket.java:189) @ fileclient.main(fileclient.java:29) what gives? throws unknownhostexception immediately, though can ping exte

bandwidth - java/tomcat web hosting -

sorry repeating question, different. i'm looking web hosting around 15$/month unlimited bandwidth , space or ever deal. site using struts2 java framework mysql database. i have seen plan of mochahost.com unlimitedgb.com although plan full of feature , in price range lately see lot of negative reviews on www.web-hosting-top.com makes me further confused , i'm not able make mind use. can guys suggest trusted java hoster. , if can point how bandwidth , disk space requred avg data driven site. [some thing site can figure out data bandwidth: site have 2 types of login general user , org user. general user can login , submit feedback of 9 text fields on avg 100 char each 1 file upload document type avg size 100kb other org user can have report feature based on feedback site new not user/view expecting 100k users in first 4 months, no audio/video/flash used on site plan text/css/image make attractive ] thanks rain, truth won't find good hosting plan money.

surfaceholder - Getting an android app to keep it's OpenGL Context after hitting the home button -

first bit of context: i'm developing video game both android , iphone platforms. way iphone works, when user hits home button , returns game later, in circumstances game pick right left off no hicups. jump rendering , game loop. setting on ios platform absolutely easy me do. accomplishing on android has left me in fit of rage after hours of wrestling google results :p i have own opengl setup both iphone , android, , has been working great. root of problem, believe, need surfaceholder create opengl context. here's sucky part, when screen loses focus of game (ie home button hit), android calls surfacedestroyed in surfaceview class , kills opengl context. could recreate new 1 new surfaceholder when surfacecreated called, need reload of art assets defeats purpose of i'm trying accomplish. can somehow prevent android os killing surface holder, there sort of custom view can use work? there setting in manifest can me out here (i doubt have thoroughly tested of fla

php - problem in uploading FLV video file to server -

while uploading mp4 video $_files array comes this.. array ( [qqfile] => array ( [name] => video.mp4 [type] => video/mpeg4 [tmp_name] => /tmp/php74n9mr [error] => 0 [size] => 199160 ) ) but while uploading .flv file $_files array coming , why not coming proper? array ( [qqfile] => array ( [name] => youtube - youtube contest announcement.flv [type] => [tmp_name] => [error] => 1 [size] => 0 ) ) please suggest. the file trying upload large. the php manual's chapter on file uploads : since php 4.2.0, php returns appropriate error code along file array. error code can found in error segment of file array created during file upload php. in other words, error might found in $_files['userfile']['error'].

vb.net - Running applicaition but nothing is appearing -

i have been running project using f5, says ready , nothing happens. goes debugging mode )play button disabled, pause , stop enabled) application not appear. could advise me problem? thanks fuqna infinite loop ... maybe... on startup form.load event ?

jquery - How to keep all selected days after clicking on a selected day? -

i found in full calendar documentation: "a selection might cleared number of reasons: 1.the user clicks away current selection (doesn't happen when unselectauto false)." if have selected more days, click in current selection unselect existing selection. actually, trying achieve following: 1)user selects few days on month view 2)than clicks somewhere in selected area 3)calendar keeping selected days i've tried option unselectcancel:".fc-cell-overlay" doesn't work any advice appreciated regards, niki

iphone - how to parse google weather xml using XMLParser -

i want parse google weather api using nsxml please guide me this. url looks like: http://www.google.com/ig/api?weather=islamabad . can parse data "tagged" xml, xml structure used in url not understandable me. please help. you should check docs nsxmlparserdeleagte: - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict attributedict - need. example tag: <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0"> attributedict contain 6 keys: module_id, tab_id, mobile_row, mobile_zipped, row, section appropriate values.

.net - C# follow folder junctions with FileSystemWatcher -

is possible configure filesystemwatcher watch other folders linked in folder junction point? for example: you watching d: you have d:\junction points e:\folder when create file in e:\folder\file.txt want see watcher d:\junction\file.txt. is possible? thanks. filesystemwatcher not supposed monitor junctions or symlinks... , monitors 1 folder @ time.

javascript - Advantages of setting the "constructor" Property in the "prototype" -

in javascript prototype inheritance, goal of adding prototype.constructor property. let me explain example. var super = function() { this.superproperty = 'super property' } var sub = function() { this.subproperty = 'sub property' } sub.prototype = new super(); sub.prototype.constructor = sub; // advantages of statement var inst = new sub(); the following lines return true in case, when adding sub.prototype.constructor = sub or not. console.log(inst instanceof sub) // true console.log(inst instanceof super) // true i guess, may useful when getting new instances when and/or how? thanks in advance. it's reset constructor property accurately reflect function used construct object. sub.prototype = new super(); console.log(new sub().constructor == sub); // -> 'false' sub.prototype.constructor = sub; console.log(new sub().constructor == sub); // -> 'true'

linq - Performance tuning C# permutations and SHA1 code -

although university assignment (homework) i've come best solution think of. achieve full marks code matches question, specially allowed develop in c# rather else using java, kind of "yeh, show c# can do" challenge ;-) the question was: create program find password of sha1 hash using brute force technique, assuming passwords 6 characters long , can contain lower-case a-z , 0-9. i created linq query , after have possible combinations need run them through sha1 hash , compare provided password hash. i created code: public static string bruteforcehash(string hash) { var results = c0 in enumerable.range(0, 36) c1 in enumerable.range(0, 36) c2 in enumerable.range(0, 36) c3 in enumerable.range(0, 36) c4 in enumerable.range(0, 36) c5 in enumerable.range(0, 36) sele

php - How to add Google Maps to Wordpress site (not posts or pages) -

i want add google maps index page on wordpress site i'm designing. i've been looking everywhere can find plugins allows me add posts , pages. that's not want. i want map looks map 10 here: http://gis.yohman.com/blog/2010/10/27/wordpress-plugin-google-maps-shortcode/ on first page. how do that? tried install plugin add: < ?php echo do_shortcode ( '[shortcode goes here..]' ); ?> on index.php. doesn't work. shall do? please me. forget plugins , wordpress specific stuff, why overly complicate adding 1 thing 1 page? get google maps code directly google maps website. add index.php template file want map appear. if index.php template used more home page, copy contents home.php , template file wordpress use homepage if exists.

asp.net mvc 2 - Collections.Generic.Dictionary<TKey,Tvalue> model binding from Viewmodel to controller -

i have problem : when try post submit view httppost actionresult null value. this code : public class whitelistviewmodel { public string badge { get; set; } public ienumerable<string> selezioni { get; set; } public ienumerable<bool> abilitazioni { get; set; } } public actionresult whitelist() { return view( "whitelist", masterpage, new whitelistviewmodel()); } [httppost] public actionresult whitelistp(ienumerable<whitelistviewmodel> whitelist ) { bool[] abilitato = new bool[whitelist.single().abilitazioni.count()]; string[] selezione = new string[whitelist.single().selezioni.count()]; ... } <%@ page title="" language="c#" masterpagefile="~/views/shared/siter.master" inherits="system.web.mvc.viewpage<ienumerable<_21112010.viewmodel.whitelistviewmodel>>" %> <asp:content id="content1" contentplaceholderid="ti

How do I search for a tabulator in VI? -

i wondering if there possibility search tabulator in vi . used vim, machine on editing file doesn't have vim, please don't suggest use vim. why should not work /\t? must have been possible vi aswell, no?

postgresql - Using regex in WHERE in Postgres -

i have the following query: select regexp_matches(name, 'foo') table; how can rewrite regex in following (not working): select * table regexp_matches(name, 'foo'); current error message is: error: argument of must type boolean, not type text[] sql state: 42804 character: 29 write instead: select * table name ~ 'foo' the '~' operator produces boolean result whether regex matches or not rather extracting matching subgroups.

image - Img in floating container not clickable in Explorer -

i have anchor element in div "imgbox" containing image , caption, , div "textbox" containing text. now when float div.imgbox, img element inside no longer clickable; caption , text in div.textbox is. happens in internet explorer; other browsers work fine. does know what's causing (and how solve it)? thanks! here's css , html i'm using: <style> .wrap { display: block; overflow: hidden;/* makes wrap around floats */ cursor: pointer; } .imgbox { float: left; } .textbox { overflow: hidden;/* positions div next float */ } </style> <div class="wrap"> <a href="#"> <div class="imgbox"> <img src="http://jaron.nl/misc/dummy.gif" width="80" height="45" alt="" /> caption text clickable </div> <div class="textbox">

Set Selected Item of WPF Combobox to User Setting -

i have combo box item source set collection of 'category'. selectedvaluepath categoryid property. have user setting 'defaultcategory' integer of should set categoryid. want combo box have selection of defaultcategory user setting. xmlns:my="clr-namespace:myapp" <combobox x:name="cmbcategory" displaymemberpath="category" selectedvaluepath="categoryid" selectedvalue="{binding source={x:static my:mysettings.default}, path=defaultcategory, mode=twoway}"/> you create additional application setting called defaultcategory_selected of type int , scope of user , , binding selectedindex property setting. <combobox selectedindex="{binding path=defaultcategory_selected, mode=twoway}" ... />

Android service polling to database -

i want create service upload images server, reading path database. should upload 1 image @ time , after uploading server should update table. i have activity take pictures , saves database. what best way this. thanks satty...

perl - Does the greediness of a regex matter after all need matches have been used? -

the title pretty says all. i have regex need match names of virtual machines array. the regex looks this: /^(?<id> \d+)\s+(?<name> .+?)\s+\[.+\]/mx after last capture group matched have no need left overs other using them stop match @ correct place characters in capture group correctly matched. matter how greedy left overs if not being used? here example of string matching, before match. 432 test box åäö!"''*# [store] test box +w6xdpmo2iq-_''_+iw/test box +w6xdpmo2iq-_''_+iw.vmx slesguest vmx-04 here example if string matching, after match. 432 test box åäö!"''*# like ask above, if need first 2 capture groups matter how greedy uncaptured part @ end is? there no difference between \s+ , \s+? long preceding quantifier .+? remains lazy; match @ least 1 space , expand needed until following [ . i first said there might difference between \[.+\] , \[.+?\] if more 1 pair of data item

security - Authorization and Token Validation with WCF Service -

i working on internal test framework in 1 of requirements able allocate resource can used within test (e.g. allocate physical pc used part of test). resource has wcf service running on , test talks using proxy. as part of framework, add level of authorization after allocating resource, token retrieved , presented service running on resource , must validated resource's service. we've come 2 main options this: 1. * federated security * - proxy talks resource gets token security token service , presents resource's service validates it. seems cleanest solution, main issue revocation of token after device released. 1 option have token have timeout of few mintues , worst case resource unused few minutes - less ideal. 2. * validation token service in each call * - in solution, resource service uses token service validate token (instead of validating using public key in solution #1). solves issue of revocation, seems tons of overhead validate service each call.

android - Permission errors when cropping after taking a photo -

i want take photo intent on android.provider.mediastore.action_image_capture, next crop result with: intent intent = new intent("com.android.camera.action.crop"); intent.setclassname("com.android.camera", "com.android.camera.cropimage"); i follow sugestions made at: android: crop image after taking camera fixed aspect ratio however when calling crop activity (already checked logcat output) permission error, saying like: permission denial on intent access temporary image created camera activity on sdcard. can please suggest solution android 2.2 ? thank you cgm, do have <uses-permission android:name="android.permission.write_external_storage" /> in androidmanifest.xml ? it required modify on sd card.

transactions - How to obtain current isolation level on DB2? -

i trying learn how transactions work in db , wrote following test sql: savepoint stop_here on rollback retain cursors; insert testschema."test" (id, name) values (89898, 'sdfasdfasd'); rollback savepoint stop_here; select * testschema."test"; after execution of code 1 row added table. if add following line @ beginning: set transaction isolation level read committed; all work expected, i.e. transaction correctly rolled , no new entries in db, if run code again data studio shows me error in first line: [sql0428] sql statement can not launched. so questions are: there way obtain current isolation level , why can't set isolation level more 1 time? i thankful answers , links. ps. using db2/iseries v5r4. pps. sorry bad english you can current isolation level special register current isolation . sql0428 because didn't commit or rollback before setting isolation level, , there transactions still in process in session.

Post data and retrieve the response using PHP Curl? -

i'm new working web services, , i'm finding pretty confusing. if have url i'm trying post json data to, understand how using curl php method. what i'm wondering is, if this, , url has kind of server response.. how response in php , use take different actions within php accordingly? thanks! -elliot you'll have set curlopt_returntransfer option true. $ch = curl_init($url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $params); curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch); curl_close($ch); the response request available in $result variable.

css - How to fill a cell with an image -

hi using 3px*10px gradient image fill in want fill in complete cell image , wanted stretch images automatically if content of cell increases..however dont want repeat image gradient looks ugly. can please help. the code snipet follows. <html> <head></head> <body> <table border=1> <tr><td>a<td rowspan="9" style="background-image:url('images/bg_menu_hov.gif');background-repeat:no-repeat; height:100%;">&nbsp<td>b</tr> <tr><td>c<td>d</tr> <tr><td>e<td>f</tr> <tr><td>c<td>d</tr> <tr><td>e<td>f</tr> <tr><td>c<td>d</tr> <tr><td>e<td>f</tr> <tr><td>c<td>d</tr> <tr><td>e<td>f</tr> </table> <body> </html> depending on image, need set background-repeat differently. stretching ima

javascript - How to use feature detection to know if browser supports css hover? -

how can use feature detection determine whether browser supports :hover pseudo class? want without using conditional comments include ie6-specific script files if possible. the :hover pseudo-class supported standards compliant browsers. browsers ie6 support <a> elements. you can use hover changes on thing using jquery, name one. $('.class').hover( function(){ $(this).addclass('hover'); }, function(){ $(this).removeclass('hover'); }); in css, use class .hover in place of pesudo-class :hover

Detect which button was clicked in a 2D array Java -

in our code have 10 10 button array. made 10 10 array using nested loop, , have no issue creating buttons. also, have when button clicked displays "button clicked". how can identify which button clicked? we're using actionlisteners , actionperformed methods. you can call getsource() method on event. or can use action classes in buttons , create new instance of each when build buttons.

C++ Dereferencing char-Pointer (image array) is very slow -

i have trouble getting fast access unsigned character array. i want copy bgrabgra....bgrabgra.... linewise coded image array opencv-version uses 3 layers. code below works fine slow (around 0.5 seconds 640*480 image). pointed out dereferencing operator * makes slow. have plan how fix this? (hint: byte unsigned char) // run thorugh pixels , copy image data (int y = 0; y<imheight; y++){ byte* pline= vrim->mp_buffer + y * vrim->m_pitch; (int x = 0; x<imwidth; x++){ byte* b= pline++; // fast pointer operation byte* g= pline++; byte* r= pline++; byte* a= pline++; // (alpha) byte bc = *b; // slow! byte gc = *g; // slow! byte rc = *r; // slow! } } thanks! shouldn't - there no way taking 0.5sec 640x480 unless doing on 8086. there other code aren't showing? destination memory doesn't go anywhere ps take @ cvcvtcolor() uses optimized sse2/simd instructions

Adding runtime-library-path to flex build configuration using ant mxmlc task -

i'm trying build flex project, linking rlss. when setting project in flex builder, corresponding "build configuration" (that got adding -dump-config compiler options) generates (among other things) tag : <runtime-shared-libraries> <url>some-lib.swf</url> <url>some-other-lib.swf</url> </runtime-shared-libraries> now, trying build project using mxmlc ant task, can't seem add reference share-library. thought have help, didin't: <!-- skipping attributes don't think relevant ... --> <mxmlc ....> ... <runtime-shared-library-path> <url rsl-url="some-lib.swf"></url> <url rsl-url="some-other-lib.swf"></url> </runtime-shared-library-path> </mxmlc> so missing here ? thanks you need specify path swc of custom libraries via "path-element" attribute on "runtime-shared-library-path" element , define "rsl-url"

sockets - C# Simulate TCP port not responding -

i have proxy server written in c# runs windows service. listens on 127.0.0.1:xxxxx xxxxx can range of ports 53500 up. the proxy works ports stop responding , when try telnet them says request timed out or did not respond. i have not been able reproduce problem in development area think has causing beginreceive not called after endreceive. following quote thread symptoms experiencing. similar problem when using asynchronous communication , there execution path turns out not call beginreceive once previous endreceive completed. makes socket ignorant further data sent remote side. is there way simulate situation port stops responding. want write code check if port responding before proceeds request. if not responding can remove listener on port , add again. band-aid keep proxy crashing until can determine cause of problem. i've added logging determine causing ports stop responding. i'm taking stab in dark, code wrapped in try block? if block place call

ruby on rails - ruby_filemagic uploads in AJAX form, not otherwise -

i'm updating project uses ruby_filemagic upload images. there ajax form in iframe works, when transport code form, apparently identically structured (eg multipart, referring same object, in case @listing), throws error. why case? there behaviour in ajax environment the failing form tag looks : <form action="/listings/add_description" class="edit_listing" enctype="multipart/form-data" id="edit_listing_26" method="post" onsubmit="return validateform(this,'listing_description');"> <div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="2vyjp37ff1adoob6zdets4frdxwgngnqqstb+honwu0=" /> while 1 works looks : <form target="imageupload" method="post" id="new_listing" enctype="multipart/

opengl - GPU memory allocation for video -

is possible allocate memory on gpu without cuda? i'm adding more details... need video frame decoded vlc , have compositing functions on video; i'm doing using new sdl rendering capabilities. works fine until have send decoded data sdl texture... part of code handled standard malloc slow video operations. right i'm not sure using gpu video me let's clear: trying accomplish real time video processing? since latest update changed problem considerably, i'm adding answer. the " slowness " experiencing due several reasons. in order " real-time " effect (in perceptual sense), must able process frame , display withing 33ms (approximately, 30fps video). means must decode frame, run compositing functions (as call) on it, , display on screen within time frame. if compositing functions cpu intensive, might consider writing gpu program speed task. the first thing should is determine bottleneck of application is exactly. strip applicat

Android 2.2: diminished reality -

i planning develop diminished reality application android phone. if theres existing frameworks , is. tell me start? thanks to started recommend download android ndk , opencv framework , read paper people did video demo paper tu ilmenau (pdf) . sounds fun project.

jar - Eclipse cannot find Twitter class in twitter4j -

i'm using twitter4j 2.1.11 jar, eclipse doesn't seem able find classes within it. added jar referenced library, twitter cannot resolved type when trying use it. can add imports import twitter4j.* not import twitter4j.twitter . i can tell class available present when open jar in archive viewer. how can eclipse behave? the problem having was importing wrong archive, sources archive rather 1 found in /lib of twitter4j download.

iphone - Thread and NSTimer -

i making application has timer. count minutes , seconds given time down 0. when happen launch alertview. my structure this: mainthread method allocate new thread , initialize it. entrypoint(method) thread has timer invokes method calculating time left, , if time up, displays alertview. however, correct? because updating gui thread main...and bad right? , displaying alertview thread. i thought of making method encapsulate logic updating , displaying alertview , in method nstimer invokes use performselectorinmainthread, correct? thanks time. assuming it's simple determine how time left, run timer on main thread. timer gets attached current runloop, it's not blocking anywhere, , callback method shouldn't take inordinate amount of time run, , can therefore update ui nicely. - (void) initializetimerwithendtime: (nsdate *) endtime { // call on main thread & it'll automatically // install timer on main runloop self.countdowntimer = [nst

php - How do I show an element on page load, but only the first time the user loads the page? -

not sure how make work. guessing can store cookie or (i unfamiliar cookies or session tracking). basically, when visits page, want load div element (like "welcome to..."). if visit page again later, don't want div load. better, if visit page, couple weeks later, make div element load again. server running php (wordpress). any appreciated. cookies ask. can set expiration date on cookie, allow welcome message come again if user hasn't visited site in few weeks. here's quick tutorial on using cookies in php.

ios - UIView transitionFromView -

i'm pretty new on ios programming. , i'm stuck @ (i'm sure) simple issue. don't know i'm doing wrong... -my viewdidload: [super viewdidload]; cgrect frame = cgrectmake(0, 0, 768, 1024); uiview *uno=[[[uiview alloc] initwithframe:frame] autorelease]; uiimageview *mainview = [[[uiimageview alloc] initwithframe:frame] autorelease]; mainview.image = [uiimage imagenamed:@"photo.jpg"]; [uno addsubview:mainview]; uiview *dos=[[[uiview alloc] initwithframe:frame] autorelease]; uiimageview *mainviewdos = [[[uiimageview alloc] initwithframe:frame] autorelease]; mainviewdos.image = [uiimage imagenamed:@"default.png"]; [dos addsubview:mainviewdos]; // [self.view addsubview:uno]; // [self anima:uno:dos]; and anima method: -(void) anima:(uiview *)uno:(uiview *)dos{ [uiview transitionfromview:uno toview:dos duration:2.0 options:uiviewanimationoptiontransitionflipfromleft

Zoom to Fit to canvas size in C#? -

i have canvas changes size depending on users input, want hit button , able zoom out see whole canvas. know height , width of canvas want zoom in or out user can see whole canvas. have zoom in , zoom out work not sure how zoom fit? thoughts? february 11th thank response, great , able zoom out on canvas completely. problem having user has zoom in, , zoom out controls. if user zooms in , out , tries zoom fit canvas scaling factor off, code below this basic zooming in , out on canvas: double scalerate = 1.2; public void buttonzoomin_click(object sender, routedeventargs e) { st.scalex *= scalerate; st.scaley *= scalerate; } public void buttonzoomout_click(object sender, routedeventargs e) { st.scalex /= scalerate; st.scaley /= scalerate; } the zoom fit button want press zoom out on canvas: private void zoomtofitbt_click(object sender, routedeventargs e) { float maxwidthscale = (float)scrollviewer

hdf5 - MATLAB: Differences between .mat versions -

Image
the official documentation states following: . have noticed there other important differences besides stated in table above. for example, saving cell array 6,000 elements occupies 176 mb of memory in matlab gives me following results depending on whether use -v7 or -v7.3 : with -v7 : file size = 15 mb , , save & load fast . with -v7.3 : file size = 400 mb , , save & load very slow (probably in part because of large file size). has else noticed these differences? update 1 : replies point out, -v7.3 relies on hdf5 , according mathworks, "this format has significant storage overhead" , although it's not clear if overhead due format itself, or matlab implementation , handling of hdf5 instead. update 2 : @andrew janke points this helpful pdf (which apparently not available in html format on web). more details, see comments in answer provided @amro. this takes me next question: are there alternatives combine best of both worlds (e.g. efficie

Can DotNetNuke be used with a reverse proxy? -

can dotnetnuke used reverse proxy server? reverse proxy: proxy server appears client if origin server. useful hide real origin server client security reasons, or load balance (taken google's definition of term). basically dnn respond request using same portal alias request made on. need tell dnn respond request specific domain name only, regardless of domain name request contained. does know if possible, or if possible turn effect off? i found answer: yes! have disable friendly urls.

javascript - How can I play two Youtube videos without linking to a playlist? -

i'm new javascript. i'm embedding youtube iframe here: http://www.heartlandpokertour.com/indexbeta.php using documentation: http://code.google.com/apis/youtube/iframe_api_reference.html i second video play, looped, after first 1 finished. i'm unable set specific video parameters if try , link/set video id youtube playlist. i'm assuming need setup event listener , function trigger when yt.playerstate.ended (or 0) broadcast, no idea how this. update: here current code i'm using player: <script> // 2. code loads iframe player api code asynchronously. var tag = document.createelement('script'); tag.src = "http://www.youtube.com/player_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); // 3. function creates <iframe> (and youtube player) // after api code downloads. var player; function onyoutubeplayerapiready() {

python - Which django apps are directly usable or easily adaptable for django-nonrel? -

is there list of django apps can used unaltered in django-nonrel or list of django apps can adapted used in django-nonrel? i used django-dbindexer same guys made django-nonrel use django-registration without modifications.

c# - Problems Querying nested lists in RavenDB -

i want use ravendb project doing, before can, need figure out how query nested objects... let me explain have class this: public class customer { public string id { get; set; } public string name { get; set; } public ilist<orders> { get; set; } } then order class: public class order { public int ordernumber { get; set; } public decimal orderamount { get; set; } public bool customerbilled { get; set; } } i create bunch of fake data , add raven -- customers have orders customerbilled set true, customerbilled set false, , mix of true , false on customerbilled. what need with, figuring out how extract list of customers 1 or more orders customerbilled set false. how create query it? can't seem 1 work, , have no idea how. the dynamic queries in ravendb can handle this, think following should want (sorry can't compile code right verify) // list of objects - linq doc in customers doc.orders.any( order => order.customebilled == false) select

unusual behaviour in delphi assembly block -

i running weird behaviour delphi's inline assembly, demonstrated in short , simple program: program test; {$apptype console} uses sysutils; type tasdf = class public int: integer; end; tblah = class public asdf: tasdf; constructor create(a: tasdf); procedure test; end; constructor tblah.create(a: tasdf); begin asdf := a; end; procedure tblah.test; begin asm mov eax, [asdf] end; end; var asdf: tasdf; blah: tblah; begin asdf := tasdf.create; blah := tblah.create(asdf); blah.test; readln; end. it's sake of example ( mov ing [asdf] eax doesn't much, works example). if @ assembly program, you'll see that mov eax, [asdf] has been turned into mov eax, ds:[4] (as represented ollydbg) crashes. however, if this: var temp: tasdf; begin temp := asdf; asm int 3; mov eax, [temp]; end; it changes mov eax, [ebp-4

c# - how many times a file has been downloaded -

i creating web browser using c#, , need specific data web pages loaded in browser. the pages loading download scripts. data want is: number of times file has been downloaded. i want save value in text. what code can use this, or can start? appreciated. most web browsers have own storage. mozilla uses sqlite things. whenever app/browser needs retrieve remote resource (url of kind), log database table. perhaps use sqlite this. decent start create history table this: url --varchar(max) lastaccessed --datetime totalrequests --int

asp.net - Sql SessionState Server and Timeout -

hi there downside using sql server sessionstate server , increasing timeout 2 weeks? goal keep people logged in long possible while keeping webserver memory @ minimum. i think might have few concepts confused here bit. sessionstate , "logged in" can mean 2 different things. sessionstate represents objects/data stored in "session" object within environment. users login typically controlled using asp.net membership system. can have user has persistent login (remember me) session time out after 20 minutes. system still remember them, data "cached" user in session might gone. more directly question, yes, there numerous issues type of approach sql session state, , depending on size of values put session , traffic more or less extreme. this information still going take memory, hard-disk memory on db side, grows can see performance reductions. session abandonment alone cause massive amounts of data cached. as number of session items g

MySQL Workbench error while accessing configuration -

after installing mysql community server 5.59 (64bit) , mysql workbench 5.2.31a , setting try accessing db's configuration , receive following error: configuration file 'c:\program files\mysql\mysql server 5.0\my.ini' can not found. new file created on apply of changes. i click ok. when trying apply change second io error not being able write file. it figures installation @ c:\program files\mysql\mysql server 5.5 , not @ c:\program files\mysql\mysql server 5.0 . why workbench search there? try: can change base directory in server administration-> manager server instances > local mysql >system profile > configuration file : <your dir>\my.ini (click directory)

c# - DataContractSerializer serializing List<T> getting error -

i trying serialize list, serializes (i think fine), when deserialize, sorry amount of code, stuck , have no idea why happening, tried changed struct class , no help. thanks. i following error updated there error deserializing object of type there error deserializing object of type `system.collections.generic.list`1[[a.b.c.datavalues, a.v, version=1.0.0.0, culture=neutral, publickeytoken=null]]. unexpected end of file. following elements not closed: time, datavalues, arrayofdatavalues.` i serializing updated public void serializedatavalue(list<datavalues> values) { datacontractserializer serializer = new datacontractserializer(typeof(list<datavalues>)); using (memorystream stream = new memorystream()) { using (gzipstream compress = new gzipstream(stream, compressionmode.compress)) { xmldictionarywriter w = xmldictionarywriter.

ruby on rails - redcloth (MissingSourceFile) - new problem after Heroku changed to bundler 1.0.7 -

our app had been working. pushed new code staging on heroku 1st time after moved bundler 1.0.7. our app crashes , got error message - /usr/ruby1.9.1/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require': no such file load -- redcloth (missingsourcefile) we're on rails 2.3.8. here part of gemfile - gem 'rails', '2.3.8', :require => nil gem 'redcloth', :require => 'redcloth' any ideas on how fix problem? thanks. i'm on heroku , have : gem 'redcloth', '4.2.3'

streaming - XMPP/AMQP/Websockets vs Pusher/Beacon push? -

with pusher , beacon push cloud services can live updates in browsers. implement chat functionality. can't these cloud services replace need of me learning xmpp/amqp/websockets/comet implement same kind of live updates/feeds? these services offer infrastructure service don't have worry underlying technology. said services use technology selling point e.g. pusher use websockets sell service. as pusher there similar services i'd recommend checking out real-time tech guide others haven't been mentioned (i work pusher). can't these cloud services replace need of me learning xmpp/amqp/websockets/comet implement same kind of live updates/feeds? yes. point in these frameworks , services abstract away underlying connection , protocols provide reasonable real-time communication pattern (simple messaging, pub-sub, evented pub-sub, rpc/rmi or datasync) works application functionality looking build.

ajax - jQuery: Why isn't IE8 sending a request during this call to .load()? -

i trying make use of hash symbol enable back-button , refresh functionality in ajax web app. in firefox , chrome when click refresh browser reloads , when script below run new request made using url appears after # sign. in ie8 request never made during refresh, alert pops if has! can reproduce behavior in simplified html document posted here: full html doc http://pastebin.com/cvyswtup sample code $(document).ready(function () { // 1. ajax history & button $(window).bind("hashchange", function (e) { if (!ignorehashchange) { // load content $("#content").load(location.hash.substring(1), function () { alert("content loaded!"); }); } ignorehashchange = false; }); // 2. home page / refresh action if (location.hash) { $(window).trigger("hashchange"); } else { location.hash = "customers/list"; } }); edi

linux - Can I use grep to find a file including a particular string? -

can use grep find file including particular string? example, find file containing "abc" without knowing file name. grep -l "abc" * if want recursive , grep -r -l "abc" * if have ruby(1.9+) dir["**/*"].each |file| if test(?f,file) open(file).each |line| if line[/abc/] puts "line: #{line}" puts "file: #{file}" end end end end

csh - C Shell Scripting - find command -

i trying use find command, , wondering if there simpler way regex find files specific ending? in assignment, have find files end in .c (like c program's source code file) isn't find . -name '*.c' simple enough?

html - border on submit button image -

i trying image border go away on submit button , can't seem find magic code fix it. <input name="insert" type="image" id="insert" alt="register" width="189" height="38" border="0" src="../../images/register.png" onmouseover="mm_swapimage('insert','','../../images/register_f2.png',1)" onmouseout="mm_swapimgrestore()" /> style="border: 0px;" should it.

csh - C Shell Scripting - append to the end of a file name -

so i'm taking in number of files, , wish copy them directory , store them added file extension, ".copy". i'm not sure command can use append end of file, simpler thinking or need command? do plan using loop or trying find one-liner? if have file $f , can $f.copy appended version.

Select @var = temporal table result from function SQL Server? -

if have function returns temporal table, how set var in sql server saves it? if result of function like: temp table item1 item2...itemn 1 2... n is valid? select @table = * dbo.some_function() ?? if possible, make example, of how use @table var knowing values? if not possible, how can access temp table function returns?? if function returning table, should able have: insert @table (col1, col2) select * dbo.some_function() you'd need specify columns you're going using either insert or select portion of statement. update: here's i've come can find out columns. first part enabling server can return , use stored procs normal table (check dba or whoever runs server they're ok these options being turned on). select resultset temp table, run sp_columns stored proc in tempdb , insert temp table (which drop). way, @ least know columns you've got, , can possibly use make easier work dynamic column names perhaps. s

regex - How to match exact "multiple" strings in Python -

i've got list of exact patterns want search in given string. i've got real bad solution such problem. pat1 = re.compile('foo.tralingstring') mat1 = pat1.match(mystring) pat2 = re.compile('bar.trailingstring') mat2 = pat2.match(mystring) if mat1 or mat2: # whatever pat = re.compile('[foo|bar].tralingstring') match = pat.match(mystring) # doesn't work the condition i've got list of strings matched exactly. whats best possible solution in python. edit: search patterns have trailing patterns common. you trivial regex combines two: pat = re.compile('foo|bar') if pat.match(mystring): # whatever you expand regex whatever need to, using | separator (which means or in regex syntax) edit: based upon recent edit, should you: pat = re.compile('(foo|bar)\\.trailingstring'); if pat.match(mystring): # whatever the [] character class. [foo|bar] match string one of included characters (since there

How to wipe or reset a table in Lua -

how go wiping or resetting table in lua. want make blank table in end. you iterate on keys , make them nil. for k,v in pairs(t) t[k] = nil end if it's array remove values table.remove()

join query in mysql -

i having table structure table1 table2 pid pname pid uid cat 1 1 1 1 2 b 1 2 1 3 c 1 3 1 select * table1 t1 left join table2 t2 on t1.pid=t2.pid t2.uid=1 , t2.cat=1 it's select 2 rows i don't want group pid because may have same pid in table 1 need number of rows matched pid this may silly question tried hard couldn't . i hope people can me! thanks in advance if want count of rows match: select count(*) table1 t1 inner join table2 t2 on t1.pid = t2.pid t2.uid=1 your left join unnecessary, since filtering table2. http://en.wikipedia.org/wiki/join_%28sql%29

c# - group by first letter of the string -

i have person table, huge number of records, , want group duplicate persons in it, 1 of requirements persons duplicates, if have same family name, , first letter of first names equal, want group first name, , first letter of family name, there way group in sql this? need in c#, code processing done, number of persons huge, should fast algorithm. select member.member_firstname, count(member.member_lastname) dbo.member group member.member_firstname, substring(member.member_lastname, 1,1) having count(member.member_lastname) > 1 this query give (members in case) first name same , last name's first letter same more 1 member. in other words duplicates you've defined it.

iphone - UINavigationController app crashes when clicking the "back" button -

hoping can me. in didselectrowatindexpath method, loading , pushing detail view controller, when tap "back" button in detail view go root view, app crash. no error logs or anything. i'm 95% sure it's got "rides" object being released early, can't figure out. thanks help! #import "ridesviewcontroller.h" #import "ridedetailviewcontroller.h" #import "json.h" @implementation ridesviewcontroller @synthesize rides; #pragma mark - #pragma mark view lifecycle - (void)viewdidload { [super viewdidload]; self.tableview.backgroundview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"table-view-background.png"]]; rides = [[nsdictionary alloc] init]; nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"rides" oftype:@"json"]; nsdata *jsondata = [nsdata datawithcontentsoffile:filepath]; nsstr

dojo - How can I customize editing behavior of dojox.Grid? -

i using code like: var paymentlayout = [ { field: "id", name: "id" }, { field: "paymentdate", name: "payment date",editable: true } ]; paymentsgrid = new dojox.grid.datagrid( { query: { id: "*" }, store: store, structure: paymentlayout }, "gridnode" ); paymentsgrid.startup(); now want customize editing behavior of grid. example, show date picker editing date field. i have found dojox.grid.editors.datetextbox , not able find example of usage. how can tell grid use editor payment date column in above example? take at: dojo datagrid date , time

RegDBKeyExists function fails to read in Installshield -

have developed msi package in installshiled 2008 premier edition , project type installscript msi, bought 2011 , upgrdaded our project 2011. in earlier version used check registry entries microsoft sql express , path **hkey_local_machine\software\microsoft\microsoft sql server\instance names\sql** now new require came create package 64 bit o.s., since o.s. 64-bit registry path sql express in 64 bit is **hkey_local_machine\software\wow6432node\microsoft\microsoft sql server\instance names\sql** the registry function regdbkeyexists check sql registry's presence, function returning negative number -2147483646 , fails read. setting option regdb_options = regdb_options | regdb_option_wow64_64key not because not reading 64 bit related registry hive. please help. thanks don't worry much; registry reflection makes right thing without code. when 32-bit app accesses hkey_local_machine\software\microsoft\microsoft sql server\instance names\sql on 64-bit