Find out why a program can't seem to access to a file

2010-05-05 2 min read Fedora Linux

$ strace php tias.php -e open,access 2>&1 | <a class="zem_slink freebase/en/grep" href="http://en.wikipedia.org/wiki/Grep" title="Grep" rel="wikipedia">grep foo.txt Sometimes a program refuses to read a file and you&#8217;re not sure why. You may have display_errors turned off for <a class="zem_slink freebase/en/php" href="http://www.php.net/" title="PHP" rel="homepage">PHP or something. In this example, fopen(&#8217;/var/www/test/foo.txt&#8217;) was called but doesn&#8217;t have read access to foo.txt.

Strace can tell you what went wrong. E.g., if php doesn&#8217;t have read access to the file, strace will say &#8221;EACCESS (Permission denied)&#8221;. Or, if the <a class="zem_slink freebase/guid/9202a8c04000641f8000000000220ffa" href="http://en.wikipedia.org/wiki/Path_%28computing%29" title="Path (computing)" rel="wikipedia">file path you gave doesn&#8217;t exist, strace will say &#8221;ENOENT (No such file or directory)&#8221;, etc.

Continue reading

Download youtube video directly from the command line with youtube-dl

2010-05-03 2 min read Fedora Uncategorized

If you keep searching for applications to <a class="zem_slink freebase/en/uploading_and_downloading" title="Uploading and downloading" rel="wikipedia" href="http://en.wikipedia.org/wiki/Uploading_and_downloading">download the <a class="zem_slink freebase/en/youtube" title="YouTube" rel="homepage" href="http://www.youtube.com/">youtube videos or you keep searching for the firefox addons to download the embedded the video, then this is for you. Ofcouse that is the case, only if you do not want to copy it after you have watched it in the <a class="zem_slink freebase/en/web_browser" title="Web browser" rel="wikipedia" href="http://en.wikipedia.org/wiki/Web_browser">browser :). If you have already watched it then you can copy it from the <a class="zem_slink freebase/en/mozilla_firefox" title="Firefox" rel="homepage" href="http://www.mozilla.com/en-US/firefox/">Firefox cache. I will post on that later for now lets see youtube-dl.

Continue reading

captcha\’s implemented finally.

2010-04-30 1 min read Linux

For last couple of time I had tried to set the captcha to avoid spam. Getting nearly 2-3 spam now everyday and is on the increasing side, so finally I worked out to put the spam control meaasure – captcha&#8217;s.

With the captcha&#8217;s in place, I have removed the moderation on the comments, but still reserver the right to remove a comment without any reason.

If you find any issues with the captcha let me know at wordpress@amit-agarwal.co.in

Continue reading

AndreaMosiac.. The way to create a mosaic.

2010-04-30 1 min read Linux

<a href="http://www.andreaplanet.com/andreamosaic/download/" target="_blank">Download from here, AndreaMosaic. It us cinoketekt free for personal use and does just what the name says, creates mosaic. I tried this on Linux and was flawless with wine. Good show πŸ™‚

Here&#8217;s how to use it:

Start AndreaMosaic

<img class="size-full wp-image-657" title="andreamosaic" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/screenshot-andreamosaic2.jpg" alt="andreamosaic" width="585" height="477" /><div class="zemanta-pixie">and select your base file by clicking on the &#8221;+&#8221;:<img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/pixy.gif" alt="" />

<div class="zemanta-pixie">

<img class="size-full wp-image-658" title="andreamosaic" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/screenshot-andreamosaic.jpg" alt="Base image" width="585" height="477" />

<div class="zemanta-pixie">And now select the images that would tile to give you the base image. Click on select tiles:
<div class="zemanta-pixie"><img class="alignnone size-full wp-image-659" title="tiles" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/tiles.jpg" alt="tiles" width="602" height="452" /> <div class="zemanta-pixie"> <div class="zemanta-pixie">To start off, click on ok and then create mosaic on the initial window and you get your first mosaic. Here&#8217;s an example: <div class="zemanta-pixie"><img class="alignnone size-full wp-image-660" title="mosaic" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/mosaic.jpg" alt="mosaic" width="450" height="319" /> <div class="zemanta-pixie"> <div class="zemanta-pixie">There are various settings you can tweak to get different effects, so enjoy πŸ™‚

Continue reading

Local DNS Server for faster DNS response time

2010-04-30 1 min read Fedora Linux

Here&#8217;s a quick tip for faster DNS response time. I installed a local DNS server which can contact the remote DNS server and enabled caching for the local DNS server. This ensures that the response time for the DNS queries is much faster.

I am on Fedora 10, so here&#8217;s what I was required to do:

yum install dnsmasq

After this I created a file called /etc/resolve.dns with the nameserver address&#8217;s and heres what it looks like:

Continue reading

Delete all files in a folder that don't match a certain file extension

2010-04-30 1 min read Bash Fedora Linux

$ rm !(.foo|.bar|*.baz)

Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.

  • <a href="http://www.commandlinefu.com/commands/view/5351/delete-all-files-in-a-folder-that-dont-match-a-certain-file-extension">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/hutch">View all commands by <a href="http://feeds2.feedburner.com/commands/by/hutch">hutch

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/0/di" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/1/di" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/TCRb2ku_V1Y" alt="" width="1" height="1" align="bottom" />

Continue reading
Older posts Newer posts