Lively Kernel canvas
* MIT license
*
* Includes enhancements by Scott Trenda
* and Kris Kowal
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.]]> 99 ? Math.round(L / 10) : L),
t: H < 12 ? "a" : "p",
tt: H < 12 ? "am" : "pm",
T: H < 12 ? "A" : "P",
TT: H < 12 ? "AM" : "PM",
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
};
return mask.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
});
};
}();
// Some common format strings
dateFormat.masks = {
"default": "ddd mmm dd yyyy HH:MM:ss",
shortDate: "m/d/yy",
mediumDate: "mmm d, yyyy",
longDate: "mmmm d, yyyy",
fullDate: "dddd, mmmm d, yyyy",
shortTime: "h:MM TT",
mediumTime: "h:MM:ss TT",
longTime: "h:MM:ss TT Z",
isoDate: "yyyy-mm-dd",
isoTime: "HH:MM:ss",
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};
// Internationalization strings
dateFormat.i18n = {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
]
};
// For convenience...
Date.prototype.format = function (mask, utc) {
return dateFormat(this, mask, utc);
};]]>
Entwicklertagebuch40true
savefalsenulltruenull
sortfalsenullfalsenull
reversefalsenullfalsenull
newentryfalsenullfalsenull
2010-04-28,WedSomeothergreatprojects;-):-http://www.kobrix.com/seco.jspinteractivedevelopmentenvironmentthatcanbesoftwareinitself(likelively);exchangeof"notebooks"isdonethroughIM(XMPP)-http://www.amyeditor.com/onlinetexteditorinTextMate-style,collaborationpossible(editingatthesametime)187
2010-04-28,WedAusgabevon"alternativen"FormatenausCouchDB,z.B.eineMöglichkeitJS-DateienperMapReduce/Viewauszugeben:http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Specifying_Content-Type_Response_Header186
Motivation:-currentversioninggranularityisaJavaScriptfile-historyofsmallerobjects(likeclasses,methods,visualobjects)notavailableIdea:-replacecurrentSVNpersistencyforJSfileswithaCouchDBforcodeobjects-JSfilerepresentationisaviewontopoftheCouchDBrepositoryKeyIssues:-Whatistherightlevelofgranularity?classes,methods-Whataboutcodeoutsideofmethods?-WhatisthemetamodelofallJScodeobjects?Versioninginformation:-perobjectchangehistory-changesetstocapturechangesonmultipleobjectsatthesametime-methodorclassversioningbasedontheinterface(optional,butnicetohave)Questions:-Whatabouttransactions?(Isthisaconcernatall?HowmuchdoesCouchDBalreadyprovide?)-Whataboutauthentication/authorization?20truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
Requirementsfalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
2010-05-08,Sat--TerminologyCodeObject:AcodeobjectisasourcecodeartifactwithintheLivelyKernelenvironmentthathasasemanticalnotionofitsown.Asinglecodeobjectcanbecomposedofothersmallercodeobjects.Examplesofsuchcodeobjectsaremethods,classes,andmodules.CodeobjectsarerepresentedbyCouchDBdocuments.CodeObjectRevision:Aparticularpersistentrepresentationofacodeobjectataspecificpointintimeiscalledacodeobjectrevision.EachcodeobjectrevisioncorrespondstoaparticularCouchDBdocumentrevision.Acodeobjectrevisionisidentifiedbyacodeobjectrevisionnumberthatissequentiallyincrementedforeachnewrevisionstartingwith1forthefirstrevision.CodeObjectVersion:Acodeobjectversionisacontractbetweentheproviderofthecodeobjectandanyconsumerstotoupholdacertainsetoffeatures.Theprecisenotionofacodeobjectversiondependsonthetypeofcodeobjectbutwillusuallyincludeexternallyvisibleinterfacesofthecodeobjectaswellassomeadditionalpropertiesdescribingtheactualbehaviorofthecodeobject.Acodeobjectversionwillrefertoaspecificcodeobjectrevisionthatrepresentsthelatestcodeobjectrepresentationtoupholdtheversioncontract.Acodeobjectmayhaveanarbitrarynumberofversions.Therevisionassociatedwithacodeobjectversionmightchangeinthecourseoftimeasbugsmaybefixed.ChangeSet:Asetoftransientchangestoasetofcodeobjectsiscalledachangeset.Thechangesusuallybelongsemanticallytogether.Achangesetisbasedonaparticularchangesetrevisiontowhichthechangeswillbeapplied.ChangeSetRevision:Persistingachangesetinthedatabasewillcreateachangesetrevision.Foreachcodeobjectthatispartofthechangesetanewcodeobjectrevisionwillbecreated.Achangesetrevisionisidentifiedbyachangesetrevisionnumberthatissequentiallyincrementedforeachpersistedchangesetstartingwith1forthefirstrevision.1828
2010-05-08,SatFirstcutataclassmodel(AdobeReaderrecommended)URLschemeproposal:MetaInformationforthelatestRevisionofclass"MyClass"ofmodule"MyModule"http://couchdb.lively-kernel.org/code_db/Structure::MyModule[::MyClass[::MyFunction]]LatestRevisionofclass"MyClass"ofmodule"MyModule"(asJS)http://couchdb.lively-kernel.org/code_db/Data::MyModule[::MyClass[::MyFunction]]RevisionHistoryofclass"MyClass"ofmodule"MyModule"http://couchdb.lively-kernel.org/code_db/RevisionHistory::MyModule::MyClassMetaInformationforRevision2ofclass"MyClass"ofmodule"MyModule"http://couchdb.lively-kernel.org/code_db/Revision::2::Structure::MyModule::MyClass(rewritestohttp://couchdb.lively-kernel.org/code_db/Structure::MyModule::MyClass?rev=2-967a00dff5e02add41819138abb3284d)Revision2ofclass"MyClass"ofmodule"MyModule"http://couchdb.lively-kernel.org/code_db/Revision::2::Data::MyModule::MyClass(rewritestohttp://couchdb.lively-kernel.org/code_db/Data::MyModule::MyClass?rev=2-967a00dff5e02add41819138abb3284d)ChangeSetRevisionHistoryhttp://couchdb.lively-kernel.org/code_db/ChangeSetHistoryClass"MyClass"ofmodule"MyModule"afterchangeset34wasappliedhttp://couchdb.lively-kernel.org/code_db/ChangeSet::34::Structure::MyModule::MyClass(rewritestohttp://couchdb.lively-kernel.org/code_db/Revision::15::Structure::MyModule::MyClass)1832
2010-05-17,MonSomeJSONexamplesforCouchDBdocuments:-ChangeSetRevisionHistory-CodeObjectStructureforamodule,foraclass-CodeObjectRevisionHistory185
2010-06-02,WedFirstversionoftheCodeDBBrowserisfinished-yes!!(readingmodules,classes,methodsandmethodsourcesfromtheCouchDB)Openthisandjustevaluatethe"CodeRepositoryBrowser"workspace.185
2010-06-07,MonVisitingthe"BerlinBuzzwords"conferencetodayandtomorrowIdidlistentoatalkofJanLehnardt(oneofthecorecommittersofCouchDB)aboutCouchDBanditsfeatures.Histalkwasespeciallyaboutbringingwebapplicationdefaultandthereforethewebservertotheend-user.Icalledthatgivingthe"Powertothepeople";-).Somecoolstuffhementioned:-anHTTPchannelwhereyoucangetupdatesaboutchangesonthedatabase-thefeatureof"auto-conflictdetection"wheretwoormorerevisionsaremarkedasconflicted(butallarekept)-replicationofanyCouchDBinstancewitheachotherHavingalittlechatwithhimafterwardsaboutthelivelykernel(hedidknowaboutlivelybutnotabouttheHPIdevelopingonit)andtheupcommingmigrationfromSVNtoCouchDB(andsothisproject),hewasreallyexcitedaboutthatandhopestohearaboutthatafterfinishingthisproject.WhatIwaswonderingaboutwhenIheardhistalkis,whetherourcurrentideaofcreatingdocumentsforeachmethod,classandmoduleistherightwaytodothat.Shouldn'tweratherstoreonlymodules(andclasses)andhaveanarraywith(classesand)methodsinsidethisdocument?!Btw.healsoisafanofHyperCard:-).1822
2010-06-14,MonAddedsupportfor-readingcodeobjectsfromthedatabase-updatinganddeletingexistingobjects-accessingtheentirerevisionhistoryQuestions:-Whatisagoodwayfortesting?UnitTest?(Wouldhavetobeonaseparatedatabase)Nextitems:-retrievingaparticularcodeobjectrevision1811
2010-06-15,TueBIGPROBLEMS?!LookingforwaystoworkwitholdrevisionsIcameaccrossthisdocument:http://wiki.apache.org/couchdb/Document_revisionsThemostinterestingbutalsodisencouragingare:-"[...]NotethattheolderrevisionsarenotavailabletoViews.":-(-"[...]conflictsshouldberesolvedbyyourclient,usuallybyrequestingthenewestversionofthedocument,modifyingandtryingtheupdateagain.[...]"-"[...]Youcannotrelyondocumentrevisionsforanyotherpurposethanconcurrencycontrol."-"Duetocompaction,revisionsmaydisappearatanytime.Youcannotusethemforaclientrevisionsystem."-"[...]Replicationonlyreplicatesthelastversionofadocument,soitwillbeimpossibletoaccess,onthedestinationdatabase,previousversionsofadocumentthatwasstoredonthesourcedatabase.[...]"Suggestedsolutions:-usingattachmentstostoreoldrevisions.(+1fromMarko)-usingmultipledocumentstostoreoldrevisions.EDIT:Whileatfirstsightthesecondsolutionseemedtobethebestforme,Ilaterondiscoveredhttp://blog.couch.io/post/632718824/simple-document-versioning-with-couchdb.Canweimplementthatinsideourcouchdb-transaction-layer?1824
2010-06-27,SunCodeObjectrevisionsarenowstoredasattachmentsoftheCodeObjectRevisionHistory.ThereisnoseparateStructure::documentanymore.IlefttheRevisionHistory::prefixtoavoidnameclasheswithChangeSetHistoryoranyotherthingswemightstoreinthesamedatabase.NewModificationParadigm:Changestoasinglecodeobjectarenowsavedimmediatelytothedatabaseasdraftrevisions.Otherusersdonotseethedraftrevisionsunlesstheyreallywantto.Duringcommit,thelastdraftrevisionisturnedintoanactiverevision.Readingacodeobjectfromthedatabasewillalwaysreturn(unlessotherwisespecified)thelastactiverevision.Tests:Thereareacoupleoftestsinprojects/CodeDB/CDBTest.jsthatworkonaseparatedatabase.Remainingitems:-moresophisticatedcaching?(revisioncaching,revisionhistorycaching)-moretests(issue:howtoenableviews/lists/showsinthetestdatabase)1815
-ShortCuts:-Cmd+B/Cmd+IdonotworkwithoutShiftkeypressedaswell-Ctrl+Clickisnotarightclick-Cmd+ClickonaLinkdoesnotopenthelinkinanewtabSystemCodeBrowser-"AddClass"wouldbenicewithapopuptoenteronlytheclassname-ListofclassesandmethodsinSystemCodeBrowserisnotalphabeticallysortedbydefault-contextmenu(whichiscurrentlyabovethescrollbar)shouldopenwhenyouclickonwhitespace-Ifyouclickintothesourcecodeofthesystembrowserwindowafterafreshrestart,theentirewindowandnotjustthesourcecodemorphisselected.Asaresult,youcan'tuseCmd+SbecausethewindowitselfdoesnothandleCmd+STextWindow-Cmd+CursorRightmovesthecursoronewordahead,expectedbehaviorshouldbetomovethecursortotheendoftheline.Alt+CursorRightshouldmovethecursoronewordahead.-Shift+Cmd+CursorLeftdoesnotmovetothepreviouslineoncethelinebeginningwasreached,howeverShift+Cmd+CursorRightmovestothenextlineoncethelineendwasreached-Winowsdoesnotscrollwhenyoutypeandreachtheendofthelineandyouwouldhavetoscrolltoseethenextone.-Thereisoftennocursorinpopupinputfield,e.g.makelink.truetruefalse21truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
Issuesfalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
2010-07-05,MonHavingstartedwithaTeXbeamerpresentationItookthetimetolivelyup(livelify?lively...?)ourpresentationandthereitis:presentation.IthinkdoingthepresentationinsideLivelyhastheadvantageofdoingdemonstrationsrightinsidethepresentationpage.@Robert/Jens:HowcanIscaletheHPIlogostotheoriginallyusedsizeinsideyourpresentation(100x100px,60x60px)?Neededtochangetheimagesourcewhichledtoaresetonscaling:-(.Solved:(inspect)->this.setExtent(pt(100,100))18 this.setExtent(pt(100,100))"]]>11
2010-07-14,WedDearreader*;-),havingcompletedtheJavaScriptlist-view-constructtoloadcodefromtheCouchDBtoLivelyrecently,Iamnowconcernedaboutthecodethatmightbe"generated".185
module('$code_db.MyModule').requires('').toRun(function(){});module('$code_db.TestModule').requires('MyModule').toRun(function(){MySuperClass.subclass('TestClass',{testMethod:function(arg){alert(arg);},});});149
module('$code_db.TestModule').requires('MyModule').toRun(function(){$code_db.MySuperClass.subclass('TestClass',{testMethod:function(arg){alert(arg);},});});146
HereistheplaceforYOURcomments:Object.subclass('$FooBar',{})//->Error:notaname...Object.subclass('FooBar',{})$foo={}$foo.FooBar=FooBar$foo.FooBar.subclass('Foo',{})//->nowedon'tgetintotrouble:-)(Jens)*possiblereadersinclude:Tilman,Jens,Robert,Dan:-)189 Error: not a name ...\nObject.subclass('FooBar',{}) \n$foo = {}\n$foo.FooBar = FooBar\n$foo.FooBar.subclass('Foo',{}) // -> no we don't get into trouble :-) (Jens)\n\n\n* possible readers include: Tilman, Jens, Robert, Dan :-)\n"]]>
DearwriterCoolthatview-code-generationnowworks,yeeepeeeee:-)Theissuewith"Object.subclass('$FooBar',{})"couldbesolvedifreallyneeded(seeClass>>isValidIdentifier).Otherwisethereshouldn'tbeanyissueswith$innames.Theexampleisabitconfusingsince$code_dbisdirectlyusedasamodule.P.S.LieberWriter,kommmalwiederinsHPI,ichbinerstmalnurnochbiszum11.daundhabegehoert,dassDuunsbaldverlaesst...147>isValidIdentifier). Otherwise there shouldn't be any issues with $ in names. The example is a bit confusing since $code_db is directly used as a module.\n\nP.S. Lieber Writer, komm mal wieder ins HPI, ich bin erstmal nur noch bis zum 11. da und habe gehoert, dass Du uns bald verlaesst..."]]>
SelectingintheLivelyeditorissimilartomostothersystems,exceptfordouble-clicking...*Double-clickingisindependentoftiming.Youjustclicktwiceinthesamespot.*Double-clickinginsideawordwillselectaword*adddetailhereaboutwhichcharactersareincludedandhow*coulddobetterwithperiod*Double-clickingnexttoabracketcharacterwillselectuptothematchingbracket*thisincludes![..],{..},(..),<..>,andeven/*..*/*Doubleclickingatthebeginningortheendofthetextselectstheentiretext*DoubleclickingatthebeginningortheendofalineselectstheentirelineTheeditingcommandsalluseacommand-keymodifiersuchastheApplekeyorthealtkey.*a--selectAll.Firstuseselectswhatyoumayhavejusttyped.Seconduseselectsentiretext.*x--Cut.Cuttheselectedtextandcopyittotheclipboard.*c--Copy.Copytheselectedtexttotheclipboard*v--Paste.Pastetheclipboardcontentstothecurrentselection*m--More.Repeatthelastreplacement.Inotherwordssearchforwardforthenextpossiblesimilarreplacementandperformit.Thisisagreattime-saverbecauseyoudon'thavetoplanaheadformultiplereplacements.*e--Exchange.Exchangethecurrentselectionwiththepreviousselection.Anothergreattime-saver,especiallyinconjunctionwithdouble-clickselection.*f--Find.Promptsforsometextandthensearchesforthefirstoccurrenceinthetextfollowingthecurrentselection.*g--aGain.Searchforwardforthenextoccurrenceoftheprevioussearchstring*w--Where.Whensourcecodeisonline,thiswillsearchtheentirecodebaseforstringsmatchingthecurrentselection,andopenachangeListbrowseronallpatchescontainingthatstring.*d--Doit.EvaluatethecurrentselectionasJavaScript.*p--Printit.EvaluatethecurrentselectionasJavaScriptandprinttheresultfollowingtheselection.*s--Save.Savethecontentsofthistextpane.Thismaymeandifferentthingsindifferentplaces.Theseemphasiscommandsturntheirattributeonoroffdependingonthefirstcharacteroftheselection*b--Bold.Maketheentireselectionboldornotbold*i--Italic.MaketheentireselectionitalicornotitalicThefontsizecommandsarerelativetothefontSizesetforthetextMorphasawhole.[rknotes:thesepreventcurly/squarebracketsongermankeyboards]*4--fontSize*0.8*5--fontSize*1.0*6--fontSize*1.2*7--fontSize*1.5*8--fontSize*2.0Textalignmentcommands*l--Leftflush*r--Rightflush*j--Justify,ie,alignflushwithleftandrightmargins*h--Halfway,ie,centerthistextOthercommands*u--URL.Associatealinkwiththistext(andcoloritblue)*o--Givetheselectionsomelocalcolor*z--UndothepreviouschangetothebestofourabilityNotethattheStylePanelcanbeusedtocontrolglobalsettingsof,eg,textfont,size,colorandbackground.---------, and even /*..*/\n * Double clicking at the beginning or the end of the text selects the entire text\n * Double clicking at the beginning or the end of a line selects the entire line\n\nThe editing commands all use a command-key modifier such as the Apple key or the alt key.\n * a -- select All. First use selects what you may have just typed. Second use selects entire text.\n * x -- Cut. Cut the selected text and copy it to the clipboard.\n * c -- Copy. Copy the selected text to the clipboard\n * v -- Paste. Paste the clipboard contents to the current selection\n * m -- More. Repeat the last replacement. In other words search forward for the next possible similar replacement and perform it. This is a great time-saver because you don't have to plan ahead for multiple replacements.\n * e -- Exchange. Exchange the current selection with the previous selection. Another great time-saver, especially in conjunction with double-click selection.\n * f -- Find. Prompts for some text and then searches for the first occurrence in the text following the current selection.\n * g -- aGain. Search forward for the next occurrence of the previous search string\n * w -- Where. When source code is online, this will search the entire code base for strings matching the current selection, and open a changeList browser on all patches containing that string.\n * d -- Do it. Evaluate the current selection as JavaScript.\n * p -- Print it. Evaluate the current selection as JavaScript and print the result following the selection.\n * s -- Save. Save the contents of this text pane. This may mean different things in different places.\n \nThese emphasis commands turn their attribute on or off depending on the first character of the selection\n * b -- Bold. Make the entire selection bold or not bold\n * i -- Italic. Make the entire selection italic or not italic\n\t \nThe font size commands are relative to the fontSize set for the textMorph as a whole.\n[rk notes: these prevent curly/square brackets on german keyboards]\n * 4 -- fontSize * 0.8\n * 5-- fontSize * 1.0\n * 6 -- fontSize * 1.2\n * 7 -- fontSize * 1.5\n * 8 -- fontSize * 2.0\n\t \nText alignment commands\n * l -- Left flush\n * r -- Right flush\n * j -- Justify, ie, align flush with left and right margins\n * h -- Halfway, ie, center this text\n\nOther commands\n * u -- URL. Associate a link with this text (and color it blue)\n * o -- Give the selection some local color\n * z -- Undo the previous change to the best of our ability\n\nNote that the Style Panel can be used to control global settings of, eg, text font, size, color and background.\n---------\n"]]>61truetruefalse, and even /*..*/\n * Double clicking at the beginning or the end of the text selects the entire text\n * Double clicking at the beginning or the end of a line selects the entire line\n\nThe editing commands all use a command-key modifier such as the Apple key or the alt key.\n * a -- select All. First use selects what you may have just typed. Second use selects entire text.\n * x -- Cut. Cut the selected text and copy it to the clipboard.\n * c -- Copy. Copy the selected text to the clipboard\n * v -- Paste. Paste the clipboard contents to the current selection\n * m -- More. Repeat the last replacement. In other words search forward for the next possible similar replacement and perform it. This is a great time-saver because you don't have to plan ahead for multiple replacements.\n * e -- Exchange. Exchange the current selection with the previous selection. Another great time-saver, especially in conjunction with double-click selection.\n * f -- Find. Prompts for some text and then searches for the first occurrence in the text following the current selection.\n * g -- aGain. Search forward for the next occurrence of the previous search string\n * w -- Where. When source code is online, this will search the entire code base for strings matching the current selection, and open a changeList browser on all patches containing that string.\n * d -- Do it. Evaluate the current selection as JavaScript.\n * p -- Print it. Evaluate the current selection as JavaScript and print the result following the selection.\n * s -- Save. Save the contents of this text pane. This may mean different things in different places.\n \nThese emphasis commands turn their attribute on or off depending on the first character of the selection\n * b -- Bold. Make the entire selection bold or not bold\n * i -- Italic. Make the entire selection italic or not italic\n\t \nThe font size commands are relative to the fontSize set for the textMorph as a whole.\n[rk notes: these prevent curly/square brackets on german keyboards]\n * 4 -- fontSize * 0.8\n * 5-- fontSize * 1.0\n * 6 -- fontSize * 1.2\n * 7 -- fontSize * 1.5\n * 8 -- fontSize * 2.0\n\t \nText alignment commands\n * l -- Left flush\n * r -- Right flush\n * j -- Justify, ie, align flush with left and right margins\n * h -- Halfway, ie, center this text\n\nOther commands\n * u -- URL. Associate a link with this text (and color it blue)\n * o -- Give the selection some local color\n * z -- Undo the previous change to the best of our ability\n\nNote that the Style Panel can be used to control global settings of, eg, text font, size, color and background.\n---------\n"]]>truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
Commandkeyhelpfalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Thisisarealexampleofgeneratedsourcecodefromthisrequest.Myquestiontoyounow,dearreader*,willwesomehowgetintotroubleusingthe$-signwhendoingsubclassing?Imeanthatwouldlooksomethinglikethis:183
2010-08-09,Mon--TODO-lazilyloaddependentobjects(e.g.classesofamethod)(CHECK)-donotcommitemptychangesets(CHECK?)-evaluatesourcecodeaftersave(CHECK)-maintainselectionaftersave(CHECK)-testaddToChangeSet(CHECK)-commitmessages(CHECK)-testdelete(CHECK)186
Wikicontroltruetrue
null207