Kulbir Saini – Tech Stuff https://gofedora.com How Tos, Tutorials, Tips and Tricks Thu, 18 Jun 2015 14:17:41 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.4 Catching up! https://gofedora.com/catching-up/ https://gofedora.com/catching-up/#comments Thu, 18 Jun 2015 14:17:41 +0000 http://gofedora.com/?p=1166 … ]]> A lot has changed since the last blog post (more than three years). I was happily running a successful business around Videocache till Google decided to push HTTPS really hard and enforced SSL even for video content. That rendered Videocache completely useless as YouTube video caching was the unique selling point. Though people are still using it for other websites (whatever supported and not HTTPS yet), I personally didn’t find it good enough for selling. To add to the trouble, Mozilla and friends announced that there will be free certs for everyone. Now, that took away whatever motivation was left to keep working on Videocache. I decided to open source Videocache and the source is now available on GitHub. If you have better ideas or you are looking forward to make things work by forging certs etc, fork it and give it a shot.

After all that mess with Videocache, I am left with a contract job which is not working out well. So, the learning hat is back and I am trying to catch up with the tech world. I didn’t really want to get into the whole JavaScript framework mess because there is no clear winner and there are too many of them but it looks rather unavoidable or Unflushable (if you remember Jeff from Coupling). I have been trying to make simple apps with Angularjs. There is little documentation and you have to dig really deep at times but still you can make things work if you persist. Once you spend some quality time with it, you may actually start liking Angularjs. So, I did give it some time and implemented angular fronted for Pixomatix-Api (another learning project I am working on) and I think I sort of like it now.

In 2015, if you are web developer, you must know how APIs work and you should be able to consume them. So, to learn to expose APIs and version them properly, I fired a small project Pixomatix. Being a Rails developer, you really get obsessed with it and try to implement everything using Rails. Even when you want an API with 2-3 endpoints, you tend to make the horrible mistake of doing it in Rails. This kept bugging me and a few weeks later, I decided to freshen up my Sinatra memories. But working with Sinatra is not all that easy especially if you are used to all the niceties of Rails. Dug up my attempt of implementing Videocache in Ruby, and extracted few tasks and configurations I had automated long time ago. Ended up working a lot more on it and packages into a template app with almost all the essential stuff. Though I need to document it a little more, the app has got everything needed to expose a versioned API via Sinatra.

On the other hand, I tried to use devise gem to authentication for Pixomatix. It was all good for integration with standard web apps and APIs but it sort of failed me when I tried to make the API versioned. Devise turned out to be black-hole when I tried to dig deeper to make things work. I tried a few other gems which supported token authentication but they were also no good for versioning. Generally, you may not need to version the authentication part of your API, but what if you do! Since, this was just a learning exercise, I was hell bent on implementing this. So, I just reinvented the wheel and coded basic authentication (including token authentication) for the API.

That’s it for this post. I am looking forward to post regularly on the new stuff I learn.

]]>
https://gofedora.com/catching-up/feed/ 1
Insanely Awesome Web Interface for Your Git Repos https://gofedora.com/insanely-awesome-web-interface-git-repos/ https://gofedora.com/insanely-awesome-web-interface-git-repos/#comments Tue, 22 May 2012 06:55:47 +0000 http://gofedora.com/?p=1128 … ]]> Almost 80-90 people visit How To: Install and Configure GitWeb everyday in search of setting up a web interface for their git repositories. Though gitweb is nice, it’s a bit painful to setup and the web interface is not that appealing. The other day I received this email from Klaus Silveira

Hello Kulbir,
I saw your article about installing Gitweb and i decided to send this shameless self-promotion. Maybe you could try my open-source project, GitList https://github.com/klaussilveira/gitlist

I’m looking for beta testers and supporters. FLOSS. 🙂

So, I thought I’ll just give it a try. Today, I got it working and was blown away by the amazing interface! It’s almost like a super simplified version of GitHub. I was so impressed that I immediately setup a demo website at git.gofedora.com for others to look at and fall in love :-)Another good thing about GitList is that it’s very simple to setup. Below is a step by step process to install and configure GitList to expose your public Git repositories to the internet.

What You Need?

You need the following packages before you can setup GitList.

Installing Required Packages

Most modern operating systems have the above mentioned packages installed by default. Even if you don’t have them already, you can use your OS package manager to install them quickly. To install on Fedora/RedHat/CentOS using yum, use the following command

[root@whitemagnet.com ~]$ yum install php git httpd

For Ubuntu/Debian, use the following command

[root@whitemagnet.com ~]$ apt-get install php git apache2

Assumptions

For setting up GitList, I am assuming the following directory paths and other variables.

  • Path to public Git repositories : /home/saini/code/public/
  • Path to Apache document root : /var/www/html/
  • Path to Git executable : /usr/bin/git (Use “which git” to find out for your OS)
  • Web URL for browsing git repos : mygit.example.com/gitlist/

Installing and Configuring GitList

Follow the following simple steps to install and configure GitList.

Step 1 : Clone GitList repository from GitHub to /var/www/html/gitlist/

[root@whitemagnet.com ~]$ cd /var/www/html/
[root@whitemagnet.com html]$ git clone git://github.com/klaussilveira/gitlist.git gitlist

Step 2 : Create cache directory and make it globally writable

[root@whitemagnet.com ~]$ cd gitlist
[root@whitemagnet.com gitlist]$ mkdir cache
[root@whitemagnet.com gitlist]$ chmod 777 cache

Step 3 : Configure GitList using config.ini

Open the config.ini (in gitlist directory) and set the option properly. Refer the sample shown below.

[git]
client = '/usr/bin/git' ; Your git executable path
repositories = '/home/saini/code/public/' ; Path to your repositories (with ending slash)

[app]
baseurl = 'http://mygit.exmaple.com/gitlist' ; Base URL of the application (without ending slash)

Step 4 : Make sure your Apache can read your .htaccess file in gitlist directory

GitList utilizes Apache’s mod_rewrite module to  provide nice URLs. Make sure your Apache is configured to read .htaccess from the gitlist directory. Open your Apache config file (generally located at /etc/httpd/conf/httpd.conf or /etc/apache2/ports.conf) and look for the following

In this segment, make sure you have AllowOverride All as below.


# Other lines omitted
AllowOverride All
# Other lines omitted

Step 5 : Reload or restart Apache daemon if needed

[root@whitemagnet.com ~]$ apachctl -k restart (or apache2ctl -k restart for Ubuntu/Debian)

Step 6 : Get some sample repositories in your public repo directory

Get some sample repositories in your public repo directory from GitHub.

[root@whitemagnet.com ~]$ cd /home/saini/code/public/
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/intelligentmirror.git
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/Railscasts-Sync.git
[root@whitemagnet.com ~]$ git clone git://github.com/zilkey/active_hash.git

That’s all! Now, go to http://mygit.example.com/gitlist to discover your public git repos via a cool web interface! Leave a comment if you face any issues.

]]>
https://gofedora.com/insanely-awesome-web-interface-git-repos/feed/ 26
Getting Started With Git https://gofedora.com/getting-started-with-git/ https://gofedora.com/getting-started-with-git/#comments Thu, 17 May 2012 04:44:58 +0000 http://gofedora.com/?p=1125 … ]]> I have been using Git for years now and I am still a novice user. Actually, if you are an individual developer or work in a really small team, you don’t really need to go beyond using the basic stuff like cloning a repo, committing code, branching and pushing back to the origin repo. And that’s exactly what happened with me. Working alone most of the times and working in my own repos. I never felt the need to explore advanced usage.

Last week, we didn’t have internet at home for like four days. So, I thought I’ll read a book. I downloaded ProGit : The Free Git Book and started reading. It’s an awesomely written book. I learned a lot of new things about Git. A few more concept about using branches efficiently. If you are a Git beginner or looking forward to getting started with Git and you don’t like reading too much, I’ll suggest that you read at least first three chapters thoroughly. That along with a free GitHub account should be enough to get you going if you are not going to be a heavy Git user soon.

]]>
https://gofedora.com/getting-started-with-git/feed/ 2
Summer Hacking https://gofedora.com/summer-hacking/ https://gofedora.com/summer-hacking/#comments Fri, 11 May 2012 20:03:17 +0000 http://gofedora.com/?p=1121 … ]]> Summer has already started and we (a small group of current and ex-IIITians in Hyderabad) are planning to have some fun digging into Ruby on Rails and related technologies. If you are also interested in utilizing your summer in a productive and fun way, you can join us and share your knowledge while learning from the rest of the members at the same time.

Assuming that all of us know at least one programming language (C/C++/Python), below is the list of things we are planning to learn.

  1. Ruby
    • If you already know a programming language, it’ll not be difficult for you to pick up Ruby.
    • In case you happen to know Python, you’ll feel at home.
    • Spend a good half an hour on Ruby In Twenty Minutes and you’ll know how simple and beautiful Ruby is.
    • Once you are done with Ruby quick-starter, you can try ruby in your browser and have some fun.
    • Please go through Ruby Style Guide to see how to write beautiful and easy to understand Ruby code.
  2. Rails
    • If you have worked with any MVC framework in past, you’ll pickup rails quite easily.
    • If you have worked with Web2py, then go through this Rails vc Web2py presentation which tries to show similarities among both frameworks.
    • RailsGuides is one of best and complete documentation for getting started with Ruby on Rails. It may look like a lot of content to beginners. If that’s the case with you, you can skip the guides in Digging Deeper section.
    • RailsCasts is  like a sea of quality Ruby on Rails screencasts. Watch a few on topics where you may have doubts.
  3. jQuery
    • We’ll be learning jQuery assuming that all of us are already familiar with JavaScript.
    • We’ll learn only basics initially and explore more as we start using it in a Rails project.
  4. CoffeeScript
    • CoffeeScript is a language that compiles to JavaScript but it’s way more beautiful to look at and easier to read and understand.
    • We’ll not write JavaScript code for our Rails app. Instead, we’ll be writing CoffeeScript!
  5. SCSS
    • SCSS is an extension of CSS3. It’s fun to write stylesheets using SCSS as it brings in additional features like variables, nested rules etc.
    • SCSS will ultimately be compiled to CSS.
    • Again, there is not much to do here. Half an hour to familiarize yourself with the syntax and you are ready to roll.
  6. Twitter Bootstrap
    • Bootstrap is a super simple and crazy awesome CSS and JavaScript toolkit developed by twitter.
    • We’ll be using bootstrap to power our Rails apps which we’ll build at a later stage.
    • Nothing much to learn here. It’s more about getting familiar with commonly used classes.
  7. Git and GitHub
    • We’ll be using Git for tracking code while building our apps.
    • We’ll learn about basic Git functions like cloning a repository, committing code, pushing code to a remote repository, working in different branches etc.
    • Go through Git Basics and we can learn more as we start using it full time.
    • We’ll be using GitHub to host all our code. If you don’t have an account already, get one.

We’ll learn these technologies while working regularly at our work places. Once in a while, we’ll meet and share our experiences and knowledge. The plan is to spend one or two weeks to go through basic stuff in all the topics. After that we can start a dummy rails project and learn more as we go.

If you are not in Hyderabad and still want to join, just start exploring and we can connect online! Happy Hacking!!!

]]>
https://gofedora.com/summer-hacking/feed/ 4
My New Book on Squid Proxy Server (A Beginner’s Guide) https://gofedora.com/book-squid-proxy-server-beginners-guide/ Mon, 18 Apr 2011 03:32:19 +0000 http://gofedora.com/?p=1072 … ]]> I have not blogged since a long time mainly because I was a bit busy authoring a book Squid Proxy Server 3.1: Beginner’s Guide for Packt Publications. The book is an introductory guide to Squid (especially the new features in Squid-3 series) covering both the basic aspects as well as the in dept details for advanced users. The book focuses on learning by doing and provides example scenarios for the concepts discussed throughout the book. Access control configuration, reverse proxying, interception proxying, authentication and other features have been discussed in details with examples.

Checkout the links below:

]]>
News: ATI Catalyst Drivers 10.2 Released. No Fedora 12 Support. https://gofedora.com/news-ati-catalyst-drivers-10-2-released-no-fedora-12-support/ https://gofedora.com/news-ati-catalyst-drivers-10-2-released-no-fedora-12-support/#comments Wed, 17 Feb 2010 22:33:15 +0000 http://gofedora.com/?p=1042 … ]]> After almost a month, ATI has come up with a new version 10.2 of its Catalyst (fglrx) drivers. The drivers can be download from ATI Catalyst™ 10.2 Proprietary Linux x86 Display Driver Page. As AMD is famous for doing nothing but just incrementing versions of there software, even this version doesn’t support xorg-1.7.4. But if you still want to give it a try, you can download and try installing the driver. Otherwise mesa-experimental drivers are your friend. Checkout the post Fedora 12 and ATI Drivers and save yourself from frustration 🙂

And yes, lets wait for next version of ATI Drivers 🙂

]]>
https://gofedora.com/news-ati-catalyst-drivers-10-2-released-no-fedora-12-support/feed/ 48
Javascript To Remove All Facebook Apps From Your Account https://gofedora.com/javascript-remove-facebook-apps-account/ https://gofedora.com/javascript-remove-facebook-apps-account/#comments Thu, 11 Feb 2010 23:06:45 +0000 http://gofedora.com/?p=1022 … ]]> This is a guest post by Gaganpreet Arora AKA bitgeek.

My Facebook app list was cluttered with useless apps accumulated over the time I had joined Facebook. The worst thing is that Facebook does not allow you to remove multiple apps in one go. You have to select one, confirm on “Are you sure?” first and then click on “Okay” when it is deleted. Very cumbersome. So I wrote a Javascript hack to remove all of the apps in one go.

Warning: This will actually delete all the apps

Step 1

Go to: http://www.facebook.com/editapps.php?v=allowed.

Step 2

Select and copy the complete code below and paste it into the address bar.

javascript:
function postwith (to,p)
{
  var myForm = document.createElement("form");
  myForm.method="post" ; myForm.action = to ;
  for (var k in p)
  {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}

function getElementsByClassName(classname, node)
{
  if (!node)
  {
    node = document.getElementsByTagName('body')[0];
  }
  var a = [], re = new RegExp('\\b' + classname + '\\b');
  els = node.getElementsByTagName('*');
  for (var i = 0, j = els.length; i < j; i++)
  {
    if ( re.test(els[i].className) )
    { a.push(els[i]); }
  }
  return a;
}

var arr = [];
els=document.getElementsByClassName('app_row');
arr['fb_dtsg']=document.getElementsByName('fb_dtsg')[0].value;
arr['remove'] = 1;
arr['post_form_id_source']='AsyncRequest';
arr['post_form_id'] = document.getElementById('post_form_id').value;
arr['app_id']=els[0].id.replace("editapps_allowed_","");
arr['__a'] = 1;
for (i=0; i

Step 3

Press Enter. The browser may get stuck for a few moments if the list is large, so if it does, just wait a bit and it will respond back.

References

Function postwith was taken from here, and getElementsByClassName was taken from here.
]]>
https://gofedora.com/javascript-remove-facebook-apps-account/feed/ 8
News : ATI Catalyst Drivers 10.1 Released. Test them now! https://gofedora.com/news-ati-catalyst-drivers-101-released-test/ https://gofedora.com/news-ati-catalyst-drivers-101-released-test/#comments Thu, 28 Jan 2010 02:45:47 +0000 http://gofedora.com/?p=1016 … ]]> After a long, really long wait, AMD has released the next version 10.1 of its ATI Catalyst display drivers (fglrx) for Linux. The drivers can be download from ATI Catalyst™ 10.1 Proprietary Linux x86 Display Driver Page. As previous version turned out to be a big turn off for Fedora community and AMD took a long time for releasing this, I hope they have fixed issues regarding new Xorg version. Fedora folks will really want this version to work, otherwise there will be *blood* 😀 You have got AMD graphics card? What are you waiting for? Download the drivers immediately and test the damn thing! And please let everyone know whether it works for you with details of your graphics card. You know where the howto for installation is ;) How To: Install ATI Catalyst (fglrx) Drivers.

I really hope that things turn out well and you don’t really get to this point. But if these drivers don’t work for you, proceed to the post Fedora 12 ATI Catalyst Drivers and checkout mesa-dri-drivers-experimental.

From the release notes for version 10.1,

Resolved Issues

  • [ATI CatalystTM Control Center] Display Manager Properties tab now properly shows a single mode instead of multiple modes when big desktop mode is enabled.
  • The operating system will no longer fail when switching between virtual desktops.
  • [RHEL 5.4 32-bit] [ATI CatalystTM Control Center] System now functions properly after selecting “Detect Displays” button and hot-plugging a HDMI display.
  • [Ubunut 9.10] X no longer fails after executing multiple Xserver generations with Xinerama enabled.
  • Hotplugging a HDMI monitor or toggling between LCD and HDMI no longer causes the system to stop responding.

Know Issues

  • [RHEL4-U8 32-bit] Corruption may be observed while starting Xserver on some ASICs.
  • Corruption may be observed after 90, 180 or 270 degree desktop rotation on some ASICs.
  • System may stop responding after switching to DC (battery) mode with CrossFireTM enabled and full-screen applications running.
  • System may become unresponsive after executing specific combinations of XRandR reflections and rotations.
  • The output log file may report the Engine Clock or Memory Clock values as 0 MHz on some systems.
  • [RHEL 5.4][ ATI CatalystTM Control Center] Applying customized TV modes might not work properly, pop up message requesting restart will not appear and customized format will not apply.
  • [Ubuntu 9.04 x86 64-bit] Some systems may become unresponsive during video playback with certain Dual Head configurations.
  • [ATI CatalystTM Control Center] Specific customized modes under the HDTV page may fail to apply on some systems.
  • [Ubuntu 9.04] With one DP monitor and one DVI monitor connected in clone mode, unplugging and re-plugging the DVI monitor may cause the system to deadlock.
  • Xserver may fail to launch after enabling CrossFireTM and restarting on some ASICs.
  • [ATI CatalystTM Control Center] Super Anti-Aliasing (16x) mode may not be available on some display adapters with CrossFireTM is enabled.
  • Display rotation may fail to apply from ATI CatalystTM Control Center with desktop effects enabled.
  • [RHEL] Enabling Xinerama may cause input devices (keyboard and mouse) to become inaccessible after restarting Xserver.
  • System may fail to return to console mode after enabling all adapters and exiting Xserver for multi GPU configuration on some ASICs.
  • ATI CatalystTM Control Center may report error when two displays of different maximum resolutions are set in clone mode.
  • [SUSE 11.1 64-bit] Enabling CrossFireTM might fail with some ASICs
  • Scaling setting changes may fail to retain after mode change, reboot or restarting Xserver.
  • [SUSE 11.2 x86] CrossFireTM might not be functional under specific configurations
  • [Ubuntu 9.10] CAL test “completemodulelist.txt” might not execute and throws segmentation fault.
  • [ATI CatalystTM Control Center] Some systems may intermittently stop responding when changing the scaling options.
  • [ATI CatalystTM Control Center] Applying “Size and Position” adjustments for Analog Monitors might not work properly.
  • [Ubuntu 9.04] Some video cards may stop video output signals when monitor has been powered off.
  • [ATI CatalystTM Control Center] Disabled display will become enabled after Xserver restart.
  • Flickering corruption might be visible while running OpenGL applications with CrossFireTM enabled on specific ASICs.
]]>
https://gofedora.com/news-ati-catalyst-drivers-101-released-test/feed/ 12
Red Hat Launches OpenSource.Com https://gofedora.com/red-hat-launches-opensource-com/ Wed, 27 Jan 2010 05:50:50 +0000 http://gofedora.com/?p=1010 … ]]> Well, OpenSource is more or less about software source code and technology specific but OpenSource.Com scales beyond software and technology and provides a platform to discuss/learn/get involved/share.

From the website,

What problems can we solve? How would it affect the way we learn? Work? Run our governments?

We want to shine a light on the places where the open source way is multiplying ideas and effort, even beyond technology. We believe that opensource.com will be a gathering place for many of the open source stories we’d like to share–through articles, audio, web presentations, video, or open discussion.

Currently website has following five channels,

For more information, visit following links

If you want to participate, please visit How to participate?

]]>
Tip: Multiproxy Switch : Easily use multiple proxies in Firefox https://gofedora.com/tip-multiproxy-switch-easily-use-multiple-proxies-in-firefox/ https://gofedora.com/tip-multiproxy-switch-easily-use-multiple-proxies-in-firefox/#comments Fri, 18 Dec 2009 22:53:46 +0000 http://gofedora.com/?p=1005 … ]]> A lot of people (especially working people with mobile devices like notebook/netbooks) need to use different proxy servers at home and office. There are several Firefox extensions available to achieve the required functionality but IMHO Multiproxy Switch(Mozilla Addon Page) is the best because

  1. Its simple and easy to use. It does what it should. No fancy/extra terrestrial stuff. Just switch proxies 🙂
  2. Easy and Firefox like interface to specify different proxies. Many extensions add their own fancy interfaces for specifying proxies which eventually suck big time.
  3. I am a fan of this one. The No-Proxy list. I could never understand those regular expression based no-proxy lists in FoxyProxy. Multiproxy Switch has Firefox like No-Proxy list which rocks and understandable 🙂

If you happen to come across a better proxy switcher for Firefox, do let us know 🙂

]]>
https://gofedora.com/tip-multiproxy-switch-easily-use-multiple-proxies-in-firefox/feed/ 4