Archive for the ‘technology’ Category

Baseplane Tool: Is PureMVC the Cross Platform MVC Toolkit You Have Been Looking For?

Saturday, March 29th, 2008

PureMVC is quite a versatile MVC kit.  With implementations for AS3, .NET (c#), Python, PHP, Silverlight and other platforms it is quite a system and domain to spread that far and have consistency.  There are small changes but for the most post the MVC is the same structure across the platforms.  This can be very beneficial for a service firm or for a product base that needs to support many different platforms.

PureMVC is a lightweight framework  for creating applications based
upon the classic Model-View-Controller design meta-pattern.
This free, open-source framework is implemented in ActionScript 2 and
3, Java, C# and a number of other popular programming languages.
This allows development on a wide variety of platforms including:

  • Mobile Environments: FlashLite, .NET Compact Framework, J2ME
  • Server Environments: ColdFusion, J2EE, PHP, Python
  • Browser Environments: Flash/Flex, JavaFX, Silverlight
  • Desktop Environments: .NET, AIR, FLASH, J2SE

For Flex PureMVC happens to be my favorite MVC kit.  I only use one if absolutely necessary but PureMVC keeps it clean.  The great thing is that is works with or without Flex unlike Cairngorm and it is always up to date.  It is just an added bonus that is spans so many other platforms. There are a few things I don’t like about it in other platforms like the url naming but it is much better than kits out there now and Microsoft’s ASP.NET MVC most likely wont’ be cross platform *wink*.

Some info on the PureMVC framework (caution PDF):

PureMVC Manifold

Ports

Big O Notation in Design Theory

Saturday, March 22nd, 2008

Big O Notation is based on complexity theory and is something engineers and architects should know about do determine complexity and orders of magnitude in their data and scalability formal blueprints. Whenever you use any algorithm or port a formal function into code, math and reducing the orders of magnitude is what separates the fast from really fast.

Optimization can be evil, but solid base starting points are desired. Many times formal knowledge can be as needed as logical or physical separation and understanding service and standards format layering in your applications for the best evolution and versioning as well as performance. Formal engineering is what is separating companies like Google from the pack. Do you do formal?

Orders of common functions

Here is a list of classes of functions that are commonly encountered when analyzing algorithms. All of these are as n increases to infinity. The slower-growing functions are listed first. c is an arbitrary constant.

Notation Name Example
\mathcal{O}\left(1\right) constant Determining if a number is even or odd
\mathcal{O}\left(\alpha(n)\right) inverse Ackermann Amortized time per operation when using a disjoint-set (union-find) data structure
\mathcal{O}\left(\log^* n\right) iterated logarithmic The find algorithm of Hopcroft and Ullman on a disjoint set
\mathcal{O}\left(\log n\right) logarithmic Finding an item in a sorted list with the binary search algorithm
\mathcal{O}\left(\left(\log n\right)^c\right) polylogarithmic Deciding if n is prime with the AKS primality test
\mathcal{O}\left({n^c}\right), 0<c<1 fractional power searching in a kd-tree
\mathcal{O}\left(n\right) linear Finding an item in an unsorted list
\mathcal{O}\left(n\log n\right) linearithmic, loglinear, or quasilinear Sorting a list with heapsort, computing a FFT
\mathcal{O}\left({n^2}\right) quadratic Sorting a list with insertion sort, computing a DFT
\mathcal{O}\left({n^c}\right), c>1 polynomial, sometimes called algebraic Finding the shortest path on a weighted digraph with the Floyd-Warshall algorithm
\mathcal{O}\left({c^n}\right) exponential, sometimes called geometric Finding the (exact) solution to the traveling salesman problem (under the assumption that P ≠ NP)
\mathcal{O}\left(n!\right) factorial, sometimes called combinatorial Determining if two logical statements are equivalent[1], traveling salesman problem, or any other NP-complete problem via brute-force search, finding the determinant of a matrix with expansion by minors
\mathcal{O}\left({n^n}\right) n to the n  
\mathcal{O}\left(c_1^{c_2^n}\right) double exponential Finding a complete set of associative-commutative unifiers[2]

Not as common, but even larger growth is possible, such as the single-valued version of the Ackermann function, A(n,n). Conversely, extremely slowly-growing functions such as the inverse of this function, often denoted α(n), are possible. Although unbounded, these functions are often regarded as being constant factors for all practical purposes.

JSON-RPC Implementations

Thursday, March 20th, 2008

JSON-RPC is the answer to the argument that XML RPC is too verbose and bloated and convoluted.  JSON is just about as simple as you can get in data formats and it is becoming a great baseplane standard and is a tool that spans many platforms.

“Does distributed computing have to be any harder than this? I don’t think so.”

Can it be even simpler ?

JSON-RPC is lightweight remote procedure call protocol similar to XML-RPC. It’s designed to be simple!

JavaScript

C

C#

Erlang

Java

Lisp

Lua

Perl

Php

Python

Ruby

Frameworks

HOWTO: Remove All Subversion .svn Folders and Files Quickly

Wednesday, March 19th, 2008

Yes you can Export a clean build with TortoiseSVN so that you have a clean copy without the .svn tracking items, remove the directory and make a new one.

But, if you need to clean up an existing folder you can use some old skool bat/cmd in the root with this command on Windows

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( rd /s /q "%%i" )

[source]

Just put that in a .cmd file like cleansvn.cmd like the source suggests in the root of the subversion project you want to clean up. Works nicely. It essentially just uses the rd command to remove directories recursively that match ’svn’.

I will be featuring tutorials and utilities with subversion including some tools to quickly add and pull the newly imported trees into Subversion that can be cumbersome. I will also be doing some in an IronPython command scripting language that gives you the full power of the .net language runtime to use in your scripts.

Bringing scripts back to Windows through good uses is the goal. Scripts are not always good to build on but for quick common tasks they can be great ways to do tasks much quicker.

For *nix you can just do

find . -type d -name ‘.svn' -print0 | xargs -0 rm -rdf

MonoDevelop 1.0 Released

Tuesday, March 18th, 2008

mono-logo.pngMono is a great open source .NET implementation that has been looking to being a baseplane dream to .net development. They even have Moonlight which will eventually be caught up with Silverlight development.

However today mono gets a killer IDE in the MonoDevelop name.

[insertname]Develop projects are largely based on the SharpDevelop IDE that is one of my favorites with .net and is open source. If you are looking for a FAST IDE SharpDevelop is that. In the FAQ Miguel mentions that MonoDevelop is a port or branch of SharpDevelop which is great news for quality, speed and usability.

FlashDevelop is also another great kit based on this IDE framework. I am very pleased Mono is using the same standard for IDEs that mimic VS.NET only much more speedy and usable in SharpDevelop and FlashDevelop (both .net apps themselves and two of the only good winforms apps there ever were).

mmI highly recommend mono and MonoDevelop. These are tools that are baseplane languages and platforms that have all the benefits of .net development but for any platform and now for any platform as an IDE. One problem with FlashDevelop is that it is only for Windows machines but maybe MonoDevelop will influence and will allow it for other platforms as well and everyone will be able to use the best IDE there is for flash and flex development.

In the meantime if you are a .net developer and want to develop for multiple platforms not just Windows then Mono is your tool and MonoDevelop is your IDE.

The main features of MonoDevelop are:

  • Customizable workbench, including custom key bindings, custom layouts, and external tools.
  • Support for several languages, with C#, VB.NET and C/C++ support included, and Boo and Java (IKVM) support available as separate add-ins.
  • Support for code completion and type information tooltips.
  • Refactoring operations to simplify changes like renaming types and type members, encapsulating fields, overriding methods, or implementing interfaces.
  • Code navigation operations such as jumping to variable definitions and finding derived classes.
  • Easy to use GUI designer for GTK# applications, also supporting the creation and management of custom GTK# widget libraries.
  • Integrated source code version control, with support for Subversion.
  • Integrated unit testing based on NUnit.
  • Support for ASP.NET projects, allowing web projects can be built and tested on XSP.
  • Integrated database explorer and editor (beta).
  • Integration with Monodoc, to provide documentation about classes.
  • Support for makefiles, both generation and synchronization.
  • Support for Microsoft Visual Studio project formats.
  • Packaging system that allows generating tarballs, source code and binary packages.
  • Command line tools for building and managing projects.
  • Support for localization projects.
  • Extensible add-in architecture.

Baseplane Tools: Regular Expressions

Thursday, March 13th, 2008

Regular Expressions are a great tool for programmers on any platform. We aim to highlight the skills that work well for programmers on any system and this is definitely one of them. Regular Expressions are not black magic, they are very helpful and when it comes to templating, highlighting or any kind of searching textual content they are the best tool for the job.

Some Platforms or Systems that use Regex

One of the best regular expression sites is just http://www.regular-expressions.info/ but there are many. If you are new to regular expressions or finally want to start understanding what makes them work

Some samples of common programming tasks:

Example of White Space Trimming

You can easily trim unnecessary whitespace from the start and the end of a string or the lines in a text file by doing a regex search-and-replace. Search for ^[ \t]+ and replace with nothing to delete leading whitespace (spaces and tabs). Search for [ \t]+$ to trim trailing whitespace. Do both by combining the regular expressions into ^[ \t]+|[ \t]+$ . Instead of [ \t] which matches a space or a tab, you can expand the character class into [ \t\r\n] if you also want to strip line breaks. Or you can use the shorthand \s instead.

Grabbing HTML tags or Markup

<TAG\b[^>]*>(.*?)</TAG> matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do. This regex will not properly match tags nested inside themselves, like in <TAG>one<TAG>two</TAG>one</TAG>.

<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1> will match the opening and closing pair of any HTML tag. Be sure to turn off case sensitivity. The key in this solution is the use of the backreference \1 in the regex. Anything between the tags is captured into the second backreference. This solution will also not match tags nested in themselves.

This is just a few great uses. When you build your regex libraries, they never die, they span all platforms.

Check out ten great reasons to learn and use regular expressions. Also the javascript RegexPal.

Pseudo-code for using regex in a recursive way

When used by themselves, these regular expressions may not have the intended result. If a comment appears inside a string, the comment regex will consider the text inside the string as a comment. The string regex will also match strings inside comments. The solution is to use more than one regular expression, like in this pseudo-code:

GlobalStartPosition := 0;
while GlobalStartPosition < LengthOfText do
  GlobalMatchPosition := LengthOfText;
  MatchedRegEx := NULL;
  foreach RegEx in RegExList do
    RegEx.StartPosition := GlobalStartPosition;
    if RegEx.Match and RegEx.MatchPosition < GlobalMatchPosition then
      MatchedRegEx := RegEx;
      GlobalMatchPosition := RegEx.MatchPosition;
    endif
  endforeach
  if MatchedRegEx <> NULL then
    // At this point, MatchedRegEx indicates which regex matched
    // and you can do whatever processing you want depending on
    // which regex actually matched.
  endif
  GlobalStartPosition := GlobalMatchPosition;
endwhile

Regex makes you a better solution provider, it give the engineer the tools to transcend platforms with ease. They help to create a baseplane solution in technology and a market platform.

Is Python Becoming A Market Baseplane Language?

Thursday, March 13th, 2008

Sun has been on a rampage lately. They recently purchased MySQL (which has some questions with InnoDB) but they also are supporting Python and integrating it into the VM offerings with Jython.

So now we have Google (They employ Guido), Microsoft (IronPython) and Sun (Jython) all turning into Python-istas. Does this mean Python is destined for greatness in the near future? Well I recommend learning it. It is a great language and it has a high productivity rate. Time will tell if it has the ability to be in extremely large code bases. I think it is just a matter of the architecture and organization as with any project.

Jonathan Schwartz at Sun mentioned also taking the “J” out of “JVM” to just make a VM much like a .NET framework. So Microsoft copied Java with C# the JVM and added multiple languages. Then Sun comes back and added multiple byte code compiled languages. And then they both focus on dynamic engines to implement versions of Python, Microsoft doing this within their DLR.

Many times the larger market languages that end up running business or “enterprisey” are heavily influenced by companies, in addition to the other demands from consumers, which here is programmers. So when the big three are all banking on Python as a draw there is a definite market draw there and a tell on the future. But I think it is apparent that Python is becoming a standard market baseplane language.

It is great to be able to use other libraries from .net with IronPython and java libraries with Jython. It has found a way to integrate with the current infrastructure and the language has low bar entry but deep benefits. Python is snaking its way into the market.

Python is so non verbose…

import sys
import clr
from System.IO import Path, Directory, FileInfodir = Path.Combine(sys.prefix, 'DLLs')

if Directory.Exists(dir):
    sys.path.append(dir)
    files = Directory.GetFiles(dir)
    for file in files:
        if file.lower().endswith('.dll'):
            try:
                clr.AddReference(FileInfo(file).Name)
            except:
                pass

This sample is from IronPython showing adding dynamic references to all dlls loaded.

Check out this HTML/XHTML parser in pure Python.

from HTMLParser import HTMLParserclass MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print "Encountered the beginning of a %s tag" % tag
def handle_endtag(self, tag):
print "Encountered the end of a %s tag" % tag



baseplane - technology platforms is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

© 2006-2008 Ryan Christensen - template by drawk }}



Unless othewise specified the content in this site is licensed under a Creative Commons License
Your Ad Here Your Ad Here Your Ad Here Your Ad Here