Quick GWT Note

While working on a small GWT project with two other developers I ran into an odd runtime exception “com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException” as I was testing my app in the hosted mode I’m not sure how to refresh that built in browser which is the listed fix. What I ended up doing was a simple clean of the project which solved my problem, I think it relates to how I’m using SVN not integrated into Eclipse with the project yet its hard to tell. But if you run accross this expection try a simple clean before pulling too much hair out.

ExpressionEngine Pagination and Get Parameters

This may not come up that often but if you are using Get parameters such as lets say submitted by a form to filter some weblog entries, these parameters will not be preserved while using the built in pagination. This can be a real issue if you are trying to filter results and let users page through them but we can add a touch of PHP and fix this issue. In your paginate tags we just need to add the query string to the page link. You’ll notice in the sample we use the server parameter ‘query_string’ along with the question mark which will produce our correct links.

{paginate}
  {if previous_page}
    <a href="{auto_path}<?php echo "?".$_SERVER['QUERY_STRING']; ?>" class='paginate-previous'>Previous</a>
  {/if}

  {if next_page}
    <a href="{auto_path}<?php echo "?".$_SERVER['QUERY_STRING']; ?>" class='paginate-next'>Next</a>
  {/if}
{/paginate}

ExpressionEngine Pagination and the Dynamic Parameter

While working with an ExpressionEngine based site I ran across a listing of a weblog that could contain 1000′s of posts yet as it was displayed with the Dynamic Parameter off there was no stock way to support Pagination of the items. I used a simple hack, shown at the end of the post, that allowed me to use the pagination but it shows a bigger issue with ExpresionEngine, while it may not come up that often there still should be pagination for any exp:weblog:entries set but it is not. There is no reason that non-dyanmic listings shouldn’t be paginated if anything it would be more likely needed as they are likely to be a long list of a whole set.

The hack I used to enable pagination while the dynamic=”off” was available here on the ExpressionEngine Wiki but as it is a wiki I felt that I should give you the basics here as well.

In system/modules/weblog/mod.weblog.php find the comment “Parse page number” you need to simply remove the AND $dynamic from the if statment to allow for the pagination use inside a non-dynamic weblog listing.

Start with:

if (preg_match("#^P(\d+)|/P(\d+)#", $qstring, $match) AND $dynamic)
{
...

Change to:

if (preg_match("#^P(\d+)|/P(\d+)#", $qstring, $match) )
    {
    ...

wget and special characters

While using wget with authorization to download some data you may run into the problem of having a special character such as ‘>’ in your password. It’s a simple fix of wrapping your password in quotes. But the only error message that this problem will give is an authentication failure.

JavaScript / Flash Chart Alternative

So many times it is nice to add a dynamic graph to a web page. I’ve personally done this with JavaScript libraries like PlotKit or Plotr. Also there is the use of Flash with PHP or ASP.Net in amCharts. But if the user doesn’t have Flash or JavaScript turned off these tools fail. While this doesn’t happen too often any more it still may be an issue. But one issue I’ve noticed is that these charts do take a lot of resources to run so if you have visitors with slower computers that may be a real issue.

So we need a simple alternative, such as generating an image server side and serving that up. While this isn’t too difficult you may not have an imaging library available or the resources to spare. That is where Google Charts comes in with their simple API you can quickly add graphs to your web page. It’s really simple just embed a special URL in an image tag which you can easily make dynamic with PHP, ASP, or any dynamic system you’re using. See the example below. It works very well, with minimal setup and no added software for clients is needed.

<img src="http://chart.apis.google.com/chart?
    chs=250x100
    &amp;chd=t:60,40
    &amp;cht=p3
    &amp;chl=Hello|World"
    alt="Sample chart" />

Sample chart