09.27.11

Anynetwork.net

Posted in Uncategorized at 1:40 am by admin

I had an idea the other day, I thought ‘Why do we have to type all these 192.168.1.x addresses, it seems like a waste of time and a bit archaic.  Why can I name my machines and have a domain name for them.  Actually why cant everybody’.  Now they can.

Introducing ‘Anynework.net’

I have updated the DNS on anynetwork.net to have lots and lots of fully quaified domains pointing to IP addresses within the 192.168.1.x address space.

Simple

server1.anynetwork.net – 192.168.1.1
server2.anynetwork.net- 192.168.1.2

server254.anynetwork.net- 192.168.1.254

Fruity

apple.anynetwork.net - 192.168.1.1
banana.anynetwork.net- 192.168.1.2

 

I’m in the process of writing an API so that you can get your app to request a subdomain to use for a specific ip address.

See Anynetwork.net for more details.

The only gotcha is if you’re disconnected from the net the names may not work.

 

 

02.16.11

QRCodes.

Posted in Uncategorized at 1:52 am by admin

I have recently discovered QRCode (stands for Quick Response Codes  but thats not really relevant).  These are two dimensional barcodes that can store a reasonable amount of data – up to several thousand characters, enough for a URL, Contact Info, a bit of text etc.  Recognition with a smartphone camera is trivial (taking a fraction of a second) and with Iphones and Android apps all sorts of cool things can be done.  I have now discovered that the quickest way by far to get contact details of a client onto my phone from our computer system is to scan a QRCode.  I now declare that I am going to use QRCodes for everything.

Here are two really good ways to generate QRCodes.

Zebra Crossing Barcode Generator (Using Googles Charts API)

PHP QRCode Generator (Pure PHP)

Both are really good, although for volume use the zxing / google one is probably better.  I chose to use the php library as I am using client data to generate contact cards in an internal app and wasnt completely happy about sending that info to Google over the web, even though they do say they only store it in Logs for a couple of weeks.  For non-sensitive data the google chart api is a brilliant way to generate qrcodes.  Just embed the details you need into the src attribute of an img tag on your page.

There are some very good QRCode Scanners for phones, the best I’ve found for the Iphone is Barcodes from the zxing people.

02.06.11

Opening up to the world

Posted in Programming, Sites at 12:28 pm by admin

We have an internal php app that we use everyday. I wanted to make it available to our staff when they are out and about, but wanted to add a little extra security.  We now run on Apache after having run on IIS for years, so I reckoned a .htaccess file was the way to go, but I only wanted the user to be asked for an extra password if they were accessing it externally.

I asked a question on stackoverflow.com (which is for programming questions what google is for search), which lead me to the my answer on this site.

01.26.11

document.location vs document.location.replace

Posted in Programming at 2:38 pm by admin

document.location.replace(‘http://mysite.example.com/myurl.html’)

seems to replace (!) the contents of the window, and although it replaces the url in the address bar it doesnt really refresh the page as you will notice if you try the back button as it will look like you are going two pages back.

document.location = ‘http://mysite.example.com/myurl.html’

will go to the new location.

01.25.11

Adding a Module to YUI3 using YUI.add

Posted in Programming, YUI at 10:43 am by admin

I have been using YUI 2 and now YUI 3 for the last year or so.  I’m not a major javascript developer by any means but I started with Douglas Crockfords excellent book and series and javascript and YUI have finally started to make sense and I’m begining to put together a few bits and pieces for an internal app we have.  I started using YUI 3 recently as there is no reason not to since it works almost seemlessly with YUI 2 with only a little moving around.  However I was never quite sure how to put it all together.  The standard YUI template looks a bit funny at the begining.

YUI().use(''yui2-tabview', 'yui2-element', 'yui2-connection',  function(Y) {

//Do all sorts of cool things here.
});

You see this pattern all over the place, and infact it is how you use YUI3.

After watching some of the excellent videos at YUI Theatre, I figured out that it was really easy to use the YUI.add method to add my own module, but all the code I could find was one slide in the presentation which sort of described how to do it, so I thought it would be useful to do a little how to here to help people out.

Basic Module

Adding a module to YUI is super easy, so easy infact that you will never write YUI code again that isnt part of a module.  I guess thats the point.

Instead of just writing functions or objects in your .js file, do this.

YUI.add('mycoolmodule-core', function(Y){

var privatevariable = 'Private Value';

var privatefunction = function(){ //dos something };

Y.namespace('mycoolmodule');

Y.mycoolmodule.core = {

//declare object with public functions and variables.

}

}, '0.1.1' //Version String is Third parameter to add function

//,RequirementsObject  //if you wish fourth param can be a Config Object, see API reference for details.

);

Note we do not execute YUI as in the use pattern.

In the above code, the object assigned to Y.mycoolmodule.core is our public module.   The public code you would have had in your .js file is in this object, and available to your other code .  In order to use it you just need to include the .js file in your page as expected, and call use.

YUI().use(''yui2-tabview', 'yui2-element', 'yui2-connection','mycoolmodule-core',  function(Y) {

//Do all sorts of cool things here with my own module.
});

Thats it!  It works, and you have all the sandboxing that YUI provides for your code.  How brilliant is that?

How do I reference Stuff

One of the things I found confusing initially was how to reference stuff within this module structure, so I’ll show you what I did (if someone wants to correct me to make this better please do, I find the whole this, that, these, those a bit confusing).

YAHOO!

Most people are still using YUI 2 so a reference to the YAHOO object is essential, the way to do this is to declare YAHOO as a private variable in your module, which makes it available to all your module functions.

YUI.add('mycoolmodule-core', function(Y){

var YAHOO = Y.YUI2;

var privatefunction = function(){ //dos something };

Y.namespace('mycoolmodule');

Y.mycoolmodule.core = {

//etc

Your Module

Stuff within your module, such as dialogs, functions, objects , array etc, can be referenced in a number of ways, I suppose you can use ‘this’, but I find this confusing.   In my case it works well to refer to it by full namespaces

YUI.add('mycoolmodule-core', function(Y){

var YAHOO = Y.YUI2;

var privatefunction = function(){ //dos something };

Y.namespace('mycoolmodule');

Y.mycoolmodule.core = {

PublicVar : 'A Value',

PublicObj : {a:'A', b:'B'},

afunction : function(){

alert(Y.mycoolmodule.core.PublicObj.a);

}

}

//etc

I hope this helps out with someone needing to get a YUI module working by using YUI.add

01.20.11

Setting Up Magento: So you want a REAL store and not a demo?

Posted in Sites, Uncategorized at 8:56 am by admin

A very useful page to read.

01.16.11

Renewing a link

Posted in Uncategorized at 11:20 pm by admin

I stumbled upon this and found this and found a link to [http://www.stsc.hill.af.mil/CrossTalk/2008/01/0801DewarSchonberg.html] which no longer exists but found a copy of it as a pdf here

12.11.10

Calendar Validation

Posted in Sites, tools at 11:26 am by admin

I’ve been doing some stuff importing an ics file of our cookery courses into a company wide google calendar. A calender file validator is essential

http://severinghaus.org/projects/icv/

10.28.10

Coffee Art

Posted in Uncategorized at 3:24 pm by admin

Enjoy my Coffee Art

Bug Eyes in my Coffee

Bug Eyes in my Coffee

01.27.10

Running Command Line tools in EditpadPro

Posted in EditPadPro, tools at 7:14 am by admin

Following on from my previous post about setting Editpadpro up to run your php script, I wondered whether I could get it to run any command line command.  It was wonderfully easy.

  • Create a new Tool called ‘Command Line’

Setting up Command Line Tool

  • Set the Command Line to ‘cmd’

Providing Settings

  • On The Standard I/O tab, set the Selected text to be sent to the standard input .
  • Set the tools output to be sent to the message pane (or a new document if you wish).
  • Save the tool

Type your command and select then click on Tools|Command Line to run the command and you get your output in the message window.

« Previous entries Next Page » Next Page »