Blog of Leonid Mamchenkov

You just stepped in a pile of posts.

Entries Tagged as 'tips'

Fixing Firefox with safe mode

Posted in All, Technology, Web work on June 19th, 2008 · No Comments

Here is something useful I learned today.  Until recently I’ve been using Firefox 3 beta 5.  It was working fine for me after I found all replacements and upgrades for all the extensions that I need.  One of those extensions was CompactMenu (not giving a link for now).  This extension replaces the whole main menu (File, Edit, View, etc) with a single icon.  You can place this icon anywhere on your toolbars and when you click it, you’ll get a drop down with your main menu items.  Huge space saver.

Yesterday, I upgraded my Firefox to the latest and greatest stable version 3.  The update came as an official package from Fedora updates.  However, once I fired up the new Firefox, it notified me that CompactMenu was not compatible with this version and so it was disabled.  Can you guess where I ended up?

Exactly.  No menu and no way to get to the menu.  I tried uninstalling the extension, intalling another version of it, unintalling it again, cleaning up options in about:config, customizing the toolbars, and so on and so forth.  Nothing worked.  And so I Googled.

It turns out that Firefox has something called a “safe mode“.  All you need to do to get to it is start firefox with “–safe-mode” parameter.  Once it comes up, you’ll see the window as on the screenshot above.  One of the optios is “Reset toolbars and controls“.  It works wonders.  I got all the toolbars to their default state, and with View -> Toolbars -> Customize I could easily get them to the state I want.

→ No CommentsTags: , , , ,

BLOB is bad for your (mental) health

Posted in All, Programming on June 16th, 2008 · 2 Comments

If you ever mention that your web application uses database to store files, you risk being flamed into oblivion.  Indeed, in most cases, it is a bad idea, since file system is more effecient when it comes to files.  However, there are cases when it makes sense to have files saved in the database.

Maybe I am doing something wrong, but in the last six month, I had to develop at least three systems that used MySQL for file storage (uploaded files that have to be synchronized across several hosts, etc).  Yesterday, for the third time I stumbled across the same problem, that almost drove me insane.

MySQL has four data types for storing binary data - TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.  Somehow I always forget about these and use BLOB.  BLOB works just fine, but it has a limit on size, which is rather low - 64 KBytes.  The mean thing here is that it will work just fine with most of the test data - text files, short PDFs, and small pictures.  Once the application is tested and put into production, the corrupted files will start coming in.  Re-writing all parts that deal with uploading, moving, cleaning, escaping, and encrypting binary data takes time.  Going through file reading and writing routines is boring too, and it won’t help either.

By the time, the issue is discovered and all fields are changed to LONGBLOB, it is often very late, and you’ve lost your weekend, as well as a lot of large files. This post is an attempt to save my (and your) sanity.

Reminder: use LONGBLOB instead of BLOB for file storage, unless you are absolutely sure about the maximum size of incoming data.

→ 2 CommentsTags: , , , , , ,

RFC 1855 : Netiquette guidelines

Posted in All, Blogging, Technology, Web work on May 6th, 2008 · No Comments

More and more people spend more and more time online. I wish more and more of them read RFC 1855 which covers netiquette guidelines. This document is more than 10 years old, but most of the points that it discusses are as valid today as they were back then. Some are even more important today than they used to be. Another good thing about this RFC is that it has theoretical directions combined with some practical advice.

A good rule of thumb: Be conservative in what you send and liberal in what you receive. You should not send heated messages (we call these “flames”) even if you are provoked. On the other hand, you shouldn’t be surprised if you get flamed and it’s prudent not to respond to flames.

Reading this document won’t make you wise enough to avoid all the mistakes of online communications, but it can seriously minimize them.

→ No CommentsTags: , , , , , , ,

Googley Design Principles

Posted in All, Programming, Web work on April 28th, 2008 · 2 Comments

Very much in line with the image explaining simplicity of user interfaces, comes the list of Googley Design Principles:

1. Focus on people—their lives, their work, their dreams.
2. Every millisecond counts.
3. Simplicity is powerful.
4. Engage beginners and attract experts.
5. Dare to innovate.
6. Design for the world.
7. Plan for today’s and tomorrow’s business.
8. Delight the eye without distracting the mind.
9. Be worthy of people’s trust.
10. Add a human touch.

Anyone doing any sort of user interface work should learn these by heard and repeat them as every morning mantra.

→ 2 CommentsTags: , , ,

Thou shalt not ignore warnings

Posted in All, Programming on April 21st, 2008 · No Comments

Here is a quote from a wise comment in the discussion of the “Linux system programming” book review:

Build your code with -Wall -Werror (or your compiler’s equivalent). Once you clean up all the crud, that pops up, crank it up with -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith. Once there — add -Wreturn-type -Wcast-qual -Wswitch -Wshadow -Wcast-align and tighten up by removing the no in -Wno-unused-parameter. The -Wwrite-strings is essential, if you wish your code to be compiled with a C++ compiler some day (hint: the correct type for static strings is ” const char *”).
For truly clean code, add -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls.
The people, who wrote and maintain the compiler, are, most likely, several levels above you in understanding programming in general and C-programming in particular. Ignoring the advice their code generates is foolish on your part…
As a minimum, solved warnings will make your code more readable by reducing/eliminating the “Why is he doing this?” questions. More often than not, they point out bugs you would otherwise spend hours chasing with a debugger later.
And they make your code more portable. But if you don’t understand, why a warning is generated — ask around. Don’t just “shut it up”. For example, initializing a variable at declaration is usually a no-no. If the compiler thinks, the variable may be used before being initialized, scrutinize your program’s flow. If you can’t figure out, it may some times be better to disable this one warning temporarily with -Wno-uninitialized to move on, instead of shutting it up for ever by a bogus “= 0″ or some such…

→ No CommentsTags: , , , , , ,

Advertisement

  • Linux Weekly News
  • 50 ways to help the planet
  • WordPress publishing platform