Friday, October 21, 2011

There was a failure while initializing the Microsoft Visual SourceSafe source control provider

I kept getting this error when I was trying to open my project. 
There was a failure while initializing the Microsoft Visual SourceSafe source control provider. You cannot use this provider to perform source control operations.

Here is the solution:
1. Open VS2005, go to menu Tools -> Options, then click "Source Control"
2. Choose "None" for the drop-down list under "Current souce control plug-in", rather then "Microsoft Visual Source Safe"

Reference: 

Cheers!

Monday, July 25, 2011

java.util.ConcurrentModificationException with ArrayList

You will receive java.util.ConcurrentModicationException error, if you are modifying a list while iterating it. For example, the following code will throw you the exception:

for (Object obj : list) {
  if (obj.getCode().equals("something"))
    list.remove(obj);
}


To avoid this exception, the trick is to delete/add an item through the iterator, but not the collection. Here is the example:

Iterator it = list.iterator();
while (it.hasNext()) {
  Object obj = (Object)it.next();
  if (obj.getCode().equals("something")) {     

    it.remove();
  }
}


Hope this helps.

Friday, May 6, 2011

The referenced assembly could not be resolved because it has a dependency on System.Data.OracleClient

Received the following build error:
The referenced assembly "xxx" could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider re-targeting your project.

This build error is caused by the project is targeting .NET Framework 4.0 Client Profile and references to an assembly, which has indirect reference on System.Data.OracleClient.dll that is not included in the .NET Framework 4 Client Profile.

To fix such errors, you can either remove the incorrect assembly reference from the project, or set the project to target to full .NET Framework version 4 instead of .NET Framework 4 Client Profile.

To change the target setting, go to “Project -> Project's Properties -> Application Tab”, and then change to appropriate Target Framework options.

Tuesday, April 12, 2011

Resize image without distorting it

Has anyone come across a problem where image is being distorted on a webpage?

Here is the simple CSS solution to display images without distorted.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <style type="text/css">
    .imgresize {
      width: 100px;
      height: 150px;
    }
    .imgresize img {
      width: 100px; // to fix images by width, or
      // height: 150px; // to fix images by height
    }
  </style>
</head>
<body>
  <form id="form1" runat="server">
  
<div>
    <div id="imgdiv" class="imgresize">
      <img alt="" src="images/image01.gif" />
    </div>
  </div>
  </form>
</body>
</html>


Note: You need to remove the height and width attribute value from img tag itself.

Reference link http://forums.asp.net/p/1514562/3619288.aspx

Sunday, August 22, 2010

"Strict standards : Non-static methods called statically" Error after Joomla Installation

Recently I'm merely setting up a test site on localhost to check out Joomla features. After the installation, there are tons of Strict standards errors appear on my screen when I browse to Joomla homepage. I tried to reinstall several times but it still gave me the same errors.


Finally, I found something useful on Joomla! Discussion Forums.

To solve this issue, simply change the following configuration in your php.ini file.
  1. Change error_reporting = E_ALL | E_STRICT to error_reporting = E_ALL & ~E_STRICT
  2. Change display_errors = On to display_errors = Off

Remember to restart your Apache server after the changes. You should be able to view to Joomla! homepage now.

Friday, July 30, 2010

Resize Textbox/Textarea based on content length

I was asked to implement resizing textbox based on content length in one of my projects, to avoid having to deal with scroll bars.

And here is the code that works for me:
<html>
<head>
<script>
function textAreaResize(o) {
  o.style.height = "1px";
  o.style.height = (25+o.scrollHeight)+"px";
}
</script>
</head>
<body>
<textarea id="textArea1" onkeyup="textAreaResize(this)" style="overflow:hidden"></textarea>
<asp:textbox id="txt1" runat="server" Width="500px" Height="25px" TextMode="MultiLine" onkeyup="textAreaResize(this);"></asp:textbox>
</body>
</html>


Anyway, I found out that this method is works for me only when I type my text in the box.

It is not working when I having no focus on the textbox and call the textAreaResize method to resize it. Position the cursor at the end of the text will resolve the issue.

Try the following code to your page.
<html>
<head>
<script>
function textAreaResize(o) {
  SetCursorToTextEnd(o.id);
  o.style.height = "1px";
  o.style.height = (25+o.scrollHeight)+"px";
}

function SetCursorToTextEnd(textControlID)
{
  var text = document.getElementById(textControlID);
  if (text != null && text.value.length > 0) {
    if (text.createTextRange) {
       var FieldRange = text.createTextRange();
       FieldRange.moveStart('character', text.value.length);
       FieldRange.collapse();
       FieldRange.select();
    }
  }
}
</script>
</head>
</html>


Call the textAreaResize method on your page load will do.

Hope it works for you too. =)
 

Get paid for your opinions! Click on the banner above to join Planet Pulse. Its totally free to sign up, and you can earn UNLIMITED. Find out more by visiting PLANET PULSE.
Sign up for PayPal and start accepting credit card payments instantly. http://www.emailcashpro.com
July Code Blog Copyright © 2010 Blogger Template Designed by Bie Blogger Template