TYPO3 TemplaVoila Error
November 6, 2011 by Conor · Leave a Comment
TemplaVoila ERROR:
Couldn’t find Template Object with UID “1″.
Please make sure a Template Object is accessible.
Solution:
Page View (left tab) -> Right click website root -> Edit -> Appearance tab:
You should see 4 dropdown boxes labeled:
Page Template Structure: Use Template Design: Subpages – Page Template Structure: Subpages – Use Template Design:
These boxes should be showing errors relating to a value ’1′.
-> Change these boxes to another value in the list (“Main Template”). Hint: go from left to right.
Save the record, clear cache and reload web page. Everything should work fine.
Store code snippets with Code Warehouse
Have you ever found yourself browsing the net and finding some code that you know is useful and you’d like to store it for future use? You then proceed to save it in a text file and save it in a random location. Not only will you forget about it but even if you remembered it you probably wouldn’t be able to find it!!
Thats where Code Warehouse comes in. It is a handy little utiliy that lets you create your own categories for storing code snippets for reference later on. For each code entry you can specify the language to enable syntax highlighting, item type (function, class, interface etc.) plus the usuals like name, description etc. You are also able to save notes about each entry and and upload files associated with the entry. This would be handy if you needed DLL files or other to support the code you are writing.
Code Warehouse really is a once stop shop for code management and gone are the days when I had to flick through various old projects to double check how something was done. It has support for lots of languages and I am a particular fan of the database support (MySQL, SQL Server, Access + more) which means I could develop a web interface to make my code available to me on the go or provide access to other users.
My setup is as follows: Main categories by programming language then sub categories in each for various areas e.g. Text, File IO, web, security etc..
Link: here
Shorten URLs in Visual Basic using Bit.ly API
November 3, 2009 by Conor · Leave a Comment
I’m currently working on a Twitter client for college that will provide a function to shorten URLs using the Bit.ly API.
It’s actually really simple and easy to use and while my sample interface is written in VB you can use the API with any language. To use the API all you need do is construct a URL like so:
http://api.bit.ly/shorten?version=2.0.1&longUrl=http://www.conorhackett.com&login=[USERNAME]&apiKey=[API_KEY]
You will need to register with Bit.ly to get API key and a username before you can try this. Also, the url you want to shorten must begin with “http://” or else you will get an error. The above URL (with my API key included) will return the following response:
{ “errorCode”: 0, “errorMessage”: “”, “results”: { “http://www.conorhackett.com”: { “hash”: “nzIzC”, “shortKeywordUrl”: “”, “shortUrl”: “http://bit.ly/9SWQS”, “userHash”: “9SWQS” } }, “statusCode”: “OK” }
From this you can extract the shortened URL along with the status of the response among other but they are the only two pieces of information that I used.
Below you’ll find my solution written in VB. The handling of the status messages isn’t the greatest but it works fine. I should really be using regular expressions to validate user input and extract information from the response. It’s late and my regex skills are still a little shaky so i’ll leave that until another day.
' NOTE: you must use -> Imports System.Net
Public Function getShort(ByVal url As String) As String
' New instance of WebClient
Dim client As WebClient = New WebClient()
' if URL doesn't start with http:// then append it to the start
If url.StartsWith("http://") = False Then
url = "http://" + url
End If
' Setup command url to be sent to Bit.ly API
Dim commandUrl As String = "http://api.bit.ly/shorten?version=2.0.1&longUrl=" + url + "&login=[USERNAME]&apiKey=[API_KEY]"
' Get raw result string
Dim result As String = client.DownloadString(commandUrl)
' Determine status of repsonse
' This needs to be improves but works ok for now.
If result.IndexOf("""statusCode"": ""OK""") > 0 Then
' Get position of the beginning of short URL.
Dim indexOf As Integer = result.IndexOf("http://bit.ly/")
result = result.Substring(indexOf, 19)
End If
If result.IndexOf("""statusCode"": ""ERROR""") > 0 Then
' Throw an exception if response is ERROR.
Throw New System.Exception("ERROR")
End If
Return result
End Function
Update: This tutorial focuses on getting a JSON formatted response from Bit.ly. This can be changed to XML by adding &format=xml at the end of the request URL. I will post a guide on working with XML in the near future.
WP Plugins!
October 4, 2009 by Conor · Leave a Comment
As far as looks and function are concerned I can finally say that my blog is coming along nicely. By way of content there is still much room for improvement. I just thought i’d tell you about the various plugins that I have installed.
My favourite is WP-Cumuls which takes all your tags and/or categories and displays them in a nice revolving ‘cloud’ it’s made with flash and looks pretty nice! Maintenance Is a simple plugin that takes your blog offline if you need to do some urgent maintenance on it. I only used it once when I first installed wordpress and had no posts or theme.
This blog is going to contain a lot of code snippets etc so I knew I would need something to display code as if you were reading it from an IDE. That is where SyntaxHighlighter Plus comes in. This plugin is pretty cool because it’s not just for wordpress. You could install it on any site that you need proper code highlighting on. Follow the link to get a list of supported languages.
I am also using Akismet to monitor all comments posted and check them for spam. It is actually quite good and even though my blog is pretty new it has already caught 2 rogue comments. Although it is installed by default when you install WP, it is worth noting that before you can use it you need to get an API key from here before you can activate it and start protecting yourself from spammed comments.
I should really start blogging about programming now.. I promise my next post will be more exciting!!
Automatically login to Eircom stats site
Ok, so it’s pretty annoying having to login to the eircom site each time you want to check your usage. I figured there must be an easier way. What I needed to do was automatically submit the login form and go me to the stats page, quite simple really! There’s two parts, the login form and the onload event that tells the browser to submit the form when the page has loaded.
Just replace the opening body tag with this:
<body onload="window.document.stats.submit()">
And put this inside the body tags:
<form method="POST" name="stats" action="http://broadbandsupport.eircom.net/stats.asp">
<input type="hidden" name="username" value="YOUR-PHONE NUMBER" />
<input type="hidden" name="password" value="YOUR ACCOUNT NUMBER" />
</form>
*NOTE: Your phone number must be in the format [areacode-number]
I plan on making an iGoogle gadget for this. I will also try and support other ISPs. I must also put my PHP skils to the test and try to dynamically generate the html and let users download the complete html file for use with their account.
STAY TUNED!
UPDATE: Here is the full html document. Just right-click and “save target as”. You’ll then need to open the file in notepad to enter your phone number and account number.
