Download all Build 2014 videos

As you probably should know by now Build 2014 it’s over and it’s time to download the videos.

In this demo I will use MP4 high quality rss feed but it’s the same for other formats.


    class Program
    {
        public static XmlDocument getXMLDocumentFromXMLTemplate(string inURL)
        {
            HttpWebRequest myHttpWebRequest = null;     //Declare an HTTP-specific implementation of the WebRequest class.
            HttpWebResponse myHttpWebResponse = null;   //Declare an HTTP-specific implementation of the WebResponse class
            XmlDocument myXMLDocument = null;           //Declare XMLResponse document
            XmlTextReader myXMLReader = null;           //Declare XMLReader

            try
            {
                //Create Request
                myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(inURL);
                myHttpWebRequest.Method = "GET";
                myHttpWebRequest.ContentType = "text/xml; encoding='utf-8'";

                //Get Response
                myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();

                //Now load the XML Document
                myXMLDocument = new XmlDocument();

                //Load response stream into XMLReader
                myXMLReader = new XmlTextReader(myHttpWebResponse.GetResponseStream());
                myXMLDocument.Load(myXMLReader);
            }
            catch (Exception myException)
            {
                throw new Exception("Error Occurred in AuditAdapter.getXMLDocumentFromXMLTemplate()", myException);
            }
            finally
            {
                myHttpWebRequest = null;
                myHttpWebResponse = null;
                myXMLReader = null;
            }
            return myXMLDocument;
        }

        static void Main(string[] args)
        {
            XmlDocument doc = getXMLDocumentFromXMLTemplate("http://channel9.msdn.com/Events/Build/2014/RSS/mp4high");

            XmlNodeList list = doc.GetElementsByTagName("enclosure");
            StringBuilder sb = new StringBuilder();

            foreach(XmlNode node in list)
            {
                sb.AppendLine("wget " + node.Attributes["url"].Value);
            }

            string str = sb.ToString();
            //save the string to a file
        }
    }

The result will be a string like this:

 

wget http://media.ch9.ms/ch9/a2d5/f6d6b3fb-7b01-4bcb-96da-284d3622a2d5/C9Live9023_high.mp4
wget http://video.ch9.ms/sessions/build/2014/9-2663.mp4

….

just save that string to a cmd file and you are ready to download all the videos.

 

Load Jquery in Chrome developer console

If you for some reason need to load chrome in the developer console and that page doesn’t include Jquery this is what you will need to do:

For http page:

var scriptElem = document.createElement(‘script’);
scriptElem.src = “http://code.jquery.com/jquery.js”;
document.getElementsByTagName(‘head’)[0].appendChild(scriptElem);

 

For https page:

var scriptElem = document.createElement(‘script’);
scriptElem.src = “https://code.jquery.com/jquery.js”;
document.getElementsByTagName(‘head’)[0].appendChild(scriptElem);

 

Now you can start Jquery.

 

jquery-in-chrome-console

Errors running builder ‘Android Pre Compiler’ on project

If you have this error

Errors running builder ‘Android Pre Compiler’ on project ‘XXX’

Than you might be running ADT 21
This is one possible workaround until the fix
  • Open properties of project in Eclipse
  • Then Resources -> Resource filters. Click the “Add…” button -> Check “Exclude all”, “Files and folders”, “All children”.
  • In the text entry box input “.svn” (without quotes).
  • Restart Eclipse.

Eclipse fix black toolip in Ubuntu 12.04+

After Install Ubuntu 12.04 I’ve realize that in Eclipse tooltips were with a black background. After a little googling I’ve found the solution.

Edit file /usr/share/themes/Ambiance/gtk-2.0/gtkrc
This file is used by theme Ambiance in ubuntu. If you use another theme you will have a diferent file path. Note themes are instaled here /usr/share/themes
After edit this file locate in the first lines:
tooltip_fg_color
tooltip_bg_color
These are the foreground and background colors of tooltips. Change the color to the values that you like. After a restart you will have the eclipse black tooltip fixed.

Path.combine in Java

In Dotnet and in particular in C# you can to Path.Combine

public static string Combine(
string path1,
string path2
);

This is a simple way to do something similar in Java:

public final class Path {
private Path() { }
public static String combine(final String... paths){
if(paths == null || paths.length == 0) {
return null;
}

File file = new File(paths[0]);
final int len = paths.length;
for (int i = 1; i < len; i++) {
file = new File(file, paths[i]);
}

return file.getPath();
}
}