Notes on Java, Solaris, PHP, LDAP…

December 22, 2008

Darcs – source code management

Filed under: Uncategorized — negev @ 1:55 pm
Tags:

When talking to to DokuWiki community, I’ve noticed that they use Darcs – http://darcs.net

May 13, 2008

SmartSVN

Filed under: Java — negev @ 3:00 pm
Tags:

What a wonderful tool: SmartSVN. Its diff view is phantastic. It shows which lines got modified, nicely connects the pristine and working listing. It highlights the *parts of the lines* which were changed – that is really sweet.

November 27, 2007

Notes on Mercurial SCM, compared to Subversion and GIT

Filed under: Uncategorized — negev @ 5:55 pm
Tags:

Mercurial – Source Control

Mercurial (hg) is a distributed versioning system. I’ve installed it and tried just a little. Following are my notes based on http://hgbook.red-bean.com/hgbook.pdf and my experience.

Mercurial and GIT are both free distributed versioning systems. Main differences – GIT possibly a little faster, but it requires maintenance (repacking the repositories). There’s no user manual for GIT, only docs for the invdividual commands.

hg uses language very similar to Subversion, although some terms have different meaning. It introduces some more terminology specific to merging and branches, and it sounds confusing to me as a SVN user. Probably it clears out with practice.

In overall Mercurial looks more ‘human friendly’. It’s focused more on how we people think of history of documents and parallel changes (branches). It takes responsibility for book-keeping branches/merges, while in Subversion you need to keep track or identify start and end revisions in the branch you’re merging from. In SVN you need to find those start/end revisions by date, or by ‘svn log –stop-on-copy’ command. hg takes care of all that. Those were the ‘high level’ hg branches and merges. ‘Low level’ branches and merges occur all the time when pulling from other team members.

SVN has a URL for each subfolder/file in the repository – which covers all branches, tags, everything. hg has URLs but only for the main, public branch (tip or head?).

Niceties of Mercurial:

  • easy reverting of all subfolders and their files – ‘hg revert .’

  • easy pullback

  • little merges – everything you do is in your local repository. Then you merge it with changes of other people. Because merging is the daily bread, hg makes it as simple as possible

  • simple installation and administration. It only stores repository on file system, while SVN can use DB and FS.

  • history search by programmable filters via ‘hg bisect’ (logarithmic rather than sequential search)

The positives of being distributed

  • 0 day start

    • once you install locally, you can commit locally

    • works over SSH without setting any deamon/DB on the server, once you install hg on it

  • local searches over whole history – very quick

Drawbacks/complications:

  • update, merge are separate tasks. ‘hg update’ updates your local repository, but it doesn’t update your working directory – use ‘hg merge’ for that.

  • The simplest way to have ‘high-level’ branches is to have one repository for a branch. That’s OK locally, but if you want the branches to be stored on a server then developers need rights to create them and it gives extra work. hg supports several branches in same repository but it’s when the usage gets more advanced/complicated. But, it looks nicer/easier than keeping track of SVN branches (within same repository).

November 17, 2007

Various

Filed under: Uncategorized — negev @ 9:33 pm
Tags: , , ,

4 July 07

Unix/CRON output redirection
my-command >/my_log_dir/my_file 2>&1

LDAP search expressions
– need to have parenthesis both outside & inside operator-based expressions:
(&(myAttrib=value)(anotherAttrib=value)..)

Subversion on Novell SLES 10
– subversion.tigris.org
— don’t use David Summer’s summersoft.fay.ar.us – it complained about libraries even when they were up to date (for SVN 1.4.0)
– use CollabNet commandline client

Subversion on Mac OS X
– subversion.tigris.org
— use DMG from Metissian 1.3.1 or newer

Grep filtering of Java/C multi-line comments
pcregrep -r -M -f ~/comments.regex Hashtable.java
– comments.regex is:
\/\*\*([^*]|\*[^/])*\*\/
– don’t use \w – that doesn’t include new line in pcregrep
– \n doesn’t represent new line
options:
-l = Instead of printing lines from the files, just print the names of the files
-c = Do not print individual lines; instead just print a count of the number of lines
-n = Precede each line by its line number in the file

Backslash problems when connecting via rdesktop from a Linux box to Windows VM:
Set Windows (VM) to use US keyboard

PortableApps – packaging/’virtualization’ of MS Windows applications – it makes a package you can run from USB; open-source
Thinstall – same but commercial

MySQL on Mac OS X 10.4 Intel
– install DMG from Mysql site and also follow http://www.entropy.ch/software/macosx/mysql

Cross-platform presentational SW: http://www.debugmode.com/wink/
– generates Flash
– audio+screenshots

JavaOne 2007 – Open Source mobile OS:
Freedom also means that you have to let other people be free to make choices that you might not…

Test Units – abstract of Tapestry testing @JavaOne 2007
– it helps if there a single class that has responsibility for all task of a given process
– test-driven dev = change detection (regression tests) + more
– tests
— isolated, thorough
— easy to debug, frequently run (i.e. fast) => out-of-server, or out-of-container
— test the ‘hard stuff’
— tests document design decisions – expectations/requirements

Using Flex with Subversion on Mac OS X or Linux

Filed under: Uncategorized — negev @ 8:06 pm
Tags: , ,

4 April 07
Flex and Subversion
Flex performs SVN housekeeping even without Subclipse being installed. If you delete a directory which is SVN-controlled and it has entry in its parent directory’s .svn, then Flex recreates that deleted directory.

Also, if new MXML files were added to a project while Flex was turned off and if those files have any compile-time error, then next time Flex will be building the project it doesn’t generate any SWF and it *doesn’t* display any error.
Solution: create new empty MXML files using Flex menu; turn off Flex, copy the actual files over, turn on Flex.

Separate Flex and web folders
Because of the above issues, I’ve separated Flex folder:
1. I’ve checked out on commandline to ~/TLGM2_svn
2. In Flex I’ve created a plain Flex project under ~/TLGM2
— the project itself is local only and it isn’t SVN-controlled

3. build the project – otherwise it may not build once you add new files
4. close Flex

5.
cd TLGM2
# Following are hard-links, not symbolic links
ln ../TLGM2_svn/TLGM2.mxml

cd deploy
ln ../../TLGM2_svn/bin/TLGM2.swf

6. Start Flex, use it
7. svn on commandline under TLGM2_svn

If we go this way, then we need to adjust locations of any embedded resources. Right now I’m using the following adjustment to TLGM2.mxml:
– <mx:Button id=”showGroupButton” fontSize=”8″ width=”25″ click=”show_hide_Groups()” height=”78″ labelPlacement=”left” textAlign=”left” icon=”@Embed(‘deploy/resources/groups.gif’)”/>
+ <mx:Button id=”showGroupButton” fontSize=”8″ width=”25″ click=”show_hide_Groups()” height=”78″ labelPlacement=”left” textAlign=”left” icon=”@Embed(‘../TLGM2_svn/deploy/resources/groups.gif’)”/>

Probably rather than using ‘TLGM2’ and ‘TLGM2_svn’ it would be easier to have trunk/TLGM2 which would be checked out from SVN and trunk/Flex which wouldn’t be under SVN. Then resources would point at e.g. ../TLGM2/deploy/resources/groups.gif

This way if Flex gets better and we’ll use it direct on SVN-controlled trunk/TLGM2 rather than on non-SVN local trunk/Flex, then the resource locations would work unmodified.

I have had one issue when I modified same TLGM2.mxml in both Flex and via commandline svn. But I believe that was because I didn’t do a hard link, but I copied the file while experimenting – this way the file was duplicated rather than hard linked.

Formatting whole row in DataGrid

There are about 3 different types of specifying a renderer for a DataGridColumn:
1. Fully customized, but you need to copy and paste it for every column and to change {data.mail} appropriately:
<mx:DataGridColumn dataField=”mail” headerText=”Email Address”>
<mx:itemRenderer>
<mx:Component>
<mx:Text text=”{data.mail}” styleName=”{data.hasOwnProperty(‘is_admin’) ? ‘adminStyle’ : ” }” />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

2. Using a component – in this case defined in MemberRenderer.mxml – which gets instantiated behind the scenes; however it can’t be parameterized and therefore you need one component per column
<mx:DataGridColumn dataField=”mail” headerText=”Email Address” itemRenderer=”MemberRenderer” />

3. Parameterized renderer, which gets created behind the scenes via implementation (subclass) of mx.core.IFactory:
<mx:DataGridColumn dataField=”fullName” headerText=”Full Name” itemRenderer=”{new utils.MemberRendererFactory(‘fullName’)}” />

I’ve tried to somehow retrieve DataGridColumn’s dataField in the renderer object, so that we could use option (2) without using IFactory. However, the rendered components can’t access DataGridColumn.

How I’ve tried it: In renderer’s text=”{expression}” I invoked a local function, in which I called Alert.show( “parent: ” +parent.toString()+ “, owner: ” +owner.toString() ) Those showed that the parent element is ListBaseContentHolder and owner element is DataGrid.

2 April 07
Flex mx:Model – they can’t be used in initial values for variables. Use them only once the app/component was initialized – in creationComplete handler.
public var memberListData:ArrayCollection; // = new ArrayCollection( memberListModel.item ); // – this assignment fails
Flex <mx:DataGrid dataProvider=”{myDataSourceVariable}” ..> — myDataSourceVariable doesn’t need to have any initial value, then an empty DataGrid is shown
with any columns defined in its body in mx:columns
mx.Text (and its parent mx.Label) has htmlText attribute, but in order to get it used in DataGrid we need a renderer anyway

You can use any custom component for mx:DataGridColumn itemRenderer property.
If you’d like to add extra bindable variables, you define them in mx:Script within body of the component tag.

If you’re not using a custom component as a renderer, then you need to have <mx:itemRenderer><mx:Component> and the actual visible items within them, e.g. <mx:itemRenderer><mx:Component><mx:Text text=”{data.cn}” /></mx:Component></mx:itemRenderer>

Blog at WordPress.com.