River Views | |
Sat, 03 Sep 2011
The Best Web App Framework
Catalyst is the best web app framework. I feel like there is lots more to say, but it’s all been said before. I’ve been developing webapps for the past decade. I’ve observed the trends; I’ve tried different “best new solutions”. I wrote my own web and DBI framework; I eventually abandoned it. Web development was looking grim; I found Catalyst. And best of all, I could keep using Perl. I couldn’t ask for anything more. (Well, maybe an ORM, but that’s another story, with another happy ending.) Sun, 31 Jan 2010
use DBIx::Class::InflateColumn::FS instead
DBIx::Class::InflateColumn::File - DEPRECATEDIt is time to stop using DBIx::Class::InflateColumn::File. This article gives some tips and examples for switching to DBIx::Class::InflateColumn::FS. From DBIx::Class::InflateColumn::File:
I switched to DBIx::Class::InflateColumn::FS because I had problems with DBIx::Class::InflateColumn::File not deleting all files from the file system; and that was due to one of the “number of architectural deficiencies”. I am happy to see further development for file-based storage will be focussed on one package. So let’s look at ways of using DBIx::Class::InflateColumn::FS insteadIf you have been using DBIC::IC::File and want to migrate to DBIC::IC::FS, there are some changes to assigning column values. The examples below assume IC::FS is being used in a Catalyst environment. We are also assuming the desired filename is already known (part of the Using IC::File required assigning a hashref to the file column, eg:
While IC::FS just wants a filehandle:
IC::FS also has a different way of naming the file on disk and specifying the directory to write it to. The
The following goes in MyApp::Schema::Result::Media.pm; it assumes I already assigned values to
Or if you want random file names but need to control the file extension, use a method similar to
Of course if you just want a random filename, no need to override the
and elsewhere…
Note, I haven’t tried that method, but it should work fine. MyApp just uses a random (UUID) filename. What directory will files be stored in?There are two parts to configuring the directory where files will be written. The first is defining which directory will be used for all files written for a given column. I’m using class method
And second you specify which sub-directory will be used for the file. You can use the default for IC::FS, from the POD:
Or use a variation of the default method; this uses two-level sub-directory structure:
Or let’s use a value from
At some point you will need to refer to the file again, and one common use is specifying a URL which points to the file as a resource on your server. IC::FS doesn’t give us a method we can use for that, but it’s very simple to create one in our Result class.
The
First we assigned More Advanced UsageOne of the more common reasons to use a filesystem-backed storage is for image and other media files. And when there is one media file there is often another since we’ll need to offer different sizes and maybe even different formats. So let’s get our Result::Media class to assist with making multiple formats simple to manage. In one of your controller actions:
And in Result::Media, create a method which stores both the original uploaded image and a thumbnail copy. We use Imager to handle creating the thumbnail image.
So with just a few lines in our controller, we can add media files of different sizes and formats from one file upload. ConclusionsUsing DBIx::Class::InflateColumn::FS is easy, and there is enough flexibility to allow us to store files in way that meets individual file system requirements. Through the use of We can easily get the path for a file to use in a There are other usage scenarios that may require different solutions. Eg. (as discussed in the mailing list) how does HTML::FormFu handle file uploads when used with HTML::FormFu::Model::DBIC? I would like to see seamless integration with HTML::FF, I don’t know what’s required to make that happen though. Final Words… DBIx::Class::InflateColumn::FS is another great example of why the DBIx::Class and Catalyst projects are such a joy to work with. Thu, 17 Dec 2009
How much do you know about the proposed internet filter?
You have probably heard about the mandatory internet filter by now, and as someone close to the issue I thought I should share some facts about the proposal. There is so much fear-mongering around the issue that it’s hard for the facts to surface. First, for those of you who are not aware, Senator Conroy has been proposing a mandatory internet filter for all Australians; homes, businesses, everywhere. I don’t really have an issue with the concept of a filter; we already have plenty of censorship which is helpful for society (eg. movie/tv ratings, games classifications, etc). But that is not what the filter will be doing. The filter is being presented under the banner of “protecting the children”, but not only does it fall way short of that goal; it has much potential to actually make child abuse worse. There are lots of IT people talking about how it will slow down the Internet for all of Australia. The government is white-washing that fact, but that’s no big deal; anyone who cares to read about it can see that our internet will be slower if the filter is implemented. The part which is not very clear is how it has the potential to increase child abuse. The following may to be too confronting for some of you, but I believe it’s important to define what child abuse is in the context of “protecting the children”. There are two distinct issues at play; kids who view inappropriate content (net nasties), and kids who are abused and become victims. I’m sure if you stop to think about it; the second problem is much more serious. But the filter does nothing (& I mean nothing) to stop children from being abused. In fact, it has opposite effect. One of the things the government is not readily sharing is that Australian Federal Police have a unit that works internationally to combat child abuse, and their funding has been cut in order to help fund the new filter. Did you get that part? We already have cops “on the ground” who are combating child abusers. The government is taking money away from them so that they can put the mandatory filter in place. So next you ask, but what about the pedophiles, won’t they be blocked from all the nasty content. And NO, they won’t. That’s when we start getting into the technical details, and trust me that it would take a determined person about 10 minutes to circumvent the filter. A high school student demonstrated that with the trial filter; he had by-passed it in less than 10 minutes. And high school kids are notorious for sharing things like how to get around all the limitations placed in front of them. If any of you are interested I can share the technical facts which make the filter a complete joke, but that will be too boring for most of you. Next we can look at other countries like China and N Korea who have been condemned for their mandatory filters. We will be joining their ranks. Note I said mandatory filter. We have other options. Having filters is a good thing, but it’s not the government’s place to enforce them, especially when they will be so ineffective (& possibly harmful) against the actual issue of “protecting the children”. And we already have other solutions today to protect the children. Most people think of “protecting the children” as shielding them from net nasties. There are plenty of ways to do that already. The government even has a site already where parents can download filters and install them at home. Schools (& parents) can sign-up with an ISP which provides a “clean feed”. There is a long list of solutions which don’t take funds away from the AFP (who are already combatting child abuse) and don’t slow down the internet for every single person in this country. One of my colleagues summarized it quite well in his blog:
Even Google has stepped into the fray condemning the mandatory filter. And they are not the only ones. “Save the Children” has urged the Federal Government to abandon its plans to censor the internet, saying it will not be effective in protecting kids from online dangers. I don’t really have suggestions for what any of you can do about it. And some of you may even be in favour of the mandatory filter so are happy to see it going ahead. But I strongly feel that more Australians should be aware of the true implications of the mandatory filter coming from behind the banner of “protect the children”. Whether you agree with me or not, I do hope you take a moment to actually think about the issue rather than just going along with Conroy’s statements. And if you have any questions, I’ll be happy to answer them if I can, or at least point you to some online references. Some other references:
Fri, 30 May 2008
Living descendants of Shipka Ebenezer
Sally Cutter announced today that she has been in touch with someone she has confirmed to be a direct descendant of Shipka Ebenezer. Sally also said there is an Ebenezer family secret, that has been closely guarded for generations. Sally refused to share contact details, but I was able to steal her log files and see who she contacted. I found video calls made to one contact 3 times in a 65 minute period. I also found this address zai.press@gmail.com. Thu, 29 May 2008
Living descendants of Shipka Ebenezer
With all the excitement recently following the discovery of evidence that Ebenezer’s Vault does exist, a few genealogists wanted to know whether descendants could be traced through today. Sally Cutter claims to have found a direct living descendant of Shipka Ebenezer. Sally has been unable to make contact and will not make the person’s name public until she has confirmed whether direct descendant line is accurate. In the meantime she has been debating with her colleagues whether any important family history or heirlooms still exist today. The common belief is that all of Ebenezer’s treasure was locked away in his vault, so it’s unlikely that any family heirlooms will be passed down from Shipka. But letters between family members about “Pa’s secret crate” have been found in the past few decades. Sally says there is a good chance the family secret could still exist today, and she is going to find out. I’ll update this page as more info becomes available. |
River Views
Subscribe |