thru hole herbal penis size plug

just another regularban.info web blog

MEMBERS:

Efficient SQL Databases

Don't be fooled by seeming simplicity. A lot of developers get comfortable with a certain way of designing a database for their web applications that they miss out on techniques they should rather employ to make things run faster and more efficiently. A lot of developers don't bear in mnd that the small site they are creating now might grow into something incredibly large and complex, and the database they designed has become bloated and doesn't scale well to meet the demands of the increased traffic.

This article hopes to provide web developers with a few techniques to help make their database and queries faster and more efficient.

1. Avoid Character Types

When you are designing a database, it is so easy to set all data types to the VARCHAR type as it can then contain any data you want; numbers or text. But character data is amongst the most inefficient data type you can get. If a field is only going to contain numbers, then make it one of the appropriate types (INT, DOUBLE, etc).

Also, wherever possible in your web development code, try to use numeric data types as opposed to characters. One of the most common things a script has to store are flags like whether someone answered yes or no to a question, etc. You could of course store it as 'Y' or 'N' but why not store it as 0 and 1?

The reason this makes a difference is when you have a database, for example, with over 500 000 entries, and are running a SELECT on that field, comparisons are processed a lot faster for numeric data types than character types. Also, if you need to return data to the calling script, numeric data is less memory intensive than character data. In addition, your web development language (PHP, ASP, etc) would also be able to process and perform functions on numeric data better than character data.

I am not trying to convince you never to use character data types. Sometimes it is a necessity, but if you can find ways to reduce the amount of character data processed by your SQL database, the better your server will cope.

2. Normalization

Normalizing a database is really quite a complex process. It is a process that describes a way to design a database structure to avoid repetition of data in your database and can lead to significant performance benefits if employed correctly. However, the entire process of normalisation is a bit beyond the scope of this article as it can fill books on its own, but any developer designing a database should seriously consider becoming knowledgable about normalisation and employing it in their own designs.

For a good tutorial on this process: http://www.keithjbrown.co.uk/vworks/mysql/mysql_p7.php

3. DateTime vs Timestamp fields

This actually relates to 1. a bit. The big difference to bear in mind here is that a field of type DATETIME is actually stored as a series of characters. A field of type TIMESTAMP is actually stored as an integer. So therefore, a more efficient way of storing dates is using the timestamp method. The timestamp has its drawbacks however. For one, you cannot store a date early than 1 January, 1970. Also, timestamps in your script will need recalculating to get to the character format. Because of this recalculation, it may not be better to store as timestamp. It really is a case of testing which format works better for your needs.

4. Use LIMIT where possible

In your queries, if you are doing a SELECT to a database and you only expect a certain number of results, using the LIMIT statement can speed your query up incredibly.

For example, if you have a table of users and you need to run a query to search for one users record, you can use a query like:

SELECT user_name FROM users WHERE user_id = 453;

This query is perfectly valid and will return the right result. But you also know there will only be ONE result. The query above will search the database, find what you want, but then still continue searching after that. It would run a lot faster if you could tell the query that once it has found what you are looking for to stop searching. LIMIT can do this, as this query shows:

SELECT user_name FROM users WHERE user_id = 453 LIMIT 1;

Imagine this scenario. You have a table called logins, that records every login from a user. It currently contains over 2 000 000 records, and you want to find the first time a user logged in. Now bear in mind that because this table inserts data over time, it is already sorted for by date. You could do the following query:

SELECT MIN(login_date) FROM logins WHERE user_id = 4876;

This will return the record you want, but SQL will now have to get all dates for that user, sort them and then return the lowest value to you. Our table is already date sorted simply because of the way it records data for us. So using LIMIT can be more effective:

SELECT login_date FROM logins WHERE user_id = 4876 LIMIT 1;

Because it is sorted, the first one will always be a users first login.

5. Avoid using LIKE

If you have tried to employ 1. above, then hopefully you will be in a scenario where you do not need to use LIKE all that much. LIKE is one of the most inefficient ways of searching a table. LIKE performs a text comparison search in a field and with no wildcards is as efficient as a direct comparison; i.e. WHERE name = 'Jane' is equivalent to WHERE name LIKE 'Jane'. It is when you start introducing the wildcard characters like '%' that things get really hairy.

If you do have to use LIKE, then at least try and make efficient use of the wildcards. These are '_' (underscore) and '%'. Let me explain all this with a real world example.

In a project I was involved in, we had a SQL database storing logs generated automatically from a mail server. Unfortunately, the mail server pretty much just dumped a very long string of text data into a field that contained the data we wanted. A script had to be written to find all logs that referred to a login by a user into the POP server. The only way we could do this was to search every record for a string in the msg field that had the text "User logged in" in it. The first query developed was something like this:

SELECT msg FROM logs WHERE msg LIKE '%User logged in%';

This query took on average of about 35 minutes to process. Obviously not an ideal situation. The way the LIKE worked here was that it had to parse through every single portion of each and every record in the msg field looking for text that matched "User logged in" anywhere in the text. We were able to determine eventually that the text "User logged in" occured at the end of that text in the msg field and so we altered the query:

SELECT msg FROM logs WHERE msg LIKE '%User logged in';

The '%' at the end was removed as we do not want to worry about text after because there is none. The query now only compares text to our string in the msg field at the end of the field and no longer parses through the entire piece of text stored in msg. The query now ran in under 2 minutes. (This was actually still too long, but how we optimised from there is a little beyond the scope of this article.)

Hopefully with all these elements put into practice on your next web development project, you can have a database that runs quickly, efficiently, uses as little resources as possible and wont grind to a halt when the load suddenly increases.

Gareth McCumskey works as the Systems Developer for Synaq, a South African based Linux support and services provider. He has been involved in web development for over nine years and programming since he was 13.

 


Easy Web Programming Languages Are Coming

In fact easy web programming languages are already here right under our noses. Awareness of easy alternatives to popular but more complex systems based on Apache, Perl, PHP, and Ruby and their frameworks is minimal because of marketing forces.

Technology is supposed to make our lives easier but this promise has not been delivered to web developers especially. The page centered way that web applications are created forces programmers to tie many parts together with extra code that isn't needed in traditional (non-web) programming. The complexity of it all scares away the beginners and causes professional developers to be unproductive (and bald).

The popular web development culture advocates programming features like REST capability and stateless pages but these features actually complicate the development process. If you don't know what REST is, or what stateless pages are then you'll appreciate what I'm about to say: You shouldn't need to understand those ideas to create web applications. There are some programming systems which abandon these ideas, and in so doing they make web development simpler and even enjoyable. They also do receive a certain degree of disdain by the "establishment", but for those willing to think outside the box the benefits can be substantial for some kinds of web projects. This article will discuss some of these systems in short.

Seaside, http://www.seaside.st- The Seaside web development framework (also known as the Heretic web framework) is a system which provides almost a complete stack (provide your own database). It includes an HTTP server, automatic application sessions, transparent state management, live development and debugging, Ajax libraries and more.

Seaside developers code in the venerable Smalltalk language to build their applications. With a combination of an easy to use component-style page generation metaphor, support for cascading style sheets, and the powerful expressiveness of Smalltalk the Seaside developer enjoys tremendous productivity.

Seaside is an open source project with a liberal license and is available for both free and commercial Smalltalk platforms.

Run BASIC, http://www.runbasic.com- Run BASIC is a zero configuration web application server that features an extremely easy web development metaphor, suitable for the beginner. In one easy install it provides an HTTP server, automatic application sessions, transparent state management, tightly integrated BASIC programming language, inline CSS capability, graphics library, an XML parser and SQLite database support. Even with all the included functionality, the programmer is not confronted with a lot of complexity because of Run BASIC's built-in easy to use commands.

Run BASIC brings to the web the easy programming that BASIC has historically been known for. It is suitable for personal projects, educational situations, small business apps and more. There is an interactive version of the system hosted at the Run BASIC website so that anyone can try their hand at writing code. Cost: $59.95

Sun Labs Lively Kernel Project, http://research.sun.com/projects/lively- The Lively Kernel project is a web programming system developed at Sun by the inventor of the Smalltalk programming language. It is very cutting edge and very novel. It turns your web browser into a Javascript development environment and it includes a scalable vector graphics based windowing library. While this system may not be appropriate for some commercial websites, it is suitable for online games and educational curricula. Lively Kernel provides a kind of personal laboratory for building very dynamic applications that work in a browser.

Lively Kernel is supported in Safari and Firefox 2 and 3, but Safari is the recommended platform as of the writing of this article. It is licensed under the GPL2.

Carl Gundel is a programming language designer and object oriented programming expert. Read more about his current work at http://basicprogramming.blogspot.com

 


SEO and Web Site Building

If you are considering building a web site for your business, then you will more than likely like it to rank in the search engines There are many factors that influence website rankings and many of these factors can be implemented while you are creating your website. Optimizing your website properly for your business will ensure a more successful site.

Have you heard the concept "Content is King"? The search engines are becoming more selective at who ranks highly and want to provide the best content for each search term. They are looking for high quality content that is continually updated and provides a quality experience for their searchers. It makes no difference whether you have a content site or a physical product site. Content is "King" as far as the search engines are concerned. By providing quality content and/or good descriptive descriptions of products you sell you will be helping your customers and you may just help yourself at ranking.

One mistake many new webmasters make is to over optimize their web page by using too many keywords. If you are excessive with your keywords, your web page will not read well and the search engines my penalize you. It is considered spamming when your techniques are questionable even if that wasn't your intention. There are other techniques that are considered unethical including hiding text, and redirects. Just write for your visitor and don't try to over optimize your web page.

Another thing to keep in mind that may cause you problems is the use of frames. Make sure you know how to use frames correctly before using them on your website. If the proper frame context is established, then the search engines can send visitors to your site. However if you use frames incorrectly the spiders for them will not be able to crawl your web page and or website.

During web site building, you should also consider the depth of your site. Search engines have spiders that crawl through the web pages and find the necessary keywords. If you do not setup the correct linking structure throughout your website the spiders may not be able to crawl your entire site. One of the best practices when setting up your websites' structure is to include a sitemap that lists all the web pages that make up your website and then link your sitemap to your homepage. This will help ensure that the search engines can crawl your site.

With proper planning and a little research you will be able to build a professional site that the search engines love.

There are many things to consider when building a website. When you choose XSitePro to build your website, onpage SEO as well as many other functions become very easy. Stop by today and let me show you why you should consider this website builder.

 


Pages 
* About

Archives
    * February 2008
    * January 2008

Categories:
* Uncategorized

Last Updated:

regularban.info is proudly powered by WordPress MU running on  regularban.info.
Create a new blog and join in the fun!
Entries (RSS) and Comments (RSS).