Sometimes you want to perform a few checks before rendering an element on the page in any CMS. A common case is outputting an image, only if the document has an image url entered. Since the image url is optional you want to handle both cases, with url and without, gracefully. Here is a simple inline macro to check a property value before rendering a block of content.
<img src=”@Model.promotionalImage” />
I just upgraded to a MacBook Pro 15 with a retina display. So far I am loving the hardware, and of course the pixels. I am also dipping into some of the modern web frameworks that aren’t exactly web friendly. Specifically I am toying around with the nodejs frameworks like meteor and derby.
The first thing I am seeing is that almost all of these frameworks depend on you opening and editing hidden files(files that start with a period, e.g. .profile). Finder won’t show you these files so how do you edit them? One option is to open them from a terminal window using ‘open *some file name*’ but even in terminal the ls command won’t list the hidden files by default. Instead try sudo ls to get access to the hidden files as well.
As it is the documentation on the JS COM API in SharePoint 2013 is limited. Over time MSDN will surely become a great resource as always but for now we are left with what we had from SharePoint 2010.
In this series I intend to walk through the major touch points and give you the basics on what is possible.
SP.Web Overview [Coming Soon]
SP.ListItem Overview [Coming Soon]
This bit of code will register assemblies in the GAC without gacutil.exe, just putting it out here so I always have it.
[Reflection.Assembly]::LoadWithPartialName(“System.EnterpriseServices”) > $null
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish
If you just started running on an SSD you will enjoy the awesome speed boost it gives. That is, right up until you start getting constant alerts about low disk space.
To give you a little more room to work with consider disabling the Paging file. For me this cleared up about 16gb of space. It’s roughly equal to the size of the RAM you have installed.
Don’t forget to do the same on your VMs.
Today I ran into an issue with my SharePoint logs always being empty. I ensured that my logging settings were configured properly, and that the SharePoint 2010 Tracing service had proper permissions to log errors but all files were still empty.
Out of frustration I recycled the logging service and finally a log file was generated. Once I opened the file though everything became clear:
– Not enough free disk space available. The tracing service has temporarily stopped outputting usage entries to the usage log file. Usage logging will resume when more than 1124 MB of disk space becomes available.
– Tracing Service started.
– Not enough free disk space available even if all inactive log files are deleted. The tracing service has temporarily stopped outputting trace messages to the log file. Tracing will resume when more than 1124 MB of disk space becomes available.
Since my VM was very low on disk space the tracing essentially shuts itself down. Now I am off to figure out what I can delete from my VM.
I’ve decided to start building out a side project that focuses on bringing teams together. Since I never like to make things easy on myself I’m going to go ahead and learn Python and Django while building it out. This will give me a couple cool bonuses.
1. Developing with Python is free, no tooling needed
2. Hosting Python projects is free, no licensing needed
3. I’ll learn something new to program in
Off we go…
I decided to stick with windows for now to keep the setup time down, and because I just don’t want to get funky with linux right now. So I decided to jump things off with Instant Django after dowloading the file it appears to be an executable but upon launching it behaves like more of a zip file by decompressing and dropping all the files you need in the same directory as the .exe in a django folder.
So if you have this…
And you double click it, you’ll get this in the same directory…
In the django directory is a a start.bat file.
At first I thought this was a setup script that would get you environment configured for future use. It’s not.
Run start.bat any time you want to work with django, and it temporarily configures he settings needed to get you going. Close that command window or reboot and you should see those config changes disappear.
Pat yourself on the back, you are all set to get started now.
I’m following along in James Bennett’s “Practical django Projects” to get a decent start with django.
I love Apress 🙂
As you get started you run a few simple commands to ensure your setup is correct. I got to this line and got tripped up for a second:
I tried that and got this…
>>> import django
>>> print django.version
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: ‘module’ object has no attribute ‘version’
Oh no. My setup must not have worked. Python is too complicated…wait, the book has VERSION not version, maybe it’s case sensitive.
>>> print django.VERSION
(1, 2, 4, ‘final’, 0)
Yep, case sensitive.
Alright, so let’s get a project setup to work with. The book has us run the following command:
/usr/local/lib/python2.6/site-packages/django/bin/django-admin.py startproject testapp
I spent a few minutes trying to track down that django-admin.py file in instant django. Eventually I found it here:
So run this command to get your new project setup:
django-admin startproject testapp
That gives you a sub-directory called testapp with a few files you can poke around in. Including a manage.py file you can use to start the server.
c:\wip > cd testapp
c:\wip\testapp > python manage.py runserver
That’s it for now. You’ve got something started in django. I’ll keep adding to his series as I continue to get proficient in django and python.