Ramblings

November 30, 2009

Links on app testing and functional testing

Filed under: behavior driven development, dev, functional testing, test driven development, tool — michaelangela @ 2:18 pm

I just want these in one place for future reference, in no particular order except the order they are open in tabs in Firefox at the moment…

Software Testing Geek -Software Testing – Selenium IDE, RC Tutorial & Workshop

Examples « Watir

Home – mozrepl – GitHub

Software Testing Geek -Twill – Simple Web Automation Tool in Python

3hv » Blog Archive » Cucumber and WATIR: kick-starting your testing

Home – cucumber – GitHub

Watir

brynary-webrat :: gitrdoc

PHP – cucumber – GitHub

Advertisements

Eclipse PathTools and a 503 error for the DTD

Filed under: eclipse, tip, tool — michaelangela @ 10:17 am

The problem I was having with PathTools (which was only alluded to here) is that Eclipse simply failed to install it… after I installed it once already. Either way the error got me digging into my Eclipse config.

The error message was a seemingly unrelated “Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/html4/loose.dtd”. For whatever reason, Eclipse is actively trying to request and parse the DTD. According to the post below, the W3C gets hammered by these requests and have been actively blocking them with 503’s which is what I got when trying to install PathTools.

W3C Systeam’s blog – W3C’s Excessive DTD Traffic

A while ago we put a system in place to monitor our servers for abusive request patterns and send 503 Service Unavailable responses with custom text depending on the nature of the abuse. Our hope was that the authors of misbehaving software and the administrators of sites who deployed it would notice these errors and make the necessary fixes to the software responsible.

  • Pay attention to HTTP response codes

    This is basic good programming practice: check your return codes, otherwise you have no idea when something goes wrong.

This happens when trying to install PathTools from the update site given on the Google project page:

http://pathtools.googlecode.com/svn/trunk/PathToolsUpdateSite/site.xml

However searching Eclipse Plugin Central site for the plugin shows a different update site:

http://pathtools.googlecode.com/svn/trunk/PathToolsUpdateSite/

And it also shows that it needs Eclipse 3.4+. My install of FlexBuilder 3.2 is running Eclipse 3.3. And THAT turns out to be the crux of my problem. I installed it once (during some late night coding session no doubt) but it never showed up. It did show up in the “Manage Configuration” dialog though. So I disabled it, then deleted the related plugin and feature files, and to make sure it can actually install without the DTD error I tried again. It installed correctly except for the fact that it still doesn’t show up since this Eclipse is too old. So I’ll try a previous version to see if that’ll get it running here. Either that or see if I can get FlexBuilder running with 3.5.

[update]
I got Flex running on Eclipse 3.5 as per the directions noted in the line above. I’ll have to put it through it’s paces to see if it’s behaving correctly, but PathTools is oh very nice. 🙂

[update2]
Unfortunately the issues noted at the link for installing FB3.2 and Eclipse 3.5 happened for me as well so it’s back to my current working install for now.

EploreFS for Eclipse

Filed under: eclipse, tip, tool — michaelangela @ 9:44 am

In this post I mentioned trying to get PathTools to work and that I’d look into it later. That’s for another post upcoming in just a moment. But for now, there is ExploreFS mentioned below. It gets you to the folder where the asset is stored so you do still have to navigate to it but that’s still easier pretty good. Once it’s highighted (and you’re on a Mac) you can of course use Quicksilver to copy the highlighted file’s path to the clipboard.

Eclipse Plugins – RSS View, ExploreFS, and FreeMem

Eclipse Plugin: ExploreFS
ExploreFSExploreFS is a tiny plugin (~6KB) that opens a selected file in the folder of the native file manager. It adds “Explore in File System” to the context menu of Eclipse’s package explorer, resource navigator, and other views. Windows, Mac OS X, and Linux are supported.

Dealing with floating point numbers in AS3

Filed under: as3, math, tip — michaelangela @ 8:08 am

I’ve only seen it happen occasionally but the utility functions here and also that posted by Troy further down look quite helpful.

Floating-point errors got you down? – Josh Talks Flash

Many developers will never encounter issues when floating-point math fails to return the correct result. Every once in a while, when you’re expecting to see a number like 10.1 in your trace panel, you might actually see 10.1000000001. This isn’t a specific issue with Flash either. By it’s very nature, any sort of calculation with floating-point numbers can result in tiny, nearly insignificant errors anywhere in modern computing.

November 24, 2009

Revealing an asset in Eclipse in the Finder

Filed under: automation, cool, eclipse, tip — michaelangela @ 3:35 pm

So my previous post about using PathTools isn’t working at the moment but the tip below does get the file open in Finder (well Pathfinder in my case). External Tools can obviously be quite powerful.

In eclipse, reveal current file in filesystem – Stack Overflow

Great tip. On Mac OS X, replace the location with /usr/bin/open and the arguments should be just ${container_loc}. – zvikico Jul 22 at 5:27

Copy path of asset in Eclipse

Filed under: cool, eclipse, tool — michaelangela @ 3:24 pm

I often find myself alt-clicking an item to pull up the properties to get the path to that file/folder/etc. Just found this. Nice! Copies paths, folder paths, other commands, terminal open to the path of the file, find the item in the file explorer of the OS, and other goodies.

pathtools – Project Hosting on Google Code

and was this is how it was originally made?!

update: not able to get it to work in FlexBuilder 3.2 at the moment. I’ll have to look into it later.

Quicksilver + pbpaste + pbcopy

Filed under: automation, cool, osx, tip, tool — michaelangela @ 3:07 pm

After seeing the following post, many possibilities came to mind.

Notes: Pretty print XML

But working with XMPP and SAPO Broker, I’m always copy&pasting XML from one place to the other and it would be nice to format the XML snippet sitting in the clipboard.

This pipe does the trick quite nicely:

pbpaste | xmllint –format – | pbcopy

I wrapped this into a script, called x-xml-format-clipboard and now its just one command away from gratification.

In the end I came up with a couple that I use a lot after searching the web. The possibilities are endless but these are neat for me. In Eclipse I can’t easily transform text unless I install AnyEdit which I have on other systems. But I haven’t yet on this one. So the transforms are simple:

upper to lower:

#!/bin/bash

pbpaste | tr '[:lower:]' '[:upper:]' | pbcopy

lower to upper:

#!/bin/bash<br /><br />pbpaste | tr '[:upper:]' '[:lower:]' | pbcopy<br />

remove blank lines:

#!/bin/bash<br /><br />pbpaste | grep -v '^

These are made into executable scripts on my path which I can then pull up with Quicksilver. So now to remove blank lines, I select the text in any editor, trigger Quicksilver, highlight the command, press enter, and paste it back. Nice. Of course this means that you can do just about anything with this kind of thing as discussed here. | pbcopy
These are made into executable scripts on my path which I can then pull up with Quicksilver. So now to remove blank lines, I select the text in any editor, trigger Quicksilver, highlight the command, press enter, and paste it back. Nice. Of course this means that you can do just about anything with this kind of thing as discussed here.

Kids illustration tute for AI

Filed under: illustator — michaelangela @ 2:44 pm

Very cute, and not at all crazy. Another note to self to check out.

How to Create a Crafts Inspired Vector Kids Illustration

Learn how to create a couple of cute and simple kids illustrations of a car and airplane using Adobe Illustrator’s basic shapes. Take inspiration from hand crafted artwork to give each graphic a plaid effect fabric texture and stitching effect.

Nice set of Photoshop actions to add a little spice to images

Filed under: automation, photoshop, tool — michaelangela @ 2:42 pm

Note to self: check this list again later.

20 Photoshop Actions to Add Flair to Your Photos

The non-professional photographers among us are often left with boring and flat shots from our cameras, the photos lack the flair and energy that is achieved with expert techniques and equipment. Photoshop Actions on the other hand, can help recreate some amazing photo effects, just by pressing a button! This post rounds up 20 of the best Photoshop Actions that allow you to easily spice up your photos with popular effects, including HDR, Soft Focus, Lomo, Velvia and more!

Commandline calculator for OSX

Filed under: osx, tool — michaelangela @ 2:39 pm

Every now and then I like to do a bunch of quick calcs with references back to previous calcs. I can use iPython which is really powerful tool since it’s an advanced interactive frontend to python. But this is just a neat little tip.

[awk] Command line calculator using awk « *NIX tricks

This is an update on our bash command line calculator posted a few days ago — except for the fact that this time we’ll use awk to do the calculation instead of bc. As I mentioned in that post, you may use python or ruby (irb) to do the same thing, but these tricks may be useful if you don’t ruby or python installed (bc and awk, in general, come by default in any Unix or GNU/Linux distro).

First, create (or rewrite if you used our last trick) function “?” as follows and put it in your ~/.bashrc file:
? () { awk “BEGIN{ print $* }” ;}

and make sure to reload your ~/.bashrc file (do the similar thing if you’re using any other shell). [NOTE: ZSH does not like “?” as a function, so you might consider replacing it with something reasonable, e.g., “compute”]

Now, if you want to calculate an expression, do it, for example, as
$ ? “2*3+4.0*(9.9+8.1)”

and don’t forget the quotes.

Automating Firefox… from within…

Filed under: cool, dev, firefox, functional testing, testing, tip, tool — michaelangela @ 2:34 pm

This is just crazy cool. Just noting for future use.

MozLab | hyperstruct

MozRepl

Connect to Firefox and other Mozilla apps, explore and modify them from the inside, while they’re running.

Execute Javascript, play with browser GUI, sneak into HTML pages, examine functions and variables, redefine them on the fly, hot-fix bugs, …

FunFX Tutorial

Filed under: cool, dev, flex, functional testing, tool — michaelangela @ 2:30 pm

Just for future reference… this is some nice stuff indeed!

Testing your Flex app with new FunFX | Ladislav Martincik – Personal website

Flex Functional Testing

Filed under: dev, flex, functional testing, tool — michaelangela @ 2:28 pm

See the syntax example on the page for a quick reference. Wow…  that’s pretty cool.

.::FunFX – Functional Testing of Flex applications

FunFX is created as a framework that will enable you to drive a Flex application through a web browser. FunFX together with for instance Test::Unit or rSpec creates a great to for testing and asserting the functionality of a Flex application.

Flash Functional Testing

Filed under: flash, functional testing, tool — michaelangela @ 2:25 pm

Looking into functional testing, i.e. testing a user interface to make sure it does what it’s supposed to. There are a lot of web tools which I’ll try to log here for future reference but I also wanted to note Flash resources as well.

flash-selenium – Project Hosting on Google Code

The FlashSelenium is the component adding Flash communication capabilities to the Selenium framework.

Basically, the FlashSelenium is a Selenium RC Client driver extension for helping exercise the tests against the Flash component.

November 23, 2009

Flash and Salesforce: HTTP POST using PHP but with no access to cURL

Filed under: cool, php, salesforce, tip — michaelangela @ 11:53 pm

Have a client who needs some Flash to HTTPS webservice functionality. Flash and HTTPS are a difficult pair when not on the same host and all the policy files aren’t in place. The simple solution is a proxy. But this particular client’s webserver doesn’t have cURL. What to do? Making streams with a custom context is really simple. Looks good too. In the end I didn’t use fopen, stream_get_contents, etc. though. I used file_get_contents.

HTTP POST from PHP, without cURL – Evil, as in Dr.

I don’t think we do a very good job of evangelizing some of the nice things that the PHP streams layer does in the PHP manual, or even in general. At least, every time I search for the code snippet that allows you to do an HTTP POST request, I don’t find it in the manual and resort to reading the source. (You can find it if you search for “HTTP wrapper” in the online documentation, but that’s not really what you think you’re searching for when you’re looking).

And there is also a note on php.net about doing this with https.

So in the end my code looked like (no closing php tag intentional):

<?php
$url = "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8";
$data = $_POST;
$data = http_build_query($data);
$result = do_post_request($url, $data);
echo $result;

function do_post_request($url, $data, $optional_headers = null)
{
   $params = array('http' => array(
                'method' => 'POST',
                'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
	                . "Content-Length: " . strlen($data) . "\r\n",
                'content' => $data
             ));
   if ($optional_headers !== null) {
      $params['http']['header'] = $optional_headers;
   }
   $ctx = stream_context_create($params);
   $response = file_get_contents($url, false, $ctx);
   if ($response === false) {
      throw new Exception("Problem reading data from $url, $php_errormsg");
   }
   //var_dump($response);
   return $response;
}

Blog at WordPress.com.