Blogvaria

This page is brought to you by Blogvaria (http://blog.evaria.com).

To obtain more information, ask questions and interact please visit our website.

Back to Blogvaria landing page
Feedback
Subscribe
   
Blogvaria

 

The personal pages

Posts filed in 2010

Using PHP to print only the first sentence

Ever wanted to pull just the first sentence of a text and print it? If yes, this is for you.

Simply add the following code (in PHP) to your page/system before the actual HTML stuff begins:

< ?php
function getFirstSentence($string)
{
    // First remove unwanted spaces - not needed really
    $string = str_replace(" .",".",$string);
    $string = str_replace(" ?","?",$string);
    $string = str_replace(" !","!",$string);
    // Find periods, exclamation- or questionmarks with a word before but not after.
    // Perfect if you only need/want to return the first sentence of a paragraph.
    preg_match('/^.*[^\s](\.|\?|\!)/U', $string, $match);
    return $match[0];
} 
?>

Then call the function somewhere on the page where you want the text to appear:

< ?php
    // The $string below could/should be a text string pulled from your database or similar
    $string = "Lentence oneasdasd asd asd asdasd, ?. Sentence two? Sentence three! Sentence four.";
    echo getFirstSentence($string);
?>

Comes in handy for search result pages, page titles and similar listings.

Filed under Programming | Comments off

World Cup 2010 Calendar

Keep yourself up-to-date with this nifty calendar showing all games and results from this years World Cup in football. Simply click the image below to open it:

May the best team win – I’m betting on Spain :)

Filed under Entertainment | 1 Comment

The World’s Most Expensive Heavy Bike

Dodge Tomahawk is a bike which was produced by Dodge manufacturers and it was unveiled in “North American International Auto Show” in 2003. It has a very unusual design that inspire every bike admirer and especially the “speed bike lovers”. It has a 8.3 L V10 engine which can produce 500hp. It has a maximum speed of 370 miles per hour which produces torque of 712 Nm. Its front brake has 16 piston disk and back brake has 8 piston disk. The weight of bike is approximately 1500 pounds (680 kg) and has price about $ 555,000. I also like to mention its fuel capacity which is 12.3 liters.

More info and photos here.

Filed under Gadgets | Comments off

Rachmaninov had big Hands

Great little music show. Make sure you watch all – have a great weekend :)

Filed under Entertainment, Music & Hi-Fi | Comments off

How to remove the active/focus borders

I’m sure you have noticed that when you click a hyper link, and especially a linked image, a dotted border appears around it. Have a look at CSSplay for more examples and proper CSS code fix related to this.

A few quick solutions

For those of us using the jQuery Java framework the “solution” is incredibly simple. Just call the following function in your header and all dotted borders are gone:

jQuery("a").focus(function(){this.blur()});

Using CSS it’s almost as simple (at least for all browsers except IE):

a:focus {outline-style: none;} 

Using basic JavaScript the following should do the trick:

for(var i=0;elm=document.links[i];i++)
{
elm.onfocus=function(){elm.blur();};
}

Some would probably say that this shouldn’t be done because the active/focus dotted border is there to show visitors who are using tabbed link selection which link is selected. But when we are using CSS we can style our own active/focus state and in this case the dotted border is not so necessary. I’ll appreciate your take on this as I’ve debated this “issue” with some of my clients on several occasions.

Filed under CSS & Design, Programming | Comments off


Page 3 of 6«123456»

Quick links - Blogvaria time links [ sitemap ]

2012 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2011 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2010 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2009 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2008 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2007 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

2006 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec

Akismet has protected Blogvaria from 122,261 spam comments. Design by Evaria.com. Powered by WordPress.
Our beloved and trusted server has rendered 1.140 pages so far today, an amazing 2.241 pages yesterday
and even more astonishingly 935.352 pages since 19 Feb 2012 alone without dropping a byte nor a pixel.

Close
E-mail It