Posts

Showing posts from March, 2016

Why use hexadecimal values for computer ?

Let's look at the evolution of the human numbering systems : humans tried base 13, base 11, base 4, base 3, Oh man ! you name it ... until the Hindu-Arabic numbering system BASE 10 was invented. It made everything much easier, from business transactions to handling all sorts of daily interactions including numbers ... Because, we have 10 fingers :) -  Tolga Soyata · University of Rochester How about computers ? It is very clear where the BINARY numbering came from: BASE 2 is the natural representation for CPUs ... TRUE or FALSE, the most NOISE TOLERANT numbering system, which is necessary when you are working at 4GHz, and flipping billions of these BITS a second, and you do not want to mistake a 0 for 1. Any higher base system, Base 16 (i.e., hexadecimal), and BASE 256 (BYTE) is a natural expansion of BINARY by using MULTIPLE BINARY bits ...     Your question translates to : WHY DID WE INITIALLY CHOOSE TO GROUP 4-BITS ... In other words, why not 5 bits ? 5 bits would be much bet

First question post in StackOverflow and still alive it

When setting a form's opacity should I use a decimal or double? I want to use a track-bar to change a form's opacity. This is my code: decimal trans = trackBar1.Value / 5000; this.Opacity = trans; When I try to build it, I get this error:     Cannot implicitly convert type 'decimal' to 'double'. I tried making trans a double, but then the control doesn't work. This code has worked fine for me in VB.NET in the past. Answer An explicit cast to double isn't necessary. double trans = (double)trackBar1.Value / 5000.0; Identifying the constant as 5000.0 (or as 5000d) is sufficient: double trans = trackBar1.Value / 5000.0; double trans = trackBar1.Value / 5000d;  Url http://stackoverflow.com/questions/4/

Hide and Show Process in C# using pInvoke

using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Forms; namespace TeamViwerHide {     public partial class frmProcessOp : Form     {         public frmProcessOp()         {             InitializeComponent();         }         [DllImport("User32")]         private static extern int ShowWindow(int hwnd, int nCmdShow);         private void frmProcessOp_Load(object sender, EventArgs e)         {             Process[] proc = Process.GetProcesses();             List<ComboboxItem> items = new List<ComboboxItem>();             foreach (Process p in proc)             {                               try                 {                                      ComboboxItem item = new ComboboxItem();                     item.Text = p.ProcessName + @"\" + p.Id + @"\" + p.SessionId;                     item.Value = p.MainWindowHandle;