status

Geddy, Assets Addon

I wrote an assets add-on for Geddy.  Basically, ithis add-on allows you to modify the header of the page and add scripts, css files or change the title on the fly.

Installation


Step 1
Copy the Assets.js file to your controllers directory .

Step 2
Add two lines to the file app/controllers/Application.js.
var Assets = require(process.cwd() + '/app/controllers/Assets').Assets;

var Application = function () {
	this.Assets = new Assets();
};

exports.Application = Application;

Step 3
Next you need to modify app/views/layouts/application.html.ejs
...
<title><%= Assets.title(); %></title>
...
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<%- Assets.script(); %>
...
<link rel="stylesheet" href="/css/bootstrap.responsive.min.css">
<%- Assets.css(); %>
...
</div>
<%- Assets.preload(); %>
</body>

Step 4
Modify the controller you want to add Assets to. app/controllers/myFile.js
...
this.login = function (req, resp, params) {
     this.Assets.title('Registration Verification | Login');
     this.Assets.script(['myscript.js', 'myscript2.js']);
     this.Assets.css('mystyles.css');
     this.Assets.preload(['img1.jpg', 'img2.jpg']);

     this.respond({params: params, Assets: this.Assets});
}
...
* Take special note of the respond line and how I have added the assets to it.

Optionally you can use the load method
this.Assets.load({
	title:   'Registration Verification | Login',
	script:  ['myscript.js', 'myscript2.js'],
	css:     ['mystyles.css', 'mystyles2.css'],
	preload: ['mystyles.jpg', 'mystyles2.jpg']
})
    		
this.respond({params: params, Assets: this.Assets});


  Assets.js (unknown, 24 hits)

26
Apr 2012
POSTED BY Matthew
POSTED IN

General, Javascript

DISCUSSION No Comments
status

Directory Monitor

Monitor Types

  • File Created
    This gets kicked off when a file is created in the directory.  It will not wait for the fileto finish being created before the process starts.
  • After File Created
    This gets kicked off when a file is created in the directory and waits for it to finish.
  • File Deleted
    This gets kicked off when a file is deleted.

Threading

Wherever possible the program runs in a single thread environment with the exception of waiting for a file to complete.

Command-line

Two command-line options are available. -autostart and -minimize

These will automatically start the monitoring process and minimize the application to the tray.  The commandline options will
only function using the last settings you ran the program with (saved settings).

ex. dirmon.exe -autostart -minimize

Extensions

There are no periods in front of the extensions, its just a list separated by spaces, EX. bat gif jpg

  DirMon.zip (548.3 KiB, 1,205 hits)

20
Apr 2010
POSTED BY Matthew
POSTED IN

Files, General

DISCUSSION No Comments
status

Projects of Intrest

PhoneGap is an open source development tool for building (compiled) fast, easy mobile apps with JavaScript.  (iPhone, Android, Palm, Symbian and Blackberry)

http://phonegap.com/

MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer.

http://mootools.net/

MooLego UI is a small, minimal & extensible, Object-Oriented JavaScript User Interface Framework based on Mootools.

http://ui.moolego.org/

Plupload allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms,

http://www.plupload.com/

APE is a full-featured OpenSource solution designed for Ajax Push.  (Uses mootools for its server-side JavaScript)

http://www.ape-project.org/

14
Feb 2010
POSTED BY Matthew
POSTED IN

Blog, General

DISCUSSION No Comments
status

Weather Lookup


Lately, I have been exploring the Silverlight technology.  I wanted to share with you the application I wrote with this interesting technology.

The application is another weather forecaster, you type in your zip code and it goes out to Weather Underground and grabs the data to build the page.

Download the source: HERE
Preview the app: HERE

12
Feb 2010
POSTED BY Matthew
POSTED IN

General, Silverlight

DISCUSSION No Comments
status

Getting Weather Information from Yahoo Web Services in C#

I wrote an article sometime back on The CodeProject that dealt with Geolocation. I wrote this back in 2005 so I figured I would update my post here and add a new twist.

The new code still uses YAHOO’s web services, however this time I am writing it in LINQ and C#. So lets dive right in shall we? This is a simple console based program, you can re do it as a webapp or a forms program, but the concept is the same.
using System;
using System.Linq;
using System.Xml.Linq;

namespace YahooWeather
{
    class Program
    {
        public string appid { get; set; }

        public Program(string appid)
        {
            this.appid = appid;
        }
    }
}

It starts off as any program does with a basic namespace deceleration, as you can see there is one property called appid that gets set when you create an instence of this class.

        public string GetWoeid(string Zipcode)
        {
            string query = String.Format("http://where.yahooapis.com/v1/places.q('{0}')?appid={1}", Zipcode, this.appid);
            XDocument thisDoc = XDocument.Load(query);
            XNamespace ns = "http://where.yahooapis.com/v1/schema.rng";

            return (from i in thisDoc.Descendants(ns + "place") select i.Element(ns + "woeid").Value).First();
        }

This function loads up http://where.yahooapis.com/v1/ and grabs the XML stream with LINQ then returns the woeid. The woeid is a unique number that identifies your location

Next, we have to get the weather RSS feed from Yahoo using your woeid

        public void GetWeather(string Zipcode)
        {
            string query = String.Format("http://weather.yahooapis.com/forecastrss?w={0}", GetWoeid(Zipcode));
            XDocument thisDoc = XDocument.Load(query);
            XNamespace ns = "http://xml.weather.yahoo.com/ns/rss/1.0";
            var results = (from i in thisDoc.Descendants(ns + "forecast") select i);

            foreach (var thisResult in results)
                Console.WriteLine("{0}, it will be {1} with a low of {2} and a high of {3}", thisResult.Attribute("date").Value, thisResult.Attribute("text").Value, thisResult.Attribute("low").Value, thisResult.Attribute("high").Value);
        }

This function prints out the current weather conditions. In the same way we got the woeid (parsing xml/rss), we are getting the weather results. All thats left now is the main procedure.

        static void Main(string[] args)
        {
            Program thisYahoo = new Program("<strong>YOUR KEY HERE</strong>");

            Console.Write("Enter your zip code please: ");
            thisYahoo.GetWeather(Console.ReadLine());

            Console.Write("Press Enter...");
            Console.ReadLine();
        }

View the Yahoo GeoPlanet API documentation | View the Yahoo Weather API documentation | Get a Yahoo application ID

  Weather.zip (736 bytes, 315 hits)

09
Feb 2010
POSTED BY Matthew
POSTED IN

Files, General

DISCUSSION No Comments