JC Web Concepts

Custom Web Developments

Using Git for SVN

| Comments

So I have switched from SVN to Git and I am very happy about it. When I am at work I am stuck using SVN and I hate it. So I learned about a command that git has called git svn. It allows me to clone an SVN repo and locally use Git for it. I can make my commits and keep things versioned via Git. When I am done I can then commit it to the SVN repo and nobody would know I used Git instead of SVN. What is nice is it will commit all the changes, not just one massive one. I have yet to run into and issue but that’s ok if I do. So if you are a Git user stuck in an SVN world, then this is the way to save yourself. Let me show you an example of how to use this.

1
git svn clone "urlToSVNrepository" "LocalLocationYouWantThis"

Example

1
git svn clone "http://svn.google.com/sampleTest" "sampleTest"

Now lets say your repository has a trunk, branches, and or tags, you can do something with them as well.

1
git svn clone "urlToSVNrepository" "LocalLocationYouWantThis" -T trunk -b branches -t tags

Example

1
git svn clone "http://svn.google.com/sampleTest" "sampleTest" -T trunk -b branches -t tags

So now you have your svn project using git, which is nice. What also is nice is your project no longer has a bunch of .svn folders like you see in SVN land. That should be one of many things that will make you want to do this. I will make tutorial video on this soon so stay tuned if you are interested.

TextMate2 Alpha Intro

| Comments

So the other day, it was announced that the alpha release of TextMate2 was avaliable for licensed users of TextMate So I decided to make a little video on some of the changes that I have seen so far. I am excited what I have seen and look forward in helping making TextMate the best editor around.

Switching to Octopress

| Comments

I have decided to leave the world of Wordpress, for the world of Octopress. I will have some tutorials on this blogging framework but there are some reasons I made this change. I think the biggest reason I changes was Octopress does not use a database. To me that is just a great performance boost. The application comes with some nice plugins like twitter, Github, and Google+.

Using one command like rake deploy, and it automatically pushes the compiled static content to my web server with 1and1 via rsync. I no longer have to login to an admin panel and use a bloated tool like Wordpress has. I can open vim or TextMate and start writing my post using Markdown. So go try it out. I think you guys and gals will love it.

Spotlight for Windows and Linux

| Comments

One of the nice features in MacOSX is the use of Spotlight. I hardly use icons anymore and just hit command+space and type what I need. While I am in Gentoo or Windows XP, I sorely miss this functionality. Well today I started to look and found a nice tool called Launchy.

This tool supports skinning and plugins to enhance the already nice tool. What is nice is by default I can do math in it like I can do in spotlight. When I want to call the tool I hit alt+space and it comes up. I will continue to play with this tool but so far I love it.

PHP Contact Form

| Comments

I would like to take an opportunity to show you an example of how to developer a simple php contact page. I will not use css or anything like that for this tutorial. Just quick and dirty using the php mail function. Lets watch a video, explaining the process



Here is the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<html>
    <head>
        <title>Contact Us</title>
    </head>
    <body>
        <?php
            if($_SERVER['REQUEST_METHOD'] != 'POST') {
                $self = $_SERVER['PHP_SELF'];
        ?>
            <form method="post" name="contactForm" action="<?php echo $self; ?>">
                <table>
                    <tr>
                        <td>Name: </td>
                        <td><input type="text" name="cusName" id="cusName" /></td>
                    </tr>
                    <tr>
                        <td>Email: </td>
                        <td><input type="text" name="cusEmail" id="cusEmail" /></td>
                    </tr>
                    <tr>
                        <td>What can I do for you? </td>
                        <td><textarea id="reason" name="reason" rows="8" cols="40"></textarea></td>
                    </tr>
                    <tr>
                        <td><input type="submit" value="Submit" /></td>
                        <td><input type="reset" value="Reset" /></td>
                    </tr>
                </table>
            </form>
        <?php
            } else {
                $name = $_POST['cusName'];
                $emailFrom = $_POST['cusEmail'];
                $reason = $_POST['reason'];
                $emailTo = "john@jcwebconcepts.net";
                $subject = "Filled in form from website";

                $header = "From: $name <$emailFrom>\r\nReply-To: $emailFrom\r\n";
                $header .= "MIME-Version: 1.0\r\n";
                $header .= "Content-type:text/html;charset=iso-8859-1\r\n";

                $message = "From: #name, Email: $emailFrom<br /><hr />$reason";

                mail($emailTo, $subject, $message, $header);

                echo "Thank you for contacting us. Someone will get back to you as soon as we can. Thank you.";
            }
        ?>
    </body>
</html>

Passing of Steve Jobs

| Comments

As many bloggers have already done, we have lost someone this past week that was dear to a lot of Mac fanboys. He will be missed but I am sure he was working on his successor for a long time. I wonder how many people added to their Netflix queue, “Pirates of Silicon Valley”? As I am sure everything in that movie had some things that did not happen, Steve gained my respect. So good luck Steve to where ever the road takes you. Good bye.

Setting Up Blogofile

| Comments

Blogofile is a simple blogging engine that brings something nice without the use of a database. I have been testing this out and I am starting to like this. I have even been thinking of replacing it with this. I am really enjoying this framework. Go ahead and watch this video below. After the video I will post the step by step instructions just in case you do not want to watch how to do it.



Here is the steps:

On the server

Install the python tool easy_install

1
2
sudo apt-get install
python-setuptools

Install blogofile

1
sudo easy_install blogofile

If you do not have Git

1
sudo apt-get install git

Go to where you want the git repo to be installed and do the following

1
2
3
mkdir blogofile.git
cd blogofile.git
git --bare init

Now configure the post-receive file

1
2
3
4
5
6
vim hooks/post-receive
unset GIT_DIR
cd /path/to/where/clone/repo/is
git pull
blogofile build
cp -a _site/* /var/www

Local computer

Now lets go to your local computer to where you want the source files and do the following

1
2
3
4
5
6
7
8
mkdir blogofile
cd blogofile
blogofile init simple_blog
git init
git add .
git commit -m "Some message"
git remote add origin username@yourservername:/path/to/repo/somerepo.git
git push origin master

Now we need to setup our exclude file so we do not commit the _site folder.

1
vim .git/info/exclude

Now add this to the bottom of the file

1
_site/* _site/

Now if you want to test out your blog you will do the following:

1
2
blogofile build
blogofile serve 8080

The 8080 can be any unused port you like. I hope this helped you as much as it has helped me.

Dual Boot MacBook 5,2 and Gentoo

| Comments

One thing that I have always wanted to do was dual boot my Mac computer so I could run Linux on real hardware instead of emulation. This tutorial is going to show you how to accomplish this. A thing to note is you can do this with any Linux distro. Also the Mac that was used in this tutorial was a 13 inch White MacBook 5,2 version.

Things needed for this process:

  • Boot manager: rEFIt
  • Gentoo minimal ISO: Gentoo x86
  • USB keyboard and mouse
  • Wired internet connection

Partition HD

  • Mac Already installed

    • Open boot camp assistant
    • Set the partition size to the size you want
    • When this is done go ahead and click quit and install later
    • At this point you are done with partitioning your drive
  • Mac not installed

    • Turn on your Mac and hold option key down until the selector comes up
    • Insert your Mac CD in and wait for it to show. Click on it
    • When cd is loaded you will what to open disk utilities in the menu up top
    • Click on your hard drive and then on the right click the partition tab
    • Under volume scheme you want to select two partitions
    • !!!!!!!Need to work on it ending of this part

You are down with the drive partition now. We now need to move into the boot loader tool that is going to help us along the way

rEFIt

  • Now go ahead and install the rEFIt appliacation
  • Note: There is nothing fancy with this install
  • Now reboot to verify that the boot loader app comes up. If it doesn’t, try rebooting again

You are now done with the boot loader and we are now ready to install Gentoo

Installing Gentoo

After downloading and burning the ISO file to a disc you are ready, you are ready to start. Plug in your USB keyboard for now, insert the gentoo disc you burnt and restart. Remember to hold option key down so you get the option to boot to your CD. Now I am not going to go thru all the steps to install because this is well documented on Gentoo’s website. This can be found here!

So lets highlight the sections that you need to make some adjustments since you are not doing a typical dual boot on a regular PC

Boot parameters

When you get to the book parameters, you will want to type the following: [bash]gentoo maxcpus=1 vga=791[/bash]

Partition table

Here is the partition setup I have and you are welcome to follow it. Now yours might be different but should be close. If you are a cfdisk fan like I you will need to open your sda parition in fdisk, to delete the partition created by apple. Also do not worry about the warnings about unsupported GPT table. Its ok, so here is what my partitions looks like after I am done setting up the partitions that the guide tells us too

  • sda1 - GPT
  • sda2 - Mac HFS/HFS+
  • sda3 - Linux root
  • sda4 - Linux swap

After you are done with this you will want to type the following:

modprobe hid-apple This is done so your drivers get loaded for the apple keyboard. At this point you can remove the USB keyboard.

When downloading the stage3, make sure you download the i686 one

Now I do not use the genkernel. If you follow the install guide you use ext2 for the boot partition. So for some reason the kernel does not have this enabled so that is the only thing at this time I enable, beyond what is already enabled. After you exit you will want to back up the .config file. I like to do this so I can keep my kernel config files backed up.

When you are setting up your grub or lilo, you want to make sure on the kernel line that you add the following:

[bash] maxcpus=1 [/bash]

After Gentoo install

After you are done installing and you reboot you will want to leave your reboot until you get to the rEFIt menu. It does take a little bit to get to it so do not be too concerned. When you get there select the partitioning tool. You will get an error but that is ok. Hit any key and shut off your Mac. Now turn it back on and when you hear the ding hold the option key. Select the hard drive that says Windows. you should boot into Gentoo. If so then clap your hands. Log in as root and restart your computer. Try going into your Mac OS. If you can then you can go to rEFIt site and get the uninstall directions. Congratulations, you have just installed and got Gentoo somewhat working on your MacBook.

Media and Linux

| Comments

This is part 6 of my using Linux for everything blog posts. Some time ago, if you wanted to listen to music or watch videos, you ran into issues. Today’s Linux has changed all that. Honestly the only issues I have had is that my iTunes purchased content cannot be played. This is hugh since I do a lot of purchasing of music on iTunes. If you do not use iTunes then this is not an issue. So with this being said I would say that I could not make the switch to Linux fully since I would lose the ability to watch my movies and listen to my music. Maybe someday this block will not be here.

Setting Up a Git Server

| Comments

Version control is something that a lot of developers use. I have been using SVN for the longest time and ignoring Git. I found it confusing and I just left it alone. I did the same thing before I started to use SVN. I thought I would have learned by now. So take a look at the video below and I will also put the steps at the end of the post.



On where the master git server will be hosted

1
2
3
mkdir /home/git/somerepo.git
cd /home/git/somerepo.git
git --bare init

Now lets go to your computer

1
2
3
4
5
6
7
8
9
mkdir somerepo.git
cd somerepo.git
git init
**Create a README file or you can type:
touch README
git add .
git commit -m "Some message"
git remote add origin username@yourservername:somerepo.git
git push origin master

Now this setup is just using the users that are already on the server. You can setup that you do not need to type in password. You can create just a git user. I hope that this tutorial has helped.