Web2Py is a wonderful frameworks Web written in Python.
If you like the power and ease of use web2py is for you
Pyjamas is a port of Google Web Toolkit in Python
http://www.web2py.com/AlterEgo/default/show/203
Wednesday, December 30, 2009
Friday, December 25, 2009
Thursday, December 24, 2009
Wednesday, December 23, 2009
Tuesday, December 22, 2009
Monday, December 21, 2009
A Very Simple OBA with VSTO v3, Web Service, LINQ to SQL
Saturday, December 19, 2009
Friday, December 18, 2009
Tuesday, December 15, 2009
Sunday, December 13, 2009
Saturday, December 12, 2009
Apophysis Resources
http://apophysis.byethost8.com/resources.html
http://www.apophysis.org/tutorials/scripts4.html
http://polyfractalisation.blogspot.com/2009/03/tip-ad-hoc-scripting-1-batch-rendering.html
http://www.ivy-cottage.net/ApophysisUserGuide.pdf
http://www.apophysis.org/tutorials/scripts4.html
http://polyfractalisation.blogspot.com/2009/03/tip-ad-hoc-scripting-1-batch-rendering.html
http://www.ivy-cottage.net/ApophysisUserGuide.pdf
Friday, December 11, 2009
SQLCLR : Table Valued Function
using System;
using Microsoft.SqlServer.Server;
using System.Collections;
using System.Data.SqlTypes;
using System.Collections.Generic;
class Product
{
public int Quantity { get; set; }
public string Description { get; set; }
}
public partial class UserDefinedFunctions
{
[SqlFunction(TableDefinition = @"Quantity int,
Description nvarchar(100)",
Name = "Products",
FillRowMethodName = "FillRowProduct")]
public static IEnumerable GetProducts()
{
ListlstPerson = new List ();
lstPerson.Add(new Product { Quantity = 1, Description = "Ball" });
lstPerson.Add(new Product { Quantity = 10, Description = "Bike" });
lstPerson.Add(new Product { Quantity = 5, Description = "Club" });
lstPerson.Add(new Product { Quantity = 10, Description = "Bat" });
return lstPerson;
}
public static void FillRowProduct(Object obj, out SqlInt32 Quantity, out SqlChars Description)
{
Product p = (Product)obj;
Description = new SqlChars(p.Description);
Quantity = new SqlInt32(p.Quantity);
}
};
<--->
SELECT Prod.*
FROM dbo.Products() AS Prod
Quantity Description
1 Ball
10 Bike
5 Club
10 Bat
Thursday, December 10, 2009
SQL CLR Table-Valued Functions
http://msdn.microsoft.com/en-us/library/cc655659%28SQL.90%29.aspx
http://msdn.microsoft.com/en-us/library/ms131103.aspx
http://netindonesia.net/blogs/kasim.wirama/archive/2008/12/30/sql-clr-user-defined-function.aspx
http://www.soliddotnet.com/index.php/2009/09/23/insert-value-using-table-value-functions-tvf/
http://msdn.microsoft.com/en-us/library/ms131103.aspx
http://netindonesia.net/blogs/kasim.wirama/archive/2008/12/30/sql-clr-user-defined-function.aspx
http://www.soliddotnet.com/index.php/2009/09/23/insert-value-using-table-value-functions-tvf/
Wednesday, December 9, 2009
Tuesday, December 8, 2009
Sunday, December 6, 2009
VSTO Excel From Range to Array Array to Range
using System;
using Excel = Microsoft.Office.Interop.Excel;
namespace ExcelArray
{
public partial class ThisAddIn
{
Excel.Worksheet ws;
Excel.Range c;
Object[,] arValue;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
ws = (Excel.Worksheet)Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet;
for (int j = 1; j < 11; j++)
{
for (int i = 1; i < 11; i++)
{
c = (Excel.Range)ws.Cells[i, j];
c.Value2 = i+j-1;
}
}
// From Range to Array
// We copy the 2nth column
c = (Excel.Range)ws.get_Range(ws.Cells[1, 2], ws.Cells[10, 2]);
c.Interior.ColorIndex = 2;
arValue = (Object[,])c.Value2;
// Array to Range
// We paste on the first column
c = (Excel.Range)ws.get_Range(ws.Cells[12, 1], ws.Cells[21, 1]);
c.Value2 = arValue;
c.Interior.ColorIndex = 6;
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
Saturday, December 5, 2009
Apophysis
Nice site for this wonderful program
http://apophysisrevealed.com/
http://apophysisrevealed.com/
Pointers in C#
I need to parse large amount of data in Excel Sheet.
I trying to use pointers for performance issues
Here is how to define pointers in C#
http://msdn.microsoft.com/en-us/library/f58wzh21%28VS.71%29.aspx
I trying to use pointers for performance issues
Here is how to define pointers in C#
http://msdn.microsoft.com/en-us/library/f58wzh21%28VS.71%29.aspx
Friday, December 4, 2009
C# - DatagridView
I was in search of editing cell programmatically.
Here is a simple attempt
Here is a simple attempt
using System.Collections.Generic;
using System.Windows.Forms;
namespace testGridView
{
public partial class Form1 : Form
{
Listcars;
int currentValue;
public Form1()
{
InitializeComponent();
InitializeCarsCollection();
SetLayoutGrid();
this.dataGridView1.DataSource = cars;
}
private void SetLayoutGrid()
{
this.dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellClick);
this.dataGridView1.CellEndEdit += new DataGridViewCellEventHandler(dataGridView1_CellEndEdit);
this.dataGridView1.Dock = DockStyle.Fill;
this.dataGridView1.AutoGenerateColumns = true;
this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
}
void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
int editedValue = (int)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
if (editedValue != this.currentValue)
{
System.Windows.Forms.MessageBox.Show(this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString());
}
}
void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 2)
{
this.currentValue = (int)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
this.dataGridView1.BeginEdit(true);
}
}
private void InitializeCarsCollection()
{
cars = new List();
cars.Add(new Car { Marque = "Renault", Couleur = "rouge", Cylindree = 6 });
cars.Add(new Car { Marque = "Citroen", Couleur = "bleu", Cylindree = 4 });
cars.Add(new Car { Marque = "Peugeot", Couleur = "vert", Cylindree = 8 });
cars.Add(new Car { Marque = "BMW", Couleur = "jaune", Cylindree = 16 });
}
}
}
Thursday, December 3, 2009
C# Tutorial
Nice Tutorials
http://www.csharp-station.com/Tutorial.aspx
http://www.csharp-station.com/Tutorial.aspx
Wednesday, December 2, 2009
Monday, November 30, 2009
Programming Paradigms
Stanford Courses programming
http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.1617348111
http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.1617348111
Saturday, November 28, 2009
Thursday, November 19, 2009
Sunday, November 15, 2009
Saturday, November 14, 2009
Monday, November 9, 2009
Friday, November 6, 2009
Wednesday, November 4, 2009
Tuesday, November 3, 2009
Monday, November 2, 2009
Fractal Flames in Python
Great News
http://fr0st.wordpress.com/
http://fr0st.wordpress.com/
Saturday, October 31, 2009
Art with Fractals
http://www.webdesignerdepot.com/2009/01/40-amazing-3d-fractals-using-apophysis/
http://flam3.com/index.cgi?&menu=download
http://apophysis.wikispaces.com/Tutorials
http://www.woosie.net/apophysis/funkytut/funkytut.htm
http://www.innertraveler.com/messagecenter/showthread.php?t=2442
http://www.apophysis.org/tutorials/index.html
http://apophysis.wikispaces.com/Apo+Script+Reference+Manual
http://www.fractaldimentia.com/downloads.html
http://apophysis.wikispaces.com/Artists
http://www.subblue.com/blog/2009/5/14/fractals_and_generative_art_resources
Apophysis Tutorials Great
http://flam3.com/index.cgi?&menu=download
http://apophysis.wikispaces.com/Tutorials
http://www.woosie.net/apophysis/funkytut/funkytut.htm
http://www.innertraveler.com/messagecenter/showthread.php?t=2442
http://www.apophysis.org/tutorials/index.html
http://apophysis.wikispaces.com/Apo+Script+Reference+Manual
http://www.fractaldimentia.com/downloads.html
http://apophysis.wikispaces.com/Artists
http://www.subblue.com/blog/2009/5/14/fractals_and_generative_art_resources
Apophysis Tutorials Great
Thursday, October 29, 2009
DLR and JavaScript Interoperability with Gestalt
Calling Javascript from Python and vice versa
http://visitmix.com/Opinions/DLR-and-JavaScript-Interoperability-with-Gestalt
http://visitmix.com/Opinions/DLR-and-JavaScript-Interoperability-with-Gestalt
Tuesday, October 27, 2009
Sunday, October 25, 2009
Gestalt - Nishant Kothary and Joshua Allen
Gestalt" is a technology that allows web developers to easily include ruby, python, and even Silverlight code directly within the html of their websites...
http://channel9.msdn.com/shows/The+Knowledge+Chamber/Gestalt-Nishant-Kothary-and-Joshua-Allen/
http://channel9.msdn.com/shows/The+Knowledge+Chamber/Gestalt-Nishant-Kothary-and-Joshua-Allen/
Dynamic C#
Great posts about this new feature
http://blogs.msdn.com/cburrows/archive/tags/dynamic/default.aspx
http://blogs.msdn.com/cburrows/archive/tags/dynamic/default.aspx
Friday, October 2, 2009
Game Development with JavaScript and the Canvas element
Sunday, September 20, 2009
NodeBox : Pong
Pong in NodeBox :
http://billmill.org/index?offset=5
http://billmill.org/index?offset=5
Monday, September 14, 2009
Friday, September 11, 2009
Tuesday, September 8, 2009
Sunday, September 6, 2009
Thursday, September 3, 2009
Tuesday, September 1, 2009
Sunday, August 30, 2009
Friday, August 28, 2009
A Developer’s Introduction to Windows Communication
Programming Tutorials
Great tutorial on C++
http://progtutorials.tripod.com/
http://progtutorials.tripod.com/
Thursday, August 27, 2009
Wednesday, August 26, 2009
Sunday, August 23, 2009
Flirting With Silverlight
Friday, August 21, 2009
Silverlight 3 + RIA Services + MVVM et testabilité
Aperçu RIA Services
Merci à David pour ce lien
Silverlight 3 : introduction à .NET RIA Services
Wednesday, August 19, 2009
Creating object in Javascript
http://www.howtocreate.co.uk/tutorials/javascript/objects
http://www.javascriptkit.com/javatutors/proto.shtml
http://msdn.microsoft.com/en-us/magazine/cc163419.aspx
http://nefariousdesigns.co.uk/archive/2006/05/object-oriented-javascript/
http://jquery-howto.blogspot.com/2009/01/object-oriented-javascript-how-to_21.html
http://www.javascriptkit.com/javatutors/proto.shtml
http://msdn.microsoft.com/en-us/magazine/cc163419.aspx
http://nefariousdesigns.co.uk/archive/2006/05/object-oriented-javascript/
http://jquery-howto.blogspot.com/2009/01/object-oriented-javascript-how-to_21.html
Thursday, August 13, 2009
Monday, August 10, 2009
User Defined Functions
'...if you have ever wanted to use the results of a stored procedure as part of a T-SQL command, use parameterized non-updateable views, or encapsulate complex logic into a single database object, the SQL Server 2000 User-Defined function is a new database object that you should examine to see if its right for your particular environment.'
http://www.sqlteam.com/article/user-defined-functions
http://www.sqlteam.com/article/user-defined-functions
CLR Stored Procedures
http://msdn.microsoft.com/en-gb/library/ms131094.aspx
http://www.devx.com/dbzone/Article/28412/1954
http://www.amergerzic.com/post/CLRStoredProcedures.aspx
http://aspalliance.com/1338_Working_with_Managed_Stored_Procedure_using_Visual_Studio_2005.5
http://www.devx.com/dbzone/Article/28412/1954
http://www.amergerzic.com/post/CLRStoredProcedures.aspx
http://aspalliance.com/1338_Working_with_Managed_Stored_Procedure_using_Visual_Studio_2005.5
Sunday, August 9, 2009
Saturday, August 8, 2009
Friday, August 7, 2009
Thursday, August 6, 2009
Thursday, July 30, 2009
Wednesday, July 29, 2009
Thursday, July 23, 2009
Building Amazing Business Applications with Silverlight 3
I saw this video with a great pleasure
http://blogs.msdn.com/brada/archive/2009/03/17/mix09-building-amazing-business-applications-with-silverlight-3.aspx
http://blogs.msdn.com/brada/archive/2009/03/17/mix09-building-amazing-business-applications-with-silverlight-3.aspx
Sunday, July 19, 2009
Friday, July 17, 2009
Wednesday, July 15, 2009
Tuesday, July 14, 2009
Python doodles
Physics in Python
http://metakatie.wordpress.com/2009/02/01/double-pendulum/
http://metakatie.wordpress.com/2009/02/01/double-pendulum/
Saturday, July 11, 2009
Tuesday, July 7, 2009
Factory Pattern in C#
I wanted to access the fields of the created classes.
Here is the code I've implemented, feel free to comment
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FactoryPattern
{
interface Base
{
}
class Factory
{
Base derived;
public Base GetObject(int selector)
{
switch (selector)
{
case 1:
derived = new Derived1();
break;
case 2:
derived = new Derived2();
break;
}
return derived;
}
}
class Derived1 : Base
{
public string origin = "Derived1";
}
public class Derived2 : Base
{
public string origin = "Derived2";
public int value = 145;
}
class Program
{
public static object GetFieldValue(string nameField, object obj)
{
return obj.GetType().GetField(nameField).GetValue(obj);
}
static void Main(string[] args)
{
Base obj;
Factory f = new Factory();
obj = f.GetObject(2);
var origin = GetFieldValue("value", obj);
System.Console.WriteLine(String.Format("{0}",origin));
Console.ReadLine();
}
}
}
Here is the code I've implemented, feel free to comment
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FactoryPattern
{
interface Base
{
}
class Factory
{
Base derived;
public Base GetObject(int selector)
{
switch (selector)
{
case 1:
derived = new Derived1();
break;
case 2:
derived = new Derived2();
break;
}
return derived;
}
}
class Derived1 : Base
{
public string origin = "Derived1";
}
public class Derived2 : Base
{
public string origin = "Derived2";
public int value = 145;
}
class Program
{
public static object GetFieldValue(string nameField, object obj)
{
return obj.GetType().GetField(nameField).GetValue(obj);
}
static void Main(string[] args)
{
Base obj;
Factory f = new Factory();
obj = f.GetObject(2);
var origin = GetFieldValue("value", obj);
System.Console.WriteLine(String.Format("{0}",origin));
Console.ReadLine();
}
}
}
Friday, July 3, 2009
Monday, June 29, 2009
Dynamic LINQ
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
Here how to retrieve the result from the Dynamic Generated Class
Thanks to Daniel
http://www.albamond.com/blog/Daniel/post/Dynamic-Linq-is-love.aspx
Here how to retrieve the result from the Dynamic Generated Class
Thanks to Daniel
http://www.albamond.com/blog/Daniel/post/Dynamic-Linq-is-love.aspx
Sunday, June 28, 2009
Saturday, June 27, 2009
F# Webcast
Another great presentation of F#.
Including a fully working application.
http://tomasp.net/blog/fsharp-webcast-functional.aspx
Including a fully working application.
http://tomasp.net/blog/fsharp-webcast-functional.aspx
F Sharp Programming
Very very nice tuorial
http://en.wikibooks.org/wiki/F_Sharp_Programming
http://en.wikibooks.org/wiki/F_Sharp_Programming
Interfaces + Factory pattern = Decoupled architecture
Tuesday, June 23, 2009
VSTO Excel : GetRange
/// <summary>
/// Return a range starting from cell C
/// The range can contain empty cell
/// C - - - - - -
/// - - - - - -
/// - - - - - - -
/// - - - -
/// </summary>
/// <param name="ws"></param>
/// <param name="start"></param>
/// <returns></returns>
public Excel.Range GetRightDownRegion(Excel.Worksheet ws, Excel.Range start)
{
Excel.Range curCell = start;
Excel.Range endCell = start;
int lastCol;
int offsetCol;
int j = 0;
while (curCell.Value2 != null)
{
curCell = start.get_Offset(0, j);
if (curCell.Value2 != null)
{
endCell = curCell;
}
j++;
}
lastCol = endCell.Column;
int i = 0;
curCell = start;
endCell = start;
while (curCell.Value2 != null)
{
curCell = start.get_Offset(i, 0);
if (curCell.Value2 != null)
{
endCell = curCell;
}
i++;
}
offsetCol = lastCol - endCell.Column;
endCell = endCell.get_Offset(0, offsetCol);
return ws.get_Range(start, endCell);
}
}
/// Return a range starting from cell C
/// The range can contain empty cell
/// C - - - - - -
/// - - - - - -
/// - - - - - - -
/// - - - -
/// </summary>
/// <param name="ws"></param>
/// <param name="start"></param>
/// <returns></returns>
public Excel.Range GetRightDownRegion(Excel.Worksheet ws, Excel.Range start)
{
Excel.Range curCell = start;
Excel.Range endCell = start;
int lastCol;
int offsetCol;
int j = 0;
while (curCell.Value2 != null)
{
curCell = start.get_Offset(0, j);
if (curCell.Value2 != null)
{
endCell = curCell;
}
j++;
}
lastCol = endCell.Column;
int i = 0;
curCell = start;
endCell = start;
while (curCell.Value2 != null)
{
curCell = start.get_Offset(i, 0);
if (curCell.Value2 != null)
{
endCell = curCell;
}
i++;
}
offsetCol = lastCol - endCell.Column;
endCell = endCell.get_Offset(0, offsetCol);
return ws.get_Range(start, endCell);
}
}
Wednesday, June 17, 2009
Thursday, June 11, 2009
VSTO : ListObjects
VSTO is not obvious, here is to name columns
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
namespace ExcelWorkbook7
{
public partial class Feuil1
{
NorthwindDataContext ctx = new NorthwindDataContext();
private void Feuil1_Startup(object sender, System.EventArgs e)
{
var cs = from cust in ctx.Customers
select cust;
Microsoft.Office.Tools.Excel.ListObject customerData;
customerData = this.Controls.AddListObject(this.get_Range(this.Cells[1,1],this.Cells[1,2]), "Customers");
DataGridTableStyle s = new DataGridTableStyle();
customerData.TableStyle = "TableStyleLight10";
customerData.ListColumns.get_Item(1).Name = "ID";
customerData.ListColumns.get_Item(2).Name = "Name";
customerData.SetDataBinding(cs,"","CustomerID","CompanyName");
}
private void Feuil1_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InternalStartup()
{
this.Startup += new System.EventHandler(this.Feuil1_Startup);
this.Shutdown += new System.EventHandler(this.Feuil1_Shutdown);
}
#endregion
}
}
Wednesday, June 10, 2009
Tuesday, June 9, 2009
Monday, June 8, 2009
Thursday, June 4, 2009
Saturday, May 30, 2009
Wednesday, May 27, 2009
Sunday, May 17, 2009
40 Useful JavaScript Libraries Get Feed
Astonishing Javascript Libraries
http://www.twine.com/item/1229c1r0s-4n/40-useful-javascript-libraries
http://www.twine.com/item/1229c1r0s-4n/40-useful-javascript-libraries
Saturday, May 16, 2009
Excel Addin : calling service
Given a simple asmx service, here is how to call it in an Excel AddIn
In RibbonBar
(...)
using ExcelAddIn.ServiceReference1;
namespace ExcelAddIn
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
public void Hello()
{
using (Service1SoapClient svc = new Service1SoapClient())
{
Excel.Range rgStart;
Excel.Worksheet ws = (Excel.Worksheet)Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet;
rgStart = ws.Application.ActiveCell;
rgStart.Value2 = svc.HelloWorld();
}
}
#region VSTO generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
In RibbonBar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
namespace ExcelAddIn
{
public partial class Ribbon1 : OfficeRibbon
{
public Ribbon1()
{
InitializeComponent();
}
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Globals.ThisAddIn.Hello();
}
}
}
Friday, May 15, 2009
JQuery : Templating using Pure.js
I have tried to use 'chain.js' but it was too slow so I've adopted Pure.js, which is very fast.
I also use the nice tips of John which allows to hide
html parts.
Here is a sample on how I use Pure with JQuery
Here is the link for the lib:
http://beebole.com/pure
Thanks Mic Cvilic
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script src="../Scripts/pure.js" type="text/javascript"></script>
<script src="../Scripts/Services.js" type="text/javascript"></script>
</head>
<body>
<button onclick="getProducts();">GetProducts</button>
<br />
<div id="productsList"></div>
<br />
<button onclick="decS();">prev 10</button><button onclick="incS();">next 10</button>
<!-- Scripts -->
<script type="text/html" id="productsListTemplate">
<table id="products" border="1"; width="400">
<thead>
<tr>
<th style="width:100;">ProductID</th>
<th>ProductName</th>
</tr>
</thead>
<tbody id="tableBody">
</tbody>
</table>
</script>
<script type="text/html" id="tableBodyTemplate">
<tr class="context">
<td class="ProductID"></td>
<td class="ProductName"></td>
</tr>
</script>
<script type="text/javascript" charset="utf-8">
var s = 0;
var t = 10;
var uriProducts = "ClientBin/DataService.axd/InfoCentreV01-Web-ProductService/GetProducts?";
var tableBodyTemplate = $("#tableBodyTemplate").html();
var prdtTemplate = $("#productsListTemplate").html();
$("#productsList").html(prdtTemplate);
function incS() {
s = s + 10;
getProducts()
}
function decS() {
if (s > 1) {
s = s - 10;
}
getProducts();
}
function getProducts() {
var uri = uriProducts + "s=" + s + "&t=" + 10;
$.getJSON(uri, function(products) {
var context = products.Results;
$("#tableBody").html('');
$("#tableBody").html(tableBodyTemplate);
$('#products').autoRender(context);
});
}
</script>
</body>
</html>
I also use the nice tips of John which allows to hide
html parts.
Here is a sample on how I use Pure with JQuery
Here is the link for the lib:
http://beebole.com/pure
Thanks Mic Cvilic
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script src="../Scripts/pure.js" type="text/javascript"></script>
<script src="../Scripts/Services.js" type="text/javascript"></script>
</head>
<body>
<button onclick="getProducts();">GetProducts</button>
<br />
<div id="productsList"></div>
<br />
<button onclick="decS();">prev 10</button><button onclick="incS();">next 10</button>
<!-- Scripts -->
<script type="text/html" id="productsListTemplate">
<table id="products" border="1"; width="400">
<thead>
<tr>
<th style="width:100;">ProductID</th>
<th>ProductName</th>
</tr>
</thead>
<tbody id="tableBody">
</tbody>
</table>
</script>
<script type="text/html" id="tableBodyTemplate">
<tr class="context">
<td class="ProductID"></td>
<td class="ProductName"></td>
</tr>
</script>
<script type="text/javascript" charset="utf-8">
var s = 0;
var t = 10;
var uriProducts = "ClientBin/DataService.axd/InfoCentreV01-Web-ProductService/GetProducts?";
var tableBodyTemplate = $("#tableBodyTemplate").html();
var prdtTemplate = $("#productsListTemplate").html();
$("#productsList").html(prdtTemplate);
function incS() {
s = s + 10;
getProducts()
}
function decS() {
if (s > 1) {
s = s - 10;
}
getProducts();
}
function getProducts() {
var uri = uriProducts + "s=" + s + "&t=" + 10;
$.getJSON(uri, function(products) {
var context = products.Results;
$("#tableBody").html('');
$("#tableBody").html(tableBodyTemplate);
$('#products').autoRender(context);
});
}
</script>
</body>
</html>
Thursday, May 14, 2009
Monday, May 11, 2009
Wednesday, April 29, 2009
Tuesday, April 28, 2009
Silverlight 3 : Navigation Framework
SilverLight 3 allows to build 'Navigational Applications'
Tim Heuer shows a nice walkthrough
http://silverlight.net/learn/learnvideo.aspx?video=187319
Tim Heuer shows a nice walkthrough
http://silverlight.net/learn/learnvideo.aspx?video=187319
Sunday, April 26, 2009
Friday, April 24, 2009
Thursday, April 23, 2009
Wednesday, April 22, 2009
Tuesday, April 21, 2009
Monday, April 20, 2009
Saturday, April 18, 2009
Using jQuery in ASP.NET apps with httphandlers (ASHX)
This sample shows how to update cascaded dropdownlist
http://sites.google.com/site/spyderhoodcommunity/tech-stuff/usingjqueryinaspnetappswithhttphandlersashx
http://sites.google.com/site/spyderhoodcommunity/tech-stuff/usingjqueryinaspnetappswithhttphandlersashx
Friday, April 17, 2009
Thursday, April 16, 2009
Wednesday, April 15, 2009
Wednesday, April 8, 2009
Raising Events From User Controls
Given a simple button in a usercontrol, here is the code behind
And in the code behind aspx page
On aspx page
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication37._Default" %>
<%@ Register Src="~/WebUserControl.ascx" TagPrefix="uc" TagName="mycontrol" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:mycontrol ID="myuc" runat="server" OnMyEvent="myControl_MyEvent" />
</div>
</form>
</body>
</html>
Partial Public Class WebUserControl
Inherits System.Web.UI.UserControl
Public Event MyEvent As System.EventHandler
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
RaiseEvent MyEvent(Me, New EventArgs())
End Sub
End Class
And in the code behind aspx page
Partial Public Class _Default
Inherits System.Web.UI.Page
Dim WithEvents uc As WebUserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub myControl_MyEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles uc.MyEvent
'...'
End Sub
End Class
On aspx page
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication37._Default" %>
<%@ Register Src="~/WebUserControl.ascx" TagPrefix="uc" TagName="mycontrol" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:mycontrol ID="myuc" runat="server" OnMyEvent="myControl_MyEvent" />
</div>
</form>
</body>
</html>
Tuesday, April 7, 2009
Monday, April 6, 2009
Dynamically Loading ASP.NET User Controls with jQuery
Thursday, April 2, 2009
Wednesday, April 1, 2009
Sunday, March 29, 2009
OpenFrameWorks
Openframeworks is a c++ library designed to assist the creative process by providing a simple and intuitive framework for experimentation.
http://www.openframeworks.cc/download
http://www.openframeworks.cc/download
Friday, March 27, 2009
Thursday, March 26, 2009
Wednesday, March 25, 2009
Tuesday, March 24, 2009
HTTP Web Programming with WCF 3.5: Creating a Template based URI
ASP.NET AJAX createDelegate and the JavaScript "this"
Sunday, March 22, 2009
Thursday, March 19, 2009
Plugin Concept in .Net
Here is th VB.NET translation of this excellent Article
http://www.ottoschellekens.nl/PluginConcept.htm
Imports System.Collections.Generic
Imports System.IO
Imports System.Reflection
Public Class PluginHandler
Private Shared _Handler As PluginHandler
Private _haPlugins = New System.Collections.Hashtable
Public Shared Function Create() As PluginHandler
If _Handler Is Nothing Then
_Handler = New PluginHandler()
End If
Return _Handler
End Function
Public Function LoadPlugins() As Int16
Dim PluginsLoaded = 0
'Dim Path = "c:\OceanPlugins"
Dim Path = System.Configuration.ConfigurationManager.AppSettings("RepertoirePlugins")
Dim dir As DirectoryInfo = New DirectoryInfo(Path)
Dim dllFiles() As FileInfo = dir.GetFiles("*.dll")
For Each objInfo As FileInfo In dllFiles
If LoadPlugin(objInfo.FullName) Then
PluginsLoaded += 1
End If
Next
Return PluginsLoaded
End Function
Public Function LoadPlugin(ByVal sFile As String) As Boolean
Dim assPlugin As Assembly = Assembly.LoadFile(sFile)
Dim typPluginTypes() As Type = assPlugin.GetTypes()
Dim bReturn As Boolean = False
For Each typPlugin In typPluginTypes
Dim typInterface As System.Type = typPlugin.GetInterface("Ocean.IOceanPlugin")
If typInterface IsNot Nothing And typPlugin.IsClass Then
Dim objFactory As Object = assPlugin.CreateInstance(typPlugin.FullName)
Dim objPlugin As Ocean.IOceanPlugin = CType(objFactory, Ocean.IOceanPlugin)
_haPlugins.Add(objPlugin.GetShortDescription, objPlugin)
bReturn = True
End If
Next
End Function
Public Function getPlugins() As Hashtable
Return _haPlugins
End Function
End Class
http://www.ottoschellekens.nl/PluginConcept.htm
Imports System.Collections.Generic
Imports System.IO
Imports System.Reflection
Public Class PluginHandler
Private Shared _Handler As PluginHandler
Private _haPlugins = New System.Collections.Hashtable
Public Shared Function Create() As PluginHandler
If _Handler Is Nothing Then
_Handler = New PluginHandler()
End If
Return _Handler
End Function
Public Function LoadPlugins() As Int16
Dim PluginsLoaded = 0
'Dim Path = "c:\OceanPlugins"
Dim Path = System.Configuration.ConfigurationManager.AppSettings("RepertoirePlugins")
Dim dir As DirectoryInfo = New DirectoryInfo(Path)
Dim dllFiles() As FileInfo = dir.GetFiles("*.dll")
For Each objInfo As FileInfo In dllFiles
If LoadPlugin(objInfo.FullName) Then
PluginsLoaded += 1
End If
Next
Return PluginsLoaded
End Function
Public Function LoadPlugin(ByVal sFile As String) As Boolean
Dim assPlugin As Assembly = Assembly.LoadFile(sFile)
Dim typPluginTypes() As Type = assPlugin.GetTypes()
Dim bReturn As Boolean = False
For Each typPlugin In typPluginTypes
Dim typInterface As System.Type = typPlugin.GetInterface("Ocean.IOceanPlugin")
If typInterface IsNot Nothing And typPlugin.IsClass Then
Dim objFactory As Object = assPlugin.CreateInstance(typPlugin.FullName)
Dim objPlugin As Ocean.IOceanPlugin = CType(objFactory, Ocean.IOceanPlugin)
_haPlugins.Add(objPlugin.GetShortDescription, objPlugin)
bReturn = True
End If
Next
End Function
Public Function getPlugins() As Hashtable
Return _haPlugins
End Function
End Class
Tuesday, March 17, 2009
Python Raytracer in 50 Lines of Code
From http://jan.varho.org/blog/programming/python-raytracer-in-50-lines-of-code/comment-page-1/#comment-11
import math
from PIL import Image
def sub(v1, v2): return [x-y for x,y in zip(v1, v2)]
def dot(v1, v2): return sum([x*y for x,y in zip(v1, v2)])
def norm(v): return [x/math.sqrt(dot(v,v)) for x in v]
def trace_sphere(r, s, tmin, color):
sr = sub(s[0], r[0])
dsr = dot(sr, r[1])
d = dsr*dsr - dot(sr,sr) + s[1]
if d < 0: return
d = math.sqrt(d)
t1 = dsr + d
if t1 < 0: return
t2 = dsr - d
if t2 > tmin[0]: return
if t2 < 0:
tmin[0] = t1
else:
tmin[0] = t2
color[:] = [s[2]]
def trace_ray(ray, spheres):
color = [(0, 0, 0)]
tmin = [100000]
for s in spheres:
trace_sphere(ray, s, tmin, color)
return color[0]
red = (255,0,0)
blue = (0,0,255)
spheres = ( ((0,0,100), 100.0, red), ((0,-5,50), 20.0, blue) )
w, h = 200, 200
image = Image.new("RGB", (w, h))
pix = image.load()
for x in range(w):
for y in range(h):
ray = ( (0,0,0), norm(((x-w/2.0)/w, (y-h/2.0)/w, 1)) )
pix[x,y] = trace_ray(ray, spheres)
image.save("out.png")
Simple Ray Tracing Computation
Example of a simple Ray Tracing Computation to compute primary ray and test intersection with a sphere
http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtexamp1.htm
http://matthieu-brucher.developpez.com/tutoriels/3D/raytracer/01-introduction/
http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtexamp1.htm
http://matthieu-brucher.developpez.com/tutoriels/3D/raytracer/01-introduction/
Subscribe to:
Posts (Atom)