## How to Figure Out Relative Humidity with PHP

Today, I had to calculate relative humidity using PHP and I have documented my findings below:

First, let’s just use an example situation where we have a temperature of 60.1 and a dew point of 42.7, both in Fahrenheit, so…:

dew point in Fahrenheit: 42.7

temperature in Fahrenheit: 60.1

1) The first step is to convert to Celsius using the following formulas
Tc=5.0/9.0*(Tf-32.0)

Tdc=5.0/9.0*(Tdf-32.0)

Formulas explained:
Tc=air temperature in degrees Celsius, Tf=air temperature in degrees Fahrenheit

Tdc=dewpoint temperature in degrees Celsius

Tdf=dewpoint temperature in degrees Fahrenheit

Notice: If your temperature and dewpoint are in degrees Celsius, you can skip step 1 and proceed to step 2.

Temp in Celsius: 15.61

Tc=5.0/9.0*(Tf-32.0)
5.0/9.0*(60.1-32.0)
5.0/9.0*28.1
0.5555555555555556 * 28.1 = 15.61111111111111

dewpoint in Celsius: 5.94
5.0/9.0*(Tdf-32.0)
5.0/9.0*10.7
0.5555555555555556 *  10.7 = 5.944444444444444

2) calculate saturation vapor pressure(Es) and actual vapor pressure(E) in millibars:
NOTE: first line is the equation and the subsequent lines represent one step solved at a time:
Es=6.11*10.0**(7.5*Tc/(237.7+Tc))
Es=6.11*10.0**(7.5*15.61/(237.7+15.61))
Es=61.1 ** (7.5*15.61/(237.7+15.61))
Es=61.1 ** (117.075/253.31)
Es = 61.1**0.4621807271722395
Es = 6.6907349413770067935260257174923

E=6.11*10.0**(7.5*Tdc/(237.7+Tdc))
E=6.11*10.0**(7.5*5.94/(237.7+5.94))
E=61.1 ** (7.5*5.94/(237.7+5.94))
E=61.1 ** (44.55/243.64)
E=61.1 ** 0.1828517484813659497619438515843
E = 2.1211957981192776150462474985589

3)  Once you have the saturation vapor pressure and actual vapor pressure, relative humidity(RH) can be computed by dividing the actual vapor pressure by the saturation vapor pressure and then multiplying by 100 to convert the quantity to a percent:
RH =(E/Es)*100
RH =(2.1211957981192776150462474985589/6.6907349413770067935260257174923)*100
RH = 0.31703479762758596814611114744566 * 100
RH = 31.703479762758596814611114744566%
SO… Humidity is 31.7%

And note here that ** means to the power of. I figured I’de clue anyone in that is as ignorant is I was when I had to figure it out.

## You Can Now Contribute Web Development Content

Jafty Interactive Web Development has decided to start accepting user contributed blog posts! You can now submit any post that is related to out blog theme of web development and it will be published after admin moderation. Along with posting articles, they even teach their clients where to find a cheap web design which can help them save a ton on the marketing sector of their business. Jafty also is in association with many SEO audit services, which’ll only increase the exposure we get on your submitted blogs. As long as it is on topic and I think it improves the quality of my blog, it will probably be published. Some topics I picked from https://onlinemoneypage.com/ and would like to encourage users to submit posts about include:

• PHP
• JavaScript
• HTML
• XML
• CSS
• Search Engine Optimization/SEO and The best service curating it
• Freelancing as a web developer
• Freelance writing
• working from home
• Laravel
• WordPress
• C Languages
• Java
• ASP.net
• JQUERY
• Ruby on rails
• MySQL Database
• SQL
• PHP and MySQL
• Linux Command Line
• Linux and Windows Servers
• MAC and web development
• PC vs MAC
• Mobile Development
• Mobile website optimization
• PERL
• AJAX
• CURL
• Graphics
• anything else related to web development!

That’s just a list to fuel your mind. Feel free to submit any related topic. I will accept anything related to web development. I’m looking forward to some great blog posts! – Ian L.

# CodeLobster PHP Edition Software Review

Written by Ian Lincicome of Jafty Interactive Web Development – Jafty.com

For the past couple of weeks, I have been evaluating CodeLobster’s latest release of “CodeLobster PHP Edition” which I’ll refer to as simply “CodeLobster” from here on out in this review. The current edition at the time of writing this review was CodeLobster PHP Edition Professional Version 5.4. I am reviewing CodeLobster because I am looking for a tool I can use for my web development business, Jafty Interactive Web Development. Also I was given a break on purchasing the pro version of CodeLobster in exchange for writing a product review on my site, Jafty.com. Please note that I am under no obligation to write a positive review. I will be as brutally honest as ever, I assure you. This review will include both the pros and cons of using CodeLobster rather than a one-sided review like many company’s probably hire writers to write. In fact, if that was my intention, I wouldn’t have mentioned that the someone had asked me to write this review. My ulterior motive for writing the review is to find the perfect program to do my work for my business. The rest of the sectors, like recruiting a marketing team and hiring Salesforce support services have been taken care of. I am also evaluating other products as well because I want to work with the best.

I’m looking for an application that will allow me to seamlessly edit several types of code on several different servers without having to use a separate code editor, FTP program, web browser and Language reference material. To this date, I have been using three separate applications to accomplish my day-to-day work. I used FileZilla to copy files from a client’s web server to my desktop. I used Notepad++ to edit the code files. Finally, before using FileZilla again to upload the files back to the client’s server, I viewed the file in Firefox to see how it looks in a browser. That is if it is not a server-side language like PHP which I use the most. If I had to edit a PHP file, I had yet another couple of steps to perform because I’d have to upload the file to the server to view it and then repeat the whole entire process again if I had more changes to make to get it perfect. So I used FileZilla, Notepad++ and Firefox mostly up until now. I figure I could probably almost double my productivity with one good tool that does it all.

## Technologies CodeLobster Supports

CodeLobster supports a wide range of technologies including:

• PHP
• HTML
• JavaScript
• CSS
• SQL
• MySQL
• Version control systems such as SVN, Git etc.
• CakePHP
• CodeIgniter
• WordPress
• Drupal
• Joomla
• jQuery
• Smarty
• Symfony
• Yii

CodeLobster also has a very wide assortment of features including all the standard components you would expect in a code editor and many extras. I found a helpful built-in Help feature that also links to online help if you can’t find what you need in the built-in documentation. The online documentation is surprisingly complete for a newer product.

## Installing CodeLobster

When I first installed CodeLobster, it allowed me to select what languages/technologies I wanted to install. I only deselected two that I knew for sure I would most likely never use. I figured if there was even a small chance that I might use one of the items listed, then I should leave it checked. That way I will be prepared in case I need that particular technology in the future.

## Pros and Cons

Once I began using CodeLobster I noticed both good and bad points regarding the program. I loved how versatile the program was right out of the box. I did not like the way the word wrap feature worked(View/Word Wrap). It breaks up words rather than splitting lines by the nearest space. I’d prefer it to not break up words at all or at least do so in a more logical manner(by syllables with hyphens for example). From what I understand from reading the forums and talking with my contact, CodeLobster plans to add an option between soft and hard word-wrap. Hard wrap is how it is now and soft wrap would be a word-wrap technique that doesn’t break up words. I do hope they add it soon because it was one of the of the first things I noticed.

One of the first features I noticed and liked was the completely configurable hot-keys. You can configure any hot-key by going to Tools/Preferences/IDE/Hot keys. Another nice feature is the Find and Replace feature that is very much like that of Notepad++ including regular expression search and the ability to search and replace text in files, folders and sub-folders. This can be a huge time-saver for coders.

One of the first things I noticed and did not like was the lack of a decent spell checker. I know notepad++ has the option as a plugin, but not as a built-in feature. Either way would be great, but I think it should be a standard built-in feature. I realize that auto-complete helps with this, but not if you are writing a plain text file such as I am doing right now while writing this review. I talked to my contact at CodeLobster Software about this and he assured me that they plan to add a robust spell-checking feature in the near future. He mentioned that they plan on making several additions to the software and will be releasing future editions with new features and improvements ASAP. So, while CodeLobster may not have everything I would like it to have at the moment, I was assured that they are heading in the right direction with future expansion plans.

Another nice feature I also noticed right away was CodeLobster’s tool bars. The tool bars are completely configurable and have a nice drag and drop feature to move tool bar items around as you please. The same can be said for the man different windows that can be added or removed from the work area.

CodeLobster is a code editor first & foremost and it does a wonderful job at editing PHP code which is my code of choice. If you are looking for a word processor, CodeLobster probably won’t fit the bill, but it is a very robust code editor that can handle all of the languages I use for web development and several others.

CodeLobster’s plugin ability is great to have in a code editing program. The pro version of CodeLobster comes with many plugins that the free version does not include from what I understand, so I think the pro version is definitely worth the cost for those of you who work with frameworks such as WordPress, Joomla, CakePHP, CodeIgniter, etc. I currently own the Pro version and I am happy with its performance so far and will be much happier once some of the additions are made in the near future.

Even the free version would be great for coders who use many different coding languages regularly but don’t need the extra plugin abilities that require the pro version. As a full-time web developer, I mostly use PHP, HTML, CSS, JavaScript, WordPress and MySQL. I also occasionally use Joomla, XML, Perl, Python, Drupal, Smarty, Laravel, CakePHP and others, so I require the Pro version of CodeLobster myself. If you only use the most common languages such as PHP, HTML, CSS and JavaScript, you can probably do fine with the free version. Some of the things I require the Pro version for include WordPress support, Smarty, Laravel and CakePHP. Honestly there are to many features to list here. You should visit their web page at http://www.codelobster.com/details_phped.html to figure out which version is best for you. They also have a Lite version which you can read about on their site since I won’t be covering CodeLobster Lite here.

As I continue to evaluate the software I am finding there are more and more features that I like. As a web developer, I need a tool that allows me to quickly edit code, test it and upload it to the client’s server. So far, CodeLobster seems to be meeting my three main requirements quite well in most cases.

## FTP Feature

CodeLobster’s FTP ability is a very powerful feature. The FTP feature allows you to set up as many FTP connections as you need. I was able to copy all of my client’s FTP connections from FileZilla into CodeLobster. Now I am able to click on a connection, edit a server file, preview it and upload it back to the server seamlessly from within a single application! This is huge for me because I used to use at least three different applications to do the same thing without CodeLobster. I can see that my work will get done a lot faster by using CodeLobster. In fact, I am already getting work done faster after only two days of using it.

The FTP feature is very functional, but for a guy like me who hates to read instructions, it took a little bit of fooling around using trial and error methods to get it set up for the first time with all of my client’s 20+ FTP connections and configuring basic settings. Everything I needed to accomplish my FTP tasks is in CodeLobster, but the FTP system does need some improvements. For example it gave me trouble when trying to connect to a SFTP connection. It worked great with all non-secure FTP connections however. As luck would have it, out of over 20 current clients I work with, only one uses SFTP rather than FTP, so I am unable to test it on other secure SFTP servers to see if the problem is just with this one server or not. Unfortunately this is one of my regular clients so it is going to be a problem for me. It did connect using SFTP, but had issues when trying to edit files on the server which I was able to do fine with regular FTP connections. I did bring this issue to the attention of my CodeLobster contact however and he assures me it will be looked into ASAP.

Regarding the GUI set-up for FTP, in my personal opinion, the way the windows are organized in the work area could have been done a little better. For example, when I use FTP, I have to go to Tools/FTP to open the explorer window that lists FTP connections. That alone will allow you to open your FTP connection but won’t allow you to see what’s going on. If there was an error and the only window you had open in your work area was the explorer window, you wouldn’t see that error. This is where I think it could have been done better. I would have programmed it so that when you open the FTP window, the output window opens along with it, right above it, similar to how FileZilla allows you to view console output. Of course this is just my opinion, it may not bother others and actually I am starting to get used to it so it doesn’t bother me as much as time passes.

## Search Features

The “Find in Files”(Search/Find in Files…) feature is great for finding text in open files. It could be improved to allow file search on the local directory tree files as well, but it is sufficient the way it is. Also I love the regular expression search as I mentioned earlier.

Also, I often use the incremental search feature when I edit code. While I am glad it has this feature, a small nuisance for me is that the incremental search box is not persistent across different views. I think it would be nice if the incremental search box would stay at the bottom of all view tabs once it is opened. I don’t think it should close unless you manually close it. Again, this is just my preference, not a bug.

## Nice-to-Have Features

One more thing I liked while test driving CodeLobster is that when editing .html and .css files I could hover over class names in the HTML or CSS code and it would show me the associated style declaration. Also when hovering over items in a .css file, it shows me information regarding the browser compatibility of the CSS code.

The HTML preview feature works very well. It is a built-in browser that shows the results of your code live without having to open a separate browser window. All you do is click on the “preview” tab. I did notice that sometimes you have to hit the refresh button to see your changes, but that is to be expected.

I also enjoyed the code formatting features very much. I tested them on an HTML file that I copied from an online web page. At first the HTML code was ran all together with no line breaks or indents. I simply went to the tool bar and clicked “Tools/Code Format/Format” and it formatted it perfectly. I am sure it will work with other supported languages equally well.

When you double-click on a variable name in the PHP editor, it highlights the variable and the dollar sign, so you can copy the whole thing and paste or search for it easily. Notepad++ wouldn’t include the dollar sign and it was a bother to me.

CodeLobster has what they call a “Map” feature(View/Windows/Map) that I’ve never seen before. It is basically a small window with a tiny view of the document you’re working on. It allows you to click anywhere in the Map to quickly jump to a section of the file that you need to work on. It is a great feature for working with large files.

## Conclusion

I have concluded that CodeLobster will indeed fill a need in my current web development process. It is not yet developed enough to be the only tool I use simply because of that one SFTP connection it will not work correctly with. However I found that I can combine it with another tool, CyberDuck, as a work-around until the developers of CodeLobster work out the final kinks in the software and add some more nice-to-have type features such as spell-check and . In the end it still gets a thumbs up for all the wonderful features it has and for its robustness in general. Eventually I believe it will make the perfect all-in-one coding tool for my company. The other contender for my new all-in-one coding tool was CyberDuck and I can honestly say that CodeLobster has much more potential. CyberDuck is also in its early stages of development and it needs several improvements to be truly useful. CyberDuck fails in comparison to CodeLobster when it comes to Features. CodeLobster is truly made to be an all-in-one coding solution while CyberDuck is missing many of the necessary features to be a real competitor.

If you are interested in how I combined CodeLobster with CyberDuck to make up for CodeLobster’s short-coming when connecting by SFTP, I’ll quickly go over how to do it. Create a bookmark(that’s what CyberDuck calls their FTP/SFTP connections) in CyberDuck to the SFTP server. CyberDuck allows you to set it up so you can use your own code editor with it in a way that allows you to click on a file from a remote server and open it in that editor. Then when you save it in that editor(CodeLobster), it saves it to the server. That way I still have a seamless process even though I have to combine two tools to get what I truly want.

## Sell PHP, JavaScript, C++, C# and Other Scripts and Tools on Jafty.com

Yes, we have started a store on Jafty.com which can be found at Jafty.com/shop. Currently shoppers can find a limited collection of my own scripts and tools for sale. I would like to give my readers a chance to sell their own script and tools here as well, so I am opening it to the public upon approval by me of course. As long as I can see that your scripts are useful and have a potential that someone visiting my site will purchase them, I will publish them. To submit your script for review, simply send me an email at linian11@yahoo.com with a link to your script or attach it to the email and include the amount you expect to receive for each sale made and I will promptly give you a decision on whether or not we will sell your items on Jafty.com.

## Creating a Web Development Environment

This week, I decided it was time to upgrade my web development tools so I contacted the professionals at SEO Root and got right into business. When you reach my age and have been coding for over 20 years, you have to upgrade every once in a while. I am doing this because I know there are faster and better ways to do what I do everyday. I also wanted to document the new system I create for myself as a seasoned web developer so that those of you just starting out can gain some insight.

First, I had to layout what my needs as a web developer were. I simply made a list of the technologies I use every day and some I use regularly but not every day necessarily and ordered the list in order of priority. The first items on my list are technologies I use the most:

1. PHP
2. HTML
3. CSS
4. JavaScript
5. MySQL
6. WordPress
7. Woocommerce
8.  jQuery
9. Photoshop
10. SEO
11. Three.js 3D programming
12. FTP
13. Perl
14. C++
15. C#
16. Ajax
17. Blender
18. Gimp
19. Unity 3D Development
20. XHTML
21. XML

As you can see, I use over 20 web technologies in my day to day work and I didn’t even list them all, but those are the most significant ones off the top of my head that I use. My goal is to put together a work environment with the most important of those technologies in mind, and so have hired SEO consulting services to aid me with this. Ultimately I wish to create an environment that focuses on speed and the ability to make the top technologies I use to work together in a more organized fashion. For example an app that allows me to code in many languages and preview server-side code live in a local server would be one of the primary objectives of my new routine.

With that in mind, I am going to narrow down my above list to what I use in my day to day work from which I actually make money from and do the most. Those would be mostly the ones at the top of my list, but this gives me the opportunity to rethink what I need the most and come up with a work environment that best facilitates my needs as a web developer. Here’s what I came up with in the end:

• PHP
• HTML
• CSS
• JavaScript
• MySQL
• WordPress
• Woocommerce
• Graphic Design
• SEO
• FTP
• Perl

## Searching for Applications

My next task was to find programs and applications that will help speed up the web development process. First, I will list the programs and applications I use currently and from there figure out where I can make improvements. So I copy and paste my short-list from above and add after each technology what tool or program I use to accomplish tasks related to each technology:

• PHP ——————- Notepad++, Filezilla, Firefox, IE, Safari, Chrome
• HTML —————– Notepad++, Filezilla, Firefox, IE, Safari, Chrome
• CSS ——————– Notepad++, Filezilla, Firefox, IE, Safari, Chrome
• JavaScript ———– Notepad++ , Filezilla, Firefox, IE, Safari, Chrome
• Graphic Design – Photoshop, Gimp, Blender, Unity, MakeHuman, FileZilla, Firefox, Notepad++
• SEO ——————– Notepad++, Firefox, Various Service Providers
• Perl ——————– Notepad++, Putty, Filezilla

So from the above exercise, I was able to make a comprehensive list of the programs and applications I use when doing my web development work:

3. Filezilla
5. Firefox
6. Internet Explorer(IE)
7. Safari
8. Chrome
9. Putty
10. Photoshop
11. Gimp
12. Blender
13. Unity
14. MakeHuman

So out of those 14 programs, I don’t actually use them all everyday and I use some more than others. For example, I am more of a programmer than a graphic designer. That’s why I call myself a “Web Developer” and not a “Web Designer”. So numbers 10 – 14 on the list can go into my “Nice to Have” category and do not require crucial changes since I only use them every once in a while and it’s not a huge deal to keep using what I use now for those. If you are primarily a web designer however, these applications would be higher up on your list of tools you use and you WOULD want to give more thought to whether you can find better tools and tools that can combine the abilities of several of those. For example, Photoshop can do everything Gimp can do for the most part, so you might want to drop Gimp as a regular tool and use Photoshop more often. Then Unity, Blender and MakeHuman are all 3D modeling tools used more for video game development than web development, but if you use these regularly, you can probably search and find a tool that does most of what you need to do using those tools all rolled up in one good tool. Actually Unity is close. I try to learn to do what models and textures I can right in Unity instead of going to Blender to create them and then import them into Unity which takes more time, but sometimes it is still necessary to do.

Anyway, being first and foremost a web developer and not a designer, the tools most important to me right now are the first ones on my list and can be narrowed down to these:

1. Notepad++ is what I currently use for most of my coding needs.
2. PHPMyAdmin is a must have for all of my MySQL database manipulation needs currently.
3. Filezilla is what I always use to download files from client’s web servers. Then I edit them and upload them back to the server using Filezilla once again.
4. Firefox is my web browser of choice since it is by far the most standards compliant of all the available popular web browsers. The others listed above are only used at the end of a project to check for cross-browser compatibility and there is no real way to get around having to use them all to properly debug your web applications.
5. Putty is a great tool I also use often to access client’s web servers for just about anything that I cannot do through the Filezilla FTP program. Tasks I use Putty for include tweaking PHP settings, changing ownership of files and editing server configuration files.

The next thing I have to ask myself is where can I make improvements in my development process and what tools are involved. After that I can search for better tools to accomplish those goals. From what I gather after examining my own habits and tools that I use, I figure the most improvement can be made in the areas of FTP, Code editing and Previewing the results of the code I write.

I came up with the above conclusion by thinking about where it seems like I waste the most time. Also I kept in mind what is possible to change and I figured that recent developments in developer tools probably will allow me to be able to improve the way I edit code, the way I update files and the way I view server-side scripts while in the process of coding them. Here’s my current most common process in my day to day work routine:

1. I go to Firefox and locate the problem on a client’s website or the area of the website that they may want something added to.
2. Then, I open Filezilla and locate the files involved that need editing on the server and download them to my desktop for editing.
3. Next, I will normally open Notepad++ and work on the PHP, HTML, CSS and/or JavaScript code until a portion of the solution is accomplished.
4.  Then I have to use Filezilla again to upload that file back to the web server for testing.
5. After that, I open the webpage in Firefox to see if it works and to plan what I have to do next.
6. I go back to Notepad++ and make more changes.
7. I upload with Filezilla again and again view the progress in Firefox and keep repeating steps 4,5 and 6 until the changes appear correct.
8. Then finally, I check the progress in all other popular browsers such as IE, Chrome and Safari to make sure it all works. Again here I have to repeat steps four through six some more until all problems are resolved with cross-browser compatibility.

As you can see, there are some seriously repeated functions that can take up a lot of precious development time in my current process. The best way to speed the process up would be to eliminate the process of having to upload the files to he server every time I make a round of changes and view it in a browser then go back to notepad++. With this acknowledgement in mind, I need to find a tool that allows me to do the following important steps in my web development process:

1. edit several types of code in one place.
2. get the code to the server seamlessly for testing.
3. and view the output in a browser.

So the best place for improvement in my process is within those three steps. If I could find the perfect tool to accomplish all three, that would be perfect.

## Finding Tools to Improve your Workflow

So, while looking for tools to accomplish these feats, Here is what I found.

## CyberDuck

The first one I tried after reading reviews and program descriptions all across the web, was a not-so-well-known application called CyberDuck. After testing CyberDuck for about a week or so, I found that it met most of these needs, but had it’s pros and cons like any other application. Let’s examine those pros and cons:

### CyberDuck Pros:

• allows for the importing of FTP connection information from Filezille to CyberDuck. This is great because if you have a lot of clients like I do, you have a lot of FTP connections and it would take a lot of time to copy them all manually. In CyberDuck, they call FTP connections “bookmarks” this was strange to me and I didn’t know what they were for the first day or so, but once I figured out what they were, I was able to use the application much more efficiently.
• CyberDuck has an FTP application built in.
• It allows you to link your favorite text editor or code editor to the FTP function so all you do is click on a file in the server’s document tree and it opens in an editor on your local machine! So, it downloads a copy of the file and opens it in your editor in other words. So in my case, I click on a file in the document tree and it opens up in Notepad++ for editing.
• When I save the file after making changes in Notepad++, it automatically uploads the changes to the remote server without me having to do anything but click on “Save” in Notepad++. This saves a lot of time. Even though I am actually using two programs, CyberDuck and Notepad++, it seems like I’m only using one because there is a nice seamless integration of the two performed within CyberDuck.

### Cons of Using CyberDuck

There are not a lot of cons, but the ones that bothered me were:

1. It drops the connection to the server more often than Filezilla did it seems like.
2. While it combined two of my three main functnionalities I was seeking, it did not allow for viewing of the code changes live on the server. I still would have to go to Firefox to do that.

All in all, CyberDuck is a great tool. It is still new and has some bugs to work out, but I will definitely follow it and use it while looking for a better solution. Perhaps it will evolve into that perfect solution in a future version. Who knows.

## CodeLobster PHP Edition

Next I got an email to let me know of a new program called CodeLobster that was supposed to be the perfect PHP code editor and much more. I am giving it a try right now, so I’ll have to come back with most of my review of CodeLobster, but right out of the box I notice that it has a wide range of code editing abilities and features, is expandable and very well made. The only drawbacks I’ve noticed so far are minor such as the word wrap feature breaks up words in bad places and there is no spell check that I can find for editing plain .txt files. It seems great for editing PHP code so far though.

To get expert help regarding SEO and web designing, go to TheDigitalSwarm.com and opt for their services.

 <br /> <br /> <br /> <br />

## Edit Files Live on the Server

I’ve been a web developer for many  years now and I must say I feel a little foolish for not thinking of this earlier. I’ve been wasting countless amounts of time waiting for files to upload and doing the mundane tasks involved in updating files and uploading them to a server when I didn’t really have to. Here’s why.

Today I got fed up with editing my file in Notepad++, switching to Filezilla,  finding the file in a folder on my desktop, uploading the file by dragging it to Filezilla and finally testing my online website or app. I decided to Google the term “Edit files live on server” and found https://cyberduck.io/ that has an amazing product which allows you to type in your FTP details, just like I used to in Filezilla, and open a connection to my server. Then it gives me a directory tree on my server. CyberDuck allows me to click on any file on my server and open it in Notepad++ on my desktop, edit it and save it right back to the server without having to click and drag it to another program like I used to do for so many years.

## Perl Scalar Variables

Scalar variables are perhaps the most basic and commonly used variables in Perl, so let’s learn what they are and how to use them.

## Scalar Definition

When I first heard the term “Scalar Variables”, my first thought was: “What does Scalar mean? Well maybe some of you already know this, but for those that don’t, Scalar, by definition reads something like:

1. In mathematics, scalar can be a noun or adjective that refers to a quantity consisting of a real number used to measure size or magnitude such as voltage, mass and temperature. The temperature is a scalar quantity.
2. In Perl, a scalar variable is used to represent a block of information. A scalar may refer to an integer, a float, a string, an object, binary information, etc. It’s a versatile variable with no length limit. In Perl code it is preceded by a “\$”.

Had I even been armed with the above definition I would have been less ignorant, but I had to learn this and now so have you if you didn’t already know. I thought this was important. Sorry if you already knew and I’m wasting your time, but please read on!

Perl has three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as “hashes”.  A scalar is a single string of any size, number, or a reference to something. Normal arrays are ordered lists of scalars indexed by number, starting with 0. Hashes are unordered collections of scalar values indexed by their associated string key.

Scalar variables in Perl use automatic conversion. This means they do not and cannot be declared as a string, number etc. They do that automatically according to content.

## Special Perl Variables

Based on usage, special variables in Perl can be classified into the following basic categories. Remember, even special variables are scalar in nature whether they are known by scalar variables, arrays or hashes. Next we list each possible category of Perl special variables:

## Global Scalar Special Variables

Here is the list of all the scalar special variables. We have listed corresponding english like names along with the symbolic names.

 \$_ The default input and pattern-searching space. \$ARG \$. The current input line number of the last filehandle that was read. An explicit close on the filehandle resets the line number. \$NR \$/ The input record separator; newline by default. If set to the null string, it treats blank lines as delimiters. \$RS \$, The output field separator for the print operator. \$OFS \$\ The output record separator for the print operator. \$ORS \$” Like “\$,” except that it applies to list values interpolated into a double-quoted string (or similar interpreted string). Default is a space. \$LIST_SEPARATOR \$; The subscript separator for multidimensional array emulation. Default is “\034”. \$SUBSCRIPT_SEPARATOR \$^L What a format outputs to perform a formfeed. Default is “\f”. \$FORMAT_FORMFEED \$: The current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. Default is “\n””. \$FORMAT_LINE_BREAK_CHARACTERS \$^A The current value of the write accumulator for format lines. \$ACCUMULATOR \$# Contains the output format for printed numbers (deprecated). \$OFMT \$? The status returned by the last pipe close, backtick (“) command, or system operator. \$CHILD_ERROR \$! If used in a numeric context, yields the current value of the errno variable, identifying the last system call error. If used in a string context, yields the corresponding system error string. \$OS_ERROR or \$ERRNO \$@ The Perl syntax error message from the last eval command. \$EVAL_ERROR \$\$ The pid of the Perl process running this script. \$PROCESS_ID or \$PID \$< The real user ID (uid) of this process. \$REAL_USER_ID or \$UID \$> The effective user ID of this process. \$EFFECTIVE_USER_ID or \$EUID \$( The real group ID (gid) of this process. \$REAL_GROUP_ID or \$GID \$) The effective gid of this process. \$EFFECTIVE_GROUP_ID or \$EGID \$0 Contains the name of the file containing the Perl script being executed. \$PROGRAM_NAME \$[ The index of the first element in an array and of the first character in a substring. Default is 0. \$] Returns the version plus patchlevel divided by 1000. \$PERL_VERSION \$^D The current value of the debugging flags. \$DEBUGGING \$^E Extended error message on some platforms. \$EXTENDED_OS_ERROR \$^F The maximum system file descriptor, ordinarily 2. \$SYSTEM_FD_MAX \$^H Contains internal compiler hints enabled by certain pragmatic modules. \$^I The current value of the inplace-edit extension. Use undef to disable inplace editing. \$INPLACE_EDIT \$^M The contents of \$M can be used as an emergency memory pool in case Perl dies with an out-of-memory error. Use of \$M requires a special compilation of Perl. See the INSTALL document for more information. \$^O Contains the name of the operating system that the current Perl binary was compiled for. \$OSNAME \$^P The internal flag that the debugger clears so that it doesn’t debug itself. \$PERLDB \$^T The time at which the script began running, in seconds since the epoch. \$BASETIME \$^W The current value of the warning switch, either true or false. \$WARNING \$^X The name that the Perl binary itself was executed as. \$EXECUTABLE_NAME \$ARGV Contains the name of the current file when reading from .

## Global Array Special Variables

 @ARGV The array containing the command-line arguments intended for the script. @INC The array containing the list of places to look for Perl scripts to be evaluated by the do, require, or use constructs. @F The array into which the input lines are split when the -a command-line switch is given.

## Global Hash Special Variables

 %INC The hash containing entries for the filename of each file that has been included via do or require. %ENV The hash containing your current environment. %SIG The hash used to set signal handlers for various signals.

## Global Special Filehandles

 ARGV The special filehandle that iterates over command line filenames in @ARGV. Usually written as the null filehandle in <>. STDERR The special filehandle for standard error in any package. STDIN The special filehandle for standard input in any package. STDOUT The special filehandle for standard output in any package. DATA The special filehandle that refers to anything following the __END__ token in the file containing the script. Or, the special filehandle for anything following the __DATA__ token in a required file, as long as you’re reading data in the same package __DATA__ was found in. _ (underscore) The special filehandle used to cache the information from the last stat, lstat, or file test operator.

## Global Special Constants

 __END__ Indicates the logical end of your program. Any following text is ignored, but may be read via the DATA filehandle. __FILE__ Represents the filename at the point in your program where it’s used. Not interpolated into strings. __LINE__ Represents the current line number. Not interpolated into strings. __PACKAGE__ Represents the current package name at compile time, or undefined if there is no current package. Not interpolated into strings.

## Regular Expression Special Variables

 \$digit Contains the text matched by the corresponding set of parentheses in the last pattern matched. For example, \$1 matches whatever was contained in the first set of parentheses in the previous regular expression. \$& The string matched by the last successful pattern match. \$MATCH \$` The string preceding whatever was matched by the last successful pattern match. \$PREMATCH \$’ The string following whatever was matched by the last successful pattern match. \$POSTMATCH \$+ The last bracket matched by the last search pattern. This is useful if you don’t know which of a set of alternative patterns was matched. For example: /Version: (.*)|Revision: (.*)/ && (\$rev = \$+); \$LAST_PAREN_MATCH

## Filehandle Special Variables

 \$| If set to nonzero, forces an fflush(3) after every write or print on the currently selected output channel. \$OUTPUT_AUTOFLUSH \$% The current page number of the currently selected output channel. \$FORMAT_PAGE_NUMBER \$= The current page length (printable lines) of the currently selected output channel. Default is 60. \$FORMAT_LINES_PER_PAGE \$- The number of lines left on the page of the currently selected output channel. \$FORMAT_LINES_LEFT \$~ The name of the current report format for the currently selected output channel. Default is the name of the filehandle. \$FORMAT_NAME \$^ The name of the current top-of-page format for the currently selected output channel. Default is the name of the filehandle with _TOP appended. \$FORMAT_TOP_NAME

## Understanding Perl Variables and Arguments

This is my third tutorial in the Perl tutorial series. This Perl tutorial will demonstrate how to use basic variables and command line arguments in a simple Perl script.

### Prerequisites

If you don’t have Perl installed yet or haven’t done the hello world tutorial, here are their respective links since the information is vital to successfully competing this tutorial if you are new to Perl:

Getting Started with Perl(installing Perl)

Writing Your First Perl Script(hello world)

## Declaring Perl Variables

I recall my first day using Perl. I tried to use variables like I normally would in PHP, like:

\$var_name = “some value”;

Well, that doesn’t work in Perl. You’ll get an error that says something like “perl global symbol requires explicit package name at…” Variables in Perl need to be declared with “my” like this:

my \$var_name = “some value”;

That works without throwing the previous error.

## Using Perl Command Line Arguments

Commend line arguments are values passed to a Perl script that are used in some fashion within the code. Name, File name, path, phone no. and URL are some possible examples of arguments often passed to to a Perl script via the command line.  For the purposes of this tutorial we are just going to pass two simple words, one and two to the script and print them to the screen with Perl code. We will name our script test1.pl and this is how it will be called passing “one” and “two” as arguments. Type this at the command prompt in your shell:

perl test1.pl one two

## The ARGV Array

Perl command line arguments are neatly packaged up for us in the ARGV array and can be accessed like this:

the first command line parameter in our example was “one” and it can be accessed like the following example using the \$ARGV[0] line:

my \$arg1=\$ARGV[0];

…and the second argument passed, “two”, would be accessed using:

my \$arg2=\$ARGV[1];

Notice that, just like in PHP and other popular languages, the arrays start at 0 so the first argument is identified with 0 and the second with 1.

Let’s put together what we’ve learned here into a working script called test1.pl. Here are its contents:

#!/usr/bin/perl
#Perl Script to demo variables and arguments
# Strict and warnings are normally recommended.
use strict;
use warnings;

#arguments = dict file & word string
my \$arg1=\$ARGV[0];
my \$arg2=\$ARGV[1];
# Print a message.
print “argument 1: \$arg1\n”;
print “argument 2: \$arg2\n”;

Use a simple text editor such as notepad and copy the above code to a blank file and save it as “test1.pl”. Upload test1.pl via FTP and open a command prompt to to your server. Change to the directory where you uploaded the test1.pl file and type at the command prompt:

perl test1.pl one two

…or perl test1.pl followed by any two words you wish to pass to the script and see printed to the screen. Running the script above produced:

Summary

As you can see from our image, executing our test1.pl script will product:

argument 1: one

argument 2: two

Hopefully you now understand how to use simple variables and command line arguments with Perl now. Be sure to read my next tutorial to learn more! Check out Perl Scalar Variables to learn more about basic Perl variables

## Writing your First Perl Script

This simple Perl tutorial will demonstrate how you can write, install and run your first Perl script. First, you need to be sure you have Perl installed and install it if needed. To check for Perl and install as needed, see my first Perl tutorial, Getting Started with Perl for instructions on checking for and installing Perl and it’s dependencies.

## Perl Hello World Script

As the long time tradition of learning code dictates, we’ll start out with the simplest of Perl Scripts, the hello.pl file. Copy and paste or type the following content into a new document using notepad, notepad++ or another very simple word editor. Do not use a complex one such as MS Word as it includes unseen characters that will mess your code up. Without further delay, here is the Perl hello.pl file:

#!/usr/bin/perl
#Perl Hello World Script
# Strict and warnings are normally recommended.
use strict;
use warnings;
# Print a message.
print “Hello, World!\n”;

## Run your First Perl Script

Save the above example code in a file named hello.pl and upload it to a directory you can easily find and access via a command prompt or shell on your server. I upload my Perl scripts to /home/ec2-user which is the default directory on an Amazon Linux server when logging in as ec2-user, but any directory will work if it is given permission. Follow these few simple instructions to upload and run hello.pl:

1. Use an FTP client such as Filezilla to upload your hello.pl file
2. Use Putty to open a shell command prompt and change to the directory you uploaded hello.pl to using the cd /path/directory command.
3. Once in the same directory as the hello.pl file, you can simply type “perl hello.pl” at the command line and it will execute your script. Congratulations! You just ran your first Perl script. Happy coding!

Here is what it looks like when you run the hello.pl script as described above:

## Summary

As you can see, all it does is prints “Hello, World!” to the screen on the next line in your shell. Not much, but it’s a great first step to learning Perl. Now you should have Perl installed(see Installing Perl) and know how to create and execute a simple Perl script.

## Getting Started with Perl

Perl is an advanced programing language with over 26 years of development behind its belt, so I have decided to take it seriously and provide Perl tutorials on Jafty.com starting at the beginner level and progressing through more advanced Perl programming techniques.

# Beginning with Perl

Perl does have different versions, but to keep it simple, we are going with the more popular stable version 5 of Perl. There is a version 6 of Perl, but it is a different language that is not yet as widely supported as version 5. Version 6 may have its own use cases that differ from version 5, but for most people’s needs, version 5 is currently preferred and probably will be for some time. That’s not saying that you shouldn’t check out version 6 also, just try version 5 first is what I am recommending for simplicities sake alone. There is also a version 4 that is quite outdated an no longer considered for serious new development use. Type “perl –version” at a command prompt to find out what version you have or read on for more detailed information.

Let’s get started by installing Perl. If you already have Perl installed, you may skip to the next tutorial, Writing your first Perl script. If you are not sure, read on and we will show you how to find out. Here is the basic process:

1. check to see if Perl is installed. If it is, you can skip the rest of this tutorial and move on to writing your first Perl script.
2. Check if gcc compiler is installed and if it is not, this is typically installed first. The other option is to install gcc and Perl simultaneously which we will get into later in this tutorial.
3. Install Perl and gcc as needed.
4. Write your first Perl script to test Perl.

## How to Check for Perl Installation

Before you proceed to install Perl, you should make sure you don’t already have it because many servers come with it. The easiest way to check for Perl is to type “perl -v” at your command prompt from a shell console window. Here are example results if you do have it already:
[ec2-user@ip-172-30-0-9 ~]\$ perl -v

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 25 registered patches, see perl -V for more detail)

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using “man perl” or “perldoc perl”.  If you have access to the

The first line above is the command prompt with only “perl -v” typed after it and the remaining lines are the response on a server with Perl 5 installed and working.

## How to Install Perl

Here is a brief guide on installing latest stable version of Perl 5 on a Centos, Red Hat, Linux server. I did it on an Amazon cloud server, but the process is the same on any similar Linux flavor that supports YUM.

## Check for GCC

As always before installing something on your server, check to make sure it is not installed already. I am always surprised to find something on my server that I didn’t know was there, but it does happen quite frequently. In the following example, the first line contains the command prompt followed by the command to check for the gcc compiler which is “gcc –version”. The remaining lines in brown text are the result of the gcc –version command in cases where gcc does exist on the server already:
[ec2-user@ip-172-30-0-9 ~]\$ gcc –version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not get a similar response, then you need to install gcc for sure and most likely Perl too, so read on!

## Installing a Developer Package using YUM

The easy way to get gcc and alot of other useful developer tools is to use YUM to install a group of software known as the Yum Developer Tools group. Available groups in Yum can be shown at the command line by typing “yum group list”. Here are actual results from my server:

In the above screenshot the Developer Tools group has already been installed. If you run this now before doing the install, Developer Tools will be listed under the “available groups” heading instead of the “installed groups” as you see here.

Installing gcc with Developer Tools is my recommendation because it could save you from installing other needed tools later. To install the Developer Tools group now, simply type this command into your shell:

`sudo yum group install "Development Tools" `

If for that didn’t work, I’ve heard that on some servers, you have to use yum groupinstall without the space. If the above failed use this:

`sudo yum groupinstall "Development Tools" `

Now if you type “gcc –version” you should see that gcc is installed!

## Installing gcc by Itself

This method may be simpler to do, but doesn’t give you other useful tools a developer is likely to use. If you opt to simply install gcc quick and easy, just type this at the command prompt and you’re done:

yum install gcc*

That will install and update all necessary dependencies.

## Install Perl

Now that you are sure to have gcc C compiler installed, it’s time to install Perl. The quick and easy way is to type this at the command prompt:

sudo yum install perl

If that doesn’t work, check out the other ways to install Perl using these links as it is a bit much to put here:

http://learn.perl.org/installing/unix_linux.html

or this one:

http://learnperl.scratchcomputing.com/install/

## Summary

Once you have made it to the end of this tutorial, you will have Perl up and running on your server. Now it is time to Write your first Perl script, so go here and do it now: http://jafty.com/blog/writing-your-first-perl-script/