Posts

Showing posts from May, 2012

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

select - Problem with html drop down list -

Image
i having problem html drop down select box. have long list of items in select box therefore goes outside of screen. doesn't shows scroll bar. please this link address issue how make drop down menu vertical scroll bar?

javascript - Changing ajax to request that fills a div with html content to be embedded into the html page itself -

i having trouble embedding ajax html html page itself, need make ajax response apparent in page source. i have 2 servers, 1 runs web application , other responsible performing search queries (searcher). application server sends html page client's browser, request search queries searcher through ajax, after successful reply browser put html result page. the problem search results not exist in html source not seo, google crawlers have no idea being searched for. the other problem if made application server make request , wait searcher results, page take tons of seconds load. i not sure do.. need make website seo friendly , need page load quickly!! any pointers or ideas appreciated. thanks lot, wa'el it's impossible ajax provided data present in "source" in case source original page requested server before client side changes. and kind of client not support javascipt, search engine crawlers, never se ajax loaded data. if need information

c - What is the initial value of a static/global enum variable? -

e.g. quake engines have typedef enum {qfalse, qtrue} qboolean; when 1 static qboolean variable; is variable's start-up value 0? static , global variables cleared default, if there no value assigned @ initialization. in example variable have enum's equivalent of 0 , i.e. qfalse .

How to import java project (Eclipse) -

i have tried importing .zip project through eclipse right clicking project , selecting import, navigating zip folder on desktop , there go. if this, red exclamation mark next project name, after googling found because of error build path. the .zip created bosses machine , emailed me, not in office today , placement student have pretty no idea how fix this. does have tips/ can provide me. the import correct. fixing build path errors common task after importing projects. you'll have @ build path settings project , have find out, libraries missing , dependencies unresolved. right-click on project name, --> build path --> configure build path... check projects , libraries tab, reason red exclamation mark in there. you have rid of build path errors, otherwise eclipse can't build project. either provide valid paths libraries or delete classpath entries. the should remove exclamation mark , eclipse can build project. removing classpath entries res

python - how to create a subprocess? -

i create subprocess of process. can give me working example shows how accomplish this? start subprocess documentation. if want output: >>> import subprocess >>> output = subprocess.popen(['uname', '-a'], stdout=subprocess.pipe).communicate()[0] >>> output 'linux' if want call , not deal output: >>> subprocess.call(['echo', 'hi']) hi 0 subprocess.check_call same except throws calledprocesserror in case command called invalid parameters. a good subprocess tutorial .

Cross-platform configuration, options, settings, preferences, defaults -

i'm interested in peoples' views on how best store preferences , default settings in cross-platform applications. i work in node.js , perl on *nix , windows i'm interested in bigger picture. in *nix world "dotfiles" (and directories) common system-wide or application default settings residing in 1 path , user-specific settings in home directory. such files , dirs begin dot "." , hidden default directory listings. windows has registry has paths defaults , per-user overrides. certain cross-platform apps own way, firefox uses javascript preference files. should cross-platform app use 1 system across platforms or dotfiles on *nix , registry on windows? favourite programming language have library or module accessing them in standard way? there emerging best practice or roll own? what storing in db? cluster-friendly , has been working great us. in last job used store them in directory server. java has support in form of preferences api

wpf - How can i serialize xaml "Brush"? -

how can or best method serialize system.windows.media.brush ? here discussion of how serialize wpf: http://statestreetgang.net/post/2008/06/xaml-serialization-ftw.aspx /// <summary> /// serializes specified object /// </summary> /// <param name="toserialize">object serialize.</param> /// <returns>the object serialized xaml</returns> private string serialize(object toserialize) { xmlwritersettings settings = new xmlwritersettings(); // might want wrap these in #if debug's settings.indent = true; settings.newlineonattributes = true; // gets rid of xml version settings.conformancelevel = conformancelevel.fragment; // buffer stringbuilder stringbuilder sb = new stringbuilder(); xmlwriter writer = xmlwriter.create(sb, settings); // need moar documentation on manager, plox msdn xamldesignerserializationmanager manager = new xamldesignerserializationmanager(writer); manager.

html - a href changes visibility of a button/div? -

very strange thing happening here in ie7, ie8: index.php versus index-2.php as can see on index.php, button below "registration details" visible. on index-2.php, button not. difference between these 2 pages <a href> . on index.php <a href> existing page (but incorrect page) our-partners.php. on index-2.php, <a href> correct (and existing page) register-now.php. can please explain why happening? i'm going crazy trying understand! despite changing html & css suggested below, it's still not working correctly seemingly because of <a href> ! mtia! well, can see on both pages (ff 3.5). however, advise against putting <a href> around <div> that. might better idea use <a href="..." class="read-more"> , add display: block; style of read-more class. may or may not solve original problem ;)

php - Regex match HTML wrapped around HTML -

i asked here while ago matching text inside of 2 wrapped <code>..</code> tags string, , it's been working great until had other html wrapped inside <code> tags. this how i'm doing far: preg_match_all("!<code>([^<]*)</code>!", $string, $return_array); could improve regular exp. solve problem? :) thanks in advanced! this 1 case have agree dreaded regex evil meme. straightforward extraction purposes, regular expressions suitable. if want process malformed , or nested html, it's not option without significant fuss. hence i'd recommend using phpquery or querypath such occasions. it's pretty simple: print qp($html)->find("code")->text();

Reading XML in C# -

i have following xml <objects> <object> <viewangle>90</viewangle> <viewmode>thirdperson</viewmode> <top>50</top> <left>100</left> </object> </objects> i have following code read xml xmldatadocument doc = new xmldatadocument(); doc.load(xmlpath); xmlelement root = doc.documentelement; xmlnodelist nodes = root.selectnodes("/objects/object"); foreach (xmlnode node in nodes) { if (node.innerxml.contains("view")) { string viewtype=node["view"].innertext; //..... other stuffs } if (node.innerxml.contains("viewangle")) { string viewangle=node["viewangle"].innertext; //..... other stuffs }

r - Density Value for each Return -

i have dataframe "foo" looking this date return 1998-01-01 0.02 1998-01-02 0.04 1998-01-03 -0.02 1998-01-04 -0.01 1998-01-05 0.02 ... 1998-02-01 0.1 1998-02-02 -0.2 1998-02-03 -0.1 etc. i add dataframe new column showing me density value of corresponding return. tried: foo$density <- for(i in 1:length(foo$return)) density(foo$return, = foo$return[i], = foo$return[i], n = 1)$y but didn't work. have difficulty applying "function" each row. maybe there way it, not using density()? what extract fitted density values density() returns in foo. if plot(density(foo$return)) gives me curve, have density values attached returns. @joris: foo$density <- density(foo$return, n=nrow(foo$return))$y calculates something, seems return wrong density values. thank helping me out! dani on second thought, forget density function, realized wanted do. density functions return grid, don't give evaluation in exact points. if want that,

php - Modify Subscriptions using PayPal vs Amazon FPS -

i have been looking @ setting web applications rely heavily on ability users , substantially modify subscriptions. may using marketplace features well, , need system supports both seamlessly. i have seen multiple horror stories complexity of modifying subscriptions, including double billing, or cutting users off @ wrong time. i sincerely hope, instance, article http://talklikeaduck.denhaven2.com/2007/09/02/how-to-cure-the-paypal-subscription-blues is out of date. use cases have in mind more complex ones mentioned. sampling of do: support multiple subscriptions , subscription types/levels. instance 1 user might have 1 plan billed monthly @ $10 , 10 plan c billed @ $50 per month , 1 plan d billed @ $100 per year. support changing of arbitrary payment amounts. instance, user on $40 per month plan, changes $100 per month plan. cancels, signs again @ $50 per month before $100 period up. user should still $100 of service month paid $100 for, , should change $40 per month plan.

windows - Folder keeps changing to read-only -

i'm trying change folder read , write everytime check again read only the folder oracle db home. when untick read-only it applies when press ok check again it's read-only anyone know solution? i've got windows xp the read-only attribute on folders doesn't mean folder read-only. it doesn't mean @ filesystem used windows shell, , maybe other applications, tag. example, windows shell desktop.ini file if folder has read-only attribute set. (thus attribute allows avoid lookup if missing, since lookup can quite slow on network drives.) unless have reason care attribute solution ignore , let whatever setting have way. it's setting reason. on other hand, read-only attribute on files significant.

enterprise - How to restore a quote in Magento when returning to the Onepage checkout? -

i using magento enterprise, datacash 3d secure payment module. in event of error during payment process want user returned onepage checkout basket intact. when user returns checkout basket empty forwarded "checkout/cart" because have no items. i thought might problem code have initial payment action redirecting straight away error onepage checkout. public function redirectaction() { mage::getsingleton('core/session')->adderror("there problem payment gateway. please try again"); $session = mage::getsingleton('checkout/session'); return $this->_redirect('checkout/onepage/', array('_secure'=>true)); } however on returning checkout page basket empty. adding in following log indexaction of onepage checkout "quote ". looking in database quote has had active status set 0. error_log("quote ".mage::getsingleton('checkout/session')->getquoteid()); i have not came across problem sta

drop down list appears in front of my calender in asp.net -

drop down list comes in front of controls. have calander extender text box right above(top) drop down. when calender pop's out goes under i.e behind drop down. solution friends. how posting code/markup?

Facebook Android SDK Invalid_key -

possible duplicate: login failed invalid key error facebook sdk i using sample app here ibm.com/developerworks/library/x-androidfacebookapi/ test facebook android sdk, have given app id in sample app. have done setups , prerequisites. have signed app keystore , generated hash key submitted hash key facebook app settings page, installed facebook app on device. after doing app gives facebook error invalid_key. pls me in regards, thank you. invalid key number of reasons - make sure have keytool , openssl installed. make sure giving correct keystore file in command. make sure giving correct alias. make sure copied generated hash key correctly facebook application correctly. when got invalid key initially, because giving wrong alias. strange thing is, keytool , openssl won't mention alias wrong. if give command generate hash key, , doen't ask password, you're doing wrong.

java - Behaviour of threads with combination of synchronized methods in a class -

case 1 i have 2 synchronized methods shown below: class { public void synchronized methoda() {} public void synchronized methodb() {} } a: have threads t1 , t2. can threads simultaneously execute methoda , methodb (respectively) belonging same instance of class a? my analysis: answer no because 1 method executed thread t1 , thread t2 blocked until t1 finishes execution. b: have threads t1 , t2. can threads simultaneously execute methoda , methodb (respectively) belonging different instances of class a? my analysis: answer yes because t1 , t2 can execute methoda , methodb belonging different instances of class , not blocked. is understanding correct per analysis case 1? update: case 2 i have 2 synchronized methods, 1 non static , other static. class { public void synchronized methoda() {} public void static synchronized methodb() {} } a: have threads t1 , t2. can threads simultaneously execute methoda ,

sql - Detect overlapping date ranges from the same table -

i have table following data pkey start end type ==== ===== === ==== 01 01/01/2010 14/01/2010 s 02 15/01/2010 31/01/2010 s 03 05/01/2010 06/01/2010 and want following results pkey start end type ==== ===== === ==== 01 01/01/2010 14/01/2010 s 03 05/01/2010 06/01/2010 any ideas on start? lot of reading i've done suggests need create entries , each day , join on matching days, way? if have entries each day should work, if don't overhead significant, , if query used often, if affect performance. if data in format, can detect overlaps using simple date arithmetic, because overlap 1 interval starting after given interval, before given finished, like select dr1.* date_ranges dr1 inner join date_ranges dr2 on dr2.start > dr1.start -- start after dr1 started , dr2.start < dr1.end -- start before dr1 finished if need special handling interval wholly within interval, or n

How to get the current time in the format `2010-12-20 06:32:48` with PHP? -

anyone knows how it? what know time() it's pure digits.. as you've said, can current timestamp via time function . can pass timestamp php's date function . (it'll use current time if no timestamp provided.) the specific format you're after is: date('y-m-d h:i:s');

c - Intel Vs. AT&T syntax when addressing xmm and floating instruction -

hello working on writing assembly program , acquire knowledge before start on looks of at&t , intel syntax when addressing xmm , fp. know in regular instructions push when function on byte "pushb" in at&t while "push byte" in intel. can provide similar comparison when using xmm or fp? in sum want know how xmm operands addressed in advance i'm not at&t fan/user, first place start intel intel developer manuals(volumes 2a , 2b contain instruction references), these list sizes operate on, intel syntax assemblers try deduce (push try narrow variable or align it, depending on settings) if not specified, else you'll using qword/dword fp (for likes of fld) , dword/qword/dqword mmx/sse ops.

jquery - Pass HTML Table string through Json from controller to view -

i want achieve this: public system.web.mvc.actionresult exposuregrid(guid? id, decimal stddev) { //return null; try { var str = "<table border=1>"; str += "<tr><th>date</th><th>expected credit exposure</th><th>max credit exposure</th></tr>"; str += "<tr><td>12/1/2010</td><td>100,000</td><td>50</td></tr>"; str += "<tr><td>12/2/2010</td><td>101,000</td><td>100</td></tr>"; str += "<tr><td>12/3/2010</td><td>102,000</td><td>150</td></tr>"; str += "<tr><td>12/4/2010</td><td>103,000</td><td>200</td></tr>"; str += "<tr><

vb.net - How to implement a system wide text replacement in windows programmatically? -

i have small vb .net application that, among other things, attempts substitute system wide typed text user(hotstrings concept). achieve that, have deployed 'ahk2exe' , 'autohotkeysc.bin' application , did following: when user assignes new 'hotstring': kill 'hotstring' exe script file if running append new hotstring script file (if non exist create new one) convert edited/new script file exe (using ahk2exe) run newly converted script exe (somewhere there check if hotstring has been assigned) however, not totally satisfied method following 2 main reasons: the resources deployed application. lag: time takes system kill process , restart takes minimum of 5 seconds on fast computer , more on other computers. amount of time more time takes user assign hotstring, minimize/close window , test his/her new hotstring. when user no success think process failed. method not user experience. so, looking different method or implementation. may us

php - PostgreSQL: creating several pgplsql procedures in a batch -

i have php-script several similar sql tables (only 1 column varies): define('sql_tables', ' create table hide_id ( id varchar(20) references quincytrack, username varchar(20) not null, updated timestamp default current_timestamp ); create table hide_name ( name varchar(20) not null, username varchar(20) not null, updated timestamp default current_timestamp ); create table hide_category ( category varchar(120) not null, username varchar(20) not null, updated timestamp default current_timestamp ); create table hide_appsversion ( appsversion varchar(30) not null, username varchar(20) not null, updated timestamp default current_timestamp ); create table hide_osversion ( osversion varchar(30) not null, username varchar(20) not null, updated timestamp default current_timestamp ); and i'd create upsert procedure each of them: define(&

checking resources in xml and displaying icons for the resources in android -

hai every one. new android. in project had problems reading xml files. in xml have included audios , videos paths , want read xml file through code , want display images n view if there audio or video files. can body tel how read xml file. thanking in advance ok first need create parser below code this: public static void readtemplatefile(context context) { /** include file checking */ try { xml_handler_template myexhan = new xml_handler_template(); inputstreamreader isr = new filereader( new file(environment.getexternalstoragedirectory().getpath() + "/library template.xml" )); xml_handler_template.context = context; saxparserfactory spf = saxparserfactory.newinstance(); saxparser sp = spf.newsaxparser(); xmlreader xr = sp.getxmlreader(); xr.setcontenthandler((contenthandler) myexhan); xr.parse(new inputsource(isr)); } catch (exception e) { toas

wpf - ViewBox vs Grid -

whats difference between these two, , better approach. they different control! a grid allows arrange multiple children according a pre-defined set of rows / columns. a viewbox scales single child fill area on screen.

asp classic - can't close recordset in asp&sql server -

i keep getting error: adodb.recordset error '800a0e78' operation not allowed when object closed. the asp code i'm using: rs.open "usp_reply_insert 132 ,n'abc',n'teeeeeeext',0,n'gest','x@x.com' ",conn rs.close the problem rs.close command this stored procedure alter procedure [dbo].[usp_reply_insert] @maamar_id int, @subject nvarchar(200), @text nvarchar(max), @userid int, @name nvarchar(50), @email nvarchar(150) begin set nocount on insert dbo.tbl_reply (maamar_id, userid, reply_subject, reply_text, reply_name, reply_email, reply_date, reply_status ) values ( @maamar_id, @userid, @subject, @text, @name, @email, getdate(), 0 ) end how can close recored set? 10x from msdn documentation on recordset.open method : it not idea

How to use python to invoke events on a desktop? -

how use python invoke events , torrent application , feeding torrent file in linux ? most bittorrent apps on linux accept .torrent file command line parameter. (notable azureus//vuze) may need use qualified pathname, can os.path.abspath . use favorite method of running programs python subprocess module or os.system . if need more sophisticated can try looking client supports dbus .

Leaky bucket problem help? -

i'm trying review final , i'm going on example problems given me professor. can explain me concept of how leaky bucket works. here's review problem professor gave me leaky buckets. a leaky bucket @ host network interface. data rate in network 2 mbyte/s , data rate application bucket 2m5 mbyte/s a.) suppose host has 250 mbytes send onto network , sends data in 1 burst. should minimum capacity of bucket (in byte) in order no data lost? b.) suppose capacity of bucket 100m bytes. longest burst time host in order no data lost? leaky bucket symbolizes bucket small hole allowing water (data) come out @ bottom. since top of bucket has greater aperture bottom, can put water in faster goes out (so bucket fills up). basically, represents buffer on network between 2 links different rates. problem a we can compute sending data take 250mbyte / (2,5mbyte / s) = 100 s. during 100 s, bucket have retransmitted (leaked) 100s * 2mbyte/s = 200mbytes so bucket need m

ruby on rails - RoR : JQuery and Ajax request -

i fan of ruby on rails , looking tutorials adding ajax page. tried this tutorial , source there. kinda understand code, on computer, after sliding stock-list not update , keeps on displaying entire stock list, values passed around correctly, can check in controller. i tried modifying code , adding jrails in app/views/index.js.erb instead of respond_to |format| format.html format.js render :update |page| page.replace_html 'x_stock_list', :partial => 'stocks/stock_list', :locals => { :stocks => @stocks } end or adding simple alert js function file, shows plain text, when force use file (by deleting 'format.html' line above). apparently, javascript did not executed. according lot of tutorials ryan bates (railscasts) , line had added application.js: jquery.ajaxsetup({ 'beforesend': function(xhr) {xhr.setrequestheader("accept", "text/javascript")}}) to force javascript executed, did not either.

Android ListView doesn't (re) populate on "back" -

i have simple android app - dictionary. using listview populate dictionary words on main glossary screen. if word touched new intent launches wordscreen shows word , definition. problem if hit "back" go wordscreen glossary listview not populate. i using onstop() close database cursor when moving glossary screen, , onrestart() open cursor , (i thought) populate listview. doesn't seem working. one important thing, if after going glossary screen word screen (and getting black screen no listview) change orientation of app listview populates. i thought pressing "back" cause onrestart() execute. why pressing not cause listview populate, changing orientation does? thanks use onpause , onresume instead. changing orientation causes activity destroyed , restarted, navigating activity causes activity paused. when click it's resumed. check out overview - http://developer.android.com/reference/android/app/activity.html#activitylifecycle

c# - State and status of AvalonDock, options to AvalonDock -

i'm working on wpf interface use avalondock , or similar dockable windows interface. understanding avalondock pretty dockable window interface, i'm bit worried ongoing status of it. active? many comments on site discussion , bug tracker mention developer being busy, i.e. i've decided shuthdown blog site (youdev.net) i'm busy update regularity. anyway created getting started tutorial avalondock (1.3) can accessed here. i'll try answer question may have discussion section. and there number of "is still active?" questions in discussion section. thus, question: using in production software? issues there problematic. likewise, if has pointers decent dockable window library, free or commercial, i'd interested in taking look. edit: i'm using c# , .net 4 in vs2010. as research did on avalondock before coming here, still found afterward, sofa, wrapper avalondock making easier work with. sofa last updated less month ago, activity

mercurial - how to ignore dir-prop-base in .svn folder? -

i've read several posts here ignoring files in mercurial i'm stumped on one. i have couple of .svn files in repository (i'm using hg local commits, pushing svn). files are: apps\.svn\dir-prop-base apps\.svn\entries i've got several ignore entries in .hgignore none of them seem covering these 2 files. syntax: glob .svn/* **/.svn/**.* syntax: regexp \.svn\\* i'm trying couple of things see sticks there. me, looks files should ignored twice. strange thing apps\.svn\all-wcprops being ignored. i'm missing something. i'm checking whether files ignored opening new status window using tortoisehg. can't detect difference between , hg status . oben pointed me in right direction. declined making answer, here is: the files want ignore can't in add state when editing ignore file (since add takes precedence on ignore apparently). solution hg revert , edit ignore file, use hg status [directory] -i see files in target directory ignored

c++ - undefined reference to `__stack_chk_fail' -

getting error while compiling c++ code: undefined reference `__stack_chk_fail' options tried: added -fno-stack-protector while compiling - did not work, error persists added dummy implementation of void __stack_chk_fail(void) in code. still getting same error. detailed error: /u/ac/alanger/gurobi/gurobi400/linux64/lib/libgurobi_c++.a(env.o)(.text+0x1034): in function `grbenv::getpar/u/ac/alanger/gurobi/gurobi400/linux64/lib/libgurobi_c++.a(env.o)(.text+0x1034): in function `grbenv::getparaminfo(grb_stringparam, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)': : undefined reference `__stack_chk_fail' aminfo(grb_stringparam, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)': :

How do I add the iPhone SDK 3 to the latest version of Xcode? -

i upgraded xcode, don't have 3.x sdk simulator. how add testing purposes? you can try using old versions of xcode (with previous simulators) reliable 1 using device. iphone1's latest os version 3.1.3. i'm sure can pick 1 pretty cheap on ebay or similar. you need make sure drop minimum os version 3.0.

java - Good use case for Akka -

i have heard lots of raving akka framework (java/scala service platform), far have not seen many actual examples of use cases for. interested in hearing things developers have used succesfully. only 1 limitation: please not include case of writing chat server. (why? since has been overused example lots of similar things) i have used far in 2 real projects successfully. both in near real-time traffic information field (traffic in cars on highways), distributed on several nodes, integrating messages between several parties, reliable backend systems. i'm not @ liberty give specifics on clients yet, when ok maybe can added reference. akka has pulled through on projects, though started when on version 0.7. (we using scala way) one of big advantages ease @ can compose system out of actors , messages no boilerplating, scales extremely without complexities of hand-rolled threading , asynchronous message passing between objects free. it in modeling type of asynchronou

linq - Seek screencast demonstrating the act of inspecting a code expression tree -

text great lots of stuff not 'start-from-scratch' understanding of 3.5's linq.expressions (- @ least not pov of how gui can employed explore code expression tree) have access msdn (i'm sure have produced content - interested in alternatives too) navigating the best intro/overview of specific subject. thx update: 1 of times pictures worth more words.

c++ - how to combine two LPCWSTRs? -

i have 2 variables lpcwstr s. want create new variable have values of first , second variable. tried didn't work. lpcwstr d = l"sd"; lpcwstr f = l"f"; lpcwstr df = d + f; i error when try that. 1 intellisense: expression must have integral or enum type is there function can combine 2 lpcwstr s? in c++ idea use std::string manipulations strings. in case like: lpcwstr d = l"sd"; lpcwstr f = l"f"; std::wstring df = std::wstring(d) + f; lpcwstr dfc = df.c_str(); // if need

objective c - Play Video immediately when UIView is loaded -

howdy! i'm writing ipad app, , need able play video when uiview loads. however, getting bad_exc_access if try message mpmovieplayercontroller anywhere after initialize it. removed mpmediaplayercontroller *.h file, declared entirely in implementation file, , i'm getting message @ bottom below code. there no issues in build , analyze memory leaks (or issues, matter), , cannot find posts this. here's code: - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { } nsstring *url = [[nsbundle mainbundle] pathforresource:@"p0600c0100cmpintro" oftype:@"m4v"]; mpmovieplayercontroller *movie = [[mpmovieplayercontroller alloc] initwithcontenturl:[nsurl fileurlwithpath:url]]; nslog(@"%@", movie); movie.view.frame = cgrectmake(5, 0, 1035, 768); movie.view.contentmode = uiviewcontentmodescaletofill; [[movie view] setcenter:c

javascript - How to change a field based on user's selection in an HTML select? -

i have select list containing variables query <tr> <td>county name:</td> <td> <select name="countyname" onchange="countyid.value = countyname.value"> <option>select county</option> <cfloop query = "getcounties"> <option value="#countyname#" >#countyname#&nbsp;&nbsp;&nbsp;#countyid#</option> </cfloop> </select> </td> </tr> how can populate county id field? <tr> <td>county id:</td> <td><input type="text" name="countyid"> </td> </tr> i've never used jquery. there way use javascript? can see i've attempted javascript, can populate countyid countyname , need populated countyid . breaking out function should work you: live example <table> <tbody> <tr> <td>coun

cascade - mysql DELETE multiple tables -

is possible delete multiple tables? i have 3 tables related id, id same delete relevant information. many thanks you need specify on delete cascade rule tables. have @ mysql docs on foreign keys . cascading rules need force data integrity. with rules specified when delete parent row children rows automatically deleted rdbms.

flex - visual mxml creator - fireworks, photoshop, others -

i have mature flex app visually sucks. if could, use photoshop craft killer design , use fireworks, line slices , export mxmxl assets... , manually retrofit project. issue fireworks wont crop out slices when going mxml, takes stage 1 big image. what tool/process 'like' using fireworks create flex ui? i must missing something. thansk in advance. i think looking flash catalyst . takes adobe assets , lets skin them flex components. my designer using illustrator build beautiful ui, , morphs flex project using catalyst. i'd lying if said easy... need real massaging of catalyst export... export flex project , workflow works enough make app design.

Variables in Adobe Flex -

i'm tyring use variable declare in cdata later on in flex document. how can manipulate "userid" in cdata , send off in later httpservice code? <fx:style source="felxible_1.css"/> <fx:script> <![cdata[ public var userid:string; ]]> </fx:script> <fx:declarations> <mx:httpservice id="fetch_list_1" result="listfetched1(event)" method="post" url="find_data_1.php" useproxy="false"> <mx:request xmlns=""> <userid>userid</userid> </mx:request> </mx:httpservice> </fx:declarations> you need use "binding" syntax. in script, make variable send update messages when change it: [bindable] var userid:string; then, in markup, tell userid tag update when variable changes. <userid>{u

jquery table filtering/sorting plugins -

hey guys, there table sorting plugins let 'opt out' sorting once have sorted column, restoring the table unsorted/default state when table loaded? , gives hints on order of columns clicked when multiple columns used sorting? what jquery tablesorter plugin? have @ demo here

drupal 6 - PHP: Get http status code that own script just sent out via shutdown function -

i have shutdown function checks see if redirect issued. headers_list() can headers sent , see location header. question how figure out http_response_code used in header() function. headers list doesn't have response code. example code play around with. don't use redirects in example code, otherwise loop. main thing detect 301 vs other kind of redirect. inside drupal (via drupal_goto using hook_exit ); example code below shows issue. have no way of knowing status number passed browser via header(). <?php register_shutdown_function('test'); if (mt_rand(0, 1)) { header('x-test: junk 1', true, 201); } else { header('x-test: junk 0', true, 202); } exit(); function test() { if ($location = test_headers_contain('x-test: ')) { // check status code sent out echo $location . '<br>'; $list = headers_list(); $txt = str_replace(' ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(html

activerecord - How to do a Rails 3 join query? -

i have following model class user < activerecord::base has_many :assignments has_many :roles, :through => :assignments has_one :profile end how , active record query select profiles of users particular role? .includes(:relation) might useful

wpf - what is notifycollectionchangedaction reset value -

i have observable collection... selectabledatacontext<t> ..and in generic class selectabledatacontext<t> is...having 2 private member variables private t item. private bool isselected. when isselected property changes...my collection's changed property not firing . i think should fire...because it's reset in inotifycollectionchangedaction . this old question benefit of may come across through search did: notifycollectionchangedaction.reset means "the content of collection changed dramatically". 1 case reset event raised when call clear() on underlying observable collection. with reset event, don't newitems , olditems collections in notifycollectionchangedeventargs parameter. this means you're better off using "sender" of event reference modified collection , use directly, i.e. assume it's new list. an example of might like: ((inotifycollectionchanged)stringcollection).collectionchanged += new

arrays - php select X items from set? -

i using code igniter retrieve data database what returned array objects something like array( [0] = { mobile => '027xxxxxx', id => 1 }, [1] = { mobile => '027xxxxxx', id => 4 }, [2] = { mobile => '027xxxxxx', id => 5 }, [3] = { mobile => '027xxxxxx', id => 7 }, [4] = { mobile => '027xxxxxx', id => 9 }, [5] = { mobile => '027xxxxxx', id => 10 }, [6] = { mobile => '027xxxxxx', id => 112 }, [7] = { mobile => '027xxxxxx', id => 113 } ) i have variable called count, contains arbitrary number (although less number of objects in array). my question is: say count = 3 , how array of 3 random id's object? something array(4, 9, 1) i want single id once so array(4, 4, 9) incorrect. note id's not linear. $random_keys = ar

tsql - Conditional where statement in T-SQL -

Image
i've got table returns history of value, current one, each date. the oldest date main record. if value changed, new record created, old value, , main record updated new value. if happens again, third record created, contains old value. so if value starts @ 4, changes 2, again changes 1. records go 1 4 2 i'm creating inner join on table follows, gets max date of 3 above records, 2.. actual value need 4. easiest way tell if record historical 1 triageenddatetime null. inner join (select emergencyattendanceid,min(sourcecreatedatetime) max_date factemergencyattendancetriagedetail group emergencyattendanceid) eaid on eaid.emergencyattendanceid = factemergencyattendancetriagedetail.emergencyattendanceid , eaid.max_date = factemergencyattendancetriagedetail.sourcecreatedatetime what need select second record, if exists. along lines of this. select emergencyattendanceid,min(sourcecreatedatetime) m

How to use a complex associative array in javascript? -

i need table http://code.google.com/apis/chart/docs/gallery/qr_codes.html#details in program , i'm not sure if associative array way go. given type (numeric/alphanumeric), number of characters , ec (error correction) level, want function return version (first column). first, javascript has "arrays" , "objects". 'associative array' assume mean javascript object, using keys other non-negative integers. you can create javascript object literals using syntax such following: var versions = { "1" : { rowcols : [21,21], charsbyeclevel : { l : { digits:41, alpha:25 }, m : { digits:34, alpha:20 } } }, "2" : { rowcols : [25,25], charsbyeclevel : { l : { digits:77, alpha:47 }, m : { digits:63, alpha:48 } } } }; you access properties so: console.log( versions[1].charsbyeclevel.l.di

vb.net - Compile dll as earlier build -

when try run dll compiled in visual studio 2010, following message: this assembly built runtime newer loaded runtime , cannot loaded. i'm guessing means recent version of visual studio. there way can build dll earlier version? all assemblies in final solution, dlls or exes, in different solutions or in same one, must target same version of clr. can ensure configuring targeting in 2010 solution. most you're targeting 4.0 in dll's project. crank 3.5 or earlier , see if fixes problem.

Recommendations for open/source text indexing and search -

i discovered lucene (java library) , starting read on it. i'm interesting in taking works of literature (for example, philo, josephus), , indexing them, doing following types of analysis (similar bible software programs do): 1) find word x within 2 or 3 words of word y 2) find "work* of * hand*" - find "works of hands", "work of hand" etc... 3) find literary patterns (also called "motiffs") such author uses phrase "in day". (i think might trickiest, might have find combinations of 2-7 word phrases count them , rank them, showing top 25 example). might show example josephus use 1 sets of phrases, , philo another. are there open-source libraries recommend? language preferences 1) python, 2) c#, 3) java. ideally no dependencies on proprietary database. thanks, neal lucene best 1 out there in opinion in terms of popularity, community, activity , tooling. suggest @ solr built on top of lucene. open source

F# Inline Function Specialization -

my current project involves lexing , parsing script code, , such i'm using fslex , fsyacc. fslex lexbuffers can come in either lexbuffer<char> , lexbuffer<byte> varieties, , i'd have option use both. in order user both, need lexeme function of type ^buf -> string. far, attempts @ specialization have looked like: let inline lexeme (lexbuf: ^buf) : ^buf -> string ^buf : (member lexeme: char array) = new system.string(lexbuf.lexeme) let inline lexeme (lexbuf: ^buf) : ^buf -> string ^buf : (member lexeme: byte array) = system.text.encoding.utf8.getstring(lexbuf.lexeme) i'm getting type error stating function body should of type ^buf -> string , inferred type string . clearly, i'm doing (majorly?) wrong. is i'm attempting possible in f#? if so, can point me proper path? thanks! functions , members marked inline cannot overloaded, original strategy won't work. need write different code both of declarations, ne

winapi - Windows Power State change event notification in Qt -

i developing gui in qt have show battery status icon. system power status, using windows api. show status anytime , need use thread continuously read , display power status? i thinking of using event handler. not sure how implement. thinking 1 status icon run thread. has better suggestion, please share. using thread might overkill, using timer might more suitable case. qtimer can used update battery status on given interval. create qtimer object , connect it's timeout() signal slot in object, perhaps in battery state widget. in slot read new state , update icon accordingly. start qtimer instance interval of choice in milliseconds. btw. qt mobility api can used read power state on desktop. anyway if porting not issue, might easier use api platform provides.

ajax - Move a div below the current textarea (jquery) -

i have form several textareas. editing aid list div filled via ajax suggestions based on current input , active textarea. but thing need move div below active textarea. i've got current textarea id can't find way move element in particular way. <div id="list"></div> <dt><label for="mazas">mazas:</label> <dd><textarea name="mazas" id="mazas" rows="1" cols="150"></textarea></dd> <dt><label for="rayos">rayos:</label> <dd><textarea name="rayos" id="rayos" rows="1" cols="150"></textarea></dd> <dt><label for="llantas">llantas:</label> <dd><textarea name="llantas" id="llantas" rows="1" cols="150"></textarea><

c# - Mouse Down Event not firing (Bubbling events) -

i novice wpf. started learning routedevents in wpf. tried sample , met problem <grid margin="5" name="grid" mousedown="window_mouseup"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="*"></rowdefinition> <rowdefinition height="auto"></rowdefinition> <rowdefinition height="auto"></rowdefinition> </grid.rowdefinitions> <label borderbrush="black" borderthickness="1" grid.row="0" margin="5" name="fancylabel" mousedown="window_mouseup" > <stackpanel name="stack" mousedown="window_mouseup"> <textblock margin="3" name="txtblock1"> click </textblock> <textblock margin="50" name="

java me - Unable to use back button property in Popup screen in blackberry -

in application , using popup screen, implements fieldchangelistener.i used close() method button. not working. can give sample code without using keylistener , trackwheellistener ? if u want close popup screen on button try this: uiapplication.getuiapplication(). popscreen(uiapplication.getuiapplication().getactivescreen());

FullCalendar in jQuery tabs no loading initially via ajax -

i using own custom function populate events: $('#calendar').fullcalendar({ events:getcalendardata }); and happen have calendar 1 of tabs using jquery tabs plugin (tabs created $('#tabs').tabs();). the set-up works, except find when load page, calendar make async request (i see in firebug), if switch tab on calendar displayed, blank (interface fine, no events). if move next month , again, show data fine. also, if make calendar on first tab works fine! seems initial request not rendering events, perhaps because tab hidden @ time loaded. if load page, go calendar tab (showing no events), , happen manually call $('#calendar').fullcalendar( 'render' ); load events. i've tried putting render call after call fullcalendar callback, no dice. callback(events); $('#calendar').fullcalendar( 'render' ); it seems 1 option might bind $('#calendar').fullcalendar( 'render' ); show event of tab, that's tad messy

c# - Automatic reconnect to internet -

how can programatically force system (windows 7) reconnect internet? need ip changed. i'm using usb modem huawei e1750 there's chance you'll same external ip if reconnect, isp. internal (on router if have one) ip, can change changing ip address in windows 7 settings. why want ability - sounds you're trying around ip filter/limit of website? edit: well, not sure if help, simple google search turned up: http://bytes.com/topic/c-sharp/answers/260772-enable-disable-lan-connection

matlab - Curve fitting without toolbox -

without curve fit toolbox how fit function data in matlab? in particular, how fit function isn't polynomial, e.g., if want fit function y = x^(1/3) + 5 not integer? if know form of function want fit not know parameters, can use fminsearch find parameters fit data. if have data (possibly noisy) want fit y=x^a + b where a and b are unknown (here assume true values a=1/3 , b=5 ) how i'd have quick answer: here generate data (you not have in real life case) >> x = linspace(0,5,10); >> y = x.^(1/3) + 5; >> y_noisy = y + 0.1*rand(size(y)); then define function want minimize respect a , b , minimize fminsearch . in case, minimize integral of square of difference between data , function used fit. below have defined 2 functions, 1 noisy data, , 1 without noise. see in absence of noise recover values of a and b . nb: fminsearch wotks vector of parameters ( v in case). took a=v(1) and b=v(2) . have provide initial guess v (here [1 1] ). &g

.net - ObjectDataSource direct binding -

i have 2 sql tables single relationship. table a: id, applicationid, message. table b: id, applicationname. relationship: a.applicationid = b.id i want use objectdatasource bind them directly gridview want show applicationname instead of applicationid. how can that? thank u all. what sort of data access using? ado.net? linq2sql? entity framework? a sample require data access query both tables , provide data selectmethod of object datasource.

How to navigate up/down using keyboard home keys in Eclipse's suggestions pop up window? -

when eclipse shows popup code completion, how change highlighted option using keyboard home keys? currently, if thing want third or fourth on list of suggestions, have use mouse select it, or use arrow keys. there way use keyboard home keys/ shortcuts ctrl/alt this? arrow keys work me. can little more specific perspective, editor, etc? i code completion popup when press ctrl + 1 in java editor. on, can use arrow keys navigate.

flex3 - Resizing a component added to the canvas by dragging along the edge -

i developing application need place rectangular slabs of different shapes create shape of bench top. placing rectangular slabs of different shapes(i using canvas container slab) in repeater , dragging them on main canvas. 1 functionality needs implemented ability resize these slabs once dragged repeater drawing canvas dragging along edges resize windows see. there way can done. i found component developed purpose http://www.rogue-development.com/objecthandles.html i going check out. please inform if has other solutions.

regex - How to replace a String which has escape sequence inside a File using Perl? -

how replace string inside file using perl ? perl -pi -e 's/arun/brun/g' * this worked fine me but when tried change class/students/a class1/students1/b throws error how solve problem ..i tried adding slash ( \ ) before every ( / ) didn't perl -pi -e 's/class/students/a/class1/students1/b/g' * you using / regex delimiter. there / in pattern , replacement . need somehow ensure these / should not treated delimiter. you have 2 options: escape / in pattern , replacement as: perl -pi -e 's/class\/students\/a/class1\/students1\/b/g' * or use different delimiter: perl -pi -e 's#class/students/a#class1/students1/b#g' * method 2 preferred keeps regex short , clean .

c# - is it ok to instantiate lists in my domain object's constructor when using nhibernate? -

i have object have many properties lists. avoid having null checks everywhere before call add, count, clear, etc . . . thought better new lists upfront so inside resource object in case, have following code: public resource() { regions = new list<region>(); directs = new list<direct>(); } public virtual ilist<direct> directs { get; set; } public virtual ilist<region> region{ get; set; } i warning in visual studio saying calling virtual methods in constructor is there wrong or risk code above when using nhibernate ?? if wrong, there better way of achieving goal? that's fine. if want cleaner approach, use: public resource() { _regions = new list<region>(); _directs = new list<direct>(); } ilist<direct> _directs; public virtual ilist<direct> directs { { return _directs; } } ilist<region> _regions; public virtual ilist<region> regions { { return _regions; }

rest - Passing a stream to Restfull Wcf -

i passing stream rest full wcf service.i setting stream payload , not in uri.in case uri template.. my contract looks : [servicecontract] public interface irjisproxywcfservice { [operationcontract] [webinvoke(method = "put", uritemplate = "")] stream post(stream inputstream); } what uri template? there article @ http://msdn.microsoft.com/en-us/magazine/dd315413.aspx theoretically can anything. e.g. [servicecontract] public interface irjisproxywcfservice { [operationcontract] [webinvoke(method = "put", uritemplate = "aaa/")] stream post(stream inputstream); } [servicecontract] public interface irjisproxywcfservice { [operationcontract] [webinvoke(method = "put", uritemplate = "aaa/bbb")] stream post(stream inputstream); } however, when putting, putting url should baseurl/aaa (first case) or baseurl/aaa/bbb (in second case). sriwantha sri aravinda

embed block anywhere fails at drupal 7 -

it's been week have played around drupal 7. drupal 6, used able place (login) block anywhere this: $block = (object) module_invoke($module, 'block', 'view', $delta); $block->module = $module; $block->delta = $delta; return theme('block', $block); or this: $block = module_invoke('user', 'block', 'view', 0); $vars['login'] = $block['content']; i changed delta '0' drupal 7: $block = module_invoke('user', 'block', 'view', 'login'); // have changed 0 'login' delta @ drupal 7 $vars['login'] = $block['content']; both result in fatal error. change not aware of module_invoke? there no specific change @ http://api.drupal.org/api/drupal/includes--module.inc/function/module_invoke/7 any hint appreciated. hook_block($op) changed hook_block_op() in drupal 7. try: $block = module_invoke('user', 'block_view', 

hibernate - regarding converting sql to hql -

how select column's value null in hql? ex: in sql select null empname emp; in sql in hql ex: select emp.empname col1 employee emp; i want select empname' value null explained in above sql query an you can use cast function. this, select cast(null char) hede emp e or use quotes , change controls empty checks. select '' hede emp e

javascript - how to learn EXTJS -

i know jquery , javascript never worked on other frameworks extjs. can tell me best way learn extjs? , process configure extjs? in same way configure jquery (by adding standard js file)? or else. thanks i'd recommend jorge ramon's excellent extjs 3.0 cookbook - it's used learning doing stuff. projects start out pretty easy, , goes through configuring extjs. once you've got basics, sencha tutorials , faqs ok, reckon reference, best resource they've got far api . finally, jozef sakalos (aka saki) has made awesome examples on blog , on extjs examples site. good luck learning extjs!

android - How can I clear an SQLite database each time I start my application? -

i want sqlite database instance wiped away when program starts. what tried make method on class mydbadapter.java this: public class mydbadapter { private static final string tag = "notesdbadapter"; private databasehelper mdbhelper; private sqlitedatabase mdb; private static final string database_name = "gpslocdb"; private static final string permission_table_create = "create table permission ( fk_email1 varchar, fk_email2 varchar, validated tinyint, hour1 time default '08:00:00', hour2 time default '20:00:00', date1 date, date2 date, weekend tinyint default '0', fk_type varchar, primary key (fk_email1,fk_email2))"; private static final string user_table_create = "create table user ( email varchar, password varchar, fullname varchar, mobilephone varchar, mobileoperatingsystem varchar, primary key (email))"; private static final int database_version = 2; private final context mctx;