2011-03-29

Pyamf Not Installing for Tipfy

I have spent the last three days trying to get Pyamf to work in tipfy to no avail, every time I try I got an error saying it could not compile.
AMF-0.6.1/distribute-0.6.14-py2.5.egg
WARNING: Could not build extension for 'temp.tmpla7hzZ.distribute-0.6.14.tests.shlib_test.hello', no source found
no previously-included directories found matching 'doc/build'
no previously-included directories found matching 'doc/_build'
warning: no previously-included files matching '*.swf' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
cpyamf/amf0.c:9329: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/folders/lP/lPvYUKh7FLinUlJcZuddfE+++TI/-Tmp-//ccxqbDjN.out (No such file or directory)
error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1
An error occurred when trying to install PyAMF 0.6.1. Look above this message for any errors that were output by easy_install.
While:
  Updating app_lib.
  Getting distribution for 'pyamf'.
Error: Couldn't install: PyAMF 0.6.1
It was driving me insane that was until this morning when I actually read the error and changed was I was searching for, after a while I found a simular error and with a little guess work I came up with the following:
sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install multiprocessing
And thats it.

2011-03-09

How to turn off the Shutdown Event Tracker for Windows Server

Configure the Shutdown Event Tracker
  1. Click Start, Run, and then enter gpedit.msc. Click OK.
  2. The Group Policy Object Editor console opens.
  3. In the left pane, expand Computer Configuration, and then Administrative Templates.
  4. Click System
  5. In the right pane, find and double-click the Display Shutdown Event Tracker.
  6. When the Display Shutdown Event Tracker Properties dialog box opens, select one of the following options:
    • Not Configured
    • Enabled
    • Disabled
  1. If you select the Enabled option, you can choose between the following options to specify when the Shutdown Event Tracker should be displayed:
    • Always: This option is self explanatory. 
    • Server Only: When selected, the Shutdown Event Tracker is displayed for only Windows Server 2003/2008 servers.
    • Workstation Only: When selected, the Shutdown Event Tracker is displayed for only Windows XP Professional workstations.
  2. If you want to view help information on the Shutdown Event Tracker application, click the Explain tab.
  3. Click OK, and then close the Group Policy Object Editor console.

2011-03-04

Use your own tools

I got an email today from Microsoft and it had a calendar appointment in it for outlook when I looked at the map link and is was using google maps not bing.
Maybe if you want other people to use your maps you should use them yourself.

2011-02-08

Don't By Mass Effect 2 from PSN

I have had real problems with getting Mass Effect 2 to download from PSN (I downloaded it 4 times and it failed every time, which cost me $50 for bandwidth). Over the last 2 weeks I have made many phone calls trying unsuccessfully to get a refund for the purchase to my credit card so I can go and buy Mass Effect 2 from the store. Today I got this email.
Hi 
We only provide refunds to the wallet.
As per our Terms of Service "If we are liable to you for failure to deliver content or services, our liability is limited either to re-providing the relevant content or service or (at our option) refunding the amount you paid for the content or service to your PSN wallet." 
Regards
Maddalena
It looks like I am not getting Mass Effect 2 after all, and I have $100 of PSN credit I don't want to use.

Thanks for nothing Sony!

2010-08-20

Simplicity vs. Choice

I found this video today it is really worth watching if you do anything with software.

2010-07-14

Why CamelCase is good

Just though I would share today I was woking on someone sp and found the name was:
SPF_GETHARMONISEDSERIESDETAILTARIFFBYHARMONISEDSERIESDETAILID
Readable? I think not.

But with a small change, you can actuall read it:
spf_GetHarmonisedSeriesDetailTariffByHarmonisedSeriesDetailID.

2010-07-13

NotImplementedError: Unable to find the Python PIL library

I have been playing with Google App engine on both mac and windows and in both cases when using images.resize I get the following error:
NotImplementedError: Unable to find the Python PIL library.  Please view the SDK documentation for details about installing PIL on your system.
After using my friend Google I found the solution.

For Mac OSX:
  1. Open to Terminal by navigating to your Applications folder, open Utilities, and double click on Terminal. You will be greeted with a message similar to this:
    Last login: Tue Mar 6 17:21:36 on console
    Welcome to Darwin!
    imac:~ Matt$
  2. Type in "sudo easy_install --find-links http://www.pythonware.com/products/pil/ Imaging" into the Terminal and press enter.
  3. Enter in your password when prompted and then you are done.
For Windows:
  1. Download "Python Imaging Library 1.1.7 for Python 2.6" from their website and install.
  2. Reboot and then you are done.
Simple huh?

2010-07-02

2010-05-16

Good Bye JSP

I have tried using JSP on several occasions and every time I realise that I hate it, but when I started playing with Google App Engine(GAE) and the GWT I came to a conclustion that I am not a fan of that either.

I first started with GAE and Python and found that django was quite nice in the way it let you seperate the code and presentation easily, were someone with not python knowladge could easily edit the template.

So I turned to google and types in "JSP alternative", the first one I found was Freemaker so I downloaded the latest version and set out to complete this tutorial. There was one small problem the tutorial was a little out of date and try as I might I could not the the <list>. It turns out the the tutorial is a little old is not for the newest version(2.3.16 at the time of posting) of Freemarker and there have been a few changes with one major change, that being tags such as <list> and <if> now have a # before them so they look like <#list> and <#if> I made the change and the example worked!

To go from JSP to Freemarker I had to make a few changes. First I added freemarker.jar to /war/WEB-INF/lib/.
Next I created a template file called index.html and added to the war folder here is the template.
<html>   <body>   <ul>   <#list files as file>     <li>       <a href="/filestorage?name=${file.name}">${file.name}</a> (${file.mime})     </li>   </#list>   </ul>   <hr />   <form enctype="multipart/form-data" action="/filestorage" method="POST">     <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />     Choose a file to upload:     <input name="uploadedfile" type="file"/>     <br/>     <input type="submit" value="Upload File"/>   </form>   </body> </html>

After that I added a function to the serverlet to set the template values and display the template
/*  * Displays the template  */ private void DisplayTemplate(HttpServletResponse resp) {   //Now loads the data and adds it to a SimpleHash   SimpleHash modelRoot = new SimpleHash();   modelRoot.put("files", FileDAL.getFilesHash());   try {     resp.setContentType("text/html");     Configuration cfg = new Configuration();     Template tpl = cfg.getTemplate("index.html");     tpl.process(modelRoot, resp.getWriter());   } catch (Exception e) {     System.out.println(e.getLocalizedMessage());   } }

Last of all I replaced resp.sendRedirect("/index.jsp"); with DisplayTemplate(resp); and thats it.
The source is available from github.

2010-05-11

File storage in the cloud

I have been playing with google app engine for a while now mainly with Granite Data Services and Flex, recently I decided to see if I could store files in the datastore as blobs.

I stared by searching on the web on how to save a file as a blob to the datastore after a bit of playing I managed to get it all working using JSP pages and the apache commons fileupload, using this little bit of code:
ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter; iter = upload.getItemIterator(req); FileItemStream fileItem;
while(iter.hasNext() == true) {  fileItem = iter.next();  InputStream fileStream = fileItem.openStream();  Blob imageBlob = new Blob(IOUtils.toByteArray(fileStream));  if (fileItem.getContentType() != null)   FileDAL.createFile(fileItem.getName(), fileItem.getContentType(), imageBlob); }
The full source is available on github.

I have decided that I really hate JSP Pages so I am going to look into a different template engine stay tuned...

2010-03-22

Cannot Open Database Project

Today I opened visual studio and got an error message.

".dbproj files cannot be opened because its project type(.dbproj) is not supported by this version of the application"

I reinstalled the service pack and then reinstalled visual studio and it I still couldn't open my database project and all the packs and it was still not working.

So I turned to google and found out that all I had to do was reset the dev environment by running the following command.

devenv /resetskippkgs

If only i have of known this before I spent half the day reinstalling everything.

2009-11-14

MonoTouch - Image View in Interface Builder

I have been playing with MonoTouch recently in an attempt to make a iPhone app. I was playing quite happily there just one problem. I couldn't work out how to set the image for the "Image View" in Interface Builder I searched the internet for a few hours and still couldn't find a thing. So it was time to start randomly clicking and compiling until it worked. Here is what I did....

  1. Create a new iPhone Solution in MonoDevelop.
  2. Drag the image you want to use in to the Solution Explorer.
  3. Click Copy on the dialog box.
  4. Right click the image in the solution and select "Properties", the Properties panel should show up.
  5. Change the "Build Action" to "Content".
  6. Double Click MainWindow.xib in the "Solution Explorer" and Interface builder should open up.
  7. Click "Tools" > "Library", the library window will pop open.
  8. Drag and "Image View" (under "Library" > "Cocoa Touch" > "Data Views") to the "Window".
  9. Click on the Image View, then click "Tools" > "Attribute Inspector".
  10. Type the name of the image in the "Image" field. The image view will be replaced with a question mark icon
  11. Close interface builder.
  12. In MonoDevelop Click "Run" > "Run".
  13. Wait for the iPhone Simulartor to start and enjoy the results.

2009-11-08

Free Mac Apps Go get yours now!

MacHeist are at it again and are giving away free apps one of which I used to to grab the image for this post.

If you want the pack just jump on over to MacHeist sign up and then get to downloading. You have to be quick tho because the deal ends in four days from today(Sunday 8 November 2009).

2009-10-22

Single Quotes in TSQL

Recently I had a to format some data, originally the formatting was done using the MVC.NET page but there was one for small problem it took over five minutes to return 2,000 records which is just a little bit to long for my liking.

We only had a day to fix this problem so it was time for a dirty yet brilliant hack. I created a table variable and for the formatted data added the data to it and returned the date all in one stored procedure, there was one problem tho I needed to generate T-SQL and run it using EXECUTE (I know its not the best way to do things). I was working away at this and then a problem popped up there is no way to escape single quotes that I could work out in T-SQL.

But with a little trickery.....

DECLARE @singleQuote CHAR(1);
SET @singleQuote = CHAR(39);

Problem Solved!

2009-09-24

Flex - Button label truncation problem

I recently had trouble with Flex truncating the label on some but...




It was a particularly aggravating affair, playing with the padding and the width which had no apparent effect. After hours of searching the net and finding nary a shred I discovered that there was a simple fix.




Simply changing the label placement property of the button to 'bottom' had the desired effect rendering the label correctly.




Ahhhhh, much better.

2009-09-01

Making the Eclipse XML editor Useful

I use Eclipse for editing pretty much everything I on my Mac with its great free plugins who wouldn't want to use it there is only one small problem. That problem is the built in XML editor for Eclipse sucks, it tree based meaning you can't get the the underlying code without using the default Text Editor.

I decided that there must be a free plugin you can use so I Googled "free eclipse xml editor" and found several articles about an editor called XmlBuddy but there was a problem, the domain www.xmlbuddy.com has been sold so you are not going to be able to download it from there crap! So yet again I turn to my friend google and at last I have found the answer.

I downloaded the plugin from cnet unzipped into my Eclipse plugins directory, now I finally have a decent XML editor.

2009-08-17

Custom Events in Action Script

You have an custom actionscript 3.0 class and it does all sorts of great thing, but now you want other people to be able to use it. There are many ways to do this but for this example I am going to create a custom event. Lets get started.

First add the following imports to your class.

import flash.events.Event;
import flash.events.EventDispatcher;

Then add the metadata about the custom event, the event in this example is called customEvent.

[Event(name="customEvent", type="flash.events.Event")]

Next copy and paste the following code anywhere into your class this is used to add the functions need to create event listeners and dispatch events.

private var disp:EventDispatcher;
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, 
 priority:int=0, useWeakReference:Boolean=false):void {
   if (disp == null) disp = new EventDispatcher();
   disp.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
    
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void {
 if (disp == null) return;
   disp.removeEventListener(type, listener, useCapture);
}
    
public function dispatchEvent(event:Event):void {
 if (disp == null) return;
   disp.dispatchEvent(event);
}

Next you need to add the code to fire your custom event to do this add the following code to the function you want to fire the event.

var deviceDataEventObject:DeviceDataEvent = new Event("customEvent");
dispatchEvent(deviceDataEventObject);

OK you custom class can now fire your custom event all you need to do is set up a event listener in the calling class, use this code.

customClass.addEventListener("customEvent", yourFunction);
private function yourFunction(event:Event):void{
   //Do Something here
}

Thats it you are done simple huh?

2009-07-30

Free Flex Visual Studio Plug-in

There is a plug-in for visual studio it is not as good as the adobe IDE but is free will do the job, for more info on the plug-in go to their website. First you need to download all the required files listed below:
Now you have a directory full of downloads it is time to start installing(please note [version] is a place holder for the current version of the file you downloaded):
  1. Extract the Flex SDK (flex_sdk_3.zip) to "C:\Flex\3\".
  2. Install the visual studio plugin (EnsembleTofinoWithoutFlexSDK.[version].msi) by double clicking it.
  3. Open Visual studio
  4. Open the Options Windows
  5. Check the "Show all settings" checkbox if its there
  6. Go to Projects > Flex Projects
  7. Set the Flex 3 SDK location to "C:\FlexSDK\3\|

For more info on how to use the plug-in there is an article at developer fusion.

2009-07-29

Controlling Flex With Javascript

For work I had to do a proof of concept to show that I could control flex using javascript and here is is with the source, if you want to do it follow this article.

I did have one problem tho and that was i was using Flash Develop and there is no "Create Ajax Bridge." menu option, luckily this can be solved pretty simply just by copying the the files from you sdk directory to you project they are located in


[sdk]\frameworks\javascript\fabridge\src\bridge\.

2009-07-25

The Eclipse IDE and Google App Engine

App Engine is Googles offering in the realm of cloud computing. The free service that Google offers should be more than enough to host small websites. If an application does need extra resources, there is the option to enable flexible billing which alows a web application to scale and only pay for resources used. see Googles Billing Docs Orginally the App Engine only supported the Python scripting language, though the Google team have recently anounced Java support. Google have released an SDK and set of plugins for the Eclipse IDE, together they provide an integrated developement and deployment environment.

How to set up Eclipse/App Engine

Software needed: Installation:
  1. Install the Java SE DEvelopment Kit
  2. Unpack the Eclipse IDE
  3. Follow these steps to install the SDK and App engine plugin through the Eclipse software update service. You will likely need to reboot.
Further Information: App Engine Docs Sample applications