Posts

Showing posts from February, 2012

javascript - jQuery class selector and click() -

i'm trying alert happen when clicked. can working in jsfiddle, not in production code: jsfiddle example works (jquery 1.5 loaded) html (in case jsfiddle inaccessible): <!doctype html><html><head><title>test</title></head> <body> <h1>25 feb 2011</h1><h3>abc</h3><ul> <li class="todoitem">test&mdash;5 minutes</li> </ul> </body></html> javascript: $(".todoitem").click(function() { alert('item selected'); }); non-working production example: <!doctype html><html><head><title>test</title> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(".todoitem").click(function() { alert('item selected'); }); </script> </hea...

wpf - Find the applied ScaleTransform on a Control or UIElement? -

i have control sitting somewhere in window. @ root of window grid named maingrid. have scaletransform applied on maingrid's layouttransform use zoom in on contents of window when window's size grows. however, 1 of controls uses bitmapcache on canvases optimize drawing performance. bitmapcache not take consideration scaletransform s might applied control, if i'm zoomed in, control appears blurry. bitmapcache have renderatscale property can use increase scale of cached image. however, problem have don't know of elegant way find out scale value needs be. now, have property on control window can pass scale value control. however, if didn't need rely on external source passing in scale value. is there way control can summary of scaletransforms applied it? you can recursively go through of control's parents , sum scaletransform . i don't think can other way.

php - Going down on a site with "Firefox can't establish a connection to the server" -

i've site goes down message below. unable connect firefox can't establish connection server at the site temporarily unavailable or busy. try again in few moments. if unable load pages, check computer's network connection. if computer or network protected firewall or proxy, make sure firefox permitted access web. what possible reasons that's causing message shown? the hosting saying script taking memory. case? to start troubleshooting replace index.php (being sure keep copy of original) basic <?php phpinfo(); ?> , see if works consistently. if (assuming in index.php) can start working through original index.php adding bare-bones framework start , add more code until breaks. troubleshooting easy if start 1 end or other , work towards "trouble". in case, start minimal code, keep adding until goes wrong.

Encode Time Issue in Delphi 2010 -

when use encodetime function encodetime(whour, wminute, wsecond, wmilliseconds) not assigning millisec value result. we using below encode date , time result := encodedate(wyear, wmonth, wday) + encodetime(whour, wminute, wsecond, wmilliseconds); the string want parse datetime has value apr 10 2008 7:21:31:460pm after encoding output 10/04/2008 07:21:31 . the result contains hh:mm:ss value , not millisec value. please let know if there anyway format values , store in variable along millisec. * ** * ** * ** * ** * ** * *** function trying * ** * ** * ** * *** function datetimeparser(thestring :string):tdatetime; var wyear,wmonth,wday,whour, wminute, wsecond,wmilliseconds : word ; date,month,med :string; time : tdatetime; testtime,testtime1 : tsystemtime; var mydatetime : tdatetime; begin month := copy(thestring,1,3) ; if month ='jan' wmonth := 01 else if month ='feb' wmonth := 02 else if month ='mar' wmonth := 03 else i...

indexing - Sphinx Storage Engine for MySQL reindex on record insert -

do have run indexer each time add new records unto tables? there no other way around this? whenever add new record have indexer test1 --rotate on searchd service. i using ha_sphinx.dll on windows version 1.11 r2616. mysql version 5.5.9 checkout article five ways configure sphinx search engine

Google app engine JDO data store design using inheritance -

i using subtable inheritance strategy design data store using jdo application hosted in google app engine. there 3 types of users can logs app. these classes designed purpose 1) user(abstract) 2)usertype1 extends user 3) usertype2 extends user 4) usertype3 extends user. problem every time want find user based on userid have check each entity kind separatly. become more problem when user types increases. please how design model classes in scenario. thanks you're looking jdo2's superclass-table inheritance technique. works similar python app engine polymodel class. unfortunately, app engine doesn't support superclass-table right now. instead, consider consolidating of different class's fields single user class type enum.

How to emit unencoded html in the dropdown list in ASP.NET MVC -

i want populate dropdown list trademark , copyright characters looks html encoded instead encoded form. thanks help. when populating selectlist, use httputility.htmldecode on text. here's example: <% var entities = new string[] { "&copy;", "&lt;&quot;&gt;", "&#169;" }; var selectlistitems = entities.select(e => new selectlistitem { text = httputility.htmldecode(e), value = "1" }); %> <%= html.dropdownlist("exampledropdownlist", selectlistitems) %>

performance - How to configure NGINX with Memcached to serve HTML -

i'm trying configure nginx memcached serve html i found following memcached module nginx: http://wiki.nginx.org/nginxhttpmemcachedmodule but can't seem nginx serve html (e.g. index.html) files memcached reading tutorial above. anyone know nginx config should bet serve html memcached? to use memcached nginx need populate memcached right key/value pairs. need @fallback location work you. when matching request comes in, nginx query memcached whatever set $memcache_key to. if value found sent browser. if not fallback location invokes backend system 2 things: generate response , send browser. send response memcached , set appropriate key/value pair. the next time request comes in same key in memcached , served directly there.

MongoDB/C# and Telerik Ajax RadGrid -

can expert propose way use telerik radcontrols ajax grids , mongodb c# official driver manage simple grid table create/update/delete methods. object managing simple table data web control. what best object use : bsonobjects, list, datatables best ways client or server side thanks. use findas load collection database(probably use skip, limit, , setsor torder). i not familiar telerik-grid @ seems me usual grid, telerik grid has property datasource. can bind data using datasource property. for update/delete/insert methods suppose telerik grid has kind of events(like on item insert, delete). , can easy create methods thats update/delete/insert in mongo. in abstract process looks like: var items = mongocollection.findas<type>(query.eq("someproperty", "somevalue")) .setsortorder("orderfield").setlimit(100).skip(10); telerikgrid.datasource = items; telerikgrid.databind(); .... telerikgrid_onitemdelete(object sender,...

jquery - ckeditor disappears when <textarea> gets updated by ajax response -

i using ckeditor jquery adapter in ajax scenario. ckeditor bound textarea element using jquery. the app: i designing elearning app client. each course has many steps, drawn database table. the ui of app form previous , next buttons navigate through course. the issue admin facility, tutors can create , update steps in each course. again, admin facility form previous , next buttons. however, there field called steptext want have html rather plain text. hence requirement rich text editor. the scrolling step step down ajax calls, go off controller, data next (or previous) step, , inject page. ajax calls return html, created partial view. the problem: the textarea in partial view. ckeditor binds correctly first time page loaded, not subsequent ajax responses. the result ckeditor not appear goodness , unappealing nakedness of textarea. any ideas why happening? setup (shown refrence) (edited): the following scripts used: <script type="text/javasc...

c# - Launch program under interactive logon user from .NET WinService -

at moment have .net winservice started under localservice user @ windows start. service launch winforms application using process.start(). but there several problems in solution: we don't wait interactive user logon , application falls because tries , fails initialize directx device. application launched under localservice interacts user desktop in windows xp. doesn't work in windows 7 because of there different graphic stations each user in win7. sometimes need run application current interactive logon user rights. does know how wait user interactive logon in service , start winforms application these user rights? i think helps solve problems. you need separate client app. check out document, page 6: http://msdn.microsoft.com/en-us/windows/hardware/gg463353.aspx . for monitoring/restart scenario @ createprocessasuser mentioned in document. need have client app coordinate service this, , it's still pushing square peg round hole.

objective c - typedef in header causes error "Expected specifier-qualifier-list before 'typedef'" -

dear wisdom of internet, in header-file (objective-c) mytestclass.h #import <foundation/foundation.h> @interface mytestclass : nsobject { typedef int pixel; } - (id) initwithpic: (nsstring*) picfilename; - (void) dealloc; - (void) dosomething; @end at line typedef int pixel; xcode complains like ( ! ) "expected specifier-qualifier-list before 'typedef'" ( 3 ) this err-msg seems pretty popular given solutions (missing #import) not work me. hints found not explain going wrong here. i not understand err-msg can explain me? i appreciate tips. not sure trying do, put should put typedef before interface. inside braces place ivars. if want integer variable, not need typedef: @interface myclass { int mypixel; } @end typedefs used create new type, based on another. instance: typedef int pixel; @interface myclass { pixel mypixel; } @end so when use pixel pseudo-type, int type used.

sql - Generating a subquery with Arel to get an average of averages -

lets have few of tables orders = arel::table.new :orders stores = arel::table.new :stores managers = arel::table.new :managers and manager has many stores , store has many orders. one day want query average total across orders manager works. oh, want group store. clear, want average order total manager, each of stores work at. and let's assume we've looked our manager: manager = manager.find(some_id) totals = orders.where(orders[:store_id].in(manager.store_ids)).group(orders.store_id).project(orders[:total].average) puts totals.to_sql "select avg(`orders`.`total`) avg_id `orders` `orders`.`store_id` in (1, 2, 3) group `orders`.`store_id`" yup, works great. how can query average of averages? what's arel query? "select avg(avg_id) (select avg(`orders`.`total`) avg_id `orders` `orders`.`store_id` in (1, 2, 3) group `orders`.`store_id`) avg_id_alias;" anybody know? you can pretty close, activerecord doesn't support exec...

python - Automatically generating Piratespeak .po/gettext/translations for i18n testing? -

i working on translating our django webapp. i'd test our system set correctly before paying translator actual translation. is there anyway, given .po file, automatically generate new translations? , fun, there anyway pirate speak? :) (or other command line text munglying tool?) turns out no-one has done before. wrote python script myself piratify .po file

java - Filtering sources before compilation in NetBeans & Ant -

i need filter java files before compilation, leaving original sources unchanged , compiling filtered ones (basically, need set build date , such). i'm using netbeans great ant build-files. so, 1 day discovered need pre-process source files before compilation, , ran big problem. no, did not run @ once, did research, failed. so, here comes sad story... i found "filter" option of "copy" task, overrided macrodef "j2seproject3:javac" in build-impl.xml file , added filter in middle of it. got desired result, yes, tests not working, since use macrodef too. next, tired overriding "-do-compile" target, copying&filtering files directory build/temp-src, , passing argument of new source directory "j2seproject3:javac": <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml, -compile-depend,-prepare-sources" if="have.sources" name="-do-compile"> ...

java - How setup client-server simulation environment for development using J2ME and NCF -

appreciation in advance, i’m newbie in mobile development , developing twitter app using j2me. have developed server side app using .net , uses gsm interface intercept binary sms messages sent j2me client app. system works in practice costs each time test new features real device. in addition have 1 mobile phone , i’m not able test multiple user scenarios. i tried test app using nokia s40 sdk emulator , ncf (nokia connectivity framework) i’m able exchange messages between 2 instances of emulator. is there way setup simulated environment in use s40 emulator running client app , sent binary messages being routed local port on pc. way can develop middleware catching routed messages port , deliver server side engine , vice versa. i think such environment can save lots of money other developers too. any idea?

iphone - Disable Home Button -

i know has been asked disable home button in-house app distributed internally across ipads. i have searched solution both on here , google , stop users putting app background. have seen 1 solution doesn't seem work under ios 4.0 opens app again when home button pressed. could make use of private apis seeing internal app , won't reviewed apple app store? thanks i don't know why down voted legit use case internal enterprise application. kiosks, pos etc. anyway wanting know how should see answer here lock-down iphone/ipod/ipad can run 1 app

sql - How do I display the query time when a query completes in Vertica? -

when using vsql, see how long query took run once completes. example when run: select count(distinct key) schema.table; i see output like: 5678 (1 row) total query time: 55 seconds. if not possible, there way measure query time? in vsql type: \timing and hit enter. you'll you'll see :-) repeating turn off.

ms access - How to launch one other program with VBA code? -

i'm trying launch program install in system access application. or open file access, how can it? ex: there's file barcode_12mm.lbl , want use vba code launch in 1 program edits bar-code label file. thanks! you have multiple alternatives in access: shell() (see file) application.followhyperlink (see file) shellexecute() -- access.mvps.org/access/api/api0018.htm the first requires know path of executable calling , kind of fussy getting arguments formatted (you'll need double quotes arguments spaces in them, instance). the last 2 registered applications, such if file extension has association defined, open application associated it. followhyperlink easier, shellexecute provides more options. aside: note many people think using barcodes in access requires outside program or activex control. barcodes fonts, if understand format of barcode encoding, it's simple create own barcodes within access , not worry outside dependencies. tony toews has ar...

ruby on rails - railstutorial.org - rspec failed but in browser everything is OK -

i trying follow rails tutorial , have failed rspec in browser app works needed. when signed in (in browser) , go "http://localhost:3000/users/1/edit" page opens. previous rspecs tutorial passed. i using rails '3.1.0.rc4' , working in windows. the spec fails (from users_controller_spec.rb): describe "get 'edit" before(:each) @user = factory(:user) test_sign_in(@user) end "should successful" :edit, :id => @user response.should be_success end end code of test_sign_in spec_helper.rb: rspec.configure |config| config.mock_with :rspec config.fixture_path = "#{::rails.root}/spec/fixtures" config.use_transactional_fixtures = true def test_sign_in(user) controller.sign_in(user) end end code of factories.rb factory.define :user |user| user.name "mikhail" user.email "mikleb@yandex.ru" user.password "123456789a" user.password_co...

Perl's Date::Manip - how to convert a given date into another timezone -

consider following code snippet takes user input (a date) , format using unixdate date::manip #!/usr/bin/perl use date::manip; $input = join(" ", @argv); $date = unixdate($input, "%y-%m-%d %t"); print $date; this done allow users enter friendly dates such " yesterday " or " 1 week ago ". i use $date different timezone (it used extract sql data). how done? did not find construct of unixdate allow put timezone, , not know either how reformat user input (concatenating name of timezone doesn't help). example the user somewhere in central europe (timezone: cet) , enters "today @ 1pm". execution of code above follows: $ ./test.pl today @ 1pm 2011-03-03 13:00:00 this expected result no timezone change in effect. use $date timezone, e.g. pacific standard (timezone: pst). in case output should be: $ ./test.pl today @ 1pm 2011-03-03 04:00:00 try date_convtz() function: $date = unixdate( date_convtz( $inp...

asp.net - MaxConcurrentRequestsPerCPU and Asynchronous Requests -

i using c# 4.0, asp.net mvc 3 , iis 7.0. little confused asynchronous requests in iis 7. have read this article , several forum/blog posts, didn't find answer yet. here question, i have application call many remote services. many of them respond slowly. using asynccontroller free application threads. in above article thomas saying iis 7 uses maximum concurrent requests per cpu instead of maximum concurrent threads per cpu. think freeing threads using asynccontroller not effect overall application stability, because request specific instead of thread specific. if have 6000 concurrent requests, using asynccontroller allow 5000 requests execute concurrently. update : want ask whether switching asynccontroller makes difference? yes, async actions make better use of cpu/memory resources long running tasks network bound. is, after all, exact reason such feature added mvc. let avoid having 1 thread per request being tied long periods of time. threads relatively expens...

iphone - UITableView headers on the left side of sections (like Spotlight) -

Image
been searching quite while, , still haven't found way it. i'd reproduce section headers of iphone's spotlight uitableview. "regular" table view headers stay visible @ top of section when scroll, know. there 1 kind of header i've never seen elsewhere in spotlight page of springboard: there, headers span whole height of section , not stuck on top of section, on left side. how heck achieved? good question. made little experiment. looks view spotlight. it's lacking 1 import feature. lower "image" doesn't push upper image top if collide. i doubt there built in solution without use of private frameworks. i achieved this: as can see 2 header images @ top overlap. don't push each other normal headers to. , had deactivate cell separators. if use them appear @ whole cell. have draw them yourself. not big deal. but have no idea how fix overlapping. here code made happen: - (cgfloat)tableview:(uitableview *)tableview he...

html - "Stretching" the background container to hold all of it contents -

i have following problem. i have done following: in css file, have declared both body , div tag enclosed in body , height: 100%; (the div tag technically <asp:panel> tag, get's rendered div tag. this works fine, , div container scale fill browser top bottom, , not give scrollbar, intended to. however, on 1 of sub-pages, page_load method add controls panel/div, , controls enough fill more height of screen, , therefore vertical scrollbar given should. however, when start scrolling, part of content below height of screen not background. background still constrained max height of screen if it's contents exceeding height. i assume height:100% causes problem here, have not found replacement works should in case. tried height:auto; causing background removed in it's entirety. the question might basic, not web programming these days, please bear me :) edit as additional information, should mention content added inside div inside original div if ma...

floating point - strictfp in Java -

i'm implementing neural network library in java , , there intensive double (not double ) matrix operations, matrices large , performance required of course. so came read strictfp keyword didn't understand , looking simple explanation if should using or not , why strictfp indicates floating point calculations should use exact ieee754 standard. without strictfp, vm free use other (but platform dependent) representations of intermediate float , double values, in order increase precision. use strictfp if need exact same results on multiple platforms. avoid if want best precision current platform can give you. e.g. in following simple addition: 2.0 + 1.1 + 3.0 do want intermediate results (e.g. 2.0 + 1.1) represented ieee754 standard double, or best possible precision platform allows. strictfp ensures first, not using strictfp allows vm use second alternative. not using strictfp not hurt performance, , may on platforms native float types don't map ...

android - onClick Listener Code doesn't show Toasts -

i have simple layout employing 3 buttons. have listener on first button. gets called expected on click. listener checks few things, possible downloads few files, starts activity. during file download, i'd inform user download going on. tried usual suspects, saw using progressbar alot of code. tried smaller: used toast display message, disable 3 buttons download duration. code: int version_pre = getcurrentversion(); //check files on remote server string url = data._url + "/" + data.owner + "/version"; if(!this.downloadfile(url, "version")) { toast.maketext(this, "download der dateien fehlgeschlagen. fahre mit lokaler version fort.", toast.length_long).show(); } int version_post = getcurrentversion(); if(version_pre != version_post) { //neu dateien besorgen button b1 = (button)findviewbyid(r.id.btn_prospekt); b1.setenabled(false); b1 = (button)findviewbyid(r.id.btn_einheitenumrechner); b1.setenabled(false); b1 = (button)fi...

Process C#| How To Make A Process Into system tray -

so, have process running in c#, , want make system tray. possible? this code using: process proc = process.start("xxxx"); it process control whether should show task on taskbar, or in notification area; such, couldn't control process you're starting unless documents command line option purpose. of course, can control own winforms applications using components such notifyicon component (part of .net framework).

Cucumber, webrat mechanize testing php/drupal application on MAMP, authentication issue -

i've got cucumber testing drupal application passing tests so: given /^i authenticated "([^"]*)" user$/ |role| visit('/user') fill_in "name", :with => "user_#{role.downcase}" fill_in "pass", :with => "password" click_button visit('/') #gets around 302 redirect issue response_body.should contain("log out") end my env.rb so: require 'rspec/expectations' require 'webrat' require 'test/unit/assertions' world(test::unit::assertions) webrat.configure |config| config.mode = :mechanize end world session = webrat::session.new session.extend(webrat::methods) session.extend(webrat::matchers) session.visit('http://localhost') session end this passes fine when virtual host on mamp default localhost. when create virtual host, same document (and update session.visit use new root) test fails. seems session lost. does know how debug this? i...

c++ - allocating vectors (or vectors of vectors) dynamically -

i need dynamically allocate 1-d , 2-d arrays sizes given @ run-time. i managed "discover" std::vector , think fits purposes, ask whether i've written correct and/or can improved. this i'm doing: #include <vector> typedef std::vector< std::vector<double> > matrix; //... various code , other stuff std::vector<double> *name = new std::vector<double> (size); matrix *name2 = new matrix(sizex, std::vector<double>(sizey)); dynamically allocating arrays required when dimensions given @ runtime, you've discovered. however, std::vector wrapper around process, dynamically allocating vectors double positive. it's redundant. just write: #include <vector> typedef std::vector< std::vector<double> > matrix; matrix name(sizex, std::vector<double>(sizey));

changing HTML characters with javascript -

i have html page javascript hides , shows element given id (shown below). change single character in html text such when text hidden » character shown , when hidden text made visible &#xfe3e character shown (same other character, facing downwards) what need reference element pass » , change pass &#xfe3e ? preferably, without knowing first part of text pass . fail , instance. thanks, paulh <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <title></title> <script type="text/javascript"> <!-- function toggle_visibility(id) { var e = document.getelementbyid(id); if(e.style.display == 'block') { e.style.display = 'none'; } else { e.style.display = 'block'; } } //--> ...

php - session / cookie issues codeigniter 1.7.2 -

hi i’m finishing project , i’m having issues ci . i’m running version 1.7.2 , i’m using ci session class setting , getting session data. this happens in firefox , ie . what’s weirder application only works in chrome . have verified happening in older builds of application didn’t have issues previously. here’s config: session $config['sess_cookie_name'] = 'ciprojectname'; $config['sess_expiration'] = 7200; $config['sess_encrypt_cookie'] = true; $config['sess_use_database'] = true; $config['sess_table_name'] = 'sessions'; $config['sess_match_ip'] = true; $config['sess_match_useragent'] = true; $config['sess_time_to_update'] = 900; cookies $config['cookie_prefix'] = ""; $config['cookie_domain'] = ""; $config['cookie_path'] = "/"; i played adding cookie domain issue still happens. i’v...

asp.net - How to use Ajax Loader in jQuery pop up -

please tell me how use ajax loader in jquery pop up. on aspx page there jquery pop up, , on pop there list of checkboxes, , when check box checked list of checkboxes load. want use ajax loader. add div loading gif , hide it. use following snippet: $("#loading").ajaxstart(function(){ $(this).show(); }); $("#loading").ajaxstop(function(){ $(this).hide(); }); this show loading gif each time ajax request loading.

How to ignore HTML element from tabindex? -

is there way in html tell browser not allow tab indexing on particular elements? on page though there sideshow rendered jquery, when tab through that, lot of tab presses before tab control moves next visible link on page things being tabbed through hidden user visually. you can use tabindex="-1" . the w3c html5 specification supports negative tabindex values: if value negative integer user agent must set element's tabindex focus flag, should not allow element reached using sequential focus navigation. watch out though html5 feature , might not work old browsers. w3c html 4.01 standard (from 1999) compliant, tabindex need positive.

ruby on rails - virtual attributes -

<%= form_for(@membership) |f| %> <%= f.collection_select :user_id, user.all, :id, :email %> <%= f.collection_select :role_id, role.all, :id, :name %> <%= f.submit %> <% end %> what i'm trying instead of using select box users, want put text field users email. <%= form_for(@membership) |f| %> <%= f.text_field :email %> <%= f.collection_select :role_id, role.all, :id, :name %> <%= f.submit %> <% end %> membership.rb belongs_to :user belong_to :role attr_accessor :email def email self.user.email if self.user end what dont know write in controller make work , attr accessor using thing , email method ok? appreciated. def create @membership = membership.new(params[:membership]) if @membership.save redirect_to(memberships_url) else render :action => "new" end if want update existing users only, you'll have find user email in create action, ...

Android - Saving file to internal memory -

i have file in assets , need write file internal memory (not private part /data/data/mypackage/files, memory able see removable disk, when connected pc). there way how achieve this? don't mean method file copy, how access internal memory? here discussion answers problem. i'm assuming want copy asset sd card. how copy files 'assets' folder sdcard?

JQUERY multi selection $( $(this) + other items ) -

in jquery possible something like : $( $(this).parent(), $("#myid"), $("li"), ... ); in way not work , it's only explain ... from can tell, have 1 set selected, , add more elements set? try jquery's add() method.

algorithm - A Cache Efficient Matrix Transpose Program? -

so obvious way transpose matrix use : for( int = 0; < n; i++ ) for( int j = 0; j < n; j++ ) destination[j+i*n] = source[i+j*n]; but want take advantage of locality , cache blocking. looking , can't find code this, i'm told should simple modification original. ideas? edit: have 2000x2000 matrix, , want know how can change code using 2 for loops, splitting matrix blocks transpose individually, 2x2 blocks, or 40x40 blocks, , see block size efficient. edit2: matrices stored in column major order, matrix a1 a2 a3 a4 is stored a1 a3 a2 a4 . you're going want 4 loops - 2 iterate on blocks, , 2 perform transpose-copy of single block. assuming simplicity block size divides size of matrix, think, although i'd want draw pictures on backs of envelopes sure: for (int = 0; < n; += blocksize) { (int j = 0; j < n; j += blocksize) { // transpose block beginning @ [i,j] (int k = i; k < + blocksize; ++k) { ...

mysql - number of rows in a stored procedure -

is possible conditional select based on number of rows in stored procedure? e.g. if select * table1 has no records, select * table2 ? try this: select col1, col2, ..., coln table1 union select col1, col2, ..., coln table2 not exists (select * table1) this of course assumes both tables have same structure.

android - Why is my emulator starting in the tablet environment? -

i using android-sdk_r12. when run project, getting tablet environment. how can mobile phone environment? should install sdk? right click on project , under "run as" click "run configurations". select desired target avd.

Sharepoint Content Editor Webpart changing content -

in document library have number of html files calender month on them (e.g. july 2011.htm, august 2011.htm through december 2012). have content editor webpart displays html file current month. @ moment manually changing content link of webpart every month display new content - there way of doing automatically using script. not have sharepoint designer, , on sharepoint 2007 use getmonth() method of javascript current month. http://www.w3schools.com/jsref/jsref_getmonth.asp once have month, can append location of html file , output link. note can put javascript in cewp web part: http://sharepointsolutions.blogspot.com/2007/07/adding-javascript-to-content-editor-web.html

eclipse - How do i do a simple php email sending? -

as stated in subject. how do it? i'm doing on eclipse galileo using php. would appreciate help. just this: mail('to@email.com', 'subject', 'message body'); see php mail() documentation more advanced usage.

javascript - How to resolve 'TypeError: Property '_onTimeout' of object #<Object> is not a function' in node? -

the following snipped of code: var theadnets = new array(); function populateadnetlist() { } //update list every 5 minutes. setinterval("populateadnetlist()",300000); //fetch in 5 seconds. settimeout("populateadnetlist();",5000); produces following error: typeerror: property '_ontimeout' of object #<object> not function @ timer.callback (timers.js:83:39) the populateadnetlist() function , not object. there no reference 'this' in body of function() { }. why happening? that scope issue. if function defined locally in function or object, it's not available in global scope string evaluated. move function global scope, or use function reference in calls instead avoid scope problem: //update list every 5 minutes. setinterval(populateadnetlist,300000); //fetch in 5 seconds. settimeout(populateadnetlist,5000);

android - "417: Expectation Failed" on HTTPPost -

very expect continue problem c# described here, http post returns error: 417 "expectation failed." , getting "expectation failed" error server trying post httppost object in android. the equivalent fix prevent request using "expect continue" seems this: httppostinstance.getparams().setparameter( coreprotocolpnames.use_expect_continue, boolean.false); i found @ http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html under 1.6.1.

python - Lock directory when uploading to it -

i've been thinking of updating directory name username , datetime when user uploads files it. newest upload user show on it. have upload function , rename so: # check if form valid , upload if form.is_valid(): form.save(request.files, request) # edit previous folder have new datetime , user marking if folder has such. currentpath = post_data.get('path').encode("utf-8") prevfolder = os.path.basename(post_data.get('path').encode("utf-8")) try: casename, rest = prevfolder.split(" [",1) #print(casename) dest = renameonupload(request,currentpath, casename) except: dest = form.path return httpresponseredirect('/fm/list/%s' % dest) def renameonupload(request,path,casename): datetime_string = get_currenttime() user_string = " ["+ request.user.username + "]" newcasename = casename+user_string.encode("utf-8")+datetime_s...

integrating myspace sdk for iphone tutorial -

i need tutorial or guide using myspace sdk in iphone application. i have downloaded myspace sdk iphone can't use myspace sdk in iphone application, because there lot of stuffs in importing sdk in iphone application. if there tutorial or guide please share us. thanks i saw question old "mar 7 11" still face problem; here guidance them. 1) read , implement following starting guideline myspace documentation. http://wiki.developer.myspace.com/index.php?title=example_application:_hello_world by following guideline able setup app setup @ myspace facebook or twitter. 2) once done it, can verify auth , other services api tool: http://developer.myspace.com/community/myspace/testandtinker.aspx 3) download ios sdk demo project following link: http://code.google.com/p/myspace-iphone-sdk/ 4) once able run demo/example ios demo.try see file in "myspacesdkservices.plist" in demo sdk project , edit accordingly files settings done @ myspace app ...

.net 4.0 - Wait for Handle to be set when using Process.Start -

i'm using process.start start console app app. after it's started want use p/invoke set title of window. my problem after starting process mainwindowhandle 0. if wait bit handle gets set. i know use waitforidleinput if wasn't console app, do if is? my fall sleep, or loop waits until mainwindowhandle set, there better way?

html - Web Folder Structure -

i working on code images referred preceding "/" eg: <img alt="" class="repositioned" src="/images/top-b-strip.jpg" /> i have wamp server run code , find image not coming correctly until remove prceeding "/" before images. <img alt="" class="repositioned" src="images/top-b-strip.jpg" /> can explain missing here? putting "/" @ start of path denotes it's absolutely situated @ root of server. instance, http://www.example.com/images/top-b-strip.jpg , may have them http://www.example.com/somesubaccount/images/top-b-strip.jpg . you can read more absolute versus relative paths at, instance, http://www.communitymx.com/content/article.cfm?cid=230ad

cocoa touch - Bug when moving a UIView horizontally -

i've created puzzle engine ipad (ios sdk 4.2) i have puzzleviewcontroller controls uiview (rootview) holds smaller uiview (puzzleview) , twelve puzzle pieces (puzzlepieceview class extends uiimageview). the ideia simple. puzzlepieces around puzzleview , picked , dragged puzzleview. when pieces picked double they're size , centered place finger touching. when they're dropped in right place stay put (they're removed rootview , added subviews puzzleview) if they're drop in wrong place return original position , size. currently i'm overriding touches began/moved/ended/cancelled in puzzlepieceview class each puzzlepiece controls own movements. here's do #pragma mark uiresponder overriding - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { nslog(@"puzzlepiece touchesbegan"); if (!isdeployed) { if (self.initialsize.width == 0 || self.initialsize.height ==0) { //if there still no initial size self....

javascript - "oembed is null" error in firebug console (JQUERY OEMBED) -

im having problem oembed outputting error in firebug's console windows such: oembed null oembedcontainer.html(oembed.code); which when clicked point jquery.oembed.js file. declaration of oembed replace links class name of oembed, so: $(".oembed").oembed(null, { embedmethod: "replace", maxwidth: 350, maxheight: 350, vimeo: { autoplay: false, maxwidth: 350, maxheight: 350 } }); i think error pointing on first parameter of function oembed(). dont know happening inside, know workaround here?? link got code: http://code.google.com/p/jquery-oembed/ i had same problem until noticed snippet had non absolute url loading script. therefore never loaded @ all. change this: <script type="text/javascript" src="../../jquery.oembed.js"></script> for actual url of script, example, if y...

How to manage the article content in an asp.net web site -

i'm planning create site learning technologies, such codeproject or codeplex. can please suggest me different ways manage huge articles? look @ content management system, such sitefinity: http://www.sitefinity.com/ . there others, free. can find on codeplex.com. hth.

"plugin" to the facebook android app -

is possible write plugin facebook android app ? what trying : allow user send data app . can android facebook app passed on app in way? i don't think there's plugin architecture facebook, , in fact app doesn't play android in there's no way share content facebook app other apps. e.g. in tweetdeck can share tweet via email, sms, etc not facebook app. assume re keen keep data within facebook. you possibly write own facebook app connects facebook api , shows data, in way can shared.

c - Any quick guide to understand networking and use it in programming? -

is there quick guide understand basic concept of computer networking layers of networking tcp/ip , how use in programming language c ? not talking books tutorials available on net. i read through yesterday. gives great explanations network stack , how program via c++ c. http://beej.us/guide/bgnet/output/html/multipage/index.html it's more or less ebook, there lot of tutorials , examples. hope helps!

c++ - Boost signals.hpp causes several compile time errors on Visual Studio 2010 -

i'm trying use boost.signals library. know use it, first need build boost since signals not header library. followed steps described under this topic build boost , did not errors. however, when include boost/signals.hpp several c2146, c2238, c2447 errors. of them syntax errors. example there several c2143 errors saying missing ; before { in signals_common.hpp . has faced such problem? you linker error if problem how built it. compile time. try making simple example people try. my guess qt. if using qt, there may namespace conflicts. how boost.signals work qt?

php - Multidimensional array sorting -

Image
i have following array , want sort array, value. ( [bwin] => array ( [0] => array ( [bookie] => bwin [id_bookie] => 178537 [value] => 6.00 [bettype] => 3way [line] => 0.0 [bet] => 1 ) [1] => array ( [bookie] => bwin [id_bookie] => 178537 [value] => 1.45 [bettype] => 3way [line] => 0.0 [bet] => 2 ) [2] => array ( [bookie] => bwin [id_bookie] => 178537 [value] => 4.50 [bettype] => 3way [line] => 0.0 [bet] => x ) ...

Replace WCF default JSON serialization -

is possible replace default json serialization of wcf (i'm testing webhttp behaviour), , passing application/json mime type. in particular, don't default every property key/value pair like: {"key":"propertyname", "value":"propertyvalue"} i'm using service json-enabled endpoints (requesting data jquery + wcf). you can use message formatter change serializer used deal json. post @ http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/03/wcf-extensibility-message-formatters.aspx shows example on how change default serializer (datacontractjsonserializer) 1 (json.net).

python - Use Function to Return a List of Words Containing Required Letters -

i trying write function takes string, , checks every letter in string against every letter, in every line, in list of words. code have written is: def uses_all(required): fin = open('words.txt') line in fin: letter in line: if letter not in required: pass return line when try have words contain vowels returned returning last line in file. >>> uses_all('aeiou') 'zymurgy\n' well, function you´ve written iterates through file without doing anything, , returns last line, behavior see kinda expected. try this: def uses_all(required): ret = [] fin = open('words.txt') line in fin: # let´s try , find our required letters in word. letter in required: if letter not in line: break # we`re missing one! break! else: # else block executes if no break occured ret.append(line) return ret it`s lousy implementa...

java - How to auto-detect and wire classes which extends from specific type? -

spring supports auto-detect classes using annotation @component , <component-scan>, however, @component not @inherited. i have tried create custom inheritable annotation: @component @inherited @retention(runtime) public @interface myinheritablecomponent {} unfortunately, @myinheritablecomponent doesn't work. any idea? edit file my/package/injectable.java: @myinheritablecomponent public class injectable {} file my/package/foo.java: public class foo extends injectable {} and component-scan defined as: <context:component-scan base-package="my.package" /> in above example, foo not auto-detected. my intention is, hide @component annotation specific classes. due absence of @inherited on @component <context:component-scan> default filters doesn't respect @inherited on custom annotations. however, if add custom filter annotation, work expected: <context:component-scan base-package="my.package"> ...

perl ".../config.h, needed by `Makefile'" not working after OSX Lion upgrade -

solved. see @ bottom. just upgraded osx lion , trying perl install running again: sudo /usr/bin/perl -mcpan -e 'install "modulename"' with value of modulename tried (e.g. json ) produces: ... checking if kit complete... looks writing makefile json make: *** no rule make target `/system/library/perl/5.12/darwin-thread-multi-2level/core/config.h', needed `makefile'. stop. makamaka/json-2.53.tar.gz /developer/usr/bin/make -- not ok i can't find resembling config.h anywhere, directory exists though ... not works: /usr/bin/cpan cpan solved: download , install latest version of xcode appstore. note downloading xcode appstore not install (why, apple, oh why?) dumps installer /applications. run installer, fix issue. solved: download , install latest version of xcode appstore. note downloading xcode appstore not install (why, apple, oh why?) dumps installer /applications. run installer, fix issue.

math - Collision detection with oddly shaped polygons -

i planning make program have circular shapes moving inside of oddly shaped polygon. i can't seem figure out how collision detection edges , have shapes bounce correctly. i sure problem has been solved before, can't find nice example. my main problems are: figuring out if circle has hit edge of surrounding polygon. once hit occurs calculate normal of hit point figure out reflection vector. can point me in right direction? thanks, jason you need circle line intersection test . to make faster, can first check bounding boxes. example, if start , end point of line both left of leftmost coordinate of circle, there can't intersection.

iphone - cocos2d semantic issue -

getting error in xcode 4. reading book uses 0.99.5 think , using 1.0.0 framework cocos2d. error: semantic issue: assigning 'cgpoint' (aka 'struct cgpoint') incompatible type 'double' on line playervelocity = playervelocity.x * dec + acceleration.x * sens; any ideas. full code float dec = 0.4f; //lower = quicker change direction; float sens = 6.0f; //higher more sensitive; float maxvel = 100; playervelocity = playervelocity.x * dec + acceleration.x * sens; if(playervelocity.x > maxvel) { } else if(playervelocity.x < - maxvel) { playervelocity.x = - maxvel; } playervelocity vector, should assign value this: playervelocity = ccp(playervelocity.x * dec + acceleration.x * sens, 0); ccp macro build vector 2 component specify. gave 0 y component, feel free change value need.

database - CMS for integrating high volume indexable tables -

i wish use cms following additional requirement: - create table 5000 items searchable 10 of fields (its product catalogue table. ideally want use cms basic ecommerce capability , add vertical partition in 1:1 reference catalog table of main cms product table , change queries within cms package reference / search additional field information. which cms appropriate extending? cms must have @ least basic ecommerce capabilities. ez publish standard shop features plus ez find . both free oss

silverlight - Binding is not updating multiple UI elements -

i have buttons on silverlight page opacity bound 1 of 2 properties on viewmodel. i'm using button command changes properties, in theory affect buttons bound property, control gets affected button initiates command (any 1 of them). any ideas on why additional bindings don't work? the whole thing little more complex buttons on control bindings dependencyproperties mapping vm, , bound properties going through valueconverter. it sounds need raise inotifypropertychanged.propertychanged event properties changing. let controls bound them know there change , need come , latest value.

html - 2 column layout (Left column fixed width, right fluid + clear:both) -

just need have been trying sort out ages now. need: i've got 2 column layout, left column has fixed width 220px , right column has fluid width. code is: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>fluid</title> <style type="text/css" media="screen"> html, body { background: #ccc; } .wrap { margin: 20px; padding: 20px; background: #fff; } .main { margin-left: 220px; width: auto } .sidebar { width: 200px; float: left; } .main, .sidebar { background: #eee; min-height: 100px; } </style> </head> <body> <div class="wrap"> <div class="sidebar">this static sidebar</div> <div class="main">thi...

json - Specify the callback parameter with JQuery.getJSON -

is there way specify value of callback parameter when using jquery's getjson method? for example: $.getjson('/content?callback=?', function(data) {}); generates following url: content?callback=jquery15108431726952168015_1299633045933&_=1299633046552 the parameter here generated randomly library. i specify own callback parameter. i use same callback parameter every request can aggresively cache response. you need @ least on jquery 1.5 work. // url generated "/content?callback=mycallback" $.ajax({ url: '/content?callback=?', datatype: 'jsonp', jsonpcallback: 'mycallback', cache: true, success: function(data) {} });

c# - Send client side data Queue to server side through Tcp/IP -

i wanna send data client server. there 2 queues. in client side , in server side. want client connected server , send data in client queue server. in server side wanna accept clients , objects , add server side queue client code : queue<person> clientqueue; // client side queue ipendpoint serverendpoint = new ipendpoint(ipaddress.parse("127.0.0.1"), 15884); var client = new tcpclient(); while(!clientqueue.isempty) { person personobj = clientqueue.dequeue(); client.connect(serverendpoint); networkstream clientstream = client.getstream(); binaryformatter bf = new binaryformatter(); bf.serialize(clientstream, personobj); clientstream.flush(); } server side : queue<person> serverqueue; // server side queue ipendpoint ipendpoint = new ipendpoint(ipaddress.parse("127.0.0.1"), 15884); tcplistener tcplistener = new tcplistener(ipendpoint); while(true) { tcpclient client = tcplistener.accepttcpclient(); networ...