ASP.NET Send Canvas to Server as File Using Ajax

Author: | Categories: Programming No Comments
HTML 5 introduces canvas element as a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images on the fly. A canvas is a rectangle in your page where you can use JavaScript to draw anything you want. Below is the code save graphics drawn on Canvas to server […]

ASP.Net persist readonly textbox value on postback

Author: | Categories: Programming No Comments
As a security measure in the asp.net the readonly fields and disabled fields loose their values in postbacks. To retain the readonly textbox value after postback instead of making the textbox readonly using properties option, use attributes in code: TextBox1.Attributes.Add(“readonly”, “readonly”); that will still make the textbox readonly and will also retain the value after […]

ASP.NET calling Webmethod using jQuery

Author: | Categories: Programming No Comments
To call Webmethod asynchronously in ASP.net through jQuery Javascript Code <script type=”text/javascript”> function Authenticate() { $.ajax({ type: "POST", url: "/login.aspx/Authenticate", data: "{ provide json data }", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (msg.d == '1') { alert(‘authenticated’); } else { alert("not authenticated"); } }, error: function() { alert("Error :("); } }); }; […]

Enable Pretty Permalinks on WordPress

Author: | Categories: Linux, Programming No Comments
Set pretty permalinks in Settings .htaccess file must look like this # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress Enable mod_rewrite on terminal window a2enmod rewrite Enable AllowOverride in Apache config file so that Apache reads .htaccess file <Directory […]

Accessing MySQL databases from remote computer

Author: | Categories: Database, Linux No Comments
To expose MySQL other than localhost uncomment following line in /etc/mysql/my.cnf and assign to your computers IP address and not loopback bind-address = xxx.xxx.xxx.xxx # replace xxx with IP Next for a remote user to connect with the correct privileges you need to have that user created in both the localhost and '%' as in. […]

SQL Joins

Author: | Categories: Database No Comments
Comprehensive image to show how SQL joins work

Check / Uncheck checkbox and radio button with jquery

Author: | Categories: Programming No Comments
You can check or uncheck a checkbox element or a radio button using the .prop() method // Check #x $( "#x" ).prop( "checked", true ); // Uncheck #x $( "#x" ).prop( "checked", false );

Parse Json data with JQuery

Author: | Categories: Programming No Comments
JavaScript has builtin functionality to read JSON objects. Let’s say there is a json like: [ { "id" : "1", "name" : "test1" }, { "id" : "2", "name" : "test2" }, { "id" : "3", "name" : "test3" }, { "id" : "4", "name" : "test4" }, { "id" : "5", "name" : "test5" […]