Umbraco: playing with the dark side

Since the long wait has been over, here I am full of hopes and time to spend on my sudden feeling of skills improvement — a better way to put this tech-bladging.

I have been using IIS for quite some time now to server static pages and Windows Media streaming. My attempt to go in-depth will be to try Umbraco, a .NET CMS that runs on IIS with MS Ajax and MS SQL Server Express. One thing, it is quite weird dealing with MS products that bear these enterprisey names that sound similar.

Anyway, I will try to create a module or extension or a cool theme with this product and hopefully it will open my world to the dark side of C# (^_^)

Merging partitions in OSX 10.5.5 and moving User directory into a different Volume

Since I have been editing a lot of photos in Aperture and doing hibernation at mode 5, the startup disk has been easily filled up to the limit.

I decided to delete my Windows Partition and move completely to OSX Leopard because I can still run Vmware Fusion just in case I need it. I guess my PC gaming has ended and luckily I have a console to cover that.

I am also waiting for a 4gb kit ram for an upgrade to give this machine a boost of 8gb at 64 bit. I will be testing Photoshop scratch disk to run solely from the memory.

Now back to business.

First. Moving the users directory in a new partition

root# dscl localhost
cd /Local/Default/Users
change user dsAttrTypeNative:NFSHomeDirectory /Volumes/UserData /Volumes/Data/Users

Log-off

2nd. Merging Journaled HFS+ Partition

Since my 2 partition of a 74GB raptor is making the Startup Disk insufficient, I have to merge them.

Create a Journaled HFS+ on the second partition then on the Terminal

sudo su
mergePartitions "Journaled HFS+" Macintosh disk1s1 disk1s2
 
Merging partitions into a new partition
Start partition: disk1s1 Mac
Finish partition: disk1s2 disk1s2
Attempting resize
Changing filesystem size on disk 'disk1s1'...
Attempting to change filesystem size from 32346472448 to 74348273664 bytes
/dev/disk1
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:     FDisk_partition_scheme                        *69.2 Gi    disk1
1:                  Apple_HFS Mac                     69.2 Gi    disk1s1

The last saving grace. Boot using the OSX Installer. Open Terminal.

diskutil list
fdisk -e /dev/rdisk0
p
f 1
write
y
exit

Seeing it work…priceless

Chrome plating the internet

Google Chrome will change the internet landscape. The browser is fast and I noticed that the picture is being rendered with a vibrant color as well. I do not know if it has to do with the rendering engine Webkit or it is a different experience browsing in an almost default fullscreen.

The interface is very intuitive and there is no clutter. It is all about the experience in browsing and getting the information that you want.

The Opera style quickdial is also fascinating as it automatically detects the history. Even the Ctrl T is working.

My coworker told me that I am having an orgasm with Chrome because judging by my reaction, I am. I am really anticipating an OS X version as I use mac at home. And well, I hope Chromium will shake the linux world as well.

What a day to get excited by a browser. Google has already a hold in Dell by distributing the toolbar on its PCs. Hopefully, they can find a way to distribute chrome as a default web broser like Internet explorer and surely they will gain leverage.

Google is huge and they are doing great things that’s why.

The beauty of this NAS

Since I have some free cash from Acer Cashback, I went to BBC to buy a D-link 323 NAS (Network Attached Storage). I installed to it a new 740GB Samsung 32MB cache sata 3 and an old 320GB Seagate 16MB cache sata 3. By the way, Samsung is so genius that you need a software to run their disk into 16MB cache because it won’t follow its jumper.

First off, I loaded fun_plug. If you are not going to use raid or jbod, the right disk will be volume 1 and it is where you install fun_plug. And from there, you can put in a robust iTunes Server, a torrent client and many more. I might explore the UPNP media server and PS3 in the future.

You have to put cleanboot in it as well for the best way to shutdown your machine. Using the power button will render the an improper unmounting of drives and might corrupt precious data. You need to telnet or ssh and do a halt.

If you are already suffering from this:

# dmesg
 
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended

Mount your drive into a Linux machine and do

e2fsck -f /dev/sde1
e2fsck -f /dev/sde4

If you don’t have linux, you can use a livecd like Ubuntu. Since the drive is already mounted, it is also practical to transfer old files this way because it will be faster than rely solely on gigabit network. From my experience, it will take about 4 hours to transfer 300GB of data on a gigabit network and just less than an hour in sata.

To save my drive from unwanted spinning and separate all these scripts from the data, I moved fun_plug into a usb. Good thing the Queensland government has given away their interactive tour in a 1Gb usb flash disk.

Not bad for a NAS because you can extend its functionality and the filesystem is not the proprietary out of this world Fat32 being used by a lot of pseudo NAS devices.

My current firmware is 1.04 and I have spent the whole Saturday until 5:00am Sunday doing this and finishing Season 3 of Beauty and the Geek with my wife.

Of course she is a beauty and I am a not a geek! =)

Shared hosting insecurity, core dumps, and troubled disk usage

It always amazed me how some of the sysads of these servers are obsessed with security but fail to see the other side of the picture.

The shared hosting account that I have, a reseller account by the way, won’t let you run normal things in PHP because of their false idea of security. The system uses the infamous CPanel setup as paranoid, when your web app use a fair amount of CPU, your site will be shut off.

Add this to httpd.conf

    RLimitMEM 295490218
    RLimitCPU 240

The funny thing is, they forget to turn off the Core Dump and this will mess the system by filling it with files that only the root can delete. This will give you erros in Disk Usage at CPanel, saying that you are using a huge (GB) space and it is only displaying a smaller (MB) space usage.

So please send the core dump in the void or at least turn them off

$ ulimit -c 0

For the users who have these sysads who don’t listen, instead of sending them to /dev/null together with the core dumps, you can create a script to delete these core dumps and put them on schedule using cron.

From here:

    #!/usr/bin/perl
 
    ## SPECIFY THE PATH TO THE DIRECTORY
    ## NOTE: NO TRAILING SLASH "/"
 
    $dir = "/home/PATHTOYOUR/public_html/phpBB3" ;
 
    ## OPEN AND READ THE DIRECTORY
 
    opendir (DIR, "$dir/");
    @FILES = grep(/^core/,readdir(DIR));
    closedir (DIR);
 
    ## DELETE THE CORE.* FILES
 
    foreach $FILES (@FILES) {
             unlink("$dir/$FILES");
       }

Save as delcore.pl

    15 * * * * /home/PATHTOYOUR/public_html/delcore.pl

Some of them are just clueless when I ask them to delete the core dumps for me. One has even ask me if he can delete the core*.php files in the Smarty library. Geez, what a day.

Reverting Leopard to the Welcome Screen after Install

I usually put the User Data in a different partition. And Leopard has a hobby of corrupting the User Space when you reboot it after it just froze itself.

Save yourself the time from doing the fresh install Setup by going back to the initial boot welcome screen after installation by using the following command:

sudo rm /var/db/.AppleSetupDone

Then get your user setting from Time Machine.

EDIT: It seems that Leopard is messing the mounting of Volumes everytime a cold reboot is needed. Unmount the UserData (Will be UserData 1) in Disk Utility

sudo rm -rf /Volumes/UserData

Mount the UserData in Disk Utility
Re Login

Controlling itunes from SSH

Code Listing. Combined with codes on comments

#!/bin/sh
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
####################################
 
showHelp () {
echo "-----------------------------";
echo "iTunes Command Line Interface";
echo "-----------------------------";
echo "Usage: `basename $0` ";
echo;
echo "Options:";
echo " status   = Shows iTunes' status, current artist and track.";
echo " play     = Start playing iTunes.";
echo " pause    = Pause iTunes.";
echo " next     = Go to the next track.";
echo " prev     = Go to the previous track.";
echo " mute     = Mute iTunes' volume.";
echo " unmute   = Unmute iTunes' volume.";
echo " vol up   = Increase iTunes' volume by 10%";
echo " vol down = Increase iTunes' volume by 10%";
echo " vol #    = Set iTunes' volume to # [0-100]";
echo " shuf  = Shuffle current playlist";
echo " nosh  = Do not shuffle current playlist";
echo " playlist "@" = Play iTunes' playlist named @";
echo " stop     = Stop iTunes.";
echo " quit     = Quit iTunes.";
}
 
if [ $# = 0 ]; then
showHelp;
fi
 
while [ $# -gt 0 ]; do
arg=$1;
case $arg in
"status" ) state=`osascript -e 'tell application "iTunes" to player state as string'`;
echo "iTunes is currently $state.";
if [ $state = "playing" ]; then
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`;
track=`osascript -e 'tell application "iTunes" to name of current track as string'`;
echo "Current track $artist:  $track";
fi
break ;;
 
"play"    ) echo "Playing iTunes.";
osascript -e 'tell application "iTunes" to play';
break ;;
 
"pause"    ) echo "Pausing iTunes.";
osascript -e 'tell application "iTunes" to pause';
break ;;
 
"next"    ) echo "Going to next track." ;
osascript -e 'tell application "iTunes" to next track';
break ;;
 
"prev"    ) echo "Going to previous track.";
osascript -e 'tell application "iTunes" to previous track';
break ;;
 
"mute"    ) echo "Muting iTunes volume level.";
osascript -e 'tell application "iTunes" to set mute to true';
break ;;
 
"unmute" ) echo "Unmuting iTunes volume level.";
osascript -e 'tell application "iTunes" to set mute to false';
break ;;
 
"vol" ) echo "Changing iTunes volume level.";
vol=`osascript -e 'tell application "iTunes" to sound volume as integer'`;
if [ $2 = "up" ]; then
newvol=$(( vol+10 ));
osascript -e "tell application \"iTunes\" to set sound volume to $newvol";
break ;
fi
 
if [ $2 = "down" ]; then
newvol=$(( vol-10 ));
osascript -e "tell application \"iTunes\" to set sound volume to $newvol";
break ;
fi
 
if [ $2 -gt 0 ]; then
newvol=$2;
osascript -e "tell application \"iTunes\" to set sound volume to $newvol";
break ;
fi
break ;;
 
"playlist" ) echo "Changing iTunes playlist.";
osascript -e 'tell application "iTunes"' -e "set the new_playlist to \"$2\" as string" -e "play playlist new_playlist" -e "end tell";
break ;;
 
"shuf" ) echo "Shuffle is ON.";
osascript -e 'tell application "iTunes" to set shuffle of current playlist to 1';
break ;;
 
"nosh" ) echo "Shuffle is OFF.";
osascript -e 'tell application "iTunes" to set shuffle of current playlist to 0';
break ;;
 
"stop"    ) echo "Stopping iTunes.";
osascript -e 'tell application "iTunes" to stop';
break ;;
 
"quit"    ) echo "Quitting iTunes.";
osascript -e 'tell application "iTunes" to quit';
exit 1 ;;
 
"help" | * ) echo "help:";
showHelp;
break ;;
esac
done

Reference:
MacOSX Hints