app79 common wisdom, helpful code and useful apps

4Feb/090

can Singularity be reached?

No.

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
31Jan/090

10 digit regex ruby (for phone numbers)

How to check for 10 (ten) digits, no more, no less, using regular expression in ruby on rails with ruby:

validates_format_of :phone,

:with => /^\d{10,10}$/

useful for american phone numbers.

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
5Sep/080

Announcing: Monthly Payment Calculator by app79

This is actually just a small part of a bigger application I'm working on, but it's useful by itself so I'm posting it.

Figure out how much your soul car or house will cost you every month with the easy to use Monthly Payment Calculator! Works with Silverlight 2 Beta 2 on Firefox/IE/Not Google Chrome. Available now at http://app79.com/live/payment/

Screenshot

monthly payment calculator

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
24Aug/080

Announcing: Market Rate Calculator by app79

For all your salary comparison needs, takes up to 2 salaries and returns the market rate +/- 15% and 30%. Market Rate Calculator runs on Silverlight 2 beta 2 (Mac/PC compatible), comes with no guarantee of getting you a raise, and is available now at http://app79.com/live/marketrate.

Screenshot:

market rate calculator

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
24Aug/080

On/Off, C#, and Ternary Logic

This past week I've been working on a step sequencer built in Silverlight. One of the requirements was that a 'step' change to a different color when it is active ( an on/off switch ). The simplest solution is this piece of code:

if (currentStatus == on)

{

status = off

}

else

{

status = on

}

While this works, it can be made more elegant using a ternary operator, and rewritten with just one line of code:

status = currentStatus == on ? off : on;

which in my case translates to:

myButton.Background = currentBrush.Color == greenBrush.Color ? blueBrush : greenBrush;

Again, this just says, if the current brush is green (currentBrush.Color == greenBrush.Color) make the background (myButton.Background) blue, else make it green.

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
28Jul/081

Design Patterns 101

Principles

1) Program to an interface rather than an implementation.

2)  Composition and delegation result in runtime flexibility and should be favored to inheritance.

3) Find out what varies and encapsulate it.

Types of Patterns

:: Creational (factory, prototype, singleton)

:: Structural (adapter, proxy, façade)

:: Behavioral ( State, Visitor, Template Method, Strategy)

Notes

- Good when used correctly

- Bad when used like hammer with no nails

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
Filed under: applications, design 1 Comment
15May/080

First!

Most first posts on blogs are boring, useless, and pointless. This one will be no different. Stay tuned for the first (second) real post.

share:
  • Facebook
  • TwitThis
  • MySpace
  • Digg
  • del.icio.us
  • Google
Tagged as: No Comments

Recent Posts

Archives

Blogroll

Categories

Tags

cartoon corporate email first funny how to internet internet explorer javascript linux computers os management office marshmallow theory onchange sadness singularity no theory robot stack overflow tech support tutorial upside down computer video youtube