OpenID for non-SuperUsers

2010-09-07 2 min read Learning Uncategorized

Based on the results of my Unobtrusive <a class="zem_slink" title="OpenID Foundation" rel="homepage" href="http://openid.net">OpenID post, it is quite evident that there is a lot of partial <a class="zem_slink" title="Knowledge" rel="wikipedia" href="http://en.wikipedia.org/wiki/Knowledge">knowledge about OpenID out there. While my knowledge on the subject is far from complete, this post is my attempt to share what I have learned with others.

The target audience for the bulk of this post is people who are capable of adding autodiscovery links to their blog templates, may be able to install a small <a class="zem_slink" title="PHP" rel="homepage" href="http://www.php.net/">PHP script and/or know what a <a class="zem_slink" title="Hypertext Transfer Protocol" rel="wikipedia" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP <a class="zem_slink" title="List of HTTP headers" rel="wikipedia" href="http://en.wikipedia.org/wiki/List_of_HTTP_headers">header is.

Continue reading

Adding a sub-menu in the wordpress admin menu :)

2010-07-29 2 min read Wordpress

For the impatient ones, first the code:
(in wp-admin folder, open the file menu.php) and locate the code:

$submenu[&#8217;edit.php&#8217;][10]  = array( _x(&#8217;Add New&#8217;, &#8217;post&#8217;), &#8217;edit_posts&#8217;, &#8217;post-new.php&#8217; );

and add the below:

$submenu[&#8217;edit.php&#8217;][7]  = array( _x(&#8217;Pending&#8217;, &#8217;post&#8217;), &#8217;edit_posts&#8217;, &#8217;edit.php?post_status=pending&post_type=post&#8217; );

And now the explanation and why do you need this 🙂

Problem:

There is no direct mechanism to access the pending posts in WP admin. I generally post through email and mark them as pending. So, whenever I go to my admin POSTs page, I will look through the list of pending items and post them as and when required. For this, when I am done with changes in one item, I need to either modify the address bar or need to go to posts link and then click the Pending items.

Continue reading

Browser or User agent identification with php.

2010-06-09 1 min read Linux

<a href="http://apptools.com/phptools/browser/source.php">Link

This is a link to very nice code to identify the browser used by the user. I have put a test program with this <a href="http://amit-agarwal.co.in/find_browser.php">here.<a class="performancingtags" href="http://technorati.com/tag/browser" rel="tag">

Verify all the paths in the PATH directory

2010-06-08 1 min read Bash Learning Linux

Here is the command to test that all the directories in your path actually exist.

(<a class="zem_slink freebase/en/internal_field_separator" title="Internal field separator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Internal_field_separator">IFS=:;for p in $PATH; do test -d $p || echo $p; done)

And the explanation :

Set the IFS to &#8221;:&#8221;

now we loop through the PATH variable

and test all the directories with &#8221;test -d&#8221;

Here is another version without IFS:

for i in ${PATH//:/ };do test  -d $i || echo $i;done

Continue reading

vim – get names of the scripts and the details from the command line

2010-05-19 1 min read Learning Linux Vim Tips

For the below commands either you can set the two variables in bold and then run the scripts or change the following in the commands and run the scripts.

If you have html2text installed then you can use this:

wget -o /dev/null -O $script_id_file &#8217;http://www.vim.org/scripts/script.php?script_id=&#8217;$script_id |html2text

If you dont have html2text installed then you can use:

wget -o /dev/null -O $script_id_file &#8217;http://www.vim.org/scripts/script.php?script_id=&#8217;$script_id<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.inquisitr.com/55496/twilight-eclipse-script-allegedly-leaked/">Twilight Eclipse Script Allegedly Leaked (inquisitr.com) <li class="zemanta-article-ul-li"><a href="http://huddledmasses.org/powershell-script-club-in-rochester-on-wednesday/">PowerShell Script Club in Rochester on Wednesday (huddledmasses.org) <li class="zemanta-article-ul-li"><a href="http://blogs.adobe.com/acrolaw/2010/02/add_a_flatten_document_menu_item.html">Add a Flatten Document Menu Item to Acrobat (blogs.adobe.com) <li class="zemanta-article-ul-li"><a href="http://codebetter.com/blogs/james.kovacs/archive/2010/02/25/the-exec-problem.aspx">The Exec Problem (codebetter.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/d25e9b6c-aca3-4008-9a3c-3403140d32e0/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e38.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading

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
Older posts Newer posts