Enough ClearType! Go GDI++!
Did you ever want to replace the ugly ClearType with something better? I know I have. And my prayers have been answered - meet GDI++ - the solution to all your font problems. Enough words, see it in action (this is Verdana, btw):
Well, I think that the difference is pretty obvious. So if you are ready to start you new font life - go here and download the file named gdi0870.zip (404kb). Extract anywhere you want and launch gditray.exe. Choose 'enable' from the context menu of the tray icon and voila - your font are rendered without the help of that ugly, ugly ClearType.
RoR: Session / login management
This is basic yet not obvious in Ruby on Rails - I've been looking for info on this for a long time (a long time for this problem is anything more than 5 minutes).
So, this is the way you make sessions/logins work in ruby:
class SessionController < ApplicationController
def login
@session['logged'] = true
end
def logout
@session['logged'] = false
end
end
The @session variable is available anywhere. Use it anywhere. For example you could come up with the following view showing whether the user is logged in:
<p>Logged in: <%= @session['logged'] %> </p>
And that is it. Anything beyond that (like adding a User model etc.) is out of this post's target. There are many articles on those things yet no clear explanation where to find and how to init a session. As you can see - the answer is clear - you don't
The session is already there. Just start using it.
Komodo Edit tools – add style.css and reset.css
Good morning, planet. Today I am going to share a very useful script I am using in Komodo Edit (it automates adding style.css). It is very (!) simple yet very effective for me and, probably for others who are doing a lot of HTML files and face a problem of repetitive actions.
This thing works as follows (the use case):
- You create a new HTML file in komodo and save it in some directory.
- You double-click the script in the Komodo Edit toolbox.
- The script adds the following folders/files to the project (paths relative to the file currently in editor!)
- css/
- css/style.css
- css/reset.css
- Also the file adds the following HTML code at the cursor in current opened file:
Voila. The needed action is done.
How-To: Create a horizontal menu
This is a tutorial on how to create a fully costomizable horizontal menu. Why another menu how-to? Well, mostly because there are situations when there are no suitable google results (based on my experience) and you have to come up with something yourself.
These are the features we will try to get into our menu:
- It will be horizontal
- It will have splitters (made with images)
- It will have active class for rollover / selected item (background change)
- Menu items will be of different size
This code works for Internet Explorer 6+, Firefox 2.0+, Opera 9+, Safari (at least on Safari 4 - tested on Windows version of it).
Here is a mockup that we have:
Menu mockup
NB! If you just want to see how to do it - go here for the demo / full code.
Web development future
As you may already know I work as a web developer. This means I encounter a lot of (X)HTML, PHP and JavaScript. There is no doubt that those are the most widely used tools for small/medium websites as well as there is no doubt that with all the new trends, with the increasing will to build the "Web 2.0" the developmet becms harder and harder. There is a tremendous amount of ways to implement things, a huge number of frameworks out there than say "Hey, use me! I am the best!". Obviously, this is very stressful for the developer. And what is more stressing is the complexity of the code.
Remember how you used to write those small pure HTML pages without caring about whether it passes the validity tests? Remeber how you didn't care about Mozilla, Opera and Safari? You only had to make sure that this will work in IE and put a small text on the front page - "This site was made for IE6".
After that came PHP, which was overwhelming. It is a great tool designed to make scripting pages with ease. Then came databases and object-oriented paradigms. That is the time when I first started to feel frustrated. The code did not fit into my head anymore. I had to review the classes I have, the functions that they have, members, deal with connections and other crap.
And the latest thing - AJAX. This thing has been terrorising every single web developer. When I hear AJAX I always have two conflicting feelings - it is cool and it is very unpleasant to make it happen. I mean JavaScript was so simple (and mostly unnecessary) until AJAX hit the internet (and Web 2.0, of course). All you did was getElementById and validate forms with it sometimes.
Where am I going with this? Well... It is simple. At the moment the whole web development process with HTML/PHP/JS is quite complicated if you want to make something exceptional. As I work I keep seeing that I am performing repeating actions now and then. And I think that now it is time to make something new. A new way, a new tool, tailored for the specific needs of the web developer community. I will be not surprised if it will be something ASP.NET-like. Let it be. It is time to either dramatically improve the web development tools we have now or to create a new all-in-one tool that takes the concepts of HTML, PHP and JS/AJAX together and puts them into a universal form.
Web development tools I use and recommend
Ok, not being original here, but still... a web developer's blog is never complete without this. Maybe somebody will find at least something useful here. So here goes:
Tasks
- slicing designs into images and cobining it to (X)HTML/CSS
- script writing (PHP / JavaScript)
- debugging
- testing IE compatibility
- quick editing
- database handling
- OS: Microsoft Windows
- others
ORM for PHP – Doctrine
I have been always dreaming about some magical component for PHP developers that would free us from the pain of handling databses. And I have mostly seen useless wrappers for native database functions of PHP. Those always tried to claim that the will make it all better. No luck. Until recently (well, a bit more than recently) I looked into a thing called ORM (Object-relational mapping). Specifically - an ORM for PHP called Doctrine.
A bit of MODx CMS criticism
Today I am going to talk about MODx CMS again. Now, the first post on this topic covered my first impressions of this product. And now I have something else to say.
This time I am going to go a bit deeper into minuses of MODx. Why? Well, all the pluses are available on the official website and I do not see the reason for repeating those. This post does not in anyway mean that MODx is a bad product! It just has some bad sides that I would find very useful to read about before starting to build a website based on this system. This post is healthy citicism and maybe a precaution for those wondering what can't you do with MODx.
MODx CMS overview
Some MODx related post discussing MODx cons is also here.
0. Intro
Today I am going to say something about MODx CMS.
At the moment I have used it to make one website as well as I am using it right now to make another. This is mainly the suggestion of the client, so I am using it not because I like it so very much, but just because of circumstances.
So far my experience with it is, actually, quite pleasant. MODx CMS has a lot of fine features. At the moment I can tell that it at least has the minimal things that are required to make a website. So far I have understood, that most of the MODx functionality relies on the following things: templates, template variables (TV), chunks and snippets. All the other things are quite auxiliary.
So, let us take a look and see what those are.
