I faced again with problem of posting PHP code on blogger. So here is very simple and nice Code converter for posting code on Blogger.
http://francois.schnell.free.fr/tools/BloggerPaste/BloggerPaste.html
Wednesday, August 24, 2011
Simple Google Weather Unofficial Api
Hey guys. If you are searching for very simple google weather Unofficial api, so here is the code for it.
<?php
//Created by Roman Losev 2011
//http://pilotaz.blogspot.com/
//email: pilotaz@gmail.com
//Thanks for feedback.
$url = "http://www.google.com/ig/api?weather=Vilnius+Lithuania&hl=lt";
ini_set("user_agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0");
ini_set("content_type","text/xml; charset=\"UTF-8\"");
ini_set("accept_charset","utf-8;q=0.7,*;q=0.7");
ini_set("max_execution_time", 0);
ini_set("memory_limit", "1000M");
$xml = simplexml_load_file($url);
$image_size = "80";
$count = 0;
echo '<div id="weather" align="center">';
$img = IMG_URL."me/hero_bg.gif";
echo "<table border='0' width='400' style=\"background: url(".$img.") bottom left repeat-x #FFF; border: 1px solid #EEE; padding: 20px\">";
foreach($xml->weather as $item) {
echo "<tr><td colspan=\"4\" align='center'>Vilniuje šiandien: ".$item->current_conditions->temp_c['data']."° C, ".$item->current_conditions->humidity['data'].", ".$item->current_conditions->wind_condition['data']."</td></tr><tr>";
foreach($item->forecast_conditions as $new) {
echo '<td style="padding: 4px;" align="center"><div class="weatherIcon">';
echo '<img src="http://www.google.com/' . $new->icon['data'] . '"/ width="'.$image_size.'" height="'.$image_size.'" style="border: 1px solid #a1a1a1"><br/>';
echo $new->day_of_week['data'].": ".$new->low['data']." - ".$new->high['data']."° C";
echo '</div>';
echo "</td>";
}
}
echo "</tr></table>";
echo '</div><br>';
?>
[Solution] user agent stylesheet override site stylesheet on Chrome but not Firefox
My problem was this: i wanted to put bold on text which was in select's option by putting style - wont-weight. I had succeed only on Firefox. Because chrome user agent stylesheet were overriding my stylesheet.
I tried to solve the problem for hours. Finally with my friend's help i found the website - electrictoolbox. And it says that only firefox allows to do that... that means we cant use wont-weight on chrome for option, select and optgroup.
My solution was for the bold text changing wont-weight style into color, with dark color for normal text and lighter color for bold required. Also i needed disabling option of bold, so i just added " disabled='disabled' ". That is all..
My result:
Good luck.
Thursday, August 4, 2011
PHP string replace all except numbers and chars
Here is PHP function(code) to remove all but not characters and numbers.
http://pilotaz.blogspot.com/2011/05/php-remove-all-characters-and-leave_29.html
$result= preg_replace("/[^a-zA-Z0-9]+/", "", $text);p.s. If you are looking to delete everything but numbers, than look here:
http://pilotaz.blogspot.com/2011/05/php-remove-all-characters-and-leave_29.html
Monday, August 1, 2011
PHP multidimensional array check
Today i faced with problem that array had array inside it. It means that the array is multidimensional. So i was forced to recheck the array check with function is_array to new check. Here is the code of check:
function is_multi($a) { $rv = array_filter($a,'is_array'); if(count($rv)>0) return true; return false; }
Source: http://stackoverflow.com/questions/145337/checking-if-array-is-multidimensional-or-not
Big thanks to Vinko Vrsalovic
Friday, July 29, 2011
CSS compressor
Today i have created my own css compressor. I often do css compression, but i always used other sites. So today i created my own and using it! All you need just copy your css code, paste into css code field and press compress. The compressor will compress css code for you. Mostly i get 20% compressed code. Compression can be high and can be low, it all depends on your CSS code writing. The more compressed code you write, the less it will be need to compress.
So now you dont need to write it compressed. Just write as you like and after compress into compact size called "min" aka "mini" ( most of programmers use .min tag for jquery files , like jquery.blabla.min.js )
Screenshot:
Source:
CSS compressor
So now you dont need to write it compressed. Just write as you like and after compress into compact size called "min" aka "mini" ( most of programmers use .min tag for jquery files , like jquery.blabla.min.js )
Screenshot:
Source:
CSS compressor
Saturday, July 16, 2011
Create table with auto increament id
i always use sql code to create table with auto increament id, because some times some servers dont allow to do one with auto increament id.
here is a code to do that:
here is a code to do that:
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=MyISAM;
Monday, July 11, 2011
Ping domain
Have you ever tried to ping any site or domain? The site will allow you to do this - http://www.igloro.info/en/ping.html
Once you are there, just type your desired url or domain name and press Ping.
My outcome:
Once you are there, just type your desired url or domain name and press Ping.
My outcome:
http://pilotaz.blogspot.com is Alive (76 ms)
RGB test
Have you ever wanted to test how looks one or another rgb hex code? So the page will allow you to do the trick - http://www.igloro.info/en/rgbtest.html .
It is very easy to use. Just enter your desired rgb hex value and press test.
Site description:
My outcome:
It is very easy to use. Just enter your desired rgb hex value and press test.
Site description:
RGB test - is a tester which allows you to test how hex color could look.source: http://www.igloro.info/en/rgbtest.html
My outcome:
RGB: #c0c0c0Red: 192, Green: 192, Blue: 192Inverse RGB: #3f3f3fRed: 63, Green: 63, Blue: 63
Pagerank counter
All websites has their own pagerank. And you can check your website's page rank on various pagerank counter's pages.
One of the pagerank counter pages is: http://www.igloro.info/en/pagerank.html
Description of the page:
1. enter website url
2. press check.
My outcome:
One of the pagerank counter pages is: http://www.igloro.info/en/pagerank.html
Description of the page:
Check your site's pagerank here. Igloro pagerank counter is one of methods which calculates and determine what your site's google page rank ( Google PR ) is. Important pages receive a higher PageRank and are more likely to appear at the top of the search results. Google Pagerank is a measure from 0 to 10. Google Pagerank is based on backlinks. More good quality backlinks you have, better for your site. Improving your Google page rank (building quality backlinks) is very important if you want to improve your search engine rankings.Function of the page is easy.
1. enter website url
2. press check.
My outcome:
http://pilotaz.blogspot.com Page Rank is: 1
2011-06-10: http://pilotaz.blogspot.com Page Rank was: 0
Md5 generator
Md5 is coding. And most of time it used for mysql database's passwords. After coding password with md5 you will get 25 chars length string.
There are a lot of good md5 generators, example:
Sometimes people required to create md5 force way. So just input your password or whatever else string into string field and press genereate md5.
Here is my result for "password" string md5 generation:
md5: 5f4dcc3b5aa765d61d8327deb882cf99sha1: 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8md4: 8a9d093f14f8701df17732b2bb182c74crc32b: 35c246d5crc32: bbeda74fmd2: f03881a88c6e39135f0ecc60efd609b9
Wednesday, July 6, 2011
Web development - seo keywords optimization tools - my new blog
So, few days ago i created my new blog for my new project - igloro.info ( You are all welcome to visit my new blog here: http://seokeywordstools.blogspot.com/ ). I write update's news there and description about all tools we are created.
Saturday, July 2, 2011
Seo keywords optimization tools.
Currently working on my own new project. In the project im trying to create tool for monitoring seo keywords of other projects.
I have a lot fun and im trying to use most newest tools to create it. There already is some good tools, like keywords searching, google pagerank counter, urls counter, google analytics monitoring and much much more coming!
Hope to see some testers there and ill would like to hear some suggestions from your side if you are very interested in it.
It is a bit bugged for now but ill fix everything very soon.
Also it will be multi language project. But for beggining there will be only 2 languages - Lithuanian and English.
Source: http://www.igloro.info
Thursday, June 16, 2011
Optimize your website
At work as programmer i need to optimize page load time.
So here is some tweaks which you can use for your own web sites.
1. Optimizing your CSS and JS ( Javascript, Jquery and so on... ).
All pages uses css and js. Most of time they are huge. like 50-500 kb for css and same for JS.
Most of time i use the tool to see how fast my page is loading:
http://tools.pingdom.com
Best way to optimize CSS is:
Explode CSS files by parts and use only required ones for pages you are using. After compress it with such tools as http://www.cssdrive.com/index.php/main/csscompressor. And in same time combine these ones together into one single load ( search google for CSS.php combiner ).
Best way to optimize JS is:
Explode by files and use only required code you are using. Compress these files with tools like this: http://www.compress-javascript.com/ ( Some codes don't work after compress, you can try to find another good compressor which will compress better than this one. Let me know if you find anything.. )
In same time combine them with combiners into one file. ( search google for JS.php combiner ).
2. Cache! Best way to optimize website is to use cache.
There also some good tweaks about cache. For example using GZIP cache.
Most of time gzip compressed code with 80% success. For example if you code is 100kb, gzip will compress into 20kb and load it into user browser.
To check gzip compression im using such tools as this one: http://www.whatsmyip.org/http_compression/
3. Images! Less images - better. But as you know, logos and so on.. are important for web sites.
Big web sites as facebook using very nice technique - one big image with all images: http://static.ak.fbcdn.net/rsrc.php/v1/zi/r/uVYVvAILt0K.png
4. HTML, PHP code optimization gives some results too. Spaces, tabs, else { } and so on are pretty good on lowering some kbs...
but each kb less will be some gigabytes less for server load per day-week-month if your web site is big!.
5. Javascript lazyloading - it is very nice tool for loading images. It will load image only if user sees the image. If the image is not in visible spot, it will not be loaded.
Source: http://www.appelsiini.net/projects/lazyload
And remember, that visitor is important of all web sites!
So here is some tweaks which you can use for your own web sites.
1. Optimizing your CSS and JS ( Javascript, Jquery and so on... ).
All pages uses css and js. Most of time they are huge. like 50-500 kb for css and same for JS.
Most of time i use the tool to see how fast my page is loading:
http://tools.pingdom.com
Best way to optimize CSS is:
Explode CSS files by parts and use only required ones for pages you are using. After compress it with such tools as http://www.cssdrive.com/index.php/main/csscompressor. And in same time combine these ones together into one single load ( search google for CSS.php combiner ).
Best way to optimize JS is:
Explode by files and use only required code you are using. Compress these files with tools like this: http://www.compress-javascript.com/ ( Some codes don't work after compress, you can try to find another good compressor which will compress better than this one. Let me know if you find anything.. )
In same time combine them with combiners into one file. ( search google for JS.php combiner ).
2. Cache! Best way to optimize website is to use cache.
There also some good tweaks about cache. For example using GZIP cache.
Most of time gzip compressed code with 80% success. For example if you code is 100kb, gzip will compress into 20kb and load it into user browser.
To check gzip compression im using such tools as this one: http://www.whatsmyip.org/http_compression/
3. Images! Less images - better. But as you know, logos and so on.. are important for web sites.
Big web sites as facebook using very nice technique - one big image with all images: http://static.ak.fbcdn.net/rsrc.php/v1/zi/r/uVYVvAILt0K.png
4. HTML, PHP code optimization gives some results too. Spaces, tabs, else {
but each kb less will be some gigabytes less for server load per day-week-month if your web site is big!.
5. Javascript lazyloading - it is very nice tool for loading images. It will load image only if user sees the image. If the image is not in visible spot, it will not be loaded.
Source: http://www.appelsiini.net/projects/lazyload
And remember, that visitor is important of all web sites!
Sunday, May 29, 2011
PHP remove all characters and leave only numbers
function which will remove all but leave only numbers for php:
p.s. If you are looking for function to delete all except chars and numbers look here:
http://pilotaz.blogspot.com/2011/08/php-string-replace-all-except-numbers.html
$string = preg_replace('#[^0-9]#','',strip_tags($string));
p.s. If you are looking for function to delete all except chars and numbers look here:
http://pilotaz.blogspot.com/2011/08/php-string-replace-all-except-numbers.html
Friday, May 27, 2011
Broken image. Failed to load images fix with JQuery
Today i was solving problem with failed to load images. There was 2 solutions for this - 1) php with getimagesize and 2) JQuery check.
getimagesize showed me warnings so my choice was JQuery.
And it was great choice, because using jquery is always fun.
Code i used for all img ( CSS attribute ):
getimagesize showed me warnings so my choice was JQuery.
And it was great choice, because using jquery is always fun.
Code i used for all img ( CSS attribute ):
$(window).load(function() {
$('img').each(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
// image was broken, replace with your new image
this.src = 'http://www.example.com/replace_no_image.jpg';
}
});
});
Tuesday, May 24, 2011
MYSQL - Deleting duplicated entries huge DB
The problem occurred when i had to delete duplicated entries
like this:
id name value
502 john null
503 john null
1000 john smith
solution for this was to group by name and export them to other table
so here is mysql codes:
1. Exporting to new table
2. Renaming old and new tables ( 'different-new-table-name' , not new-table-name )
3. And finaly renaming new table to old table's name
like this:
id name value
502 john null
503 john null
1000 john smith
solution for this was to group by name and export them to other table
so here is mysql codes:
1. Exporting to new table
CREATE TABLE new-table-name as
SELECT * FROM old-table-name WHERE 1 GROUP BY [column by which to group];
2. Renaming old and new tables ( 'different-new-table-name' , not new-table-name )
RENAME TABLE old-table-name TO different-new-table-name;
3. And finaly renaming new table to old table's name
RENAME TABLE new-table-name TO old-table-name;
Monday, May 16, 2011
Google chrome Program too big to fit in memory [ Solution ]
Today for first time i meet the problem.
I was browsing as always... many tabs - like 10. Most of them are text. Suddenly my pc showed BSOD. After restart google chrome want start. And shows cmd windows for a second.
With cmd.exe ( start > cmd.exe ) , you can run same google chrome to see error message. It was - "Program too big to fit in memory".
After some google searches i read nothing interesting but only complains and questions about the problem.
I was not worried about my bookmarks because im using google sync.
1. So i just opened firefox.
2. Went to Google Chrome download page.
3. Downloaded / Ran setup
4. After installation all came back to normal.
Also last session was saved... and i could see pages which was opened before BSOD.
In worst situation you can lose your bookmarks. So its up to you...
Leave a comment if your bookmarks haven't erased after install. If you didn't used google sync. Cheers.
Hope it will help you guys.
Thursday, May 5, 2011
Input is not proper UTF-8, indicate encoding !
I faced with the error while exporting huge xml.
My solution for this was changing the code:
Into this:
Hope it will help you solving your problem.
Anyways. Good luck!
My solution for this was changing the code:
foreach($adData as $itemData )
{
$xmlData .= "<item><![CDATA[".$itemData."]]></item>";
}
Into this:
foreach($adData as $itemData )
{
$table = array('&' => '&', '<' => '<', '>' => '>', '"' => '"');
$data = str_replace(array_keys($table), array_values($table), $itemData);
$date = str_replace(" ","",$data); //there is one strange square symbol. after converting into chars //for blogspot it was removed :(
$data = htmlspecialchars(html_entity_decode($data, ENT_QUOTES, 'UTF-8'), ENT_NOQUOTES, 'UTF-8');
$xmlData .= "<item><![CDATA[".$itemData."]]></item>";
}
Hope it will help you solving your problem.
Anyways. Good luck!
Friday, April 22, 2011
Video editor online free - JayCfut
I was trying to find freeware which will silent videos audio track and add another one. I tried some of freewares like - wax , windows movie maker, avidemux ( linux video editor on windows ). Maybe they are good and maybe im not so experienced for the freewares but i found better free ware for myself - jaycut.com . It is website which contains java video editor, and so you can edit videos online.
After finishing your project it will generate file and send url to your e-mail.
Website of the project: http://jaycut.com/
A little about JayCut:
Why edit video online?
No need for downloads or installs
Instant access via any web browser
No specific hardware requirements
Access uploaded content anywhere, anytime
Works on all computers and browsers
Use content on the web in movies, e.g. YouTube videos
Collaborative editing, work together with other users from around the world.
Fueled by a passion for web video and creativity, JayCut was founded in 2007 and has since worked with some of world’s leading brands and received several prestigious awards.
In early 2006 we started asking ourselves if web video couldn't be about more than just consumption. We wanted to add creativity into to the equation. Nine months later, in December 2006, we had laid the foundation for what would come to be the world's most advanced technology for online video editing. The company was founded early 2007 and since 2008 we license the video editing tool to other companies and websites.
Today, JayCut is a privately held company based in Stockholm, Sweden. Our customers include some of theworld’s leading brands, and the company and technology has received some of the most prestigious awards in the industry. But our firm belief is that we've just scratched the surface of what web video can be.
Ask yourself what would happen if anyone could edit video, anywhere, with any mobile device, using any media on the web and finally publish the result to any device or website. Join us in starting this creative revolution!
Video i created:
Subscribe to:
Posts (Atom)





