Skip to content

Dipin krishna

perl

Perl: How to Upload a file using perl CGI

This is a tutorial on how to upload a file using perl CGI.

html-css

How to make a Div (Lightbox) appear over a Flash / Youtube embedded video

Do you have a Flash / Youtube video on your website, and have you ever tried to put a Lightbox on top of everything on your site? It is usually said that flash loads on top of everything. What a flash plugin does is, instead of being displaying inside the browser, it actually makes a… Read More »How to make a Div (Lightbox) appear over a Flash / Youtube embedded video

Search Replace

SED: Shell command to find and replace text inside a directory (multiple files)

I have been using this command for a long time now. Whenever i am in need of this command, i won’t be remembering the correct syntax. So, i google it each time. Now, i am gonna write it down here. sed is a marvelous utility. Unfortunately, most people never learn its real power. The language… Read More »SED: Shell command to find and replace text inside a directory (multiple files)

wordpress-error

WordPress: Fix – Parameter 1 to fdl_the_content() expected to be a reference – error

Today, i moved my blog to a new server. Everything was set up easily. But, when i pulled out a blog post, everything was working correctly, except that the blog post content was missing. I then checked out my php error logs and found this “Parameter 1 to fdl_the_content() expected to be a reference, value… Read More »WordPress: Fix – Parameter 1 to fdl_the_content() expected to be a reference – error

xcode

iOS: Hide/Show the Status bar in an iPhone/iPad application

Lets see how to change the visibility of the status bar in an iphone/ipad application. The UIApplication class provides a centralized point of control and coordination for applications running on iOS. Every application must have exactly one instance of UIApplication (or a subclass of UIApplication). When an application is launched, the UIApplicationMain function is called;… Read More »iOS: Hide/Show the Status bar in an iPhone/iPad application

xcode

iOS: Change the Orientation of the Status Bar

Lets see how to change the orientation of the status bar programmatically in an iphone/ipad application. There are four orientations: Portrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight. The UIApplication class provides a centralized point of control and coordination for applications running on iOS. Every application must have exactly one instance of UIApplication (or a subclass of UIApplication). When… Read More »iOS: Change the Orientation of the Status Bar

xcode

iOS: How to get App’s Version number (CFBundleVersion)

  Recently, i had to make an update to one of my apps. I was trying to figure out a way to see if all the users have upgraded their app. I made the app to get the current version number and send it to the server. Here is, how you can get the current… Read More »iOS: How to get App’s Version number (CFBundleVersion)

Asianet(ISP) now showing Interstitial ads (intad.pag2p.co) along with their javascript injection.

  Asianet had been injecting javascript code to each webpage requested, for the past three months now. Now, they have started showing interstitial ads. When you type in a URL, you get redirected to an ad site (intad.pag2p.co) and then it immediately redirects to the site that you asked for. “They’re using a proxy. In… Read More »Asianet(ISP) now showing Interstitial ads (intad.pag2p.co) along with their javascript injection.

iOS: NSNotificationCenter – broadcast

iOS: NSNotificationCenter – broadcast information within a program

An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An NSNotificationCenter object is essentially a notification dispatch table. Objects register with a notification center to receive notifications (NSNotification objects) using the addObserver:selector:name:object: or addObserverForName:object:queue:usingBlock: methods. Each invocation of this method specifies a set of notifications. Therefore, objects may… Read More »iOS: NSNotificationCenter – broadcast information within a program

xcode

iOS: Check whether internet connection is available

Here, i am just checking whether network connectivity is available to a server and its done synchronously. You can use Reachability if you need notifications when there is any change in the network connectivity. For this you have to include the SystemConfiguration.framework in your project. Now add, #import “SystemConfiguration/SystemConfiguration.h” and the below function to your… Read More »iOS: Check whether internet connection is available

android

android.os.NetworkOnMainThreadException due to StrictMode.ThreadPolicy

StrictMode.ThreadPolicy was introduced since API Level 9 and the default thread policy had been changed since API Level 11, which in short, does not allow network operation (include HttpClient and HttpUrlConnection) get executed on UI thread. if you do this, you get NetworkOnMainThreadException.

Remove ui.streamride.net ads injected by ISPs (Asianet in my case)

Read it full here : Asianet(ISP) injecting javascript code(ads) in every webpage requested by the customer Here asianet(ISP) is injecting a javascript code into a website without the permission of the website owner and that’s against law. This is the piece of code they are inserting   I have informed the authorities about this, i… Read More »Remove ui.streamride.net ads injected by ISPs (Asianet in my case)

Asianet(ISP) injecting javascript code(ads) in every webpage requested by the customer

Update: Asianet(ISP) now showing Interstitial ads (intad.pag2p.co) along with their javascript injection.   Some of you out there, using Asianet, might have noticed that an ad is shown on the right side of each webpage you pull from the internet.     What i am seeing is an ad that is generated by the javascript,… Read More »Asianet(ISP) injecting javascript code(ads) in every webpage requested by the customer

iOS LOGIN Screen Tutorial with Server Authentication – JSON – PHP

This tutorial will guide you to create a simple app with a Login screen which takes username and password from the user and then posts it to a url and parses the JSON response form the server.

perl

Perl: Process an array or a hash inside a Template

Process and array or a hash inside a perl template #Print an Array named items [% FOREACH item IN items -%] [% item %] [% END -%] #Print a HASH named items [% FOREACH key IN items.keys.sort -%] [% key %]: [% terms.$key %] [% END -%] Enjoy coding! 🙂

ruby on rails

RubyOnRails: Create a Controller and Views for it using a single command

Lets create a controller named ‘home‘ with  views ‘index‘, ‘view2′ view3’. Fortunately, you can do that in a single command. Enter this command in your terminal: $ rails generate controller home index view2 view3 Rails will create several files for you, including app/views/home/index.html.erb. This is the template that will be used to display the results… Read More »RubyOnRails: Create a Controller and Views for it using a single command

magento-webshop

Magento: Check if an admin is logged in or not

If you are writing a custom module, and you want it to be accessed only by admins, then you possibly need the following code in your controller. //get the admin session Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’)); //verify if the user is logged in to the backend if(Mage::getSingleton(‘admin/session’)->isLoggedIn()){ echo “Admin Logged in”; } else { echo “You need to… Read More »Magento: Check if an admin is logged in or not

perl chat

Perl: Send a chat message to your gmail buddy using Jabber

Net::Jabber provides a Perl user with access to the Jabber Instant Messaging protocol. Net::Jabber is a convenient tool to use for any perl script that would like to utilize the Jabber Instant Messaging protocol. While not a client in and of itself, it provides all of the necessary back-end functions to make a CGI client… Read More »Perl: Send a chat message to your gmail buddy using Jabber

perl

Perl: Send a message to a queue or topic using Stomp

Net::Stomp module allows you to write a Stomp client. Stomp is the Streaming Text Orientated Messaging Protocol (or the Protocol Briefly Known as TTMP and Represented by the symbol :ttmp). It’s a simple and easy to implement protocol for working with Message Orientated Middleware from any language. Net::Stomp is useful for talking to Apache ActiveMQ, an open… Read More »Perl: Send a message to a queue or topic using Stomp

perl

Perl: Function to print a HASH completely

Below is a perl function that i wrote to print a HASH completely. What i mean by ‘completely’ is that it will expand all hashes and arrays found within the given HASH. sub print_hash { my ($hash,$str) = @_; while( my ($k, $v) = each %{$hash}) { print $str.”$k => $v\n”; if( $v =~ /hash/i… Read More »Perl: Function to print a HASH completely