Car insurance

Archive for Uncategorized

My Microsoft Office SharePoint Server Workflow and Forms Webinar

// June 13th, 2008 // No Comments » // Uncategorized

Details:

Click here to join the Webinar: https://www1.gotomeeting.com/pjoin/280371218/105341790

This link should not be shared with others; it is unique to you.
2. Join the conference call:
Dial: 1800 500 364
International Number: +61297791200
Access code: 3218515
Webinar ID: 280-371-218
System Requirements:
Windows® Vista, XP Pro, XP Home, 2003 Server, 2000, 2000 Server
Mac OS® X 10.4 (Tiger®) or newer

Creating a Field Control for Sharepoint – A FilePicker!

// April 14th, 2008 // 1 Comment » // Uncategorized

Whilst doing a project for a client i came across an interesting need to be able to upload documents/files within a list. Almost like a filepicker control for a list. When i had a look around i quickly found what i was looking for here. The filepicker looks great, my one problem is I didnt have the money to buy it!

My recent interaction with custom content types got me thinking and upon more research i found it was possible to create a Field Control within Visual Studio. (provided you have WSS Extensions for Visual Studio installed). So i went ahead and added an “Empty” project under the sharepoint templates, and then proceeded to add a new item to the project, which gave me the option of adding a “Field Control”.

In similar fashion to the creation of a webpart, one is able to spit out controls and obviously the code behind them, which makes anything possible. Here is my code for the FilePicker class:


public class FilePicker : TextField
{
private FieldControl1Field field;
private FileUpload fileUpload;
private HtmlTable table;
private string _td_path = “/BusinessUnits/IntHR”;
private string _DestUrlPath = string.Empty;
private string _DestFolder = string.Empty;
byte[] contents;
private SPSite _site = null;
private SPWeb _web = null;

public FilePicker(FieldControl1Field parentField)
{
this.field = parentField;
this.fileUpload = new FileUpload();
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
private string _uploadDocument(string theFile) {
try {
string serverName = “http://” + this.Page.Request.Url.Host;

SPSite site = new SPSite(serverName);
SPWeb web = site.OpenWeb();
SPUser user = web.AllUsers["VODACOM\\FARQVHCO"];

SPUserToken token = user.UserToken;

using (SPSite mySite = new SPSite(serverName + _td_path, token))
{
using (SPWeb myWeb = mySite.OpenWeb())
{
SPListItem myNewItem;
SPList list = myWeb.Lists["Photos"];
Stream fStream = fileUpload.PostedFile.InputStream;
byte[] contents = new byte[fStream.Length];

fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();

SPFile newFile = list.RootFolder.Files.Add(Page.Request.QueryString["ID"].ToString(), contents,true);

//Get the file

return serverName + _td_path + “/Photos/” + fileUpload.FileName;
}
}
}
catch (Exception x)
{

throw new Exception(x.Message + “errorhere”);

}
}
protected override void CreateChildControls()
{
base.CreateChildControls();

this.table = new HtmlTable();

HtmlTableRow row = new HtmlTableRow();
table.Rows.Add(row);

HtmlTableCell cell = null;

if (this.ControlMode == SPControlMode.Edit || this.ControlMode == SPControlMode.New)
{
cell = new HtmlTableCell();

cell.ColSpan = 2;
cell.Attributes["class"] = “ms-formdescription”;
cell.InnerText = “Choose a file:”;

row = new HtmlTableRow();
table.Rows.Add(row);

cell = new HtmlTableCell();
row.Cells.Add(cell);

// Create a list selector.
this.fileUpload = new FileUpload();

cell.Controls.Add(this.fileUpload);
row.Cells.Add(cell);
}

base.Controls.Add(table);
}

public override void UpdateFieldValueInItem()
{
this.EnsureChildControls();

try
{
string uploaded = _uploadDocument(this.fileUpload.PostedFile.FileName);
this.Value = uploaded;
this.ItemFieldValue = this.Value;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}

protected override void Render(HtmlTextWriter output)
{
this.table.RenderControl(output);
}
}


You’ll see i simply spit out a fileupload control and upload the file contents to a photos list. The hardcoding isnt great, but you get the idea to be able to create any type of control for you lists.

The main class simply spits out the filepicker control:

// TODO: Replace, as needed, “SPFieldText” with some other class derived from SPField.
// TODO: Update, as needed, ParentType element in fldtypes*.xml in this solution.
[CLSCompliant(false)]
[Guid("2a99cebe-f11c-488c-9717-0f674b5ab3a6")]
public class FieldControl1Field : SPFieldText
{
public FieldControl1Field(SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{
}

public FieldControl1Field(SPFieldCollection fields, string typeName, string displayName)
: base(fields, typeName, displayName)
{
}

public override BaseFieldControl FieldRenderingControl
{
[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
get
{
BaseFieldControl fieldControl = new FilePicker(this);
fieldControl.FieldName = this.InternalName;

return fieldControl;
}
}
}

Then the xml which is included in the templates section looks a little like this msdn article (see the bottom of the page). In actual fact follow that article too, its a great help!

well hope this helps

Cannot ping network computer

// March 6th, 2008 // No Comments » // Uncategorized

So you can’t ping a network computer but it can:

1. ping any computer on the network
2. be part of the network
3. do anything on the network

So basically its on the network but you cannot access it. Well dont be a retard like me and spend 6 hours turning on and off firewalls on Small Business Server or reconfiguring network cards. If you have Cisco VPN installed follow this post and basically feel like a twat afterward!

2008: My To-do

// January 20th, 2008 // 1 Comment » // Uncategorized

After reading nic’s to-do list for this year, i decided to blog my own. I had written it down, but i figured, why write it and lose the piece of paper, when you can blog it and read it all year! Strangely nic had a few that i had

(in no particular order)

1. Learn to play guitar properly
2. Learn to dance properly (i really want to learn the hustle and salsa!)
3. Dive in places around South Africa I haven’t dived.
4. Get my Advanced Open Water Divers.
5. Travel to another African Country (im thinking Zanzibar)
6. Go on a Quad bike tour
7. Run 750 kms using my Nike + ipod and shoes!
8. Relax away from work
9. Go to Toastmasters
10. Spend less time on Facebook

Bliksem: My Facebook App

// November 29th, 2007 // 1 Comment » // Uncategorized

After many long hours: My app is ready!!

I like to call it my attempt to capture the South African Facebook market using a global facebook idea. To summarise further, its the all time hit popular app, Superpoke, but with a South African flavour!

I plan to start a blog on its usage and graph the growth of it. But for now, please add it here

The Facebook App: My dealings with the Facebook Platform

// November 23rd, 2007 // 2 Comments » // Uncategorized

On Thursday last week I went to a very insightful and motivating Developers Garage at The Campus. All involved presented very well, especially Tyler Reed, who I think has a great future in the industry. No this is not a blog post bigging up other bloggers :-)

I had had some experience with the platform and had half developed an app which hit a wall when i realised i couldnt access some info on a user (users.getInfo) due to privacy restrictions. After googling a lot, I realised there isnt much on Facebook application creation and development at all. Luckily through a lot of grit, debugging, and pain I have almost completed my first app, which ill post about when done! So this blog post goes out to those who are considering creating an application:

1. Use the demo project (footprints) as a basis for your start.

2. Plan your app completely: Map out all the functions of your app. You may at some stage require information in your app which no method in the facebook platform supports! You are limited in the information you can manipulate, fetch and return. For a very good reason: Security and Privacy of users info is vital to Facebook (hint: Lawsuits)

3. If developing in php, write out (debug) all the variables which you not quite sure what they returning. They dont always return what facebook says.

4. Use a mixture of FBML, the API and FQL. There are some really helpful FBML tags which make your life very easy. For instance the invite page is all setup. check out the request form

5. Your only resources are: The Developer Forum and the WIKI. Use them wisely!

My issues with the platform:

1. The platform is a work-in-progress. It changes all the time, daily, hourly, which means one thing: your application has to support these changes. For example, the notifications.sendRequest method, which sent out notifications in both email and notification form has suddenly been discontinued. All those apps which used this method better have a try catch statement otherwise its tickets! Another example is the feed:publishTemplatizedAction, which publishes a feed to the mini feed and news feed. In Facebook’s latest developer news post, they mention you will have to register a new template for each action you wish to publish for it to actually stand a chance of making it into a persons news feed. Even still, it may not make it, Facebook decide which stories cut the grade for the news feed when you execute this method (some developers like to call it fb:magic :-) )

2. The WIKI is useless and is not kept up to date: The wiki gives a brief overview on how to use each method, what parameters to pass and EXPECTED return. However in most cases there are no examples, and if there are examples, then they dont work!
In another example, if we have User A, the calling user and User B, the user who is not a registered user of the app, the wiki for the notifications.send states that if you pass the email parameter using that method, and you try to send a notification to User B, using User A, itll return a URL which redirects the calling user to a page where you can ask them to confirm that they would like to send that user an email. However this is not the case. It returns 0, which is not even a registered return value on the wiki!! Which brings me to my next point:

3. Use the forums: After the above issues which i experienced with my development, i started posting on the forums for help. This is where i learnt that notifications.sendRequest is no longer supported (facebook use the term: deprecated). Also according to some developers, that Notifications.send won’t support the email parameter in time to come.

But these are all suggestions by fellow developers, which are not substantiated by Facebook. So one guy tells me that the email parameter wont be supported in while (who knows when?) whilst others say on the 4 december, the email parameter will be supported! Now im not saying my code is completely bug free, but then again I took the measly example from the wiki, and it doesnt work like they say it would!!

Here are some tips for Facebook I feel would help the Facebook developers out there to make strong, bug free apps:

1) Dont deprecate methods: If you decide to support one, support it for time. If you have 9000 apps, and 6000 are using a deprecated method, then you will have many unsatisfied users!

2) Provide examples in all supported code: PHP, C# Perl etc. Microsoft do it consistently in their MSDN which helps so much!

3) Make sure you have your developers on the forums answering questions. Rumours about methods and what they do start to circulate which can lead others down the wrong paths!

With all that been said: If you are developing an app, and came across this blog post, i’d love you to drop me a line on your feelings, or if you are in need of help, give me a shout, Im more than willing to help!

Facebook Developer – Johannesburg – South Africa

// November 8th, 2007 // 1 Comment » // Uncategorized

If you looking for one, im your man! Just finished my a collaborative app to sync your events to your gmail calendar! i think its super handy! Speaking of which:

Facebook Developer Meeting – The Internet Solutions Chill Room – The Campus, Bryanston – 15 November!!!

Im excited

Are you a geek?

// November 6th, 2007 // No Comments » // Uncategorized

Found this on nic’s blog. and i have the following results:

62% Geek

Free Minnesota Personals

Check it out

Do you enjoy winter?

// May 22nd, 2007 // No Comments » // Uncategorized

Can i ask why? can i ask if you enjoy, lying in bed, the warmth, whilst the heater is turned up full and your toes may as well be eskimo pies. Knowing that u have to get out of bed and to the shower. Whilst you wait for the water to get luke warm, u have goosebumps bigger than chicken pox. Then you get out and the pain of the cold smashes you harder than a brick in the face as you stand there half naked. And when you wanna shave its like having your skin torn off by a german military officer at the local jewish concentration camp. You sprint to ur room, put on as many clothes as you can and then go and brush your teeth if u can get water flowing from the tap.

After being shocked by 5000 million volts of static whilst getting in the car (passenger seat if u have a peasant car like me) you hold the steering wheel and realise that it actually has dry ice on it and so ur hands are now stuck there as you try to reach for the gear knob with the corner of your hand hoping u wont touch the cold plastic part. If you have a carborator engine, you have the choke yanked out to the max, the heater is blowing cold air, because lets be honest, WHERE WOULD IT FIND HOT AIR?

RSS Viewer Web Part

// May 16th, 2007 // No Comments » // Uncategorized

In my dealings with the large corporate which im currently deploying MOSS 2007 for, Ive had the need to create a news web part with a little more colour and flair than the standard out the box custom list provided. I thought it would be nice to let the news “marquee” up the page.

It suddenly dawned on me that i should use the RSS viewer to view the RSS of the custom list I’d created. Great idea. I then found a blog on how to make the text scroll. Great stuff!

I applied the RSS viewer web part, added the feed and bam! Error:

The RSS webpart does not support authenticated feeds

What do you know? So after I googled the error i was lead to this blog by most people who encountered this problem.

After reading this im sure you’ll agree that to get a RSS to work, this is way to much configuration to change, especially if you have deployed MOSS over a number of servers. Pathetic really

This is just another irritating feature (or bug) with sharepoint. What’d you gotta do to get a RSS feed to work round here?

PS. I tried an ordinary feed like this one here -> www.studentwire.net/main/backend/studentwire and it still didnt work. This irritated me once again and i have resorted to using this webpart here