<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom"><generator uri="http://www.habariproject.org/" version="0.10-alpha">Habari</generator><id>tag:mattread.com,2020-02-06:habari/8570b76d965d9aabc07ffb82b7ac6c3a35ed2dea</id><title>Matt Read, Weblog</title><subtitle>It says little, does less, means  nothing.</subtitle><updated>2013-10-03T10:55:19-04:00</updated><link rel="alternate" href="https://mattread.com/tag/habari"/><link rel="self" href="https://mattread.com/tag/habari/atom"/><entry><title>hConsole: A Live Habari Console</title><link rel="alternate" href="https://mattread.com/hconsole-a-live-habari-debugging-console"/><link rel="edit" href="https://mattread.com/hconsole-a-live-habari-debugging-console/atom"/><author><name>Matt Read</name><uri>https://mattread.com</uri></author><id>tag:mattread.com,2013:hconsole-a-live-habari-debugging-console/1359403524</id><updated>2013-10-03T10:55:19-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2020-02-06T12:56:28-05:00</app:edited><published>2013-10-02T14:54:06-04:00</published><category term="habari"/><category term="code"/><content type="html">&lt;p&gt;If you have ever written code before, you&amp;#8217;ve come across a situation where you needed to debug or test something simple in your code. Doing this with a Command Line Interpreter is quite simple. Type your code, see what comes out. But when it comes to web applications, it&amp;#8217;s a little harder. There are &lt;abbr title="HyperText Transfer Protocol"&gt;HTTP&lt;/abbr&gt; requests, Sessions, Cookies, and a Webserver involved. This is where &lt;a href="https://github.com/habari-extras/hconsole" title="hConsole github repo"&gt;hConsole&lt;/a&gt; comes in.&lt;/p&gt;

&lt;p&gt;hConsole is a live &lt;a href="https://habariproject.org/en/" title="Habari Project's main site"&gt;Habari&lt;/a&gt; console, or command line, that allows you to evaluate your code directly in your Habari installation, with all the &lt;abbr title="HyperText Transfer Protocol"&gt;HTTP&lt;/abbr&gt; request, Sessions, etc. there. You can access the entire Habari core, even trigger plugin actions and filters, and view the live result on screen.&lt;/p&gt;

&lt;p&gt;Once installed, you simply click on the hConsole button in the bottom right of your screen to bring up the console. In the console you can evaluate any &lt;abbr title="PHP: Hypertext Preprocessor"&gt;PHP&lt;/abbr&gt; code and utilize the entire Habari base. You can also execute &lt;abbr title="Structured Query Language"&gt;SQL&lt;/abbr&gt;, to query your Habari&amp;#8217;s database directly (Tip: press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;Q&lt;/kbd&gt; to run code without the mouse).&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;a href="//farm9.staticflickr.com/8099/8590516105_9d9462457c_b.jpg" class="fancybox"&gt;&lt;img alt="hconsole_php" src="//farm9.static.flickr.com/8099/8590516105_9d9462457c.jpg" class="card center"&gt;&lt;/a&gt; 
&lt;figcaption&gt;&lt;b&gt;Figure 1&lt;/b&gt; Using the debug area to output code.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;h3&gt;Debugging &lt;abbr title="PHP: Hypertext Preprocessor"&gt;PHP&lt;/abbr&gt; and Habari&lt;/h3&gt;

&lt;p&gt;hConsole has 2 parts; A debug section, for outputting variables and such (&lt;code&gt;Utils::debug()&lt;/code&gt; comes in handy here), and the ability to trigger plugin hooks and affect the output of, say, post titles. There is also an option to &lt;code&gt;htmlspecialchars()&lt;/code&gt; the output of the debugging code if you wanted to output &lt;abbr title="Hyper Text Markup Language"&gt;HTML&lt;/abbr&gt; tags, for example. Let&amp;#8217;s look at two basic examples:&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;pre class="highlight php"&gt;
$test = "this is a test";
echo $test;
&lt;/pre&gt;
&lt;figcaption&gt;&lt;b&gt;Example 1&lt;/b&gt; A simple Debug echo&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;p&gt;The code in example 1 will simply echo the variable &lt;code&gt;$test&lt;/code&gt; above the command line in hConsole; The so called &amp;#8220;Debug Area&amp;#8221;. We can also implement plugin hooks.&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;pre class="highlight php"&gt;
filter_post_title_out {
    function boo ($title)
    {
        return $title . ' Boo!';
    }
}
&lt;/pre&gt;
&lt;figcaption&gt;&lt;b&gt;Example 2&lt;/b&gt; Filtering Post Titles&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;p&gt;The code in example 2 will register the function &lt;code&gt;boo()&lt;/code&gt; to the &lt;code&gt;post_title_out&lt;/code&gt; filter. Function &lt;code&gt;boo()&lt;/code&gt; then appends &lt;code&gt;" Boo!"&lt;/code&gt; to all post titles for the page you are looking at. We can also combine the two and have debug output along will running filters or actions.&lt;/p&gt;

&lt;p&gt;Of course these are very simple examples of what can be done with hConsole. In the real world it becomes a very powerful tool.&lt;/p&gt;

&lt;h3&gt;Debugging With hConsole&lt;/h3&gt;

&lt;p&gt;Let&amp;#8217;s look at an example of a real debugging situation where hConsole came in handy. When trying to debug Habari&amp;#8217;s internal Cron system it&amp;#8217;s hard to tell why it&amp;#8217;s failing when &lt;abbr title="PHP: Hypertext Preprocessor"&gt;PHP&lt;/abbr&gt; is set to use &lt;abbr title="Client URLs"&gt;CURL&lt;/abbr&gt;. Recently &lt;a href="http://skippy.net" title="Scott's website"&gt;Scott&lt;/a&gt; was having an issue with a local install, where crons weren&amp;#8217;t running.&lt;/p&gt;

&lt;p&gt;The issue comes from the fact that Habari makes an asynchronous &lt;abbr title="HyperText Transfer Protocol"&gt;HTTP&lt;/abbr&gt; call to itself to trigger all the Cronjobs to run. So you never actually see any errors from this, and when &lt;abbr title="Client URLs"&gt;CURL&lt;/abbr&gt; throws an exception, nothing is in the logs. So to test why Scott&amp;#8217;s crons where not running he used hConsole.&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;pre class="highlight php"&gt;
$cronurl = URL::get( 'cron',array( 'asyncronous' =&gt; Utils::crypt( Options::get( 'public-GUID' ) ) ) );
$request = new RemoteRequest( $cronurl, 'GET', 100 );
$request-&gt;execute();
&lt;/pre&gt;
&lt;figcaption&gt;&lt;b&gt;Example 3&lt;/b&gt; Making a request to the cron.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;p&gt;In example 3 we run the cron trigger using hConsole with a longer timeout so we can see what is happening. And Scott was able to get the error &lt;code&gt;Exception: CURL Error 60: SSL certificate problem, verify that the CA ...&lt;/code&gt;. He was then able to add his  &lt;abbr title="Secure Socket layer"&gt;SSL&lt;/abbr&gt; certificate chain to his Apache config so &lt;abbr title="Client URLs"&gt;CURL&lt;/abbr&gt; accepted the certificate, and crons ran smoothly.&lt;/p&gt;

&lt;h3&gt;Debugging &lt;abbr title="Structured Query Language"&gt;SQL&lt;/abbr&gt;&lt;/h3&gt;

&lt;p&gt;hConsole will also let you directly run &lt;abbr title="Structured Query Language"&gt;SQL&lt;/abbr&gt; statements on your database. It will even substitute proper table names when using &amp;#8220;curly brackets&amp;#8221;, like &lt;code&gt;{posts}&lt;/code&gt; becomes &lt;code&gt;habari__posts&lt;/code&gt;, or whatever you chose during install. You can run any database query by simply checking the &lt;abbr title="Structured Query Language"&gt;SQL&lt;/abbr&gt; checkbox, and the results will output in a nicely formatted table.&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;pre class="highlight sql"&gt;
select * from {posts} limit 3;
&lt;/pre&gt;
&lt;figcaption&gt;&lt;b&gt;Example 4&lt;/b&gt; SQL selecting the 3 most recent posts.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;p&gt;And the results from running example 4 show in a nice tabular format so we can easily see what&amp;#8217;s in our database.&lt;/p&gt;

&lt;div&gt;&lt;figure&gt;
&lt;a href="//farm9.static.flickr.com/8506/8591609336_bf476f433f_b.jpg" class="fancybox"&gt;&lt;img alt="hconsole_sql" src="//farm9.static.flickr.com/8506/8591609336_bf476f433f.jpg" class="center card"&gt;&lt;/a&gt;
&lt;figcaption&gt;&lt;b&gt;Figure 2&lt;/b&gt; Results of selecting the 3 most recent posts.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/div&gt;

&lt;p&gt;You can also, of course, run other statements, such as delete, update, show tables, etc. All statements will output their results, or show an error if there are troubles.&lt;/p&gt;

&lt;h2&gt;Developer&amp;#8217;s Best Friend&lt;/h2&gt;

&lt;p&gt;As you can see hConsole is the plugin and theme developers best friend. Whether you are debugging a core Habari issue, or simply looking at the contents of an object. You can pretty much debug and test any code you need to; &lt;abbr title="PHP: Hypertext Preprocessor"&gt;PHP&lt;/abbr&gt;, &lt;abbr title="Structured Query Language"&gt;SQL&lt;/abbr&gt;, and Habari.&lt;/p&gt;

&lt;ul class="download"&gt;
&lt;li&gt;&lt;a href="https://github.com/habari-extras/hconsole/archive/master.zip"&gt;hConsole Master &lt;i class="icon-box-add"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/habari-extras/hconsole"&gt;GitHub Repo &lt;i class="icon-github"&gt;&lt;/i&gt;&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
</content></entry><entry><title>Jambo On Habari-Extras</title><link rel="alternate" href="https://mattread.com/jambo-on-habari-extras"/><link rel="edit" href="https://mattread.com/jambo-on-habari-extras/atom"/><author><name>Matt Read</name><uri>https://mattread.com</uri></author><id>tag:mattread.com,2008:jambo-on-habari-extras/1206317045</id><updated>2008-03-23T20:04:05-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-08T22:58:13-05:00</app:edited><published>2008-03-23T12:58:55-04:00</published><category term="habari"/><category term="plugin"/><category term="jambo"/><category term="tabasamu"/><category term="markdown"/><content type="html">&lt;p&gt;I just put the latest version of the Jambo contact form for Habari on the &lt;a href="http://svn.habariproject.org/habari-extras/plugins/jambo/"&gt;Habari-Extras&lt;/a&gt; repo. So now anyone who wants to participate in the development of Jambo can do so. And please feel free do make it better, or fix my mistakes, that&amp;#8217;s why it&amp;#8217;s there.&lt;/p&gt;

&lt;p&gt;You will also find &lt;a href="http://svn.habariproject.org/habari-extras/plugins/tabasamu/"&gt;Tabasamu&lt;/a&gt;, &lt;a href="http://svn.habariproject.org/habari-extras/plugins/staticfront/"&gt;StaticFront&lt;/a&gt;, and &lt;a href="http://svn.habariproject.org/habari-extras/plugins/habarimarkdown/"&gt;HabariMarkdown&lt;/a&gt; there too. Enjoy and thanks.&lt;/p&gt;
</content></entry><entry><title>The Times, They Are A Changin</title><link rel="alternate" href="https://mattread.com/the-times-they-are-a-changin"/><link rel="edit" href="https://mattread.com/the-times-they-are-a-changin/atom"/><author><name>Matt Read</name><uri>https://mattread.com</uri></author><id>tag:mattread.ca,2007:the-times-they-are-a-changin/1176136304</id><updated>2007-04-09T10:58:13-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-08T22:58:19-05:00</app:edited><published>2007-04-09T05:31:44-04:00</published><category term="habari"/><category term="wordpress"/><content type="html">&lt;p&gt;You might be wondering what the hell happened to my site. Well, it changed. As you may have noticed I no longer run &lt;a href="http://wordpress.org"&gt;WordPress&lt;/a&gt;. I&amp;#8217;m now running &lt;a href="http://habariproject.org"&gt;Habari&lt;/a&gt; on this site. It&amp;#8217;s not because Habari is better than WordPress, but simply because I got bored of WordPress and Habari offered a new code base for me to play with. I still highly recomend and support the WordPress project.&lt;/p&gt;

&lt;p&gt;You will also notice that all my current &lt;a href="/projects"&gt;WordPress plugins and themes&lt;/a&gt; are no longer supported. Since I won&amp;#8217;t be keeping up with WordPress anymore I can no longer support them. If you wish to take them on yourself and develop them further, please send me an email, and I&amp;#8217;ll link them to your site.&lt;/p&gt;

&lt;p&gt;Finally I would like to say thank you to the WordPress team and community. It has been a great 4 years. I&amp;#8217;ll miss all the Press ;).&lt;/p&gt;
</content></entry><entry><title>Thinking About URI's</title><link rel="alternate" href="https://mattread.com/thinking-about-uri-s"/><link rel="edit" href="https://mattread.com/thinking-about-uri-s/atom"/><author><name>Matt Read</name><uri>https://mattread.com</uri></author><id>tag:mattread.ca,2007:thinking-about-uri-s/1175443948</id><updated>2007-04-01T12:26:52-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-08T22:58:19-05:00</app:edited><published>2007-04-01T05:12:28-04:00</published><category term="habari"/><category term="design"/><category term="uri"/><content type="html">&lt;p&gt;I&amp;#8217;m trying to come up with a new URI design for my site. My thinking is to &amp;#8220;version&amp;#8221; everything by date. So for example, I could have /blog/post-slug/2007-04-01. There might only be one version of most blog posts, but it would allow for &amp;#8220;follow up&amp;#8221; posts on the same topic at a letter date.&lt;/p&gt;

&lt;p&gt;My second thought is to use the content-type in the URI, /content-type/post-slug/version; Giving something like, /entry/post-slug/2007-04-01, or /page/about/2007-04-01. A URI without the version would simply be the latest version, /page/about. This also lends well to my projects. I would maybe have a content-type of &amp;#8220;project&amp;#8221;, so I could have /project/tabasamu/2007-04-01 etc.&lt;/p&gt;

&lt;p&gt;Thus I could categorize all content by it&amp;#8217;s type and version, then further by tags. I&amp;#8217;m liking this idea, hopefully I can hack around with Habari a bit and see if I can make it work. Here&amp;#8217;s hoping post-slugs are not unique, as they shouldn&amp;#8217;t be (for my case anyway ;) ).&lt;/p&gt;
</content></entry></feed>
