Preparing a custom image of Windows 7

I have written a detailed guide about preparing custom images for Windows XP before, and this time I am writing about preparing custom images of Windows 7 with the same technique.

The basic tool we use is the same – Sysprep. However, it is much easier in Windows 7 to create a custom image. I have ran across some weird problems, and I am including those details and solutions as well in this article.

Read more »

Updating a control in ASP.NET using ASPxGridView after a postback

I’ve recently ran into a strange problem in ASP.NET. Being a desktop developer, I like to put interactions in my applications. What I wanted to do was very simple: After a grid postback (grid operation like update or create/delete), I wanted to show a status message to the user. This can be done easily with a button click event but since I was using DevExpress ASPxGridView, I couldn’t bind the UpdatePanel events to it’s postback event (I did but it didn’t work). I tried ways to force partial render but none gave the result I wanted. Here, I’m giving the solution I came up with:

It uses an UpdatePanel and Javascript.
The Javascript part:

<script type="text/javascript">
function updateStatusText() {
__doPostBack("< %= UpdatePanel.ClientID%>", '');
}
</script>

What we do here is simple, we add a Javascript function which forces a postback of the desired control (UpdatePanel in our case)

Read more »

Psychology of Programming: Programmer’s Flow

The nature and psychology of “things” have always attracted me. Aside programming, I like to learn “how” and “why” parts of phenomenons. Lately, I have been working on how to get more efficient and do more tasks in less time, especially in programming. Of course planning is the most important part of this goal, but, how do we implement our planning? Today’s most programming strategies involve breaking tasks into smaller ones and get feedback on the project along the way. This is one of the crucial steps of programming, but there is one more step: implementing these tasks efficiently.

Efficiency in programming can not be achieved with the strategies from other fields. Think about these: When you need efficiency in a restaurant, you may hire more waiters and cooks. When you need efficiency in your finance department, you can hire large groups of accountants, plan the work, split and get everything done. In any field, you can throw more “players” or “units” to achieve speed. (Warning: I’m not saying quality, I’m saying speed and/or efficiency). But, if you look at programming teams, they are usually small. Why can’t we throw more programmers and get everything done? There are some companies out there who tried this methodology and failed miserably. While looking for reasons of this problem, I came across this phenomenon: Programmer’s Flow (or Conscious Programming)

Read more »

[SQL Quickies] “Login Failed for user” error in SQL Server

Here’s a quick tip on solving this problem on MS SQL Servers:

First of all, find why the problem exists:

  • Right click “My Computer” and click Manager
  • Expand Event Viewer
  • Click on “Application”
  • Look for “Failure Audit” in the logs. Your error might be different than mine, if it’s the same, keep reading.

Read more »

Linux on USB Stick, Under Windows, with CoLinux!

Ok, I admit that the title is a little bit tricky. You want to use Linux, especially a linux application, under Windows, without installing any virtualization software (Vmware, VirtualBox etc.) And you need to do it fast, i.e with a double-click only. You can use CoLinux, “the first working free and open source method for optimally running Linux on Microsoft Windows
natively. Cooperative Linux (short-named coLinux) is a port of the Linux kernel that allows it to run cooperatively alongside another operating system on a single machine”. You can hook up with XMing Portable (X Server for Windows) and start using your Linux applications on Windows and carry it to anywhere on your USB stick. Normally you have to install your distribution on CoLinux, but I’ll provide a faster way (use a pre-configured Arch Linux on CoLinux)
Read more »

Deploying Windows Image Universally to Different Hardware (Different HAL, IDE or SATA or SCSI)

How much time does it take to install Windows XP? And the service pack? And the programs, plus settings, and other things? 3-4 hours? And considering the problems like spyware, malicious software problems, or the “natural” problems of Windows like getting slow after 1-2 months, crashing for no reason; how many times do you have to go through this installation procedure in a year? Well, multiply this with the number of computers you own. Lots of time gone for configuring.. Well, there is a very easy way of creating a universal image of Windows Xp with all the programs and configurations you want, and it can be deployed in just minutes!

What you will need to create a universal Windows XP image:

1-) Windows XP Cd
2-) Optional: Service Packs or any programs you want to install
3-) An imaging software (like Acronis TrueImage or Norton Ghost)
4-) Optional: Preferably a Virtual Machine. I do my imaging in Virtual Machine, but you can use your own computer to get the image. I use Sun VirtualBox

Steps to take to create your XP image:

Read more »

Hello World with Smart Client Software Factory

To define Smart Client Software Factory, we need to understand the Composite Smart Client Application. This describes a smart client that combines several loosely coupled modules in one shell. They for instance share a menu, status bar and several services, but remain independent besides those. A smart client is the name that is used, mainly by Microsoft , for a client application that combines the rich GUI of the well-known windows applications like Word and Excel (the fat client) with the connectedness of a browser application (thin client). Read more »

Multi WAN Load Balancing under Windows with PfSense

I recently built a home server machine for multimedia (movies, gaming, and picture storage) and networking purposes. The multimedia part is quite simple, you can hook up the server to your TV and watch movies or play games, and use the server as a centralized storage for file archiving. This can mostly be done under *NIX systems, but when it comes to HD movie playing and gaming, WINE may not run everything smoothly and you may not get the same results with full HD (1080p) under Linux. So, I decided to use Windows Vista as my host operating system in this server configuration.

The second purpose of the server is networking. I wanted to combine several DSL and Cable Net connections into one network and use the bandwidth pool (Quick example: Think that you have 3 DSL lines, each with 6 Mbit bandwidth pools. If you combine these 3 lines and apply load balancing with a round robin algorithm, you’ll get 18 Mbit bandwidth pool. So if you use segmented downloading software like Internet Download Manager, you should get around 1.6 mb/s download rate. ) The goal here is, very basically, I want to combine my internet connections to get faster speed.

This is called Multi WAN Load Balancing (will be called “load balancing” from now on). Load balancing can be done very easily with a script under BSD and Linux systems. (Doing it under BSD is easier than Linux by the way). But, my server will be on Windows Vista, and as you can guess, it is nearly impossible to this under a Windows desktop operating system. By the way Windows Server 2008 and 2003 has NLB (Network Load Balancing), which is NOT we are doing in this article. These two concepts are different. Also, forget about Internet Connection Sharing under Windows, it is different from our goal here.

So, back to our problem; we want to do load balancing with round robin algorithm under Windows Vista, and there is no software doing it. The easiest way of doing this is using a BSD system, but we’re under Windows. At this point, a friend of mine, who is a network systems admin (Alper YALCINER) gave me the idea of using PfSense, an open source customized distribution of FreeBSD tailored for use as a firewall and router, with a live CD. My buddy told me that all I had to do was running PfSense under Windows via Vmware or VirtualPC and redirecting all outgoing traffic to the local connection that PfSense uses. I chose to use Vmware since VirtualPC does not offer as much as its competitors.

Read more »

My Top 7 Symbian Applications

I am thrilled about the improvements on mobile technologies, both on hardware and software levels. I am using Nokia N95-8GB, with all it’s functionalities and I enjoy it very much. The hardware capabilities are great – lots of storage, A-GPS, Wifi Connectivity, large screen, dual cameras(3.2 MP and  5 MP) and 3-G and much more. But, with software, these already-great functions can be taken to a much greater level, with new ideas. So, to help the developers and show everyone what I’m using, I would like to list my top 7 Symbian applications here: Read more »

PostgreSQL Database Server Farm Installation and Configuration with PgCluster on FreeBSD

I recently installed a PostgreSQL Database Server Farm on FreeBSD at work. This installation had 1 loadbalancer, 3 cluster servers and 2 replication servers. PostgreSQL works really fast under FreeBSD (especially if you apply the correct configuration). I had some hard time finding a documentation, so I’m publishing the one I wrote here. This guide includes FreeBSD installation (step by step) and configuration, PgCluster installation and configuration (with a little bit performance tuning, thanks to EnderUnix Team and Alper YALCINER) and also performance testing via Bristlecone.

Read more »

Detecting Dead Characters in Delphi

A dead key is a key on a typewriter or a computer keyboard that allows modification (such as by placement of diacritic) on the following letter. For example, option-`e produces è on the Macintosh U.S. keyboard layout. On a typewriter, this was accomplished mechanically by striking the diacritic mark without advancing the carriage (thus, the paper is still in the position to accept the next letter at the same spot the diacritic was placed). On a computer, the key instead temporarily changes the mapping of the keyboard for the next keypress.

Here’s an old code snippet of mine for those of you who are dealing with dead characters in Delphi: To detect a dead character, use this function:

function IsDeadKey(Key: Word): Boolean;
begin
if MapVirtualKey(Key, 2)  = 0 then
Result := True
else
Result := False;
end; 

Then, if the key is not a dead key, you can go ahead and use ToUnicodeEx() API to convert it in your code. If it’s a dead key, don’t use ToUnicodeEx() as it will delete the keyboard buffer.

Cheers
Bora Bilgin

Texas Holdem Poker Game in C# (XNA 3.0)

Here’s the Texas Hold’em Poker game that I’ve been working on for 2.5 weeks. It’s coded in C# (XNA 3.0). It’s my first game, so there are still some bugs in it, but it was really a fun experience. You can play with 2, 4 or 8 bots, although the bots aren’t very intelligent, they can keep you entertained for a while. You can also see your hand odds (chances of winning). I am actually thinking about writing a Poker server in Java which can be attached to my instant messenger system(sick, eh?).Here’s a screenshot:

Texas Holdem Poker Game

Download the installation file here. You don’t need XNA to run it!
Cheers, and happy coding. Thanks to Keith Rule, Jonathan Feldkamp and Wesley Valera for their community additions.

Bora Bilgin

DataGrid in a ComboBox, C#


Ever thought of putting different controls in a combo box? I’ve seen calendar, (DateTimePicker), check box, treeview controls in a combo box, but not a data grid control. So I decided to make it on my own. Here’s a screenshot of what I’m talking about:

Data Grid in a Combo Box Control
Download the .vsi file here. Double click on it and Visual Studio will install the control automatically.If it doesn’t work, (for some reason it might not work, giving you an error about not finding the dll file), here is the dll file.

Enjoy, and happy coding

Bora Bilgin

Fast IP Switcher


Using more than 1 network at home? Wanna try a fast way of changing your IP addresses? Here is Fast Net Switcher, an old program that I wrote last year. Thought it might be useful.

Screenshot:

Fast IP Switcher

Download the file here. Coded in Delphi 7, e-mail for the source code.

Cheers and happy coding.

Bora Bilgin

Mic Spy


As promised, I am posting the applications from my old blog site. Here goes Mic Spy.

Mic Spy

It records the audio input from microphone. It is written in Delphi 7, uses PCM 22.050 kHz 16 Bit Mono format, and you can show or hide it with a key combination. You can also start or stop recording with a key combination, which makes it a “local” spy :) I’ve made a networked version of this (which simply runs in background and sends the audio data to multiple computers on network) but I think it won’t be good to distribute that application. So, enjoy :) Drop an e-mail if you are interested in the code.

Download the application here.

Cheers, and happy coding!

Bora Bilgin

UPDATE: Here’s the source code (with WaveAudio Package, make sure it’s in your library path for compilation) for those who wants to have a look at it. Download the source code here.

Better event handling in JavaScript


Recently I ran into Aaron Moore’s addEvent method through Robert Nyman’s blog. I was so thrilled about the code so I wanted to share it.Here is the link to the JavaScript file, and here is the usage:

addEvent(window, 'onload', func);

The first argument can be any element, the second is a string which contains the name of the listener, and the third contains your handler, which can be anonymous, but if so, you can’t use the remove function to remove it because there is no way to identify it.

removeEvent(document.getElementById('test'), 'onclick', back);

The arguments for remove are exactly the same as for add. As long as remove has a reference to the function, it can find it and remove it.

Thanks to Aaron Moore for this awesome piece of code.Cheers, and happy coding.
Bora Bilgin

Hacking your Symbian S60 v3 Phone to Install Unsigned Applications

Note: This article is for educational purposes only. Buy the applications that you use so that you can get newer and better applications in the future.
There are lots of methods for installing unsigned applications to your symbian phone (with your own certificate, with symbiansigned.com etc) BUT most of them do not work at the moment. In some newer phones, you can’t even install AppTrk to mod the firmware! Here is a very quick and working way to hack your symbian phone:

  • Download this file
  • Install HelloCarbide
  • Open X-Plore or a similar file handler program. Enable “Show system/hidden files” option
  • WITHOUT exiting X-Plore (press menu button etc), run HelloCarbide, and choose Menu1. It will close when it’s done, this is normal. Go back to X-Plore
  • Copy installserver.exe to c:\sys\bin\ (if bin folder doesn’t exist, create one)
  • Restart your phone
  • Install ROMPatcher.sisx and run it
  • Restart your phone

Voila, now you can install UNSIGNED symbian applications. This was tested on an N95-4 8GB, working very well

Cheers, and happy hacking

Credits go to the respective c0ders of the applications :)

Bora Bilgin

BDA on Windows Server 2008 for TV Tuner Cards


There are a lot of reasons not to use Windows Vista, but I’m not going to write them here. If you want to use the new features of Windows kernel and avoid the slowness of Vista, you can use Windows 2008 Server as your desktop operating system. XP still rocks, but what if you are developing applications and/or need to provide Vista support to your clients? Use Windows Server 2008, it’s fast, feature rich, more manageable than Vista.

I installed Windows 2008 when it was first released. I am using an HP Pavilion dv9000 series laptop, and it has a nice external TV Tuner card, which I wasn’t able to use with Windows 2008. I searched the internet, looked into forums, drivers etc.. everything and nothing worked, until I found out that BDA was disabled in Windows 2008.Then, as you can guess, someone came up with a solution! Installing BDA to Windows 2008!

What you need to do to use your TV Tuner in Windows 2008:

  • ->Download this executable
  • ->Run it. It should extract itself to c:\bdaforserver
  • ->Run the “Get BDA Vista Files.exe” under a Vista system. This file is going to gather some files from Vista. Those files can not be distributed within the executable file, as it’s illegal (Ever heard about the legendary lawyer army of Microsoft? Wink )
  • ->After running that exe under Vista, run “BDASetup.exe” under you 2008 system. This will install those gathered files into your Windows 2008. Then restart your system, plug your tv card, install it’s driver software and enjoy watching it!!!

Credits go to shaded26 on MSFN forums.
Enjoy

Bora Bilgin

Column Header View in SQLite


Ok, I know that the topic doesn’t make much sense. So I’ll let the pictures talk here. I’ve seen terrible ideas for showing the column header for sql output (even creating TABLES for each fields!!) so I am posting this small snippet. Here we go

Let’s assume that we have a table, named as “TEST”. And we have some fields: test_data, test_data_other, test_data_name and test_date Create statement:

CREATE TABLE TEST (test_data VARCHAR(30), test_data_other VARCHAR(30),
test_date SMALLDATE, test_data_name VARCHAR(6));

Some dummy data entry:Note: We don’t have a primary key field here. In normal conditions you’ll probably have “test_data_name” field as your primary key, but just to show the problem and the solution, I’m going to skip that part.

INSERT INTO TEST VALUES('SAMPLE DATA', 'ABC VALUE', '12-05-2008', 'ABC COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', 'DEF VALUE', '12-05-2008', 'DEF COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', 'QWE VALUE', '12-05-2008', 'QWE COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', 'YZX VALUE', '12-05-2008', 'YZX COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '123 VALUE', '13-05-2008', 'ABC COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '345 VALUE', '12-05-2008', 'DEF COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '678 VALUE', '12-05-2008', 'QWE COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '901 VALUE', '12-05-2008', 'YZX COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '321 VALUE', '13-05-2008', 'ABC COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '432 VALUE', '12-05-2008', 'DEF COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '653 VALUE', '12-05-2008', 'QWE COMPANY');
INSERT INTO TEST VALUES('SAMPLE DATA', '234 VALUE', '12-05-2008', 'YZX COMPANY'); 

How the table looks like with a SELECT * FROM TEST; query:
Normal Table View

How do we want the output to look like:
Desired Output

So, how do we get this output? We can use Fetch() in MsSql or some other servers, but with SQLite ? We use Case Then End code to get this output:

SELECT TEST_DATA_NAME, MIN(CASE WHEN TEST_DATE='12-05-2008' THEN TEST_DATA_OTHER END) AS '12-05-2008', MIN(CASE WHEN TEST_DATE='13-05-2008' THEN TEST_DATA_OTHER END) AS '13-05-2008', MIN(CASE WHEN TEST_DATE='14-05-2008' THEN TEST_DATA_OTHER END) AS '14-05-2008' FROM TEST GROUP BY TEST_DATA_NAME; 

Note that SQLite only recognizes the date fields if you use “YYYY-MM-DD HH:MM:SS”  format. We are using DD-MM-YYYY only, so we cant use date functions here.

So here, we check if the date column is what we want, and if it is, we ask SQLite to show our desired field as column. I’m using this technique in a stock market application, to show the daily values of stock items (there are 350 items and their value changes every day, so I need to see them as a column, not as a row) Another note. We use MIN(…). Why do we use an aggregate function(we are not even looking for MIN values anyways!!) Well, try using this query without an aggregate function. The “GROUP BY” clause won’t work. So we have to use an aggregate function, which, in our case is, MIN.

Cheers and happy coding

Bora Bilgin

Blog is Up and Running!


After a long period, my blog is up and running. Here’s the list of things that happened:

  • A disk was down in the server (which contained the most important data). We couldn’t get the data back.
  • I found a second job, which took most of my time
  • I installed a new CMS (Xaraya) instead of Joomla. Xaraya is far better than Joomla, I’m going to write a review on that in a short while.
  • Some other personal issues.

So, now that I’m back, here’s the list of things that I’m going to write (in order, hopefully)

  • Delphi articles & tips on my old blog site. I am trying to find them (No backups at the moment, I only have the code snippets ·that I’ve written. Anyways that’s something too!)
  • SQLite3 with Delphi (Dudes, SQLite is really great. And I found compatible Delphi libs as well). Also, aggregate SQL functions in SQLite deserve a write up, since I spent long time figuring out how to do some interesting things with SQLite
  • bizIM Messenger Update
  • Xaraya Review
  • Various other Delphi / .NET / Java tips that are in my mind for some time.

Cheers, and happy coding
Bora Bilgin

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work by Bora Bilgin is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.