Blog Stats
- 120,271 hits
My Tech Notebook
Feeling the heat from your laptop? Overheating and reduced battery life is common ‘phenomenon’ in Linux Mint. Jupiter was the best tool to reduce overheating in Linux desktop but since its development has stopped, you can use TLP or CPUFREQ instead of Jupiter. Install TLP using the following command:
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
No configuration required for using TLP. Install it and forget about it. If you want to use CPUFREQ, read this article how to use CPUFREQ to reduce overheating in Ubuntu.
Function
<?php
function
createTinyUrl(
$strURL
) {
return
$tinyurl
;
}
?>
<?php
echo
(createTinyUrl(
'http://www.richardcastera.com/2009/05/09/creating-a-tinyurl-with-tinyurl-api/'
));
?>
A URL shortener is a service that takes in a long URL and gives you a short and memorable URL that you can distribute to anyone you want. The service takes care of redirecting users who land up at the shortened URL to the original URL.
TinyURL, of course, was one of the pioneers in the field but ever since Micro blogging sites like Twitter started to take off, a number of services have come up that all provide essentially the same URL shortening service.
One major problem with using a third-party URL shortening service is that all your links are always bound to that one service and if they ever go out of business, like tr.im did, all your data is gone too. And that is why, if you’re serious about saving all the wonderful links that you’ve discovered from around the web, you might want to consider running your own URL shortening service.
YOURLS gives you exactly that.
First of all, you need to download YOURLS to your web server and unzip the package.
Now, use your favorite tool to create a mysql database for YOURLS. If you’re using a shared hosting provider, there must be a way to do this from inside your domain control panel. If not, just open a ticket with your hosting provider and let them handle it for you. I named my database ‘kunz_yourls‘.
Now, browse over to the includes directory and rename the file named ‘config-sample.php’ to ‘config.php’.
Open ‘config.php’ in a text editor and edit the following variables.
‘YOURLS_DB_USER’
YOURLS_DB_PASS
YOURLS_DB_NAME
YOURLS_DB_HOST
YOURLS_SITE
$yourls_user_passwords
The comments in the file are pretty self explanatory and you can also get an overview here.
Now, from your web browser, visit the site http://<website>/admin, where website is the domain name where you installed YOURLS. Click the “Install YOURLS” button.
If all went well, you will see the following message which means that YOURLS was successfully installed on your domain.
Browse over to http://<website>/admin/index.php and login using the username/password combination that you entered earlier in config.php. If you didn’t enter any, try username/password. That’s the default combination and that is why you should change it when you’re installing YOURLS.
Upon login, you’ll be able to create short URLs easily by just entering the complete URL in the prominently displayed text box and clicking “Shorten the URL” button.
You can even get some nice and simple statistics about the short URLs that you’ve created.
Be sure to check out the bundled tools. You get two cool bookmarklets that you can use to create short URLs right from your browser toolbar.
YOURLS also provides an API that you can take advantage of in custom applications and such.
Did you find YOURLS useful? Will you use it over, say, bit.ly? Let us know in the comments.
Source : http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/
If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This will redirect any requests to http://my-domain.com to http://www.my-domain.com. There are several benefits from doing that:
Note that if your site has already been indexed by Google without the www, this might cause unwanted side effects, like lost of PR. I don’t think this would happen, or in any case it would be a temporary issue (we are doing a permanent redirect, 301, so Google should transfer all rankings to the www version). But anyway, use at your own risk!
Something nice about the code above is that you can use it for any website, since it doesn’t include the actual domain name.
If you want to do the opposite, the code is very similar:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]
In this case we are explicitly typing the domain name. I’m sure it’s possible to do it in a generic way, but I haven’t had the time to work one out and test it. So remember to change ‘my-domain’ with your domain name!
Source: http://maketecheasier.com/transform-gedit-into-a-web-developer-ide/2010/12/29
Gedit is the default text-editor in Gnome based distro. To many, it may seems like a normal text-editor with no special functions (just like notepad in Windows), but for those regular users, they will swear by it and marvel at how powerful and versatile it can be. With its plugins system, it can easily transform itself from a basic text-editor to complicated and powerful programming IDE. Here’s how you can do it.
Note: For this tutorial, I will focus mainly on HTML, PHP and CSS since that are the web programming languages I used. You can modify it to suit your needs.
First, install the extra set of gedit plugins In your system.
sudo apt-get install gedit-plugins |
This will install the following plugins:
You won’t need all of them, but it is useful to have them readily available.
Gmate is an additional set of plugin for gedit to make it more similar to TextMate. It contains code snippets, plugins, and an automatic registration of rails-related files.
To install Gmate:
sudo apt-add-repository ppa:ubuntu-on-rails/ppa sudo apt-get update sudo apt-get install gedit-gmate exuberant-ctags |
Now that you have installed the extra plugins, it is time to activate and configure the necessary plugins. Open gedit and go to “Edit -> Preferences“. Click on the “Plugins” tab.
Scroll down the list and select the following plugins:
Note: The above plugins are the one that I used. You are free to activate/deactivate any other plugins.
Once you have activated the plugins, your gedit should now be equipped with syntax highlighting, auto-completion, tag list for quick insertion, color picker, class browser that display all your functions, file browser, bracket balancing etc.
The default tag list only comes with support for HTML and XSL. To add support for PHP, CSS and xHTML, we need to install additional set of tag list.
Download gedit_webdev_tags-0.1.tar.gz. Extract the content into a folder “taglist” in your Home directory. Open a terminal:
cd taglist sudo cp *.tags /usr/share/gedit-2/plugins/taglist |
Open your gedit, you should be able to see the tag list for CSS, PHP and xHTMLnow.
Clientside plugin for gedit is an useful plugin for web developer who deals with CSS and Javascript. It can minify and beautify javascript and CSS. It also includes jsLint and has option to gzip the current file.
First install the prerequisites:
sudo apt-get install nodejs php5-cli |
Download the ClientSide zip file.
Extract the zip file. Copy the “clientside.gedit-plugin” file and the “clientside” folder to “/home/USERNAME/.gnome2/gedit/plugins”. If the “plugins” folder does not exist, create it.
Go to your gedit. In the plugin section, activate the clientside plugin. Click on the Configure Plugin button. Enter the following:
How do I call NodeJS?: nodejs
How do I call PHP?: php
You can directly transfer your files to your server via FTP without a FTP client.
Open Nautilus File Manager and go to “File -> Connect to Server”. Connect to your FTP server. Remember to check the box “Add bookmark”.
In your gedit, open your side pane and go to the file browser. At the dropdown field, select “Bookmarks”. You should see the FTP server bookmark. You can click on it to connect to your server.
That’s it. Your gedit should be a fully functional web developing IDE now.
The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.
Here’s an excerpt:
4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 25,000 views in 2012. If each view were a film, this blog would power 6 Film Festivals
To remove windows activation key and Licence follow these steps:
slmgr /upk
and wait for this to complete. This will uninstall the current product key from Windows and put it into an unlicensed state.slmgr /cpky
and wait for this to complete. This will remove the product key from the registry if it’s still there.slmgr /rearm
and wait for this to complete. This is to reset the Windows activation timers so the new users will be prompted to activate Windows when they put in the key.Here is coupon code which will give a discount of $9.94 for your next hosting purchase from hostgator
While signing up , just enter this code : “manashoffer“, without double quotes.
Ah yes, I will get commission for it, and you will get discount. A perfect win-win situation 🙂
Today while sharing my Public folder , I was getting this error:
“net usershare add: cannot convert name “Everyone” to a SID + unexpected information received”.
Agter searching for a while, I found solution which worked from here : http://ubuntuforums.org/showthread.php?t=1982137
[1] Do not ever use gadmin-samba again for as long as you live.
[2] Purging the “samba” package will not resolve your discombobulated smb.conf file since that file doesn’t come from the “samba” package.
[3] Restore a factory fresh copy of smb.conf:
(**) Make sure the following file exists: /usr/share/samba/smb.conf
(**) Make a backup of your current smb.conf
sudo cp /etc/samba/smb.conf /etc/samba/smb.confMOD
(**) Start with a fresh one:
sudo cp -a /usr/share/samba/smb.conf /etc/samba/
(**) Correct one mistake in the new one:
Find the line:
encrypt passwords = false |
and change it to:
encrypt passwords = true |
(**) Restart samba
sudo service smbd restart