[dba-VB] Rectangular Coding Style :)

Jim Lawrence accessd at shaw.ca
Mon Jan 19 15:48:56 CST 2015


Hi Shamil:

Now that is very interesting challenge. How did you rate you code challenge?

There are two more points to consider when selecting which solution is best. I would choose JQuery as a rule because:

1. JQuery is so designed as to run on all browsers without additional coding.

2. As the goal is to run a display, JQuery does not have to make a round trip to a BE server so if the BE was ever under load or the internet was running slow, JQuery would be uninfected as it just uses the resources of local browser webkit API. Additionally, JQuery uses the browser engine components to do a direct page display and requires no extra remote calls.

Great piece of code. I am totally impressed.

Jim
 
----- Original Message -----
From: "Salakhetdinov Shamil" <mcp2004 at mail.ru>
To: "Discussion concerning Visual Basic and related programming issues." <dba-vb at databaseadvisors.com>
Sent: Tuesday, January 13, 2015 4:45:15 AM
Subject: [dba-VB] Rectangular Coding Style :)


Hi All --

Here is an interesting coding exercise.
Source code is borrowed from 
http://codegolf.stackexchange.com/questions/26782/fast-cheap-and-good-choose-any-two .
It didn't work "out-of-the-copy-paste-box" so I have made some corrections:


using System.Windows.Forms;
using System.Linq;class P:
CheckBox{static void Main()
{var p=new Form{Text=
"SELECT ANY TWO"};P[]a=null;
a="FAST CHEAP GOOD".Split().
Select((x,i)=>{var c=new P{
Top=i*50,Text=x};c.Click+=(
s,e) =>{if (a.Count(b=>b.
Checked) >1){a.First(b=>!b.
Checked).Enabled=1<0;}else 
a.All(b=>b.Enabled=0<1);};p.
Controls.Add(c);return c;}).
ToArray();Application.Run(p)
;}}
Enjoy! ;)


-- 
Салахетдинов Шамиль
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list