Friday, March 8, 2013

What Blogging is to me

Blogging is a confusing internet medium. It has been overtaken by newer personal communication sites (twitter and facebook) and quick professional communication (linkedin and message boards). Yet, blogs are still a hub for information from the famous blogger and big news blogs. For the less famous, blogging is a diary-like to log personal ideas. I have seen bloggers talking about life experience and life events, personal opinions (religion, politics and all of the fun stuff). There is also the brand marketing that is disguised as blogging. It is a smart way to advertise a a site while offering the information.

So.. Why am I blogging?

I don't know. I started this as a part of a class requirement when I was a student and I enjoy some parts of it and dislike the other.

Like: I seem to enjoy going back and seeing my past self was thinking. It is a good way to solve problems and helping my confidence. It also brings events and skills back to memory.

Dislike: the stress. I don't know my Target audience and the fact that anyone can Google me and find my Blogger is terrifying  I am aware that I am a bad writer and my confidence is blocking me. The thought that someone would find my blog and find a spelling error is scary. The only way for me to improve is by writing and I feel as going back and over proof read my blog to be tiring. So I just give up and not publish my blogs. I have no readers now and I have more drafts than posts.

My new goal is to brain dump what I have. I want to build up my momentum and write. It will take a lot of practice to become a good writer and I will start now.
Tuesday, March 5, 2013

Uploading files to your website and saving them on a sharepoint folder (or any folder)

I ran into a requirement where I had to implement an email attachment like feature on my web page. The user should be able to upload and retrieve a the file. We chose Sharepoint to be the host for the files.

I never worked with Sharepoint before and I felt as using the ms libraries would be complicated. Thankfully, the whole process was easier than what I expected as it is all .NET. It boils down to moving a file from one folder to another folder in a directory in the server.

Bellow is a snippet if code that would accomplish the task (I will format it later. I wish the option was in blogger)


                    string location = WebConfigurationManager.AppSettings["IssueTrackingSharepointFolderLocation"];//Shared Documents";

                    // Some browsers send file names with full path. We only care about the file name.
                    var fileName = Path.GetFileName(file.FileName);



string[] combinedPath = new string[3];
            combinedPath[0] = location;



//handle the month if iti s less than 10 and add a 0 to it
            if (date.Month < 10)
            { combinedPath[1] = date.Year.ToString() + "0" + date.Month.ToString(); }
            else
            { combinedPath[1] = date.Year.ToString() + date.Month.ToString(); }

            combinedPath[2] = entity.IssueAttachmentID.ToString() + "." + GetFileNameExtension(fileName);  //get the key with the extension

            string destinationPath = Path.Combine(combinedPath);

            string directoryPath = Path.Combine(combinedPath[0], combinedPath[1]);
            Directory.CreateDirectory(directoryPath);