App.config content CAN disappear :)

Posted on : 23-06-2009 | By : andrej | In : .NET

0

Saving useful information to config file is cool. Doing that during runtime is even cooler. If that information suddendly disappears isn’t cool at all.

 

I was saving some data to configuration file (app.config) at runtime. Visual studio copied app.config file before application runs to Debug folder (or any other folder if you want to, i used default settings for my Debug build), then renamed it to my_application_name.vshost.exe.config. It did that because that’s what it does to config file, when running application it copies it to running folder, then renames it according to pattern application_name.application_extension.config.

 

As you can see, there is also string vshost in my configuration name, that is because i was running it in visual studio using debugger. So i wasn’t running file my_application_name.exe but instead visual studio ran file my_application_name.vshost.exe. So my config was written in my_application_name.vshost.exe.config file. Nothing wrong with that.

 

The funny thing is that after i closed my application all data from my config file disappeared. Well almost all of my data. Data included in my App.config file remained, so actually only data entered in config at runtime disappeared. What i figured out when trying to solve this problem is that vshost config file gets copied from normal application config file (my_application.exe.config) ! Because my_application.exe.config was exact copy of App.config file it seemed as if my runtime settings disappeared.

 

The solution to this problem is that you have to right click in Visual studio on project name, then click properties and in Debug tab remove setting Enable Visual studio hosting process. Then run application and this time it will put settings to application_name.extension.config file. When you close application, settings will not disappear. Then if you want to use debugger, turn EnableVisual studio hosting process settings back on and settings you entered when hosting process was turned on will remain in file (vshost config file).

 

And that can be useful piece of information to have if you are trying to save something to configuration file at runtime if you’re using Visual studio and trying to figure out why your precious configuration data is disappearing all over the place. :)

Hard drive making funny noises?!?

Posted on : 05-06-2009 | By : andrej | In : Linux

0

I have been using Linux on my laptop for quite a while. Sure, i had to adjust all sort of things to make it behave the way i wanted, but after i spent some time doing adjustments i was very happy with its performance. But there is one thing that annoyed me the most when i first installed linux on my laptop. Clicking noises. :)

Yes, clicking noises. The moment i installed latest version Ubuntu on my laptop, i heard my hard drive was making clicking noises which didn’t sound very healthy for it. That happened every 5 seconds or so. Later on I discovered other versions of Ubuntu and even other Linux distributions had same problem. I’ve looked everywhere but all the guys on forums were answering to people with similar hard drive problems something like: “Your hard drive is failing! Replace hardware! Buy new stuff! Spend money on stuff because it HAS to be a hardware problem!”.

But i knew my hard drive was almost brand new! Hardware failure, yeah right! :)

So after quite a lot of research i finally found some useful forum posts that helped me fix my ‘bad hardware problem’.

I put the following commands in my rc.local file:

sudo hdparm -B 254 /dev/sda

and some people suggested the following command which might work for you:

sudo hdparm -B 255 /dev/sda

One of these two commands should cause that your drive will never be spun down. Of course you must realize that head parking protects your computer from any possible bumps while you’re on the road, but my work environment is usually not bumpy so it wasn’t the problem for me. Computer also doesn’t save as much battery power if drive doesn’t spin down but my computer is usually connected to power anyway, i just don’t want that horrible clicking doing possible bad things to my hard drive.

Still, USE THIS WORKAROUND AT YOUR OWN RISK!

After i made these adjustments i didn’t experience abnormal hard drive clicking anymore and computer was very happy (and it still is) for quite a while. :)

Hello world!

Posted on : 23-03-2009 | By : andrej | In : Blubit

0

New blubit’s blog is now online! Yeey! :)