Parallels Experience

July 27th, 2010 -- 1 Comment

I was asked to write my experiences when using Parallels on my Mac. So I thought I would make a blog post about this at the same time to share my thoughts on this topic. If you own a Mac, Parallels is a purchase that is a must. It makes your life easier. So let me get onto my experiences.

Windows at work

At my work most computers are running Windows XP. When I decided to use a Mac instead of a Windows computers, I came into some issues. There are tools that only have Windows applications and I thought I would be in trouble. I ended up installing XP in Parallels and I was able to install the applications I needed. I needed access to internet explorer to run my automation scripts against website in internet explorer. The company runs some web applications that will only work in internet explorer and Parallels run these applications seamlessly. No issues at all, I do not even know that I am running a virtual machine.

Linux servers

Another thing that Parallels help me with is being able to setup Linux virtual machines. I create a lot of how-to tutorials and I use these virtual machines for them. Installing Linux in Parallels is easy and I do not run into many issues. Setting up and compiling kernels are easy to do. My Gentoo and Ubuntu distros find all the parallels drivers and it makes it so much easier.

The bad

The only bad thing I can say is gaming. I do understand that this is not easy but it is getting closer.

Conclusion

I thank the Parallels team and hope you guys and gals keep improving and keep bring in new features for your product.

Bluefish IDE Editor

July 26th, 2010 -- No Comments

Well as a PHP, HTML, CSS, and jQuery designer one of the things I have been looking for is a good lightweight text editor. I have used many different types of editors and not found the right one. When I programmed in Windows I loved Notepad++, but there is no Mac/Linux equivalent. The editors that I have used in the past are as follows:

The last editor I was and still will use is VIM. There is times I just want to click somewhere to move my cursor, I.E. Being lazy. I really like bluefish cause it is very lightweight and fast. Eclipse and Dreamweaver just are too slow for me. Bluefish will work in Mac, Linux, and Windows. The best thing I like about it, is it is free. So take a look at them, post some comments about what you think is the best. Maybe you have one that I just have not seen.

Setting up Eclipse

April 27th, 2010 -- No Comments

I wanted to talk about how to setup your Eclipse IDE to work with Selenium, Maven, and TestNG. For those who do not know what those are you can click on the link to learn more. I will be making some more posts/tutorials on how to use these items. Eclipse can run on Mac, Linux, and or Windows. You need to have Java installed and if you want to work with SVN then you need the command line SVN client.

From the video below here is the list of the sites that you will need to add to Eclipse:

  • Maven = http://m2eclipse.sonatype.org/sites/m2e
  • TestNG = http://beust.com/eclipse
  • Subclipse = http://subclipse.tigris.org/update_1.6.x

Here is the video. Below video I will paste the code that you want to add to the pom.xml

Here is the code that is remaining

<build>
  		<testResources>
  		</testResources>
  		<plugins>
			<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4.3</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>app.env</name>
                            <value>${app.env}</value>
                        </property>
                    </systemProperties>
					<excludes>
						<exclude>**/TestUtilities.java</exclude>
					</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <skip>true</skip>
                    <failsOnError>true</failsOnError>
                    <consoleOutput>true</consoleOutput>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
  	</build>
  	<dependencies>
        <dependency>
			<groupId>net.sf.jacob-project</groupId>
			<artifactId>jacob</artifactId>
			<version>1.14.3</version>
		</dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>2.5.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>2.5.3</version>
        </dependency> 
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>oracle</groupId>
            <artifactId>oracle</artifactId>
            <version>14</version>
            <scope>test</scope>
        </dependency>
        <dependency>
        	<groupId>org.testng</groupId>
        	<artifactId>testng</artifactId>
        	<version>5.11</version>
        	<classifier>jdk15</classifier>
        	<scope>test</scope>
        </dependency>
        <dependency>
        	<groupId>org.seleniumhq.selenium</groupId>
        	<artifactId>selenium</artifactId>
        	<version>2.0a2</version>
        </dependency>
        <dependency>
        	<groupId>org.seleniumhq.selenium</groupId>
        	<artifactId>selenium-server</artifactId>
        	<version>2.0a2</version>
        </dependency>
    </dependencies>

Mplayer Playlist

March 31st, 2010 -- No Comments

Ok I know this type of post is not like me but I thought I would post it since I needed to research on how to do this. Well a lot of my developement is done in the Linux environment. All my music comes from CD’s or purchases from iTunes. In the Linux realm I have found that purchased music is not liked. So when I program in the Gentoo I mount my iTunes music folder. Since I am in command line most of the time I use Mplayer to listen to my music. So I needed to figure out how to tell Mplayer to play everything in my Music folder. I got tired or having to pick a new song all the time. So let me show you how I did this.

Ok the first thing you want to do is run the following command from my home directory to create the playlist:

jcostanzo@virtual-gentoo ~$ find /media/prl/iTunes\ Music/ > myMusic

Now the two things you would need to change is where the main folder of your music is and the other thing is what you want to name your playlist. Instead of myMusic you could say JohnsPlaylist. Now that you got the playlist to run it you would run this command

jcostanzo@virtual-gentoo ~$ mplayer -playlist ~/myMusic

If you want to shuffle the playlist you would do

jcostanzo@virtual-gentoo ~$ mplayer -playlist ~/myMusic -shuffle

Well I hope this might have help some other people who maybe had the same struggles I did.

Categories: General, Linux / BSD

Hosts File

March 25th, 2010 -- No Comments

As a web developer one of the tools that I love to use is built right into the operating system. I have come across some jobs where the coder has coded everything in absolute paths. Let me show you an example of an absolute path and a relative path.

….

Absolute Path
<a href="http://www.jcwebconcepts.com/index.php">Home</a>
 
Relative Path
<a href="index.php">Home</a>

As you can see there is a little difference. So now you may ask why is this an issue. Well if you are like me and like to test stuff on a local server first, then you will run into some issues. If your page calls an file it will call it from the remote server and not the local one. There are other examples but I will spare you of them. Lets get to this hosts file.

The hosts file exists in modern day operating systems. You can find it in Linux, Mac, Unix, and or Windows. Let me show you where these files exist.

Linux (Most distros)/Unix
/etc/hosts
 
Mac
/etc/hosts
 
Windows
C:\Windows\system32\drivers\etc\hosts

Here is an example of what a host file looks like

Linux Host File

So now let me show you some magic. So now on your testing box I would add a new entry. It can be added anywhere you want. So add this line

127.0.0.1     http://www.jcwebconcepts.net
127.0.0.1     http://jcwebconcepts.net
127.0.0.1     www.jcwebconcepts.net
127.0.0.1     jcwebconcepts.net

Of course you could substitute with any domain. So now when you test your files/scripts and the point to the absolute path you will pointing to your local box. Of course when you are done I like to comment that out. Just in case I forget that I have that and I want to look at the remote site. Now if you want to see the test environment on another computer the line you add to the host file will be different. First get your IP of the test box. Mine is 192.168.2.120

192.168.2.120     http://www.jcwebconcepts.net
192.168.2.120     http://jcwebconcepts.net
192.168.2.120     www.jcwebconcepts.net
192.168.2.120     jcwebconcepts.net

So you can start to see the things you can do with the hosts file that can help you. Instead of recoding all those absolute paths to relative you can edit the hosts file and test it that way.

Here is a video that explains some of this

CentOS (My Thoughts)

March 17th, 2010 -- No Comments

When I first learned Linux about 12 years ago I started off using Red Hat. You guys who have used it long enough remember the day when you wanted to install an app you had to not only download the application but 5 or 6 dependencies. In todays world that has changed. Things have been made so much easier. Thru the years I have used different distributions from Red Hat, SuSE, Fedora, Ubuntu, and CentOS. If you have used the Fedora and Red Hat land distro’s then you are not going to have much of a problem.

To do a net install it is not as easy like the other distro’s but if you have seen one version of Linux you have seen them all. The big thing about CentOS that I really like is that apps are tested fast and properly. Updates seem to be coming before some of the other versions of Linux. For now I use CentOS to try to stay on top of it to keep my knowledge up on some of these distributions. So go try and download a copy and throw it in a Virtual environment. See what you think and post a comment if you have a different opinion or question(s).

Categories: General, Linux / BSD, Servers

NAS Server. Should I or Should I Not

March 2nd, 2010 -- 1 Comment

For the people who do not know what NAS stands for, it stands for Network-attached Storage. Do you have an old computer that is just sitting there collecting dust? I for one when I bought my iMac and MacBook my Dell became a dust collector. So one day I decided I needed to set something up to backup my files. I know I could have burnt stuff to DVD or buy an external hard drive to store them on.

Now for the Mac I could use a portable HD to setup Time Machine. Now my concern with Time Machine is that as far as I know you can only use it for one computer. Now I have not researched it so I could be wrong. With the external if you do run multiple operating systems like Linux or Windows then you have to worry about how you format your HD. Also if you buy a portable that needs a power source then I need to fiddle behind my desk to plug in the power adapter for the HD. What a mess I’ll tell ya.

Now if you have the luxury of having a dual layer burner you could burn all your backup data. Now I will tell you that data that does not change I still put to DVD but why waste it all for stuff that changes. You then need to setup databases or spreadsheets on what stuff is on what DVD or CD. I do not know about you but I would not want to worry about all that stuff.

So this brings me to setting up a NAS server. All you need is a computer with a decent size hard drive and if you want to hide it a wireless card. The other option here is buying a time capsule cause that is basically a NAS server. So if you decide the old computer you then have 2 choices for the OS that I would use. One is FreeNAS which is based off FreeBSD and the other would be Ubuntu. I basically chose Ubuntu cause I can run other things off it like a web server and set it up as a puppet master for some of my virtual machines.

So what are you going to choose? Do you have any opinions on what you think about storage backups? Post a comment and let us know what you believe the is the best backup solution.

Ubuntu Web Server Part 2

January 30th, 2010 -- No Comments

Since posting my tutorial on running a web server on Ubuntu 9.10, I have had some questions on some of the next steps. So in this tutorial I want to discuss what you want to do to get your web server on the internet. I want to discuss on how to set it that a standard user can edit files in the web directory.


Categories: Linux / BSD, Servers, Tutorials

Using Expect

January 7th, 2010 -- No Comments

Are you running a Linux or Unix server that there are process you need to automate? Is there a daily process that are just a waist of your time but not to your server? There is a nice application called Expect that can help you with this. This application can handle several protocols. Some are ssh, telnet, ftp, passwd, fsck, rlogin, tip, etc… This application does not need a server it is just a client. The client is installed where your script will run from. The nice thing about expect is the file can be executed on a webpage as well. So let me show you an example script:

#!/usr/bin/expect
 
###Usage: call the file with a username.
 
spawn ssh -i /var/employee/includes/id_rsa root@10.10.1.12
expect "The authenticity of host '10.10.1.12 (10.10.1.12)' can't be established.
RSA key fingerprint is 47:4a:6a:ce:65:99:e2:93:2b:7t:a9:48:19:64:f6:28.
Are you sure you want to continue connecting (yes/no)?"
send "Yes\r"
expect "root@10.10.1.12's password:"
send "iamthegreatone\r"
expect "#"
send "cd /home\r"
expect "#"
send "rm -Rf $argv\r"
expect "#"
send "cp -a default/ $argv\r"
expect "#"
send "chown -R $argv:513 $argv\r"
expect "#"
send "exit\r"
expect eof

This script is executed by running the following:

root@john-server:~# expect thefilename.exp john

This is a script I use at work to reset my users profiles when they mess them up. As you can see then when you run the file you must pass an argument. So in this case you ssh into the server that has the user directories pass the name of the directory. So this script will remove the current users directory and cp the default profile directory to theirs. It will then set the right permissions for the user. Note: The group 513 may be different from server to server.

Now you do not need to use ssh or anything like that. So if you want to have the script live in the same box you can remove the SSH information. Hope this helps and give it a try it is a nice tool.

Python Basics

December 23rd, 2009 -- 1 Comment

If you have been reading previous blog posts, I have been using a monitoring tool called Zenoss. Under the hood there is a lot of Python stuff. So I decided to start learning Python. Python can run on Mac, Linux, Unix, and Windows. Let me show you some basic on what you can do in python.

#!/usr/bin/python
 
firstName = "John"
lastName = "Costanzo"
 
# Lets just print out one variable
print firstName
 
# Now lets complete my name
print firstName, lastName
 
# Lets just print something random without a variable
print "The sun is warm. The grass is green"
 
# Now I will print some variables followed by some text
print firstName, lastName, "Is the owner of this blog."

For more information on Python you can visit this site.