Monday, April 19, 2010

Announcing Facebook as 2010 TopCoder Open Sponsor (and they're hiring)!‏

Facebook is excited to be a part of the 2010 TopCoder(R) Open!
Facebook is also looking to hire the best TopCoder members for both full time and internship positions.
Let us know if you're interested. We'd love to meet you to talk more about some of the awesome engineering opportunities we have.
http://www.topcoder.com/tc?module=Static&d1=tournaments&d2=tco10&d3=overview&d4=sponsor2
Facebook is built by a relatively small group of the smartest engineers, hackers and entrepreneurs who each have a huge impact on the 400+ million people that use Facebook around the world. We work in small teams, so every Facebook engineer is responsible for more than one million users, a ratio that is 10-30 times greater than other technology companies.
We are constantly challenged to scale quickly and efficiently, and have some of the best engineers working together to solve today's toughest technical problems.
Help develop the second most-trafficked site and one of the largest MySQL installations in the world.
Build with PHP, C++, Python, Java, Erlang, and even a little bit of ML.
Hack on open source infrastructure technologies to support the site's growth including HipHop for PHP, Cassandra, Hive, Scribe, and Thrift.
Enhance our custom-built search engine that serves millions of queries a day.
Grow Facebook Platform, one of the world's most advanced social platforms.
At Facebook, we move fast. Our rapid development cycle is supported by tools that always keep us operating ahead of the curve. Our engineers are able to write code and have it running live on the site that same night - see the impact you're making in real-time.
Best of luck in competitions leading up to the 2010 TopCoder Open Finals and we hope to see you there!
http://www.topcoder.com/tc?module=Static&d1=tournaments&d2=tco10&d3=overview&d4=sponsor2
Learn more about the TCO10 here: http://www.topcoder.com/tco10
- Facebook and the TopCoder Competitions Team

Labels:

Friday, April 16, 2010

Office Talk Sharepoint 2010 Awards

It's SharePoint Awards Winners 2010

So here are the Winner and Runner-up in each SharePoint category. These companies will all be receiving a special ‘Seal of Approval’ in the next ten days.

1. BEST SHAREPOINT INFORMATION SITE
Winner -
EndUserSharePoint.com
Expert Comment – A great site written not for developers but for real SharePoint Administrators. It really feels as if they care.
Runner Up -  SharePoint Magazine

2. BEST SHAREPOINT WEBPART PROVIDER
Winner -
Amrein Engineering
Expert Comment - Very easy to navigate round site.  Like the variety of web parts on offer and how they are explained, lots of crowd pleasers in there.
Runner Up -  Kwizcom
3. BEST SHAREPOINT ADMINISTRATION TOOL 2010
Winner -
ControlPoint (scored a perfect 10)
Expert Comment - Hands down the best in the industry.  Very user friendly. Extremely strong permissions reporting capability – the top requirement for managing large farms as 80% of all support calls come from permissions management.

Runner Up - DocAve Administrator
4. BEST WEBSITE BUILT ON SHAREPOINT 2010

Winner - Chilis
Expert Comment - The most fun site I have seen in years!  That chalk work is amazing!  Great branding.
Runner Up -  Swatch

5. BEST SHAREPOINT TRAINING PACKAGES 2010

Winner - Combined Knowledge CBT
Expert Comment – Combined Knowledge continues to lead the way with SharePoint Training. You can tell they understand SharePoint.
Runner Up - CBT Clips
6. BEST SHAREPOINT OFFLINE SOLUTION 2010
Winner -
Colligo Contributor (perfect 10 again)
Expert Comment - An all great round solution which is easy to use.  They offer more than just Outlook integration. 
Runner Up - MyDocs

7. MOST USEFUL SHAREPOINT WEBPART 2010

Winner -  Column\View Permissions
Expert Comment - By far the most business benefit – one of the top requests I get on a daily basis.  This tool is perfect to resolve that!

Runner Up -  Bamboo sharePoint video Library
8. FAVOURITE FREE SHAREPOINT WEBPART/ADD-ONS 2010
Winner - Google Charts
Expert Comment – Making life simple is what we all want and this is what Google Charts does.
Runner Up - Visualizer (Digital Assets)
Expert Comment - Phwooaar, coooool.  Very slick.  Great way to wow your audience.  End users love stuff like this. 
9. MOST FUN FREE WEBPART 2010
Winner -  Daily Dilbert
Expert Comment – Start your SharePoint with a smile every day.
Runner Up - Hello User
10. BEST SHAREPOINT APPLICATION 2010
Winner -
ShareKnowledge – E-Learning Solution
Expert Comment – Brilliant ! Now businesses can really use SharePoint to train their workforce. Great for Health & Safety courses. So easy to design courses as well. Ideal for any size organisation who have SharePoint.
Runner Up - MediaRich Digital Asset Management

So those are the winners but all the finalists offer terrific SharePoint products and I recommend you trial a few yourself.

Labels: ,

Open XML SDK 2.0 weird issues

 

I was creating and modifying .docx Word files with the Open XML SDK and have got some strange behaviors.

One if them was that I wrote some code to open a blank document and added some Paragraphs with Bold fonts.

Then I opened it with Word and all was ok. I saw my created Paragraph on bold.

The problem was when I tried to open it on another computer. Word told me that the file was corrupted.

So I decided to open it with the Productivity Tool and validate the corrupted file and I got some info like this.

 

 Error description:The element has unexpected child element 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:rFonts'.

Content type of part with error: application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml

 

Location Path.xpath:/w:document[1]/w:body[1]/w:p[6]/w:r[1]/w:rPr[1]

 

The code I used was something like this:

 

// Creates an RunProperties instance and adds its children.
public RunProperties GenerateRunProperties()
{
    RunProperties runProperties1 = new RunProperties();
    Bold bold1 = new Bold();
    RunFonts runFonts1 = new RunFonts(){ Ascii = "Trebuchet MS" };
    Color color1 = new Color(){ Val = "000000" };

    runProperties1.Append(bold1);
    runProperties1.Append(runFonts1);
    runProperties1.Append(color1);
    return runProperties1;
}

 

And when I deleted the Bold , all worked fine.

 

Someday I’d like to know why this happens…

Perhaps it happens in this CTP version…

Labels:

Monday, April 12, 2010

Adding a Sharepoint footer (globally)

GOAL

I recently wanted a portal/sites wide footer for my SharePoint installation. I wanted this to affect the SPS portal and every WSS site without my needing to modify any of the .aspx pages that come with SharePoint.

RESEARCH

I found a great blog article on creating a footer with various means.

danielmcpherson - How To Create A Footer

Read the article and you may come to the same conclusion that the "3. DHTML and Stylesheet" solution is the most compelling, requiring no changes other than style sheet. Unfortunately this technique only works on IE due to HTC.

This effort underway which may help, but I was unable to graft into my scenario:

Scott Galloway - Use HTC within Mozilla!

I was convinced that the DOM script within the HTC was going to ultimately cause an incompatibility, so I scrapped the stylesheet-only idea.

SOLUTION

I ultimately created an HttpModule that I plugged into the site to put a footer on every dynamic page in the virtual directory. This "filter" would look for a </body> tag within any HTML content before it sent it to the user, and inserts my footer code. To make it more "style-sheet like," I decided to insert a javascript reference so that the content of the footer could be maintained by a separate file.

The trick is to create an IHttpModule implementation that installs a customized Stream filter to capture, watch and manipulate the text. Unfortunately stream needs to implement Stream and all it's methods so that you can override the Stream.Write(byte[] data, int offset, int count) as well as optionally Stream.Close(), Stream.Flush() or anything else you want.

I chose to capture all data pushed into Stream.Write(), and modify/output it only on Stream.Close(), with special attention on the destructor to make sure Stream.Close() was actually called.

Interesting excerpts:

public class MyFooterModule : IHttpModule
{
public MyFooterModule() {}
public string ModuleName { get { return "MyFooterModule"; } }
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
private void context_BeginRequest(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;
context.Response.Filter = new MyFooterFilter(context.Response.Filter, context);
}
public void Dispose() {}
}
public class FooterFilter : Stream {
public const string FOOTER_HTML = "<script src=\"/Elements/Footer.js\"></script>";
public const string BEFORE_REGEX = @"</body>\s*</html>";
protected byte[] mycache = null;
public override void Close() {
if (mycache != null)
{
string buffer = System.Text.UTF8Encoding.UTF8.GetString(mycache, 0, mycache.Length);
Regex regex = new Regex(BEFORE_REGEX, RegexOptions.IgnoreCase);
Match match = regex.Match(buffer);
if ((match != null) && match.Success)
{
StringBuilder newBuffer = new StringBuilder(buffer.Length + FOOTER_HTML.Length);
newBuffer.Append(buffer.Substring(0, match.Index;));
newBuffer.Append(FOOTER_HTML);
newBuffer.Append(buffer.Substring(match.Index;));
mycache = MakeByteArrayFromString(newBuffer.ToString());
}
BaseStream.Write(mycache, 0, mycache.Length);
}
base.Close();
}
}


When you get to the installation, consider signing the assembly, and NOT putting it into the GAC, or resorting to setting web.config to Full trust. In the meantime, do whatever it takes to make the following line work in your web.config file:



    <add name="FooterModule" type="MyNameSpace,myassembly"/>
</httpModules>


You will have to put the assembly in the site's bin directory. Also put it into the layouts bin directory if you want to have the footer appear in the _layouts/1033/*.aspx pages.



By installing this footer module into the default web site's web.config file, every portal and site .aspx page will be affected. Making the same modification to the layouts virtual directory will add the footer to the _layouts/1033/*.aspx pages, but some will look undesirable such as the rich text editor. As far as I've found, no pages actually break using this technique the the provided regular expression during content manipulation.



I heard that this type of filtering does not properly adjust the Content-Length header, which should be a problem, but I have not seen any ill effects yet.



 



This was an old post on MindsharpBlogs that unfortunately is not more online.

Labels: , , ,

Wednesday, April 07, 2010

Changing fonts with Open XML SDK 2.0

 

Take a look at the next code if you need to change or replace the font name or size on paragraphs of a Word Document.

 

using System.Xml.Linq ;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;

private void changeFonts()
        {
            string myFile = @"\\MySharedFolder\myDoc.docx";

            WordprocessingDocument doc = WordprocessingDocument.Open(myFile, true);

            //iterate through paragraphs
            IList<Paragraph> paragraphs = doc.MainDocumentPart.Document.Body.Elements<Paragraph>().ToList<Paragraph>();

            foreach (Paragraph para in paragraphs)
            {

                foreach (Run r in para.Elements<Run>())
                {                 
                        foreach (RunProperties rp in r.Elements<RunProperties>())
                        {
                            try
                            {
                                //t  rp is our current RunProperty
                                rp.RunFonts.Ascii = "Arial";
                                FontSize myFontSize = new FontSize();
                                myFontSize.Val = new StringValue("50");
                                rp.FontSize = myFontSize;

                            }
                            catch (Exception ex) { }
                        }                   
                }
            }
            doc.MainDocumentPart.Document.Save();

        }