Sorry it's been so long since my last post, but I've been really busy with my new job.. My total time per week either at work or commuting is about 65.5 hours, so I don't have heaps of time.
Anyway, for a while now I've been a fan of abandonware games, which are games that have gone out of copywrite and are now free to download. Obviously these are only really old games but to my mind some of the greatest ever games were made more than 20 years ago.
The problem with abandonware is that it can take a great amount of human time to get the abandonware files. This is because you often have to click through three or four pages per game, even though each game is often less than 1mb in size! I recently came across a site called c:\dos abandonware.
There's a page on this site that google sent me to which complains that you have JavaScript turned off and gives you a list off all the games on the site (with the links to download them). I thought to myself, why don't I make a nice little Perl script to download all of these games automatically. The first thing you will need to do is go to www.cdosabandonware.com/std_noscript.php and get the source. You can do that by right-clicking the web page and selecting view source. Then just copy and paste the source into a text editor of your choice. You could also do something like:
$ wget www.cdosabandonware.com/std_noscript.php
Then, you need to write your perl script. It's only four lines long and looks like this:
#!/usr/bin/perl -w
while() {
`wget $1` if (/"http:\/\/(.+)"/);
}
That's it! All you have to do is run it like this:
$ ./get.pl < source.html
Where get.pl is the perl script we've just made and source.html is the source from the c:/dos abandonware site.
A few things to note: this script will only work in linux. It should be easy to change it for ActivePerl in Windows, but I don't know how. Also, I currently estimate the total download size to be about 3gigabytes. I will update this post when my download completes, but until then you have been warned!
UPDATE: The total download for running this script was about 11 Gigabytes. Apparently the abandonware games are bigger than I expected.. It's OK for me because I've got plenty of download bandwidth left, but I suggest that you don't run this script unless you have bandwidth to burn!
Thursday, June 18, 2009
Monday, May 18, 2009
Update to Webform and Node Administration in Drupal
After my previous post, I did some more work on the same site, and came across the issue I talked about before. Unfortunately the fix I used last time didn't work for a new situation I came across, so I had to do some more rummaging in the Drupal modules and forums to see if I could find a better way around it.
Looking at what I was wanting to achieve, I wanted to be able to allow a role to look at the list of content and then add, edit or delete this content. However, I didn't want to give the role Node Administration access, because that would mean the user has access to create new WebForms, which I didn't want to give.
I came across a module called Content Management Filter, or cmf. This module creates a single page that roles can be given access to. This page does everything that the Administer Nodes page does as well as allow more control over the filters to view the content in the site. Also, this module exposes a number of permissions that give an administrator finer control over what each role can do on the page.
I simply included this module, tweaked the permissions for it and then removed the Administer Nodes permission. Now, it works exactly as I want it - the particular role can not create webforms, but they can view a list of all content and add, edit or remove this content!
It's pretty bad that Drupal doesn't let you do this straight out of the box, but thankfully this module gives you all the control you'll need to give roles permission to edit content.
Looking at what I was wanting to achieve, I wanted to be able to allow a role to look at the list of content and then add, edit or delete this content. However, I didn't want to give the role Node Administration access, because that would mean the user has access to create new WebForms, which I didn't want to give.
I came across a module called Content Management Filter, or cmf. This module creates a single page that roles can be given access to. This page does everything that the Administer Nodes page does as well as allow more control over the filters to view the content in the site. Also, this module exposes a number of permissions that give an administrator finer control over what each role can do on the page.
I simply included this module, tweaked the permissions for it and then removed the Administer Nodes permission. Now, it works exactly as I want it - the particular role can not create webforms, but they can view a list of all content and add, edit or remove this content!
It's pretty bad that Drupal doesn't let you do this straight out of the box, but thankfully this module gives you all the control you'll need to give roles permission to edit content.
Sunday, May 10, 2009
Combining Webforms and Node administration in Drupal
I started a new job a few weeks ago, so despite my best efforts, I haven't had time to add anything more to this blog since I opened it.
Earlier today I was working on an almost complete site in Drupal. The site is almost ready to go live, it's just a matter of a few last minute configuration changes. I was working on the permissions for a content editor role. Basically, this role was to be able to create, edit and delete any content on the site, as well as manage the sites users. The caveat is that one of the modules that is installed is the WebForms module. This module allows an administrator to create forms for users to fill in. It has a bunch of useful features, and installs a new content type to facilitate the creation of these forms.
What I wanted to do was remove access to this content type for a content editor. Because the webforms content type is only really a psuedo content type, it doesn't have the permissions set up in the same way. The webforms module exposes a bunch of other permissions, one of which is "allowed to create new WebForms". This would seem to be the permission I am looking for. However, when I remove permissions to the role and then log in as a user who is part of the role, I am still able to create webforms.
A little digging through the forums, and some playing around, and I come across the problem. A user who has the permission 'Administer Nodes' is automatically given permission to create WebForms. This makes the create WebForms permission reduntant, or at least in the context that I'm using it in. I could take away Administer Nodes permission, but then my content editor would not be given permission to access the list of all nodes. This is obviously not a workable solution, as the editor really needs access to a list of content to edit.
The best solution I've come up with is to disable the WebForms menu option. It no longer shows up in the navigation menu, and also does not show up on the create content page. The disadvantage with this is that an administrator can not see the option either. Also, a content editor can create a WebForm, if they know the path to the correct page.
In the context of my site, neither of these are of a huge concern, because the layout of the site will remain largely unchanged when it goes live. Also, there are only likely to be two or three content editors, and they will all be trustworthy. Moreover, the users are almost certainly going to be either Dentists or their receptionists, neither of which are in the high danger zone for being hackers!
Earlier today I was working on an almost complete site in Drupal. The site is almost ready to go live, it's just a matter of a few last minute configuration changes. I was working on the permissions for a content editor role. Basically, this role was to be able to create, edit and delete any content on the site, as well as manage the sites users. The caveat is that one of the modules that is installed is the WebForms module. This module allows an administrator to create forms for users to fill in. It has a bunch of useful features, and installs a new content type to facilitate the creation of these forms.
What I wanted to do was remove access to this content type for a content editor. Because the webforms content type is only really a psuedo content type, it doesn't have the permissions set up in the same way. The webforms module exposes a bunch of other permissions, one of which is "allowed to create new WebForms". This would seem to be the permission I am looking for. However, when I remove permissions to the role and then log in as a user who is part of the role, I am still able to create webforms.
A little digging through the forums, and some playing around, and I come across the problem. A user who has the permission 'Administer Nodes' is automatically given permission to create WebForms. This makes the create WebForms permission reduntant, or at least in the context that I'm using it in. I could take away Administer Nodes permission, but then my content editor would not be given permission to access the list of all nodes. This is obviously not a workable solution, as the editor really needs access to a list of content to edit.
The best solution I've come up with is to disable the WebForms menu option. It no longer shows up in the navigation menu, and also does not show up on the create content page. The disadvantage with this is that an administrator can not see the option either. Also, a content editor can create a WebForm, if they know the path to the correct page.
In the context of my site, neither of these are of a huge concern, because the layout of the site will remain largely unchanged when it goes live. Also, there are only likely to be two or three content editors, and they will all be trustworthy. Moreover, the users are almost certainly going to be either Dentists or their receptionists, neither of which are in the high danger zone for being hackers!
Tuesday, March 24, 2009
Welcome
Hello, and welcome to my blog. My name is Jeremy, and I am an 'Analyst Programmer', whatever that means.
Anyway, I've set up this blog to share what I learn about programming. At work, I make database driven websites using ASP.Net. We use Visual Basic.Net as the server-side language, Microsoft SQL Server 2008 for the database, and make heavy use of JavaScript. At home, I prefer a more Open Source approach, using PHP for most server-side work, with MySQL as the database. I also make a lot more use of CSS at home, and a lot less use of JavaScript.
As well as this web development, I also manage my server at home. This is an old games machine of mine that I've rebuilt with 2x1TB hdds in a mirrored RAID array, and installed CentOS as the operating system (An enterprise level linux distribution based on Red Hat). In the past I have also had a few different versions of Debian on it. So you are likely to get some server administration type posts here too.
I also write scripts, mainly Perl and Bash shell, program in C and C++, and am learning Python (slowly..). Basically, anything that I do that is technology related, and I find interesting, I will try to put up here. I figure I have done a lot of googling and reading of blogs to find answers to my problems, so why not put my own up to help others?
So, read through what's here, post comments, questions and answers, and I'll answer everything that I can.
Anyway, I've set up this blog to share what I learn about programming. At work, I make database driven websites using ASP.Net. We use Visual Basic.Net as the server-side language, Microsoft SQL Server 2008 for the database, and make heavy use of JavaScript. At home, I prefer a more Open Source approach, using PHP for most server-side work, with MySQL as the database. I also make a lot more use of CSS at home, and a lot less use of JavaScript.
As well as this web development, I also manage my server at home. This is an old games machine of mine that I've rebuilt with 2x1TB hdds in a mirrored RAID array, and installed CentOS as the operating system (An enterprise level linux distribution based on Red Hat). In the past I have also had a few different versions of Debian on it. So you are likely to get some server administration type posts here too.
I also write scripts, mainly Perl and Bash shell, program in C and C++, and am learning Python (slowly..). Basically, anything that I do that is technology related, and I find interesting, I will try to put up here. I figure I have done a lot of googling and reading of blogs to find answers to my problems, so why not put my own up to help others?
So, read through what's here, post comments, questions and answers, and I'll answer everything that I can.
Subscribe to:
Posts (Atom)