Sharepoint Online support in AzureCopy

Sharepoint Online (and probably regular Sharepoint, but I haven’t tested) support is now available with AzureCopy 0.12. So now AzureCopy handles local filesystem, Azure Blob Storage, AWS S3, Skydrive and Sharepoint! Dropbox soon to follow!

The basic functionality of listing, reading and writing files/blobs are working. Many optimisations are planned to improve the performance and experience but at least the essentials are working Smile

The Nuget package has not been updated yet (publishing key issues) but will be done soon.

New parameters added are –SharepointUser (-spu) and –SharepointPassword.

For example, copying from Sharepoint Online to Azure Blob Storage is as easy as:

azurecopy.exe  -i “ Documents/ken.PNG” –o “”

(with the login details in the config file obviously).

Revisiting “99 Problems” in C#: Part 2

As mentioned I’ve dusted off my old github repository on the 99 problems and have had a look over them with a more experienced eye. Honestly, not sure I’d change anything mainly due to problems 1 to 8 are very simple problems (wont waste your time repeating them).

Now after a 2 year hiatus, I’m looking at problems 9 to 12. Things don’t get interesting until problem 11. For this the problem requires that a single list is returning multiple types of objects, either a single char or a tuple of int/char.  I went for the obvious option of a List<object> approach, which certainly lets me get the result I need. But, it’s ugly and if I ever had to use a List<object> in production code I’d hope the code reviewer would tut loudly before handing out a severe beating. But… the question specifically states a List[Any]  (Scala lingo for List<object>), so will leave it as that for now. In reality I’d probably leave it as a list of Tuples or come up with a common interface then have 2 classes implement it. (one for single chars, the other containing quantities).

Problem 12 had a single point of interest, which was if I have a character/object and a quantity associated, how do I “multiply” out an object that isn’t a number?

ie I have 3,’a’  how do I generate a list of ‘a’,’a’,’a’ ?

Then I remembered the lovely Enumerable class (highly underused, at least by me). Specifically the Enumerable.Range() method, which I only ever really use if I need a list of numbers generated easily. But of course I didn’t need to emit the number being generated but merely “something”. So with the simple little line:

List<char> expandedList =  (Enumerable.Range(0, myTuple.Item1).Select( n => myTuple.Item2)).ToList<char>();

It takes in a tuple (int,char) and generates a list of chars with the appropriate content. Very nice and easy.

All code has been updated here

Revisiting “99 Problems” in C#

A few years ago I was always after new coding problems just to keep my dev skills up to scratch. Two of my favourite ways of doing this was coding up solutions to “99 Problems” and “Project Euler”. I hadn’t touched either of these in a while and thought it would be good to go back and revisit how I’d solve the problems now as opposed to just a few years ago. Have I learned much since then? Am I a better developer? No idea, but I’d like to think YES.

I started again on Project Euler but soon remembered why I got slightly bored with the problems. The problems are targeted more at your math skills than your coding skills (and my math skills aren’t particularly good). Can I remember much about primes? Not really. Every time I need to do something with them I have to hit Wikipedia again.

So 99 Problems it is then. Smile

I’ll be updating my old 99 Problems Github repo with each of the solutions. One thing to note, I’m going to try and be completely practical about the answers. I know the problems are often setup so you have to code your own solution to the problem, and that’s a good thing. But, if the language I’m going to use (C#) has a built in function/method/class to solve the problem, I’m going to use it. Maybe given time I’ll go back and see if I can code my own way around the problem but for now I want to treat it as if it was a regular project and NOT just a mental exercise.