Posts Tagged ‘number’
Thursday, July 24th, 2008
We are so frequently required to create date based queries, eg how many orders last week, last month, how many orders between two dates. It is necessary to avoid the trap of treating date as a number, instead convert the date into a handy unit such as days
# select all records from today
select * from tbl_orders where TO_DAYS(NOW()) = TO_DAYS(dtmdevdate);
# select all records from last three days
select * from tbl_orders where (TO_DAYS(NOW())-3) > TO_DAYS(orderdate);
MySQL provides a whole range of date functions become familiar with them here
Tags: become, By, date, Days, Frequently, MySQL, number, orders, queries, Querying
Posted in MySQL, tricks | No Comments »
Monday, July 14th, 2008
First up are the sizeof and count functions. They can both be used to count the number of items in an array but does one do it better?
sizeof vs count
sizeof: 3.75928902626 seconds
count: 3.33035206795 seconds
Time saved: 0.428936958313 seconds; 12.8796280262%
The evidence says yes. The count function was over 12% faster in this test. Both functions are fast though taking 3-4 microseconds to count an array with 100,000 items. You might think it isn’t worth it but remember count is also a character shorter. Not only is it faster to run but it is also faster to type!
Tags: array, character shorter, count, evidence, fast, faster, functions, number, PHP, remember, sizeof
Posted in PHP, tricks | No Comments »
Monday, July 14th, 2008
How would you like to be 1 on Google search results for keywords you want? What would that do for your business? And imagine if you don’t have to pay for it! This is biggest opportunity in 2008 for webmasters who have been doing Search Engine Optimizing (SEO), advertising or marketing them selfs to get to Number One spot on Google and Yahoo.
Tags: google, Google search, keywords, number, opportunity, Optimizing, position, Search Engine, Top, webmasters, Yahoo
Posted in SEO, google | No Comments »
Monday, June 30th, 2008
<script type=”text/javascript”>
var str = “Hello World!”
var res = “”
for (i=0;i < str.length; i++) {
res += str.charCodeAt(i) + ‘,’;
}
res = res.substr(0, res.length - 1);
//Result: 72,101,108,108,111,32,87,111,114,108,100,33
document.write(res);
</script>
Tags: ASCII, Convert, Document, Javascript, length, number, sequence, String, substr, Write
Posted in PHP | No Comments »
Monday, June 30th, 2008
<script type=”text/javascript”>
// outputs: “Hello World!”
document.write(String.fromCharCode(72,101,108,108,111,32,87,111,114,108,100,33));
</script>
Tags: ASCII, Convert, Document, fromCharCode, Hello World, Javascript, number, outputs, String, Write
Posted in PHP | No Comments »
Saturday, June 28th, 2008
Microsoft released it’s much-anticipated 2007 version of its Office product in January 2007. Years in the making, Office 2007 contains a number of new features, the most notable of which is the entirely new graphical user interface called the Ribbon, replacing the menus and toolbars that have been the cornerstone of Office since its inception. Students and faculty purchasing new computers since January have been purchasing this new version. Although there are many improvements to Word, PowerPoint, Excel and Access, one thing that you should be aware of is that the default file formats are not only different from all past versions, they are not readable by past versions. This means that if a student creates a document in Word 2007 it will automatically be saved in a format called .docx. Since this file type is not recognized in Word 2003 or XP, you will not be able to open it. Some of you may have already run into this problem with student submissions.
Tags: 2007, Converter, Document, entirely, format, graphical user, Improvements, January, Microsoft, much-anticipated, number, Office, problem, Students, Toolbars, version, versions, years
Posted in Uncategorized | No Comments »
Thursday, June 26th, 2008
Every server on the internet is assigned a unique number – an IP (Internet Protocol) address. This number can be thought of as a ‘telephone number’ which allows other computers to find and access files no matter where they are. The IP address is 4 bytes (32 bits). Each byte is known as an octet and can have a value between 0 and 255, so IP addresses are written in the form of 123.456.78.9.
IP addresses of 32 bits theoretically allow for more than 4 billion unique addresses, but in practice the actual number is much less. Certain ranges are reserved for special purposes so the number of available IP addresses is limited. Web sites can get around this limitation by using shared hosting or virtual servers. Rather than using one server for one web site, shared hosting allows several sites (sometimes hundreds) to be hosted on the same server. Each of these sites has the same IP address. They are uniquely identified by their domain name (e.g. mydomain.com).
There are plans to expand the number of IP addresses with the introduction of version 6 (We currently use version 4) of the Internet Protocol. IPv6 has IP addresses which are 128 bits wide. This provides an almost unlimited number of unique addresses, but will take several years to implement because of the heavy cost of upgrading the Internet infrastructure.
Shared hosting solves the problem of limited IP addresses for web sites, but there is also a need for IP addresses for each personal computer which connects to the Internet to browse the web or send email. Rather than assign each PC a unique IP address, Internet Providers can use a system of ‘dynamic addresses’. This means that each time you connect to the Internet through a dial-up or DSL modem you are assigned a different IP address.
So far we have been discussing how to use a web hosting company to host a web site, but there is no reason why you can’t host a site on your home computer. The biggest technical difficulty for most people, though, is that they connect to the Internet using a dynamic IP address. Dynamic addresses make it difficult to host a web site from home. Since the IP address is constantly changing nobody would be able to find your site unless you somehow notified them of your current IP address. There are dynamic DNS services, however, which allow you to assign a domain name to a site with a dynamic IP address. Each time you are assigned a new address your computer automatically notifies the service, which in turn updates its DNS (Domain Name Server).
Hosting a web site on your home computer, however, may not be a good idea. The computer has to operate server software and needs a high speed Internet connection. Your home Internet connection is probably a lot slower than those used by hosting companies so your web pages may load slowly – especially if they have a lot of graphics. If you have a small personal site with few visitors, though, it may be feasible to host your own site. Dynamic DNS is available as either a free or subscribed service.
Tags: addresses, bits, identified, Internet Protocol, IP, number, practice, unique
Posted in web hosting | No Comments »
Thursday, June 19th, 2008
Whatever industry or niche you’re in, there are bloggers, forums and an online community that’s already active. Depending on the specificity of your focus, you may need to think one or two levels broader than your own content to find a large community, but with the size of the participatory web today, even the highly specialized content areas receive attention. A great way to find out who these people are is to use Technorati to conduct searches, then sort by number of links (authority). Del.icio.us tags are also very useful in this process, as are straight searches at the engines (Ask.com’s blog search in particular is of very good quality).
Tags: already, bloggers, Blogs, community, Depending, Forums, highly, links, number, Participate, particular, people, process, Related, searches, size, specificity, Today, web today, Whatever
Posted in Uncategorized | No Comments »