Friday, October 26, 2018

Mari kita kasi judul seadanya saja...

Jadi ceritanya entah ada angin apa, saya kepikiran untuk membeli lagi domain blog saya yang dulu di imsuryawan.net. Blog ini sudah musnah entah tahun berapa.

Trus, akhirnya menasehati diri sendiri.
"Ketimbang beli domain itu, bikin blog baru lagi, dan akhirnya terbengkalai lagi, mending manfaatkan saja blog yang dulu sudah ada dan digunakan lagi". 

So, here I am... trying to write a post in this blog again.

Sebelum menulis postingan ini, saya iseng-iseng ngecek blog saya di wordpress. Cuman ada 2 postingan di situ, yang intinya berjanji untuk mengaktifkan blog itu lagi (dan janji tinggallah janji... 😣). 

Berusaha login, ga bisa. Males set forgot password. Jadi mainlah saya ke blog saya yang di blogspot ini.

Damn! Tadi jadi malu sendiri setelah melihat postingan jadul di blog ini. Sotoy amat postingannya yak! :D

Saya ingat. Waktu itu saya memutuskan untuk mengulang seluruh konten di blog ini, dan mengganti topik yang saya kuasai... yaitu IT. Ada keinginan juga dulu untuk me-monitize blog ini, makanya ada paid artikel. 

Tapi yah, dasarnya saya bukan penulis... Niat untuk meng-update blog ini pun sirna entah ke mana. Semua motivasi yang melandasi pun menghilang begitu saja.

Hal lain juga... waktu itu saya memutuskan to go "offline" for a while. Entah itu medsos, blog, etc. Pokoknya got vanished! Personal reason. 

I was not really offline though. Cuman nda jadi user generating content saja. 

Sekian lama "offline", saya mulai lagi eksis di jejak online di FB mungkin sekitar tahun 2014an... Kapan tepatnya? Saya lupa! Pokoknya waktu itu saya mulai ikut-ikutan menggunakan Path.

Mungkin tulisan ini akan menjadi awal saya aktif lagi di dunia maya. Mungkin... Kita lihat saja nanti. 

I am not expecting too much. Sekarang saya cuman menikmati melihat blog ini yang pertama kali saya buat dan bernostalgia jejak-jejak saya di dunia maya.

This time let's do it without trying to become too serious.

Or maybe I should start something else but useful... like investing maybe? Hmm, we'll see.

Sunday, July 3, 2016

Prepare your exam with E2Language

It's been a while since my last post, and I decided to write on this blog again. This time, I'd like to share the project that I've been involved in: www.e2language.com. As I am one of the core team members, in this post, I will refer myself as we. Oh.. and by the way, sorry... no tech related in this post :D



OK... Cut the crap! 

So what is E2Language? E2 is an online learning platform focused on English Exam preparation. At the moment, we are focusing on OET and PTE which will soon expand to IELTS and TOEFL as well. 


As an online learning platform, we tried to deliver the best and latest teaching methods to be delivered online - but you will be still guided with our highly experienced teachers. When you signing up for free (yes, totally free), you will get a complete set of General English practice test material. These materials consists of complete Grammar, Reading, Writing, and Listening lessons. Most of the materials has video lessons which will guide you through the lessons (it's really nice, simple, and easy to follow videos - guaranteed), tons of practice tests, and a "real" scored tests. The scoring is designed with gamification approach which will tease (of not motivate) you to try more, more, and more. If you dare, try to compete with the top students and get yourself listed on the top!

While for your exam preparation, we provides you the platform where you could practice as you would do on your real test. Our teachers done a very serious and deep research with this one. See this post to get the idea.

As many other online services out there, we also tried to promote ourself online via social network. Our youtube channels provides you with a lot of useful video tips that will give you secrets on how to succeed with your exam. Other sources that will benefit you too is our newly launched blog. Check this tips on how to succeed on your OET Writing exam. It will give you idea that this blog is not just a crap! :) Or maybe you are interested to see what's latest from us, just follow our Facebook page.

OK that's all for now. I will bring more updates as we go along. :)


Wednesday, July 28, 2010

Managing Assembly Version

As some of you might have known that we could manage the information about the assembly that we create through AssemblyInfo.cs (in C#) or AssemblyInfo.vb (in VB.NET). When you have a lot of assemblies within of your application, it is not an easy task to manage them, and sometimes it become annoying. Let say that you want to upgrade you version number each time you want to build them, you will face the reality that you need to change all the AssemblyInfo files within your solution. And that is a very boring thing to do.

I found these two articles which suggest us to use single file to maintain information which is generic for all assemblies within our application (such as AssemblyCompany, AssemblyVersion, etc). Very nice articles. Thanks to the writers, it helps me a lot managing my assemblies' version. You can find the articles here, and here.

Another good article is this one, which explain how to automate the process of giving version number each time we build our application. I haven't try it yet. But, it seems that it will be helpful to manage version of your application, specially if your application is quite large and following complex process (maybe involving step such as creating nightly build), which might require you to sign your assembly each time you build them.

Friday, July 23, 2010

The Killer Robot Case


Have you ever read the killer robot case? Well, just in case you don't, this is a good (and long) story about ethical scenario which occurs in a development of robot. In short, the programmer who wrote the codes for this robot, was mistakenly wrote a wrong formula which cause the robot to perform inappropriately and killed its operator. After a deep investigations held inside the company, it was found that the company also did some unethical actions which responsible direct/indirectly to the death of the operator.

Hmm, I guess you need to read it. It's a good case, believe me! You can read the story here. If you have other links for the same case, I would really thank you for sharing.

Now, the case has been assigned as a homework in one of training class that I attended. The training is about Software Quality, and one of the sub topic is about ethics related to Software Engineering. My writing below, was my answer for that homework. I shared it here, because I think it will be helpful for others who work on the same topic, not by giving them direct answer, but to better analyze the case so they can answer better than my answer. If you have worked on the same topic in the past and would like to share anything about this, I would really thank you for sharing it.

So, we were asked to identify the top 5 violation of code of ethics in this case, explain why and what should have been done instead.

And here is my answer.

Violation 1
The quality assurance division was made false claim that they said the software was successfully been tested and error free. They made a fake testing document which said that the. This violation is shown by Cindy Yardley who made fake test document as per request from Ray Johnson. Ray Johnson was also made fake claims that he used to convince Cindy Yardley, that the software is safe that no one will know the test document was a fake. This is violation for the following codes:
  1. Code number 1.06 which says “Be fair and avoid deception in all statements, particularly public ones, concerning software or related documents, methods and tools”.
  2. Code number 6.07 which says “Be accurate in stating the characteristics of software on which they work, avoiding not only false claims but also claims that might reasonably be supposed to be speculative, vacuous, deceptive, misleading, or doubtful”.
  3. Code number 6.08 which says “Take responsibility for detecting, correcting, and reporting errors in software and associated documents on which they work”.
Both Cindy Yardley and Ray Johnson should never make deceptive claim regarding the application, since it may lead to serious problem (cause death to the operator).

Violation 2
People in Techtronics never inform the operator that the software has exceptional conditions which were clearly stated in the requirements document, as stated by Ruth Whitherspoon that there are exceptional conditions written in the document section 5.2.4.26. This is violation for code number 1.04 which says “Disclose to appropriate persons or authorities any actual or potential danger to the user, the public, or the environment, that they reasonably believe to be associated with software or related documents”. According to this code, the people from Techtronics should warn the operator prior to operate the robot, and even give them appropriate training about how to act when such exceptional conditions occur.

Violation 3
Some of people involved in the project had no appropriate experience and educational backgrounds. This is a violation for the following codes:
  1. Code number 2.01 which says “Provide service in their areas of competence, being honest and forthright about any limitations of their experience and education”.
  2. Code number 3.04 which says “Ensure that they are qualified for any project on which they work or propose to work by an appropriate combination of education and training, and experience”.
  3. Code number 5.04 which says “Assign work only after taking into account appropriate contributions of education and experience tempered with a desire to further that education and experience”.
The violations were shown by the following acts:
  1. Randy Samuels has no educational background in mathematics, statistics and physics. Knowledge on those areas is needed to be able to judge that the business rules, formulas, and logics are correctly implemented within the application. It is true that Randy has experience in programming, but it doesn’t make Randy the appropriate person to judge that the code that he wrote has correct logic or not.
  2. Ray Johnson who leads the Robotic Division had no sufficient experience in software development, since his background is from manufacturing. Therefore his decision was inappropriate for example when he insisted to add developers to speed up the project which is based on his experience in manufacturing field
  3. The decision that has been made by the management to place Sam Reynolds as the project manager was also violation of the codes above, since Sam has no experience in Robotic software. Instead, Sam was previously experienced in data processing which characteristics of the projects have differences from robotic software.
To avoid the violations, the executives or managements should place people who have expertise in area of robotic programming.

Violation 4
Ray Johnson was unethically order Cindy Yardley to create fake test document by using his power as Head of Robotics Division. This action was a violation of the code of ethic since Johnson was asking his engineer to do such action that was inconsistent with the code of ethic. This is a violation for the following codes:
  1. Code number 5.11 which says “Not ask a software engineer to do anything inconsistent with this Code”.
  2. Code number 8.08 which says “Not influence others to undertake any action that involves a breach of this Code”.
According to the codes above, Johnson should never use his power to influences his staffs to do any unethical actions. He should let his engineers to work professionally based on their expertise and knowledge.

Violation 5
The project was not developed based on a realistic schedule and estimations. Both Ray Johnson and Sam Reynolds realize that it was impossible to deliver the product perfectly within the time constraint provided by the executives (1 January). However, both Johnson and Reynolds were choosing to force their engineers to do the impossible project, instead of trying to convince the executives that their time constraint given to them was inappropriate. This is violation for the following codes:
  1. Code number 3.01 which says “Strive for high quality, acceptable cost and a reasonable schedule, ensuring significant tradeoffs are clear to and accepted by the employer and the client, and are available for consideration by the user and the public”.
  2. Code number 5.05 which says “Ensure realistic quantitative estimates of cost, scheduling, personnel, quality and outcomes on any project on which they work or propose to work, and provide an uncertainty assessment of these estimates”.

Thursday, December 3, 2009

My Notes About .NET Framework


These are my notes about .NET. I wrote it here, just to review my knowledge about this framework because it's growing very fast. Sometimes, I confused whether WPF was published before the WCF or otherwise. Whether LINQ is built in the framework since it first version, etc. Nothing technical, though. I believe there are millions articles out there that can give a better explanation on specific topic than this article.

So, my notes are:
  • The .NET framework 1.0 was released by Microsoft on 10 July 2002.
  • Early .NET framework articles can be found http://msdn.microsoft.com/en-us/magazine/bb985004.aspx and http://msdn.microsoft.com/en-us/magazine/cc748671.aspx
  • The conceptual overview of the framework can be found at http://msdn.microsoft.com/en-us/library/zw4w595w.aspx.
  • .NET framework release timeline can be found at http://en.wikipedia.org/wiki/.NET_Framework#Versions, more completed list can be found at http://en.wikipedia.org/wiki/.NET_Framework_version_list
  • In .NET 3.0, Microsoft introduces four major new components WPF, WCF, WF, and Windows CardSpace.
  • Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF.
  • Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.
  • Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
  • Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.
  • In .NET 3.5, Microsoft introduces LINQ

Saturday, December 20, 2008

Reading Serial Port with C#

Couple days ago my junior in college called. He was asking about how to read data from Serial Port. He is currently working with his final project to pursue his Bachelor Degree in Electrical Engineering.

In general, his project is creating an RFID reader which can be used to read the RFID tag. The data then will be sent to a PC through RS232 Serial Port. This unique ID then will used as primary key to save data to database.

Hmm... this is a kind of a new thing for me, because I'm never done it before. To give you a better overview of the project, you may want to read these sources before continue:
Ok, let's get back to our main focus of how to read data from Serial Port.

According to MSDN, starting from .NET 2.0, there is a class which can be used to read and write data from Serial Port easily. You can read the documentation here. By using this class, working with serial port is no more a nightmare. The class make us able to work with serial port, as if we were working with file. In sort, you just need to specify the port object, instantiate it, open it, and start working with it (read or write data).

Specifically to create a port reader, SerialPort has an event which will be trigerred when there is a data being sent to the port. The event handler is called DataReceived. What you need to do is creating a method to be executed when the event raised, and attach the method with a SerialDataReceivedEventHandler delegate to the event handler. Let's look at the class that I've created, I call it PortReader class.

This class has three properties which are Name - name of the port which will be read, Error - to hold error occured during the operation (if any), and Message - to hold the message from the port.



private string _name = string.Empty;
private string _error = string.Empty;
private string _msg = string.Empty;

...

public string Name
{
get { return _name; }
set { _port.PortName = value; }
}

public string Message
{
get { return _msg; }
set { _msg = value; }
}

public string Error
{
get { return _error; }
}


You need to specify several attributes of the port such as BaudRate, Parity, DataBits, and StopBits (and other properties as necessary). In this class I specify it in the constructor.



public PortReader()
{
_port = new SerialPort();

_port.BaudRate = 9600;
_port.Parity = Parity.None;
_port.DataBits = 8;
_port.StopBits = StopBits.One;
_port.DataReceived += new SerialDataReceivedEventHandler(PortReader_SerialDataReceived);

}


You may notice that I also specify a new instance of SerialDataReceivedEventHandler which then attached to DataReceived event of the object. I also create a new event for my class which wrap the DataReceived event - EndReadEvent. The codes is as the following:



public delegate void PortReaderEventHandler();
public event PortReaderEventHandler EndReadEvent;

...

private void PortReader_SerialDataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (!_port.IsOpen)
{
_error = "Can't read. Port is closed.";
return;
}

_msg = _port.ReadExisting();

//raise end read event
if (EndReadEvent != null) EndReadEvent();

}


PortReader_SerialDataReceived is a method which is used to handle the DataReceived event. It's simply read the port data and hold it in _msg variable. The method then raise its own EndReadEvent. This will allow user to do necessary action after the read operation.

Other methods are the DoOpen and DoClose method, which are as the following:




public bool DoOpen()
{
if (_port.PortName == "")
{
_error = "Please supply port name!";
return false;
}

if (_port.IsOpen)
{
_port.Close();
}

_port.Open();
return true;
}

public bool DoClose()
{
if (!_port.IsOpen)
{
_error = "Can't close port that is not in open state.";
return false;
}

_port.Close();
return true;
}


That's it. The complete codes of this class is as the following:



public class PortReader
{
private SerialPort _port;
private string _name = string.Empty;
private string _error = string.Empty;
private string _msg = string.Empty;

public delegate void PortReaderEventHandler();
public event PortReaderEventHandler EndReadEvent;

public string Name
{
get { return _name; }
set { _port.PortName = value; }
}

public string Message
{
get { return _msg; }
set { _msg = value; }
}

public string Error
{
get { return _error; }
}

public PortReader()
{
_port = new SerialPort();

_port.BaudRate = 9600;
_port.Parity = Parity.None;
_port.DataBits = 8;
_port.StopBits = StopBits.One;
_port.DataReceived += new SerialDataReceivedEventHandler(PortReader_SerialDataReceived);

}

private void PortReader_SerialDataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (!_port.IsOpen)
{
_error = "Can't read. Port is closed.";
return;
}

_msg = _port.ReadExisting();

//raise end read event
if (EndReadEvent != null) EndReadEvent();

}

public bool DoOpen()
{
if (_port.PortName == "")
{
_error = "Please supply port name!";
return false;
}

if (_port.IsOpen)
{
_port.Close();
}

_port.Open();
return true;
}

public bool DoClose()
{
if (!_port.IsOpen)
{
_error = "Can't close port that is not in open state.";
return false;
}

_port.Close();
return true;
}

}


Now to use the class, you only need to instantiate the object, specify the port name, open the port, and specifying the action when any read event occurred. Just place your action in OnPortReader_EndRead (you may change it with your own method). A simple example may look like the following:



PortReader myPort = new PortReader();
myPort.Name = "COM1";
myPort.EndReadEvent += new PortReader.PortReaderEventHandler(OnPortReader_EndRead);
myPort.DoOpen();


To test the application you might want to use a Virtual Serial Port Emulator. I use Virtual Serial Port Emulator form Softpedia. It's a nice application - very easy to use, very helpful, and it's free. The application will allow you to create a virtual ports as many as you want up to 255 ports.

Ok, that's all. Happy playing with the port. Any input, please welcome. :D

Friday, December 5, 2008

Even Code Comments, Are Very Important!

The story was started by this email:
All,

Please, allow me to share a little bit.

I have just read the Programming Standards.doc, and I found out something interesting in the document about code comments (all of you might have known this). I have highlighted some statements that might important to be concerned when writing our codes.

You can find the complete standard in Programming Standards.doc.

... Some paragraphs has been deleted...

By reading this, I become more realized that even comments in code have a standard for our client. Overall, I think to follow this standard there is no other way except trying to follow them when writing our codes in each task (And I am still trying to do so).

Any input, please welcome.

Regards,

-imsuryawan-
Above, was my email a couple days ago to all team members about code comments. Yes, I know this is an old topics for the one who have been involved in Programming for long years. But, still... for a newcomers, this is a very good stuff to know.

I remember when I was at the first time involved in a professional team who worked as an outsourced Software Engineers for a well known company in Australia, that code comments is very important. My senior who was being my code reviewer, writes a huge bunch notes about my comments. That time I was thinking, "Man, this is just a comment. The compiler will never care about them! So, what's wrong with this?". Hahaha... Please understand, I was still a Junior SE that time. :D

Now, I am a senior programmer in a different outsourced team for the same client. After reading the Programming Standard I become more realized that event code comments are a very important thing to be concerned, so they write them in the document.

I am sorry that I can not tell you what the rules in the document are. Overall, most of the item written in the document is a common rule when writing code comment. There are so many articles on the net about how to write a good code comment. This one is a good reference for you. Other source maybe by reading Code Complete by Steve McConnel - which discussing how to create a self documenting codes in chapter 32.

So, let's start to write a good comments in our codes. :D

Tuesday, September 23, 2008

Hello Again!

Huah... after couple months of hiatus, now I'm back. Yeap... It has been a busy months lately. Some personal stuffs has made me busy. And ofcourse, the project is getting crazy.

Yeah, whatever!

Btw, I just want to update my blog. No particular topic in this post. Because I was too busy to write an article. hahaha... I know, you may call it lazy. Hehehe... It's tight related each other, though!

Btw, I was starting to use Linux again. I used to use Fedora last year. But, Fedora is not for a newbie like me - because to many things to do to make it works as smooth as W*****s, so I uninstalled it from my PC! After searching for several opinions from internet, most of the review told me to use Ubuntu! So, this Ubuntu thing is in my PC right now!

Oh yeah! About my project, I'm learning new thing right now. It's called Service Oriented Architecture. This thing has made me so busy for a couple of week. I hope I can write something about this architecture lately. Just ask uncle Google if you want to know about this stuff. I guess this link is a good start! Just check it out.

Allright then! Enough for now... Hello again all!

Saturday, June 14, 2008

For Delphi's Scanline Property, in .NET We Use LockBits

When I was in college, I used Delphi to do my assignment in Digital Image Processing subject. No particular reason though. It just because Delphi is the most popular tools to be used when working with image manipulation. My senior told me that those tools are quite good to use, because we can do an image manipulation in bit level and accessing the pointer. Since Delphi using Pascal as the core language, and Pascal do support pointer, I think the statement is right. CMIIW.

The most important one is that Delphi has a very powerful method to work with image. The method called Scanline. For a brief explanation of this method, just read it here.

Once, a friend asked me about how to implement Delphi's ScanLine when working in .NET. Hmm... that's new to me. As far as I now, there is no such method which have same ability with
Delphi's ScanLine. Common methods used to work with Image (specifically Bitmap) is Bitmap.GetPixel and Bitmap.SetPixel method. But these methods are extremely slow to be used when working with a huge image.

After browsing through uncle Google for a while, I found out that there is a method which can be used when we want to work directly accessing image data in memory. The method is Lockbits. Please refer to this article for the explanation. The writer has just explain the method in very detail and good way, so I believe you'll understand quickly.

Here is an example to do a Grayscale operation with
Bitmap.GetPixel and Bitmap.SetPixel method.


///
/// Grayscale method
///

public void Grayscale()
{
int width = _bmp.Size.Width;
int height = _bmp.Size.Height;

for (int heightIdx = 0; heightIdx < height; heightIdx++)
{
for (int widthIdx = 0; widthIdx < width; widthIdx++)
{
Color objImgColor;
objImgColor = _bmp.GetPixel(widthIdx, heightIdx);

int grayScaleBase = (int)((objImgColor.R + objImgColor.G + objImgColor.B) / 3);
Color grayScaleColor;
grayScaleColor = Color.FromArgb(grayScaleBase, grayScaleBase, grayScaleBase);

_bmp.SetPixel(widthIdx, heightIdx, grayScaleColor);
}
}
}



When woring with a large image, the method above is extremely slow. Just try it If you don't believe me. And here is how we implement Lockbits method to do a Grayscale operation on image.


///
/// Grayscale method by using pointer access
///

public void SpeedGrayscale()
{

// Specify width, height, anf pixel format
int imgWidth = _bmp.Width;
int imgHeight = _bmp.Height;
PixelFormat imgPixFormat = _bmp.PixelFormat;

// Create BitmapData and Rectangle object, which will be used
// in Lockbits method
BitmapData bmpData = null;
Rectangle rct = new Rectangle(0, 0, imgWidth, imgHeight);

try
{
// We use unsafe keyword, because this is a pointer operation
unsafe
{

//Lockbits = lock bitmap data to memory
bmpData = _bmp.LockBits(rct, ImageLockMode.ReadWrite, imgPixFormat);

byte* row; // Pointer for a bitmap row
byte* rowElement; // Pointer for a pixel
int intGrayscaleValue; // grayscale value for one pixel

// Loop based on image height (y)
for (int y = 0; y < bmpData.Height; y++)
{
// Find starting memory pointer address for each row
row = (byte*)bmpData.Scan0 + (y * bmpData.Stride);

// Loop through the row (x)
for (int x = 0; x < bmpData.Width; x++)
{
rowElement = row + (x * 3); // find the pixel pointer address

intGrayscaleValue = (rowElement[0] + rowElement[1] + rowElement[2]) / 3;

// assign grayscale value for each pixel element
rowElement[0] = (byte)intGrayscaleValue;
rowElement[1] = (byte)intGrayscaleValue;
rowElement[2] = (byte)intGrayscaleValue;
}
}

// Unlock the bitmap from memory
_bmp.UnlockBits(bmpData);
}

}
catch (Exception ex)
{
throw ex;
}
}

Friday, May 16, 2008

Other Old Articles Written By Me

It's been almost a month, and I haven't updated this blog yet. Huh! There was a busy month. A lot of work in the office with a huge bunch of tasks with complex specification.

Btw, I just want to share links from my primary blog. Yeah! I have written some articles, and putted in my primary blog. Nothing important, but they might helpful for some of you. The articles are:
I wrote those articles when I was in Induction Training. The topics may not interest you but, for some people who are really need it, I believe it can give a brighter light. Hopefully! hehehe...

So please enjoy.