64 Bytes

just a few characters short of a code base.

Open Vote Framework... Brain candy that might be worth building.

clock November 3, 2008 02:34 by author josh

So in this election year I have spent a lot of time thinking about voting and technology.. I see a lot of purpose built and closed systems outthere, and there are a few open systems.. But in my limited research I haven'tseen talk of but no action on a truly open source voting framework.. What I amtalking about is a series of services that would create a secure votingsystem.. Here are the design goals I am considering for this project.

  • Distributed & Self healing data model :  The actual votes should be stored in multiple locations with enough parity between each location that N number of locations can be compromised and the results from the vote still be trusted and valid.
  • Self recounts: This is something I did in a Voting system for an NPO many moons ago.. No user vote was ever associated with a specific user BUT all user votes were given an ID.. The User (Voter) was given the ID and could look up their vote any time.. In these cases when the voting base doesn't trust the results, they can still validate that their vote WAS recorded correctly.. This would allow grass root organizations to do "pseudo" recounts on their own using information they gather from voters about the accuracy of their vote and some statistical analysis.. if things seem TOO far out of whack then actual recounts can be executed.
  • Scoped Voting: This is something that has bugged me for a LONG time.. If I am a voter who lives in a state but I go to the wrong polling place my entire VOTE is provisional or void.. I would suggest that disenfranchising these voters we scope the vote.  After all National concerns like President and Senatorial elections are still valid for you. The rest of the ballet could be marked provisional.. The same could be true if you move from one part of a county to another.. Perhaps you can't vote in the congressional seat but you can on county bonds or state initiatives. By scoping the vote we allow voters a chance for their voice to be heard accurately and give them the dynamics they need.
  • Vote Anywhere: The goal here is to allow voters the opportunity to vote their specific ballot (based on their registration) regardless of their physical location or the polling station they actually vote at.. This could also extend to the web. This, specifically, isn't pie in the sky tech; Travis County Texas already did this using Hart Intercivics voting system at all of their early voting centers.
  • Hardware (and UI agnostic) : By this I mean that the application should be service based.. Private hardware providers should be allowed to build hardware or software that integrates with the voting service.  This is especially important when dealing with special needs voters. And of course this could allow for online or web based voting.
  • Deep but anonymous Logs and Auditing trails: By this we mean that actions should (for privacy) be anonymised from the specific user that executed them BUT there should be deep logging so that should a node in the service become invalid (see Distributed and Self Healing) that it can be analyzed to determine the true cause of the issue.
  • Voter Identity validation without ID: Using a series of questions & answers based on the user the identity of that use should be able to be validate to a level of certainty that is equal to or greater than that of forced State ID regulations.. This system could be used as a backup in locations where a person is missing their ID or for Online voting.

At thispoint its all just brain candy that I'm playing with. But I guess I have 4years to figure it out and get some of these ideas into code or architecture.  If your interested in these ideas or want to help let me know if there is enough backing I may start a formal project, otherwise I'll just tinker with it in my proverbial garage.

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


I still ♥ Ruby on Rails...

clock May 20, 2008 07:23 by author josh

Over the summer I finally dug into this whole "MVC" thing for web development. Naturally I began with the Mecca of them all Ruby on Rails.  This was a twofold learning experience for me..  First off it was Ruby a meta-language that bends like read in the wind.  And second was Rails, the darling framework that seems to have been sent by the demi-gods of software to help all suffering web developers.

But all of this joy was not without its flaws. Ruby is (as I mentioned before) all but un-deployable on a windows platform. After all Ruby is a single threaded/multi-process language (great for Unix where you don't actually have threads). But this limitation makes it an un-workable option on a windows box. Since then I have dug into Monorail, and now am neck deep in ASP.NET MVC. Heck I'm even a committer on the MVCContrib project. And while these projects are great they are still missing some magic. 

In short I still have stars in my eyes when I think of RoR.. This brings up the question, Why? (ya simple question).  I've been thinking about this a bit and I think (for me) the issue boils down to just a few issues.

First off is the RoR mantra "Convention over Configuration".  This mantra is actually quite deep; and while it can be a touch annoying at times (class naming can get silly) it's actually insanely smart. I have probably downloaded 15 different rails projects and had a working knowledge of the app and how to tweak each one in less than an hour. This is because the sites structure is described 1 way and 1 way only. More over I have been able to hand over projects in no time flat. In short, getting up to speed on a rails project is a no brainer.  ASP.NET MVC missed the mark on this in a big way in my book. MS, wisely from an OO perspective, laid everything out in a strong override-able and design. If you don't like routing, just implement a new router, don't like the view engine, just replace it. MVCContrib continued this with implantations of DI containers like Winsor, Structure Map, etc.. To muddy the situation further, MVCContrib implements multiple View Engines allowing developers to choose between ASPX, NHTML, NVolocity etc.. With all of that we diverge from Convention, and in doing so remove elegance for the privilege of flexibility (* Flexibility I am sure I will be thankful for when I migrate some of my Monorail apps to ASP.NET MVC over the summer).  Monorail is also bad about this (although not as much) with multiple view engines and a solid OO framework; but monorail has a community that has become kind of set in their ways. And so, while not set in stone, some conventions have settled in.  But going back to the rails mantra "Convention over Configuration"; nether ASP.NET MVC or Monorail prescribe to this philosophy more over they are the opposite "Here's a convention, but here are 108 tools to ignore it with " (I jest). 

    The second great feature of rails is the data model versioning and deployment methodology. You want a new data model, you add a new class to your data model describing the changes. Deploy the new version to your dev db, then code. Once your are done you run your deployment in test, evaluate your unit tests and push to prod; all very elegantly and with little effort. Linq for SQL has a great model but you design the app to the data (pulling your object structure from your tables) not the other way around.. So the same model change in Linq starts at the DB (with change scripts so you can manually run them in test and prod later) then re build your mode, code, test, run scripts in test, run unit tests, and deploy using your ant script that took 2 days to write. That's a lot of work and unfortunately Castle active record isn't much better.

    No don't get me wrong I really enjoy using Monorail and ASP.NET MVC has real promise. But when you take these three MVC frameworks and you look at developer efficiency and experience RoR is closest to my heart!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


RoR now 2.0 (well 2.0.1).

clock December 13, 2007 02:53 by author Josh

Ruby on rails has now reached 2.0 (I guess late last week).. I guess its time to get my Ruby Dev VM up and running again and start the migration of PassVault to it. Info Here

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


System.Web.MVC + DLR + Linq = Rails killer?

clock October 11, 2007 16:33 by author josh

     Looks to me like Microsoft isn't taking the whole Rails movement lying down. First off they have IronRuby. But why stop there? I just read thru and watched the screencasts from the MVC demo at Alt.Net (click here to watch them, and yes you do want to read and watch them!) and I have to say I am quite impressed.

      It really does look like the boys at MS realized that RoR and Monorail and other MVC platforms brought a real value add for some (in my book many) web development scenarios and as such are moving to Microsoft the Web MVC development experience. Now add in the DLR (I do love what it can offer because I have become a big fan of Dynamic languages) and top it off with LINQ (or DLINQ) and you have a very compelling argument to develop your next RoR or Monorails app using all microsoft goodness.

   So the good and bad of it for me..

The good: Microsoft level of dependability, scaleability, performance, etc..

The bad: I want all my projects on one platform. I really don't want to mix and match my apps between MonoRail and System.Web.MVC and RoR! One MVC to rule them all Damnit!!!!! Its an in-determinit amount of time away (the Screencasts are of an internal experimental build).

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Time to give Ruby another shot?

clock October 10, 2007 08:17 by author josh

The IIS team has finally released the new FastCGI module for IIS 6 and 7.. I won't know until I try to get it setup if it will work for me BUT (fingers crossed).. with any luck this will allow me to atleast have all of my work served out of one instance of IIS instead of IIS for my .NET work and Apache + Mongral Clusters for my Rails work.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Ktomics has a new site.

clock October 1, 2007 08:21 by author josh

In an effort to become more of a company and less of a "shop", we have developed and deployed a new site for Ktomics.. The new site also has our new logo and tag line :-).. Its pretty nice (if I do say so myself), so check it out :-).. www.ktomics.net.

(oh a techical note on the products. Gift Scanner is about 90% complete with eval/alpha versions in field testing. Gift Scanner is written with a .NET client and .NET/MonoRail on the server side. Given my problems with RoR for Windows I have made the transition to MonoRail for projects moving forward. Passvault is running on a cluster of Mongrals and is still a Ruby on Rails application).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Rails Acillies heal (for me)

clock August 20, 2007 09:33 by author josh

Ok so I have fallen in love with RoR as a development enviroment, its easy, elegent, and for compatent developers it can increase productivity astronomicly.. BUT it has a huge problem for Windows enviroments; it has no solid deployment stratagy for windows ( and no mongrel clusters behind apache don't count). Below are the methods I have tried any my opinion of their results.

1) Fast CGI on IIS using the old Fast CGI ISAPI filter: Slow (10, 12 connections per second) and I couldn't find an elegent way for it to run multiple sites.

2) Fast CGI on IIS using the new Microsoft Fast CGI tech preview 2: Faster BUT it couldn't handle default routes (routes to the root of a site) and it crashed when I had more than 1 app (first app would run fine, second one would keep crashing). Oh and did I mention it was a Tech Preview :-P

3) Fast CGI on Apache: I tried, 2.0, 2.2, FastCGI, fcgid, and about 2 million other combinations. I never got it work work! (I followed 3 diffrent tutorials about 10 times each, even mixing and matching steps where I thought one may have had a typo.) This may be because I am on Windows Server 2003 x64. But thats about the only reason I could find that thse just  "wouldn't work"

4) X Mongral Services running with apache as the balancer: This works great until you consider scale. It takes about 40megs per mongral instance (instance + ruby). and you need one Mongral per connection you want to handle (simaltanious, not per/second). So if I want to handle 200 connections/second and my Mongrals can each handle 10 per second, then I need 20 mongrals running. Now multiply that by 40 megs, and you are burning 800 megs of ram just on my app. This is not so go.

5) Linux VM running inside my windows box: One major downside. I can only connect to my SQL server via ODBC. Enough said.

So what are my options.

1) Ditch windows: Ya sorry, not going to happen.

2) Ditch Sql Server: See above answer.

3) Live with it and wait for iron ruby to support rails: I would if I thought iron ruby on rails was just around the corner, but its my bet its atleast 18 months out before its solid and production ready (remember iron ruby is only pre-alpha).

4) Do [X] (where X is the suggestion you place in the comments below): I am all ears.

5) Bite the bullet now (before there is TO much development to turn back) and port to Monorail or another MVC style framework that places nice with IIS and Windows: This is high on my list.

5) Give up on the clean goodness of a forced MVC framework and go back to traditional ASP.NET: This may also happen; but I am not a fan of this.

Suggestions are (of course) very welcome.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Dynamic Record proxy for RoR webservices.

clock June 11, 2007 22:49 by author josh
So I have taken the plunge and spent quite a bit of time playing with RoR (Ruby on Rails), in fact I decided to port my current projects serverside over to ruby to make the Ajax work easier and for the Experience. Along the way I had to write about 15 webservices to use for client server sync. Now if you don't know Ruby on Rails then the rest of this won't make much since so go of and learn a little rails and specifically ActionWebServices, then come back and you will think this is pretty cool :-) For the rest of you read on :-).

For security reasons Ruby on Rails doesn't support passing ActiveRecord objects to and from the client (not by default anyways). The fear is that someone will blindly pass in bad data, and the developer will just save it (without validation) therefore causing all kinds of issues. Now you can get around that by setting a parameter at the top of your ActionWebService::Base. But (at least for me) all that did was trade one problem (security) for another (exceptions being thrown because I don't use Integer ID's).  I thought about it a bit and I realized I would need ActiveWebService::Struct proxies for all of my objects. I looked at my 20 tables and realized that while that would be a pain , it wouldn't be "so" bad.. But hand writing a Struct for each of my objects, then one by one writing a "to" and "from" converter just didn't sound fun. Not to mention that it wasn' a long term solution. I mean what if the next project has 300 tables?

Deep in thought considering the problem I decided what I really needed to do was harness what it means to be a dynamic language. I wanted a module or base class, that would take a ActionWebService::Struct and a ActiveRecord, and dynamically do the translation for me.. Put a ActiveRecord in and get a specific ActionWebService::Struct out, put a Stuct in and get the "right" ActiveRecord back. To that end I wrote WsBase  
module WsBase 
@basedOnType = Class 
def map_from_class (type) 
   if (!type.base_class == (ActiveRecord::Base)) 
       raise(ActionWebServiceError, "ActiveRecord model classes is expected") 
   end 
   @basedOnType = type 
   type.columns.each do |prop| 
      member prop.name, prop.type 
   end 
end 
def fill_base(me) 
   mydata = me.dup 
   #raise @returnval.to_yaml 
   hashVal = Hash.new 
   @basedOnType.columns.each do |attrib| 
      hashVal[attrib.name] = mydata[attrib.name] 
   end 
   returnval = @basedOnType.find(:first, :conditions => ["id = ?", mydata["id"]]) 
   if (returnval == nil) 
      returnval = @basedOnType.new(hashVal) 
      returnval.id = mydata["id"] 
   else 
      hashVal.each do |field, val| 
       eval "returnval." + field + " = val" 
     end 
   end 
   return returnval 
end 
def fill_me(myRec,me) 
   myval = me.dup 
    myRec.attributes.each do |attrib,val| 
     eval "myval." + attrib + " = val" 
   end 
   myval.id = myRec.id 
   return myval 
end 
end 

The idea behind this module is that I create a 3 line proxy class that inherits from ActionWebService::Struct. I then extend it with this module and then add the line map_from_class ActiveRecordClassName.. Thats it. If I want to populate the Struct I pass in my ActiveRecord, If I want to get back my ActiveRecord, I pass in my populated Struct. The class files look something like this

class WsContact < ActionWebService::Struct 
   extend WsBase 
   map_from_class Contact 
end 

And a "read method" in my Webservice controller would look like this

def get_contact(contactId) 
   wcontact = WsContact.new 
   arcontact = Contact.find(:first, :conditions => ["id = ?",contactId]) 
   if (arcontact != nil) 
      returnval = WsContact.fill_me(arcontact, wcontact) 
     return returnval 
   end 
   return nil 
end 

and finally my write method would only need to be this

def save_contact(contact) 
   record = WsContact.fill_base(record) 
   if (record.save) 
      return "Good" 
    end 
   return "Bad" 
end

Now isn't that elegent. And best of all maintance for my model doesn't mean I have to update these classes, they automaticly change because they take on the properties of their ActiveRecord :-).. I even made the code cleaner by making the write function take a param of type, so instead of having 15 write methods I have 1 write method that gets called 15 diffrent ways.. and the write method doesn't change, again taking advantage of rubys dynamic nature, you can call static methods of a parameter :-P..

Anyways, this all qualified as TOO cool not to share in my book.. If anyone has any updates or suggestions on how to write this dynamic code I am all ears, I am a Ruby Neophite so I am sure my fill_base and fill_me functions could be optimized or follow do a better job of following Ruby best practices.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


ASP.NET Web services + AJAX + prototype.js

clock May 10, 2007 17:50 by author josh
So doing some reading on ASP.NET Webservices and ASP.NET AJAX's ScriptManager Tag, I realized ASP.NET Webservices can handle SOAP or JSON  if you set them up right. So below is what I have figured out. And my thoughts on the whole experience.

First off, you need to have ASP.NET AJAXs installed. Now make a refrence to System.Web.Extentions. Once that is done you can get to the meat of it.

Start off by making a quick change to your web.config so it can support passing .asmx requests to a script handler.

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services; 


/// 
/// Summary description for WebService
/// 
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService { 

    public WebService () { 

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    } 

    [WebMethod]
    public string HelloWorld(string echoField) {
        return echoField;
    }
    
} 

Now its time to play with your HTML. Now I am on this kick of trying to write 100% HTML clients, so I won't be using the scriptmanager tag (that would be too easy).. But if I were to use the scriptmanager tag then all I would need to do is write one line of javascript to call the above webservice. As such my script would look something like this (so that it can handle processing the request)

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
        function testCall()
        {
            debugger;
            WebService.HelloWorld("test message",completeTest,errorTest);
        }
        function completeTest(val)
        {
            alert(val);
        }
        function errorTest(error)
        {
            alert(error.get_message());
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
        <asp:ServiceReference Path="Services/WebService.asmx" />
        </Services>
        </asp:ScriptManager>
        <div>
          <button onclick="testCall()">test</button>
        </div>
    </form>
</body>
</html> 

But like I said before I wasn't going to USE microsofts framework on the client. if I did the page would be ASP.NET not 100% Html :-P.. So this is what I did. first off I have to choose a AJAXs API, in this case I used Prototype.js but I like YUI and could have used it :-).. Once I have added my API to my page I would call my JSON webservice and it too is only one line (although not as pretty as Microsofts provides. As such it looks something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/javascript" src="scripts/prototype.js"></script>
    
    <script type="text/javascript">
    function testCall()
    {
        new Ajax.Request('Services/WebService.asmx/HelloWorld',
                {   postBody:"{echoField:'test message'}",
                    method: 'post', contentType:'application/json; charset=utf-8',
                    onSuccess: completeTest,
                    onFailure: errorTest});
    }
    function completeTest(val)
    {
          alert(val.responseText);
    }
    function errorTest(error)
    {
        var val = error.responseText;
        alert(val);
    }
    </script>
    
    
</head>
<body>
    <div>
          <button onclick="testCall()">test</button>
        </div>
</body>
</html>

Although I could use the ASP.NET AJAX provided javascript API and it works great, I'm having more fun making it work with prototype. Plus this is a proof of concenpt, which means you can find the smallest lightest JSON communication layer you want and use that (jquery is only 50k uncompressed and should work fine).. I think next I'll have to come up with an easy way to wrap these webservices in a proxy much like microsoft does OR find a way to use the microsoft generated Proxies with other APIs.. By the way to see the Microsoft generated Javascript proxy, just put /js at the end of your webservice URL. (scriptmanager does this for you normally).

Anyways, this was a fun little experiement, and I'll post when I get it more refined.

 

Currently rated 4.6 by 5 people

  • Currently 4.6/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Dr. Dobbs and I Agree!!!

clock May 2, 2007 17:20 by author josh

Saw this on slashdot and it warmed my heart. see there is an artical on Dr. Dobbs about AJAX frameworks and it reminded me of the process I went thru. Just like Dr. Dobbs I weighed DOJO, scriptastic, Prototype, YUI and GWT; and like the artical I finally chose YUI..

    Now personally I loved DOJO (I still use it on quicker projects); but YUI is much quicker (performance) and customization is a whole lot less complex although less extendable. One other part of YUI I really like is its communications layer, the service architecture (yes even inside javascript you can have services) makes since to me and just seemd to fit my brain better. I also have to say that extJS (based on YUI) is a great extention to YUI and worth looking into (although now the developer seems to be charging for it, although its not to much  [Correction - see comments ] Now the developer has added support options for the library and/or if you need more freedom than LGPL gives you. And the prices aren't bad either).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Add to Technorati Favorites

Sign in