Skip to main content
 

LessThanOrEqual in SilverStripe 3.0

When adding a filter on a DataList sometimes you need to do a <= rather than a <. Unfortunately the LessThanOrEqual and GreatherThanOrEqual search filters do not exist in SilverStripe 3.0.x, they were added in 3.1.

Therefore we have to write our own where clause like the following example:

// Return all the sessions on or before the $date
$sessions = new DataList('AcademicSession');
$sessions = $sessions->where('"SessionStartDate" <= \'' . $date . '\'');

 

Ad tech is killing the online experience

Apple blogger John Gruber started off a new debate about these issues recently, when he noted that a 537-word text post on the website iMore.com weighed in at 14 megabytes. (Fourteen megabytes of text should correspond to about 7m words, or about 10 times the combined length of the Old and New Testaments.)

Gruber blamed iMore.com, but really it’s not the website’s fault, since to a very large degree the owner of the website you’re visiting doesn’t actually control what you see, when you see it, how you see it, or even whether you see it. Instead, there are dozens of links in the advertising-technology chain, and every single one of them is optimising for financial value, rather than low-bandwidth user experience. Many pages, if you’re on a slow connection, simply time out; they never load at all.

When you are a website owner, you are responsible for all the content on your site. If you don't have any control over the ads, then that's a process issue that should be addressed.

Why not band together with a few large sites and create a standardised ad submission and review system that advertisers can integrate into their content tools and websites can set criteria about ads on their sites.

Maybe the bigger problem is that those websites cannot afford to reject ads.

 

BugzScoutLogWriter 1.0

I've released another SilverStripe add-on called BugzScoutLogWriter that I have been using for several months on some of the sites at work.It supports SS 3.0 and 3.1.

BugzScoutLogWriter is a LogWriter that integrates logs with FogBugz, an integrated web-based project management system featuring bug/issue tracking made by FogCreek.

A LogWriter is attached to errors, warnings and notices that occur in a website due to programming errors or runtime errors and then sends / saves a log of this event. SilverStripe comes with built-in functionality to e-mail or save the logs to a file, however if you use a third party bug reporting system then it's nice to have all the issues collected there instead.

I've used FogBugz for years now and one of the nice features is that multiple occurrences of the same issue get collected in the same ticket. This keeps the whole process manageable. Say, in the event that a mistake that affects all pages on a website, FogBugz collects the first 50 occurrences of that error and lets you close the ticket with one click. This is an improvement to a flood of email.

Anyways let me know if you find it useful and feel free to raise issues.

 

How to provide and manage your own permissions

At some point on your journey through the jungle that is SilverStripe, you will want to create permissions and assign users to them. You might have created a Page Category model admin to categorise your pages, and setup the relations between pages and their category. By default when you create a category as an admin they will not be visible to any content authors and any content authors that can access the model admin can't create any new items.

The solution to this dilemma is to create a new permission (for example PROJECT_CategoryAdmin) and then let people with that permission mange the category items. This is how to go about it:

Create the permission

You will need to tell SilverStripe you are implementing permission by changing the class declaration as follows (changes in bold):

class Category extends DataObject implements PermissionProvider

To create the new permission you will have to write a providePermissions() method for the Category class:

      public function providePermissions() {
        return array(
            "PROJECT_CategoryAdmin" => array(
                'name' => 'Administer categories',
                'category' => 'PROJECT',
                'help' => 'Manage categories.'
            )
        );
    }

Finally, implement the permission by declaring the canCreate, canDelete, canEdit and canView methods to your liking:

    public function canCreate($member = null) {
        return Permission::check('PROJECT_CategoryAdmin');
    }

    public function canDelete($member = null) {
        return Permission::check('PROJECT_CategoryAdmin');
    }

    public function canEdit($member = null) {
        return Permission::check('PROJECT_CategoryAdmin');
    }

    public function canView($member = null) {
        return Permission::check('PROJECT_CategoryAdmin') ;
    }

Don't forget to create a Role and/or assign the permission to the right Group(s), to make sure the right users can manage your categories.

 

Security through insecurity

Schneier explained how, initially, NSA Director General Keith Alexander claimed in 2013 that he had disrupted 54 terrorists plots. A few months later, this was revised down to 13, and then to "one or two." Eventually, the only success that the NSA could point to was the prevention of a San Diego man sending $8,500 to support a Somali militant group.

Doesn't sound like a worthy trade-off.

 

Resolve Conflicted Files That Don't Exist

Download VisualSvn Server, open a command prompt and type svn resolved -R . to resolve all conflicts, then commit again.

 

Microblogging with WordPress and Twitter

Manton Reece has been having very interesting discussions about microblogging and content ownership recently. He's working on an unannounced project in this area and I've been following his progress.

A few days ago he wrote a post about Microblogging with Wordpress in which he describes most of the process of writing your status updates on your own blog first. As I had to adapt his process for it to work with my configuration of WordPress and as I am using Twitter instead of App.net I thought it would be useful to detail how I went about, based on Manton's write-up.

Requirements

  • A theme that supports post-formats.
  • an IFTTT and Twitter account.
  • A self-hosted WordPress installation, hosted using Apache.
  • (optionally) the DoNote app from IFTTT for your mobile device.

Step 1: Link a status updates feed to Twitter

In order to post only the status updates to twitter, we have to identify them in both WordPress and for IFTTT.

Create a dedicated category

In Wordpress, if you do not have a category for status updates, create a Snippets category (with the slug snippets). Note the category ID. In addition, create a new category called ifttt-status if you plan to post to Wordpresss from your mobile device later, as I did (this is a workaround to allow WordPress to convert from this category to the status post format).

Setup the RSS feed endpoints

With the category ID, we can now create a new feed by editing the .htaccess file in your WordPress installation directory, see my gist comment on manton's configuration. I had redirection issues with Manton's original setup so I amended it. What we do here is create two endpoints, one for posts without status updates (rss.xml); and one for only status updates (snippets.xml). We then point any requests to /feed (the default WordPress endpoint) to the first endpoint.

Update (26 June): I updated the gist comment after identifying issues in initial configuration. Please reread the gist if you had problems using the initial configuration.

Post new status updates to Twitter

Now create a new recipe that is triggered from the snippets RSS feed, with the action to post a tweet with the tweet text EntryContent.

You can now blog from WordPress to twitter (just leave the title empty).

Step 2: Post status updates from your mobile device

I'm using DoNote to post to IFTTT which then posts to WordPress.

Setup WordPress

Login to your WordPress blog and in the users section create a ifttt user with the role of Author (this allows the user to create posts).

Install the "IFTTT Post Formats & Post Types" plugin, it will convert posts with the ifttt-status category to the status post-format. It will also hide the ifttt-status category from showing up in your template for example.

Link DoNote to WordPress using IFTTT

Back in IFTTT, In the My Recipe's DoNote section, create a new recipe for WordPress (you might get asked to provide the WordPress username and password you created for this purpose) with the action to create a post with the following values:

  • Title: (leave empty)
  • Body: NoteText
  • Categories: Snippets,ifttt-status
  • Tags: (leave empty)
  • Post status: Publish immediately

You are not limited to using DoNote if there is a trigger for your service, and you are not limited to usin IFTTT at all if there are WordPress plugins for your status update service and WordPress support for your writing app, but these will require similar configuration as detailed in this post.

Hope this helps!

 

On The God who Peter Molyneux forgot

Wesley Yin-Pool, writing for Eurogamer:

You will become a digital god, Molyneux proclaims in the video, of 22Cans' next game, Godus. And, you will receive a cut of the money made by Godus from the start of your reign to its end.

18 months later, as Bryan Henderson approaches his 21st birthday, he has yet to become God of Gods, he has yet to receive the "riches" Molyneux promised him, and it's looking increasingly likely he never will.

The core issue with promising such a fantastic reward is that it depends on a future that hasn't materialised:

"But we can't have the God of Gods role without the ability for people to challenge the God of Gods role, and the God of Gods role can't be challenged without combat, and we can't implement the combat without sorting out the server issues, which are being sorted out as of last week. It's just a maelstrom."

It looks to me that the whole team is continually rushed into firefighting the next feature development, with never enough revenue coming in to take a breather and plan things out properly.

He confirms the Godus development team has shrunk considerably to just a few people as resources are diverted to a new game, called The Trail.

Trust me, by the time the server issues are sorted; the combat is implemented; the multiplayer is developed and the God of God feature is finished there will be no players left to make any money from. 22Cans would do better to offer some kind of goodwill gesture to restore the morale of its staff and its fans before this PR opportunity turned completely toxic.

 

 

Switched to secure connection [updated]

I've switched this site to HTTPS, a secure connection, using a ssl proxy service provided for free by Cloudflare, for reasons. Let me know if you come across any issues.

For those using WordPress, changing the settings Site Address and WordPress Address to HTTPS may make your site unavailable. FYI, the solution I settled on is to install the WordPress HTTPS plugin. Then I set the Site Address to HTTPS. Finally, I cleared the cache. All is working fine now.

Update (06/02/15):
I've moved away from Cloudflare as my DNS provider and as a side-effect this means I'm no longer HTTPS for now. Sorry.

 

Tweet: So tempted to start a bbc news truth correction ac...

So tempted to start a bbc news truth correction account, but don’t think it’s good for my health. Wish there was more choice than it and sky

 

Tweet: Feedback for @BBCNews reporters: EU is not Brussel...

Feedback for @BBCNews reporters: EU is not Brussels and Berlin, it’s just as much London. Stop pretending we’re not in it.

 

Tweet: Tried to login to @LastPass and login to twitter i...

Tried to login to @LastPass and login to twitter in a tab. After 4 minutes still waiting on login submission. Wifi! My iPhone 4 is too slow

 

 

Tweet: Surely there is a tumblr for that?

Surely there is a tumblr for that?

 

Tweet: Dear ios dev team can you please make a badges cen...

Dear ios dev team can you please make a badges center so I don’t have to see these nagging red numbers all over my serene ios home screen?

 

Tweet: My Hide Trackbacks #wordpress plugin is now compat...

My Hide Trackbacks plugin is now compatible with version 4.1 (wordpress.org/plugins/hide-t…) Keep referrers, stop spam comments.

 

Tweet: Started a huffduffer feed (https://t.co/wax0BHeF2D...

Started a huffduffer feed (huffduffer.com/svandragt) to listen to audio files on the move using my podcast client.

 

Tweet: Are there any razor blades (single blades) that m...

Are there any razor blades (single blades) that meet @LeapingBunny cruelty free standards? Not been able to find any! :(

 

 

Tweet: 2014 for me was about the failure to have a honest...

2014 for me was about the failure to have a honest debate about . Today's recap on @BBCNews keeps adding spin / lies