Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)

Friday

The type or namespace name 'MySql' could not be found:
                                  If you remove or delete the MySql.Data reference from your project library, you will get this type of errors. To resolve this you just follow the below steps.
 Solution:
Step 1: Download the Connector/Net from http://dev.mysql.com/downloads/connector/net/1.0.html

Step 2: Run the downloaded .exe file in to your system.

Step 3: Open your project in Visual Studio --> open references --> delete MySql.Data (old) reference.

Step 4: Right click on references and Add new assembly references for MySql.Data

Step 5: Build your library and you will get Build Succeed.

iPhone: Copy a file from resources to documents

iPhone SDK: How to copy a file from resources to documents Directory?:
                                                        You can copy a file or database from resources to documents directory by using the following code.
Code:

NSFileManager *fileMgr= [[NSFileManager alloc] init];
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"reporter.sqlite3" ofType:nil];
    NSError *error;
    if(![fileMgr copyItemAtPath:filePath toPath:[NSString stringWithFormat:@"%@/Documents/reporter.sqlite3", NSHomeDirectory()] error:&error]) {
         //Exception Hndling
         NSLog(@"Error : %@", [error description]);

    }
    [fileMgr release];

Get remaining characters count in a textbox using javascript

Wednesday


Show how many characters remaining in a html text box using javascript:
                                                                                     The following  javascript will help you to show how many characters are remaining for a textbox or textarea, The label placed next to the text box shown the number of character remaining.

<script type="text/javascript">
function txtCounters(id,max_length,myelement)
{
counter 
= document.getElementById(id);
field = document.getElementById(myelement).value;
field_length = field.length;
 if 
(field_length <= max_length)  {
//Calculate remaining characters
 
remaining_characters = max_length-field_length;
//Update the counter on the page
  
counter.innerHTML = remaining_characters;  }
 } 
</script>

<label for="txtName">Enter Your Text : </label>
<input type="text" id="txtName" size="50" maxlength="50" onkeyup="javascript:txtCounters('txtCounter',50,'txtName')"> <div id="txtCounter"><b>50</b></div>characters remaining.
Demo:

50
chars remaining.

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets