Wednesday, June 22, 2011

ubuntu unexpected operator for shell script

[ : unexpected operator

Ubuntu is strict on shell syntax

check if you can fix it by changing

#!/bin/sh => #!/bin/bash

Thursday, June 9, 2011

SVNServer set up on CentOS

courtesy of
http://wiki.centos.org/HowTos/Subversion
http://lincgeek.org/blog/?p=347

1.

[root@lucifer ~]yum install mod_dav_svn subversion

2.
[root@lucifer ~]vim /etc/httpd/conf/httpd.conf

change Server Name as its IP (not sure if it is necessary)

3.
[root@lucifer ~]service httpd start

[root@lucifer ~]chkconfig httpd on

4.
[root@lucifer ~]vim /etc/httpd/conf.d/subversion.conf

make it look like the following

# Make sure you uncomment the following if they are commented out
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

# Add the following to allow a basic authentication and point Apache to where the actual
# repository resides.
<Location /repos>
        DAV svn
        SVNPath /var/www/svn/repos
        AuthType Basic
        AuthName "Subversion repos"
        AuthUserFile /etc/svn-auth-conf
        Require valid-user
</Location>

NOTE: if you

see 403 "Forbidden You don't have permission to access  ...." 


check if you are using SVNParentPath instead of SVNPath

5.
Add the 1st User
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusername
New password:
Re-type new password:
Adding password for user yourusername

Add additional user
[root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusername
New password:
Re-type new password:
Adding password for user anotherusername

6.
Create the repo
[root@lucifer ~] cd /var/www/ -- Or wherever you placed your path above
[root@lucifer ~] mkdir svn
[root@lucifer ~] cd svn
[root@lucifer ~] svnadmin create repos
[root@lucifer ~] chown -R apache.apache /var/www/svn/*
[root@lucifer ~] chmod 770 -R /var/www/svn/*
[root@lucifer ~] service httpd restart

7.
Test it out
http://[yourmachine]/repos

8.
Add items to the repos with comments
[root@lucifer ~] svn import /tmp/mytestproj/ file:///var/www/svn/repos/mytestproj -m "Initial repository layout for mytestproj"
Adding         /tmp/mytestproj/main
Adding         /tmp/mytestproj/main/mainfile1.cfg
Adding         /tmp/mytestproj/configurations
Adding         /tmp/mytestproj/configurations/testconf1.cfg
Adding         /tmp/mytestproj/options
Adding         /tmp/mytestproj/options/testopts1.cfg

9.
Edit and Commit

[me@mylappy ~] cd mytestproj
[me@mylappy ~] vim configurations/testconf1.cfg -- Add or delete something and save.
[me@mylappy ~] svn commit -m "Added a line to testconf1.cfg."
Sending        configurations/testconf1.cfg
Transmitting file data .
Committed revision 2.

10.
Add to existing folder in the repo

Now this is all fine and dandy, but how do you add more files to an already existing repo directory? Easy, with the add argument. Go ahead and checkout your latest and greatest, copy a file over to a directory, add, then commit the changes.

11.
[me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj
A    mytestproj/main
A    mytestproj/main/mainfile1.cfg
A    mytestproj/configurations
A    mytestproj/configurations/testconf1.cfg
A    mytestproj/options
A    mytestproj/options/testopts1.cfg
Checked out revision 2.

[me@mylappy ~] cd mytestproj
[me@mylappy ~] cp /etc/yum.repos.d/CentOS-Base.repo configurations/
[me@mylappy ~] svn add configurations/CentOS-Base.repo
A         configurations/CentOS-Base.repo

[me@mylappy ~] svn commit -m "Added the CentOS Yum repo file."
Adding         configurations/CentOS-Base.repo
Transmitting file data .
Committed revision 3.

Delete

[me@mylappy ~] svn delete configurations/CentOS-Base.repo
[me@mylappy ~] svn commit -m "Delete the CentOS Yum repo file."

Subclipse - get started

1. Windows->Open Perspectives->Other->SVN Explorer; Once the view is open, right click "New Location" and put in the URL pointing to your repo

2. to import the project to eclipse the 1st time, right click on the project and 'check out', follow the wizard to import it into the current workspace

3. the project should appear in your workspace then and you can immediately 'commit' the project if you don't want to keep it checked out

4. edit the files anyway you want, when save, the file/project will have a "*" next to its icon, meaning it's changed and different from the copy on the server.

5. to 'check in' the changes. right click on the file and 'Commit' with an comment for the change.

6. To add a local project to SVN repo, right click on that project -> Team ->Share Project->SVN ...

Note: as far as I see now, you can not add a project (and its files) that is under some other source control (e.g. clear case) to SVN

Set up Subclipse in Ubuntu

1. (install plugin)
http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
2. (install the additional javaHL libraries)
$ apt-get install libsvn-java

3.  (get eclipse to pick these libraries)
add to eclipse.ini, under -vmargs


-Djava.library.path=/usr/lib/jni

Saturday, June 4, 2011

ItemFileWriteStore: newItem() was not passed an identity for the new item

bug Trac:
http://bugs.dojotoolkit.org/ticket/6562

ItemFileWriteStore.js source code:
http://bugs.dojotoolkit.org/browser/branches/1.0/dojo/trunk/data/ItemFileWriteStore.js?rev=12277

Friday, June 3, 2011

Query URL transformation

From "Matering Dojo" p275

But different server-side programs
require different forms of URLs.

For example:
mystore.php?query=A%&page=1&itemsperpage=10&sort=name

Rather than be dictatorial, QueryReadStore allows you to plug in code to
rewrite the dojo.data request as a URL. You do this by writing a subclass
of QueryReadStore and using that for your driver instead.


dojo.provide("dojobook.data.datasources.sample_rewriter" );

dojo.require("dojox.data.QueryReadStore" );

dojo.declare(
"dojobook.data.datasources.sample_rewriter" ,
dojox.data.QueryReadStore, {

fetch:function(request) {
request.serverQuery = {
q: request.query.substance.replace("*" , "%" ),
itemsperpage: request.count,
page: Math.floor(request.start / 10)
};

// Call superclasses' fetch
return this.inherited(arguments);
}
});

QueryReadStore sends both the request.query and the request.serverQuery
properties combined. In the previous example, mystore.php?q=A&page=10&
itemsperpage=10&query=A*&start=1&count=10 gets sent. As long as the extra
parameters do not interfere with the server program, you needn’t worry
about it. If they do, you can simply null out request.query.field in the
QueryReadStore subclass

Thursday, June 2, 2011

javascript dojo.body() undefined

Possibly some code directly under

<script/> tag. Try put them into a function and  call it on page load if necessary