Archive by Author

[Fix] PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding “UTF8”

I was trying to store Random IVs generated for AES encryption but couldn’t store them into a PostgreSQL database. The Random IVs generated were binary data. So, you have to escape them. While storing, do this PGconn.escape_bytea(data) While retrieving, do this PGconn.unescape_bytea(data)  

How to create a singleton scaffold in Rails 4

I thought I would quickly post this. Use the usual command to generate the scaffold. rails generate scaffold Model then in routes.rb   Change resource :models to resource :models, :path => ‘model’

Briefly describe your current experience with computers and computer programming

I was applying for RubyConf India scholarship which I want to go badly. I missed the last one in Bangalore because I wasn’t in the Ruby scene back then. They did have this question: Briefly describe your current experience with computers and computer programming Midway through writing the answer when I figured it was pretty long, unnecessary and would make a nice blogpost after a long break. [...]

How to get reverse SSH access to a Linux Machine behind NAT

My friend wanted access to a computer at college because he was working on his college project where they had to create a cloud farm using OpenStack. He wanted to work from home (that is one of the perk if you are a software person). The computer was behind the college NAT. So, doing something like this would need the SysAdmin and presumably a convoluted process. I found this nice remote forwarding [...]
WordPress WXR file splitter for Mac OS X

WordPress WXR file splitter for Mac OS X

I had been looking for a WordPress WXR (WordPress eXtended RSS) export file splitter as some hosts has limits over the upload file size limit and at times, I don’t get root access to edit the PHP.ini to lift the limits. Windows has a neat little tool that helps people split WXR export files. http://www.rangerpretzel.com/content/view/20/1/ Sadly, at the time of this writing, none seems to be available [...]

How to programmatically assign a category to a post on WordPress

Another quick little snippet. This is when you use it in a loop. $my_post = array(); $my_post['ID'] = $post->ID; $catarray = array(31); // 31 is the cat ID you want to assign foreach((get_the_category($post->ID)) as $category) { array_push($catarray, $category->cat_ID); } $my_post['post_category'] = $catarray; wp_update_post( $my_post [...]

How to install Ruby 1.9.2 on Ubuntu using RVM

Here’s a quick snippet to install Ruby on your Ubuntu system. RVM = Awesomeness! login as single user, not root. bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc source ~/.bashrc Check out the [...]
About Procrastination

About Procrastination

I have been a hardcore procrastinator since as long I can remember. Recently, I have been doing some introspection. I have never been someone who can write a 5 page essay. From now on I’ll be posting my small bits of thoughts even it’s a disorganized mess. Disclaimer: All of following is my thoughts inspired by this post. What’s procrastination: It’s a process where you do very [...]

Get FTP server running on Ubuntu, quick and easy [vsftpd]

If you are new to linux this might be a little difficult. Once you have some basics nailed, its super easy. Here’s how to get it working without worrying about usergroups etc etc. I just wanted to get it working with my WordPress setup (Apache). First, install vsftpd sudo apt-get install vsftpd Configure your installation. sudo nano /etc/vsftpd.conf or sudo vi /etc/vsftpd.conf You need to have [...]

How to enable ICMP ping requests on EC2 instances. No more “Request Timed Out”

I, recently, switched to the EC2 virtual instance. I wanted to check if the website is online. As usual I used the “ping” command. I thought my server was down (kinda freaked out) but the website on the browser was working fine. All I needed to do was to enable the ICMP requests: 1) Log into AWS account. 2) Click on “Security Groups”. Choose the required security group. 3) Click [...]
© 2015 Suhas Tech. All rights reserved.
Proudly powered by Wordpress.
Suhas Sharma+