Posts RSS Comments RSS 129 Posts and 246 Comments till now

The Journey Of Bishan-McRitchie-Bukit Timah

Continuing last week’s adventure. This week we took longer route. From Bishan MRT Station, to McRitchie Reservoir and then all the way to Bukit Timah Reservoir.

Here are the pictures.

1. The Beginning. This is our starting point. Along the way, we saw many teenagers having fun with canoe.
Photobucket - Video and Image Hosting

 

2. A short glance to our final destination.
Photobucket - Video and Image Hosting

 

3. A journey of thousand Li start from Zero KM :D
Photobucket - Video and Image Hosting

 

4. A native resident of McRitchie Reservoir cheers up our journey.
Photobucket - Video and Image Hosting

 

5. This is just the beginning …
Photobucket - Video and Image Hosting

 

6. Bamboo trees surrounded by the forests.
Photobucket - Video and Image Hosting

 

7. Nowhere bear Bukit Timah
Photobucket - Video and Image Hosting

 

8. Remember to behave when you are inside the National Parks!
Photobucket - Video and Image Hosting

 

9. Halfway in McRitchie Route.
Photobucket - Video and Image Hosting

 

10. Note point no. 8. Do Not Feed the Monkeys!
Photobucket - Video and Image Hosting

 

11. Resting at the Ranger’s Station. I had my lunch here. The fresh and soothing air really makes me fully relax after the meal.
Photobucket - Video and Image Hosting

 

12. The Ranger’s Station, complete with Water distiller.
Photobucket - Video and Image Hosting

 

13. Flower at Ranger’s Station.
Photobucket - Video and Image Hosting

 

14. So near yet so far ….
Photobucket - Video and Image Hosting

 

15. King of the forest.
Photobucket - Video and Image Hosting

 

16. Path to nowhere. Initially thought that this is the route to Bukit Timah. We took this route, and stopped at the dead end. Almost took risk by walking through the thick forest before decided that this route is the correct one.
Photobucket - Video and Image Hosting

 

17. Made a detour back to ranger station >.<
Photobucket - Video and Image Hosting

 

18. This time we took the correct path.
Photobucket - Video and Image Hosting

 

19. We’ve come this far, but Bukit Timah is yet within our view.
Photobucket - Video and Image Hosting

 

20. It seems we must take the Durian Loop. I wonder why they called this path Durian Loop?
Photobucket - Video and Image Hosting

 

21. OMG! Duck… Cover your head!!! .. The durians are falling down from the sky!!!!
Photobucket - Video and Image Hosting

 

22. This is it… One last kilometers to Bukit Timah Nature Reserver.
Photobucket - Video and Image Hosting

Hmm .. what next? Seletar Reservoir ?

Powered by Gregarious (42)
Share This
 

A Fine Sunday at McRitchie Reservoir

Overall conclusion would be, I need to go out for more outdoor activities :D

We spent the whole day circling the lake. we started walking at 10.30 and finished around 4 PM. Whew…that’s more than 5 hours


View Larger Map

The lake …
Photobucket

 

From different angle
Photobucket

 

Say hi to Mr. Nyu Nyu (Tortoise)
Photobucket

 

Dragonfly ??
Photobucket

 

Ripe …
Photobucket

 

A view from top… (of Jelapang Tower)
Photobucket

 

Another view from top … (still of Jelapang Tower)
Photobucket

 

Tree-Top Walk
Photobucket

 

Tree-Top Walk 2
Photobucket

 

Tree-Top Walk 3
Photobucket

 

Tree-Top Walk 4
Photobucket

 

Powered by Gregarious (42)
Share This

ASP.NET Session Quick Recap

Few days ago, a colleague of mine asked me what kind of session that is being used in my team’s application. Apparently his team has some sort of problem in handling the session. He asked whether my team use InProc, or OutProc. His question sent me scrambling for answer :) After googling for a while, here’s what I found:

  • InProc SessionState: The session will be stored in the memory of ASP.NET server.
  • OutProc SessionState: The session will be serialized and stored in other machine (StateServer machine or SQLServer machine).

To decide which SessionState that is most suitable for your environment, please consider the following points:

  1. Performance:
    • InProc: fastest, but consume more memory
    • OutProc (StateServer): slower than InProc, due to transport overhead and serialization cost
    • OutProc (SQLServer): slower than OutProc (StateServer), due to transport overhead and serialization cost
  2. Robustness:
    • InProc: session data will be lost when the IIS process restarted/stopped.
    • OutProc (StateServer): session data will NOT be lost when the IIS process restarted/stopped. But the StateServer machine will become the single point of failure. All sessions in any ASP.NET server linked to this State server will be lost if you restart/stop the StateServer process.
    • OutProc (SQLServer): almost the same as OutProc (StateServer), but you will not losing the sessions after you restart the SQL Server

To configure session state, add the following code within web.config’s <system.web>


Please note that serialization will cost you least when you store the “Basic DataTypes”. They are:

  1. Any numeric data types (Int32, Byte, Int64, etc)
  2. String
  3. DateTime
  4. TimeSpan
  5. GUID
  6. IntPtr and UIntPtr

If your ASP.NET application will be deployed in a web farm, consider using either StateServer or SQLServer to store your sessions. You can choose to use the commercial or the open-source solution. :) Unfortunately, I was unable to find any decent performance review of NCache without the marketing vibe :( But maybe in the future I might write something based on this blog post

 

References

Powered by Gregarious (42)
Share This
 

Questions To Be Pondered on Your Software Development

I was reading Alik Levin’s Blog which linked to an interesting article about increasing the performance of .NET application. The interesting questions are:

  • How to cache data?
  • How to handle communications?
  • How to handle concurrency?
  • How to handle components’ coupling/cohesion?
  • How to perform data access?
  • What algorithms to use?
  • How to handle exceptions?
  • How to handle resource management?
  • How to handle state management?

*read the article HERE

I strongly agree that every developer in any development Team should remember these questions (and know how to answer it, of course :D) by heart. And able take them as a consideration. My favorite donkey-bridge to these question is A-4C-D-E-R-S (Algorithm, Cache, Communication, Concurrency, Coupling, Data Access, Exceptions, Resource and State Management)

Even better if not best, if you could implement the answers to above questions as a standard framework for your development team. ;)

Powered by Gregarious (42)
Share This

How To Draw Diamond Recursively

I had this interesting challenge from my colleague. He asked me to draw diamond recursively (not really draw, but plot using command line program :D). I managed to draw the 3×3 diamond, but I didn’t satisfied with my program. So I put more thought on it, and make it more interesting by allow us to define the width and the height of the diamond.

namespace ConsolePrograms
{
    class DrawDiamond
    {
        static void Main(string[] args)
        {
            Console.WriteLine("1 Diamond, Width=7, Height=5");
            SetupDiamond(1, 7, 5);
            Console.WriteLine("4 Diamond, Width=3, Height=5");
            SetupDiamond(4, 3, 5);
            Console.WriteLine("9 Diamond, Width=3, Height=3");
            SetupDiamond(9, 3, 3);
            Console.WriteLine("16 Diamond, Width=7, Height=7");
            SetupDiamond(16, 7, 7);
        }

        static void SetupDiamond(int NumberOfDiamonds, int Width, int Height)
        {
            //NumberOfDiamonds must be a Perfect Square
            if (((int)Math.Pow(Math.Sqrt(NumberOfDiamonds),2.0)) != NumberOfDiamonds)
                return;

            //Width and Height must be an odd number bigger than 1
            if (Width % 2 != 1 || Height % 2 != 1)
                return;

            int actualWidth = (int)Math.Sqrt(NumberOfDiamonds) * Width
                - ((int)Math.Sqrt(NumberOfDiamonds)-1) ;

            int actualHeight = (int)Math.Sqrt(NumberOfDiamonds) * Height
                - ((int)Math.Sqrt(NumberOfDiamonds)-1);

            int midWidth = (actualWidth - (actualWidth % 2)) / 2;
            int midHeight = (actualHeight - (actualHeight % 2)) / 2;

            Char[][] arCharacters = new Char[actualWidth ][];
            for (int i = 0; i < actualWidth; i++)
                arCharacters[i] = new Char[actualHeight];

            for (int i = 0; i < actualWidth; i++)
                for (int j = 0; j < actualHeight; j++)
                    arCharacters[i][j] = '.';

            DrawDiamond(midWidth, 0, (Width-1)/2,
                (Height-1)/2, midWidth, midHeight,
                actualWidth, actualHeight,
                ref arCharacters);

            for (int i = 0; i < actualHeight ; i++)
            {
                for (int j = 0; j < actualWidth; j++)
                    Console.Write(arCharacters[j][i]);
                Console.WriteLine();
            }
        }

        public static void DrawDiamond(int x, int y, int Width,
            int Height, int midWidth, int midHeight,
            int actualWidth, int actualHeight,
            ref Char[][] arCharacters)
        {
            if (x < 0 || x >= actualWidth)
                return;

            if (y >= actualHeight)
                return;

            arCharacters[x][y] = ‘*’;

            if (x < midWidth && y < midHeight)
            {
                DrawDiamond(x - Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x > midWidth && y < midHeight)
            {
                DrawDiamond(x + Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x < midWidth && y > midHeight)
            {
                DrawDiamond(x + Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x > midWidth && y > midHeight)
            {
                DrawDiamond(x - Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x == midWidth)
            {
                DrawDiamond(x - Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
                DrawDiamond(x + Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
                DrawDiamond(x, y + (Height*2), Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x < midWidth && y == midHeight)
            {
                DrawDiamond(x + Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            }
            else if (x > midWidth && y == midHeight)
                DrawDiamond(x - Width, y + Height, Width,
                    Height, midWidth, midHeight,
                    actualWidth, actualHeight,
                    ref arCharacters);
            return;
        }
    }
}
Powered by Gregarious (42)
Share This

Pages (26): [1] 2 3 4 » ... Last »

Close
E-mail It
Socialized through Gregarious 42