Quicksearch
Calendar
|
Monday, May 17. 2004
Gmail as an online backup system Posted by Ilia Alshanetsky
in Stuff at
14:29
Comments (136) Trackbacks (6) Gmail as an online backup system
Recently I had opportunity to obtain a Gmail account (thanks James). For those you living under a rock it's the latest fad as far as free e-mail is concerned from the same people who brought us Google. The biggest attraction of Gmail is the 1,000 megabyte storage box and saner(?) monetization model that will rely upon the same text ads you may have seen near Google's search results, rather then big bulky banners and/or popup variations. At this time the system is in beta stage, so to get an account you first must be invited by an existing member, but only some members can invite (I am not one of them, so don't bother asking). While my initial plan for this account was to use it as the handler for mail comming to my @php.net account, which now a days comprises mostly of spam and windows viruses. Rather then have my server perform slow analysis on some 2-3 thousand messages, I'd let Google's Gmail do it for me.
Since most of the e-mail going to that account ended up being removed by spam filters, which seem to be quite good the account ended being rather empty, which seems rather wasteful. So, I've come up with a quick utility to make use of at least a small portion of the available space for backup purposes. To accomplish this task I wrote a small PHP script that can be used to backup files to Gmail and then quickly retrieve them back if and when you need them. I trust that Gmail servers are fairly reliable, and this offers an excellent offsite backup that is extremely fast (I can max out my connection on download 300k/sec) and accessible from anywhere internet is available. Given that you do have 1gig of space quite a few things can be backed up . If you want to try it for yourself here is the script itself: Plain Text Highlighted PHP Source P.S. The script can probably be optimized to run a little faster by removing regex and making cURL use Keep-Alive, but given that most of the time is spent retrieving the file that is not a big concern at the moment. Monday, May 17. 2004FUDforum 2.6.3 Released
Yey! Yet another stable release of FUDforum is out.
A bit more of e-mail fine tuning, this time aimed at making sure all mail clients can properly parsed encoded e-mails. Updated Chinese & French translations and the English translation undergone major grammatical revisions. The poll can now be position anywhere inside the message via the use of the {POLL} tag. Stricter URL session checks etc... All users are encourages to upgrade. Thursday, May 13. 2004
sendfile() syscall and why the 2.6 ... Posted by Ilia Alshanetsky
in Stuff at
13:13
Comments (7) Trackbacks (0) sendfile() syscall and why the 2.6 linux kernel sucks!
A friend of mine gave me a good idea of making a wrapper around the sendfile() syscall that can be used for very quick data transfers between socket and file descriptors. This syscall in some instances can replace 3 other syscalls (seek, read, write) when you need to write a portion of 1 file into another file. Another words a very neat functionality that I could see myself using in my own applications, such as the message file compactor for FUDforum who's entire job is to seek and write data from one file to another. Further tests have shown that this syscall can also be used to create a much faster copy() that compared to PHP's current copy mechanism is about 2x faster, not a bad improvement if I do say so myself.
However, when it came to testing the code in my primary development box it just would not work, neither would any sendfile example I could find on the net that dealt with transferring data across two files. After much searching on Google, IRC and reviewing the relevant kernel sources I've discovered the problem. It appears that as for Linux kernel 2.6.X sendfile() syscall can only be used to transfer data from a file descriptor to a socket descriptor. The so called "misfeature" of allowing data transfer between two files has been removed, while I could not find any reported problems about it in 2.4.X kernels where it can work with 2 file descriptors. The frustration is further escalated by the fact that sendfile() man page does not acknowledge this little tid-bit of information and only the very recent version even documents the EINVAL error code returned, ARGHH!!! I am still quite curios as to why this functionality was removed, since even after much searching I was not able to find the reason for it, only the fact that it was removed sometime in the 2.5.X kernel series. Monday, May 10. 2004PHP Optimization Tricks
There are a number of tricks that you can use to squeeze the last bit of performance from your scripts. These tricks won't make your applications much faster, but can give you that little edge in performance you may be looking for. More importantly it may give you insight into how PHP internals works allowing you to write code that can be executed in more optimal fashion by the Zend Engine. Please keep in mind that these are not the 1st optimization you should perform. There are some far easier and more performance advantageous tricks, however once those are exhausted and you don't feel like turning to C, these maybe tricks you would want to consider. So, without further ado...
Continue reading "PHP Optimization Tricks" Thursday, May 6. 2004A'dam conference
Sitting at the airport enjoying the "cheap" Dutchie wifi at a mere $10 per day waiting for my flight that is about 3 hours off. The conference was quite a bit of fun. I got to meet a number of PHP guys who I have not seen before as well as meet old friends and acquaintances. The city itself is quite interesting and nearly everyone speaks English so communication with the locals is quite simple. One surprise was the fact that Dutchies don't seem to wear the traditional wooden shoes (perhaps it makes riding bicycles too hard?), the only time I've seen them was in the various tourist shops. The other was the fact that I have only seen about a dozen tulips in the country, which supposedly world renowned for this particular flower, oh well.
P.S. The two talks I gave will be put online as soon as I return to Toronto. Tuesday, April 27. 2004Joe 3.0!!!
I am an avid user of Joe, a console text based editor whose roots can be traced to WordStar. It was the editor I've started my *NIX experience with and it never gave me a reason to consider more popular alternatives such as VI or Emacs. One of the things Joe lacked was syntax highlighting that the developer had been promising to add for what seems like years. Well, the wait is over! This morning while doing a the morning news crawl I've discovered that Joe 3.0 has been released with UTF8 support and the long awaited syntax highlighting support.
Continue reading "Joe 3.0!!!" Monday, April 26. 2004Canadian Banks
I always thought of Canada being an progressive country with ties to various economic markets that make it easier for it's citizens to engage in cross-border commerce. Alas this seems to be only true when dealing with our neighbor to the south, the US. In preparation to my upcoming trip to Netherlands I went to my bank to get some (small amount) of Euros. However, after speaking to the teller and the bank manager I quickly found out that my home branch does not carry any foreign currency other then US dollars. Calls from the branch to other nearby branches of my own bank as well as other banks have yielded the same response, "no Euros". So, how can I get some Euros? Well, I have to order them and wait no less then 5 business days, before getting my hands on this rather unusual currency. The explanation for the delay that Canadian banks often do not have any currency on hand and need to go to currency exchange house to buy the currency themselves, unless someone miraculously decides to trade in their Euros for Canadian Pecos.
More over I cannot choose what denomination of bills will I get, meaning that they could easily give me 2 $100 bills or 20 $10 etc... which is not an ideal situation while traveling. In my experience most small stores will refuse to accept large bills for fear of forgery, meaning that I am likely to be in a situation where I need to exchange my bills for something more portable upon arrival. Keep in mind that this is happening in Toronto, Canada's largest city by far, not some small backwater village in the middle of nowhere, where perhaps no one had even heard of Euros. It seems that there is no requirement that even small quantities of foreign currency be kept on hand in the unlikely event a Canadian would decide to travel to a country other then the US. Friday, April 23. 20042.6.3RC1
In an effort to catch up to the Linux kernel version (I can dream, can't I ) just over a week after 2.6.2 release here goes 2.6.3RC1 of FUDforum. While mostly a bug fixing release there are a number of fairly important new features in it as well.
Continue reading "2.6.3RC1"
Saturday, April 17. 2004Kill Bill v2
There is not much I can say about the movie without spoiling the experience of seeing it, another words GO SEE IT! If anything the continuation (Kill Bill was originally a single movie that Quentin broke into to parts to avoid the Titaniasque style movie that just never seems to end) is better then the original. Through out the movie you can see a variety of influences ranging from anime, westerns and of course martial arts of all sorts, there is even a short appearance by a lone zombie!!!
While the movie is great, if you had not seen the first one you should probably watch it first before seeing the volume 2. Wednesday, April 14. 2004FUDforum 2.6.2 Released
In between getting ready for the next PHP release, flame-war of the day and the usual workload I completely forgot to mention that FUDforum 2.6.2 has been released today, shame on me.
This release is a mix of bug fixes and new features with full details avaliable in the release announcement (final & rc1) and nitpick details in the changelog. Wednesday, April 14. 2004Top 10 ways to crash PHP
Ever wonder what it takes to crash PHP, well here is a quick guide . Technically speaking PHP being a high level language should not crash, but reality speaks for itself. By knowing what could make PHP crash it may be possible to implement various safety mechanisms in your PHP configuration that would prevent users from crashing your PHP. This is quite important since a crash is not only a 'bad thing' [tm] in general but can also have several adverse affect on the web server potentially creating a possibility for a local DOS (Denial of Service). So without further ado here is the current crash list:
There are a number of other crashes in PHP, some were fixed and some may still be present. However those tend to be inside obscure extensions that most people do not have enabled and as such are very unlikely. Other crashes while may still exist are in the process of being resolved, unlike the ones listed above that are likely to be around for quite a while. Monday, April 12. 2004WWIV: Exceptions
Lately it seems that the possibility of PHP developers agreeing on something is about as likely as peace in the middle-east being declared overnight.
After about a two week cease fire, following the long and bloody fight about studlyCaps aka suckyCaps, which ended with a sound defeat of the forces of sanity & reason the PHP developer community is at it again. Once more we can thank John Coggeshall for this bit of entertainment, this time centered around wondrous PHP5 feature called "Exceptions". As you may or may not know in PHP5 it is possible to throw exceptions, which you can then catch and theoretically through this process simply error checking process and make it easier to write code. John proposed that all error messages raised by OO code would report errors by throwing exceptions rather then using the current error reporting mechanism. Technically the idea is sound good, since it would allow reduction in the number of error checks, allowing all error tracking be performed via a single try {} catch () {} block around the relevant code. Alas theory tends to neglect practical problems and this is where the fun begins. In PHP an uncaught exception leads to a fatal error resulting in the termination of the script regardless of criticality of the error that had occurred. Which means that if you god forbid neglect to put exception throwing code inside the block, your script will break and worse yet not provide any meaningful information other then you having an uncaught exception somewhere. More over some PHP errors can be ignored in many instances, these include NOTICES, WARNINGS and PHP5's STRICT errors, by making them exceptions you can no longer ignore them and must catch the thrown exception. This is particularly annoying for database extensions where there are numerous instances where it may be safe to allow certain operations to fail. In fact certain optimizations rely on trying to execute a query and upon failure execute an alternate query thereby avoid locking the table(s) used for for the operation, which has significant performance benefits. Even outside of the database world, having exceptions thrown on every error can do more harm then good. Let's take the Tidy extension for example, which is first extension subject to this new exception treatment. Certain operations such as setting deprecated libtidy options results in harmless warning that can be safely ignored as it does not have any affects on the generated code. However, with exception a harmless warning becomes an exception that must be handled. Consequently the script author who intends to use the simpler OO interface will now pay for that simplicity with interest by having to implement various error handlers to ensure that his script is not terminated prematurely by an uncaught exception. What's even worse that once an exception is triggered the code goes directly to the exception handler skipping any of the latter code, meaning that you have very little choice but to terminate the script execution yourself after logging the warning or error. This pretty much the usefullness of exceptions, who's original goal is to simplify the error handling code. Yet another proof that the road to hell is paved with good intentions. Tuesday, April 6. 20041st Post!
If Porsche can have an SUV, I can have a blog!
While this is not technically the very post, it is the first official online rant by your's truly. Well, that's not entirely true either, since I rant on a regular basis on internals mailing list about wide variety of topics. But let's ignore the facts for a moment, they only tend to get in the way of things. Anyhow, on with the introduction. I finally decided to get of my lazy ass and design a site for myself. Rather amusing, given that I've been directly and indirectly involved in the design of hundreds of websites in the past. For the moment only the blog is online, however I will add other tidbits in the near future. The biggest difficulty was lack of a good (short) domain. Despite having a fairly rare name, that I tend to spell differently that some of my namesakes (Ilia vs Ilya) this had proven to be quite a challenge. All common domain extensions were taken with the expiry date no where in sight and when they did approach the said date they were promptly renewed . When I turned to country based domain extensions, to my great surprise I discovered that the vast majority of possible options were too reserved. In fact, ilia.ca is owned by some fella from Vanier (Ontario Canada) who is using an e-mail address name virtually identical to mine. For some strange reason, even though his last time does not begin with an 'A' his e-mail login is iliaa@sympatico, while mine is ilia@sympatico (HA! I got my account 1st). That said I tend to use iliaa quite frequntly since ilia often tends to be taken . After a bit of research, I've come to a conclusion that to get ilia.[extension] I'd have to resort to using some strange country code like .cn (China) or (.tw) (Taiwan) or even stranger variants such as .co.nz. Fortunately, I remembered about the newly added .ws (WebSite) domain extension, which to my great surprise was not yet taken by some domain squatting bastard (See: http://ilia.com, http://ilia.net, http://ilia.org/) and grabbed it for myself. Which is what made the page you are looking at possible. Tuesday, April 6. 2004
Look Ma , I'm a writer! Posted by Ilia Alshanetsky
in Publications at
13:03
Comments (0) Trackbacks (0) Look Ma , I'm a writer!
My inner workaholic is hard at work making sure my daily work load does not drop below the minimum of 12 hours. Consequently I will be writing another article for PHP|Architect in addition to the one (404 handling) that will be published in April's issue. This time I will foray into the exciting world of making complex URL requests via PHP through the newly introduced context parameter in addition to the old favorite, cURL.
On the positive note, Marco will have an absolutely 'smashing time' trying to make sense out of my drivel. MUWAHAHAHAHA! Tuesday, April 6. 2004
Spring International PHP Conf. Posted by Ilia Alshanetsky
in Talks at
11:55
Comments (0) Trackbacks (0) Spring International PHP Conf.
May 3 - 5
Amsterdam, Netherlands http://www.phpconference.com/ At this conference I will be giving my two favorite talks. One about SQLite and the other about optimization of PHP. Here is a detailed description of the talks themselves for those who are interested in attending. Accelerating PHP Applications without changing their Source. A detailed tutorial on how to increase speed of PHP applications via third party tools, environment tuning and various compiler tricks. Introduction of opcode caching mechanisms, review of their capabilities and a comparison of their performance benefits. Analysis of various proxy caching mechanisms and webserver tuning parameters. Overview of OS and environment parameters that can bring significant performance benefits. Indepth Overview of SQLite Database and its PHP Interface. detailed tutorial on how to increase speed of PHP applications via third party tools, environment tuning and various compiler tricks. Introduction of opcode caching mechanisms, review of their capabilities and a comparison of their performance benefits. Analysis of various proxy caching mechanisms and webserver tuning parameters. Overview of OS and environment parameters that can bring significant performance benefits. |
Categories
|