Weblog Of Nirandas | home

Developer From INDIA

Resizing a varchar column in MySql

clock April 29, 2008 05:41 by author
Today I was asked by my client to resize a text field in a MySql database. MySql provides an easy way to resize or modify any column in your table using alter table .. modify syntax. alter table Articles modify Title varchar (255) ;(table name and column names are changed!)Here the column `Title` from the table `Articles` is modified to a varchar of the length 255. Note: if the column's length was more than 255, all the values in the columns will be truncated to fit the current size. You can use this statement to modify any datatype, not just varchars.To verify that all went well, run the explain tablename command before and after executing the alter table modify statement.
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Forcing a file download using asp.net

clock April 25, 2008 06:51 by author
One way of allowing the users to download a file is providing the direct link to the file. But if you want to do some custom processing before or after the file is downloaded, creating a custom handler  for sending the file is more useful.Here is how I created the download button for allowing visitors to download the txCaptcha plugin for wordpress.In my download button's click event handler.
string fn = Server.MapPath("~/path to the file..");Response.ClearHeaders();Response.ContentType = "application/x-force-download";Response.AddHeader("Content-Disposition", "attachment; FILENAME = \"txCaptcha.zip\"");Response.TransmitFile(fn);Response.End();
Here calling the response.End() is very important. If not called, the downloaded file will get corrupted as the rest of the output will also get appended to the file.The code is simple and hardcoded, but it should give you an idea about which HttpHeaders to send for forcing the browser to show the file download dialog.Note: this code does not have support for resuming the download if it gets broken. So, if you are sending large file this simple method may not be the best method. I will be posting about how to implement support for resuming download in a later post.
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Free online book for learning php from hudzilla.org

clock April 18, 2008 17:07 by author

Here is a free online php book which teaches php in great detail.http://www.hudzilla.org/php/

With more than 20 chapters, this online book contains virtually everything you will need to know to be able to develop websites in the PHP.Once you think you have mastered the language, you can take the online exam and test your art of php programming!

This is a must read if you are interested in learning php.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


What is the difference between 'smarty.class.php' and 'Smarty.class.php'?

clock April 18, 2008 11:42 by author
When you develop php sites on Windows to be hosted on Linux box, a simple thing like ignoring the case of filenames can cost you few hours. Specially ifthe server does not output the error description, most hosting servers would not do this for security reasons.So, use a standard method for casing your filenames and check that your scripts does use the right case while refering to the files.Remember! most php sites will be hosted on Linux and unlike Windows, Linux is a case-sensitive OS
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Currently rated 2.0 by 1 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Almost pretty URLs on IIS

clock April 15, 2008 10:58 by author

Setting up pretty looking permalinks with wordpress and Apache is very easy. Apache's mod_rewrite functionality makes it a matter of seconds. However, when you are hosting your wordpress blog on IIS, lack of native URL rewriting capability on IIS makes it impossible to have the pretty URLs like seen on Wordpress with Apache.

There is an option though, (almost pretty looking permalinks).The URLs of the posts will be like /index.php/post-title/ instead of /post-title/That is as near you can get to the pretty URLs on IIS by only configuring wordpress.

Wordpress 2.5.1

On wordpress 2.5.1, use the following steps to set up "almost pretty URLs".

  1. Choose settings from your admin CP
  2. Click on the Permalink link
  3. Check "custom structure" radio button
  4. In the box provided for entering the custom link structure, type "/index.php/%postname%/" without the quotes.
  5. Hit the save changes button!

You are done. Now there will not be any '?' in the permalinks of your posts. For more information about the permalinks with wordpress, visithttp://codex.wordpress.org/Using_Permalinks

There exists some other methods using which you can have pretty permalinks on IIS like using custom 404 redirect support etc. But I have not tryed them yet.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


How to Launch a windows application from the browser

clock April 14, 2008 09:39 by author

Sometimes, you may want to launch your application when user clicks a link on your webpage. This is especially useful for gaming sites, starting the gamewhen the player joins a poker table etc. You can see this at work at http://allinplay.com.

Few months ago, I was into a project where I had to implement this feature. Since it was to work only in windows, I could use custom "url protocol" handlersupport.

For that I registered the application to be started as an url protocol with a custom url scheme for example "appname.webstart". Then launching the appwas just a matter of navigating to a url which uses the registered scheme for example "appname.webstart:arguments".

How it works: When your browser (both IE and firefox) is navigating to a url, it looks up the scheme in the registry and loads the attached handler. schemeslike http and ftp have default handlers implemented.What we do is create a new scheme and specify our application as the handler, after which all the requests for that scheme will be handled by our application.

How to launch: You can use javascript to redirect the browser the url likelocation.href = "appname.webstart:2998";Here "2998" is some type of argument for the app. Now the browser will start the app with the specifyed argument. The program should parse the commandlineargument and perform the action according to it.

Detail instructions about creating url protocol handlers and how to register them can be found at http://msdn2.microsoft.com/en-us/library/aa767914(VS.85).aspx.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Who Am I?

I am Nirandas - a developer from INDIA

Sign in