Find and replace text in multiple files

8 Dec, 2009

Perl dark
Question: How can I find and replace text in multiple files?

Answer: If you have perl installed on your server, you can easily use it to perform the function you need. Even if you do not have root access to the server, basic user SSH access will be enough.

Let’s start with a simple example. If you wanted to replace every instance of the word “captain” with the word “major” in all of your html files, you would enter the follow from the command line:

perl -pi -e "s/captain/major/g;" *.html

That is all it takes. Perl will search every html file in the current path and change all of the captains to majors. This is very useful if you need to edit multiple files at once and do not want to go through the trouble of opening, changing, and saving each one.

Photo: Flickr

(0) Comment Categories : Software, Web Hosting
Tag: , , , , ,

Benefits of Using CSS

18 Nov, 2009

CSS carved in a pumpkin
There are many design benefits to using Cascading Style Sheets (CSS), but there are also technical ones that any website owner or server administrator should consider. Originally, websites were mostly just text and images with no fancy boxes, menus, or other slick layout schemes. Over time people started getting more inventive and primarily relied on tables with styles inside of them.

CSS allows web designers to use other methods, such as divs, for structure while leaving the styles in a separate stylesheet. Web browsers read through tables twice, once to understand the structure and a second time to determine content. Relying on CSS decreases rendering time, making the site faster and easier on the server.

Furthermore, html documents are smaller because the layout and design is not rewritten for every page. Most of it is contained in a single or few style sheets. Again, the obvious benefit is less stress on the server and less bandwidth and disk space consumed. As you can see, using CSS helps websites run more efficiently, which is good for both the site owners and the server administrators.

Photo Source: Flickr

(0) Comment Categories : Software, Web Design, Web Hosting, Web servers
Tag: , , , , , ,

HTML, XHTML, and CSS

28 Sep, 2009

HTML and CSS reference guides
When stepping into the world of web hosting, you will be inundated with abbreviations, acronyms, and recursive acronyms. Three that you should definitely know are: HTML, XHTML, and CSS. HTML is as old as the Web itself. It stands for Hyper Text Markup Language. It is the primary language of the Web. All websites use at least some of it, and a web browser’s primary function is to read it. Web servers, such as Apache HTTP Server, are designed to primarily to publish HTML-based websites.

XHTML is the extended form of HTML that was officially recommended in 2000 to clean up some of the issues with HTML 4, while also preparing for HTML 5. It has gradually become the standard for websites, and web purists insist on it. In XHTML, the structure of the site is handled in the markup, while the style is handled by CSS.

CSS stands for Cascading Style Sheets, and is a language in itself that handles all of the style (colors, sizes, text weight, borders) of the elements on a web page. All modern web browsers support CSS, and it is very useful for sites with multiple pages, as you can quickly and easily apply new styles to multiple pages without having to edit each page individually. All three languages have standards established and maintained by the World Wide Web Consortium (W3C).

Photo: Flickr

(0) Comment Categories : Software, Web Design, Web Hosting, Web Infrastructure
Tag: , , , , , ,

Static vs Dynamic Websites

24 Sep, 2009

Stack of scripting books

Question: What is the difference between a static website and a dynamic website?

Answer: A static website relies on traditional HTML pages to display content. Typically, a person will create the pages in an offline editor, such as Dreamweaver or even a plain text editor like Notepad, and then upload them to the server via FTP. The downside of static pages is that anytime you want to make changes to the site, you have to edit the pages and upload them again. It can be time consuming and costly, if you hire someone to make a site for you.

A dynamic website relies on a scripting language, such as PHP, Perl, ASP, JSP, or CFML. All of these languages employ server-side scripting. With Javascript and other client-side scripting, the browser is responsible for executing the script. That is why you can disable Javascript in your web browser. With server-side scripting, the scripts are executed on the server, so when you visit the site, the page is displayed as normal HTML.

The big advantage of a dynamic site is that data is stored in a separate database or series of text files. When you want to make changes to the site, you can use a content management system (CMS), such as Joomla or Druapl, and simply login to the site backend. Pages are created on the fly, and there is virtually no limit to the number of pages you can create. If you are interested in having a dynamic website, you need to make sure the web hosting company you choose supports the type of scripting your CMS will require.

Photo Source: Flickr

(0) Comment Categories : Software, Web Design, Web Hosting, Web servers
Tag: , , , , , ,

2 Ways to Redirect Your Website

22 Sep, 2009

Arrow redirect
Question: I want my website redirected to another site or page on my server. How do I setup automatic redirection?

Answer: There are many easy ways to redirect your website. Here are two commonly used methods.

1. .htaccess Redirect: Using an .htaccess file, you can instruct a visitor’s browser to any page on your website to look elsewhere for that page. This is useful because, in addition to redirecting the main page of your site, you can redirect any internal page to another.

In a previous post, we learned how to make error documents using .htaccess files. This uses the same principle but relies on the 301 Redirect code rather than a typical error code. It is quick and easy. Simply create an .htaccess file in the directory of the page you want to redirect. Then enter this on the first line:

Redirect 301 /oldpage.html http://www.example.com/newpage.html
Read More >>

(0) Comment Categories : Web Hosting
Tag: , , , , ,

The danger of free WYSIWYG editors

11 Sep, 2009

web design
In an effort to sign up customers, web hosts these days offer an array of freebies with their plans. One common inclusion is a What-You-
See-Is-What-You-Get (WYSIWYG) editor. These tools promise to create professional-looking websites for users with no HTML knowledge, but more often than not, are a waste of time.

A WYSIWYG editor should work well enough for a small website with little content, but this does not characterize most sites on the web today. From my experience, these editors are too inconsistent to get quality results

They generate buggy code that may not work in all browsers, aren’t very user-friendly, and don’t work well with templates. During my early days on the web I tried working with several, only to find I could do what I needed to get faster the old-fashioned way.

Don’t be lured into signing up with a host because they offer a WYSIWYG editor. Your time would be much better spent learning HTML, which most people can do in less than a week.

Photo | AnnaOMline

(0) Comment Categories : Web Design, Web Hosting, Web Services
Tag: , , , ,

Microsoft joins the HTML 5 discussion

10 Aug, 2009

IE, Firefox, and Safari Logos
Last month we discussed the current state of HTML 5, particularly regarding its video component. Not only were the major browser makers, Mozilla, Google, Apple, and Opera, all duking it out over what should be considered standard, but the largest browser maker, Microsoft, had barely contributed to the debate at all.

Now Microsoft has begun to open up to the HTML 5 development mailing list, indicating that they are interested in joining the discussion. Their latest browser, Internet Explorer 8, includes some HTML 5 features, although it is far behind Mozilla Firefox, Apple Safari, Google Chrome, and Opera. Microsoft clearly wants to be involved now, a move that more than likely is the result of website owners embracing HTML 5 even in its development state and Google’s willingness to adopt it, with its huge Web presence.

HTML or hypertext markup language, is the technical language of the World Wide Web. It is standardized by the World Wide Web Consortium or W3C. Much of the HTML 5 development, however, has come from an outside organization called Web Hypertext Application Technology Working Group (WHATWG), which the major browser makers established as a reaction to their disappointment with XHTML 2.0. There has been a highly publicized debate about embedded video standards, whether to use Ogg Theora or H.264. Until now, Microsoft has been largely silent.
Source: ZDNet Asia

(0) Comment Categories : Software, Web Design, Web Infrastructure
Tag: , , , , , ,

SSH Remote access to your website

9 Jul, 2009

Secure Shell SSH
While FTP is the most common method of transferring files to your website, there many be times when you want a secure method of manipulating your files directly on the server. Secure Shell or SSH is one method of accomplishing this. It was design as a secure replacement for Telnet — a significantly less secure shell. Many web hosts no longer offer SSH accounts because of security concerns, but if you do a little investigating, your host might offer it upon special request.

Usually a special request will require some form of identity authentication, such as a driver’s license. The reason for this is that SSH access will give you more power, the power to attempt to circumvent server security and gain administrative (root) access. SSH comes installed on most Linux servers, and the user connects with a standard username and password. The connection uses a public-key crytography.

Once you are logged in, you will have a command-line interface, using whatever Linux or Unix shell the server offers. This could be Bash, Dash, Tsch, or something similar. If you are use to MS Dos commands on Windows, you will need to learn some of the Linux commands to safely navigate through directories and make the changes you need. You can usually edit text files — such as php and html files — with applications like “nano” or “vi”. Logging out is as simple as typing “exit”.

(0) Comment Categories : Software, Web Hosting, Web servers, Web Services
Tag: , , , ,

Apple, Google and the death of HTML 5 video

6 Jul, 2009

Browser wars
Who done it, with what, and where? Was it A) Microsoft, inside their security deficient, sub-standard browser with an over-hyped search engine? Was it B) Apple at its elitist developer conference with an exploding iPhone app? Was it C) Google in a YouTube video with a poison drop of lonelygirl15‘s blood? The answer is D) All of the above. From Microsoft’s refusal to participate in the process at all to Apple’s insistence on a patented, closed, proprietary format, the entire episode only serves to illustrate that the “browser wars“, however petty, are far from over.

While the W3C intentions were certainly noble, the entire ordeal is now spiraling out of control. The initial proposal was simple: create an open standard for streaming video playback on the web, something to replace the vendor-locked, resource hogging, proprietary Adobe Flash player. Microsoft’s abstention was disappointing but not surprising. But what is more disturbing is that, of the four main participants: Mozilla, Opera, Apple and Google, only Mozilla and Opera were willing to sign on to using the open Ogg Theora format. Apple and Google both insisted on H.264, which might be an outstanding video codec, but it is not open and is laced with patents, making it not much better than Flash player.

Google has stated that they will at least ship their Chrome browser with support for both Ogg and H.264, but Apple refuses to support Ogg at all. As a result of this childish bickering, Ian Hickson, the man responsible for the HTML 5 audio and video tags, has removed the codec specification, essentially leaving us where we began, with multiple formats and no packaged solution. It is a company or web site owner’s nightmare to have content on their websites that not all visitors can view, but it happens all of the time, partly due to web developer arrogance and partly due to the impassible situation in which browser makers and video codec patent holders have left us. The future looks grim indeed. Who done it? It was Apple, Google and Microsoft in the comfort of their corporate offices, with their egos.

Photo: Flickr

(0) Comment Categories : Intellectual Property, Software, Web Design, Web servers, Web Services
Tag: , , , , , , ,

Opera CEO: HTML 5 will make Adobe Flash unnecessary

25 May, 2009

Adobe conference
The makers of three major web browsers, Opera, Apple, and Mozilla have been working to ensure that the next version of HTML will include many advances in audio and video integration, something that has become the mainstay of Adobe Flash. The trio forms part of an organization called Web-Hypertext Application Technology Working Group (Whatwg), formed to encourage the World Wide Web Consortium (W3C) to engage in a more progressive development of HTML 5.

Opera CEO Jon von Tetzchner said that the new version of HTML will support rich media (audio and video), rendering Adobe Flash redundant. Those who wish to keep their websites in compliance with web standards will be able to provide users with the same rich media content and features currently only available with the proprietary Flash plugin.

“You can do most things with Web standards today,” von Tetzchner said. “In some ways, you may say you don’t need Flash.”

He believes people will continue to and should have a choice between Flash or the new HTML 5 integrated media, but those concerned with web standards and the closed nature of Flash will now have an alternative.

Source: ZDNet
Photo: Flickr

(0) Comment Categories : Web Design, Web Services
Tag: , , , , , , ,