Hello, and welcome to the online home of Robert Price - Senior Web and Mobile
Developer at multinational media company Bauer
(but don't let that put you off).
Here you'll find Rob's blog, focusing mainly on
web and mobile technology, but anything can (and does) get posted here.
Latest Blog Entries
I had a requirement today for an ASP.NET page to jump to the same part of the page once a form was submitted via a postback.
Qudos to my fellow developer Andy Howell for leaping in and pointing out that functionality was already in ASP.NET 2.0 and above, so there would be no need for me to write any funky JavaScript.
You need to set MaintainScrollPositionOnPostback to true. I did this in the Page tag on the ASP.NET page.
<%@ Page MaintainScrollPositionOnPostback="true" %>
Although I've not tested it yet, you should also be able to set it globally in the web.config file in the pages section.
<pages maintainScrollPositionOnPostBack="true" />
Or programmatically in the code behind.
System.Web.UI.Page.MaintainScrollPositionOnPostBack = true;
For more information on this, see the MSDN page for System.Web.UI.Page.MaintainScrollPositionOnPostBack.
Entered: 2010-01-22 18:17:26
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1054
Bookmarks from del.icio.us
Entered: 2010-01-17 00:15:01
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1053
While helping upgrade an old phpBB 2 messageboard to phpBB 3 earlier, I needed to reset the admin password.
I was getting tbe error "It was not possible to convert your password when updating this bulletin board’s software." after I'd converted the old user data and tried to login as the admin user.
To reset the admin password to "password" you have to do the following.
- Login to your database and look in the phpbb_users table for the admin user.
- Set the user_password to "
$H$9Ae3Uk.ECdWW5ya13M4ErWhr4c.761/", user_login_attempts to "0" and user_pass_convert="0".
You should now be able to login with your admin username and the password "password". Remember to change this once you are in for security!
Entered: 2010-01-14 11:51:49
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1052
Bookmarks from del.icio.us
Entered: 2009-12-05 00:15:12
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1051
While working on FHM.com earlier today I came across an odd bug on a page. On Firefox 3, parts of the page were rendering incorrectly, while on Internet Explorer everything was fine.
Browsers rendering content differently isn't anything new, but most of this site is derived from common templates, and only a small part of the page was directly inserting HTML. This was the obvious place to look.
Looking at the source code with syntax highlighting turned on revealed the problem, and it was one i'd not come across before.
The site had a comment that included two dashes next to each other, something like this
<-- A test comment -- test -->
Looks OK doesn't it? Well it's not valid XHTML, hence the problem.
XHTML is based on XML so follows it's standards. Here is the standard for XML comments.
The key wording here is, the string " -- " (double-hyphen) MUST NOT occur within comments.
The same applies to HTML, have a look at what the HTML4 spec says about comments. This is down to HTML being based on SGML, and double dashes are SGML comments.
In the end, it's Firefox obeying the spec, and other browsers not. However, things look like they are due to change.
Due to these problems, SGML comments have been removed from Acid 2, and future HTML versions will not require SGML comments. Browsers that have implemented them are now expected to remove their support for SGML comments, for all HTML versions.
Read more about HTML and SGML comments.
Entered: 2009-12-02 18:26:19
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1050
We're changing the format our streaming radio feeds at the moment and our test player kept jumping. We were a bit stumped as to what could be going on as the same code runs our current listen again functionality.
Delving into the ActionScript 3 code, we discovered that it appears to be down to how we implemented the NetStream object that handles the live stream. There is a variation between a live publishing stream and an archive subscribing stream and how they work with the buffer.
On a subscribing stream, the bufferTime attribute specifies how long to buffer incoming data before starting to display the stream. However, on a publishing stream, bufferTime specifies how long the outgoing buffer can grow before the application starts dropping frames.
We had our bufferTime set too low, the default is 0.1. We have now upped this and our problems have gone.
See the Adobe reference site for more information on the ActionScript 3 NetStream bufferTime attribute.
Entered: 2009-11-24 18:03:13
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1049
One function that seems to be missing in jQuery is to create new elements outside of the current DOM.
There is a good reason for this, normal vanilla JavaScript has the function createElement to do the job for you.
To create a new h1 element for example, we can do the following.
var myH1Element = document.createElement('h1');
We can easily combine this with jQuery to set the text inside for example...
jQuery(myH1Element).text("My H1 Text");
There is one downside, using the standard createElement we're not able to chain functions with jQuery.
The way around this is to wrap the request in jQuery like this...
jQuery(document.createElement("h1"));
Now we can chain this together as before...
jQuery(document.createElement("h1")).text("My H1 Text");
If you don't like the look of that, then we could always create a jQuery plugin, and add a createElement function to jQuery.
jQuery.extend({
createElement : function(elementName) {
return jQuery(document.createElement(elementName));
}
});
That must be one of the simpliest jQuery plugins ever!
Now we have extended jQuery with a createElement function we can chain calls to it like this.
jQuery.createElement("h1").text("My H1 Text").appendTo("body");
This will create a new h1 element, add the text "My H1 Text" inside the h1, then append the h1 inside the documents body tag.
Entered: 2009-10-19 17:37:26
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=1048
>> Continue reading blog entries...