Posts

Showing posts from May, 2010

html - Incorrectly redirecting user back to a PHP page after submitting a form -

all, this question has simple answer - i'm overlooking. maybe can tell me look... i have php page ("index.php") simple login form (e.g., username , password). when user clicks "submit" button, form posts values php page ("login.php"). page supposed confirm user's credentials, following: if user's credentials not correct, redirect user error.php, along error message if user's credentials correct, create session , set $_session['authenticated'] = true, redirect him "loggedin.php" [update] then, on loggedin.php, check see isset($_session['authenticated']) returns true. if does, proceed. if not, redirect user index.php. however, here's happens. first time fill out form (with valid creds) , submit it, can see briefly in url bar user sent login.php, loggedin.php, back index.php. but, if re-enter same credentials , submit info second time, works should. so, in short, looks either login.php...

Delphi Interbase Sql Conversion to Sql Server and Oracle -

i have delphi application uses database interbase / firebird. consult , write data use interbase components palette (ibtable, ibquery, ibdataset). i'm performing conversion of system sqlserver / oracle have thousands of queries assembled @ runtime sql instructions specific of database interbase/firebird. know component or tool makes parse commands interbase -> sql server or interbase-> oracle ? what need like: var parser: tparser; outputsql: string; begin parser := tparser.create(); parser.text := 'select first 10 cityname tbcity'; if firebird outputsql := parser.parseto('sqlserver'); if oracle outputsql := parser.parseto('oracle'); componentaccess.sql.text := outputsql; ... the result of: parser.parseto('sqlserver'); will be 'select top 10 cityname tbcity' and parser.parseto('oracle'); will be 'select cityname tbcity rownum <= 10' 1) afaik, librari...

Why to use empty parentheses in Scala if we can just use no parentheses to define a function which does not need any arguments? -

as far understand, in scala can define function no parameters either using empty parentheses after name, or no parentheses @ all, , these 2 definitions not synonyms. purpose of distinguishing these 2 syntaxes , when should better use 1 instead of another? it's question of convention. methods empty parameter lists are, convention, evaluated side-effects. methods without parameters assumed side-effect free. that's convention.

c++ - When to use QThread::exec() -

i've checked satisfying explanation not find. docs mention in order use signals/slots between threads, need use event loops , start them calling exec. however can see w/o using exec(), can still send signals , handle them across threads. what's exact use of it? use qthread::exec() when want run event loop qt provides in qthread class. if don't call exec(), need create own event loop processes qt events (that is, if want signals / slots work). more work it's worth, unless have specific needs. you can still send signals / slots? guess you're not running on different thread. common issue when using qthread. put breakpoint inside code think running on different thread , have @ stack trace - may in shock!

xml - Conditional XPath matching -

i have xml looks this... <tbody> <tr> <td> <h5> <a class="foo" name="bar">this element want condition on.</a> </h5> </td> </tr> <tr> <td> <a href="/generic/generic">this element want match on</a> <td> <td></td> <td></td> </tr> <tbody> how match on second first 's name attribute "bar", using xpath? this expression work... //tr[preceding-sibling::tr/td/h5/a/@name = 'bar']/td/a but there errors in xml. here's edited version: <tbody> <tr> <td> <h5> <a class="foo" name="bar">this element want condition on.</a> </h5> </td> </tr> <tr> <td> <a hr...

confusion: xauth or oauth or my own auth? -

i'm logged in a.com now i'm on b.com b.com accesses localstorage , sees i'm logged in a.com and asks me if want download pictures a.com 1- if don't want b.com know have accounts on local storage? 2- if a.com specifies sites can see token how hell a.com supposed know, sites users go to? 3- prevents b.com not authorizing without asking me (it has access whatever token stored a.com), if token weak one, - what's use of except letting b.com know i'm logged a.com? - if no authorization can occur token how can xauth can compared oauth. because oauth have go a.com , specify want b.com access photos , post wall can not send me emails. , when interaction occur xauth? 4- think oauth , xauth crappy interim solutions replaced totally new or think o/xauth 10.0 solution connected web? 5- suggestion a.com give access b.com - invest time , o/xauth, or write function produces 2 tokens , done it? thanks. ps: i'd appreciate answers people have implemen...

alias - Aliasing a command in vim -

vim preferred text editor when program, , run particularly annoying issue. frequently, when need save buffer , continue on other miscellaneous task, typical :w however, – seems more 50% of time – manage capitalise :w . naturally, vim yells @ me because w invalid command e492: not editor command: w my question how can 1 alias colon-commands in vim . particularly, exemplify how alias w w . i aware of process map keys commands . unfortunately, not i'm looking for. to leave completion untouched, try using cnoreabbrev w w , replace w in command line w , if neither followed nor preceded word character, :w<cr> replaced :w<cr> , :write won't. update here how write now : cnoreabbrev <expr> w ((getcmdtype() is# ':' && getcmdline() is# 'w')?('w'):('w')) as function: fun! setupcommandalias(from, to) exec 'cnoreabbrev <expr> '.a:from \ .' ((getcmdtype() is# ...

c# - transforming an image into an array of lines to draw -

how generate list of lines draw if have pixel data image, don't have draw every pixel? language do, although listed have working knowledge for. c ok well. there limit how many tags choose. also, can point me toward algorithm. you looking "raster vector" algorithm. term comes graphics display systems, used crt (cathode ray tube) display itself. there 2 approaches displaying graphics: "raster" scan of series of lines left right, top bottom, each line made of on/off pixels. controller of crt's electron gun scanned same pattern on , over, varying intensity of electron beam. on "vector" display, electron gun draw straight line between 2 points - no aliasing, no pixelation, pure straight line. vector displays capable of higher resolution, limited number of lines draw - if drawing had many lines, display begin flicker time take redraw picture (to refresh phosphors of crt) take longer persistence of crt's phosphor surface. raster disp...

Rails, Why does this helper not output HTML, but rather HTML in quotes? -

i have following helper in application_helper.rb file: def topmenu pages = { "projects" => projects_path, "photos" => photos_path } pages.map |key, value| classnames = %( class="current") if controller.controller_name == key "<li#{classnames}>#{link_to(key, value)}</li>" end end then in application.html.erb file have: <%= topmenu %> for reason, page generating showing html above helper text, not html. not sure why? thx i presume you're running rails3. add .html_safe method call before returning string: "<li#{classnames}>#{link_to(key, value)}</li>".html_safe

Get visiting company name in rendering from Sitecore OMS -

we using sitecore oms , want name of visiting company (allthough know not allways accuarate) show in rendering. know if possible question analytics api kind of information? found this blog post ! var sessionid = analyticstracker.current.currentsession.sessionid; var ipowner = analyticsmanager.getipownerbysessionid(sessionid);

.net - MCMS 2002 - How to implement redirection -

our company's website built on mcms 2002. on iis6 , need redirect our site users our new website in domain. options redirection in mcms 2002? mcmsfaq.com has link redirection control - redirector, link 404. will isapi_rewrite work mcsm-2002? i urgently need hands-on advice on how this. thank you use helicon tech's isapi rewrite. there's lite (free) version on here . if don't fancy regular expressions, can create aspx response.redirect.

localization - How can I make Rails 3 localize my date formats? -

i working on rails 3 project there place date input within form. text field date uses date picker there no concern date being entered in wrong format, date being displayed in :db format (e.g. 2010-01-21). (note: in form fields - e.g. <%= f.text_field :publish_date %> , should automatically use :default format, , shouldn't need provided value) i have tried adding in customized locale has following date configuration: date: formats: # use strftime parameters formats. # when no format has been given, uses default. # can provide other formats here if like! default: "%d/%m/%y" short: "%b %d" long: "%b %d, %y" and setting locale ( config.i18n.default_locale = "en-au" ) doesn't seem take , becoming quite frustrating. the app support number of locales, setting initializer override date formats @ application startup isn't suitable, , know should work - i'm guessing i've misse...

c# 3.0 - Forcing the use of a specific overload of a method in C# -

i have overloaded generic method used obtain value of property of object of type pagedata . properties collection implemented dictionary<string, object> . method used avoid tedium of checking if property not null , has value. a common pattern bind collection of pagedata repeater. within repeater each pagedata container.dataitem of type object . i wrote original extension method against pagedata: public static t getpropertyvalue<t>(this pagedata page, string propertyname); but when data binding, have cast container.dataitem pagedata : <%# ((pagedata)container.dataitem).getpropertyvalue("someproperty") %> i got little itch , wondered if couldn't overload method extend object, place method in separate namespace (so not pollute inherits object ) , use namespace in aspx/ascx files know i've databound collection of pagedata . this, can avoid messy cast in aspx/ascx e.g. // new overload public static t getpropertyvalue<t>(this o...

tfs2008 - Will deleting a project in TFS remove the files, or will the history be preserved? -

the reason i'm asking want test something, expect generate number of commits, totalling lot of data, , since it's test, don't want leave them permanently in database. do have set temporary tfs server this, or can delete project afterwards , expects disk space reclaimed? disk space not reclaimed normal deletion. have option undelete in tfs, changes never lost. (it's kind of feature in source control system). do remember tfs stores files diffs between commits, disk space usage might not large expect. you can, however, use tf.exe destroy permanently delete changes. think allow reclaim disk space (though haven't tested personally). please cautious if using tf destroy .

windows - Egit very slow at handling big projects -

the problem egit/eclipse slow @ dealing big java projects (~2,000k files). slow means following on windows 7/quad core/ssd setup: 60 seconds drawing commit window another 30 s doing commit (would acceptable) 60 s drawing push window (changes view) another 120 s pushing (would acceptable, too) 1,620 s (27 m) synchronize between 2 branches (both have been checked out sometime) for productive environment times not acceptable. don't think i'm doing wrong, because testing on new project results in "real world" performance. is usual? i find egit synchronize slow on large/medium size project. thought may have number of untracked files in local repository not case. each branch on java project @ least 2000 java files, not accounting resource, presentation layer artifacts. i did not find similar issues git command line on windows (mingw), git status/diff or command matter.

cocoa touch - how to set image as background programmatically,iphone -

hi all, how set image wallpaper, programmatically, in iphone? suggestions appreciated. regards if you're talking changing phone's wallpaper, that's not possible programmatically.

How do statically-typed languages deal without generics? -

i'm curious statically-typed languages have no generics support (and lesser extent languages historically did not have generics), , how deal it. do users cast on place? there special sauce basic collections, lists , dictionaries, allow types generic? why these languages not have generics? avoid potential complexity or other reasons? c—and historical c++, before called c++—requires either manually expand "generic" types non-generics (i.e. c preprocessor macro equivalent of c++ templates) or escape type system (i.e. void pointers). however, arrays (lists) treated composite types rather single type. can have array of shorts, example, not treat same array of chars or of longs. this isn't big problem in c, though inconvenient @ times. represent trade-off 40 years ago, put in context.

asp.net mvc - Stopping MVC ViewMasterPage from resolving CSS URLs -

by default master pages in .net mvc2 placed /folderlevel1/folderlevel2/site.master accessed url domain.com/urllevel1/urllevel2/ resolve url in tag: <link href="/content/site.css" rel="stylesheet" type="text/css" /> to <link href="../../content/site.css" rel="stylesheet" type="text/css" /> this becomes problematic in multi-tennant mvc app. , want stop behaviour. want master page leave url alone. you having issue because asp.net performs magic tricks when specify head tag server side control so: <head runat="server"> these tricks include: resolving relative css paths populating title , meta tags view's @page directive if don't want these tricks, remove runat attribute head tag: <%@ master language="c#" inherits="system.web.mvc.viewmasterpage" %> <!doctype html> <html> <head> <link href="content/si...

winforms - How to disable one row of DevExpress XtraGrid in C# -

i using devexpress xtragrid in c#.net application. want disable or set readonly property particular row of xtragrid . please help. you can use gridview.showingeditor event , set e.cancel = true

java - JTable add rows bottom up - rows added one after the other should appear at the bottom of the last one but all should be bottom aligned -

i have jtable in java swing needs bottom aligned. as in normal tables when row added table placed on top, when next row added added under , on. what place new row @ bottom of table. when new row added new row placed right @ bottom , previous row move up. way rows appear move upward. rows should stick bottom. any ideas how this? you can use decorator pattern. assuming class named tablemodeldecorator decorates tablemodel can implement: public class tableemptyreverserowsmodel extends tablemodeldecorator { private int minimumrows; public tableemptyreverserowsmodel(final tablemodel realmodel, final int minimumrows) { super(realmodel); this.minimumrows = minimumrows; } public int getrowcount() { int realcount = model.getrowcount(); return realcount < minimumrows ? minimumrows : realcount; } public boolean iscelleditable(int rowindex, int columnindex) { int diff = minimumrows - model.getrowcount(); if...

c# - How to tell apart different exception types in BackgroundWorker.RunWorkerCompleted event handler -

i doing little hobby project in c#, language not know well, , have stumbled upon following: suppose have asynchronous operation implemented using backgroundworker. if there exception, event runworkercompleted raised , runworkercompletedeventargs.error non-null. is following canonical way handle different exception types? (here exception kinds siblings wrt inheritance) if (e.error != null) { firstkindofexception e1 = e onekindofexception; secondkindofexception e2 = e secondkindofexception; ... lastkindofexception en = e lastkindofexception; if (e1 != null) { ... } else if (e2 != null) { ... } ... else { ... } } it works, but... doesn't feel right . you use is keep each test tightly scoped: if (e.error firstkindofexception ) { ... } else if (e.error secondkindofexception) { ... } (then re-cast if want special values exception) to honest, though, pretty rare need handle ...

font size in html code -

<html> <tr> <td style="padding-left: 5px;padding-bottom:3px; font size="35;""> <b>datum:</b><br/> november 2010 </td> </html> is code correct? increase font of first line. not sure if have put 2 "'s here. , seems didn't work. try this: <html> <table> <tr> <td style="padding-left: 5px; padding-bottom: 3px;"> <strong style="font-size: 35px;">datum:</strong><br /> november 2010 </td> </tr> </table> </html> notice included table-tag, seem have forgotten. has included if want appear table.

opengraph - Count Comments for Facebook Posts? -

i have bunch of facebook post's, ideas how one comments fast possible? thanks helping using fql: select post_id, comments.count stream post_id in("post_id1", ... , "post_idx") order comments.count desc limit 1

How do you use Parsley with GraniteDS in Flex? -

i want use parsley framework , want use graniteds remoting. of 2.1, graniteds generates as3 service classes java code local proxies, , want use these classes in parsley. i can inject service classes parsley when call of methods null object error at org.granite.tide::component/http://www.adobe.com/2006/actionscript/flash/proxy::callproperty()[c:\workspace_\graniteds\as3\framework\org\granite\tide\component.as:172] @ library::bookservicebase/get()[c:\documents , settings\medlinetec\adobe flash builder 4\library\src\library\bookservicebase.as:36] this because parsley creating instances of service classes without injecting them relevant "context" graniteds remoting. need figure out how give graniteds context service classes parsley instantiates. saw a post on parsley forums recommended: <parsley:contextbuilder> <parsley:flexconfig type="{usermanagerconfig}"/> <parsley:runtimeconfig instances="{[tidecontext]}" /> </...

ruby on rails 3 - scoped and find_within -

iam using geokit-rails (http://github.com/jlecour/geokit-rails branch gem). build scope like a = mymodel.scoped = a.limit(10).scoped = a.find_within(10,:origin => [mylat,mylng]).scoped = a.where(:visible => true) = a.paginate(:page => @params[:page], :per_page => 20) but does't work - after find query fired. scopes .origin , .within (described in documentation of geokit-rails) don't work. in rails2 i'd used rayn bates scope_builder , work until update on rails3. cause i'm not such advanced programmer i'm not able implement own scope geokit-rails. does have idea how prevent activerecord fire query on find_within method? thanks ok solution here: http://github.com/olli/geokit-rails/commit/7df7316870045def9eaaf640d4a068853c8d1962 have fun :)

silverlight or jquery ajax for complex asp.net data form -

so part of web app centers around important form used create form. google docs form. user keys in type (checkbox, textfield, numericfield) , label , slaps system, , generates form somewhere. its little more complex google forms, field types complex , theres lot more form (it happens form generator finance plan) the app asp.net, thinking of using jquery , jquery's own ajax methods post data, think turn hairy situation, thought silverlight, ive never done silverlight before experienced .net guy. so guys think, silverlight tough first timer kinda thing? or should stick jquery. plus points silverlight inhouse lan app , particular page used people high bandwidth. also i'm on .net 4 btw. thanks much. if have time speed on sliverlight i'd great learning experience you. learning how use silverlight skill prove helpful later on. if need true async functionality, bit easier manage in silverlight, keep in mind have more things think silverlight, have wcf/secu...

asp.net mvc and webforms shared authentication -

i have few websites based on webforms , 1 based on mvc. websites have same settings forms authentication in web config. the problem once logged in webforms website, have re-login mvc websites, when log out mvc website, automatically logged out webforms websites. how can pass information mvc website user logged in when using webforms. try article. essentially, want single sign on. term google for. http://www.codeproject.com/kb/aspnet/singlesignon.aspx

Can I use sql bulk copy to copy data within the same server? -

can use sql bulk copy copy data within same server ? yes. in fact, in demo code shown here , copy table within same database.

java ee - How does weblogic clustering work? -

i'm new weblogic. i've read http://download.oracle.com/docs/cd/e11035_01/wls100/cluster/overview.html , searched topic on internet still had hard time understanding of weblogic's clustering concepts. can confirm/correct understandings below? a cluster contains 1 or more logical servers can reside on 1 or many physical servers when deploying j2ee app cluster, tied 1 server in cluster external users of deployed app aren't aware of clustering the log file of app located on server it's deployed if server hosting app fails, it's okay because app in cluster , server pick work? if server hosting app fails, happens logging? maybe got whole concept wrong. point me correct directions? thanks much. i think should understand concept of domain first. the domain parent of cluster. contains typically 1 admin , 1 or more managed servers. cluster grouping of or of these managed servers within domain. hope diagram here helps understanding . o...

javascript - google analytics js file cached but utm.gif still loaded -

i use google analytics uses file ga.js. creates hidden utm.gif file in parameters attached , sent server (to included in google analytics interface) my understanding utm.gif uses "304 not modified" header, ensure file reloaded (rather cached). in case, possible ga.js not loaded (sometimes cached) in browser, still utm.gif works normal (using cached ga.js instead of downloaded ga.js)? in other words, ga.js file need downloaded (for every request) in order utm.gif have right parameters? cheers ke does ga.js file need downloaded (for every request) in order utm.gif have right parameters? no doesn't. script uses parameters inline script add site.

java - Login with HTTPS to htaccess protected directory -

the app building needs perform login username , password. using defaulthttpclient execute request , setting username , password credentials. server expects htacces-login. result not logintoken hoped for. instead returns errormessage. can tell me went wrong in code? thank help! pr private string httploginrequest() { string logintoken = null; string loginurl = "https://somedomain.com/login"; defaulthttpclient client = new defaulthttpclient(); client.getcredentialsprovider().setcredentials(new authscope(authscope.any_host, authscope.any_port), new usernamepasswordcredentials("username", "password")); httpresponse httpresponse; httpentity entity; try{ httpresponse = client.execute(request); entity = httpresponse.getentity(); if (entity != null) { inputstream instream = entity.getcontent(); logintoken = convertinputstreamtostring(instream); } } catch (clientprotocolex...

javascript - How to move and resize the browser's window in Opera and Chrome? -

i looking way resize , move browser's window , i've found these: self.resizeto(w, h) , self.moveto(x, y) - seems work perfectly, in firefox , ie (tested ie8, don't know how works in previous versions). how can force same behavior (resizing , moving) in opera , chrome? in these browsers above solution not work @ all. nothing happens , nothing appears in error console. in opera , chrome can use window.resizeto(w,h); won't affect maximized tabs (so can move , resize popups).

maven 2 - How can I configure additional eclipse settings with m2eclipse? -

with maven eclipse plugin, can configure checkstyle or sonar configurations adding necessary invocations pom.xml , calling "mvn eclipse:eclipse" create project configuration. some members of team want use "import maven project" , therefore don't benefits of project preconfigurations. there way provide same (or similiar) hints m2eclipse? what want accomplish people "import maven project", , automatically project preconfigured correct checkstyle configuration (which possibly downloaded somewhere defined in pom) without having manually go project preferences , click around lot. somehow defeats purpose of automatic project generation :-) there more detailed answers topic in can configure m2eclipse through pom.xml? : automatic configuration can achieved projectconfigurator. there solution based on antrun , xmltask findbugs , sonar. needs manual triggering once after checkout.

python - Mysterious and weird lines after using uni-form -

i'm using django-uni-form display forms. i've included css , javascript (notably jquery) in page. weird looking lines. image below show how looks: http://i243.photobucket.com/albums/ff176/cwalkrox/uni-form1.jpg you can notice username , email address, lines aligned upper side of text inputs while 2 passwords, lines below password inputs. in uni-form's official website, can't see line in 3 examples. if gives me lines, should consistent? so strange story doesn't stop here. jquery can highlight selected inputs. ways highlights username, email , password still inconsistent. following images prove it: i243.photobucket.com/albums/ff176/cwalkrox/uni-form2.jpg i243.photobucket.com/albums/ff176/cwalkrox/uni-form3.jpg so every problems seem stem mysterious lines. how happens? btw, page show rendered form of django-registration. rendering snippet is: <form action="" method="post" class="uniform"> <fieldset> {{ for...

c# - Windows platform programming -

i hired local company here makes small accounting/billing/payroll softwares manage clients' companies. of them use windows platform , softwares not complex ones. want ask language should opt for? python, c#, vb.net or else make gui programming task easier. in advance. for programming on windows want go .net , wpf presentation layer if can wrap head around mvvm gives more scope delivering flexible uis forms. for cross platform utility - python, i'm not sure i'd want principal development tool (if i'm focusing on windows applications).

iphone - How can I do custom drawing on part of a view that also contains buttons and other controls? -

i've tried demo code , gotten work fine: http://www.techotopia.com/index.php/an_iphone_graphics_drawing_tutorial_using_quartz_2d what i'd do, however, same custom drawing onto panel or canvas of sort sitting on view (instead of drawing on view itself). i'd have other controls (like buttons) on same view, , have button clicks control actual drawing. is there easy way this? at least couple options. you can create subview programmatically, sized not cover controls, put draw kind of model object subview can see drawrect, , call setneedsdisplay on subview view controls. or can create cgbitmap drawing context, draw bitmap context view controls, , assign bitmap context calayer of subview when want update.

nlp - Sensible variable names for a text adventure action -

this difficult one, i've been racking brains come sensible name these variables. instantly hit on one. take these example actions: "throw bottle @ wall" "push john door" "attack ogre sword" action thing at/with/on/in/to thing i need sensible name first "thing", , sensible name second "thing" if had define variable each. so... "interactor" , "interactee"... proper name. i've been trying explain few people , can't seem concept across, feel free ask me clarify. the 2 "things" in example seem me "direct object" , "indirect object." see grammar monster 's explanation.

asp.net - Default column sorting from datagrid -

i have 5 bound columns retrieved database want on page load event retrieval of data should sorted according column only, what need do..plz me!! i'd recommend having data sorted database. presume have database query somewhere - either in asp.net page, in stored procedure, or in object model - need specify order by clause. for example, if have following sql statement used populate datagrid: select col1, col2, col3, col4, col5 mytable and want results sorted by, say, col3 , use following query instead: select col1, col2, col3, col4, col5 mytable order col3 happy programming!

.htaccess - HTACCESS issue- domain vs subdomain -

i have got lots of ideas google , stackoverflow- none of looking for. here scenario- i have bought hosting space provider. had provide domain name(let abc.com) primary domain of hosting space. then have found have put contents rimary domain(abc.com) document root directly. no directory www/abc or www/abc.com. then googled , found lots of .htaccess solution. picked following one- rewriteengine on rewritebase / rewritecond %{http_host} abc.com rewritecond %{request_uri} !^/abc.com/(.*) [nc] rewriterule ^(.*)$ /abc.com/$1 i have paste above lines @ end of existing .htaccess file (default). working fine. have been using www/abc.com directory abc.com domain then. recently have added subdomains (let xyz.abc.com) abc.com domain. behaving strange me. subdomains looking contents abc.com/subdomain (eg. abc.com/xyz.abc.com) this time getting no solution on google (i may missed it). someone me please- in bad shape. edited: following lines in webroot .htaccess beginning....

javascript - Coding a volume bar -

i'm trying code progress bar in js. i have bar coded have problems math work correctly. when user clicks on bar i'm grabbing pixel position click on...this working correctly. bar 80px wide , if click in middle clicked value returns @ 40...if click right @ end of bar 80. so thought needed divide click position total width of bar , times total volume...which 100... so clicking in middle of bar : 40 / 80 = 0.5. correct...the user has clicked halfway 0.5 makes sense....but if times 100 gives me 50 obviously...which isn't right...if scenario user has clicked full volume 80 / 80 = 1 * 100 = 100 what calculation need make working? why isn't 50 correct? said volume out of 100. 50 50% of 100, 50% of progress bar, halfway. makes perfect sense me.

performance - Why is SDL so slow and how can I get it to run faster? -

i have following test setup: 1024 * 768 screen surface created sdl_hwsurface the main loop consists of sdl_flip() , simple fps counter the problem is: i getting around 1000 fps this. really low when consider not draw anything! the fps drop fast when continue on blitting rather large surfaces on screen well. what wanted do: a pixel-per-pixel effects/physics destructible terrain/objects game. why sdl slow? (i have played around 3 days small example test , eliminated every possible mistake have made, quite sure sdl's fault) are there secret tricks run faster? are there other 2d apis provide easy , rather fast single-pixel access? pixel access it's slow in hardware surfaces (it's hardware limit, not sdl limit). you can try sfml it's opengl accelerated.

How to set a background of WPF Window? -

i have simple wpf window. intend set it's background 1 of images added project embedded resource. tried: <window x:class="a_boggle.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="a-boggle" height="300" width="625" resizemode="noresize" windowstartuplocation="centerscreen" name="game"> <window.background> <imagebrush imagesource="background.jpg"></imagebrush> </window.background> <grid> </grid> but this, this: "error 1 file splash.jpg not part of project or 'build action' property not set 'resource'." any ideas? go image within vs , set item resource. right click -> properties -> build action -> resource update: you need change path if in folder. ie...resources/background.jpg

apache - Rewriting URLs in htaccess -

i trying rewrite url's. urls this www.domain.com/index/c/index/ www.domain.com/index/c/about/ www.domain.com/index/c/store/ i these urls following: www.domain.com www.domain.com/about www.domain.com/store i have tried several different things in htaccess file haven't had luck. rewriterule ^([^/.]+)/?$ /index/c/$1 [l] okay, admittedly not awesome @ either htaccess or regex, i'm trying learn more helps: it looks you're trying match follows first slash after url. this slash should included in rewrite base, you'd want htaccess be: rewriteengine on rewritebase / rewriterule ^(.*)$ index/c/$1 [l] if you'd rather not match everything, try using ranges such as rewriterule ^([a-za-z])$ index/c/$1 [l] think should match letters. also, please note rewriteengine on , rewritebase / key lines! need them htaccess work. (although / part of rewritebase can modified, in case want use '/')

.net - MethodInfo and Delegates -

i using dotnet 2.0 i know eventinfo value, can loop through assembly's types , find methods match eventinfo delegate definition ( eventinfo.eventhandlertype ) is there way find out available delegates given methodinfo can assigned in delegate.createdelegate() function without first looping through referenced assemblies find delegate definitions. or stuck doing following: public bool methodinfodelegatesearch( methodinfo mi ) { system.collections.generic.list<type> delegatetypes = new system.collections.generic.list<type>(); foreach ( assembly in appdomain.currentdomain.getassemblies() ) foreach ( type t in a.gettypes() ) { if ( t.issubclassof( typeof( delegate ) ) ) delegatetypes.add( t ); } ( int = 0; < delegatetypes.count; i++ ) { type t = delegatetypes[i]; /* * here attempt match delegate structure methodinfo * can compare parameters or attempt create delegate */ try { delegate.createdelegate...

cocoa touch - what is the simplest way to have text show if a tableview section is empty? -

preferably without looking cell. display "tap edit in upper right add syllables" your best bet implement tableview:titleforfooterinsection: method in class implements uitableviewdatasource .

video - Media player libraries in Java -

i evaluating libraries playing audio/video in java. it not need 100% java ; java bindings native libraries ok. external application can controlled java fine, long can render video on java component. the target platform linux. windows support plus, not required. i have played vlc using vlcj bindings, , works pretty in general, keeps crashing when put under stress. have used mplayer in slave mode , looks good. i'd evaluate other options well. these requirements: live playback of h.264, mpeg4 through rtp using rtsp. points mjpeg on http. able render video on java (swing or awt) component open source, , actively maintained stable, rock-solid suggestions? advice? ok, i've spent last month playing several options , these results: vlc . first thought, keeps saying "plays everything". have used both vlcj java bindings, , built-in remote interface ( -i rc ). found work pretty in general, had issues. kept seeing ocassional crashes under heavy l...

objective c - in scripting bridge how can i send shortcut with 2 modifiers? -

i trying replicate "take screenshot shortcut" (cmd+shift+3) via cocoa , scripting bridge systemeventsapplication * sysevent = [sbapplication applicationwithbundleidentifier:@"com.apple.systemevents"]; [sysevent keycode:20 using:systemeventsemdscommanddown]; but can't send more 1 systemeventsemds method. in applescript easy as key code 20 using {command down, shift down} i kinda solved this. trying cmd+shift+3 serves, of know, take screenshot. shift+3 in italian keyboard = "£" so [sysevent keystroke:@"£" using:systemeventsemdscommanddown]; does trick i'm still wondering how have done cmd+opt+something , how manage localization...

SQL server 2005 - compact edition and express edition -

i have database program developed in visual studios 2005. uses sql express in creating , connecting database. have created deployment package sql express. can installed on pc has sql 2005 compact edition installed? sql express , sql compact 2 different versions. need install sql express on pc well.

PHP complex check between different arrays -

my goal decide if $icurrentmembershipid can access $acurrentmenu array based on: if $icurrentmembershipid in $arescrictaccess array. if(is_array($arescrictaccess)){ // not sure } ultimately, need deny access page if users $icurrentmembershipid in $arescrictaccess array. if(is_array($arestrictaccess)){ if(in_array($icurrentmembershipid, $arestricaccess) === false){ /* display $acurrentmenu */ } }

c++ - Transform a list of pointers to base class -

i have design have std::list of base pointers i'd transform parallel list adds behavior. problem i'm having object i'm trying use transform doesnt know actual types when invoked. it's quite possible i'm missing subtle , there easy fix. however, if design flaw (i've seen suggested in other posts) appropriate way approach this? suppose following: class sprite { /* ... */ }; class character : public sprite {}; class markup : public sprite {}; these constructed (based on input) std::list< sprite * > . i'd take list , transform parallel structure suitable output operations. instance, given: class htmlsprite { /* ... */ }; class htmlcharacter : public htmlsprite {}; class htmlmarkup : public htmlsprite {}; i'd ideally like std::transform(sprites.begin (), sprites.end (), html.begin (), htmlconvert); with like struct htmlconvert_ { htmlsprite * operator () (const character * c) { return new htmlcharacter (); } htmlsprite * opera...

http - How can I send cookies with Perl's LWP::Simple? -

use lwp::simple; use html::linkextor; use data::dumper; #my $url = shift @argv; $content = get('example.com?get=whateveriwant'); $parser = html::linkextor->new(); #create linkextor object no callbacks $parser->parse($content); #parse content now if want send post , cookie info http header how can configure funciton? or have customize own method? my main interest cookies! post! lwp::simple simple http requests. if need more complex (like cookies), have upgrade full lwp::useragent . cookie_jar http::cookies object, , can use set_cookie method add cookie. use lwp::useragent; $ua = lwp::useragent->new(cookie_jar => {}); # create empty cookie jar $ua->cookie_jar->set_cookie(...); $rsp = $ua->get('example.com?get=whateveriwant'); die $rsp->status_line unless $rsp->is_success; $content = $rsp->decoded_content; ... the lwp::useragent has post method.

objective c - Mapping IOKit IOReturn error code to String -

when error 0x10, want able make sense of error code. looking ioreturn.h , mach/error.h not particularly convenient. lost when got 0x22 error code. silly question there function error2string can map ioreturn error code string describes error ? code running in kernel can use ioservice::stringfromreturn(...)

jQuery - passing querystring values to $(selector).load(url); not working -

i have following lines of code: var search = $("#txtsearch").val(); search.replace(" ", "%20"); $(".header").html("/parts/search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search); $(".main-content").load("/parts/search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search); i know there textbox id specified in first line, , 2 inputs of type radio name set type. value passed type either postcode or normal. correct output (as far can see) being displayed in elements satisfying .header selector. page not loading .main-content. there page, called search.php, user taken if js disabled (i.e. there submit button submits /search.php through method - disappears , search link appears if js enabled). if page has 2 querystring parameters specified include /parts/search.php. works fine - reads querystring parent (root level) search.php. dont why ...

How to declare a dynamic object array in Java? -

i want ask question java. have user-defined object class, student, have 2 data members, name , id. , in class, have declare object[], (e.g. student stu[?]; ). however, don't know size of object array. possible declare object array don't know size? thank you. user arraylist instead. it'll expand automatically add new elements. later can convert array, if need. as option (not sure want), can declare object[] field , not initialize immediately.

.htaccess - Append Query String via Apache Rewrite Rule -

how can rewrite following: http://www.mydomain.com/my-page.html http://www.mydomain.com/my-page.html?type=1 tried following without luck: rewriterule /car-covers.html$ /car-covers.html?type=$1 [r=301,l] rewriterule ^car-covers.html$ car-covers.html?type=$1 [qsa,l] rewriterule ^html page/([^/\.]+)?$ index.php?action=search_refine&type=$1 [l]

java - FlexJSON doesn't serialize class objects fully -

i new flexjson , following http://flexjson.sourceforge.net/ simple tutorial. wrote simple program seems not serializing object attributes. please me if knows this package com.webapp.enter; import flexjson.jsonserializer; class pobject { string name; int age; string country; public pobject (string n, int , string c){ this.name = n; this.country = c; this.age = a; } public string tostring(){ return this.name + this.age + this.country; } public string[] getdata(){ return new string[]{ this.name, this.country}; } } public class person{ public static void main(string main[]){ pobject person = new pobject("harit",23,"india"); system.out.println(person.name + " - " + person.age + " - " + person.country); jsonserializer serializer = new jsonserializer(); string out = seriali...

Function Templates - Explicit specialisation vs Global Functions (C++) -

i know function templates used make functions portable , used data types. also explicit specialization of templates done if have more efficient implementation specific data type. but instead of explicit specialization code nontemplate function called main . save processing time compiler locate nontemplate functions faster explicitly specialized templated functions in turn better in terms of efficiency. so why use explicit specialization when have alternative of calling nontemplate functions ? please correct me if i'm wrong! edit 1: told professor whenever make function templates , call function main ,the compiler first looks templated function , if not able locate that,then searches function template in turn makes templated function , calls it. it sounds you're confusing compile-time efficiency run-time efficiency. choice of function call made @ compile time, not run time, make no difference run time of program. explicit specialization used wh...

c# - toolstripbutton with images for each state -

i have in app toolsrip toolstripbuttons. wish add not basic image, image hover state , clicked state, , if possible, remove orange background when button hovered mouse... it's possible? in advance! if @ events of button can see various events including. isnt working code sample head @ link. private void button1_onmousehover { backgroundimage = "test.png"; } http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripbutton.aspx

.net - Visual Studio Post Build Task passing Multiple files -

i have executable file - process.exe - takes single file path , file (no outputs). process.exe isn't capable of accepting wildcard paths e.g. process.exe c:\project\*.ext what want select files of particular extension in project (*.xmlt) , pass each 1 of these files process.exe part of afterbuild step. you'll have use batching (in project file): <propertygroup> <processexe>process.exe</processexe> </propertygroup> <target name="afterbuild"> <itemgroup> <xmlt include="**\*.xmlt"/> </itemgroup> <exec command="$(processexe) %(xmlt.fullpath)"/> </target>

.htaccess - Doesn't recognized my css, js, and so on -

i have .htacces like: rewriteengine on rewriterule ^en/$ index.php?page=index&lang_id=2 rewriterule ^contact.html$ index.php?page=contact rewriterule ^en/contact.html$ index.php?page=contact&lang_id=2 # ...[and on] in site have switch language button(image). basic language in ro , and want swtich en. so, point on real server, switcher works. on local server, wamp, when try switch language, in browser appears text translated (as stocked in database), doesn't recognized css styles, images,...it appears text. where problem ? please me. are using absolute or relative urls external resources? problem folder pre-pended breaking relative urls. so using image called logo.png , hosted in images folder, , referred image tag: <img src="images/logo.png" alt="logo" /> . normally, if on contact.html page, browser check location http://localhost/images/logo.png /en folder, browser check http://localhost/en/logo.png doesn...

c# - Adding and saving not persistent objects to persistent object in NHibernate -

could explain me? i have standard relations in mssql db: [item] id symbol [item_version] id item_id (fk) symbol in [item] mapping there standard item_version bag cascade="all" , many-to-one in [item_version] mapping. this test case: [test] public void addnewversiontopersistentobject() { //creating item item = new item(); i.symbol = "item 1 symbol"; //saving item item.dao.save(i); long id = i.id; //clearing session , getting item db datahelper.daofactory.clearsession(); item itemfromdb = item.dao.getbyid(id); //creating new versions itemversion v1 = new itemversion(); v1.symbol = "version 1 symbol"; itemversion v2 = new itemversion(); v2.symbol = "version 2 symbol"; //adding versions , saving item itemfromdb.additemversion(v1); itemfromdb.additemversion(v2); item.dao.sav...

php - codeigniter upload config -

how specify more 1 configuration in config/upload.php ? i think it's not posible it, manual says: setting preferences in config file if prefer not set preferences using above method, can instead put them config file. create new file called upload.php, add $config array in file. save file in: config/upload.php , used automatically. not need use $this->upload->initialize function if save preferences in config file. so you're adding $config array() without key auto-initialize. better make config file , load config params like: $config['upload_1']['upload_path'] = './uploads/'; $config['upload_1']['allowed_types'] = 'gif|jpg|png'; $config['upload_1']['max_size'] = '100'; $config['upload_1']['max_width'] = '1024'; $config['upload_1']['max_height'] = '768'; and loading later in controller with: $this->l...

python - unbuffered urllib2.urlopen -

i have client web interface long running process. i'd have output process displayed comes. works great urllib.urlopen() , doesn't have timeout parameter. on other hand urllib2.urlopen() output buffered. there easy way disable buffer? a quick hack has occurred me use urllib.urlopen() threading.timer() emulate timeout. that's quick , dirty hack.

regex - Invert match with regular expressions -

how exclude style attribute html string regular expressions? for example if have following inline html string: <html><body style="background-color:yellow"><h2 style="background-color:red">this heading</h2><p style="background-color:green">this paragraph.</p></body></html> when apply regular expression matching, matched result should like: <html><body ><h2 >this heading</h2><p >this paragraph.</p></body></html> you can't parse html regular expressions because html not regular. of course can cut corners @ own peril, example searching style\s*=\s*"[^"]*" , replacing nothing, remove any occurence of style="anything" text.

python RSA module how to use java decrypt -

i use python rsa module( http://stuvel.eu/rsa ) private_key , public_key. how can use these private_key , public_key encrypt or decrypt in java? thank all. think have got method. python's rsa module can generate (n,p,q,e,d).i can use follow method in java keyfactory s=keyfactory.getinstance("rsa"); key pri_k=s.generateprivate(new rsaprivatekeyspec(new biginteger(n=p*q),new biginteger(e)); key pub_k=s.generatepublic(new rsapublickeyspec(new biginteger(n=p*q),new biginteger(d)); the second method run .py in command(not jython). such as: runtime.getruntime().exec("python c:\test.py")

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints? -

there has been many questions drawing pdf's. yes, can render pdf's uiwebview cant give performance , functionality expect pdf viewer. you can draw pdf page to calayer or uiimage . apple have sample code show how draw large pdf in zoomable uiscrollview but same issues keep cropping up. uiimage method: pdf's in uiimage don't optically scale layer approach. the cpu , memory hit on generating uiimages pdfcontext limits/prevents using create real-time render of new zoom-levels. catiledlayer method: theres significant overhead (time) drawing full pdf page calayer : individual tiles can seen rendering (even tilesize tweak) calayers cant prepared ahead of time (rendered off-screen). generally pdf viewers pretty heavy on memory too. monitor memory usage of apple's zoomable pdf example. in current project, i'm developing pdf viewer , rendering uiimage of page in separate thread (issues here too!) , presenting while scale x1. catile...