Feeds:
Posts
Comments

Visual Studio 2008 integrates Sql server 2008 express nicely into App_Data folder. You just create the database using Server Explorer, and it inserts the connection string into web.config for you. I used it when I worked on my toy project – ToastManager. I finished coding and testing on my machine and deployed it to an integration server which belongs to my SCRUM team.

A problem, as usual, arose on the integration box. My windows login had sysadmin access to my local Sql Server express, but the process that runs ToastManager did not on the box.

I blindly thought that Sql Server express is a stand-alone DB and it can be deployed together with the applicaiton. It was misunderstanding. Sql Server Express is still a server application that needs to be installed on a remote machine. I looked for an alternative and soon found that many people use Sqlite.

Sqlite is an open source database and people testify that it is really fast. In order to use with .Net, you need to install System.Data.SQLite, which is another open source ADO.NET provider for SQLite database engine.

Once you download Sqlite, you can use its own command-prompt based tool, but probably, your first reaction is to try to find some GUI management tool. Fortunately, there is one too. It is FireFox Add-on: SQLite Manager.

So, to summarise, you need to have 3 programs to use SQLite. SQLite, System.Data.SQLite, and SQLite Manager.

If you have all necessary programs, please be careful with the folloing points.

  1. Add “SQLite Data Provider” to your web.config. You can add it to your machine.config or web.config in .Net 2’s config folder, but I prefere adding it to project’s web.config.
  2. Do not use “Link To Sql” as it does not support SQLite. Instead, use Entity Framework. It works nicely.
  3. Make sure you have System.Data.SQLite.dll and System.Data.SQLite.Linq.dll in your application’s bin folder. For some reason, though I referenced those two dlls in the project, they were copied into the folder. If those dlls are not in bin folder, you will have “Failed to find or load the registered .Net Framework Data Provider”. (http://sqlite.phxsoftware.com/forums/t/251.aspx)
  4. When you compare data using LINK, do not use .Date property. For some reason, it works with Sql Express, but not with Sqlite. I use “where o.OrderDate >= DateTime.Today” instead of “where o.OrderDate.Date == DateTime.Today”

This is my repository codes I wrote  against SQLite. Hope it helps.

public class OrderRepositorySqlite : IOrderRepository
{
    ToastMasterSqlite _entities = new ToastMasterSqlite();
    #region IOrderRepository Members

    public IEnumerable<Order> ListTodayOrders()
    {
        return (from o in _entities.Order
                where o.OrderDate >= DateTime.Today
                select o).ToList();
    }

    public Order GetOrder(long id)
    {
        return (from order in _entities.Order
                where order.OrderId == id
                select order).FirstOrDefault();
    }

    public void Add(Order order)
    {
        _entities.AddToOrder(order);
        _entities.SaveChanges();
    }

    public void Delete(Order order)
    {
        var originalOrder = GetOrder(order.OrderId);
        _entities.DeleteObject(originalOrder);
        _entities.SaveChanges();
    }

    public Order Update(Order orderToUpdate)
    {
        var originalOrder = GetOrder(orderToUpdate.OrderId);
        _entities.ApplyPropertyChanges(originalOrder.EntityKey.EntitySetName, orderToUpdate);
        _entities.SaveChanges();

        return orderToUpdate;
    }

    #endregion
}

You can come to a same page with the same or similar content with many different urls. Query strings may have user id, session id, and many more. All these varied urls work unfavourably toward SEO. It will be best to clean up your urls, but there is a easy and quick way to get around it. It is canonical link.

It’s supported not only by google, but by microsoft and yahoo as well. (http://searchengineland.com/canonical-tag-16537)

Recently, I added a 1 x 1 px hidden iframe on the site home for tagging purpose. The page that is loaded within the iframe does not need to be indexed and the url is better not to be kept in search engine. So what I did is

    <meta name="robots" Content="noindex">
    <link rel="canonical" href="https://www.sitehome.com" />

I wrote ToastManager about two months ago, and not try to covert it into ASP.Net. What ToastManager does is to collect people’s toast order for the morning toast run.

Why? I just think MVC is cool. It separate programming logic into 3 different layers nicely.

The first problem I encountered in writing MVC code was to find a way to display a dropdownlist with a selected value. It is funny. I feel like I am a complete novice when I use MVC.

Simply, you need to pass the selected value in creating SelectList. (from ASP.NET MVC Html.DropDownList SelectedValue)

for example,

    Slices = new SelectList(new int[] {1, 2, 3, 4}, 2);
[

The below is the code for my OrderFormViewModel class


public Models.Order Order { get; private set; }
public string[] Spread { get; private set; }
public SelectList Slices { get; private set; }

public OrderFormViewModel(Order order)
{
    Order = order;
    Spread = new[] { "Butter", "Jam", "Peanut Butter", "Bovril", "Honey", "Marmalade", "Marmite", "Vegemite" };
    int[] sliceList = new int[] {1, 2, 3, 4};
    Slices = new SelectList(sliceList, Order.Slice);
}

Roy Osherove is giving an hands-on TDD Masterclass in the UK, September 21-25. Roy is author of “The Art of Unit Testing” (http://www.artofunittesting.com/), a leading tdd & unit testing book; he maintains a blog at http://iserializable.com (which amoung other things has critiqued tests written by Microsoft for asp.net MVC – check out the testreviews category) and has recently been on the Scott Hanselman podcast (http://bit.ly/psgYO) where he educated Scott on best practices in Unit Testing techniques. For a further insight into Roy’s style, be sure to also check out Roy’s talk at the recent Norwegian Developer’s Conference (http://bit.ly/NuJVa).

Full Details here: http://bbits.co.uk/tddmasterclass

bbits are holding a raffle for a free ticket for the event. To be eligible to win the ticket (worth £2395!) you MUST paste this text, including all links, into your blog and email Ian@bbits.co.uk with the url to the blog entry. The draw will be made on September 1st and the winner informed by email and on bbits.co.uk/blog

여러가지 비법이 있을 수 있지만, Paul Hong 선교사님이 자신의 체험을 바탕으로 한 영어 잘하기 비법 3가지를 공개하셨다. 이 세가지 비법이 가진 강점은 본인이 직접 실행하여 그 효과를 체험하였다는 것.

  1. 영어 공부의 목적이 “영어를 쓰는 사람들을 사랑하기 위한 것” 이 되어야 한다. 사랑하면 두려움이 없다. 비록 저 사람이 영어를 잘 하고 (native니까 당연히!) 내가 잘 모르는 사람이지만, 그 사람을 주님안에서 사랑해야 하겠다고 마음먹으면 두려움없이 approac 할 수 있다. 사랑하는 마음으로 두려움을 극복하라. 영어를 쓰는 사람을 사랑하기 위해 영어를 공부하라.
  2. Words power and words pronunciation.
    대부분의 한국 사람들은 문법으로 영어를 잘 해보려고 하는데, 문법보다 어휘의 양을 늘려 대화의 폭을 넓히고 말하기 시작하라. 어휘가 늘면, 자연이 영어가 는다.
  3. 영어 신문 보기
    New York Times, Guardian, Financial Times 등을 매일 읽으라. 앨빈 토플러는 신문을 10씩 읽는다고 한다. 선교사가 되기 위해서는 성경과 신문을 함께 읽으라.

이 중에서 구체적인 실천법으로 영어 신문을 읽으라가 무척 마음에 다가온다. 사실 신문은 워낙 다양한 내용을 다루기 때문에, 다양한 어휘와 표현을 배울 수 있다. 매일 Susanna와 신문 1페이지를 읽도록 하자.

We just had a sprint review meeting with Olly who is the technical architect. One thing I am impressed with is that he actively suggest different ways to achieve the value to the product owner. I seem to have an technical guy mindsent and usually I do not challange the business value of the user story or suggest a different way to achieve the business goal. I thought it was a good thing to be open-minded and ready to do anything a product owner wants to have. In today’s meeting, I realised PO also needs feedback from us and we can find something better together, which is the agile way.

Susanna가 갑자기 한국에 가게 되어서 조엘이의 British Passport를 신청하고 있다. Check and Send service 를 이용하면 약 2주 안에 받을 수 있다. 신청할 수 있는 Post office는

POST OFFICE LTD
MEDIA VILLAGE SPSO
MEDIA VILLAGE, UNIT 8
BBC MEDIA CENTRE
LONDON
LONDON
W12 7TQ

요금은 46 파운드가 되겠습니다.

어린이가 태어났을 때 아버지가 영주권자 이면 자동적으로 어린이는 British Citizen이 됩니다. (ILR – Wikipedia)

Recently, I had a chance to refactor codes for a system that sends a file to DreamMail. Because we did not touch any FTP functionality, we were complacent and tested it up to where files are exported and sent via FTP. Development is completed and the application was deployed to a testing environment. Very thankfully and luckily, Jon (a team mate) and I happened to see that all new files generated by the refactored code are rejected in DreamMail ftp server. First we thought they fail because we use a testing account but it was worring that all files fail. We started investigating the issue. Picked one file that was successfully processed and uploaded it again. It worked without any problem. Then we compared the two files, successful one and failed one. Yet there was no difference. I assumed that something was different but was not visible, so downloaded Ultra-Edit because it can display file in hex code and checked the two files. The difference was the first 3 characters which is called BOM, Byte-Order Mark.

BOM is zero-width, no-break space and therefore, not visible in most of text editor. “It is conventionally used as a marker to indicate that text is encoded in UTF-8, UTF-16 or UTF-32.” (wikipedia) In hex value it is EF BB BF.

If the file stars with BOM, DreamMail client rejects it for some reason, thinking it is malformed.  My code that prepended BOM to the file was this.

using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))

Fix for this is simple. Do not specify encoding in StreamWriter constructor.

using (StreamWriter sw = new StreamWriter(fs))

There is a post in Expert Exchange that tells you to use Encoding.ASCII. It fixes the problem, but all text will be written in ASCII. You will lose lots of characters.

Honestly I panicked when I tried to open a text file and found that I could not open the file nor copy it. I installed Windows Home Server. I liked the simple interface and enjoyed the straightforward backup. I deleted and installed Windows XP, because my HP Deskjet 1560 did not have its driver for windows server.

Then the problem appeared. As Windows Home Server does it, all my data files were on D:\ drive. When the XP installation finished, I tried to open a text file. I had an error messsage saying “the file cannot be accessed by the system.” First, I thought, ah it must be something with NTFS ACL. I managed to find xcacls.vbs which shows NTFS ACL permission. It was ok. “Builtin\Administrators” had “Full Control” permission on the file. I googled the error message, and http://support.microsoft.com/kb/262320 said I have to install “Remote Storage Database” back. Probably, it was true partly, and WHS seems to use it underneath. But I couldn’t install WHS back, because WHS deletes all data on disk on installation. I googled again, adding “Home Server” to the error message. And at last, a social MSDN post gave me a very simple solution. It seems that there was a guy who panicked like me.

The solution is to find the hidden /DE folder on your disk and copoy from it. Please visit the link and read the post. A guy called “bruber” really explained it very professionally.

I think Windows Home Server is a very good idea, but if it is intended to be used at home, I believe it should handle driver issues. Many cheap peripheral devices for PC usually do not provide drivers for server windows.

I bought a refurbished vaio NR38M earlier 2 months ago. It is a nice laptop with good price and has Vista installed with lots of other programs. I wanted to use Windows 7 on it, and usually windows 7 performs better than Vista.

I can find all drivers, but it is very difficult to find a utility programs that enable keyboard function key. I don’t understand why Sony did in this way, using special program to enable function key.

A day later, I found that the above drivers page has links to Vaio’s driver and utility repository ftp.

You can see all originally installed drivers and utilities. Keyboard shortcuts are manaaged by a program called “Vaio Event Service.” I managed to figure it out using process explorer, thought some other guys on Internet already mentioned it. You can find Event service installation program from the above ftp link. I tried a seeminglyl latest one

Older Posts »