Posts

Showing posts from June, 2012

Text overwrite in visual studio 2010 -

really silly problem here. in visual studio 2010, text cursor has changed blinking line, blinking grey box around characters. when type overwrites text in front of it. i'm not sure how off? it's happens when press insert key in microsoft word , overwrite mode gets turned on. i'm working on mac windows virtual machine when hit insert it's shortcut key parallels (the virtual machine program i'm running). would appreciate help!! if pressing insert key doesn't work, try doubleclicking ins/ovr label in lower right corner of visual studio.

delphi - How do I identify what code is generating " '' is not a valid floating point value" error dialogue box -

Image
i using delphi 2010 , have program keeps generating error dialog box stating '' not valid floating point value how delphi show me line generated error? the easiest way solve run under debugger , have configured notify on language exceptions , tools | options: ignore big list of exceptions ignore come own codebase. make sure checkbox have highlighted marked. then when run program, stop @ line causes exception.

handling nulls and zero values in django -

if have model nullable field: class something(models.model): parameter = models.floatfield(blank=true,null=true) i want handle in view or template. if something.parameter has value, want return value, , if null, want return 'n/a'. if use: something = something.objects.get(id=1) output_string = 'parameter value: %s' % (something.parameter or 'n/a') then works, except in case something.parameter=0, returns 'n/a' rather desired '0'. how can correct behaviour? is there way of doing directly in template? use default_if_none template filter: {{ value|default_if_none:"n/a" }}

Can this XML be represented in CSV - Objective C -

i have following structure of xml can convert csv(ideally objective-c) <root> <parent> <name>somename</name> <age>20</age> <child> <childitem1>somevalue</childitem1> <childitem2>somevalue</childitem2> </child> <child> <childitem1>somevalue</childitem1> <childitem2>somevalue</childitem2> </child> </parent> <parent> <name>somename</name> <age>20</age> <child> <childitem1>somevalue</childitem1> <childitem2>somevalue</childitem2> </child> <child> <childitem1>somevalue</childitem1> <childitem2>somevalue</childitem2> </child> </parent> </root> the problem facing list formation of nodes. thanks in advance edited : problem need xml above result of csv/excel spread sheet, dont know how create such f

javascript - change message box title -

how can change title of message box in java script plese given me code that you can not change standard alert() of javascript. go through link- http://labs.abeautifulsite.net/projects/js/jquery/alerts/demo/

Find architecture of system in Windows Installer -

i have application developed in c#. creating installer app using visual studio setup project. while installation, want execute exe file differs 32 , 64 bit respectively. have use different file 32bit , 64bit. for executing exe file, have added "custom action" , works also. said, exe file differs system architectire. how can knwo architecture in installer , execute respective file. i tried following : check hkey_local_machine\software\wow6432node - if found returns "" , else returns "", of no use. versionnt - provides version, more concerned architecture. how can achieve ? vbs can work or not ? don't know vbs, know can added action , set condition , little bit things that. if @ create 32bit app detects architecture, how work out suring installation ? any highly appreciated. thanks look @ second comment here: http://msdn.microsoft.com/en-us/library/ms724072%28vs.85%29.aspx

python - Is there a way to efficiently yield every file in a directory containing millions of files? -

i'm aware of os.listdir , far can gather, gets filenames in directory memory, , returns list. want, way yield filename, work on it, , yield next one, without reading them memory. is there way this? worry case filenames change, new files added, , files deleted using such method. iterators prevent modifying collection during iteration, taking snapshot of state of collection @ beginning, , comparing state on each move operation. if there iterator capable of yielding filenames path, raise error if there filesystem changes (add, remove, rename files within iterated directory) modify collection? there potentially few cases cause iterator fail, , depends on how iterator maintains state. using s.lotts example: filea.txt fileb.txt filec.txt iterator yields filea.txt . during processing , filea.txt renamed filey.txt , fileb.txt renamed filez.txt . when iterator attempts next file, if use filename filea.txt find it's current position in order find next file , filea.txt n

mysql - How do you avoid column name conflicts? -

i assigned task of creating auction system. during work, met numerous occasions sql queries contained joins failed execute due ambiguous column names. consider (simplified) table structure auction: table auction : id name uid (id of user created auction) table item : id name uid (id of user added item) aid (id of auction item available) price (initial price) table user : id name table bid : id uid (id of user placed bid) iid (item price has been raised) price (offered price) as can see, there numerous columns have conflicting names. joining these tables requires using measures clear ambiguities. i can think of 2 ways this. first rename columns, prefixing of them abbreviated table name, auction id become a_id , item id become i_id , , item id within bid table become b_i_id . pretty solid, reduces readability of column names. another way can think of writing explicit queries: select `bid`.`id`, `user`.`name`, `bid`.`price` `bid` join

Choosing between WPF/C# and Qt/C++ -

me , team developing application, involves back-end written in c++ , involves use of libraries such opencv, mil, etc. now, need develop gui interface program, such gui displays images, , user can interact images , annotate / mark images, , run image processing algorithms written in c++ display results. for gui, stuck choosing between wpf , qt find wpf easier, , more powerful qt understand wpf not portable linux, not worried much... also, wpf uses directx technology, may have use generate 3-d visualization @ later stage. please me these points : can interface wpf directly c++ (and not visual c# ??) if (point 1) not possible, consider : code in c++ going big, , involving libraries too, can use c# call c++ functions time invested in learning qt lesser making unmanaged non-oo c++ code work wpf ? (i have sinking feeling i'd have write code interfacing c++ wpf, may equal rewriting half of actual program itself... :-( ) i've used both qt c++ , wpf. prefer

storage of data in memory -

i want know, how data stored in memory ; or affect of following code data1 db 1,2,3 how data stored.. if using 80386 or above intel microprocessor.. new these stuff kindly help! well, db defines sequence of bytes you'll 3 bytes 1, 2 , 3 in increasing memory locations, starting @ data1 . if data1 @ 0x00001234, 2 statements db 1,2,3 , db 3,2,1 (that's 1 or other, not 1 followed other) give: db 1,2,3 db 3,2,1 +------+ +------+ 0x00001234 | 0x01 | | 0x03 | +------+ +------+ 0x00001235 | 0x02 | | 0x02 | +------+ +------+ 0x00001236 | 0x03 | | 0x01 | +------+ +------+ for example, check out debug session: c:\src> debug -a 100 1388:0100 db 1,2,3,4 1388:0104 db 9,8,7,6 1388:0108 -d 100 10f 1388:0100 01 02 03 04 09 08 07 06-00 00 00 00 00 00 00 00 ................ -q c:\src> _ you can see 1 , 2 , 3 , 4 (in order)

matlab - Clever way to assign multiple fields at once? -

due legacy function calls i'm forced write ugly wrappers this function return = somewrapper(somefield) = somefield.a; b = somefield.b; % , on, realistically it's more ten variables % grouped in struct save('params.mat', 'a', 'b'); %etc. % then, on machine, function loads params.mat, calculations % , saves result in result.mat containing variables c,d,... load('result.mat', 'c', 'd'); return.c = c; return.d = d; % again, it's more 2 return values so basic idea create variables same names somefield 's fieldnames, run function , create return structure using somefunction 's return variable's names fieldnames. is there way simplify using loop e.g. on fieldnames(somefield) ? or should use different approach? since further processing done somefield , result i'd keep using structs, maybe second question be can save , load redirect varibale names? i.e. e.g. variable a in params.mat stored usi

VB.Net - select whole line in a multicolumn ListView and not only first item -

i have listview in vb.net. want use display table of data. i want able click on row , select it . component allows me select row clicking on first item of each row. can change that? is there better component display tables? (i've tried datagridview. don't it's appearance) this should matter of setting fullrowselect on control true .

c# - itextsharp measure chunk width / height -

i trying precise alignment itextsharp, keep falling short can't figure out way width / height value chunk or paragraph. if create paragraph font , size , text, dimensions should known, right? i know default left/right/center alignments trick me mostly, have scenarios knowing dimensions useful. ideas? you can chunk's width using getwidthpoint() , height of chunk font's size unless you're using lowercase letters. if can manually measure characters using basefont.getcharbbox() . paragraphs flowable items, however, , depend on context written measuring them harder. (chunks don't automatically wrap paragraphs do.) best way measure paragraph write pdfcell , measure pdfcell . don't have add pdfcell document. link below explains little more. http://itext-general.2136553.n4.nabble.com/linecount-td2146114.html

creating custom android keyboard layout -

this question has answer here: custom 'keyboard' built in application on android 3 answers i'd create custom layout android 2.3 keyboard. start? don't have experience in android platform. is possible hack existing keyboard layout not have create new 1 scratch? read creating input method on android dev site, soft keyboard example.

ruby on rails 3 - Why is my cron Job not running on OS X (configured by whenever gem)? -

i have set cron job, using great whenever gem. every 1.minute runner "peerreview.start_feedbacks" end i set cron job with: whenever --set environment=development --update-crontab the crontab file looks fine, shows: * * * * * /bin/bash -l -c 'cd /path_to_app/ && script/rails runner -e development '\''peerreview.start_feedbacks'\'' >> log/cron_log.log 2>&1' if execute runner, works fine, however, cron job doesn^t seem work (also don't see log being created). what missing? (i'm working on mac os x, 10.6.6) update i think identified problem: path name contains spaces , , wasn't handled correctly whenever gem, crontab filled incorrectly (the needed backslashes missing), cronjobs executed, path command wrong. all above correctly done. the rails app in directory spaces in path names , spaces not escaped whenever gem, when setting crontab.

performance - Most efficient method for persisting complex types with variable schemas in SQL -

what i'm doing i creating sql table provide back-end storage mechanism complex-typed objects. trying determine how accomplish best performance. need able query on each individual simple type value of complex type (e.g. string value of city in address complex type). i thinking store complex type values in 1 record xml, concerned search performance of design. i need able create variable schemas on fly without changing database access layer . where i'm @ now right thinking create following tables. table: schemas column name data type schemaid uniqueidentifier xsd xml //contains schema document of given complex type deserializetype varchar(200) //the full type name of c# class document deserializes. table: documents column name data type documentid uniqueidentifier schemaid uniqueidentifier table: values //the documentid+value

C# - Tree / Recursion in Get and Set Accessors? -

i have tree (a list<t> ) contains number of itemtype classes (see code below); class has properties overridediscount (which null , indicating use defaultdiscount (which null , indicating use parent itemtype 's calculateddiscount )) so see need recurse tree (which incidentally list<itemtype> ) parent's calculateddiscount , because null , means need parent's parent's calculateddiscount , on... is bad idea put code in get accessor? how handle it? just sidenote, data comes via sqldatareader database in no particular order, after children property list populated looping through tree , adding children list appropriate. parents unaware of children until after set accessor has been called, ruling out putting useful in set accessor (e.g. setting children's calculateddiscount in set accessor). unless i've missed other way of doing (very possible, recursion fries brain sometimes). thanks in advance the class far: public class

install - no access to windows phone 7 marketplace -

my country has no access wp7 marketplace want know if can still @ least develop apps own wp7 device or @ least directly install on other devices have access to.. thanks you can still develop applications countries have wp7 marketplace , can add applications unlocked device without needing access marketplace using application deployment tool, part of windows phone7 development tools . in order unlock phone, need create account on app hub , register developer.

jsp - Does every browser open a new HTTPSession -

i working on webbased application has jsp , servlets. in application, binding objects sessions following code -- httpsession session = p_req.getsession(); session.setattribute(download_with_warnings, downloadmap); later retrieving them using session.getattribute. know if every time open new browser open new http session. because , if setattribute value in 1 browser instance, change visible when getattribute using other browser instance. the behaviour depends on browsers. ie 6 - everytime open new browser window, you'll have new session. if open new window using file - new menu, use same session. all other browsers - opening new browser window use existing session. to sure, clear cookies once.

logging - How can I log current line, and stack info with Python? -

i have logging function follows. logging.basicconfig( filename = filename, format = "%(levelname) -10s %(asctime)s %(message)s", level = logging.debug ) def printinfo(string): if debug: logging.info(string) def printerror(string): if debug: logging.error(string) print string i need login line number, stack information. example: 1: def hello(): 2: goodbye() 3: 4: def goodbye(): 5: printinfo() ---> line 5: goodbye()/hello() how can python? solved def printinfo(string): if debug: frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) logging.debug(stack_trace[:-1]) if log: logging.info(string) gives me info need. debug 2011-02-23 10:09:13,500 [ ' file "/abc.py", line 553, in <module>\n rununittest(coverage, profile)\n', ' file "/abc.py", line 411, in rununittest\n printinfo(string)\n']

c# - The battle between TDD/Injection and information hiding - A possible compromise? -

i proposed following pattern else. have used few times, when wanted ability inject dependencies test, but still wanted backdoor (somewhat) invisible outsiders. hence, empty public ctor , internal ctor argument: public class classthatuseinjection { private readonly someclass _injectedclass; public classthatuseinjection(): this(new someclass()) {} internal classthatuseinjection(someclass injectedclass) { _injectedclass = injectedclass; } } public class someclass { public object someproperty { get; set; } } my idea since empty ctor nothing forward new instance, crime not bad. think? is smelly? regards, morten i think ok. in fact, doing injecting class dependency injection , practical use of open/closed principle. don't see no harm in making internal ctor public one. problem always, don't want force others create instance of injected class, therefore, default ctor. if want create instance, can go ahead , so. on related no

c# - Mapping IDataReader to object without third party libraries -

are there quick way map idatareader object without third party libraries such automapper or valueinjecter? i'm not sure mean quick, can put using reflection. there's lot of assumptions you'll have make, such object's values set via properties. and, datareader columns must match object property name. this: note: setproperty function article on devx . (it in vb.net, , converted c# -- if there mistakes, missed something.) ilist<myobject> myobjlist = new list<myobject>(); while (reader.read()){ int fieldcount = reader.fieldcount; myobject myobj = new myobject(); for(int i=0;i<fieldcount;i++){ setproperty(myobj, reader.getname(i), reader.getordinal(i)); } myobjlist.add(myobj); } bool setproperty(object obj, string propertyname, object val) { try { //get reference propertyinfo, exit if no property //name system.reflection.propertyinfo pi = obj.gettype().getproperty(propertyname); if (pi

Question about arrays in Java -

can explain why, a.equals(b) false , when initiate b using int[] b = a.clone() true if initiate b using int[] b = a ? int[] = {1, 2, 3, 4, 5}; int[] b = a; //int[] b = a.clone(); if(a==b){//true system.out.println("equal"); } if(a.equals(b)){//true system.out.println("equal"); } well if use int[] b = a; then b , a refer same object, trivially they're equal. first comparison (==) certainly return false between a , a.clone() values refer different objects. sounds arrays don't override equals (e.g. arraylist does), hence clone not being equal original under equals method either. edit: indeed, language specification section 10.7, array members : all members inherited class object; method of object not inherited clone method. in other words, array overrides clone() not tostring / hashcode / equals .

ASP.NET MVC2 - Model Binding multiple data sources on one View page - Options? -

i have 1 view page (myview.aspx) , many data sources bind on page. lets has books, publishers, comments, etc. each 1 of has object provides list, list, etc. in view, optiosn multilple model biding? i want check see if each 1 empty, , enumerate it. can't check model.count() because wouldn't model made of objects if set page inheriet ? what options? should load each content area in control/partial view? or can dump each object viewdata , check count casting in view? thanks taking @ problem. have considered using viewmodel contains lists of of different data fields , using populate view? example: viewmodel: public class myviewmodel { list<book> books {get; set;} list<publisher> publishers {get; set;} list<comment> comments {get; set;} //other fields... //constructors... } then in view check if specific field null prior enumerating through it: view: if(model.books.count() != 0) { //enumerate through results

Sencha Touch vs. jQtouch vs. GWT mobile vs. XUI vs. jQuery Mobile vs. -

hey, there posts out there discussing sencha touch , jqtouch. i understand sencha more heavy apps. read here: http://9-bits.com/post/723711597/jqtouch-and-sencha-touch but gwt mobile vs. xui vs. jquery mobile? tested them? gwt mobile looks quite nice... did not dig deeper yet. other mobile dev frameworks? if want cross platform, web based, mobile support devices beyond webkit browsers (ios, android, bb 6.0+), need scalpel, not chainsaw. sencha, jquery mobile, , great , give tons of functionality right out of box, many mentioned, catering big mobile players , leave wanting when comes supporting , lower end devices. my choice of scalpel has been phonegap + xuijs , i'm loving far. while bare bones js library, gives foundation build reliable, gracefully degradable experience across entire spectrum of smart phones (with wp7 on way). write transitions, skinning, etc... css , browsers don't support them deliver content without flare of sliding views, round corner

In MySQL 5, SELECT COUNT(1) FROM table_name is very slow -

i have mysql 5.0 database few tables containing on 50m rows. how know this? running "select count(1) foo", of course. query on 1 table containing 58.8m rows took 10 minutes complete! mysql> select count(1) large_table; +----------+ | count(1) | +----------+ | 58778494 | +----------+ 1 row in set (10 min 23.88 sec) mysql> explain select count(1) large_table; +----+-------------+-------------------+-------+---------------+----------------------------------------+---------+------+-----------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+-------------+-------------------+-------+---------------+----------------------------------------+---------+------+-----------+-------------+ | 1 | simple | large_table | index | null | fk_large_table_other_table_id | 5 | null | 167567567 | using index | +----+-------------+----

setting timestamps for audio samples in directshow graph -

i developing directshow audio decoder filter, decode ac3 audio. filter used in live graph, decoding ts multicast. demuxer (mainconcept) provides me audio data demuxed, not provide timestamps sample. how can get/compute correct timestamp of audio? each ac-3 frame embeds data 6 * 256 samples. sampling rate can 32 khz, 44.1 khz or 48 khz (as defined ac-3 specification digital audio compression standard (ac-3, e-ac-3) ). frames not carry timestamps, needs assume continuous stream , increment time stamps respectively. mentioned source live, might need re-adjust time stamps on data starvation. each ac-3 frame of fixed length (which can identify bitstream header), might checking if demultiplexer giving single ac-3 frame or few in batch.

Apache Mod-rewrite -

this gives "no record found" ###get members pagename rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /view_members_public_profile.php?page_name=$1 [l] shows member record http://localhost/view_members_public_profile.php?page_name=mabel i want show members profile going http://localhost/mabel any ideas? thank you try rewriterule ^/(.*) /view_members_public_profile.php?page_name=$1 [l]

how to write path of external file in an included c++ source -

suppose i'm writing library or set of tools mytool class mytool other people can use defined. suppose have directory tree this: project | - program1 | - main1.cpp ... | - mytool | - mytool.h | - mytool.cpp | - data.txt in tool1.cpp use external binary huge file data.dat : ifsteam f("data.txt"); the main1.cpp use mytool, if mytool.(s)o linked main1.o program can't find data.dat , case need change previous line to: ifstream f("../mytool/data.txt"); but can't know other people put mytool example can have different directory tree: project | - program1 | - main1.cpp | - mytool | - tool1.h | - tool2.cpp | - data.dat in addition (am right?) path depend on program executed. the solution can imagine pass class contructor mytool path of data.dat want keep hidden file user. you need know absolute path of file, or else path of file relative working directory. 1 approach have conf

db4o: LINQ equivalent of SODA query? -

for db4o, i'm trying find linq code generates following soda: var query = db4o.db.query(); query.descend("symbol"); query.descend("_symbolglobal").constrain("apple"); query.descend("_date"); // add date constraint here. iobjectset result = query.execute(); all soda drop down tree end node. example, if wanted select "apple" date "2010-10-18", return "apples on thursday". data structure: root ----symbol (apple) | |------day 1: date: 2010-10-18, string "apples on thursday" | |------day 2: date: 2010-10-19, string "apples on friday" | | |-----symbol (pear) |------day 1: date: 2010-10-18, string "pears on thursday" |------day 2: date: 2010-10-19, string "pears on friday" here first attempt, doesn't work getting cross product (i.e. looking @ ev

nhibernate - Map a column multiple times -

i have rather odd requirement in fluent hibernate maps. have table(a) has compound foreign key relationship table(b). in mapping table have both object created table b , access individual attributes of define key. there way that? seem index out of range exceptions if map column twice. i cannot explore b attributes because row in table b may not exist. painfully aware there significant smells in structure i'm dealing. such fate of deal legacy systems. it's kinda possible, hacking around little. we're going define domain fake collection we'll use retrieve single related element, if found: public class foo { public virtual barkey barkey { get; set; } public virtual bar bar { { return bars.singleordefault(); } } protected virtual icollection<bar> bars { get; set; } } public class bar { public virtual barkey id { get; set; } } //this class must override equals , gethashcode. implementation not shown. public class barkey { pub

Javascript library for clickable bar chart? -

Image
i need javascript charting tool build bar chart allows me click on chart bar , chart (in popup or below first chart). need bar chart fires event giving me kind of id of column has been clicked. dettails the data first chart should loaded ajax when page loads , data second chart should loaded when click on 1 of columns. an example: graph 1 bar march , 1 bar april, when click on march bar second graph (below or in pop up) 2 bars: 1 12/03/2011 , other 23/03/2011. total expenses: march 1200 april 300 total expenses march: 12/03/2011 1000 23/03/2011 200 total expenses april: 16/04/2011 10 21/04/2011 290 yet option, if using jquery: flot . graph types: interaction: click images see actual demo.

email - php mail function problem -

this code far function send_email() { $email = $_post['signup-email']; $firstname = $_post['firstname']; $lastname = $_post['lastname']; $to = "the1nz4ne@hotmail.com"; $subject = "email ratemylife.com"; $body = "hi ,$firstname $lastname, email ratemylife.com"; $headers = "from:info@iphoneappgmz.com"; mail($to, $subject, $body, $headers); exit(); } $existingsignup = mysql_query("select * signups signup_email_address='$email'"); if(mysql_num_rows($existingsignup) < 1){ $date = date('y-m-d'); $time = date('h:i:s'); $password = md5($passwd); $insertsignup = mysql_query("insert signups (signup_email_address, signup_date, signup_time, firstname, lastname, password, year, day, month, gender) values ('$email','$date','$time','$firstname', '$lastname', '$password', '$year', '$day', '$month&#

java - logging and wrapping exceptions. is this good practice? -

do think it's worth wrap service methods in try catch block log exceptions this: public void attachclean(car instance) { log.info("attaching clean car instance"); try { getsessionfactory().getcurrentsession().lock(instance, lockmode.none); log.info("attach successful"); } catch (runtimeexception re) { log.error("attach failed", re); throw re; } } it seems lot of typing you log or rethrow, not both. upper layers may able handle exceptional state, , logging entire stacktrace unnecessary in such case. hovewer, if absolutely want make sure it's logged, can log on own. logging exception multiple times better missing important exception in log file.

dictionary - Create an Android GPS tracking application -

Image
recently i've taken android development hobby , looking develop application can find , track users position using google maps. once application has gps lock, application can track movements drawing route using overlay class. i've seen similar applications mytracks open source they're complex me right now. ideally i'd love create application looks this he code below without imports. what i'm trying create array of geopoints. every time location changes new geopoint created. try use loop iterate through each geopoint , draw path between them. public class tracking extends mapactivity implements locationlistener { locationmanager locman; locationlistener loclis; location location; private mapview map; list<geopoint> geopointsarray = new arraylist<geopoint>(); private mapcontroller controller; string provider = locationmanager.gps_provider; double lat; double lon; @override public void oncreate(bundle savedinstancestate) { super.oncr

facebook - Is there a way to update User profile data from an application e.g. Political View? -

i wondering if there way update piece of user info application, example siblings or political views or school or place of work or other info. i couldn't find such functionality mentioned in developer doc directly. wondering if there way around it. you can't change profile of user. see list of elements can access , publish on facebook though app

Why does Rails not document the ability to use accepts_nested_attributes_for on children -

from rails documentation: "nested attributes allow save attributes on associated records through parent ." i able save attributes on associated records through child . (which great... why not documented or explained?) (this project can cloned github at: https://github.com/blasto333/vehicles-demo/ ) vehicle model (parent) class vehicle < activerecord::base has_one :car attr_accessible :name, :color, :price, :condition end # == schema information # # table name: vehicles # # id :integer not null, primary key # name :string(255) # color :string(255) # price :string(255) # condition :string(255) # created_at :datetime # updated_at :datetime # car model (child) class car < activerecord::base belongs_to :vehicle accepts_nested_attributes_for :vehicle attr_accessible :doors, :sport, :vehicle_attributes end # == schema information # # table name: cars # # id :integer not null, primary key # v

ruby on rails - What is the best practice for rendering the same thing in two different ways? -

i got - actor - model , relative controller classical show action displays complete list of actors , various information them (e.g. movies they've starred in, etc.). now, i'd retrieve exact same information need show action, show them in partial different style, since partial - _search_results - has used create small "search-as-you-type" box. imagine show action finder window displaying folders , files , partial dropdown list appears when search on spotlight. of course stay dry possible , i'm wondering best practice this, while not repeating code in actors_controller , since information needed partial same show action produces show view. thanks. edit (n.b.) of course want partial rendered inside controller, because don't want application layout shown in search result box! the classic advice on stick information assembly in model, can accessed multiple controller actions without duplication. named scopes , make of easy do. http:

File upload via FTP gaieerror Python 2.6 -

i'm trying upload text file ftp server, getting error: gaierror: [errno 11004] getaddrinfo failed here code. s = ftplib.ftp("ftp://xbrera.co.cc", "myuser", "mypass") f = open(path + "ld.txt", "r") s.storbinary("stor " + path + "ld.txt") f.close() s.quit() what doing wrong, , why getting error? thanks! change code s = ftplib.ftp("xbrera.co.cc", "myuser", "mypass") . ftp:// mandatory uri ftplib library expect hostname of ftp server.

how does this css footer stay at the bottom -

possible duplicate: how footer stay @ bottom of web page? how site keep footer @ bottom when content short? you can use sticky footer solution http://ryanfait.com/sticky-footer/ or http://www.cssstickyfooter.com/

scope - Is it possible to see variable states in native iPhone apps? -

for example, if upon launching app wanted see current caller or latest sms message "phone" or "messages", there classes available can access information @ level? this may system security/stability/scoping issue apple wants avoid, it's worth try. you're assumptions correct, not allowed, nor think ever be. i believe reasoning developers cannot access personal information phone numbers , addresses , exploit them. you can send mail , sms messages app, , can see current call state.

PHP MYSQL while change field name each time -

i have database store people's quick links. basic quick link storage method. database looks this: full_name | 1url | 1name | 2url | 2name | 3url |3 name | 4url |4name | 5url | 5name ^this goes on until 10. know bad way, unprofessional website. i want put result ordered list. unsure how change number (1url or 2url) each time? so have set in php $result = mysql_query(select * `links` `full_name`='$loggedin')or die (mysql_error()); while($row = mysql_fetch_array($result)){ echo '<li><a href="'; echo $row['1url']; echo '"></a></li>'; } but having no luck that! i'm unsure of should do. want display <li> <a> , link plus name of link each row found. thanks! please specific me, new ground! :d edit: i have run problem. have used code peoples' answers , of them work. however, if 1 of fields blank (so user has 6 quick links) still shows <li> . ca

c# - Process.Start throws Win32 Exception Access is Denied on Windows XP Machines -

i'm attempting call executable using process.start , throwing win32 exception on windows xp machines. console application installed on machine. here's example of code: var path = @"c:\mycoolpath\file.exe"; var content = "my cool content"; using (var process = process.start(new processstartinfo(path, content))) process.waitforexit(); here's stack trace: system.componentmodel.win32exception (0x80004005): access denied @ system.diagnostics.process.startwithshellexecuteex(processstartinfo startinfo) @ system.diagnostics.process.start() @ system.diagnostics.process.start(processstartinfo startinfo) anyone have advice on getting work on windows xp machines? using useshellexecute = false processstartinfo lets work.

Django tutorial on remote server: how to view in my browser? -

i'm getting started django tutorial, , i've run snag. having created sample "mysite" on usual domain, want able display in browser. tutorial points me http://127.0.0.1:8000 . however, that's not going work, i'm doing remotely. [background information] what have done, apparently successfully, django-admin.py startproject mysite (created mysite directory containing 4 files) python manage.py runserver (validating models... 0 errors found, etc.) the absolute path /home/toewsweb/public_html/pythonlab/mysite url should able use bring in browser? i put mysite @ /home/toewsweb/mysite (since it's not supposed go in publicly accessible directory) url should able use in case? this virtual private server, have access httpd.conf. have downloaded , installed mod_wsgi , have added apache configuration. did set subdomain documentroot of /home/toewsweb/public_html/pythonlab/mysite; however, when point browser subdomain, directory listing. [/backgroun

mercurial - How (is it possible) to create an hg command alias that runs multiple commands? -

i define mercurial command alias in hgrc file invokes multiple commands. example following: [alias] giveup = revert --all --no-backup; purge syncprod = fetch production; push production this allow me call hg syncprod , have invoke fetch , push. haven't been able determine if capability exists. (i'm guessing means no.) use shell alias style this: giveup = !$hg revert --all --no-backup ; $hg purge though, i'd create bash alias skip hg part altogether.

android - Populating a listview with images from the SD card (not a set amount of items in list) -

basically i'm trying make contact list 1 provided android. when populating listview items, using simplecursoradapter can names appear in r.id.textview of each item: private void filldata() { mcursor = mdbadapter.fetchallcontacts(); startmanagingcursor(mcursor); string[] = new string[] {dbadapter.key_name}; int[] = new int[] {r.id.contact_name}; simplecursoradapter contacts = new simplecursoradapter(this, r.layout.contact_view, mcursor, from, to); this.setlistadapter(contacts); } something that. i've searched , found sample code both getting images online, or displaying set number of images in items (for instance know have 5 items 5 matching images). don't know i'd begin on getting images sd card, , displaying them in proper item. images named according id of contact, have means call proper image. a push in right direction appreciated, thank you! edit: @jeff gilfelt gave great answer, went ahead , spoke whe

javascript - Script organization patterns (MVC + jQGrid) -

i'm building mvc web app heavy use of ajax loaded partial views containing jqgrids , javascripts. many of partial views contains 2 div tags , rest javascripts. using script tags makes general page structure more logic me, because javascripts content of page see it. however there small utilityfunctions, formatting functions, used jqgrid , i'm starting see increasing risk of scripts same name performing identical tasks. example of formatting function: function primaryroleformatter(cellvalue, options, rowobject) { switch (cellvalue) { case "1": return "<%= resource.primary %>"; default: break; } return ""; }; at first saw formatting functions belonging closest grid, since there might other grids having formatting function same name small differences in code. i load 2 or more grids @ same time, seems javascript smart enough use script define

.net - NullReferenceException WIA C# -

when run code below error nullreferenceexception unhandled.. below code private void showscannerdialog() { this.scanner = null; this.imageitem = null; this.getscanner(); wia.commondialog dialog = new wia.commondialog(); items imageitems = dialog.showselectitems(this.scanner, wiaimageintent.textintent, wiaimagebias.minimizesize, false, true, false); if (imageitems != null) { foreach (item item in imageitems) { imageitem = item; break; } } } thanks // complete code using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io; using system.collections; using system.drawing.imaging; using system.runtime.interopservi

c++ - How to use std::tuple types with boost::mpl algorithms? -

the boost::mpl algorithms seem not able work on std::tuple types out of box, e.g., following not compile (boost-1.46.0, g++ snapshot 2011-02-19): #include <tuple> #include <boost/mpl/vector.hpp> #include <boost/mpl/contains.hpp> namespace mpl=boost::mpl; typedef mpl::vector<int,float,bool> types; static_assert(mpl::contains<types, float>::value, "vector contains bool"); typedef std::tuple<int,float,bool> types2; // following not compile: // error: no class template named ‘apply’ in ‘struct boost::mpl::contains_impl<boost::mpl::non_sequence_tag>’ static_assert(mpl::contains<types2, float>::value, "tuple contains bool"); what easiest way make boost::mpl algorithms work on std::tuple ? does evtl. boost::fusion provide functionality (as boost::tuple )? if not, possible carry on fusion implementation boost::tuple std::tuple easily? if not either, have implement all intrinsic metafunctions listed in mpl

.net - Best way to keep a DataGridView up to date in c# -

i want add filter textbox application when user types text it, type it, datagridview automatically trim down what's being viewed. right datagridview bound list user objects. i in process of using linq create separate list of user objects , re update datagridview doing whole datagridview1.datasource = filteredlist best way go this? feel i'm doing bad way. that's similar i'd go with. alternatively iterate list , remove objects no longer matching more memory-friendly.

Testing Routes with Rspec in Rails 3 -

i have form suppose post create action doing post index action. decided test routes rspec. in example have test follows. it "should recognize specific invoices#create route" assert_routing("/invoices", {:controller => "invoices", :action => "create"}) end but when run test coming error. 1) invoicescontroller on :index should recognize specific invoices#create route failure/error: assert_routing("/invoices", {:controller => "invoices", :action => "create"}) recognized options <{"action"=>"index", "controller"=>"invoices"}> did not match <{"controller"=>"invoices", "action"=>"create"}>, difference: <{"action"=>"create"}>. expected block return true value. so im trying figure out why form doing post on index , why test thinks im doing index route. have tried in

exception - SAXParseException and UnmarshalException -

i trying deal these exception. example when user, loads invalid xml file, saxparseexception thrown , asked load file. it seems "catch" won't work here. here's code: public void parsexml_from_file (file xml_file) { try { jaxbcontext jc = jaxbcontext.newinstance ("generated"); //creating unmarshaller. unmarshaller u = jc.createunmarshaller (); //using file approach system.out.println("using file approach:"); jaxbelement element = (jaxbelement) u.unmarshal(xml_file); test_class maintest = (test_class) element.getvalue (); } catch (jaxbexception e) { e.printstacktrace (); }catch (saxparseexception e) //do }catch (unmarshalexception e) //do } } even, wont work catch (jaxbexception,saxparseexception,unmarshalexception e) { //do } @don robi this get: exception in

compiler construction - What's the relationship between LR grammar and S-attributed grammar? -

is true lr grammars can converted s-attributed grammar since bottom-up grammars? update is true attributed grammars converted lr grammars s-attributed grammars? from can tell, "s-attributed" describes any attribute grammar uses synthesized attributes. therefore grammar can parsed bottom (say lr grammar can parsed using lr parser) should capable of passing synthesized attributes up, , therefore considered s-attributed grammar if attached attributes it.

jquery - Horizontal scrollbar not showing up -

update: using overflow-x (it question wrong) the horizontal scrollbar should show in case, not <div style="overflow-x:scroll; width:400px"> <div style="float:left; width:300px">abc </div> <div style="float:left; width:300px">abc </div> <div style="clear:both"></div> </div> how use div overflow in case? to answer question, child divs not cause overflow of parent div. current design not cause overflow of parent because both children set float:left it seems assuming children stacked horizontally; turn float off , put them in table of width 600px in adjacent cells , see does. also note css overflow property highly browser-dependent. browsers use overflow:scroll , use overflow:auto .

SQL Server Reporting Service - Reference another dataset? -

i have 2 datasets in sql server 2008 reporting services report. need attach clause second 1 contain value first one. how should write second query? if understand asking, should run sub query within clause. select title books author_id in (select id authors);

iphone - Read UTF8 character in specify position from a NSString -

nsstring* str = @"1二3四5"; nslog(@"%c",[str characteratindex:0]); nslog(@"%c",[str characteratindex:1]); nsstring - characteratindex works on ascii chars, how utf8 character @ index of 2? -- updated -- seems unichar(16bits) can't represent utf8 encoding strings(8bites 32bites), there method char nsstring? unfortunately dave's answer doesn't want. index supplied rangeofcomposedcharactersequenceatindex index of utf-16 code unit, 1 or 2 or make utf-16 code point. 1 not second utf-16 code point if first code point in string requires 2 code units... ( rangeofcomposedcharactersequenceatindex returns range of code point includes code unit @ given index, if first char requires 2 code units passing index of 0 or 1 returns same range). if want find utf-8 sequence character can use utf8string , parse resultant bytes find byte sequence nth character. or can likewise use rangeofcomposedcharactersequenceatindex star

How to access PageData in a WebMatrix C# file? -

many of webmatrix examples , tutorials use pagedata transfer data between pages during page construction process (e.g. between content page , layout page). example... @{ layout = "/shared/_layout.cshtml"; pagedata["title"] = "passing data"; pagedata["tracedata"] += "start of main page.|"; } this works fine simple situations, have enough repeated code using pagedata want refactor c# classes. in none of examples or documentation have been able find, there "using" statements, or other context indicate object pagedata (or property of). in cshtml file it's "just there" magic have not yet been able determine. how can access pagedata in c# class? example, able this... public static class mytrace { public static void add(string amessage) { pagedata["tracedata"] += amessage + "|"; } public static string read() { return pagedata["tracedata&quo