|
|
Thu, May. 8th, 2008, 02:05 pm HDTV and the Wii
So yesterday I stopped at the Game Stop, E.B. Games, Target, and Best Buy for a Wii. No such luck. I got an HDTV converter instead with my http://www.dtv2009.gov coupon. The HDTV tuner could hardly tune anything in. I just barely got 17-1, and some weird lawyer infomercial channel. I needed an antenna for HDTV, the wire out the window is just not going to cut it. After lunch today I stopped in the Gallery at the Radio Shack to get a small set-top yagi for HDTV (apparently multipath affects the american version of HDTV more than the better European standard - no surprise there - big business money controlling the FCC again). Radio shack was swamped. I left. On a whim, and since I fear/hate/loath the gallery, I wanted to kill two birds with one stone... I did a random drop by for the Wii at Game Stop. I missed it by one hour! NO! NO! NO! Random drop by at E.B. Games. YES! YES! YES!
Thu, May. 8th, 2008, 11:01 am gnome sucks
gnome file selector sucks ass!
Thu, May. 8th, 2008, 01:37 am Using libchart as a cakephp vendor application
First off, in cake 1.2, you vendor() is depreciated, so you'll have to use App::import('Vendor', ... ); A link on its usage can be found <a href="http://cakebaker.42dh.com/2008/03/2 6/loading-vendor-files/">http://cakebake r.42dh.com/2008/03/26/loading-vendor-fil es/</a> First off, we want to unpack libchart tarball, and put the libchart directory in /app/webroot/vendors/. The basic steps for creating a graph are: - Create an action that will *just* fetch data
- hand the data over in a predetermined fashion to the view.
- Then the view will call a helper function which will do the actual graphing (libchart calls).
So for example, I created an action in my controller which displays a number of fruits. Important things to note are the first three lines, this turns off all verbose debugging, and default layouts which will get in the way of the PNG. The "predetermined" fashion is that my helper is going to accept a chart title, and an array of data in the form of x-labels => y-vals. class FruitsController extends AppController { var $helpers = array('Html', 'Form', 'Javascript', 'Graph'); ... function chartFruitTotals($id = null, $rndm = null) { $this->layout = null; $this->autoLayout = false; Configure::write('debug', '0');
// do some database stuff here to get data. I'll use a prefilled array $chartData = array ('apples' => 3, 'pears' => 4, 'oranges => '1', 'peaches' => '2'); $chartTitle = 'Fruit Totals'; $chartData = $alertTotals; $this->set(compact('chartTitle', 'chartData')); } ... }The view is rather simple. Just call the GraphHelper's method which will do the charting. <?php $graph->showChart($chartTitle, $chartData); ?>The helper method is where the magic will be. Since libchart.php in its own directory (two directories deep) we'll be using the following syntax: App::import('Vendor', 'libchart', array('file'=>'libchart'.DS.'classes'.DS. 'libchart.php')); where DS is the directory separator. I just ended up copying a barchart demo file that came with libchart and just slightly modifying it. <?php App::import('Vendor', 'libchart', array('file'=>'libchart'.DS.'classes'.DS.'libchart.php')); class GraphHelper extends AppHelper { ... function showChart($chartTitle, $chartData) { header("Content-type: image/png"); $chart = new HorizontalBarChart(300, 250);
$dataSet = new XYDataSet();
foreach ($chartData as $xLabel => $yValue) { $dataSet->addPoint(new Point($xLabel, $yValue)); }
$chart->setDataSet($dataSet); $chart->getPlot()->setGraphPadding(new Padding(5, 15, 15, 100)); $chart->getPlot()->setLogoFileName(null); // get rid of the annoying logo
$chart->setTitle($chartTitle); $chart->render(); } ... ?>Now, what that will do is spit out a raw PNG file to that particular view. If you would like the chart to appear as an <IMG> anywhere in your pages, you probably want to do a component or something similar that does the same as the helper and just $chart->render($tmpfile) it out to "tempnam", or "tmpfile", and a wrapper in the img/ directory @readfile's the tmpfile/tempnam. To be safe, make sure any reads are escaped correctly. There are other ways to skin that cat, but at this point it's just plain ol' php.
Wed, May. 7th, 2008, 02:07 am libchart, jpgraph
So the documentation for artichow was in french, and I couldn't figure out how to make it plot horizontal bar graphs. UGH. But it looks like libchart, can do exactly that.Nice.
Wed, May. 7th, 2008, 01:00 am Aritchow Graphing
A PHP API to generate dynamic NICE LOOKING charts. This is GREAT! I've been looking for this FOREVER! Alas all the docs for it seems to be in french, but at least the API is in english. If I only had this when I started working on the older version of the kutzik project, I wouldn't have had to deal with GNUPlot, which, while functional, looks rather unprofessional. http://www.artichow.org/http://www.artichow.org/
Sun, May. 4th, 2008, 07:31 pm dtv2009 and the Wii
So brad and i FINALLY decided that our birthday gifts to each other (considering that were 13 days apart) would be a dtv converter (with the $40 gov't coupon http://www.dtv2009.gov ) and a Wii. Brad wanted to wait until the next revision of the iphone before getting one so it'll prolly be his x-mas gift. So we biked down to the best buy and were tieing up, when this guy standing on the wall to the best buy, was talking on the phone. In effect he said that he was waiting for a wii. I start to slow down my bike tieing and start to listen while he's talking on the phone then stare, and eventually grin - from ear to ear. He notices that I am there for a wii, and starts doing the same. When he's done on the phone, he starts to explain that he and ... 30 other people, standing against the wall, whom I'd failed to notice, were waiting for a wii as well. It was some super special deal or something, but yet, they were all paying the same price. Brad ran inside to find out if they had any, and they were all "out". Gezus! We're not talking about the iPhone here, folks.. it's a freakiin' wii. The reason why we went in person, is because we decided (today) to finally buy one, and went straight away to get one. Honestly, if i knew i'd have to wait, I would have just ordered one on-line anyways. (Which is how I buy anything anymore, anyway.) And I never did get the digital to analog TV converter box, with my $40 gov't coupon. We decided that we just don't watch enough TV to justify trashing a perfectly good tv to buy a digital one. It'd be better on the environment to just get the converter.
Fri, May. 2nd, 2008, 07:45 am Duran Duran
So Duran Duran's gonna be at the Mann Center May 22nd. I would go except that you need a car to get up there! If you go on a bike or bus they might actually ask that you "leave your bag in the car". I don't think I'm ever going back. It would have to be someone I would REALLY REALLY REALLY REALLY want to see. Devo's going to be at Penns Landing at the end of June! :) Cut Copy (to which I have tickets) is going to be at Pure on May 10th. w00t!
Fri, May. 2nd, 2008, 01:17 am Converting multiple TIFFs to one small PDF
OK. So I just spent the last two hours trying to figure this ImageMagick program out. I wanted it to do, relatively, the same thing that Gimp could do with the results being similar. Problem: I wanted to convert a bunch of TIFF files from our office copier/scanner (one tiff per page) into a self contained PDF. Complication: Using the straight through no options command "convert" from ImageMagick would produce really REALLY large PDF's - when it wouldn't crash from running out of memory. Requirement: It needed to be about 200 - 400k MAX and print out at the original size. So, I tried all of these options with image magick, and a lot of the time, I could "resize" the image, and it looks fine in EOG or The GIMP, but when I would write it out to ps or pdf it would produce an 8.5x11 page, but with the scanned image taking up 1/32 to 1/4 of the page. The following commands pretty much give me 200k - 500k sizes. The quality of the image (as you would expect) go from decent to pretty good. Since this is just a way of scanning paperwork, converting them to 1bit PDF would do too. The input files were 591k for page1.tif, and 237k for page2.tif with an original resolution of 600x600dpi. - Reduce the resolution to 200dpi, and resize it to 25%, THEN before spitting it out as a Postscript file, increase it back to its original 'print' size
- convert page[12].tif \( -colorspace gray \) \( -resample 200x200 \) \( -resize 1275x1650 \) \( -resize 1700x2200 \) step3c.ps
- ps2pdf step3c.ps
You can leave out the middle "resizes" but my file size jumped at that point way too much. Leaving out the middle resize, and my file size went from 270k to 355k. Leaving out both resizes it was still at 355k, but the image quality was poorer. ps2pdf I noticed produced the smallest file size. In fact, using the built in ps2pdf the file size was twice as much!
Thu, May. 1st, 2008, 11:00 am Juniper's SSL/VPN
There were problems with the SSL/VPN after upgrading to 6.0r4.2.1 where the user would visit a site with Active X components and it would not load the component. Changing the Web Caching policy for the affected site to "Unchanged" seemed to do the trick. 1. goto "Resource Policies" -> "Web" -> "Caching" 2. create a new policy for the affected website, in this case it was "foosite*:80,443/*" 3. action "Unchanged (do not add/modify caching headers)"
Tue, Apr. 29th, 2008, 12:34 pm TIFF to PDF
So there's this new copier at work which can also scan documents. The documents it produces are in TIFF format (one per page scanned). Typically, I would want to get them into a format suitable for PDF'ing. The problem is that I hadn't figured out how to get multiple TIFF files into one file. There might be an easier way, but here goes.
- download the TIFF
- open it in the GIMP
- Convert it to greyscale (or truecolor)
- Scale it down to 25% of the original size, set the DPI to 200
- Zoom to 100%
- Save as... filename.ps (postscript)
- In the dialog box that comes up, set the image size to 8.5x11, change the X and Y offset to 0.
- Rinse and repeat for each TIFF file
- cat each file in page order to a new file (cat *.ps > new_file.ps)
- Run ps2pdf on the new_file.ps
Now if I could only use ImageMagick to manipulate the TIFF file, then I could script the whole thing.
Tue, Apr. 29th, 2008, 10:49 am Smiths Rule
I have been listening to the Smiths all morning, I forgot how good they were! Does this mean that they're no longer my favorite band?! Shock and horror!
Thu, Apr. 24th, 2008, 11:35 am Joe Coffee Bar on PBS's NOW
Joe Coffee is on PBS's NOW (with David Broncaccio) http://www.pbs.org/now/shows/416/index.htmlYou can watch it in its entirety online. There's even a cameo of me! Well not really a cameo if you call a blob in the background one. Health care costs in the Keystone State are 11 percent higher than the national average and rising twice as fast as the average wage. The state legislature is debating a plan backed by Governor Ed Rendell to provide benefits to hundreds of thousands of Pennsylvanians, but there's disagreement over who's going to foot the bill.
Thu, Apr. 24th, 2008, 12:30 am
OK, so I've been hunting all evening for something that's been in front of my face the entire time. All I wanted to do was paginate() the result of a specific query... THAT'S MY PROBLEM. I was asking the wrong question. I wanted to paginate the result of a particular condition. I went as far as creating the specific paginate query in the model (which is where complex paginate queries go, not the controller). Then I asked myself, if I can pass it a $condition, why can't I just do that in the controller with the default paginate(). THEN IT HIT ME! $this->paginate is a fancy kind of Model::findAll(). The same options you can give findAll() you can give to paginate(). OK, so... - You can set some defaults to $this->paginate() as a 'var' in the controller called 'paginate'. (See previous post) This will apply to all vanilla $this->paginate() calls.
- $this->paginate() returns what $this->Post->findAll() would return.
- It also accepts all options findAll() would accept.
- Use it as you would findAll(): http://book.cakephp.org/view/448/findall
Putting it all together, five hours ago, in my "non index action" all I needed to do was: $conditions = array('Journal.incident_id' => $incidentId);
// $journals = $this->Journal->findAll($conditions); $journals = $this->paginate($conditions); $this->set('journals', $journals);
You know, for all the time CakePHP is 'saving' me by auto-generating this code, it's taking back by lack of cohesive well written documentation. Does that mean I give up... ugh, dzang, no... when I 'get' it and it works... it REALLY WORKS! :) I just wish I had more time. I have to get this site done by May 15.
Wed, Apr. 23rd, 2008, 10:28 pm $paginate fields
In cake 1.2 when setting the "displayable" fields of the model in question, use the related model's name. class JournalController extends AppController { ... var $paginate = array( 'Journal' => array( 'limit' => 25, 'fields' => array( 'Journal.id', 'Incident.id', ...
Not 'Journal.incident_id'
Fri, Apr. 18th, 2008, 03:58 pm Go RACHEL!! :)
http://www.huffingtonpost.com/2008/04/17/joe-scarborough-walks-off_n_97330.htmlDid Joe Scarborough walk out of David Gregory's show "Race to the White House" Thursday night on MSNBC? It seems that way by the video below. Joe was a panelist on the show along with Air America's Rachel Maddow, CNBC's John Harwood and former Tennessee Congressman Harold Ford, Jr.
Fri, Apr. 18th, 2008, 11:15 am Truecrypt 5.x Horrible
OK. So I tried to check out the new version of TrueCrypt for linux (5.1a)... plainly... it sucks. They forced a GUI using wxWidgets (which I've never gotten to work successfully for programs which need to be compiled, particularly wxPython). And that's just the "first" problem I've encountered. Apparently, lots of people hate the new version, and a lot of the features are stripped out of it. Someone who's spent more than three hours trying to get it to work posted the following on truecrypt's forums: PostPosted: 15 Mar 2008 Sat 00:15 [Link to This Post] [Report to Admin] Reply with quote Before I begin my review of Truecrypt 5.1, You should know that I am not new to encryption. I have been using truecrypt 4.3 first on windows and then on linux with good results. Everything I do on this machine is automatically encrypted after login. While truecrypt without a gui was difficult to use at first, as I learned the commands it actually became easier and more efficient to use. Always, I found it to be fast, responsive and seamless.
Today, I installed truecrypt 5.1 on an older machine, to test it out. The experience has been so unforgivably horrible, that I have had to revert to 4.3 just to accomplish the most basic of tasks. I found myself writing a list of everything wrong with this version so as not to forget something.
As a linux user, there is a lot to find attractive in version 5. For example, Mounted volumes appear in the side pane of Nautilus. The graphical user interface has been ported from windows. When selecting a drive to encrypt, the GUI will list the size of each partition preventing the horrible of mistake of typing /dev/sdb instead of /dev/sdc. However, if you don't want to use the GUI you will have to type truecrypt -t before every command. This quickly gets tiresome. If I wanted to launch the GUI, I wouldn't have typed $truecrypt in the command line, would I. This became so tiresome that I was forced to create a wrapper to prevent the damned little GUI windows from launching every time I did anything in the command line.
If you are confused about any of the new features in truecrypt, don't expect to go to the man pages. What once existed in truecrypt 4.3 seems to have been erased. The 'Help' function doesn't work either. Other annoyances to add to the list: 1. The icon for truecrypt that appears in the sytem tray, disappears the moment you close the program. 2. Double clicking on a drive is supposed to open a file explorer window of the drive. It doesn't even fail, it just sits there doing nothing. 3. $truecrypt -d # doesn't appear to work anymore. 4. Even in text mode, you will have to dismiss more questions to accomplish basic tasks. 5. I couldn't mount unformatted volumes from the command line. (more on this in a bit)
These annoyances are not the worst of it. The structure of truecrypt has been so fundamentally altered that I couldn't even do a relatively simple task: create an XFS encrypted volume on an external drive.
After creating the encrypted volume, I attempted to load it so I could make the XFS filesystem. ( Why truecrypt can't give me this option when I first created the volume is a mystery to me. only the FAT filesystem is available) After typing in my long password, truecrypt refused to let me load it because the partition had no filesystem. Of course it doesn't! I haven't formatted it yet! Instead of letting me mount it anyway I had to type in the entire password again, but this time click the button more options and select "do not mount." Grr.
I opened Gparted, my favorite disk formatting utility, but it seems truecrypt has changed the way it works. Instead of mount volumes on /dev/truecrypt? It now mounts them on /dev/loop? This means that truecrypt volumes don't show up in Gparted anymore. It also destroys all old scripts that I had built to work with truecrypt. "Okay", I thought, I'll just have to use the command line $mkfs -t xfs /dev/loop? This work for the first few innodes, but then stalled on 28/1100. "Stalled" is to weak a word, it completely FROZE the entire computer forcing me to do a hard reboot.
Regardless, I pressed on. I created the XFS filesystem using a different computer that still had the GOOD truecrypt installed. Then, I mounted the volume with BAD truecrypt and attempted to copy some files. It was 60 MiB in when it completely FROZE the computer once again. I watched as the time remaining counter started count up. The message box was saying 400 HOURS estimated before I had enough and did a hard reboot again. It's as if the entire driver has been rewritten and the result is EPIC FAIL. This reminds me of the problems experienced by Windows Vista users.
By this point, I had had enough. I reinstalled truecrypt 4.3 and did everything I mentioned earlier. The volume formatted flawlessly and the file copy only took a few minutes. Suffice it to say, I will not be going back anytime soon. The minor annoyances, I could have worked around for the easy use of the GUI. But to fail so completely at the most basic task. That is simply unforgivable.
Tue, Apr. 15th, 2008, 05:43 pm Audacious Plays Streamripper!
So, I finally figured it out. I'll have to retract my bug, and post something to the mailing list about this. In the home directory there was a ~/.config/audacious directory. I rm -rf'd it and started audacious. Opened the local stream http://127.0.0.1:8000 with streamripper running the relay stream, and everything worked!
Sat, Apr. 12th, 2008, 09:46 am NYC
Welp, today I am going to NYC to eat out with my mom. It was her birthday yesterday. I can't wait to see her. It's been since Christmas!
|