Archive
@font-face Coming to a browser near you
It’s been a long suat after feature of countless web developers and designers a like. In the upcoming Firefox 3.1, this fancy web feature will return to the web. There is one catch, the new browsers Safari and Firefox only work with truetype and opentype fonts, while existing IE supports embedded open type since 4.0. This means you still have to go through some pain to get the fonts working in IE. In IE 6 the font rendering is pretty bad as well, so don’t expect your fonts to be rendered clearly - they’ll be jagged looking.
Here I have taken screen shots of the embedded fonts rendering in IE 6, Safari 3.1, and Firefox 3.1 beta 2:
Internet Explorer 6, with embedded .eot font faces
Safari 3.1, with truetype .ttf font faces
Firefox 3.1 beta 2, with truetype .ttf font faces
Safari and Firefox look identical, and IE 6 looks a little broken. I haven’t checked in IE 7, but it does have improved font rendering so, I imagine the fonts will look better. Also, I have not tried in Google Chrome to see if they are using a new enough version of webkit to support the @font-face rule.
In order to have all three browsers rendering the new font, you will need to use a few tricks to get IE to choose it’s .eot font instead of the .ttf font.
<head>
...
<style type="text/css">
@font-face {
font-family: "Delicious-Roman";
src: url(/fonts/Delicious-Roman.otf) format("opentype");
}
@font-face {
font-family: "Old Standard TT Regular";
src: url(/fonts/OldStandard-Regular.ttf) format("truetype");
}
h1 { font-family: "Delicious-Roman", sans-serif }
h2 { font-family: "Old Standard TT Regular", sans-serif }
h3 { font-family: "Delicious-Roman", sans-serif }
</style>
<!--[if IE]>
<style type="text/css">
@font-face {
font-family: "Delicious-Roman";
src: url(/fonts/DELICIO0.eot);
}
@font-face {
font-family: "Old Standard TT Regular";
src: url(/fonts/OLDSTAN0.eot);
}
</style>
<![endif]-->
</head>
Here’s a link to a demo page with the fonts embedded. Try it out in IE and Safari or if you have Firefox 3.1; Try it.
Nginx and wordpress with apache
I was getting quiet a bit of traffic on another wordpress site, I’ve been running. I had apache as running php and this started to become an issue. I could upgrade the hardware, but it didn’t seem right - because really it’s not that much traffic… So, I decided to see if I could put nginx in front of apache. Here’s what I have now and it’s working out pretty well with the help of one little note from Millarian.
location / {
index index.html index.htm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_method != GET) {
proxy_pass http://apache;
break;
}
if ( $request_filename ~* .*\.php) {
proxy_pass http://apache;
break;
}
# check if the file exists and serve it
if (-f $request_filename) {
access_log off;
expires 10d;
break;
}
if (!-f $request_filename) {
proxy_pass http://apache;
break;
}
}
Now all static file’s are served directly by nginx. Dynamic requests are passed to apache. I was also able to reduce the value of MaxClients, on the server to avoid running out of memory. MaxClients in apache controls the number of server processes allowed to start. With PHP running each apache process can be as large as 30 - 60 megs per process. This value in fedora core, is set to 256 by default.
Google Adsense is a Scam!
working with processes and ruby
Some code for working with processes using ruby.
# get status from child process before daemonizing rd, wr = IO.pipe fork do rd.close fork do wr.write "hello" wr.close sleep 10 end wr.close end wr.close puts rd.read # run a command and get exit status and command output rd, wr = IO.pipe pid = fork do $stdout.reopen wr $stderr.reopen wr $stdin.reopen rd exec '/opt/local/bin/ls -l' end wr.close pid, status = Process.wait2(pid) puts rd.read puts status.inspect
Pretty easy in ruby.
C++ namespace’s and externally global variables
I ran across an interesting segmentation fault caused by trying to access a NULL pointer, that I thought should not be. Here’s what I had in my main source file:
Siphon::Logger *glogger = NULL; ... int main( int argc, char **argv ) { ... glogger = new Siphon::Logger(); // initialize the global }
Now in another source file;
namespace Siphon { extern Siphon::Logger *glogger = NULL; ... }
Later I realized this caused a warning, but initially, I just ran my code only to receive a segmentation fault when using the glogger in the second source file. Because, of the extern the compiler allowed this to slip by thinking it was Siphon::Siphon::Logger, instead of Siphon::Logger. To correct this, I could either move the line out of the namespace or remove the Siphon:: prefix.
extern Siphon::Logger *glogger; namespace Siphon { ... }
Anerian is Hiring - Engineers
The ideal individual, will have a degree in computer science. He or She should have extensive experience using Ruby on Rails, with an understanding of the inner workings of Javascript, HTML, and CSS. Individuals should be able to transform PSD files into real markup. Candidates should be familiar with MySQL, Monit, and be proficient in C/C++. You should be comfortable applying patches and reading diffs. The unix shell environment should feel like home. Ideal, canidates will have worked on open source projects such as Mozilla, Varnish, Nginx, MySQL, WebKit, Gtk+, etc…
Anerian, is a new and profitable company - the opportunity is great. Candidates should have experience getting requirements from clients and be well spoken. We’re looking for self motivated individuals. The office is located in Washington, D.C. If you are interested please contact me at todd dot fisher at anerian dot com





Recent Comments