Syntax Highlighting

Thursday, January 26, 2012

The students these days....

Gak, I was forced by the department chair to reply to a student who complained about the  fact that I "awarded [him] the grade of F." I had this student in a Programming Languages class I thought last semester. The class content, other than the class was indeed "hard",  is  immaterial to my reply. I had to teach this class at 8:30am MWF, which becomes somewhat relevant to the reply.


Mr.XXXX, 
"Award" is not a word I would associate with your performance in this class. The letter I sent out about grades stated what each assignment was worth. You should be able to do the math. Assignments and quizzes totaled roughly 30%. I did not mark your participation as 25% of the total. The 25% number was the grade you got on your final project/exam, and I was generous. That Final was 30% of your grade according to the Syllabus; and the exams, which you did horribly on, was another 30%. Participation was graded as 10% of the total. I gave you a grade of 10% on participation based on the amount of times you were absent from the class, and the times you decided to sleep in class when you actually showed up, always late, and the times you made appointments with me and did not show. Telling me you "have a real problem getting up in the morning" did not go over so well, as well as subsequently asserting "no, really!" and showing up at 10:30am for a 9:00am Final Exam. No, Mr.XXXX, you indubitably earned your grade. I did not "award" it to
you.
Good Luck,
-Polar

Tuesday, January 24, 2012

Sharepoint Anomally Number 1


Okay, so Sharepoint has the "Content Types" which are basically DB Table Schemas. They tell you that a SP List is basically a SQL Table, and the ContentType defines the Columns, to a degree. A SP Content Type may be extended from one of the base types, but you get the idea.

The problem is when you want to put a Custom Action on something that is of that type and it should apply to only that type, i.e. not all Lists, or all Forms.

Knowing how to do that programatically is a pain, because you need to find the internal ID of the ContentType to put in an Elements.xml file for a Custom Action:

<CustomAction
  Location="EditControlBlock"
  RegistrationId="0x023429892348209804323"
  RegistrationType="ContentType"
  ....>

So, The RegistrationType tells Sharepoint the context for  RegistrationId. When it's a ContentType, where do you get the ID of the Content Type? It's virtually impossible given any tool from Sharepoint. However, you can get it, if you go to:

Site Actions > Site Settings > Galleries > Site Content Types >

and select the Content Type you want for viewing you will see the Content Type Id in the URL as the "ctype" argument.

http://sites/site/_layouts/ManageContentType.aspx?ctype=0x02342989234820980432&Source=http%3A%2F%2Fsite........
 
Now, isn't that neat? Guess how long it took me to figure that out!
Geez.

If you know a better way, please post below.

InfoPath to Word? No go.

I've gotten a project where I have to turn a filled out InfoPath form into a Word document. After considerable research on the matter, despite what a lot of people say, it is best left undone. The XSLT you have to create must really be done by hand, and it should produce something you can do by hand. The reason people want it in Word is so that they can format it. However, the natural tendency is to want to format the word document as a template before its fields are populated with the data in the InfoPath. There are various tools in Word or even OpenOffice/LibreOffice to get this done, but the problem is with InfoPath "repeating tables". These are devices the form uses to populate XML structures, but multiples of them. To use this effectively, you need to use:

<xsl:for-each select="my:myFields/my:SomeElement">
  The "." means from the current my:SomeElement.
  <xsl:value-of select"./my:SubElement"/>
</xsl:for-each>


If you unzip the "docx" file you can extract "word/document.xml" and make this document an XSLT transform. However, you cannot load it back look at it as a Word document. So, trying to update the formating of the word document really requires you to start the whole process from the beginning, which is daunting to say the least.

The best way is to create something you can create by hand, such as an HTML document, and use some clever CSS to format it.

My foray into Microsoft Sharepoint

Okay, so many of you know that I'm very skeptical of Microsoft products since the days of MS-DOS, Word 6.0, and Window NT, and that disaster called Vista. I'm a Unix/Linux/BSD guy all the way. I keep a VirutalBox of Windows Server 2003 just to house an outdated version of Quickbooks, and to use TaxAct.

I've found myself these days having that criticality dated at this point, and I need to know more. Stay tuned to this blog as I delve into the world of Sharepoint development helping out a small Sharepoint consultant firm. I know nothing of Sharepoint, InfoPath, or even Windows 7.

I will be working with the 2010 series of products. I put Lync on my Windows server and it sucks on audio and screen sharing is really slow, but that could be the Virtualbox.