Agusto Xaverius P.S

Jobs : Creating many bug with bug fixing too of cource Programming : C# .Net, WSS/MOSS, K2 BlackPearl, SQL Server
See also: Other Geeks@INDC

November 2005 - Posts

Embedded Icon / Image to Resources
CMIWW.

Biasanya kita melakukan load image atau icon seperti code sebagai berikut  
public Form1(){
      //Load a file from the file system
      this.BackgroundImage = new Bitmap(@"C:\image\wallpaper.jpg");
}

Kelemahan coding adalah pada saat penginstalan ke client pastikan folder dan file tersebut berada di yang kita inginkan bila tidak applikasi tidak akan menload image yang ada karena memang tidak ada di folder tersebut.
Ataupun kita melakukan dengan menggunakan applikasi path tempat applikasi berada dan file image/icon tersebut ada di folder tempat penginstalan dan ternyata file di terdelete secara manual.Salah satu solusi yang bisa kita lakukan adalah image / icon yang kita inginkan kita embedded ke applikasi kita.
Hal-hal yang di lakukan :
1.Copy file kita inginkan ke solution applikasi kita.
2.Set property di image/icon yang ada
Pada property Build Action set menjadi Embedded Resource
3.Load File programming.

using System.Reflection;
//tambahan namespace ini pada applikasi window formnya
namespace TEST
{
static void () 
{
   Application.Run(new Form1));
   Assembly myassem=  this.GetType().Assembly;  
   System.IO.Stream streamico = myassem.GetManifestResourceStream(this.GetType ().Namespace.ToString () +         ".GEARS.ico");
    this.Icon new Icon(streamico);

    //Atau yang Form background imagenya 
    System.IO.Stream streambgk = myassem.GetManifestResourceStream(this.GetType().Namespace.ToString()+ ".wallpaper.jpg");
    this.BackgroundImage = new Bitmap(streambgk);
}
}//ending namespace
Share this post: | | | |
Posted: Nov 23 2005, 09:23 PM by agusto | with no comments
Filed under: ,
Try Sql 2005 with XML
Kemarin baru dapat project dan moga moga sich tidak ada error tentang baca baca xml untuk export import data. Hem... jadi belajar XPATH, walau pun masih banyak yang harus di pelajari lagi tentang XQUERY di XPATH tsb.
 
Lagi bengong baca dech tutorial di MSDN tentang Sql 2005 dimana saya udah install yang versi express edition.
 
Keereeeen. Bisa store xml data dengan tipe xml tentu nya dan kita bisa query dan melalukan where statement dengan data di field yang kita beri tipe xml.
 
url :  http://msdn.microsoft.com/sql/learn/prog/xml/default.aspx?pull=/library/en-us/dnsql90/html/sql25xmlbp.asp
Ini adalah contoh dari microsoft :
 

CREATE TABLE docs (pk INT PRIMARY KEY, xCol XML)  

// Create  table dengan nama doc dan field pk itu integer dan xcol dengan tipe xml  ( xcol tipe xml ini lah yang akan kita main main).

INSERT INTO docs VALUES (1,
'<book genre="security" publicationdate="2002" ISBN="0-7356-1588-2">
   <title>Writing Secure Code</title>
   <author>
      <first-name>Michael</first-name>
      <last-name>Howard</last-name>
   </author>
   <author>
      <first-name>David</first-name>
      <last-name>LeBlanc</last-name>
   </author>
   <price>39.99</price>
</book>')

Kita insert data 1 data dengan xcol berisi data xml yang kita punyai.

SELECT DATALENGTH (xCol) FROM    docs // kalo yang ini buat dapatkan length dari data xcol tersebut.

Sample query dengan xml nya :

1. SELECT xCol
    FROM   docs
    WHERE  xCol.exist (
'//book/@ISBN[. = "0-7356-1588-2"]') = 1

Sample menjelaskan untuk menampilkan data di field xCol di mana di lakukan pengecekan apakah di dalam

xCol tersebut mempunyai data dengan atribut ISBN = '0-7356-1588-2'

'//book/@ISBN -> lihat dari tag nya

2. SELECT pk, xCol.query('//author[first-name = "David"]')
FROM   docs
WHERE  xCol.exist ('book/title/../author[first-name = "David"]') = 1

Nah kalo yang ini saya coba XPATH yang saya pelajari dan bisa juga di microsoft sample nya spt di bawah ini :

SELECT pk, xCol.query('//author[first-name = "David"]')
FROM   docs
WHERE  xCol.exist ('//author[first-name = "David"]') = 1

Untuk menampilkan data pada author david kita harus melakukan 2 hal pertama :

1 .utk yang di tampilkan kita harus query lagi.

    xCol.query('//author[first-name = "David"]') 

2. pengecekan apakah exist tidak ada di xcol tersebut

    xCol.exist ('//author[first-name = "David"]') = 1  atau xCol.exist ('book/title/../author[first-name = "David"]') = 1

Kenapa ???

Bila saya lakukan statement ini :
SELECT pk, xCol.query('//author[first-name = "Test"]')
FROM   docs 

Hasil yang akan di didapat adalah ada data pk, sedangakan pada field xCol kosong karena tidak ada

data tersebut pada saat di query.

Saya belum tau kenapa itu, sebab baru mencoba, dan untuk update xml nya apakah kita harus load dulu semua setelah itu update dengan menambah xml data kita atau tinggal mengupdate nya data aja.

Cuman tertarik ada asik juga..... he..he..he..he..., Selamat Belajar Lagi ..... 

Share this post: | | | |
Posted: Nov 18 2005, 05:15 AM by agusto | with no comments
Filed under:
Free .NET Development Tools
This some free .Net Development tool and all that stuff is really “FREE“
 
1. Nant
 Namt is a build tool. Build scripts are written that can perform tasks on your build server. Tasks are a-plenty, but typical tasks include the ability to build .NET solutions, run unit tests, copy files, make and delete directories and many more. In fact, with the ability to write custom takss for Nanr, there are plenty of possibilities.
Url : http://nant.sourceforge.net/
 
2. CruiseControl.NET
CruiseControl.NET is an Automated Continuous Integration server for .NET. CruiseControl.NET will monitor your source control repository and run your build scripts at set intervals, or whenever a file is checked in. CruiseControl.NET also provides a dashboard web application to view logs and status, plus a system tray application for all developers to install. This way, everyone knows who broke the build!
url : http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET
 
3. Nunit
If you're not already unit testing your code, then you certiainly should be. Nunit allows you to write unit tests in your .NET language against your code. The GUI is easy to use and gives a developer confidence to make changes to code. Nunit can be integrated into your build (Nant) so tests can be automated.
Url : http://www.nunit.org/
 
4.NunitASP
Like Nunit, NunitASP is for unit testing.But in the case of NunitASP, this is an Nunit extension that is used to test the code-behind pages o your ASP.NET applications. You can program tests to click buttons, select an array of web controls and other useful features.
Url : http://nunitasp.sourceforge.net/
 
5. TestDriven.NET TestDriven.NET
is a free add-in for Visual Studio that piggy-backs on Nunit. It adds quick access, right mouse click functionality to run your unit tests, showing the results in the output window. You can even debug your tests from the right mouse button. Url : http://www.testdriven.net/ 5. RegEx Designer.NET If you've written validation for your .NET sites, regular expressions can be a pain to get to grips with. The RegExDesigner allows you to test out your regular expressions and even generate .NET code from your regular expressions.
Url : http://www.sellsbrothers.com/tools/#regexd
 
6. FxCop FxCop
is a code analysis tool that checks your code for standards conformance. GUI and command line is available and again can be automatically run via your build script.
Url : http://www.gotdotnet.com/team/fxcop
 
7. NDoc
NDoc generates class library documentation from .NET assemblies and the XML documentation files generated by the C# compiler Ndoc allows you to produce HTML or MSDN Style documentation.. Using Ndoc is as simple as filling in your .NET XML Comments.
Url : http://ndoc.sourceforge.net/
 
 
Share this post: | | | |