Ramblings

February 4, 2010

When GitHub goes down…

Filed under: cool, git, tool — michaelangela @ 6:45 pm

So I started to try out github to work with some AS3 related code which I’ll talk about in an upcoming post. I just forked a bit of code I wanted to make changes to and then not long after that Github went down. But…

Don’t Panic! Because of the distributed nature of git, everyone always has a local full copy of the repository, complete with history. Any of your repositories, assuming they have been kept up to date, can be uploaded to the GitHub repository with no loss of data.

via When GitHub goes down….

Pretty cool! I really like the embedded server bit. Very neat indeed.

December 14, 2009

Simpler Java asynch IO with JBoss Netty

Filed under: cool, education, groovy, java, mina, netty, tip — michaelangela @ 3:57 am

I don’t know what this will look like since I am using Scribfire which doesn’t like to deal with code very well… that should be a standard disclaimer on this site! I try to clean it up as best I can within a short timeframe though. 🙂

I recently wrote about some Java libraries/code that would simplify asynch socket communication. I hadn’t looked far enough! Looking for references on Groovy asynch programming I came across this:

ojug meeting tue oct 20th — grails and/or netty : Omaha Java Users Group

Netty has been getting some press as a potential successor to Apache’s Mina asynchronous I/O framework for building low-level custom protocols. E.g. previously I’ve used Mina to talk binary to a card processing system.

And checking in to MINA and Netty yielded some nice info. There is a great little tutorial on writing a simple server in MINA 2. But the simple Netty TelnetClient example was exactly what I was looking for. Specifically:

TelnetClient xref

TelnetClientHandler handler = new TelnetClientHandler();
bootstrap.setPipelineFactory(new TelnetPipelineFactory(handler));

For those more experienced with Java, I hadn’t seen a simpler way to assign what is essentially an event handler. The code I had seen before required using slots and keys or other bits that seemed a bit more verbose than needed. But then again that could be simply because of my inexperience in the language at this point. Seeing this immediately made sense coming from AS3. It’s not a closure like in AS3 where each event gets a method call of some sort, named or anonymous, but just a class that handles the events.

TelnetClientHandler xref

@Override
public void messageReceived(

ChannelHandlerContext ctx, MessageEvent e) {
// Print out the line received from the server.
System.err.println(e.getMessage());

}

Sweet and simple. Once that’s assigned you can go into your “do forever” loop and do the writing that needs to interact with the server.
TelnetClient xref

// Read commands from the stdin.
ChannelFuture lastWriteFuture = null;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (;;) {

String line = in.readLine();
if (line == null) {

break;

}
// Sends the received line to the server.
lastWriteFuture = channel.write(line + ‘\n’);

// If user typed the ‘bye’ command, wait until the server closes
// the connection.
if (line.toLowerCase().equals(“bye”)) {

channel.getCloseFuture().awaitUninterruptibly();
break;

}

}

Even without Groovy this is really straightforward. I guess a Groovy implementation of Netty would reduce all of this to like 3 lines of code? Heh. 🙂

December 7, 2009

Flex… um… without Flex?

Filed under: as3, cool, flex, mxml — michaelangela @ 12:56 pm

I had just mentioned compiling MXML without using FlexBuilder and did a quick Google on it to see the current state of such integration. Wow this is pretty cool. 😛 Some neat info and projects in the comments as well including FLit.

Using MXML without Flex (Example and Source) | Ryan Campbell

I made a few minor changes to the MinimalComps project from Keith Peters and got it playing nicely with MXML. The below application compiles to a tiny 23KB yet makes use of MXML and even data binding.

Restaurant API?

Filed under: cool, entrepreneur — michaelangela @ 12:51 pm

I like this concept. I could see people doing this because the start up is low. At first glance it doesn’t seem to be a problem about being a viable business model. The question to me seems to be is it profitable enough to warrant a full-time business. The example given of the 20-day-per-year model suggests it’s not a full-time venture… unless it takes that long to prepare for the event. Perhaps it is a full time venture and they make enough off of it each time that it really works.

But even if it isn’t full time, if there are restaurants willing to be used in this fashion, or just places where food can be prepped can be found, then those places could become known for certain types of dishes and a Yelp style rating could be developed. (Thinking off the top of my head here.) That would be the restaurant api. But in this case it would be very concrete things (no abstract classes or object inheritance here). Oven is good for baking. Sinks too small to work with. Floor space good and flexible. Everything you wish could me is on a cart so you can move it where you want. Etc.

So the idea sounds cool enough and would lower the barrier to entry for new cooks looking to make their mark. In fact what it would be doing is sort of how software tools became cheap enough for average folks to get their hands on things and make something to be noticed. That’s how I got into software development. I used FlashDevelop to do development for a simple MXML app using a remote datasource provided by amfphp. All free stuff. I happened to send it by the API provider as a “hey I put this together and thought I’d show you” and ended up working for them for a year. 😛 (And learned AS3, bought FlexBuilder 2, got into Eclipse and that whole world and…) I could see the same happening for folks using time-share restaurants.

Upside-Down Examples

Time-Share Restaurants

Speaking with one of my neighbors here in Crested Butte, she started talking about wanting to create a restaurant, which is a tricky business at best and even harder in a resort town with its ebbs and flows and off-seasons.

I mentioned the example given in Seth Godin’s book Tribes, about a restaurant in New York that is only open 20 days a year, on selected Saturdays. You find out and sign up via the web, and they have a full house every time. Because they don’t have to worry about being open at the whim of walk-in customers, they can spend all their time focusing on food rather than being constantly distracted by day-to-day management of a storefront.

We wondered if a restaurant space, or even just a commercial kitchen and searching for spaces that could be used in a guerrilla fashion, could be a viable model. Working with a number of different kitchen users becomes much more practical via the web.

Free (to a point) screen-sharin and web presentation… with an open source community version

Filed under: cool, tool — michaelangela @ 12:02 pm

This looks quite interesting. And the open source version is available to boot.

DimDim Works Well

Over the years I’ve tried numerous different screen-sharing and web-presentation solutions, and most of them have required some kind of adjustment in order for them to work decently. Usually you need to reduce your screen resolution in order to get decent performance, but DimDim didn’t seem to need this. The responsiveness seemed quite tolerable.

Reading chm on OS X

Filed under: cool, osx, tool — michaelangela @ 8:09 am

Nice. Will be trying this out shortly. This was mentioned in comments here.

iChm – Cocoa CHM Reader for Mac OS X and iPhone/iPod Touch – 石锅拌饭

iChm for Mac
Features

* Fully built with Cocoa. No ugly window and slow rendering.
* Tab browsing
* Search. Result sorted by relevance.
* Text encoding detecting/switching
* Find in the page
* Tag powered bookmark
* Index
* Back/Forward
* Text zoom
* Export to PDF
* Continuous reading with Page down/Page up

Robotlegs framework and programming to an interface

Filed under: as3, cool, education, frameworks, puremvc, robotlegs — michaelangela @ 8:03 am

Actual code samples makes things make so much sense. And this is a great example of the (new to me) Robotlegs framework. I really like what I see. The following post has the same small app in several different frameworks.

Robotlegs example project with source

Any comparison of frameworks wouldn’t be complete without Robotlegs. I included Robotlegs in my session at LFPUG recently, but didn’t post the example project here because the framework was in a state of flux. Robotlegs is now settling down as it approaches its imminent 1.0 release, and the MVCS implementation in it is unlikely to change further, so here’s my example.

For this Robotlegs example I’ve used exactly the same project as in the previous examples for other frameworks. Robotlegs is not prescriptive about your application’s architecture, but it does include a default MVCS implementation for those that wish to use it. I’ve used that default implementation here.

Working with this kind of code outside of some sort of IDE or at least a well known convention could be a little baffling. For example, for this project, small though it is, sets the feeds with interfaces and not the actual feeds. This goes along with the principle of “Program to an interface, not an implementation” which is good and flexible. But to a newbie it might a bit confusing. (See here for a discussion about extending AS3 using interfaces, or rather the difficulties in doing so.)

FlexBuilder is a great IDE for AS3, granted there aren’t many. And for those with far more experience in more mature languages like Java with its plethora of incredible tools, it really pales in comparison. But it’s a far cry better than the Flash AS editors! I bring that up because I often learn code by the awesome Command+click (Ctrl+click on a PC?) to jump to the definition of a variable or a class. Opening up Flexcaster.mxml shows a context “FlexcasterContext” and a MainView. I was completely new to IoC programming with its dependency injection. So I didn’t know at that time that a context is a term commonly used in IoC. But I knew it’s an MVC framework so I figured the code I was looking for wasn’t in the view. 🙂

Clicking on the FlexcasterContext brought it up which showed where the magic happens: how everything is connected. Of note though are these two lines:

injector.mapClass( IFeedsService, OpmlFeedsService );
injector.mapClass( IFeedService, RssFeedService );

This lets me know that wherever I see IFeedsService it’s actually using OpmlFeedsService, and the same for RssFeedService and IFeedService. Through the rest of the code you won’t see any reference to OpmtFeedsService or RssFeedService. This context is the only place I would see where the connection is made. The author actually brings this issue up in a different version that also uses IoC but instead of events, it uses Signals.

All in all I think it worked out rather well. There may even be a potential future in an architecture like this. I do fear the explosion of interfaces and injection rules may make the approach unwieldy for a large project, but perhaps multiple DI configuration classes, a clear package structure and disciplined developers is all that’s required. I welcome your opinions on this.

There is more discussion there. Of course the immediate benefit of programming to an interface is that swapping out a class is a one line change instead of refactoring all affected code. Making mock data objects for the model while testing is a great example of that. It could instead be

injector.mapClass( IFeedsService, TestOpmlFeedsService );<br />

when doing tests which simply returns a preset array of data.

Overall I have to say I like the conciseness of the code. Even little things like having classes instantiated as a Singleton is cool.

injector.mapSingleton( FlexcasterModel );

The FlexcasterModel is just a class but the framework itself handles the instantiation via injection. Saying

mapSingleton

makes sure you only have one and when it is injected, only the one instance already created is passed in. As the robotlegs site says, this helps prevent the boilerplate code. I look forward to trying out the framework. I enjoyed using PureMVC once I wrapped my head around it but this, perhaps because of the conciseness, took far less time to grasp.

Speeding up workflow with FDT

Filed under: cool, eclipse, tip, tool — michaelangela @ 6:40 am

Some of the following work with FlexBuilder (soon to be FlashBuilder) as well since they are both based on Eclipse.

FDT – Customize Your Workflow- Touch My Blog

We all come across things that end up saving us lots of time when used over and over again. If you use FDT, there are countless options available to enhance a development work-flow. Here are some of mine:

December 2, 2009

DrupalService makes it easy to use Drupal as a data source for a Flash site

Filed under: as3, cool, drupal, flash — michaelangela @ 9:46 am

I had to do a quick project earlier in the year for a photo gallery tied into Drupal. I used Dash Media Player for it because of it’s built-in Drupal service integration. This looks like a great way to make an easily customizable backend for a Flash/Flex based site without having to code all the internals for the communication which of course makes a very powerful system. Looking forward to trying this out.

DrupalService as a bridge between flash and drupal at dpdk Open Source

Drupal is a multiple award winning opensource content management system. With the drupal services module, it’s possible to consume data from drupal in flash. Drupal is a very powerful tool to provide data to flash movies and with the community investing much time in drupal services, now is a great time to be using drupal to power your flash websites. Services will be part of the drupal 7 core release.

We decided to release our nl.dpdk.services.gephyr package, which is a drupal as3 service which acts as a bridge between drupal and flash and features all the power of our as3 flash remoting package. It has the core functionality of the drupal services built in and is very easy to extend and to adjust to your needs. Furthermore, it makes use of all drupals’ security mechanisms via key and session based authentication.
It has more features and packs more power than any other opensource actionscript 3 based drupal package out there at the moment, so be sure to check it out.

Flash equivalent of CSS Sprites complete with rather novel CSS control

Filed under: as3, cool, css, dev — michaelangela @ 9:33 am

This is pretty sweet. You know css “sprites”, where you load one image and restrain it with CSS constraints so that you use the one image in multiple places showing only one section at a time, etc., etc. Well this works in AS3 (i.e. not just in Flex) and it adds some pretty nifty control via CSS. It becomes a sort of way to inject stuff into visual items. Take a look at the (very complete) tutorials listed on the site for examples.

Flash Camouflage | Flash Camouflage is a framework for skinning AS 3 Applications.

Flash Camo (for short) is a graphics framework that allows AS 3 applications to be easily skinned from pngs, jpgs, or gifs. The framework is broken down into 3 core areas: Decals, the CSS Parser, and the CamoDisplay. When these systems are used together they form a powerful set of tools to help skin and style any Flash application. With Camo’s modular approach, you can use as little or as much of the framework as you want.

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.

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

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;
}

October 12, 2009

BASH command line history

Filed under: cool, linux, tip, tool — michaelangela @ 4:16 pm

Sweet. The page has more tips as well like getting partial stuff from your history. I don’t know how much of this will work on OSX but it’s still neat to see.

Access to command line history in BASH

To activate those two commands, add this to your .bashrc file:

bind ‘”\e[A”‘:history-search-backward
bind ‘”\e[B”‘:history-search-forward

Now you can easily summon any command from the history by typing the command and pressing Up arrow. You might continue pressing Up arrow until you find the command instance you wish to execute again.

September 25, 2009

Finding domain name info on the command line

Filed under: cool, tool — michaelangela @ 7:08 pm

Nice. Even for funny domains like .name, etc. Quicker than pulling up an app or going to a site that doesn’t handle the edge cases.

How do I find the authoritative name-server for a domain name? – Stack Overflow

% dig +short NS stackoverflow.com
ns52.domaincontrol.com.
ns51.domaincontrol.com.

Mac OS X XML editor

Filed under: cool, tool, xml — michaelangela @ 5:34 am

I think I may have stumbled on a neat XML editor that runs as an Eclipse plugin. I like it already! Simple things like formatting XML, autocomplete of tags and attributes already present, and……generating a schema from xml… interesting. Works well for my VERY minor usage so far…

Rinzo Xml Editor – Eclipse xml editor

Rinzo is an Eclipse xml editor with the goal of make life simpler when dealing with xml files.
It has several features regarding plain xml edition such as:

* Autocompletion of tags and attributes, proposing the ones defined in the file’s DTD or Schema.
* xml validation using DTD or Schema, DTD and Schema generation from a xml
* Namespace support.
* And more

September 22, 2009

Messy XML that needs a quick clean up?

Filed under: automation, cool, tip, tool, xml — michaelangela @ 12:26 am

Really neat and nifty. This is for when you have those one liner strings of XML in a log or something (like CharlesProxy’s response pane) and you want to view it all nicely. Normally CharlesProxy does an excellent job… for well formatted XML. At least some code I was working with really wasn’t well formatted and even the noble Charles just gave me a oneliner. xmlling cleaned it right up though. Nice.

Notes: Pretty print XML

In case you didn’t know, you can pretty print XML with the xmllint command line tool that comes with libxml2, and its installed by default with Mac OS X.

September 21, 2009

Printing from OS X 10.5 to a Canon Pixma MX330 shared on a Windows XP box

Filed under: cool, mac, osx, tip, tool, windows — michaelangela @ 6:34 pm

Since there are no drivers available to print to a shared Pixma MX330 that I am aware of, I have been unable to print to the printer. And because there are no drivers that allow the DNS-323 to host the Pixma MX330 as well, that was out, too.

The following did work though, except actually printing to the printer. In step 5, instead of doing IP > LPR over IP, I used Advanced > Windows type, and used the smb://username:password@ip_address/GhostcriptLPR and that has been working today so far.

This process will ask for your XP disk to install a couple of specific DLLs when you get to adding the new services.

How to Use a Printer Attached to a Windows XP Computer in Mac OS X

This document gives a detailed explanation of how to set up an HP DeskJet 722C printer that is attached to a Windows XP computer so that the printer can be used by a Mac OS X computer on a local area network (LAN). If your printer is slightly different, or you have a different version of Windows, or you’re using a different Unix than Mac OS X, you’ll have to adapt these instructions with your own creativity.

September 9, 2009

And an example on how to use JSFL

Filed under: automation, cool, flash, tip, tool — michaelangela @ 1:14 am

And this is cool, too. I’m always looking for productivity tips and this is very cool. It really opens up a lot of possibilities.

deleteaso » Fix Textfields JSFL

Today Seb was having some issues when dealing with embedded fonts – read his post. He came up with some ActionScript ways to get around it. Well another way would be to use JSFL. A couple of my team members at Fuel Industries wrote the following JSFL script. It goes through your library and searches out any dynamic textfields. Once it finds one it makes sure it’s on a whole pixel, turns the auto kern off, embeds “UpperCase, LowerCase, Numerals, Punctuation” characters, and makes it not selectable. But you could make it do pretty much anything you can through JSFL.

Update multiple bitmaps at once in Flash CS3

Filed under: cool, flash, tip, tool — michaelangela @ 1:13 am

Just wanted to keep a note on this for future reference. Very helpful!

onebyoneblog » Blog Archive » Flash UI Panel to Edit the Properties of Multiple Bitmaps

Basically, it’s just as I described – you highlight multiple Bitmaps in your .fla’s library, adjust the settings (allow smoothing, lossy/lossless, jpg compression quality), then click on the “execute” button and – presto – all items are instantly changed.

September 2, 2009

Flex based regex tester

Filed under: as3, cool, regex, tool — michaelangela @ 5:10 am

I hadn’t seen this one before. There are other regex testers out there but this one is neat because it helps guide you. There are examples and tooltip help to let you know what you’re doing. Very neat. There is a downloadable version as well apparently. gskinner has been an indirect sort of long-distance teacher for some time now. He has a tremendous amount of resources available on his site.

Jason Sheedy’s blog: Handy regex tester for AS3

I found this tool really useful for testing regex in AS3. There’s a few of these around, but this one is very nicely done.. http://gskinner.com/RegExr/

September 1, 2009

More on strongly typed references to timeline instances

Filed under: as3, cool, flash, flex, tip — michaelangela @ 11:58 pm

And this states the issue well in a short sentence. Developing for Flash outside of the Flash IDE breaks into two camps if the “Automatically Declare Stage Instances” is checked or not. The solution mentioned below is another way (closer to the way I do) to get a reference not only as a movie clip but as a specific class object. That’s helpful when you’re adding linkages to your symbols with external classes.

Re: [Flashcoders] Automatically Declare Stage Instances andinheritance.

I think unchecking that box is the best way to handle this, but the other options presented are useful for working around these issues. My main worry seems to be incompatibilities with people who may write code using the box checked, which it is by default. It seems that this checkbox forks all AS3 code into two exclusive camps. I hope I make the right choice. 😦 C

On Mon, May 12, 2008 at 3:58 AM, Cor <[EMAIL PROTECTED]> wrote:
> This will do the trick:
>
> private var okButton:SimpleButton = getChildByName(‘okButton’) as SimpleButton;

Older Posts »

Blog at WordPress.com.