This blog is about software development; patterns; best practices. Technologies I prefer: C#, C, .NET web stack, XML, XSLT, Razor, API's, Sitecore, CMS, and and more. This blog will primarily be about issues I encounter on the way, in order to remember it better myself.
Monday, November 16, 2009
XsltUrlEncodingInDotNet
<msxsl:script language="JScript" implements-prefix="xmlnamespaceofchoice">
<![CDATA[
function urlEncode(strURL)
{
return encodeURIComponent(strURL);
}
]]>
</msxsl:script>
and then calling the
<xsl:value-of select="xmlnamespaceofchoice:urlEncode(string(//myElement))" />
voila
Friday, November 6, 2009
Sitecore editor hassles
within the sitecore editor:
"Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: no segments* file
found in Sitecore.Data.Indexing.FSDirectory@D:\Inet\Websites\Development\Website\indexes\master\system:
files:
"
Just a plain .NET Exception page... What caused the error?
/*TODO: description LUCENE, stackoverflow,*/
FIX:
Goto sitecore "control panel", choose "Database" and "Rebuild the
Search Index" and reload sitecore. Done :)
Sunday, June 7, 2009
OneClickSuperSmoothOnlinePhotoGallery
Now I have finally found an interesting setup, where all my needs(until now) have been met.
I worked with the flash based airtight simpleviewer component for a while and found it very usefull, configurable, and visually satisfying. You can configure the amount of thumbnails to display, the size of these, the layout(mostly colors and borders), the position of the thumbnails(top, bottom, left,right) and numerous other settings. The gallery information is maintained within an xml file and therefore it is easy to generate this information based on eg. images within a folder structure(I have done this before working on http://www.elileibo.com/ and http://colorrange.com/).
But still..I don't want to manually upload all the images for a gallery and the associated text files describing each picture, when what I really like to do is taking pictures and editing them.
Recently I found out that adobe lightroom 2.2 has an integrated functionality that enables you to compile a gallery(within the application), configure your ftp settings for your domain, and upload the compiled gallery as a simpleviewer gallery! This means that I do not need to spend time uploading all the files I have been developing anymore. Furthermore I do not need to write individual text files describing each image, here I just configure lightroom to add various information to the gallery (information like date information, keyword information etc.).
The last thing needed to finalize my one-click super-smooth photogallery was creating an index page displaying all the galleries on my domain. That was accomplished by writing a bit of C#, css and html(around 400 lines of code) and bada bing -
http://digitaldynamo.dk was done.
Layout is a matter of taste. I like it. Its simple and smooth. Main focus is on the photos anyway. The interesting thing here is that I now have a one-click super-smooth photogallery. I just have to compile the gallery within lightroom, tag the photos, write 3 lines of text , one for the gallery page title(displayed in the top of the browser), one describing the gallery, and the final one - the name of the folder on the ftp server. Then i simply hit "upload" and check it out on my website :)
Sunday, February 8, 2009
OurFrailSociety
Of course this could be circumvented by just changing the DNS server settings on my computer to use an alternate DNS server like the ones that OpenDNS have made available, but this might only be an option for more experienced users. People who solely use computers to search the internet for information might actually experience this as cencurship.
But what is it next time? Websites that post radical opinions? Websites or services that contain content that contradicts the political direction that the current government is pointing out? We've seen this in China, but we, here in the democratic parts of western europe, are way beyond such dictatorial means of censorship, right?
And what about the power of the police? Here in Denmark the police has created body search zones within the city of Copenhagen. Official reason is the increasing amount of violence, but there seems to be no officially defined end date for this parade of dominance.
I'm not saying that I would prefer a more violent society, I don't say that we should not have a strong police force who are able to work efficiently, but when the only argument for body search zones is that it is an efficient tool that the police can use, I find it barrier towards police raids and people disappearing, which might turn out as very efficient tools for certain missions, I find the barrier between our current society and a police state very thin.
Combined with the tolerance of more and more surveilance cameras in the public domain, although it is clearly prohibited by law, I find that there is a tendency towards a more police dominated society where civil rights are transgressed further and further.
If we just stand by watching where will this end?
Saturday, February 7, 2009
MScThesisContainingPex
Now back to the more technical stuff:
I've been talking to my thesis supervisor about which projects I consider interesting to work with for the next couple of months and he suggested a very promising testing framework that is under construction in microsoft research called Pex.
It is an automated white box testing framework that helps identify corner cases of input to your code. It will display these corner cases and let you generate Unit tests with these inputs as parameters. Yes that's right: Parameterized Unit tests. That is pretty cool!
The basic work flow is as follows: write your code(needs to be public methods), right click within the method you wish to generate input for, Pex will try to analyze every statement of your code and ensure that every code path is followed.
When the input is generated you simply select all the generated rows and hit save. This will generate Unit tests in a separate project, just like you would setup any other Unit test project.
Now you can run any of these corner cases as a regression test of your method and be sure that these corner cases will be tested, too.
If you want to extend the tests that Pex generate, you simply extend yet another generated .cs file that contains your Parameterized Unit Tests(PUT).
If you think any of this could be of any help to you or your project, do visit the clever guys running the project at research.microsoft.com/pex/ and check out the documentation.
I will definitely write more on this project in the coming months and discuss the opportunities of this interesting framework with colleagues and fellow students.