Ana içeriğe atla


Eylül, 2008 tarihine ait yayınlar gösteriliyor

When a method calls itself

This you can't do in RPG - have a method call itself. Sounds like something you would never use? Think again. See this small console program that recurses through directories to get a list of folders and files. When the method finds a directory, it calls itself with the sub folder as a parameter whereupon the File part of the IF statement is executed. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Recurse(@"c:\temp"); } public static void Recurse(string directory) { DirectoryInfo path = new DirectoryInfo(directory); FileSystemInfo[] files = path.GetFileSystemInfos( ); foreach (FileSystemInfo file in files) { if (file is DirectoryInfo) { Console.WriteLine("Folder-> " + ((DirectoryInf

Read, write and delete files in windows

Sooner or later you'll need to access files from the Window's file system. You'll need to check if a file exists, delete it, move it , you'll need to read and write to it and upload data from it to an iSeries table etc. To illustrate how easy this is, I've included a full C# project. This program cleans up a desktop. It moves unwanted items automatically to a 'clean up' folder automatically. Items you don't want to remove are maintained in a text file manually. This file is in 'CleanUp' on your desktop after you run it the first time. Set it up to run in 'scheduled tasks' to run daily. My desktop gets absolutely splattered with downloads, images, files etc. etc. Now it gets cleaned automatically and the stuff I want to keep is always there. Files are moved but not folders. The app demonstrates two things. How to access the windows file system How to write a RPG-like app in C#. i.e. in a procedural way There is a 'main', an init et

Converting RPG code to C# automatically?

What if you could take your RPG programs and hey presto! have them converted into .NET and instantly sell your product to the rest of the world. This would be a boon to AS/400 vendors locked into the small(ish) AS/400 market. The advantage is that the original product is likely a mature business proven system which can provide a critical edge against the deluge of competition once in the new windows space. While webfacing does provide a web front end to applications and is great for hosted models it does not help customers who are windows only and want windows only software. Granted companies need to migrate on the competition level . However, all the supposed advantages such as performance, cost savings, availability of talent etc sounds hollow to long time AS/400 owners. Anecdotally we know that the uptime for the AS/400 is absolutely stunning compared to windows. It's super stable and extremely reliable. At windows only shops instead of maintaining one iSeries server a

Typing the RenderView method in ASP.Net MVC

Since the first minutes I started playing around with the MVC framework something has bothered me about the use of magic strings in regards to the RendorView methods. With the current implementation of RendorView there is NO compile time type checking to ensure that view even exists (evil magic strings). Also, there is no way to find all usages of a view without doing a 'global find' on the project. If you can strongly type the view to be used you will benefit from compile time type checking, you can use ReSharpers 'Find Usages' and it is just less evil. Here are 2 ways to do this: 1 - Generics public virtual void RenderView<T>( object viewData ) { RenderView(typeof(T).Name, string.Empty, viewData); } 2 - Type provided public virtual void RenderView(Type viewType, object viewData) { RenderView(viewType.Name, string.Empty, viewData); } Here are a few examples of code calling the new RendorView methods 1 - Generics RenderView<SportsListing>(sports); 2 - Typ

SQL Server 2008

Şuanda üzerinde çalışmakta olduğumuz proje sebebiyle SQL Server 2008 Enterprise sürümü veritabanı işlemlerini gerçekleştireceğiz. Bu kapsamla bu uygulamayı kurmam gerekti. Bir önceki sürümüne oranla kurulumu daha basit ve anlaşılır. Ayrıca da bellek/performans faktörlerini düşünürsek bir önceki sürümüne göre çok daha optime ve hızlı olduğunu görebiliriz. İlerleyen zamanlarda sql server 2008 ile ilgili yenilikleri(benim gözüme çarpan) sizlerle paylaşmaya çalışacağım. Alt tarafta sizler için SQL Server 'in olmazsa olmazlarından Management Studio 'unun başlangıç ekranını sunuyorum. Umarım kullanım olanağınız olur...