Our minds cannot repel logic of that magnitude!
Archive for November, 2008
Server Downtimes Addressed
Nov 24th
It came to my attention over the weekend that the Apache webserver running on my server was down for approximately 4 hours on Saturday, and again for about an hour on Sunday. For some reason, Apache keeps receiving terminate signals and shuts down – but I cannot find any real reason behind it in the logs. The best guess I can make is that something is going on with Passenger (a.k.a. – mod_rails) with a spawned Ruby on Rails app, but since I love Redmine too much for SCM and project management I’m going to let this one slide.
Anyways, this problem has been addressed. I installed a process monitor on the server which checks running applications and daemons every minute to make sure they’re up to snuff. Should Apache crash, hang, or simply take up far too much memory it will be restarted. So far in the time since it was installed yesterday, it restarted Apache successfully when it was down this morning. Hopefully I will find a reason behind Apache’s sudden deaths soon so that I do not have to rely on the monit daemon simply to restart it.
Enlightenment DR17, Gentoo, and a PowerPC
Nov 13th
So I have an old PowerBook “Pismo” that I inherited for nothing. It originally had Mac OS X on it, but it ran it way too slow for my likes – so I decided to put Linux on it – Gentoo to be specific. After getting the system working, which was actually extremely easy I might add (with the exception of the Hermes-I wireless card not supporting WPA), I went on to put X and a window manager in. I wanted to use Enlightenment because it’s fast, it’s cool, and because I like it.
After using layman to add the portage overlay and performing a –pretend install from emerge, I saw that E17 had been masked ~ppc. I scoured through the internet to see if there was some logic to it being masked against the PowerPC architecture, but could not find anything entirely definitive (or at least definitive and less than two years old). So, I decided to simply just ACCEPT_KEYWORDS=”~ppc” emerge -av e and pray for the best.
So what’s the purpose of this post, you might ask? Well, to make a long story short – Enligtenment DR17 works perfectly on the PowerPC architecture (or at least the revision I have checked out from SVN does). So if you’re a fellow Gentoo user who wants to install E17 on your PowerPC machine – I’m here to tell you that, for now, it works. Just accept the keyword, emerge it and enjoy your new WM!
Flex AdvancedDataGrid/DataGrid Optimizer
Nov 11th
Okay, this one is for all the fellow ActionScript/Flex programmers out there. Have you ever dumped data into a DataGrid or an AdvancedDataGrid only to have your column widths be completely off, or even your row heights be off? Don’t you hate it when the contents of your grid’s cells are cut short? Well here is an easy function that resizes your columns and your grid’s rowHeight so that your data is completely displayed (provided your grid is large enough, of course).
This function takes into account both width and height, and allows you to specify padding for the width and height. It analyzes the measured display height and width of each data cell and assigns the largest values for width to each column, and the largest value for height to the DataGrid/AdvancedDataGrid’s row height. Simply pass it the DataGrid/AdvancedDataGrid you want to optimize width and height for, and the padding values, should you want to put in padding. I call this the xGrid Optimizicator™. Hope it comes in useful!
import mx.controls.AdvancedDataGrid; import mx.controls.advancedDataGridClasses.*; import mx.controls.DataGrid; import mx.controls.dataGridClasses.*; private function optimizeDataGrid(dg:Object,widthPadding:uint = 0,heightPadding:uint = 0):void { if ((!dg is AdvancedDataGrid) && (!dg is DataGrid)) return; var col:uint; var tf:TextFormat; var renderer:UITextField; var widths:Array = new Array(dg.columnCount); var height:uint = 0; var dgCol:Object; if (dg.columnCount > 0 && dg.dataProvider != null) { for (col = 0; col < dg.columnCount; ++col) widths[col] = -1; for each (var item:Object in dg.dataProvider) { for (col = 0; col < dg.columnCount; ++col) { if (dg is AdvancedDataGrid) renderer = new AdvancedDataGridItemRenderer(); else renderer = new DataGridItemRenderer(); dg.addChild(renderer); dgCol = dg.columns[col]; renderer.text = dgCol.itemToLabel(item); widths[col] = Math.max(renderer.measuredWidth, widths[col]); height = Math.max(renderer.measuredHeight, height); dg.removeChild(renderer); } } for (col = 0; col < dg.columnCount; ++col) { // Added to take into account header text - thanks modtodd! renderer = new DataGridItemRenderer(); dg.addChild(renderer); renderer.text = dg.columns[col].headerText; widths[col] = Math.max(renderer.measuredWidth,widths[col]); dg.removeChild(renderer); if (widths[col] != -1) dg.columns[col].width = widths[col] + widthPadding; } if (height != 0) dg.rowHeight = height + heightPadding; } }
New Server, Projects on Subversion
Nov 7th
Well, after being completely disgusted with my previous web host, I made the decision to pick up a VPS from a New York-based hosting company, CreativeVPS. I picked up a couple of their Halloween specials and got a great hosting deal for a great price. As a result, everybody should see an increase in the responsiveness of the website, as well as all of my other websites.
Along with this, since it is a VPS where I get my own root access, I am beginning to switch my project’s SCM to the server using Subversion. Right now both FunFunDC++ and FunFunIRC have been migrated, and you can view the repository as well as issue/support tracking using the Redmine installation I put up. They can be reached at projects.jonnyfunfun.com via both unsecure and SSL. Please note that the SSL certificate is self-signed, so your browser might complain about it being invalid should you decide to go the SSL route.
As for the forums, I am yet to get around to setting them up – so don’t even bother going there yet. Also, the gallery is royally broken and will probably be replaced with a different web-application.
