Archive for the ‘Web Development’ Category

PHP Frameworks

June 18th, 2009 | No Comments »
Posted by Aaron Reimann under PHP, Web Development

I spent most of Monday playing around with CodeIgniter (CI), a good PHP framework on my laptop. I really wanted to check it out after reading about CakePHP, Symfony, and other frameworks. CodeIgniter (CI) just seemed to make sense to me. It was simple to setup, and I was writing code pretty quickly due to that I am already familiar with PHP, and there are some good tutorials for CI.

My problem was that I kept comparing it to Ruby on Rails. On the CI website, one of the reasons to use CI is “You want a framework that does not require you to use the command line.” My problem was, I really like the command line. I am by no means afraid of the command line after years of DOS (IBM DOES, MS-DOS 3.3+) and Linux. In Rails there is a great command called “rake db:migrate”. With Rake you basically modify text files to create a table, add columns, delete tables, etc. Side note: Symfony does allow a command line, and CakePHP might too, but I don’t know.

CI does not deal with the command line. If you create tables in the database, you have to use either command-line SQL, or use some kind of GUI. Which of course slows things down. Not only that, you do not have a “rollback” feature that Rails does provide.

With all that said, if I need to write an application, and have to use PHP, I will use CI. Even though it is not Rails, it still does speed up the development time. I really recommend learning some kind of framework. I constantly have to work on applications I write 5 years ago, before web frameworks really existed, and know I would be saving time if it were based on any kind of framework.

See ya!

 

XML feed to Twitter

May 8th, 2009 | No Comments »
Posted by Aaron Reimann under Ruby, Web Development

Requirements for create the script:

  • A computer with Ruby, or, if you have good hosting, you can SSH in and run Ruby there
  • The ability to install a Ruby gem, or maybe it is already installed
  • A text editor (Vi is what I used)
  • A Twitter account

First things first, let’s go into your shell and see if you have the plugins (gems) you need already installed. Type this in to see if the gems we need are installed:

1
gem list

If you do not see “feed-normalizer” and “twitter4r” in the list, do this to install them:

1
gem install feed-normalizer twitter4r

It probably will take a while to “Bulk update” the Gem source, that is normal. Make sure to say “Y” (yes) to install of the dependencies when prompted. It will install Gems like simple-rss, hoe, rubyforge, rake, json, etc.

    Side Note: You can make sure the Gems are installed by using IRB. So, type in “irb” (Windows user will probably have to go to c:\ruby\bin if Ruby is not in your path) and type in:

    1
    
    require 'twitter4r'

    and the result should show “=> true”. If you get a “=> false”, that means it was not installed. I don’t know what could have gone wrong. I haven’t had any problems in OSX, Linux or Windows installing Gems.

Now that we have the Gems installed we need to find a feed. Almost any “normal” feed will work. I used the feed for Torah Portions (http://www.torahportions.org/portions_rss.php).

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
#!/usr/bin/ruby
require 'rubygems'
require 'feed-normalizer'
gem('twitter4r', '>=0.2.0')
require('twitter')
 
#grabbing the url, and setting up the Normilzer
feed_url = 'http://www.torahportions.org/portions_rss.php'
rss = FeedNormalizer::FeedNormalizer.parse open(feed_url)
 
#quit if for some reason there isn't a feed
exit unless rss.entries.length > 0
 
#creating the array of the portion
@ary = Array.new
 
#read entries, push to the array called @ary
rss.entries.each do |entry|
        #replacing " Reading" with just a ":" because tweats are limited to 140 char
        title = entry.title.gsub(' Reading', ':')
 
        body = entry.description + "\r"
 
        #actually adding to the array
        @ary.push(title,body)
end
 
 
@ary.delete_at(0) #removing the part that says "This Weeks Portion"
@ary.push("...http://short.ie/torah") #adding the link to torahportions.org/this-week.html
puts @ary
 
login = 'torahportions' # change this
password = 'NOTMYPASSWORDHERE' # change this
client = Twitter::Client.new(:login => login, :password => password)
#status = client.status(:post, @ary)
 

960 Grid System for designers

April 13th, 2009 | 1 Comment »
Posted by Aaron Reimann under Photoshop, Web Development

I decided to go with a grid system called 960 to lay this site out.  It is basically a CSS framework.  CSS in itself is not complex enough to really call it a framework, but for my purposes that is what I am calling it.  The framework is based on this: “All modern monitors support at least 1024 × 768 pixel resolution. 960 is divisible by 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 30, 32, 40, 48, 60, 64, 80, 96, 120, 160, 192, 240, 320 and 480. This makes it a highly flexible base number to work with.”

So I downloaded the .zip file that they give you.  I snagged the Photoshop file and started designing.  The PSD file has a bunch of markers, so when you draw a box, it will snap into the right place.  You don’t spend as much time making sure everything winds up in the right place.  Nor do you have odd (strange) numbers, like a width of 934.

This theme (ishinelight.com) was my first 960 design.  Check out the source code, *maybe* it will make sense.  Or just go to 960.gs and download the .zip file yourself.  It took me about 5 minutes to realize the power of it.  Anyway, it’s a short post, but it has changed the way I code now.

 

Unix-ish Commands I use Often

April 1st, 2009 | No Comments »
Posted by Aaron Reimann under Editing, Linux/Unix, Mac OSX, Web Development

Are you a web designer that sometimes need to SSH into a web site and make some changes but don’t know a Unix text editor?  Here are some basic commands that you might need.

Navigating in and out of directores:

To change directories:

pwd (shows you what directory you are in)

ls (lists all files)

cd www (gets you into the directory called www)

cd .. (gets you down one directory)

Editing files.  I like editing files in Vi.  It is confusing if you don’t know it.  I am by no means a Vi expert like some of my friends, but I can do a lot.  Here are the basics:

use the arrow keys to navigate (you can use letters to move around, but if you don’t want to learn Vi, don’t waste your time)

vi filename.php (opens a file called filename.php)

i (gets you in the insert mode)

the escape key gets you out of the insert mode

x (deletes the character your cursor is on)

dd (deletes the whole line you are on)

:w (writes the file)

:q (quits Vi)

:wq (writes the file and exists)

:%s:bob:john:g (replaces bob with john in the whole file, i recently used that to replace text on a 42 meg text file, it came in handy.  it took seconds to do)

Enjoy!

 

Microsoft Slows Down Technology / CSS Level 3

February 28th, 2009 | 2 Comments »
Posted by Aaron Reimann under Internet Explorer, Microsoft, Web Development

As a web designer and developer, I am very excited about CSS3.  The features are finally there to do, what I would consider, real design layout effects that you normally would have to do in Photoshop.  I have to be realistic and know that I won’t be able to use these features for 5 or more years.  It is all Microsoft’s fault, let me explain why.

Internet Explorer – fully funded

Internet Explorer 6 was released August 27th, 2001.  That is right, 2001 and it only had partial support for CSS level 1.  It is now February, 2009 and last months’ stats according to the W3C, had 18.5% of the people online using it.  That forces web designers to stick with technology that is 8 years old.  I am guessing that we will no longer have to support IE6 sometime in 2010.

Internet Explorer 7 was released in October 2006 and it only had partial support for CSS level 2.  Now please realize that CSS level 2 specs came out in 1996.  That puts Microsoft 10 years behind when it comes to one aspect of browser technology.

Let me cut Microsoft some slack and guess that IE7 will only have a life-span of 6 years.  To me, that means that 5-10% of the people online will be using it in 2012.  So, designers will be able to drop support in 2012.

The extremely sad piece is next.  Initially, IE8 was supposed to be released late in 2008.  Shockingly enough, that did not happen.  A public RC (release candidate) was released in January 2009 and the final version should be released in later 2009.  IE8 is slated to support only CSS level 2.1.  CSS level 2.1 specs came out in 2005.  Why Microsoft has to be so far behind is beyond my comprehension.

So let’s do the math again.  Let’s say IE8’s life span is 6 years.  We will finally be able to support CSS level 3 in 2015 in all browsers.  Assuming that there is an IE9 sometime before then (Ok, I’m sure they will release something, but not before CSS level 4 is out).

Open Source – some funded, some not

Now let us think about the Open Source movement.  Let me give you a quick little run down on some of them.

  • Firefox – In my opinion it is Netscape’s grand-daughter.  Netscape gave birth to the Open Source Mozilla, and Mozilla gave birth to Firefox.
  • Konqueror – A browser for Linux/Unix.  It’s engine is called KHTML.
  • Safari – Based on the KHTML engine.  Safari’s engine became known as Webkit (and Webkit has submitted code back to KHTML)
  • Chrome

So, are you wondering which one of these browsers are CSS level 3 fully compliant?  Well, none of them of course.  At least, none of them that are not in Alpha or Beta.  Chrome and Safari though, in Beta both passed the Acid3 test, according to the Acid3 web site.  Firefox 3.2 Alpha is almost compliant, and Konqueror shortly behind Firefox.  I am assuming that in the next few months they all will be passing the Acid3 test.  This means that shortly every popular Open Source browsers will be light years away from Microsoft when it comes to Internet browsing.

Why Is Microsoft So Far Behind?

I would think that the people that have 90% (that number is a guess) of the desktop market share would be winning, and be pushing technology.  Obviously that is not the case.  Open Source is just working better for the users when it comes to the Internet.  I am guessing that they have way too much red tape in the organization to get anything done.  Maybe it is because Microsoft tries to be backwards compatible, which slows development down.

There must be a reason why they slow down technology, it is just a fact.  It makes web designers and developers miserable, the end user suffers, and web applications are not where the could be if Microsoft did not slow everyone down.

What A End-User Do?

Quit using old browsers.  Please use Chrome, Firefox, or Safari for everything you can, and update it often.  Tell everyone that you are more secure using one of the Open Source browsers.

 

How-to Transfer a WordPress Site

February 21st, 2009 | No Comments »
Posted by Aaron Reimann under Web Development, Wordpress

If you are hosting your own WordPress site and you want to move because the current hosting company is slow, unstable, expensive, etc., you can transfer your WP site very easily.  It takes almost no time.  This is also a good way to transfer sites even if it isn’t a WP site, just skip the database steps.  Once you have done this a few times you will never understand why you used to download everything onto your computer and then upload it to the new server.

Requirements to transfer using this method:

  1. SSH access on both hosting companies (it will say on their site, or call them)
  2. PHPMyAdmin on both servers.  You can use command-line MySQL, but if you know that your probably aren’t in need of this article.
  3. Basic knowledge of Unix would help

Step 1: Transfer Your Files

This will copy your files from your old hosting to new hosting company.

  1. ssh -p 22 username@oldhosting.com
  2. cd www
  3. scp -r -P 22 * username@your-domain.com:/home/username/www
  4. password: (type in your password)

Explaination:

  1. SSH into your old hosting (you might not have to specify port number 22)
  2. Change Directory into your web files directory.  Most companies give will make you put them in one of these folder:  www, public_html, or httpdocs
  3. The tricky step here
    • scp – stands for Secure Copy, it copies files through encryption
    • -r – Recursive, it will copy everything in your “web” folder, and sub directories
    • -P 22 – this is not needed if your new hosting company runs SSH over port 22 (doesn’t hurt to keep it though).  if the company does not run it over 22, change it to whatever it maybe (maybe 7822 in some cases, but rare)
    • * – means everything, if you want to only copy one file, like wp-config.php you would change the * with wp-config.php
    • username@127.0.0.1 – this will be whatever your username and domain is (specifically your SSH username, might be the same as your control panel) and the IP address of your new server.  If you have already transferred your domain to the new server you will have to SSH into the old server via IP address
    • :/home/username/www – this tells scp where to write the files once it starts transferring.  “username” is whatever was assigned to you, and “www” could be “public_html”, “httpdocs” etc.
  4. it might ask ‘Are you sure you want to continue?’, type in yes)
  5. password: (you should know this)

Your transfer should be going after you type in that password.  The transfer of the files normally takes 60-120 seconds.

Step 2: Change Your URL (optional)

If you are transferring from old host to new host with the *SAME* domain, you can skip this step.  If not, make sure you change your URL.

  1. Login to the admin on your old server
  2. Go to Stettings > General
  3. Change these two settings to your new domain “WordPress address (URL)” and “Blog address (URL)”

If you do not do these steps all of the links will be pointing to your old domain.  This is where WordPress is stupid, IMHO.  They should not store the URL in the database, it should all be in the wp-config.php file.  Maybe I’m missing the developers logic.

Step 3: Export Your Database

Get into the control panel on your old hosting company.  Get into PHPMyAdmin.  I wish I could give you more details than that, but every control panel is different.

Once in PHPMyAdmin

  1. Select the correct database by click on it on the left
  2. Click on Export (one of the main tabs)
  3. Now make your screen look like mine:
  4. Exporting WordPress Screen Shot
  5. Hit Go
  6. Save the file on your desktop

Step 4: Importing Your Database

This is very similar to the previous step, but backwards.  I’m going to be lazy and tell you this, without steps.  Login to the new server and import the file you just created with step 3.

Step 5: Change Your Config File

SSH into the new server and make these changes to your new settings:

define(’DB_NAME’, ‘ishinelight’);

define(’DB_USER’, ‘ishinelight_wp’);

define(’DB_PASSWORD’, ‘SomethingSafe’);

define(’DB_HOST’, ‘localhost’);

Step 6: Done.

Browse to your new blog and you are golden.

 

Content Management

February 21st, 2009 | No Comments »
Posted by Aaron Reimann under Web Development, Wordpress

So I’ve been working a lot on WordPress.  Ever since I worked on The Complete Laywer web site, I have wanted to do a lot more.  I used Wordpress when it is a little baby crawling on the floor, but now it is at the bar hitting on the ladies (I have *no idea* how that came analogy came up, please forgive me).

For most companies I am setting up CMS Made Simple, it is awesome for managing a basic site, but lacking with community-related plug-ins. CMSms does not allow for users to sign up and have access to more features of a site. That is where Wordpress comes in.

Adam Walker and I are going some WP sites. I’ll be dropping some WP snippets as I develop.

 

Why do people still use FTP?

February 20th, 2009 | No Comments »
Posted by Aaron Reimann under Linux/Unix, Web Development

FTP is a security nightmare, and no one should ever use it if the server is on the internet.

Why isn’t it secure you ask?  When people go to Facebook, Amazon, eBay, etc., they are safe because the data that is transferred is encrypted.  So if someone is snooping on the network (like at a coffee shop) they won’t see every letter you are typing being transferred.

FTP on the other hand has no encryption.  So if I am at a coffee shop and snooping on the network, I would get the password of someone if they login using FTP.  When you are on the internet though, everything is snoop-able (sp?).  So if you are at home, and I FTP into my web server, the username/password transfers through at least 10 networks before it finally hits the server.  Someone could be spooping at any point.

There are great options like FTPS (s = secure) and SSH.  I just setup “vsFTPd” on my Linux server and it is using SSL (secure socket layer).  It took less than 5 minutes.

If you are a web designer and have the option to use SSH, SFTP, FTPS, SSL, etc, use it.  Most clients now give you the option.

 
 
Theme by A. Reimann