10 March, 2011

Our gadgets and their before-bed bad effects

Salem3Image by rabbit57i via FlickrGot this article from CNet news. It is about the negative impact of our gadget-using, especially before going to bed.

Read on.
-----
March 7, 2011

If you're having trouble getting a solid night's sleep, the blame may rest on all the gadgets you're using.

A whopping 95 percent of Americans use some kind of technology an hour before they go to sleep, the National Sleep Foundation found in a poll released today. The organization said Americans are turning on their televisions, mobile phones, computers, or video game devices before bed "at least a few nights a week."

The problem: using technology before bed can negatively affect a person's ability to fall asleep and to get the amount of sleep they need.

"Artificial light exposure between dusk and the time we go to bed at night suppresses release of the sleep-promoting hormone melatonin, enhances alertness and shifts circadian rhythms to a later hour--making it more difficult to fall asleep," Dr. Charles Czeisler, a professor at Harvard Medical School, said in a statement. "This study reveals that light-emitting screens are in heavy use within the pivotal hour before sleep."

When it comes to television before bed, age is a distinguishing factor. The National Sleep Foundation said that 67 percent of baby boomers watch TV every night or nearly every night an hour before they try to sleep, while 63 percent of Generation X folks do the same. Half of all people between the ages of 13 and 18, also known as Generation Z, watch television every night, while 49 percent of Generation Y--folks between 19 and 29--say they flick on their set.

With other devices, however, Generation Y and Generation Z lead the way.

The National Sleep Foundation found that 61 percent of Americans use a laptop or computer an hour before they go to bed. Generation Z and Generation Y were most likely to engage in that activity with 55 percent and 47 percent of people in those groups saying they use a computer before bed, respectively. Generation Z and Generation Y members are nearly twice as likely as baby boomers to play a video game an hour before trying to go to sleep, the organization said.

The National Sleep Foundation also examined mobile-phone use before bed. And not surprisingly, 56 percent of Generation Z users and 42 percent of Generation Y respondents send or receive text messages an hour before going to sleep. Just 15 percent of Generation X and 5 percent of baby boomers do the same.

Use of technology prior to bed can affect more than just sleep, researchers say.

Lauren Hale, an assistant professor at Stony Brook University Medical Center, said that the "higher use of these potentially more sleep-disruptive technologies among younger generations may have serious consequences for physical health, cognitive development and other measures of well being."

Hale's comments follow a study released in The Journal of Clinical Endocrinology & Metabolism in January that found light at night can cause high blood pressure and diabetes. Even more disconcerting, a study released last year by the University of Haifa found that light at night can increase cancer risks, as well.

"Exposure to LAN (light at night) disrupts our biological clock and affects the cyclical rhythm that has developed over hundreds of millions of evolutionary years that were devoid of LAN," researchers at the University of Haifa said at the time. "Light pollution as an environmental problem is gaining awareness around the world, and the World Health Organization...has already classified working the night shift as a higher grade of cancer risk."


Taken from below article:
All that tech is hurting your sleep, researchers say


Enhanced by Zemanta

09 March, 2011

String to StringBuilder conversion - a pitfall

If you've known that the way to go is by using StringBuilder instead of String, due to its memory use advantage, beware.

The coder's ease in using String isn't quite as straightforward when it comes to StringBuilder.

Below is one example where the code change is non-glaring, but the impact can be disastrous.


    Dim myStringBfr As String = ""

    myStringBfr += ""
    myStringBfr += "Some text to go here. "
    myStringBfr += "Some more text to go here. "
    myStringBfr += "Final text string to be added goes here. " & vbCrLf
    myStringBfr = myStringBfr + " - string concatenation ends here - "

    Console.WriteLine()

    Console.WriteLine(myStringBfr)


Common conversion happens this way (at least for my case)
  1. Change in declaration
  2. Change in assignments
  3. Change in method calls

    Dim myStringBldrBfr As New StringBuilder

    myStringBldrBfr.Append("")
    myStringBldrBfr.Append("Some text to go here. ")
    myStringBldrBfr.Append("Some more text to go here. ")
    myStringBldrBfr.Append("Final text string to be added goes here. ").AppendLine()
    myStringBldrBfr.Append(myStringBldrBfr).Append(" - string concatenation ends here - ")

    Console.WriteLine()

    Console.WriteLine(myStringBldrBfr.ToString())
    'Console.WriteLine(myStringBldrBfr) also works


When you try to run this very simple demo by creating a console application and typing in these few lines, the output will be like below:


"
Some text to go here. Some more text to go here. Final text string to be added goes here.
 - string concatenation ends here -

Some text to go here. Some more text to go here. Final text string to be added goes here.
Some text to go here. Some more text to go here. Final text string to be added goes here.
 - string concatenation ends here -
Press any key to continue . . .
"

Suggestions:

Avoid the Double Append call:
myStringBldrBfr.Append(myStringBldrBfr).Append("...
should be written as
myStringBldrBfr.Append("...

Reset or initialize the StringBuilder var
Instead of doing myStringBldrBfr.Append(""), set the length to zero.
myStringBldrBfr.Length = 0

As much as possible, define and use a local-scope variable. when it cannot be avoided, or that the overall impact of using StringBuilder is significant, then define and use a global-scope var.

This is especially true if you are using your SB var in a loop. Make sure that once the SB var is used, set the length to zero (0) to clear its contents, or the value is simply carried over and over again, the impact of which who knows?


Below is the corrected code, and the output is the same as when you used String:


    Dim myStringBldrBfrFin As New StringBuilder

    myStringBldrBfrFin.Append("Some text to go here. ")
    myStringBldrBfrFin.Append("Some more text to go here. ")
    myStringBldrBfrFin.Append("Final text string to be added goes here. ").AppendLine()
    myStringBldrBfrFin.Append(" - string concatenation ends here - ")

    Console.WriteLine()

    Console.WriteLine(myStringBldrBfrFin.ToString())
    myStringBldrBfrFin.Length = 0



Hope this code nugget is of help to those who need it most.
Till then!


Enhanced by Zemanta

03 March, 2011

Speed up your PC by turning off indexing

I always experience a slowness in my PC when it is booting up, and right after that. The other issue that I notice is that the CPU fan is making noise, and having known my PC (at work) for quite some time, I am sure that it is due to some increase in CPU activity.

That made me check, not one time only, but every time the fan starts to blow, and make noise. (Actually that is the reason why I didn't stop looking, otherwise, I would have just let it go on as is). This went on for days; days became months... until I couldn't sit and ignore it anymore.

Having disabled most of those accessories already, it is getting on my nerve and driving me nuts!

Simple Computer Tune-up: Speed Up Your PCThen today, I searched in the web on how to permanently disable the indexing service in Windows. This week I have been manually disabling the service, and I did notice that the fan died down, which indicated a decrease in CPU activity (so it doesn't get hot, and there is no need for the blower fan).

I did find some easy solutions. Below are three, but before you click and do (if you need to do it), consider these:

1. There are 3 places that needs checking: Startup folder, Windows services and Hard Drive settings.
2. The hard drive settings, if you are going to uncheck "Allow indexing ..." tickbox, will take some time.
3. The hard drive tickbox unchecking applies to all hard drives, so if you have many, grab some biscuits and a cup (or two) of coffee or tea, or whatever beverage you like.


Seagate FreeAgent 750 GB USB 2.0 Desktop External Hard Drive ST307504FDA1E1-RKStartup Folder
  1. Click [Start] > [All Programs] > [Startup] folder
  2. If "Indexing Service " is inside, right-click on it, and choose Delete

Windows Services
  1. Click [Start] > [Run]
  2. Type "services.msc"
  3. Look for "Indexing Service"
  4. If Status is Started, then right-click on it to select "Stop"
  5. Check that the Startup Type is either Manual or Disabled (right-click to select Properties to change)

Hard Drive indexing Service

  1. Open up Windows Explorer (fast one is to right-click on [Start] button, then Explore.
  2. At [My Computer] node, right-click on C:, then Properties.
  3. Uncheck the tickbox for "Allow Indexing Service...", then click OK.
  4. Do this for all the other hard drives you have.

Stellar Speed up Mac - An excellent utility to Speed up Mac Performance by cleaning up unwanted data from your Mac driveAs earlier said, this 3rd step will take time, so find something else to do while this is running, and just go back now and then to check on the progress.


References:
Turn off indexing and speed up Windows XP
Turn Off and Disable Search Indexing Service in Windows XP
Disable / Delete SearchIndexer.exe | Stop Windows Enhanced Search In Windows Vista and XP


Till then, and hope this helps you, as it did me.
Au revoir!



Enhanced by Zemanta