Running a doctrine:data-load on my Symfony web project’s data/fixtures.yml file and finding an empty database was my latest infuriation. I narrowed it down to some of the data having a Unicode character (the offending letter: ö).
Initially I thought it may be the format that the database was configured to communicate or store in. While the collation was the default latin1_swedish_ci, this isn’t the problem because the collation only defines the rule set by which text is compared. I also found no settings restricting the input or storage form.
The problem was the storage format of the data/fixtures.yml file. Despite my text editor (TextPad in this case) being able to interpret the characters correctly in their 8-bit extended ANSI form, the Doctrine processor does not. You simply must save the file as Unicode format and it will then interpret correctly.
I’ve begun using the Symfony MVC framework for a website I am developing. When trying to perform a doctrine:build to rebuild the database, I was noticing an error:
SQLSTATE[HY000]: General error: 1005 Can’t create table ‘mta.#sql-b90_1e0′ (errno: 150). Failing Query: “ALTER TABLE mta_album_instance ADD CONSTRAINT mta_album_instance_author_user_id_mta_user_id FOREIGN KEY (author_user_id) REFERENCES mta_user(id) ON DELETE SET NULL”. Failing Query: ALTER TABLE mta_album_instance ADD CONSTRAINT mta_album_instance_author_user_id_mta_user_id FOREIGN KEY (author_user_id) REFERENCES mta_user(id) ON DELETE SET NULL
Initially I was thrown because it writes “Can’t create table” for table that has clearly been created. Also it repeats itself just to make it a little harder to read. This is about adding a foreign key constraint though.
I want to set up my table so that a deletion in the foreign table will set a column to null. In Doctrine YAML this looks like so:
From the error output, the reason for the problem wasn’t obvious. It turned out to be that the column had a ‘not null’ attribution. Once this was removed everything was good.
The Assigned To Me Web Part displays a summary list of any item currently assigned to you. This web part is useful in cases where your SharePoint site is divided into numerous sub-sites and lists. Items are grouped by list with a sum total of items assigned to you per list.
To download this web part as a compiled WSP package, or for more information, click here:
A web part I’m creating must display an option to save settings, but only for designer (or administrator) users.
Web Part Page documents are SPListItem objects internally, even though SharePoint makes a distinction between document and list libraries in the user interface. I couldn’t find a path through the object model of finding this SPListItem that my web part instance was a part of. Instead I accessed the item via the current URL and a reference to the context’s SPWeb.
A typical problem with assessing permissions (or roles) for a non-administrative user is that SharePoint savagely denies access to it. Try/catch blocks can be ineffective here, with ASP.NET deciding to redirect to the ‘Access denied’ page. Depending on what you need to do, there are methods involving simple impersonation or more convoluted techniques.
Thankfully I found a peace-loving property .AllRolesForCurrentUser that accurately returns the item-level roles for the current user, regardless of their permissions level.
While customising the XSLT of a DataFormWebPart I found a discrepancy between design-time and run-time interpretation of a template tag implementing param and variable tags. Placing the <xsl:param> tags first is important.
SharePoint users have a tendency to create All Items views containing almost every column in their lists. In cases like these, the readability is often poor, and SharePoint gives users no ability to format the cells appropriately (such as text alignment, column width, etc). One case where this is most disrupting is for multi-line text columns. Single line text columns have a CSS width setting, but multi-line columns depend on the user including a sensible amount of columns to view. The image below illustrates this circumstance.
(A topical essay I wrote for an Energy Economics unit)
Cheap energy has been abundantly available for the last century. But is it really as cheap as it seems? Conventional energy trade carries external costs that neither the producer nor the consumer pays. Society at large must foot the bill for negative social and environmental by-products of energy production and consumption. This paper discusses the consequences of the failure to incorporate these externalities into the price of traded energy.
Externalities are defined as benefits or costs generated as an unintended by-product of an economic activity that do not accrue to the parties involved in the activity and where no compensation takes place[5]. In other words, any party (be it an individual, a group, a society or world-wide) external to an economic transaction may receive positive or negative impacts to which they had no intention or input in accruing.
In developing the Digital Signature Field for SharePoint I wanted to add a graphic to clearly display the current state of the signature. Is the signature old, new or invalid? A coloured tick can convey this intuitively while economising on size.
Controlling the rendering of a custom field’s value in most display modes is straight-forward through overrides to the SPField method GetFieldValueAsHtml(object) and the Render(…) methods of BaseFieldControl. When it came to rendering the value on the list display (i.e. AllItems.aspx) I found that SharePoint limited me to doing this through the RenderPattern element in the field type definition XML, with the caveat that any values, properties or calculations be limited to the CAML View Schema elements. The MSDN documentation on Patterns of Custom Field Rendering hints that a DisplayTemplate specification will let you gain control of the display mode, including the list display. After messing around for a while I felt quite confident that it didn’t include the list display mode.
Some Googling later, I found someone who had bent the rules a little to achieve complete control over display list value rendering. This IconSet custom calculated field project uses a custom RenderPattern to generate a script reference to a custom aspx page that dynamically renders some document.write(…) code that then renders HTML. Values necessary to identifying which item and field are supplied by the CAML and passed by URL parameters.
Singularity Hub rounded up the most interesting developments in robotics through 2008. Most of them are the humanoid variety. I know replicating biped movement and stability is a challenging task and still at the forefront of robotics pursuits, but I always like to see the evolutions in alternative robotic anatomies.
In my opinion, the coolest, and by far the most creepy, is a quadruped that is capable of traversing almost any terrain while carrying 150kg on its back. It’s called BigDog, but I think it’s more of a big mountain goat that buzzes like a wasp. The video is great - BigDog stumbing around foolishly on black ice, and swaggers to reclaim balance after a guy kicks it with all his weight. Are we permitted a little schadenfreude for robotic animals?