2008

2007

Cleaning up pydoc (work in progress), take two

▁ dec 30 2007

Old version, and after a bit of hacking, here’s the latest version.

Patch is available, apply to latest Python svn trunk.

. o .

Common Lisp Newbie Tip: with-ouput-to-string

▁ dec 20 2007

Common Lisp newbie tip of the day: I found this one while trying to find out how to make a function redirect output from a stream to a string that I could put in a variable. Sending nil to format will make it return a string, but any function using format will have to collect the results from the calls to format.

The solution is quite simple. The macro with-output-to-string will create a character output stream quite easily:

CL-USER> (with-output-to-string (stream)
(print stream)
(difflib:unified-diff stream "foobar" "foozot"))

#<SB-IMPL::STRING-OUTPUT-STREAM {1538C419}> 
"---
+++
@@ -1,6 +1,6 @@
f
o
o
-b
-a
-r
+z
+o
+t" 

Difflib here is from CL-DIFFLIB. Quite handy!

. o .

Is Ruby the new Perl?

▁ dec 20 2007

I don’t know Ruby very well, and I have only looked at Ruby briefly a couple of times, and this of course is not sufficient to make an objective and qualified judgment of Ruby. However, what would the Internet be without unqualified ramblings?

Read more »

. o .

6400^6400

▁ dec 17 2007
(03:42:11 PM) Jesper: 6400**6400
(03:42:33 PM) Jesper: my calculator won't even tell me what that is
(03:42:39 PM) V: try lisp!
(03:42:46 PM) Jesper: you try lisp
(03:55:53 PM) V: ok
(03:55:55 PM) V: * (expt 6400 6400)

356314500672551408766633567391665093936335856125680234458088702429516341776283729744348241687874694722931247480928100739096208969838346680204246850173550018452092782770620447614551606091258187011395160057468834711837581319082865614047219310048005018717863467914309069133861437823346506060859364149718559813232576039533329942411008463463265841416649642698429449519480577195857198618903662911827567549571931268951054425094346741945464327608346634842300384832995149899293907195113040903970090109443577565285186726153201619449611349104121733867354209549432886897523542068190119338835580110837373856592495431390374190960617107373878892675671284106412466022662303604702182526327215824537505860480936937340825630966118623328357933895695151582703318682090939066844093115102780603234333442770184613021532866595617258713635705352067070519314118829264651739377429366832764385312190891099337248267125642759080036930293774866869431622529230614743154310505366805301752041900778291507008820155918205130703509102896299530415462760099701666489748046396235060137637189914260371238287204692458001793069434793457074146117815441472683140221687402790259415939534257294342420995597596939966686516436789584136033054611918838990686599687424491629766462781551381595867746396575515514455091723991555541862383159411127601669194500725867341620834808348541543447201485873881185098702072234791613298114486294827566642250171887024327567158910495505337836755070543371441488959919454046505179325527780060822531563475289475139526448021969101694499912729356077280046924210964683297110620346643750148245078102496673149516686711210593730917057440194555477386214403822513603290060039529307845010799889300305423084158230552306572667673853161066678790753023614807747584442614156339019762929255186948374706229454758658314318265297016129546889560741778044815430153394085755522076930260588464201774117710270380982383612687818283043167226452868764288188127232912925723882826332130500465387239566007422398239221039609935231156622232049328791691539995726707899834900102913023740867766674548272463334059246731241614743028276555073416456017197878565905286294253767901511324718615053888387274846163588974966269019985097075209435797751383524486284658930980609697836054193307904678669908698995050754257003766561678064347713522201316316107310064081763444944343033447499013810739946458331240372417343809506310008065613854542075939065893464059670498464502085940787602502458829575617245386724561951468901308749289836902685283730398492015082894895441145758615365485436281321941001890914248845986935160355627321690960780166857625266711143959872598508531491044768114928607260626644157680588611816507484082809199581719093885710376869792049889897957699006090962946837528215176074159386796199467940650737200234574218259563422488360145080320605352725345504703742321845217098126138173431182319572301547964232272426724228240842648261796634931254709060283633989689197271273951570651428028961777245168311630232058913953444709107677675605586432165216720150791138307631905553476765663623266935017200795396679234685374584340459641241424132167494539380924270559293753842422363733028507316359120965098971778465888614533488782893878220350545755891094348650170713059709177094925060938229826556623259965860088223683212400458700615536354490504550355949150717835466778124232074967124197409340356994250003189173941409535280652838165684554182528108097672339755249547972074365479426123026411349783437657533295765501627939029394243676367955223520294104514096428844406314643218982295937596176125863121003760696386228986934782798339227292663300335129499173015197849324683550384357295642417431788387737265980016827011615066583775141065856972455672292603758522015236450639012697656618484409419828255380259035253418012817272233224897793697058778402048428062702458030084238681933312230885908577170558613337511007337851991316699170000897052364289534478120423394212446093188793836235298178831819566327031218876390231189248548900280913061434567698879357165178859518561881277914070682124495075255109372650893286136902832184238465309109535799411684028076870629858559863064410247288117389220479745928085745138110206086360793562484740815343865731644267065399720610368337524051600462178395415798002071244654820254163725936522056655143508256940379297025116383052017845051616965897621701151563017033449788092786324964546141333865866846539095120228950055595414830307043133332752132837635016626142388639207796893798996639344546691842291296487580048955870447146714311832152774225622139980469387596505993351771394736507949778350276594979099792617447118378307963650927928880495389106377156219409130898673350641828619413648007316269868465449606668030861726007254168593467976389972417804619031822977519845945517079122196991927405420809210646616737720282123564862175848378898613089120489454081119533371462089896012059192068538593597642987369628275775558321745142767832211918287627378006821327123448286731689657858392763506270014089278641563424824971879099221220831486932425310856186641434202085345994818182956157072693897185324305152326745677014864826874151326371521654651418905056561564983035274097985496697433908765358149797004357634978662642306032345111382859174054934805081906547285006293374518301800867629506117785266390062697074865227970656930521490276245457447414200330788471390868739473601501630713396542010420945762222172062265219180088199695697684304142379875545208351237036645870650221336972160194180219988846953734679536166279668969112550639827313983200804262999253671043068872107743847557101101001463740120392198021547784973941965208794071006844522386807835140318616242126169104789601483173968434003502802028550229085805589931029784926460624579986778647636375669606865060386654650413790520493939149204610410232472536980768731005630528523232488241853523992904131058689770296649723141659705678277482029932519386258875483264236700984045568718731288828460378267087968505704613274999998959415857431608977920599882751938536600324382142522850184720531571310320702347075287083142941489951987314046549360064059688295194981053606328478998852896719385309315074153147014320133151698012890733357288195865783328341905136523411459882016344688410932973023396088601792446089775478537810317928239051229445192634617948067251081336035666522684617529634140134618323639155499965636145619388925559574128499294081015090761574552303991086372972427211532837378471864491352906685481151141499610929525662645537589191631992187971158746465295437295335063336520857241566201871747061809903378160273414449321395636844470460100520919446000001650000287881980539517629353336541561957467014824006040709701279634088165281255455778315111155830412357971868946588235973116056611888446077567492553984973071643902945040937056973376799215168462791655364062126105563480074969667507399612896540171470911588418001590159855818134034740624486347513415784945592456232924258383513578783837132035596275018662882502236762559882146226691072982963099525571123169477356164955690346864694852199068610039301334796433126517360531434811487733007711536781157040991727964225381881171276816541267940333453720751597985232982798191540547665500361353105682645427832695145369405755560442402207047604016520076083767988236795386591581980221327751144742105957863419255584826558921125036707957139389945771047961700123953717513522078531082972319064746300829814833886635219689379113981268873644190410988647978994878816385431728065263666688566832255236181168584631126743717539530853542701212666072155759100652823602731768497687603725078733266313041230701109882762264807614826045958023494703651599856517035134814583364277704532806110609613636711032435344143052540274860326236176577419734264989382337206559603844765522792799180409620088100974130553527615986879277912905484078967091551695662807459058126404790891487080447779103103953320734476065574477508801808072133370144443288335004019217941509590240840059954852804107454530124889660744051621275536999110758568498974023507492918607464392444620663488099536883729722449755573961129657262911372503718727574093303748623305153718717920181223388379161849164994529977185062329415361548318539654287703443521684000747115000062610286784462238643632985820876042328067403167389487817593478943969220909966630934300209193680387021107269477673491557957971593515768242773410560939624658840129555954950155930578903832400568379835469256979464201417205989818916279807187559419484904120136058818753069007254931754066710369624359105672996629735981360290496259079525685095050717963336115051462433954713764187422052206416488016426817673568392704594867648638412920930091146783977819676093953998213150261931095911935940177514763807574981460092081904894050196703386073746050746469941429299690502878307730636764217592980492287314378099444012666335841838209200583547962664234630334747519649822741092404029252600285707396328665581846875451148295963866403053001715316396570553668954210007441121011980702859568662759645206318576905253538571085744769136775372336463012310553860857209398902083603650710302166477166805958873021728156767152029365273137825426457752584168388575323496373567121213431392341649449077483006866267751725287409507291113483797402498674694799651370481740415252802318361872678413097934337184069282156407990894409776102599305299922882485687035531369805402557438310536663397893205279252051261866080190864680258440983533505070973207208650096851519509957025851595642305461471577433051433251447972535307020515301563739235187664235807385029834755947771021833515122062944592800548436215540221793137450080062239519907859699447909619637100817712741374815825922973455152836684330134339698535629165243437537278966245562008171897012284747827933981047557343392499694706315214299965394085384730252834897817073343312914292056214499794366205587880131674184438683311034796026339466387390360631511031844347270512901031335666689223865039822026498849027009156447642753837835223158342552494158939253117799967392798381302818915173741363209421341700295315798049398971983910374147170101328639860985171685807888526037858586077685746534522892400295113051176190868914517018313799038036188204841132119898995516395550220625009379229560931795672907996148566696689373181219186438123452944546250252699919045980965223227880100358219359009094458950659909786239889677501788434865607783041798178799046603476823562111578846536561461215123314813341676889451419656155606974514168531778010678207210508934732046149919578893738590799547463878560156614229595054613233036427350213208810192764181846470636346700226999691884616539197547242666415488041181699756947154896428057668308897390774722851310077251126626771345922618433233514372082564913067282249622920474424024674197442101837858239586050981198982963080436530001110663534921244552135891112324527682126977286771436640023525783266931227278745003745502327135809508064136219717552258158569537352842330307583514304045411361748988754379246524451572286869809806571086553838311589253955630827879487378488279573533270290693533650316533443385228646018070345242800256268067006639285539901727423110271595100701232177423990260673435548905122204064537810891829608877484478203277358914442434812111661473892885995296999973903042410468048958229970758087998547939824628024034952992078013672977285600168259674624653645178020553295359931751678299021583353207545768065385001938875790608282954745840495031139069405982460952760086970064906922801900902030313382320574178508054203898664848684568371553491152474457333204757006395443823161112871759826317660211782404008723413286699731649812182964515110406211469878584932877614611404610020293819564323812035905117885283476677953735966952564513033334397337600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

(03:56:17 PM) Jesper: cool
(03:56:27 PM) V: yes
. o .

Cleaning up pydoc (work in progress)

▁ dec 15 2007

For Java there is Javadoc, for Perl there is perldoc, and for Python there is pydoc.

I haven’t played around with pydoc too much, I usually use online documentation or read documentation in source code files. Last week I wrote some code that used PyCha to plot a few datasets, and not only did that experience make me realize that PyCha has a severe lack of documentation, but also that pydoc generates HTML that looks like something from the last century.

Read more »

. o .

Pointless Fibonacci Benchmark #4253: Python vs. Simula

▁ dec 08 2007

Pointless benchmarks of code generating Fibonacci numbers is a recurring theme on PRC, and in addition it’s also a place with frequent posts about esoteric programming languages.

Read more »

. o .

Ruby: Pipes and strange variables? Why, oh why?!

▁ nov 29 2007

I briefly looked at Ruby a while ago, when it started getting attention because of Rails and all that. This week I decided to take a closer look at it, and skimmed through some tutorials. Ruby seems nice, but there are some things that make me wonder wtf is going on…

Read more »

. o .

Web Application Gotchas: Modifying data with links (GET requests)

▁ nov 27 2007

So, you’ve built your nice little web application, and all is well. Users are using it and filling your nice little database with data. Then suddenly, things start disappearing. Everything that the users have spent hours creating is deleted, one row at a time. What’s happening? You start debugging… Someone is actually clicking the links to delete content. Sabotage, perhaps?  You search through the logs and find the IP address of the offending user. After tracing the activity of that user, you track it down to Bob, one of the web developers.

Read more »

. o .

Web Application Gotchas: SQL Injection

▁ nov 19 2007

(Here’s a re-post from my other blog.)No, I’m not going to say the obvious: use placeholders or positional arguments to avoid SQL injection. All developers should know that. Except that it’s not entirely true. Yes, you read it right. Let me explain…Placeholders are most commonly used in conjunction with prepared SQL statements, and the primary purpose of this is not to avoid SQL injection, but to make applications more efficient.

Read more »

. o .

Web Application Gotchas: Never trust input

▁ nov 19 2007

Repeat after me: never trust input in web applications. Never ever. Don’t trust input in GET requests. Don’t trust input in POST requests. Just don’t do it.

“Oh, but that’s ok,” you think, “I always check data that the user inputs.” But no, that’s not enough! Any data that is recieved by the web application has to be checked before you use it…

That, or … Kill everyone that attempts XSS attacks. Why can’t people just use the #@!±?% web applications as they were intended to be used?!

sigh

Update: this goes for HTTP headers as well, btw. Don’t trust them!  It’s not difficult to forge them.

. o .

Multi-hop remote editing with Emacs and Tramp

▁ nov 18 2007

There’s an amazing Emacs module called Tramp. It enables you to do remote editing… For instance, you can simply do Ctrl-x Ctrl-f //ftp:user:password@ftp.example.com:/foo/bar to edit files on an ftp server. Tramp handles moving the files it as transparently as possible.

What’s even more ingenious, is that you can do this “multi-hop”, i.e. you can edit files on a remote server by going via another server. For instance, I have an account with an ssh key that is authorized to log into other servers, but I don’t want to have that key on my own computer. To edit files on one of the other servers, I can do Ctrl-x Ctr-f //multi:ssh:vetler@server1:ssh:vetler@server2:/path/to/file to edit files by going through server1.

Amazingly clever, and I couldn’t live without it.

Jesper posted something about remote editing in OS X today, which inspired this post.

. o .

IDE-driven development

▁ nov 18 2007

I’ve been playing around with Android lately, and since it comes with a very nice Eclipse plugin, I’ve been using Eclipse again. For the last 4 years, Emacs has been my only IDE, but before that I used Eclipse quite a lot. I was doing J2EE development back then, and Eclipse was a life saver.

Using the Android plug-in (ADT) got me thinking about a problem with these plug-ins … They can make things too easy. To build Android apps, you need some kind of logic. If you create a project with the Android SDK command line tool, activityCreator.py, then you get an Ant build file. With the ADT, you get no such thing because it does  it automatically.

“Great!” you might think. But no… The problem with this is that you make Eclipse a dependency. If you want to share your code with others, you’ll have to commit the Eclipse-specific files to make sure it’s recognized as an Android project in other Eclipse installations and everything is generated properly. The problem with this, of course, is that everyone has to use Eclipse… That might make it a little hard to do automated building, testing and such things.

The solution might be to  generate  an Ant build file, and add it to the project. That will work, except you’ll have problems running the Ant file in Eclipse, since there’s an auto-generated file that is set to be read only by the ADT. In this case the ADT is really just trying to be helpful, but the road to hell is paved with good intentions. sigh

Nothing wrong with IDE plug-ins that help out, but any plug-in that has magic such as this, is flawed. There are many things IDE plug-ins can do to help, but making projects IDE and IDE plug-in dependent is not something they should do.

. o .

Using the Eclipse Android plugin

▁ nov 17 2007

Android LogoSo, you’ve installed the Eclipse Android plugin, and are hacking happily away on the next revolutionary app that will  make you win the contest and  more… But for some reason all you get when running your Android app is the home screen. Your application won’t run anymore!

Unless you have errors in your code, you might want to try killing the  Android Debug Bridge, it seems that it has problems from time to time. Do this from the command line:

$ adb kill-server

This will stop the Android Debug Bridge, and when you start an Android app the next time, it will restart.

Another tip: there’s no need to restart the Android Emulator every time you want to test changes in your app, just run it and it’ll be pushed out to the emulator. If you run the command above, though, you will have to quit the emulator to get everything to run smoothly…

Happy hacking!

powered by