Articles Comments

w3villa Official Blog » Archive

Upload image without submitting form, works on all browsers

If you will have a look at my old post on Uploading files/image with Ajax & Jquery, without submitting a form, you will find that this implementation does not works with Internet Explorer (IE). IE does not supports FormData, so either we can flash or the hidden iframe solution. Now flash is not the best solution as it is not installed in many browsers (and many of the mobile devices does not supports flash). So, the hidden iframe solution is best in our case. Here is how we can implement it : [crayon-519dbf6b0c755/] The above HTML code will do the job. I am using Ruby on Rails framewok. I am returning a text response (If I will sent a JSON response IE will ask to save the response). You can code the same in … Read entire article »

Filed under: Programming

Facebook Send Dialog Error Code: 100 API Error Description: Invalid parameter Error Message: ‘link’ is invalid.

I am using Facebook Send Dialog for posting private message with link to my Facebook application. Earlier it was working fine but now it started throwing error as : [crayon-519dbf6b1a04c/] for sending message I am using code : [crayon-519dbf6b1a265/] I Google about this and only relevant information I get is that Facebook is blocking the link to its own domain as to avoid spam. as I change the link to other live site its working. I need to send link to my application as I have to provide such functionality. Problem Cause: Facebook is not allowing to use its own link as to stop spamming. Problem Solution: There is as such no solution as its bared by Facebook API. Other workout: Shorten URL, but its didn’t works as Facebook check the provided URL. Redirect URL, same as above. In my case I have deployed an additional HTML page just use to redirect to … Read entire article »

Filed under: Programming

Bad permissions: ignore key: /Users/../.ssh/id_rsa GitHub

After installing OS X on my mac, I tried to add RSA key fingerprint to complete the set up of git on my machine. I have already taken backup of my id_rsa and id_rsa.pub key, so I have created .ssh folder on user root. Now in order to authenticate I typed following command on my terminal [crayon-519dbf6b1b508/] I got following error [crayon-519dbf6b1b551/] In order to fix this bug you just need to change permission of your id_rsa key. To do so, just type the following command [crayon-519dbf6b1b599/] And just time when you will type ssh -T git@github.com. You will see the success message [crayon-519dbf6b1b5e2/] Done! … Read entire article »

Filed under: Operating System

Transferring file from local machine to ssh server

Many a time we need to upload a file such as dump of file of mysql, some locally downloaded packages, etc to the remote server. For doing so, we can use SCP (secure copy) command of linux. (There are many other clients available for same like FTP, SFTP, etc) Suppose a file name dump.sql is located on Downloads folder of user i.e ~/Downloads/ and we want to upload the file at root of user in the server i.e. ~/dumps/ So, we just need to write the command [crayon-519dbf6b1c66e/] Done! … Read entire article »

Filed under: Operating System

Multiple file upload using uploadify via Ajax, Spring-framework in java

If there is a need of uploading multiple file simultaneously through AJAX with Spring framework and its compatibility with multiple web browsers, then the answer is to use uploadify plugin. Here I will describe the steps to do so. If you are using maven then we need the following dependency to be updated: [crayon-519dbf6b1d2ae/] And in your application-context file you need to add bean declaration described below to support multipart request and can set other properties such as maximum upload file size as below: [crayon-519dbf6b1d2fa/] For simple or spring free projects you need not to do upper steps. Working with Uploadify : You can download uploadify from the following link http://www.uploadify.com/download/. Download and unzip the folder you will have the following files:         paste the uploadify.css file into your css folder. jquery.uploadify.js in your script folder. download jquery.1.7.2.min.js and put it … Read entire article »

Filed under: Java

Setting up Ruby on Rails application on a Cloud Server

First of all get a Cloud server from a trusty hosting company and get the root permission for SSH Open the terminal and first of all lo-gin to your account [crayon-519dbf6b1fdee/] Type yes to continue root@111.111.111.111′s password: ## Type the password here Now add a new user, we will deploy the server with this user. To do so, type the command on the console [crayon-519dbf6b1fe37/] Enter the new password Enter other information Type y to save the newly created user. [crayon-519dbf6b1fe78/] and add a line w3villa ALL=(ALL) ALL to give newly created user all permissions. SSH configuration Now browse to .ssh/id_rsa.pub file on your local machine, and copy the content of that file. Follow these commands in the remote server : [crayon-519dbf6b1feb8/] and paste the rsa key there. (esc > :wq) to save the file. Now when you will login with the user w3villa again it will … Read entire article »

Filed under: Rails

Add alias in Mac OS or Linux/Unix/Ubuntu, create shortcut of terminal commands

Open terminal and type [crayon-519dbf6b265e8/] This will open the ~/.profile file in the nano text editor. Now here the syntax to creating the alias. alias <alias name> = “<command>” [crayon-519dbf6b266cc/] Save the file and then type [crayon-519dbf6b26a60/] Now in the above example, I have created a alias name rdtp for the command “rake db:test:prepare”. With this I just need to type rdtp instead of typing “rake db:test:prepare”. Cool…huh! … Read entire article »

Filed under: Operating System

Installing linecache19 in ruby 1.9.x

When I was installing linecache1.9 I came with this error : [crayon-519dbf6b2813b/] This error came because gem was unable to include the ruby head. So we have to give the option for including the ruby. We can do it with the following command. [crayon-519dbf6b28477/] Hope its work for you, if not then let me know..  :) … Read entire article »

Filed under: Rails

Uploading files/image with Ajax & Jquery, without submitting a form

Here is the code for uploading an image or file without submitting a form with Ajax. For this we will create object of FormData class and will append the properties of the file field in a attribute of FormData object, finally we will set the FormData object with the data key of ajax method of JQuery. [crayon-519dbf6b28a88/] [crayon-519dbf6b28acb/] We can get the parameters of file field by accessing the “file” key of the parameters hash. Sorry to say, but the FormData class is not supported in IE. If you are looking for a solution that works on all browsers have a look at Upload image without submitting form, works on all browsers. … Read entire article »

Filed under: Websites