Black flicker on form when changing opacity to make fade-in/fade-out

This problem occurs in a Windows form, when you are trying to do fade-out/fade-in say on mouseLeave mouseEnter , sometimes the form display a brief black flicker, even though you set doublebuffer to true, the black flicker continues.

Language Platform: C#,VB, C++ ..etc

Main:

The solution to try is to never let the opacity level reach 1 (100%), make it stop at (99%) or (0.99d, same thing). If still there are some flickers, make sure you set doublebuffer = true.

How to binary serialize an object such as Font and store it in Windows Registry then deserialize it in C#

Smart Notepad App (At least smarter than some unnamed notepads)Say you want to make a notepad like application, and you want to let the user choose the default font for the text and that should be remembered each time the user open the app. The solution is instead of saving each font property, you save the whole class object. But you need to serialize the class using Binary in order to be able to store it in Windows Registry.

Below is the class that create registry keys, and can save and serialize a font object, and deserialize it back again using IFormatter.Serialize, IFormatter.Deserialize and MemoryStream.

Main:

For C# (C-Sharp)

The registry class


using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using System.Drawing; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; class winreg { private RegistryKey prgReg; private RegistryKey recentReg; public winreg() { RegistryKey reg = Registry.CurrentUser.OpenSubKey(“software”, true); RegistryKey regMilky = reg.CreateSubKey(“MyBrand”); prgReg = regMilky.CreateSubKey(“MySoftware”); } public void save_font(Font fnt) { RegistryKey fntReg = prgReg.CreateSubKey(“Font”); IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); formatter.Serialize(stream,fnt); stream.Flush(); byte[] buffer = new byte[stream.Length]; stream.Seek(0, SeekOrigin.Begin); stream.Read(buffer, 0, (int)stream.Length); stream.Close(); fntReg.SetValue(“FontInfo”, buffer,RegistryValueKind.Binary); } public bool get_font(ref Font fnt) { RegistryKey fntReg = prgReg.CreateSubKey(“Font”); if (fntReg.GetValue(“FontInfo”) != null) { byte[] buffer = (byte[])fntReg.GetValue(“FontInfo”); IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(buffer); fnt = (Font)formatter.Deserialize(stream); stream.Close(); return true; }else return false; } }

Below is how to use the above class.


winreg WinRegClass = new winreg(); Font fnt = MyTextBox.Font; if (WinRegClass.get_font(ref fnt)!=false) { MyTextBox.Font = fnt; }

This is not a fine work. I’m still practicing C#, so, don’t judge (; Yesterday I wanted to play a DOS game using DosBox, but somehow ended up practicing more C#. You see: Games=useful.

Why Dreamweaver cannot show .htaccess and other hidden files?

Actually yes, it can. .htaccess files normally hidden as default, Dreamweaver 8 does not display hidden files as default as well. I needed to look around for quite sometime until I found it. So to save trouble for people in a similar situation, here is how to make Dreamweaver 8 display hidden files.

Main:

How to Show .htaccess & other hidden files in DreamweaverIn the “Files” area where you can manage your files, Look at the title where it is written Files beside the collapsing arrow, on the other side of this bar, there is a small icon with a tiny arrow, click that, you get a menu, hover on view, then you ll see “Show Hidden Files”, check it, and now you ll see htaccess files and other hidden files.

You can do this in Remote view or local view, however, if you change it in local view and you were already connected to the server, you ll need to refresh the view in remote view. But if you change it in Remote View , it will refresh automatically.

Google Toolbar’s new tab feature on Firefox too slow/freeze problem due to a conflict

After I installed Google’s toolbar 5.0 and I tried the chrome’s new tab feature on Firefox 3.0 , I encountered a problem. When I open a new tab, it loads fine, though Firefox freezes for couple of seconds afterward. After investigating what’s happening, I noticed that Alexa Sparky plugin is trying to get the statistics for the page, and as a result Firefox freezes.

I looked at the javascripts of Alexa Firefox plugin, I found that the problem is that Alexa trying to get the host of Google-toolbar, since there is no such host, it takes extra seconds to realize that which leads to freezing.

Probably Alexa would fix this Alexa-Google toolbar conflict soon when they realize it, while then I did the following solution:

Main:

0-ANY OF THESE STEPS ON YOUR RISK, OF COURSE (;

1-On your computer browse to:
C:\Documents and Settings\YOUR CURRENT COMPUTER USERNAME\Application Data\Mozilla\Firefox\Profiles\SOME CODE.default\extensions\toolbar@alexa.com\content

2-Find the file overlay.js , backup the file just in case.

3-Edit the original file with notepad or any ASCII non-BOM editor. (If you are newbie and not sure about that, use notepad)

4-Find the following lines:


isIntranet: function(host) { try

Before “try” and AFTER {

adds the following line:


if (host==”google-toolbar”){ return true;}

So after you did that, it should look like this:


isIntranet: function(host) { if (host==”google-toolbar”){ return true;} try

5-Now save the changes, and exit Firefox, then open it again .

6-The problem should be solved now, enjoy the new tabs without hassles.

How to extend login session to PhpMyAdmin and prevent time out

As part of my work, I often use PhpMyAdmin, though after I use PhpMyAdmin, I do some work on the script, then I return to PhpMyAdmin to add some SQL, and then I get the session has expired message, and I lose the changes. It is so frustrating. The best thing is to edit the configurations and extend the login cookie session if you have access to the PhpMyAdmin scripts on the server.

Main:

Navigate to PhpMyAdmin root directory and find config.inc.php , edit the file, then search in the file for “LoginCookieValidity”, if you found one, change the value after the equal sign to the amount of SECONDS for the session to last. if you didn’t find it, then add the following line after any $cfg line, in a separate blank line:


$cfg[‘LoginCookieValidity’]=60 * 60 * 10;

Obviously 60 seconds , 60 minutes , 10 hours . or you can make the value : 3600 * 10 , or 36000 seconds .

If you have no access to PhpMyAdmin scripts, then you have to live with it unfortunately, but what can you do to avoid losing your current page after leaving it for some minutes, right click on any non-dangerous link (; in PhpMyAdmin page and open it in new page, in that new page, enter your username and password, then return to your current page, sometimes though especially when your current page before expiration is insert page with some data, what you do then is just copy paste the data into your fresh login.