Subversion: How to copy a branch to an empty trunk

Here’s the scenario:

You have this really cool idea of an OSS project and you have already coded some of its source, though not stable enough for release you’d decided to create and uploaded it on Google Code repository to track the development history. “Trunk tree should only have the stable source”, with this in mind you’d decided to create a branch directory (/1.0) and upload your unstable source in there. After days of hacking and cracking, you finally have a source candidate for the trunk tree. So, how do you copy your candidate branch to the empty trunk?

Remember that when you create a new project on Google Code, your initial repository will already have a branches, tags, and trunk tree.

Using “svn merge” will not do, because you still have an empty trunk.

But how about “svn copy“?

> svn copy https://your-project.googlecode.com/svn/branches/1.0 \
   https://your-project.googlecode.com/svn/trunk/

That wouldn’t do either. Yes it’ll copy all the files and directories inside the “/branch/1.0” directory but it’ll include the “/1.0” directory. Meaning the end result will be “/trunk/1.0“.

https://your-project.googlecode.com/svn/trunk/1.0

You don’t want that, do you? Remember that Trunk directory should always contain the latest and stable source. So the “/1.0” directory will be inappropriate. What you wanted to achieve in your project repository tree, is to look like this:

  • /svn/branches
    • /1.0
      • source.file.1
      • source.file.2
  • /tags
  • /trunk
    • source.file.1
    • source.file.2

Solution

The way to do this (without temporarily deleting the trunk directory) is to first, checkout the candidate branch, change working directory and import.

  1. Checkout the candidate/stable branch:
    > svn co https://your-project.googlecode.com/svn/branches/1.0 branch-1.0
    > cd branch-1.0
    
  2. Import to the empty trunk:
    > svn import https://your-project.googlecode.com/svn/trunk \
       -m 'Stable source from branches/1.0, revision 26.'
    

Pros: Quick and easy, without deleting the current trunk tree.
Cons: What happened on the branch (history) stays on the branch.

Got another solution? I’d love to hear from you.

jstcky: A stick or die JavaScript framework

Got a new project started at Google Code. It’s simple called “jstcky“. It’s a framework written in JavaScript and uses jQuery library that stick or fix a menu/app bar at the bottom of a page. It is inspired by Facebook’s fixed application/chat bar. Please checkout my post on how to fix an element/bar on the bottom of a page.

The project is still undergoing development. So, bugs may crawl and few functionalities as of this time.

I’ve already upload the jstcky codebase on Google Repository under “branches” tree. So do check it out!

How to remove [caption] shortcode from Add-Meta-Tags 1.6

While I was tinkering with my blog site, trying to (somehow) optimize it. I’ve noticed that the “Meta-Description” in which the Add-Meta-Tags generates, included the “[ caption ]” shortcode in the header’s meta-description, that is if I have an embedded image on my post. SEO professionals would say that “it’s a big No no!”. So, what’s a guy gotta do? Remove it! But then I still want a caption for my embedded images (on posts). So, editing every post and removing the code manually will not do.

I’d searched a fix on google but no luck. But, I’ve found one for All-In-One-SEO-Pack using regular expression to strip all shortcode. Tried it on Add-Meta-Tags and you guessed it! It worked!

Here’s how to you do it:

  1. Edit your ‘add-meta-tags.php‘ from ‘/wp-content/plugins/add-meta-tags-1.6‘ directory.
  2. Search for the function ‘amt_clean_desc
  3. Then add this code (one line before ‘return trim($desc);‘):
    $desc = preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $desc);
    
  4. Save it then upload it back to the server.

That’s it!

How to share folders in Linux using samba

Have you tried sharing a folder in Linux, especially in OpenSuse? If you open your File Browser/Nautilus and you right clicked on a folder, you will see a “Sharing Options” and when you try to share a folder and hit on the “Create Share” button, there’s an error prompting at the window: ‘net usershare’ returned error 255: net usershare: usershares are currently disabled.

Well the solution to this problem is quite simple:

Note: Before starting make sure that Samba is already installed and that the Samba daemon are already started:

Starting the Samba daemon

As root:

rawswift:~ # /etc/init.d/smb start
Starting Samba SMB daemon                                            done
rawswift:~ #

Now here’s what you will do next (as root):

  1. Edit ‘/etc/samba/smb.conf’.
    rawswift:~ # vi /etc/samba/smb.conf
    

    add the following under the “[global]” category:

    usershare allow guests = Yes
    usershare max shares = 100
    usershare owner only = False
    
  2. Create the ‘usershare’ directory (this is where Samba will store the lists of shared folders).
    rawswift:~ # mkdir /var/lib/samba/usershares
    rawswift:~ # chgrp users /var/lib/samba/usershares/
    rawswift:~ # chmod 1770 /var/lib/samba/usershares/
    
  3. Then finally, restart Samba daemon:
    rawswift:~ # /etc/init.d/smb restart
    Shutting down Samba SMB daemon                                       done
    Starting Samba SMB daemon                                            done
    rawswift:~ #
    

That’s it! Simple, eh?

Share a folder

  1. Open your file browser/Nautilus.
  2. Right click the folder you want to share.
  3. Click ‘Sharing Options’.
  4. Tick ‘Share this folder’ and ‘Guest access (for people without a user account)’.
  5. And hit ‘Create Share’ button.

Utilities and tools I can’t live without

After reading an article from TechRepublic, entitled “10+ IT pros share the utilities and tools they can’t live without“. I told myself that I too should have one:

As a full-time web developer, part-time designer, and sometimes system administrator, here’s a list the tools, utilities and multimedia application packed in my box:

Linux

  • Development:
    • Eclipse + Aptana – PHP development platform.
    • Eclipse + PyDev – Excellent Python development platform.
    • Bluefish – A lightweight yet powerful IDE. I personaly use it for XHTML and CSS development.
    • SSH and SCP – Secure shell and secure copy. Securely access your remote server and safely copy file from server to your local and vice versa.
    • gFTP – Gnome’s File transfer client.

  • Utilities/Multimedia:
    • VirtualBox – An Open Source virtualization software. Here is where I stuffed my Windows OS and other Unix-like OS.
    • Evolution – Gnome’s mail client application.
    • Mozilla Sunbird – A full-featured and easy to use calendar application. Compatible with Apple’s iCal application. Keeps me on track and organized.
    • Banshee – Music and video player that supports Podcast, Last.fm, and can Sync with iPod, G1, or other devices.
    • Terminal Server Client – Much like “Remote Desktop Connection” for Windows but more manageable
    • Brasero – Disc-burning application.
    • MPlayer – Movie and music player that plays most video and audio format.

Windows

  • Development and Design:
    • Zend Studio – This IDE rocks!
    • Dreamweaver – One of the reason I cannot dump Windows completely.
    • Photoshop – This is where I do most of my web and print designs and another reason why I cannot dump Windows (yet).
    • WinSCP – Free FTP, SFTP, and SCP application.
    • Putty (SSH) – Free telnet and SSH client.

  • Utilities/Multimedia:

Now it’s your turn! Share what utilities and tools you have on your sleeves that you probably can’t live without.

Fixed that bar at the bottom like Facebook!

Since I’ve started an account on Facebook, I was always fascinated with the bottom fixed application bar. And now I got a chance to hack one for my own and share it, with you guys.

Check out the sample I’ve made: http://ryan.rawswift.com/sandbox/fixed-bottom-bar/

I’ve put some comments on the HTML and CSS code. So, I hope you’ll understand it clearly.

Save and modify it, to fit your need!

Hope this helps!

Update!

Bug Fix:
1. Overlapping scrollbar (vertical and horizontal) on IE7.
2. Page wouldn’t scroll down when the mouse pointer is in a white/blank space on IE7.

The sample page are optimized for 960×600 and higher resolutions. Tested on FF3, IE6, IE7, and IE8.

Download: http://ryan.rawswift.com/sandbox/fixed-bottom-bar/fixed-bar-0.2.tgz

UPDATE – Dec. 15, 2009

Thanks guys! For all the comments and suggestions. Sorry if I couldn’t reply to each and every comments below. Been busy for the past couple of months.

Anyway, I’ve just recently created a new project called jixedbar. It’s a jQuery plugin and has the same effect as seen in the above demo but with some added features like mouse hover effect, rounded corners, text tooltip, and customizable style (partly). It is still under development and currently in beta stage.

You can download the beta version at http://code.google.com/p/jixedbar/downloads/list.

Please try it and send me your comments or suggestions.

*** Compatible in IE6, IE7, IE8, Firefox, and Chrome. (Haven’t yet tested on a Safari browser)

Demo page: http://ryan.rawswift.com/sandbox/jixedbar-0.0.2/demo/

UPDATE – June 24, 2010

Here’s the latest update:

Demo page: http://ryan.rawswift.com/sandbox/jixedbar-0.0.3/demo/

*** Development version 0.0.3

Cheers!

Donation

Support the jixedbar project by donating any amount through PayPal or by simply linking back to jixedbar‘s page over Google Code.


Unix epoch time will hit 1234567890

A few hours from now a milestone will happen for Unix world as the Unix time (Unix Epoch) will hit “1234567890″ at Friday, February 13, 2009, 11:31:30 pm UTC (since it started counting on January 1, 1970).

To find out what time it will be in your local time:

perl -e 'print scalar localtime(1234567890),"n";'

or

date -d@1234567890

Mine is ‘Saturday, February 14, 2009 07:31:30 PHT’ (Philippine Time).

Don’t have *NIX? Check out http://coolepochcountdown.com/

So! Grab your party hat and grab some beer or whatever you can grab on and party like it’s 1234567890!
If you happen to miss the celebration, then we’ll see you December 22, 2282 at 3:13:30PM ET.

Bandwidth monitoring with Network Top (ntop)

Want to know your bandwidth usage? Or who among your network peers are using most it. Then install network top (ntop), with it you can monitor your network bandwidth usage using pretty graphs (rrdtool). Ntop installs out-of-the-box through YaST (I’m assuming you have SUSE). Enough talking!

Here’s how to install it:

  1. Install ‘ntop’ using YaST. So dependencies will be included.
  2. After installation, time to set the admin’s password and the user ntop should run after it initializes.
    rawswift:~ # ntop -A -u wwwrun

    If you want to access ntop’s interface from any computer in your network then edit the ntop’s configuration file and change the localhost IP (127.0.0.1) to the host’s local network IP.

    • Open ntop configuration file (as root):
      rawswift:~ # vi /etc/sysconfig/ntop
    • Change ‘NTOPD_PORT’ value:
      • From: NTOPD_PORT=”127.0.0.1:3000″
      • To (host network IP): NTOPD_PORT=”xxx.xxx.xxx.xxx:3000″
    • Then save it!
  3. Now start ntop script
    rawswift:~ # /etc/init.d/ntop start

If you want ntop to start on boot time then enable it in the init process:

rawswift:~ # chkconfig ntop on

Open you web browser and in the address box put the ntop’s host address and port (3000). You’ll now be able to see the bandwidth monitoring:

rawswift:~ # links 127.0.0.1:3000

What I like about ntop is that is uses rrdtool to graph the bandwidth usage. Really useful in tracking who uses the most bandwidth.

And if you want to go extreme, install ettercap and use ARP poison to sniff all data frames on your local area network (LAN). But be careful with playing man-in-the-middle attack in a low end computers. It’ll definitely bog down you network.

Sun’s VirtualBox on OpenSUSE 11.1

Here’s how to install VirtualBox on OpenSUSE 11.1:

  1. First, you’ll have to download the package from Sun’s website.
  2. Get the right package for your OS platform (32-bit or 64-bit). I had the mistake of installing the wrong package. You can check your platform by running ‘uname’ command with ‘-a’ (print all information) argument:
    ryan@rawswift:~/Desktop> uname -a
    Linux rawswift 2.6.27.7-9-default #1 SMP 2008-12-04 18:10:04 +0100 x86_64 x86_64 x86_64 GNU/Linux
    ryan@rawswift:~/Desktop>

    A 64-bit kernel will give you ‘x86_64 x86_64 x86_64′ and a 32-bit would show ‘i686 i686 i386′.

  3. After you’ve download the package, it time to install it:
    ryan@rawswift:~/Desktop> sudo rpm -i VirtualBox-2.1.2_41885_openSUSE111-1.x86_64.rpm
    Creating group 'vboxusers'. VM users must be member of that group!
    ryan@rawswift:~/Desktop>

That’s it! Now run ‘Sun xVM VirtualBox’ on your application menu or ‘VirtualBox’ on your shell. Enjoy!

Problems and fixes (especially on a 32-bit and OSE package)

  • VirtualBox’s library requirements. Install the following:
    pam-devel
    libqt2-32bit
    libqt4-x11-32bit
    SDL-32bit
    libxslt-32bit
  • After running VirtualBox, it doesn’t show up on screen. Run VirtualBox on shell:
    ryan@rawswift:~/Desktop> VirtualBox
    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
             available for the current kernel (2.6.27.7-9-default) or it failed to
             load. Please recompile the kernel module and install it by
    
               sudo /etc/init.d/vboxdrv setup
    
             You will not be able to start VMs until this problem is fixed.
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    If the above error appears, you should run ‘vboxdrv’ script to create the VirtualBox kernel module:

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 failed
      (Look at /var/log/vbox-install.log to find out what went wrong)
    ryan@rawswift:~/Desktop>

    If it fails to compile, install ‘kernel-source‘ through YaST. Then run ‘/etc/init.d/vboxdrv setup’ again.

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 done
    Starting VirtualBox kernel module                                    done
    ryan@rawswift:~/Desktop>
  • Permission denied:
    ryan@rawswift:~/Desktop> VirtualBox
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    Run ‘chmod’ on ‘VirtualBox’. This will set the execute bit:

    sudo chmod +x /usr/lib/virtualbox/VirtualBox
  • Driver mismatch. If an error box appear when you ‘Start’ a virtual machine:
    The VirtualBox support driver which is running is from a different version of VirtualBox.
    You can correct this by stopping all running instances of VirtualBox and reinstalling the software.
    (VERR_VM_DRIVER_VERSION_MISMATCH).
    
    Result Code:	NS_ERROR_FAILURE (0x80004005)
    Component:	Console
    Interface:	IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}

    Check your VirtualBox package platform (64-bit or 32-bit, see the tutorial above).