Let's all turn off on-site commenting, and allow replies via moderated trackback. Anyone can start a blog and participate with increased civility and ownership. DONE.
Sander van Dragt's Notes
-
-
Enum label lookup
In your datamodel you might have a Enum field such as this date-based dropdown:
public static $db = array( "Year" => "Enum('2013, 2014, 2015')" }Internally, SilverStripe stores the index, so that when you retrieve the value in methods such as onBeforeWrite, instead of 2013 you will receive 1. Use the function below to retrieve the label of the Enum:
public function EnumLabel($field_name) { $enumValues = $this->dbObject($field_name)->enumValues(); $label = $enumValues[$this->$field_name]; return $label; } // $year = $this->EnumLabel('Year'); -
LessThanOrEqual in SilverStripe 3.0
When adding a filter on a
DataListsometimes 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.
-
App.net is now receiving snippets from my site. ?
-
#iosstorymode "the best of the year of high quality of life and the other hand is the only thing that would have to go back."
-
#iosstorymode Open a new note, enter the first word, then keep pressing the text suggestions button and see what stream of consciousness erupts.
-
Tip: keep a list of domains covered by security certificates and their expiry dates.
-
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.
-
Tip: disable IFTT URL shorthening via account > preferences > URL Shorthening to post meaningful URLs to Twitter et al.