Detecting URLs in a Block of Text

2010-03-31 4 min read Bash

Jan Goyvaerts on <a href="http://www.regex-guru.info/2008/11/detecting-urls-in-a-block-of-text/" target="_blank">Detecting URLs in a Block of Text

In his blog post <a href="http://www.codinghorror.com/blog/archives/001181.html">The Problem with URLs points out some of the issues with trying to detect URLs in a larger body of text using a regular expression.

The short answer is that it can’t be done. Pretty much any character is valid in URLs. The very simplistic <span class="regex">\bhttp://\S+ not only fails to differentiate between punctuation that’s part of the URL, and punctuation used to quote the URL. It also fails to match URLs with spaces in them. Yes, spaces are valid in URLs, and I’ve encountered quite a few web sites that use them over the years. It also forgets other protocols, such as https.

Continue reading

monkeystudio IDE on Fedora 12.. IDE of choice

2010-03-30 2 min read Learning Linux

<a href="http://www.monkeystudio.org/" target="_blank">Monkey IDE is a Free <a class="zem_slink freebase/en/cross-platform" title="Cross-platform" rel="wikipedia" href="http://en.wikipedia.org/wiki/Cross-platform">crossplatform <a class="zem_slink freebase/en/qt" title="Qt (framework)" rel="homepage" href="http://qt.nokia.com/">Qt 4 IDE

MonkeyStudio is a crossplatform <a class="zem_slink freebase/en/integrated_development_environment" title="Integrated development environment" rel="wikipedia" href="http://en.wikipedia.org/wiki/Integrated_development_environment">Integrated Development Environment ( IDE ) aiming to become a <a class="zem_slink freebase/en/rapid_application_development" title="Rapid application development" rel="wikipedia" href="http://en.wikipedia.org/wiki/Rapid_application_development">Rapid Application Development ( RAD ) environment. MonkeyStudio runs everywhere Qt 4.4.0 ( minimum required to build it ) is available as a <a class="zem_slink freebase/en/library" title="Library (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Library_%28computing%29">shared library. It is extensible via a great and powerful <a class="zem_slink freebase/en/plugin" title="Plug-in (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Plug-in_%28computing%29">plugin system which help make it do nearly anything you want and support virtually any kind of project type for which a plugin exists or is created. The primary goal of MonkeyStudio was to manage Qt4 projects as best as possible, it directly uses .pro files and does not create intrusive or unsightly <a class="zem_slink freebase/en/configuration_file" title="Configuration file" rel="wikipedia" href="http://en.wikipedia.org/wiki/Configuration_file">configuration files. MonkyStudio is also a multi language <a class="zem_slink freebase/en/source_code_editor" title="Source code editor" rel="wikipedia" href="http://en.wikipedia.org/wiki/Source_code_editor">code editor too ( javascript, xml, … ).

Continue reading

Extract all urls from the last firefox sessionstore.js file used.

2010-03-29 0 min read Linux
\"Effective
Image via Wikipedia

Some taken from commandlinefu. What all the below commands are doing is basically that the url: is captured from the sessionstore.js file and then just  extract the URL from the line. These are done in various ways using perl, <a class="zem_slink freebase/en/sed" title="Sed" rel="wikipedia" href="http://en.wikipedia.org/wiki/Sed">sed and <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk:

Continue reading

vim scripts and tips

2010-03-29 1 min read Linux Vim Tips

Here are few of the links for vim that you can use. It consists of the link to vimrc, colorscheme, syntaxcomplete and zzsplash.
<a href="http://vim.wikia.com/wiki/User:Tonymec/vimrc">http://vim.wikia.com/wiki/User:Tonymec/vimrc
<a href="http://vim.wikia.com/wiki/User:Tonymec/almost-default.vim">http://vim.wikia.com/wiki/User:Tonymec/almost-default.vim
<a href="http://vim.wikia.com/wiki/User:Tonymec/syntaxcomplete.vim">http://vim.wikia.com/wiki/User:Tonymec/syntaxcomplete.vim
<a href="http://vim.wikia.com/wiki/User:Tonymec/zzsplash.vim">http://vim.wikia.com/wiki/User:Tonymec/zzsplash.vim<table cellspacing="0" cellpadding="0" width="100%"> <h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/02/02/bash-script-to-change-the-vim-colorscheme-from-the-list-of-locally-available-schemes/">bash script to change the vim colorscheme from the list of locally available schemes (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://www.prweb.com/releases/2010/03/prweb3740684.htm">Wikia Introduces New Tools For People to Create Wiki Answer Sites on Any Topic (prweb.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/a04b9f08-df03-476c-b6d3-a1d32078cb64/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b68.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading

Change cursor and couple of other settings in window managers like fluxbox and fvwm (except gnome and KDE)

2010-03-28 2 min read Fedora Linux

First off, get cursor theme from <a href="http://gnome-look.org/index.php?xsortmode=high&page=0&xcontentmode=36" target="_blank">here. You can download the one of your choice. Now create a directory &#8221;~/.icons&#8221; if it does not exist. Extract the file you just downloaded in this directory. [If you are using GNome then you could have dropped the tar file itself in the Desktop properties window and selected the theme from there. I have since the days of RH9 not used KDE and so am not sure how to do this in KDE, sorry guys.]

Continue reading

Break Free and let firefox remember all the passwords even the ones that are not saved by default

2010-03-28 2 min read Fedora Linux

Here we go against one more security policy of most of the sites like Bank and paypal and so on. These sites do not allow Firefox or any other browser to save the password. This is using some tags in the html/code of the page that would mark the field as not completeable or savable. So, what do you do?

I am on a home computer to which no one has access so why not save the password!! Let do it. There are couple of hacks that have been found to make firefox remember all the passwords. Here are a few of them (but Linux is not covered in any of them).<h1 id="article-title"><a title="Permanent Link to Tweak Firefox’s Password Saver Without An Extension" rel="bookmark" href="http://cybernetnews.com/2006/06/07/tweak-firefoxs-password-saver-without-an-extension/">Tweak Firefox’s Password Saver Without An Extension <h1 id="article-title"><a title="Permanent Link to Make Firefox Remember Passwords without a Bookmarklet" rel="bookmark" href="http://cybernetnews.com/2009/02/13/firefox-remember-passwords/">Make Firefox Remember Passwords without a Bookmarklet

Continue reading

Search & replace with find & ed

2010-03-28 0 min read Bash Learning Linux
\"Computer
Image via Wikipedia

function sr() {

declare pattern replacement name usage
declare -i pvar=0 rvar=0 tvar=0

usage='usage: sr [-t ] [-n name] [-p pattern] [-r replacement] [– ] [dir1 dir2 …]'

# cf. <a href="http://bsdpants.blogspot.com/2007/02/option-ize-your-shell-scripts.html">http://bsdpants.blogspot.com/2007/02/option-ize-your-shell-scripts.html

while [[ "${1:0:1}" == '-' ]] ; do

[[ "${1}" == '–' ]] && { shift; break; } # – marks end of options

Continue reading
Older posts Newer posts