29 March, 2011

ODP .NET installation

DLL IconImage via WikipediaI have tried my installation of the different versions of ODP .NET.

You see, I am developing applications using VS 2005, VS 2008 and finally, VS 2010.

And with much of the developments in the Oracle world, with regard to database access, I am keen to try out ODP .NET, especially since I caught the selling point where it says that ODP will be much faster, more efficient. Not to mention that MS oracle library is already deprecated, and will be gone soon.

From OTN, I am able to see that they have installer files for Ora9, Ora10, and Ora11.

I gladly downloaded all 3, and started installing.

Actually, I used the latest file, and it was to my shock!

My applications couldn't run...

As quickly as I installed, I uninstalled ODP .NET for Oracle 11i.

And fortunate enough, my applications were able to run again (like they did recover from an initial shock)!

-----

Pro ODP.NET for Oracle Database 11g (Expert's Voice in Oracle)That was about 2 days ago.

Today, as is normally my case, I cannot rest until I make things running, or I am able to "see" what is waiting, what's in store.

So after the first setback, I wanted to try again, but this time, I worked on the earlier version - Ora9.

I installed, and rebooted, and voila! It worked. My applications were running.

And sort of being able to land first base, I didn't get contented. (Sometimes I understand why the saying 'curiosity killed the cat').

I continued to install the other 2 ODP .NET softwares (ora10g, Ora11i). You see, I was able to add in as a Reference in my VS 2005 apps the dll file (Oracle, DataAccess) - ONLY. When I tried adding the reference dll file in my VS 2010 apps, I can't find it. So I proceeded to install the higher versions with the hope that I will be able to call ODP in my VS 2010 applications.

Guess what happened?

After installing, I performed a reboot.

ODP.NET Developer's Guide: Oracle Database 10g Development with Visual Studio 2005 and the Oracle Data Provider for .NET: A practical guide for ... Oracle Developer Tools for Visual Studio 2005I called up my VS 2005 editor, and tried to run one of my apps, and it didn't run! The same error message was thrown out, and the same rootcause was found: some initialization files cannot be 'read'.

I tried to compose myself, and decided to do troubleshooting.

I checked the installation folder, and I did see what changed: C:\oracle folder now has a new folder added: product folder. And inside, there are 2 more folders: \10.1.0 and \10.2.0. I compared the structure of my current \ora90 folder with the new folders, and I found that they both have the \network\admin folders.

Being the lazy troubleshooter that I am, I thought of simply copying over the sqlnet and tnsnames files into the new folders, and see if that would solve the problem.

I did just that. I copied the 2 files form the current \network\admin folder, and renamed the sqlnet files in the two new folders as sqlnet_old, then copied the files over.

Did that solve the problem?

You bet it did!

Pro .NET Oracle ProgrammingAfter that quick no-brainer troubleshooting adventure, I proceeded to see if I can call up Oracle.DataAccess dll file in my VS 2010 applications. I opened up one app, and tried to add a reference, and there it was: Oracle.DataAccess, bright and clear, ready for the taking. I did just that.

And one or two steps on, I hit another problem, but I'm past the installation and addition of the ODP .NET library/namespace in my VS 2005 and VS 2010 apps. It's the code-building issues now.

And so, with that short narrative of mine on my ODP .NET adventure, I hope that it will be of help to you who is going in the same direction as me.

Will I hear from you?

Till then!
Enhanced by Zemanta

28 March, 2011

On to Silverlight and Ajax

Microsoft Silverlight 4 For DummiesI have began my journey to learning Silverlight and Ajax. I have completed my first books, Microsoft Silverlight 4 for Dummies and Bulletproof Ajax, aside from the books that I have got from my official course (2957B and 6463A).

I am glad that I came to read Bulletproof Ajax first, since it presents Ajax in a very general scope, and the while the book presents a lot of examples that accompanies the topic at hand, it isn't structured in a way that it immediately does into details. It gives you a view of the mountains and the path up ahead before taking the first step into the woods.

As for the other book, MS Silverlight 4 for Dummies, it is immediately dealing with examples while explaining the concepts, so that you do immediately while reading. This isn't totally bad, as many learners would want to do it immediately, running before walking.

Bulletproof Ajax 1st (first) edition Text OnlyWith these 2 books completed, I've grabbed a few others that will continue my learning of Silverlight and Ajax, what I believe to be the future of web programming.

And not to mention, I am new to the world of web, being a Windows application developer. I am sure that this will be a long and exciting journey.

Travel with me!
Enhanced by Zemanta

Firefox 4 out!

10 days after IE9 came out, Firefox 4 was released. And FF is on the heel of IE, closing in the competition.

Is there any significance to the version difference (5)? It's a trivial issue, I say, or is it?
-----

Posted: 24 March 2011

A screen displays the logo of the open-source web browser Firefox. (AFP/File/Leon Neal)
SAN FRANCISCO - A fast, sleek new version of Firefox was released on Wednesday to vie with Microsoft's Internet Explorer 9 (IE9) and Google Chrome in the fiercely competitive market for Web browsing software.

Non-profit group Mozilla made Firefox 4 available as a free download to computers powered by Windows, Mac OS X or Linux operating systems in more than 80 languages.

Firefox 4 was billed as six times faster than its predecessor and boasted features including a "Do Not Track" signal to opt-out of having online activities recorded by websites for targeted online ads or services.

The open-source Web browsing software was also designed as a stage for rich video or game graphics based on the HTML5 standard being touted as a boon for online visual experiences.

"Firefox puts users in control of their Web experience, providing a streamlined user interface, fun new features, a boost in speed and support for modern Web technologies," Mozilla said in an online message.

Powerful new versions of Chrome and IE9 Web browsers were released earlier this month by Google and Microsoft, respectively, putting pressure on California based Mozilla to release a finished version of Firefox 4.

Microsoft's Internet Explorer is the most widely used Web browser in the United States followed by Firefox, Chrome and Apple's Safari.

- AFP/ir


Taken from ChannelNewsAsia.com; source article is below:
Mozilla unleashes sleek new Firefox Web browser



Enhanced by Zemanta

Full-time blogging these days

Monkeys BloggingImage via WikipediaI am a blogger, but not intensely, nor full-time. I pick some news here, and some articles there, and pick out my likings. I don't say the rest don't matter, but I have to be selective so I don't (completely) spam, and I don't clutter.

I saw this article last week, and today, when I came to look for it, 'twas already archived. I'm still taking it, for record purposes. Perhaps that will be my pasttime in the future years to come, who knows?
-----

Vimita Mohandas
26 Mar 2011
 
SINGAPORE: Singapore has an estimated 100,000 bloggers, with about half of them registered with blog advertising community, Nuffnang Singapore.

Social media experts said this number is set to rise and more will turn blogging into a full-time career.
Nuffnang said top bloggers can earn up to S$5,000 a month, depending on factors like blog demand and editorial content. Other factors include the blogger's style of writing and blog readership.

Most influential bloggers get about one or two ads a month. And as manager of their blogs, Nuffnang limits the number of ads so that blogs do no get over-commercialised.

But with the lure of money, what safeguards are there to ensure young bloggers do not compromise on their reputation in the blogosphere?

Well-known blog Monoxious.com was created by best friends Dawn and Arissa as a hobby in 2009. Their blog, which caters to teens and young working adults, got only seven unique hits a day when it first started.

However, after gaining recognition from blog awards, it now sees close to 1,000 unique hits a day.

Their fashion-centric blog is among a growing trend of niche blogs.

"Last time a lot of people blog to focus on their lifestyle, like what they did today. But now blogs are more inclined towards niche blogs and it has to be focused on few things like travel, food or fashion and beauty. And I think these niche blogs have more potential to expand than personal blogs do," said Dawn.

Like them, there is a growing number of bloggers who get paid for writing brand reviews or advertorials. This as more brands are recognising the power of influence online, and also the lower advertising costs compared to traditional media.

With such monetary gains, one social media expert said more should be done in schools to educate young bloggers on its pitfalls.

Pat Law, a social media blogger and expert, said: "To begin with, it should come from fellow bloggers to other bloggers. We can start by making it known or having events where you talk about our experience as bloggers. We should have at least a module on social media, why there are some things you should not say or can you bear the consequences if you say what you want to say.

"So if there aren't any educational programmes catered to the very fundamental fact that we are dabbling in social media, it's about time."

Nuffnang said it has about 50 bloggers who have signed contracts with them and those below 18 years must have a parent present to attend meetings regarding the contract.

The parent also has to sign the contract on his/her child's behalf. The terms are explained very clearly to both parent and child to ensure they understand and there is a grace period where they can take the contract home to discuss or consult a third party.

Meanwhile, as a content regulator, the Media Development Authority (MDA) said its policies are aimed at safeguarding public interest, increasing media choices and enabling informed decisions by consumers.

It looks out for content that touches on broad areas like "national interest" and "racial and religious harmony", as well as specific areas such as violence, language, sex and drug scenes.

-CNA/ac


Taken from ChannelNewsAsia.com; source article is below:
More bloggers going full-time

Enhanced by Zemanta

Microsoft's IE9 officially out

Been trying out the use of the IE9 browser while it was in beta, and I say that some times, I like it, and at other times, I don't. A lot of factors, one will immediately say.

Tell it to users!

As a programmer, I know what it is being both a user and a developer, complaining about the work of others when they aren't satisfactory, and quickly defending (and absolving) mine when questioned.

Anyway, IE9 experience while it was in beta is varied and mixed. Will that change now that it is officially released?
-----

By Rachel Kelly | Posted: 14 March 2011

SINGAPORE: Microsoft has officially launched the much-anticipated Windows Internet Explorer 9.

A Web browser that allows you to unlock a PC's processing power -- almost 90 percent of which previously went untapped.

That's what Microsoft is striving to do with its latest Internet Explorer.

The idea is to allow the browser to make optimal use of your PC's processing power without the use of plug-ins such as the Adobe Flash Player.

Microsoft says that the beta version of the product is already Microsoft's more-downloaded beta browser of all time.

And the product is free for consumers.

Microsoft's chief marketing officer for consumer and online division (Asia Pacific), Haresh Khoobchandani, said: "Currently, Internet Explorer's overall (market) share is about 72.7% across Asia....we believe this will continue to grow through IE9.

"Windows 7 will be a big driver of that as we start to see more and more people deploy and upgrade to Windows 7, and as more and more Asians go online and ask for a more secure browser and one that is fast, simple, intuitive and immersive. We do expect IE9 will grow on that for all our consumers."

Some digital marketing agencies welcome the move and say it will help to boost speeds and experience.

"It's great for us and Web agencies and people working in the online area because we can create much more immersive experiences that are better for the end customers. At the end of the day, one of the problems is that Web isn't close to real life experience," said Christer Eriksson, regional strategy director at The Upper Storey.

Analysts welcome IE9's launch, saying it is a more competitive response to newer market entrants such as Firefox.

"This is more of a competitive response to some heavy users of the Internet preferring browsers like Firefox more than IE. The multi-threading capability will definitely improve performance. HTML5 will improve video access (and this is important) since video is close to 65% of Internet traffic...," said Jayesh Easwaramony, director of ICT practice at Frost and Sullivan.

Going forward, experts say competition in the browser market is healthy since the user experience is evolving due to the proliferation of tablets and video content over the internet.

- CNA/ir


Taken from ChannelnewsAsia.com; source article is below:
Microsoft's Windows IE 9 officially launched



Enhanced by Zemanta

24 March, 2011

Force termination of Apps; unable to load installer (.vdproj) file in .NET IDE

Image representing Microsoft Silverlight as de...Image via CrunchBaseI encountered some problems with my applications today, and searched the web for help.

> I saw one article (I quickly closed, so I am unable to reference it here) that instructed the single-line code:

Application.Exit()
Environment.Exit(0)

Application.Exit() is used when you are running a WinForms app.
Environment.Exit() is used when you are running a Console app.

If you need the values to be supplied with the method call, these are below, by standard:

0 - Success
1 - InvalidLogin
2 - InvalidFilename
10 - UnknownError


-----

The other problem I encountered on one development machine, not just today, but a few days back, and also today, is the problem of the .NET IDE not loading the installer project. And this only happens in one machine. All the rest are okay.

What came up in my web search are a couple of suggestions, solutions by users having the same problem:

> Run a registry cleaner, like CCleaner. And this is especially if you have done uninstallation of softwares, especially similar products recently.
> The steps below, taken from a forum's article, :

1. Make sure that Visual Studio user project/item templates location is right. (Menu: Tools > Options > Projects and Solutions)
Default path for VS2005 for projects is: %UserProfile%\My Documents\Visual Studio 2005\Templates\ProjectTemplates
Default path for VS2005 for items is: %UserProfile%\My Documents\Visual Studio 2005\Templates\ItemTemplates
*%UserProfile% refers to C:\Documents and Settings\

2. Run devenv.exe /ResetSkipPkgs (Clears all options to skip loading added to VSPackages by users wishing to avoid loading problem VSPackages, then starts Visual Studio.)

3. Use devenv.exe /setup to restore the VS settings to their original state. If you have, for instance, packages that failed to load and you clicked the button to disable them from loading in the future, you can get them back again with the /setup switch. The original problem that caused the package to fail to load may or may not have been corrected so you may need to correct that before all packages load correctly.
This is similar to /ResetSkipPkgs, but also gets newly installed packages resource info completely registered.

4. Run devenv.exe /ResetSettings to isolate the settings problem

5. Visual Studio uses a cache on disk of all the installed project/item templates, to rebuild the cache, please run devenv.exe /InstallVSTemplates (in Start > Run or "Visual Studio 2005 Command Prompt")



-----

I have applied the single-line code to my affected application, and to the others that are okay, in case they do. I have cleaned the registry using CCleaner. It didn't work.

I have also followed all the steps above, from 1 to 5, and the problem persists.

I have now performed reinstallation of VS2005.


> After some time, I find that this has not been how I expected to be fixing this problem. I thought it was easy. My VS2005 reinstallation encountered some error. I remember manually uninstallating a lot of those MS softwares, like Silverlight, RIA toolkits, Expression Blend, etc., etc. I may have removed some critical softwares...

I am reinstalling those MS softwares that I know are critical, and I'm keeping my fingers crossed...

Till then!



Enhanced by Zemanta

14 March, 2011

Oracleclient handling multiple row result set in C#

Image representing Oracle Corporation as depic...Image via CrunchBaseAfter so many days of searching and experimenting on how to use stored procedures in my applications, and specifically, to use Oracleclient, I was getting tired and frustrated. None of my searches in the web is returning the exact article that I need. Until about today.

It was a search, some kind of a last recourse, a button click with my dying enthusiasm... the last blast.

And it somehow paid off!



When I saw the article in this page, I knew that the connection string is defined differently.

I kept on doing search and review and testing.

I should mention that I saw some useful articles in MSDN, where I also learned that when handling result sets that are multiple rows and/or multiple columns, the ordinary query or stored procedure will not work. The use of REF CURSOR is now a mandate.

Professional ADO.NET 2: Programming with SQL Server 2005, Oracle, and MySQLOne such useful reference can be found here. This is where I patterned my stored procedure, made up of a stored procedure in a package.

Then finally, today, I could say that as a last recourse, I typed on "Data Reader on Oracle stored procedure in C#", "using Oracle client to fetch multiple rows", and to the likes of that search strings, and I found one coming from The Code Project, where I am subscribed to.

I found one, which, I am not able to understand immediately. But the connection string is once again stressed out to be different.

I tried a few more times, and then finally, with one last try before I would ditch my attempts forever, it worked!

That page from The Code Project team is here.

I needed the Oracleclient dll file (.NET Managed Provider for Oracle), and as directed by the Code Project article, i downloaded the installer from a Microsoft Download page. Well, find that page here also.


So why did I pursue this item?


Pro .NET Oracle ProgrammingSpeed and efficiency. Not to mention maintainability.

Stored procedures are many times more efficient that inline queries. The comparison I did was to run an inline query and the stored procedure. The timing I put in front and behind is to measure the time the small code would take to complete.

One query. Short one. Simple one.

The inline query took about 1 min and 30 secs.
The stored procedure took about 11 secs to complete.

That is approximately a speed of 6x faster or slower!

And if you need to change anything in the query, you can do it outside without ever disturbing your application - if you are using stored procedures.

And as always said, stored procedures already IN THE Database system are already optimized by the machine, rather that when it is first submitted and run by the machine.


And with all that has been done and tested, I am happy to present my simple code, for my own reference, and for everybody else who would find this useful.

Till then!

-----


Points to note:
  1. Inline query is the same as the stored procedure, modified accordingly.
  2. The parameters (input, output) should have the same names as declared in the stored procedure/package.

-----

using System;
using System.Data;
using System.Data.OleDb;
using System.Data.OracleClient;
using System.Text;
using System.Windows.Forms;

namespace Get_Data_by_OracleClient
{
  public partial class Form1 : Form
  {
    public Form1()
    { InitializeComponent(); }

    private void Form1_Load(object sender, EventArgs e)
    {
      TBox1.Clear();
      TBox2.Clear();
      TBox3.Clear();
      TBox4.Clear();
    }

    private void Btn_Click(object sender, EventArgs e)
    {
      this.Get_Data_by_InlineQ(TBox1.Text, TBox4);
      this.Get_Data_by_StoredP(TBox1.Text, TBox4);
    }

    private void Get_Data_by_InlineQ(String thisITMSDevice, TextBox thisTBox)
    {
      thisTBox.Text = "";
      //
      StringBuilder myQuery = new StringBuilder();
      string dbProvider = "Provider=MSDAORA.1;";
      string dbUser = "User ID=myUserName;";
      string dbPwd = "Password=MyPassword;";
      string dbName = "myOracleDBName";
      string dbODS = dbProvider + dbUser + dbPwd + "Data Source=" + dbName;
      OleDbConnection dbConn = new OleDbConnection(dbODS);
      StringBuilder myResult = new StringBuilder();
      myResult.Append(DateTime.Now.ToLongTimeString()).AppendLine();
      //
      myQuery.Append(" type in your inline query here ");
      //
      OleDbCommand dbCmd = new OleDbCommand(myQuery.ToString(), dbConn);
      //
      try
      {
        dbConn.Open();
        OleDbDataReader dr = dbCmd.ExecuteReader();
        myResult.Append(dr.FieldCount.ToString()).AppendLine();
        while (dr.Read())
        { myResult.Append(dr[0].ToString()).AppendLine(); }
        dr.Close();
        dbConn.Close();
        thisTBox.Text += myResult.ToString();
        thisTBox.Text += DateTime.Now.ToLongTimeString() + "\n";
      }

      catch (Exception ex)
      { MessageBox.Show(ex.ToString()); }
    }

    private void Get_Data_by_StoredP(String thisITMSDevice, TextBox thisTBox)
    {
      thisTBox.Text = "";
      //
      string dbUser = "User ID=myUserName;";
      string dbPwd = "Password=MyPassword;";
      string dbName = "Data Source=myOracleDBName;";
      string dbODS = dbName + "Persist Security Info=True;" + dbUser + dbPwd + "Unicode=True;";
      StringBuilder myResult = new StringBuilder();
      myResult.Append(DateTime.Now.ToLongTimeString()).AppendLine();
      //
      OracleConnection dbConn = new OracleConnection(dbODS);
      OracleCommand dbCmd = new OracleCommand();
      dbCmd.Connection = dbConn;
      dbCmd.CommandText = "GetData_by_Ora.GetData_by_StoredP";
      dbCmd.CommandType = CommandType.StoredProcedure;
      //
      OracleParameter myITMSDev = dbCmd.Parameters.Add("InputVar", OracleType.VarChar, 32);
      myITMSDev.Direction = ParameterDirection.Input;
      OracleParameter myPrcdName = dbCmd.Parameters.Add("ResVar1", OracleType.Cursor);
      myPrcdName.Direction = ParameterDirection.Output;
      //
      myITMSDev.Value = thisITMSDevice.ToString().Trim().ToUpper();
      //
      dbConn.Open();
      OracleDataReader rdr = dbCmd.ExecuteReader();
      myResult.Append(rdr.FieldCount.ToString()).AppendLine();
      while (rdr.Read())
      { myResult.Append(rdr[0].ToString()).AppendLine(); }
      rdr.Close();
      dbConn.Close();
      thisTBox.Text += myResult.ToString();
      thisTBox.Text += DateTime.Now.ToLongTimeString() + "\n";
    }
  }
}
Enhanced by Zemanta

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