text:
Q: Upload files with HTTPWebrequest (multipart/form-data) Is there any class, library or some piece of code which will help me to upload files with HTTPWebrequest?
Edit 2:
I do not want to upload to a WebDAV folder or something like that. I want to simulate a browser, so just like you upload your avatar to a forum or upload a file via form in a web application. Upload to a form which uses a multipart/form-data.
Edit:
WebClient is not cover my requirements, so I'm looking for a solution with HTTPWebrequest.

A: VB Example (converted from C# example on another post):
Private Sub HttpUploadFile( _
    ByVal uri As String, _
    ByVal filePath As String, _
    ByVal fileParameterName As String, _
    ByVal contentType As String, _
    ByVal otherParameters As Specialized.NameValueCollection)

    Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString("x")
    Dim newLine As String = System.Environment.NewLine
    Dim boundaryBytes As Byte() = Text.Encoding.ASCII.GetBytes(newLine & "--" & boundary & newLine)
    Dim request As Net.HttpWebRequest = Net.WebRequest.Create(uri)

    request.ContentType = "multipart/form-data; boundary=" & boundary
    request.Method = "POST"
    request.KeepAlive = True
    request.Credentials = Net.CredentialCache.DefaultCredentials

    Using requestStream As IO.Stream = request.GetRequestStream()

        Dim formDataTemplate As String = "Content-Disposition: form-data; name=""{0}""{1}{1}{2}"

        For Each key As String In otherParameters.Keys

            requestStream.Write(boundaryBytes, 0, boundaryBytes.Length)
            Dim formItem As String = String.Format(formDataTemplate, key, newLine, otherParameters(key))
            Dim formItemBytes As Byte() = Text.Encoding.UTF8.GetBytes(formItem)
            requestStream.Write(formItemBytes, 0, formItemBytes.Length)

        Next key

        requestStream.Write(boundaryBytes, 0, boundaryBytes.Length)

        Dim headerTemplate As String = "Content-Disposition: form-data; name=""{0}""; filename=""{1}""{2}Content-Type: {3}{2}{2}"
        Dim header As String = String.Format(headerTemplate, fileParameterName, filePath, newLine, contentType)
        Dim headerBytes As Byte() = Text.Encoding.UTF8.GetBytes(header)
        requestStream.Write(headerBytes, 0, headerBytes.Length)

        Using fileStream As New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)

            Dim buffer(4096) As Byte
            Dim bytesRead As Int32 = fileStream.Read(buffer, 0, buffer.Length)

            Do While (bytesRead > 0)

                requestStream.Write(buffer, 0, bytesRead)
                bytesRead = fileStream.Read(buffer, 0, buffer.Length)

            Loop

        End Using

        Dim trailer As Byte() = Text.Encoding.ASCII.GetBytes(newLine & "--" + boundary + "--" & newLine)
        requestStream.Write(trailer, 0, trailer.Length)

    End Using

    Dim response As Net.WebResponse = Nothing

    Try

        response = request.GetResponse()

        Using responseStream As IO.Stream = response.GetResponseStream()

            Using responseReader As New IO.StreamReader(responseStream)

                Dim responseText = responseReader.ReadToEnd()
                Diagnostics.Debug.Write(responseText)

            End Using

        End Using

    Catch exception As Net.WebException

        response = exception.Response

        If (response IsNot Nothing) Then

            Using reader As New IO.StreamReader(response.GetResponseStream())

                Dim responseText = reader.ReadToEnd()
                Diagnostics.Debug.Write(responseText)

            End Using

            response.Close()

        End If

    Finally

        request = Nothing

    End Try

End Sub

A: I think you're looking for something more like WebClient.
Specifically, UploadFile().

A: Took the above and modified it accept some header values, and multiple files
    NameValueCollection headers = new NameValueCollection();
        headers.Add("Cookie", "name=value;");
        headers.Add("Referer", "http://google.com");
    NameValueCollection nvc = new NameValueCollection();
        nvc.Add("name", "value");

    HttpUploadFile(url, new string[] { "c:\\file1.txt", "c:\\file2.jpg" }, new string[] { "file", "image" }, new string[] { "application/octet-stream", "image/jpeg" }, nvc, headers);

public static void HttpUploadFile(string url, string[] file, string[] paramName, string[] contentType, NameValueCollection nvc, NameValueCollection headerItems)
{
    //log.Debug(string.Format("Uploading {0} to {1}", file, url));
    string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
    byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

    HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);

    foreach (string key in headerItems.Keys)
    {
        if (key == "Referer")
        {
            wr.Referer = headerItems[key];
        }
        else
        {
            wr.Headers.Add(key, headerItems[key]);
        }
    }

    wr.ContentType = "multipart/form-data; boundary=" + boundary;
    wr.Method = "POST";
    wr.KeepAlive = true;
    wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

    Stream rs = wr.GetRequestStream();

    string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
    foreach (string key in nvc.Keys)
    {
        rs.Write(boundarybytes, 0, boundarybytes.Length);
        string formitem = string.Format(formdataTemplate, key, nvc[key]);
        byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
        rs.Write(formitembytes, 0, formitembytes.Length);
    }
    rs.Write(boundarybytes, 0, boundarybytes.Length);

    string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
    string header = "";

    for(int i =0; i<file.Count();i++)
    {
        header = string.Format(headerTemplate, paramName[i], System.IO.Path.GetFileName(file[i]), contentType[i]);
        byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
        rs.Write(headerbytes, 0, headerbytes.Length);

        FileStream fileStream = new FileStream(file[i], FileMode.Open, FileAccess.Read);
        byte[] buffer = new byte[4096];
        int bytesRead = 0;
        while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
        {
            rs.Write(buffer, 0, bytesRead);
        }
        fileStream.Close();
        rs.Write(boundarybytes, 0, boundarybytes.Length);
    }
    rs.Close();

    WebResponse wresp = null;
    try
    {
        wresp = wr.GetResponse();
        Stream stream2 = wresp.GetResponseStream();
        StreamReader reader2 = new StreamReader(stream2);
        //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd()));
    }
    catch (Exception ex)
    {
        //log.Error("Error uploading file", ex);
            wresp.Close();
            wresp = null;
    }
    finally
    {
        wr = null;
    }
}

A: I had to deal with this recently - another way to approach it is to use the fact that WebClient is inheritable, and change the underlying WebRequest from there:
http://msdn.microsoft.com/en-us/library/system.net.webclient.getwebrequest(VS.80).aspx
I prefer C#, but if you're stuck with VB the results will look something like this:
Public Class BigWebClient
    Inherits WebClient
    Protected Overrides Function GetWebRequest(ByVal address As System.Uri) As System.Net.WebRequest
        Dim x As WebRequest = MyBase.GetWebRequest(address)
        x.Timeout = 60 * 60 * 1000
        Return x
    End Function
End Class

'Use BigWebClient here instead of WebClient

A: There is another working example with some my comments :
        List<MimePart> mimeParts = new List<MimePart>();

        try
        {
            foreach (string key in form.AllKeys)
            {
                StringMimePart part = new StringMimePart();

                part.Headers["Content-Disposition"] = "form-data; name=\"" + key + "\"";
                part.StringData = form[key];

                mimeParts.Add(part);
            }

            int nameIndex = 0;

            foreach (UploadFile file in files)
            {
                StreamMimePart part = new StreamMimePart();

                if (string.IsNullOrEmpty(file.FieldName))
                    file.FieldName = "file" + nameIndex++;

                part.Headers["Content-Disposition"] = "form-data; name=\"" + file.FieldName + "\"; filename=\"" + file.FileName + "\"";
                part.Headers["Content-Type"] = file.ContentType;

                part.SetStream(file.Data);

                mimeParts.Add(part);
            }

            string boundary = "----------" + DateTime.Now.Ticks.ToString("x");

            req.ContentType = "multipart/form-data; boundary=" + boundary;
            req.Method = "POST";

            long contentLength = 0;

            byte[] _footer = Encoding.UTF8.GetBytes("--" + boundary + "--\r\n");

            foreach (MimePart part in mimeParts)
            {
                contentLength += part.GenerateHeaderFooterData(boundary);
            }

            req.ContentLength = contentLength + _footer.Length;

            byte[] buffer = new byte[8192];
            byte[] afterFile = Encoding.UTF8.GetBytes("\r\n");
            int read;

            using (Stream s = req.GetRequestStream())
            {
                foreach (MimePart part in mimeParts)
                {
                    s.Write(part.Header, 0, part.Header.Length);

                    while ((read = part.Data.Read(buffer, 0, buffer.Length)) > 0)
                        s.Write(buffer, 0, read);

                    part.Data.Dispose();

                    s.Write(afterFile, 0, afterFile.Length);
                }

                s.Write(_footer, 0, _footer.Length);
            }

            return (HttpWebResponse)req.GetResponse();
        }
        catch
        {
            foreach (MimePart part in mimeParts)
                if (part.Data != null)
                    part.Data.Dispose();

            throw;
        }

And there is example of using :
            UploadFile[] files = new UploadFile[]
            {
                new UploadFile(@"C:\2.jpg","new_file","image/jpeg") //new_file is id of upload field
            };

            NameValueCollection form = new NameValueCollection();

            form["id_hidden_input"] = "value_hidden_inpu"; //there is additional param (hidden fields on page)

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(full URL of action);

            // set credentials/cookies etc.
            req.CookieContainer = hrm.CookieContainer; //hrm is my class. i copied all cookies from last request to current (for auth)
            HttpWebResponse resp = HttpUploadHelper.Upload(req, files, form);

            using (Stream s = resp.GetResponseStream())
            using (StreamReader sr = new StreamReader(s))
            {
                string response = sr.ReadToEnd();
            }
             //profit!

A: Took the code above and fixed because it throws Internal Server Error 500. There are some problems with \r\n badly positioned and spaces etc. Applied the refactoring with memory stream, writing directly to the request stream. Here is the result:
    public static void HttpUploadFile(string url, string file, string paramName, string contentType, NameValueCollection nvc) {
        log.Debug(string.Format("Uploading {0} to {1}", file, url));
        string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
        byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

        HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
        wr.ContentType = "multipart/form-data; boundary=" + boundary;
        wr.Method = "POST";
        wr.KeepAlive = true;
        wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

        Stream rs = wr.GetRequestStream();

        string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
        foreach (string key in nvc.Keys)
        {
            rs.Write(boundarybytes, 0, boundarybytes.Length);
            string formitem = string.Format(formdataTemplate, key, nvc[key]);
            byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
            rs.Write(formitembytes, 0, formitembytes.Length);
        }
        rs.Write(boundarybytes, 0, boundarybytes.Length);

        string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
        string header = string.Format(headerTemplate, paramName, file, contentType);
        byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
        rs.Write(headerbytes, 0, headerbytes.Length);

        FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
        byte[] buffer = new byte[4096];
        int bytesRead = 0;
        while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) {
            rs.Write(buffer, 0, bytesRead);
        }
        fileStream.Close();

        byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
        rs.Write(trailer, 0, trailer.Length);
        rs.Close();

        WebResponse wresp = null;
        try {
            wresp = wr.GetResponse();
            Stream stream2 = wresp.GetResponseStream();
            StreamReader reader2 = new StreamReader(stream2);
            log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd()));
        } catch(Exception ex) {
            log.Error("Error uploading file", ex);
            if(wresp != null) {
                wresp.Close();
                wresp = null;
            }
        } finally {
            wr = null;
        }
    }

and sample usage:
    NameValueCollection nvc = new NameValueCollection();
    nvc.Add("id", "TTR");
    nvc.Add("btn-submit-photo", "Upload");
    HttpUploadFile("http://your.server.com/upload",
         @"C:\test\test.jpg", "file", "image/jpeg", nvc);

It could be extended to handle multiple files or just call it multiple times for each file. However it suits your needs.

A: I was looking to do file upload and add some parameters to a multipart/form-data request in VB.NET and not through a regular forms post.
Thanks to @JoshCodes answer I got the direction I was looking for.
I am posting my solution to help others find a way to perform a post with both file and parameters
the html equivalent of what I try to achieve is :
html
<form action="your-api-endpoint" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="api-method-name"/>
<input type="hidden" name="apiKey" value="gs1xxxxxxxxxxxxxex"/>
<input type="hidden" name="access" value="protected"/>
<input type="hidden" name="name" value="test"/>
<input type="hidden" name="title" value="test"/>
<input type="hidden" name="signature" value="cf1d4xxxxxxxxcd5"/>
<input type="file" name="file"/>
<input type="submit" name="_upload" value="Upload"/>
</form>

Due to the fact that I have to provide the apiKey and the signature (which is a calculated checksum of the request parameters and api key concatenated string), I needed to do it server side.
The other reason I needed to do it server side is the fact that the post of the file can be performed at any time by pointing to a file already on the server (providing the path), so there would be no manually selected file during form post thus form data file would not contain the file stream.Otherwise I could have calculated the checksum via an ajax callback and submitted the file through the html post using JQuery.
I am using .net version 4.0 and cannot upgrade to 4.5 in the actual solution. So I had to install the Microsoft.Net.Http using nuget cmd
PM> install-package Microsoft.Net.Http

Private Function UploadFile(req As ApiRequest, filePath As String, fileName As String) As String
    Dim result = String.empty
    Try
        ''//Get file stream
        Dim paramFileStream As Stream = File.OpenRead(filePath)
        Dim fileStreamContent As HttpContent = New  StreamContent(paramFileStream)
        Using client = New HttpClient()
            Using formData = New MultipartFormDataContent()
                ''// This adds parameter name ("action")
                ''// parameter value (req.Action) to form data
                formData.Add(New StringContent(req.Action), "action")
                formData.Add(New StringContent(req.ApiKey), "apiKey")
                For Each param In req.Parameters
                    formData.Add(New StringContent(param.Value), param.Key)
                Next
                formData.Add(New StringContent(req.getRequestSignature.Qualifier), "signature")
                ''//This adds the file stream and file info to form data
                formData.Add(fileStreamContent, "file", fileName)
                ''//We are now sending the request
                Dim response = client.PostAsync(GetAPIEndpoint(), formData).Result
                ''//We are here reading the response
                Dim readR = New StreamReader(response.Content.ReadAsStreamAsync().Result, Encoding.UTF8)
                Dim respContent = readR.ReadToEnd()

                If Not response.IsSuccessStatusCode Then
                    result =  "Request Failed : Code = " & response.StatusCode & "Reason = " & response.ReasonPhrase & "Message = " & respContent
                End If
                result.Value = respContent
            End Using
        End Using
    Catch ex As Exception
        result = "An error occurred : " & ex.Message
    End Try

    Return result
End Function

A: Modified @CristianRomanescu code to work with memory stream, accept file as a byte array, allow null nvc, return request response and work with Authorization-header. Tested the code with Web Api 2.
private string HttpUploadFile(string url, byte[] file, string fileName, string paramName, string contentType, NameValueCollection nvc, string authorizationHeader)
{
    string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
    byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

    HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
    wr.ContentType = "multipart/form-data; boundary=" + boundary;
    wr.Method = "POST";
    wr.Headers.Add("Authorization", authorizationHeader);
    wr.KeepAlive = true;

    Stream rs = wr.GetRequestStream();

    string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
    if (nvc != null)
    {
        foreach (string key in nvc.Keys)
        {
            rs.Write(boundarybytes, 0, boundarybytes.Length);
            string formitem = string.Format(formdataTemplate, key, nvc[key]);
            byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
            rs.Write(formitembytes, 0, formitembytes.Length);
        }
    }

    rs.Write(boundarybytes, 0, boundarybytes.Length);

    string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
    string header = string.Format(headerTemplate, paramName, fileName, contentType);
    byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
    rs.Write(headerbytes, 0, headerbytes.Length);

    rs.Write(file, 0, file.Length);

    byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
    rs.Write(trailer, 0, trailer.Length);
    rs.Close();

    WebResponse wresp = null;
    try
    {
        wresp = wr.GetResponse();
        Stream stream2 = wresp.GetResponseStream();
        StreamReader reader2 = new StreamReader(stream2);
        var response = reader2.ReadToEnd();
        return response;
    }
    catch (Exception ex)
    {
        if (wresp != null)
        {
            wresp.Close();
            wresp = null;
        }
        return null;
    }
    finally
    {
        wr = null;
    }
}

Testcode:
[HttpPost]
[Route("postformdata")]
public IHttpActionResult PostFormData()
{
    // Check if the request contains multipart/form-data.
    if (!Request.Content.IsMimeMultipartContent())
    {
        throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
    }

    var provider = new MultipartMemoryStreamProvider();

    try
    {
        // Read the form data.
        var result = Request.Content.ReadAsMultipartAsync(provider).Result;
        string response = "";
        // This illustrates how to get the file names.
        foreach (var file in provider.Contents)
        {
            var fileName = file.Headers.ContentDisposition.FileName.Trim('\"');
            var buffer =  file.ReadAsByteArrayAsync().Result;
            response = HttpUploadFile("https://localhost/api/v1/createfromfile", buffer, fileName, "file", "application/pdf", null, "AuthorizationKey");
        }
        return Ok(response);
    }
    catch (System.Exception e)
    {
        return InternalServerError();
    }
}

A: Based on the code provided above I added support for multiple files and also uploading a stream directly without the need to have a local file.
To upload files to a specific url including some post params do the following:
RequestHelper.PostMultipart(
    "http://www.myserver.com/upload.php",
    new Dictionary<string, object>() {
        { "testparam", "my value" },
        { "file", new FormFile() { Name = "image.jpg", ContentType = "image/jpeg", FilePath = "c:\\temp\\myniceimage.jpg" } },
        { "other_file", new FormFile() { Name = "image2.jpg", ContentType = "image/jpeg", Stream = imageDataStream } },
    });

To enhance this even more one could determine the name and mime type from the given file itself.
public class FormFile
{
    public string Name { get; set; }

    public string ContentType { get; set; }

    public string FilePath { get; set; }

    public Stream Stream { get; set; }
}

public class RequestHelper
{

    public static string PostMultipart(string url, Dictionary<string, object> parameters) {

        string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
        byte[] boundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.ContentType = "multipart/form-data; boundary=" + boundary;
        request.Method = "POST";
        request.KeepAlive = true;
        request.Credentials = System.Net.CredentialCache.DefaultCredentials;

        if(parameters != null && parameters.Count > 0) {

            using(Stream requestStream = request.GetRequestStream()) {

                foreach(KeyValuePair<string, object> pair in parameters) {

                    requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
                    if(pair.Value is FormFile) {
                        FormFile file = pair.Value as FormFile;
                        string header = "Content-Disposition: form-data; name=\"" + pair.Key + "\"; filename=\"" + file.Name + "\"\r\nContent-Type: " + file.ContentType + "\r\n\r\n";
                        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(header);
                        requestStream.Write(bytes, 0, bytes.Length);
                        byte[] buffer = new byte[32768];
                        int bytesRead;
                        if(file.Stream == null) {
                            // upload from file
                            using(FileStream fileStream = File.OpenRead(file.FilePath)) {
                                while((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                                    requestStream.Write(buffer, 0, bytesRead);
                                fileStream.Close();
                            }
                        }
                        else {
                            // upload from given stream
                            while((bytesRead = file.Stream.Read(buffer, 0, buffer.Length)) != 0)
                                requestStream.Write(buffer, 0, bytesRead);
                        }
                    }
                    else {
                        string data = "Content-Disposition: form-data; name=\"" + pair.Key + "\"\r\n\r\n" + pair.Value;
                        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
                        requestStream.Write(bytes, 0, bytes.Length);
                    }
                }

                byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
                requestStream.Write(trailer, 0, trailer.Length);
                requestStream.Close();
            }
        }

        using(WebResponse response = request.GetResponse()) {
            using(Stream responseStream = response.GetResponseStream())
            using(StreamReader reader = new StreamReader(responseStream))
                return reader.ReadToEnd();
        }

    }
}

A: My ASP.NET Upload FAQ has an article on this, with example code: Upload files using an RFC 1867 POST request with HttpWebRequest/WebClient. This code doesn't load files into memory (as opposed to the code above), supports multiple files, and supports form values, setting credentials and cookies, etc.
Edit: looks like Axosoft took down the page. Thanks guys.
It's still accessible via archive.org.

A: I was looking for something like this, Found in :
http://bytes.com/groups/net-c/268661-how-upload-file-via-c-code (modified for correctness):
public static string UploadFilesToRemoteUrl(string url, string[] files, NameValueCollection formFields = null)
{
    string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");

    HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
    request.ContentType = "multipart/form-data; boundary=" +
                            boundary;
    request.Method = "POST";
    request.KeepAlive = true;

    Stream memStream = new System.IO.MemoryStream();

    var boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
                                                            boundary + "\r\n");
    var endBoundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
                                                                boundary + "--");

    string formdataTemplate = "\r\n--" + boundary +
                                "\r\nContent-Disposition: form-data; name=\"{0}\";\r\n\r\n{1}";

    if (formFields != null)
    {
        foreach (string key in formFields.Keys)
        {
            string formitem = string.Format(formdataTemplate, key, formFields[key]);
            byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
            memStream.Write(formitembytes, 0, formitembytes.Length);
        }
    }

    string headerTemplate =
        "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n" +
        "Content-Type: application/octet-stream\r\n\r\n";

    for (int i = 0; i < files.Length; i++)
    {
        memStream.Write(boundarybytes, 0, boundarybytes.Length);
        var header = string.Format(headerTemplate, "uplTheFile", files[i]);
        var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);

        memStream.Write(headerbytes, 0, headerbytes.Length);

        using (var fileStream = new FileStream(files[i], FileMode.Open, FileAccess.Read))
        {
            var buffer = new byte[1024];
            var bytesRead = 0;
            while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
            {
                memStream.Write(buffer, 0, bytesRead);
            }
        }
    }

    memStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
    request.ContentLength = memStream.Length;

    using (Stream requestStream = request.GetRequestStream())
    {
        memStream.Position = 0;
        byte[] tempBuffer = new byte[memStream.Length];
        memStream.Read(tempBuffer, 0, tempBuffer.Length);
        memStream.Close();
        requestStream.Write(tempBuffer, 0, tempBuffer.Length);
    }

    using (var response = request.GetResponse())
    {
        Stream stream2 = response.GetResponseStream();
        StreamReader reader2 = new StreamReader(stream2);
        return reader2.ReadToEnd();
    }
}

A: something like this is close:  (untested code)
byte[] data; // data goes here.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = userNetworkCredentials;
request.Method = "PUT";
request.ContentType = "application/octet-stream";
request.ContentLength = data.Length;
Stream stream = request.GetRequestStream();
stream.Write(data,0,data.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
temp = reader.ReadToEnd();
reader.Close();

A: This is possible without external code, extensions, and "low level" HTTP manipulation (just need Microsoft.Net.Http package from NuGet). Here is an example:
// Perform the equivalent of posting a form with a filename and two files, in HTML:
// <form action="{url}" method="post" enctype="multipart/form-data">
//     <input type="text" name="filename" />
//     <input type="file" name="file1" />
//     <input type="file" name="file2" />
// </form>
private async Task<System.IO.Stream> UploadAsync(string url, string filename, Stream fileStream, byte [] fileBytes)
{
    // Convert each of the three inputs into HttpContent objects

    HttpContent stringContent = new StringContent(filename);
    // examples of converting both Stream and byte [] to HttpContent objects
    // representing input type file
    HttpContent fileStreamContent = new StreamContent(fileStream);
    HttpContent bytesContent = new ByteArrayContent(fileBytes);

    // Submit the form using HttpClient and
    // create form data as Multipart (enctype="multipart/form-data")

    using (var client = new HttpClient())
    using (var formData = new MultipartFormDataContent())
    {
        // Add the HttpContent objects to the form data

        // <input type="text" name="filename" />
        formData.Add(stringContent, "filename", "filename");
        // <input type="file" name="file1" />
        formData.Add(fileStreamContent, "file1", "file1");
        // <input type="file" name="file2" />
        formData.Add(bytesContent, "file2", "file2");

        // Invoke the request to the server

        // equivalent to pressing the submit button on
        // a form with attributes (action="{url}" method="post")
        var response = await client.PostAsync(url, formData);

        // ensure the request was a success
        if (!response.IsSuccessStatusCode)
        {
            return null;
        }
        return await response.Content.ReadAsStreamAsync();
    }
}

A: For me, the following works (mostly inspirated from all of the following answers), I started from Elad's answer and modify/simplify things to match my need (remove not file form inputs, only one file, ...).
Hope it can helps somebody :)
(PS: I know that exception handling is not implemented and it assumes that it was written inside a class, so I may need some integration effort...)
private void uploadFile()
    {
        Random rand = new Random();
        string boundary = "----boundary" + rand.Next().ToString();
        Stream data_stream;
        byte[] header = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\nContent-Disposition: form-data; name=\"file_path\"; filename=\"" + System.IO.Path.GetFileName(this.file) + "\"\r\nContent-Type: application/octet-stream\r\n\r\n");
        byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");

        // Do the request
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(MBF_URL);
        request.UserAgent = "My Toolbox";
        request.Method = "POST";
        request.KeepAlive = true;
        request.ContentType = "multipart/form-data; boundary=" + boundary;
        data_stream = request.GetRequestStream();
        data_stream.Write(header, 0, header.Length);
        byte[] file_bytes = System.IO.File.ReadAllBytes(this.file);
        data_stream.Write(file_bytes, 0, file_bytes.Length);
        data_stream.Write(trailer, 0, trailer.Length);
        data_stream.Close();

        // Read the response
        WebResponse response = request.GetResponse();
        data_stream = response.GetResponseStream();
        StreamReader reader = new StreamReader(data_stream);
        this.url = reader.ReadToEnd();

        if (this.url == "") { this.url = "No response :("; }

        reader.Close();
        data_stream.Close();
        response.Close();
    }

A: Not sure if this was posted before but I got this working with WebClient. i read the documentation for the WebClient. A key point they make is

If the BaseAddress property is not an empty string ("") and address
  does not contain an absolute URI, address must be a relative URI that
  is combined with BaseAddress to form the absolute URI of the requested
  data. If the QueryString property is not an empty string, it is
  appended to address.

So all I did was wc.QueryString.Add("source", generatedImage) to add the different query parameters and somehow it matches the property name with the image I uploaded. Hope it helps
    public void postImageToFacebook(string generatedImage, string fbGraphUrl)
    {
        WebClient wc = new WebClient();
        byte[] bytes = System.IO.File.ReadAllBytes(generatedImage);

        wc.QueryString.Add("source", generatedImage);
        wc.QueryString.Add("message", "helloworld");

        wc.UploadFile(fbGraphUrl, generatedImage);

        wc.Dispose();

    }

A: I wrote a class using WebClient way back when to do multipart form upload.
http://ferozedaud.blogspot.com/2010/03/multipart-form-upload-helper.html
///
/// MimePart
/// Abstract class for all MimeParts
///

abstract class MimePart
{
    public string Name { get; set; }

    public abstract string ContentDisposition { get; }

    public abstract string ContentType { get; }

    public abstract void CopyTo(Stream stream);

    public String Boundary
    {
        get;
        set;
    }
}

class NameValuePart : MimePart
{
    private NameValueCollection nameValues;

    public NameValuePart(NameValueCollection nameValues)
    {
        this.nameValues = nameValues;
    }

    public override void CopyTo(Stream stream)
    {
        string boundary = this.Boundary;
        StringBuilder sb = new StringBuilder();

        foreach (object element in this.nameValues.Keys)
        {
            sb.AppendFormat("--{0}", boundary);
            sb.Append("\r\n");
            sb.AppendFormat("Content-Disposition: form-data; name=\"{0}\";", element);
            sb.Append("\r\n");
            sb.Append("\r\n");
            sb.Append(this.nameValues[element.ToString()]);

            sb.Append("\r\n");

        }

        sb.AppendFormat("--{0}", boundary);
        sb.Append("\r\n");

        //Trace.WriteLine(sb.ToString());
        byte [] data = Encoding.ASCII.GetBytes(sb.ToString());
        stream.Write(data, 0, data.Length);
    }

    public override string ContentDisposition
    {
        get { return "form-data"; }
    }

    public override string ContentType
    {
        get { return String.Empty; }
    }
}

class FilePart : MimePart

{

    private Stream input;

    private String contentType;

    public FilePart(Stream input, String name, String contentType)

    {

        this.input = input;

        this.contentType = contentType;

        this.Name = name;

    }

    public override void CopyTo(Stream stream)

    {

        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("Content-Disposition: {0}", this.ContentDisposition);

        if (this.Name != null)

            sb.Append("; ").AppendFormat("name=\"{0}\"", this.Name);

        if (this.FileName != null)

            sb.Append("; ").AppendFormat("filename=\"{0}\"", this.FileName);

        sb.Append("\r\n");

        sb.AppendFormat(this.ContentType);

        sb.Append("\r\n");

        sb.Append("\r\n");

    // serialize the header data.

    byte[] buffer = Encoding.ASCII.GetBytes(sb.ToString());

    stream.Write(buffer, 0, buffer.Length);

    // send the stream.

    byte[] readBuffer = new byte[1024];

    int read = input.Read(readBuffer, 0, readBuffer.Length);

    while (read > 0)

    {

        stream.Write(readBuffer, 0, read);

        read = input.Read(readBuffer, 0, readBuffer.Length);

    }

    // write the terminating boundary

    sb.Length = 0;

    sb.Append("\r\n");

    sb.AppendFormat("--{0}", this.Boundary);

    sb.Append("\r\n");

    buffer = Encoding.ASCII.GetBytes(sb.ToString());

    stream.Write(buffer, 0, buffer.Length);

}

 public override string ContentDisposition
 {
      get { return "file"; }
 }

 public override string ContentType
 {
    get {
       return String.Format("content-type: {0}", this.contentType);
     }
 }

 public String FileName { get; set; }

}

    ///
    /// Helper class that encapsulates all file uploads
    /// in a mime part.
    ///

    class FilesCollection : MimePart
    {
        private List files;

        public FilesCollection()
        {
            this.files = new List();
            this.Boundary = MultipartHelper.GetBoundary();
        }

        public int Count
        {
            get { return this.files.Count; }
        }

        public override string ContentDisposition
        {
            get
            {
                return String.Format("form-data; name=\"{0}\"", this.Name);
            }
        }

        public override string ContentType
        {
            get { return String.Format("multipart/mixed; boundary={0}", this.Boundary); }
        }

        public override void CopyTo(Stream stream)
        {
            // serialize the headers
            StringBuilder sb = new StringBuilder(128);
            sb.Append("Content-Disposition: ").Append(this.ContentDisposition).Append("\r\n");
            sb.Append("Content-Type: ").Append(this.ContentType).Append("\r\n");
            sb.Append("\r\n");
            sb.AppendFormat("--{0}", this.Boundary).Append("\r\n");

            byte[] headerBytes = Encoding.ASCII.GetBytes(sb.ToString());
            stream.Write(headerBytes, 0, headerBytes.Length);
            foreach (FilePart part in files)
            {
                part.Boundary = this.Boundary;
                part.CopyTo(stream);
            }
        }

        public void Add(FilePart part)
        {
            this.files.Add(part);
        }
    }

///
/// Helper class to aid in uploading multipart
/// entities to HTTP web endpoints.
///

class MultipartHelper
{
    private static Random random = new Random(Environment.TickCount);

    private List formData = new List();
    private FilesCollection files = null;
    private MemoryStream bufferStream = new MemoryStream();
    private string boundary;

    public String Boundary { get { return boundary; } }

    public static String GetBoundary()
    {
        return Environment.TickCount.ToString("X");
    }

    public MultipartHelper()
    {
        this.boundary = MultipartHelper.GetBoundary();
    }

    public void Add(NameValuePart part)
    {
        this.formData.Add(part);
        part.Boundary = boundary;
    }

    public void Add(FilePart part)
    {
        if (files == null)
        {
            files = new FilesCollection();
        }
        this.files.Add(part);
    }

    public void Upload(WebClient client, string address, string method)
    {
        // set header
        client.Headers.Add(HttpRequestHeader.ContentType, "multipart/form-data; boundary=" + this.boundary);
        Trace.WriteLine("Content-Type: multipart/form-data; boundary=" + this.boundary + "\r\n");

        // first, serialize the form data
        foreach (NameValuePart part in this.formData)
        {
            part.CopyTo(bufferStream);
        }

        // serialize the files.
        this.files.CopyTo(bufferStream);

        if (this.files.Count > 0)
        {
            // add the terminating boundary.
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("--{0}", this.Boundary).Append("\r\n");
            byte [] buffer = Encoding.ASCII.GetBytes(sb.ToString());
            bufferStream.Write(buffer, 0, buffer.Length);
        }

        bufferStream.Seek(0, SeekOrigin.Begin);

        Trace.WriteLine(Encoding.ASCII.GetString(bufferStream.ToArray()));
        byte [] response = client.UploadData(address, method, bufferStream.ToArray());
        Trace.WriteLine("----- RESPONSE ------");
        Trace.WriteLine(Encoding.ASCII.GetString(response));
    }

    ///
    /// Helper class that encapsulates all file uploads
    /// in a mime part.
    ///

    class FilesCollection : MimePart
    {
        private List files;

        public FilesCollection()
        {
            this.files = new List();
            this.Boundary = MultipartHelper.GetBoundary();
        }

        public int Count
        {
            get { return this.files.Count; }
        }

        public override string ContentDisposition
        {
            get
            {
                return String.Format("form-data; name=\"{0}\"", this.Name);
            }
        }

        public override string ContentType
        {
            get { return String.Format("multipart/mixed; boundary={0}", this.Boundary); }
        }

        public override void CopyTo(Stream stream)
        {
            // serialize the headers
            StringBuilder sb = new StringBuilder(128);
            sb.Append("Content-Disposition: ").Append(this.ContentDisposition).Append("\r\n");
            sb.Append("Content-Type: ").Append(this.ContentType).Append("\r\n");
            sb.Append("\r\n");
            sb.AppendFormat("--{0}", this.Boundary).Append("\r\n");

            byte[] headerBytes = Encoding.ASCII.GetBytes(sb.ToString());
            stream.Write(headerBytes, 0, headerBytes.Length);
            foreach (FilePart part in files)
            {
                part.Boundary = this.Boundary;
                part.CopyTo(stream);
            }
        }

        public void Add(FilePart part)
        {
            this.files.Add(part);
        }
    }
}

class Program
{
    static void Main(string[] args)
    {
        Trace.Listeners.Add(new ConsoleTraceListener());
        try
        {
            using (StreamWriter sw = new StreamWriter("testfile.txt", false))
            {
                sw.Write("Hello there!");
            }

            using (Stream iniStream = File.OpenRead(@"c:\platform.ini"))
            using (Stream fileStream = File.OpenRead("testfile.txt"))
            using (WebClient client = new WebClient())
            {
                MultipartHelper helper = new MultipartHelper();

                NameValueCollection props = new NameValueCollection();
                props.Add("fname", "john");
                props.Add("id", "acme");
                helper.Add(new NameValuePart(props));

                FilePart filepart = new FilePart(fileStream, "pics1", "text/plain");
                filepart.FileName = "1.jpg";
                helper.Add(filepart);

                FilePart ini = new FilePart(iniStream, "pics2", "text/plain");
                ini.FileName = "inifile.ini";
                helper.Add(ini);

                helper.Upload(client, "http://localhost/form.aspx", "POST");
            }
        }
        catch (Exception e)
        {
            Trace.WriteLine(e);
        }
    }
}

This will work with all versions of the .NET framework.

A: I can never get the examples to work properly, I always receive a 500 error when sending it to the server.
However I came across a very elegant method of doing it in this url
It is easily extendible and obviously works with binary files as well as XML.
You call it using something similar to this
class Program
{
    public static string gsaFeedURL = "http://yourGSA.domain.com:19900/xmlfeed";

    static void Main()
    {
        try
        {
            postWebData();
        }
        catch (Exception ex)
        {
        }
    }

    // new one I made from C# web service
    public static void postWebData()
    {
        StringDictionary dictionary = new StringDictionary();
        UploadSpec uploadSpecs = new UploadSpec();
        UTF8Encoding encoding = new UTF8Encoding();
        byte[] bytes;
        Uri gsaURI = new Uri(gsaFeedURL);  // Create new URI to GSA feeder gate
        string sourceURL = @"C:\FeedFile.xml"; // Location of the XML feed file
        // Two parameters to send
        string feedtype = "full";
        string datasource = "test";

        try
        {
            // Add the parameter values to the dictionary
            dictionary.Add("feedtype", feedtype);
            dictionary.Add("datasource", datasource);

            // Load the feed file created and get its bytes
            XmlDocument xml = new XmlDocument();
            xml.Load(sourceURL);
            bytes = Encoding.UTF8.GetBytes(xml.OuterXml);

            // Add data to upload specs
            uploadSpecs.Contents = bytes;
            uploadSpecs.FileName = sourceURL;
            uploadSpecs.FieldName = "data";

            // Post the data
            if ((int)HttpUpload.Upload(gsaURI, dictionary, uploadSpecs).StatusCode == 200)
            {
                Console.WriteLine("Successful.");
            }
            else
            {
                // GSA POST not successful
                Console.WriteLine("Failure.");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
}

A: Check out the MyToolkit library:
var request = new HttpPostRequest("http://www.server.com");
request.Data.Add("name", "value"); // POST data
request.Files.Add(new HttpPostFile("name", "file.jpg", "path/to/file.jpg"));

await Http.PostAsync(request, OnRequestFinished);

http://mytoolkit.codeplex.com/wikipage?title=Http

A: Client use convert File to ToBase64String, after use Xml to promulgate
to Server call, this server use File.WriteAllBytes(path,Convert.FromBase64String(dataFile_Client_sent)).
Good lucky!

A: This method work for upload multiple image simultaneously
        var flagResult = new viewModel();
        string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
        byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

        HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
        wr.ContentType = "multipart/form-data; boundary=" + boundary;
        wr.Method = method;
        wr.KeepAlive = true;
        wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

        Stream rs = wr.GetRequestStream();

        string path = @filePath;
        System.IO.DirectoryInfo folderInfo = new DirectoryInfo(path);

        foreach (FileInfo file in folderInfo.GetFiles())
        {
            rs.Write(boundarybytes, 0, boundarybytes.Length);
            string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
            string header = string.Format(headerTemplate, paramName, file, contentType);
            byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
            rs.Write(headerbytes, 0, headerbytes.Length);

            FileStream fileStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);
            byte[] buffer = new byte[4096];
            int bytesRead = 0;
            while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
            {
                rs.Write(buffer, 0, bytesRead);
            }
            fileStream.Close();
        }

        byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
        rs.Write(trailer, 0, trailer.Length);
        rs.Close();

        WebResponse wresp = null;
        try
        {
            wresp = wr.GetResponse();
            Stream stream2 = wresp.GetResponseStream();
            StreamReader reader2 = new StreamReader(stream2);
            var result = reader2.ReadToEnd();
            var cList = JsonConvert.DeserializeObject<HttpViewModel>(result);
            if (cList.message=="images uploaded!")
            {
                flagResult.success = true;
            }

        }
        catch (Exception ex)
        {
            //log.Error("Error uploading file", ex);
            if (wresp != null)
            {
                wresp.Close();
                wresp = null;
            }
        }
        finally
        {
            wr = null;
        }
        return flagResult;
    }

A: I realize this is probably really late, but I was searching for the same solution.  I found the following response from a Microsoft rep
private void UploadFilesToRemoteUrl(string url, string[] files, string logpath, NameValueCollection nvc)
{

    long length = 0;
    string boundary = "----------------------------" +
    DateTime.Now.Ticks.ToString("x");

    HttpWebRequest httpWebRequest2 = (HttpWebRequest)WebRequest.Create(url);
    httpWebRequest2.ContentType = "multipart/form-data; boundary=" +
    boundary;
    httpWebRequest2.Method = "POST";
    httpWebRequest2.KeepAlive = true;
    httpWebRequest2.Credentials = System.Net.CredentialCache.DefaultCredentials;

    Stream memStream = new System.IO.MemoryStream();
    byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

    string formdataTemplate = "\r\n--" + boundary + "\r\nContent-Disposition: form-data; name=\"{0}\";\r\n\r\n{1}";

    foreach(string key in nvc.Keys)
    {
        string formitem = string.Format(formdataTemplate, key, nvc[key]);
        byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
        memStream.Write(formitembytes, 0, formitembytes.Length);
    }

    memStream.Write(boundarybytes,0,boundarybytes.Length);

    string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n Content-Type: application/octet-stream\r\n\r\n";

    for(int i=0;i<files.Length;i++)
    {

        string header = string.Format(headerTemplate,"file"+i,files[i]);
        byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
        memStream.Write(headerbytes,0,headerbytes.Length);

        FileStream fileStream = new FileStream(files[i], FileMode.Open,
        FileAccess.Read);
        byte[] buffer = new byte[1024];

        int bytesRead = 0;

        while ( (bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0 )
        {
            memStream.Write(buffer, 0, bytesRead);
        }

        memStream.Write(boundarybytes,0,boundarybytes.Length);

        fileStream.Close();
    }

    httpWebRequest2.ContentLength = memStream.Length;
    Stream requestStream = httpWebRequest2.GetRequestStream();

    memStream.Position = 0;
    byte[] tempBuffer = new byte[memStream.Length];
    memStream.Read(tempBuffer,0,tempBuffer.Length);
    memStream.Close();
    requestStream.Write(tempBuffer,0,tempBuffer.Length );
    requestStream.Close();

    WebResponse webResponse2 = httpWebRequest2.GetResponse();

    Stream stream2 = webResponse2.GetResponseStream();
    StreamReader reader2 = new StreamReader(stream2);

    webResponse2.Close();
    httpWebRequest2 = null;
    webResponse2 = null;

}


text:
Q: Scroll Value not working

  <title>jQuery 6</title>

  <input type="checkbox" id="t1" />
  <button id="b1">check/uncheck</button>
  <input id="i11">

    Company
    Country

    Google
    USA

    SM entertainment
    South Korea

    BitCoin
    Japan

    Marvel
    USA

    Vans
    USA

text

text

So this is my full code, what i'm trying to do is to get the value in the input when scrolling, what has gone wrong here?
I've been checking the code over and over but the value just won't work. Then through the image i'm trying to get to the top of the page which works and so does the fade method.Is the problem within the function ?

A: You missed # inside $("i11").val($(this).scrollTop()) so this will be $("#i11").val($(this).scrollTop()) please look below snippet:

  <title>jQuery 6</title>

  <input type="checkbox" id="t1" />
  <button id="b1">check/uncheck</button>
  <input id="i11">

    Company
    Country

    Google
    USA

    SM entertainment
    South Korea

    BitCoin
    Japan

    Marvel
    USA

    Vans
    USA

text

text

redpajama_set_name: RedPajamaStackExchange


text:
Q: Customize DevExpress scheduler control timeline view header How to customize devexpress scheduler control timeline view header.
The date of default header is "Tuesday, July 23 2013 - Sunday, July 28 2013". I need to make header just  like this "2013.07.23-2013.07.28".
Sorry for my bad Englsih.
Help

A: You can accomplish this task by customizing the TimeScale.DisplayFormat property of the TimeScaleWeek scale:
var timeScaleWeek = new DevExpress.XtraScheduler.TimeScaleWeek();
timeScaleWeek.DisplayFormat = "yyyy.MM.dd";
schedulerControl1.Views.TimelineView.Scales.Add(timeScaleWeek);


text:
Q: Getting TemplateDoesNotExist error when using bootstrap3 as template pack for crispy forms I am using django-crispy-forms for my django project, and reading in the documentation I saw that to be able to use bootstrap3 features (like horizontal forms), I need to set bootstrap3 as my crispy template pack by adding this line in the settings.py of my project:
CRISPY_TEMPLATE_PACK = 'bootstrap3'

According to the docs, crispy's default is bootstrap v2. But after adding bootstrap3 in my settings, when I run my application in my development machine I get this error:
TemplateDoesNotExist at /dashboard/
bootstrap3/field.html
Request Method: POST
Request URL:    http://localhost:8000/dashboard/
Django Version: 1.7.3
Exception Type: TemplateDoesNotExist
Exception Value:
bootstrap3/field.html
Exception Location: C:\Python27\VirtualEnvs\Tlaloc\lib\site-packages\django\template\loader.py in find_template, line 136
Python Executable:  C:\Python27\VirtualEnvs\Tlaloc\Scripts\python.exe
Python Version: 2.7.7

If I remove the CRISPY_TEMPLATE_PACK line from my settings (as to use the defaults) or change it to look like this:
CRISPY_TEMPLATE_PACK = 'bootstrap'

Then I don't get an error anymore, but then the form-horizontal class doesn't work in my form.
This is how my form looks like in forms.py
class UserForm(forms.Form):
    user = forms.CharField(label='Account', max_length=15)
    password = forms.CharField(widget=forms.PasswordInput())

    # Crispy forms code
    def __init__(self, *args, **kwargs):
        super(UserForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-sm-2'
        self.helper.field_class = 'col-sm-10'
        self.helper.layout = Layout(
            Fieldset(
                '',
                'user',
                'password',
            ),
            Div(FormActions(
                Submit('continue', 'Continue', css_class='btn btn-primary'),
                Button('cancel', 'Cancel', css_class='btn btn-default',
                       data_dismiss='modal'),
                ),
                css_class='modal-footer'
                )
            )

And this is part of my template:
{% load crispy_forms_tags %}

                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

{{ config_values.environment_name }} Environment Authentication

Please enter the account and password that will be used to authenticate in the selected environment.

                        {% crispy user_form %}

                    {% comment %}
                    The footer will be added through the user_form using Crispy Forms.
                    The following code will be just left here as reference.

                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                        <button type="button" class="btn btn-primary">Continue</button>

                    {% endcomment %}

What am I doing wrong?

A: Turned out that the bootstrap3 template directory didn't exist in my installation of crispy forms.
I had Crispy Forms version 1.3.2 installed on my Windows system. And looking in the project page in github I saw that the current version, which at the moment is 1.4.0, did have the \crispy_forms\templates\bootstrap3 directory. Looks like bootstrap3 template pack was introduced until this version, older versions didn't have the template pack. I upgraded to the current version, and it is now working.

A: *

*In the settings.py file, include this:

CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'foundation-5')

*Then, in the register.html write this code:

<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>Django CRM - Register</title>

  <link href="{% static 'vendor/fontawesome-free/css/all.min.css' %}" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">

  <link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet">

Create an Account!

              <form method="POST">
                {% csrf_token %}
                {{form|crispy}}
                <button type="submit" class="btn btn-primary">Submit</button>
              </form>

                Forgot Password?

                Already have an account? Login!


text:
Q: What should we do with sets of answers that are actually polling options? Sometimes there are users that post questions and immediately with that answers that are just meant to attract votes (in the positive way: an opinion of the community).
As an example here. OP posts a feature request, and immediately after that two answers that just take one of the implementation details in the feature request in order to vote on (almost like a poll).
What should we do with such answers? Are they beneficial in any way? Should we let them stay or flag them? If so, how?

A: They aren't answers. They are poll options, directly taken from the original question.
And the problem with poll options is that you want each option to have equal visibility. Any voting and further real answers being posted by other users would mess this up and interfere with the poll you're intending to have. A fact which could even make it awkward for some to add their own answers/responses to the question.
Long story short, it doesn't fit the Q&A format, and I'd personally flag them as "not an answer".
Note that there is nothing against self-answered questions. But then make them good answers to a good question.

A: When I see someone essentially pre-posting every side of an issue (as in a poll), I generally remove the answers and leave them with this guidance:

I removed the polling-style answers you posted in favor of an open discussion. If you have thoughts on the issue yourself, please feel free to post it as an answer, but it is generally better to let everyone have a voice to express their own views rather pre-posting all sides of the conversation yourself.
It's not difficult to infer what the community wants from the conversation while allowing for the possibility that there's an issue we have not considered. Polling is not a good substitute for discussion. Thanks.

If you see this style of polling, you should flag the answers to have them removed with similar guidance.
Are poll-style questions acceptable on meta sites?
I can appreciate the desire in someone to step up and elicit decisive action with expediency, but that doesn't mean they should essentially control the entire conversation in one voice. That last bit about open discussion often (very often) raises issues that would have been lost in a simple poll. Even the simplest issues can involve more than simple yes/no answer. You just don't know until everyone has a say. No one person should be allowed to lay out all sides of an issue themselves.


text:
Q: AngularJS ui-router - view disappears on reload Recently I started to use ui-router to manage my page status.
I noticed that when I run the server for the first time, the content is there but if I navigate through the pages or reload the page the contents disappears.
I'm aware there was a bug on ui-router that could be causing this. I updated ui-router however the error still persists.
Did anyone manage to find a fix or work around it?
Edit ----
My investigation has lead me to believe that it has nothing to do with the ui-router and more on the time the app takes to complete the promise. As I will get Violation warnings on the setTimeout as part of jQuery

A: So I was partially right on my last edit hence this answer; jQuery had something to do with my problem (through the use of promises to retrieve data), however it had also to do with how the ui-router works:
As the page content is loaded, ui-router will manage the first load (and subsequent reloads) with the data that is provided by the GET request.
As this is a promise it is not guaranteed (especially as you grow your DB) that the data will be there in time to render the page.
To avoid from happening use the resolve property as part of ngRoute. This property allows for all the necessary data to be loaded before rendering the DOM.
If you want to read more about follow the link below:
https://medium.com/opinionated-angularjs/advanced-routing-and-resolves-a2fcbf874a1c
My code below:
App.js
'use strict';

 angular
    .module('knoweeApp', ['ui.router'])
    .config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider) {

        $stateProvider
            .state('home', {
                url:'/',
                templateUrl: 'views/user.html',
                controller: 'UserCtrl as user',
                resolve: {
                    user: function(userFinder) {
                        return userFinder.getUsers();
                    }
                }
            })

            .state('teacher', {
                url:'/teacher/:name',
                templateUrl: 'views/teacher.html',
                controller: 'TeacherCtrl as teacher'

            });

        $urlRouterProvider.otherwise('/');

    }]);

Service: userFinder
'use strict';

/**
 * @ngdoc service
 * @name knoweeApp.userFinder
 * @description
 * # userFinder
 * Service in the knoweeApp.
 */
angular.module('knoweeApp')
  .service('userFinder', function () {
    // AngularJS will instantiate a singleton by calling "new" on this function

    this.getUsers = function (){
        return $.get('users.json');
    };

  });

Controller: UserCtrl

'use strict';

angular.module('knoweeApp')
    .controller('UserCtrl', function (userFinder,user) {

    this.teachers = user;

    this.increment = function (item) {
        item.rating += 1;
    };

    this.decrement = function (item) {
        item.rating -= 1;
    };

});

Hope this helps, contact me if in doubt


text:
Q: How can I improve the test coverage of MetadataService.cls (recent Version for API v35)? I'm using the APEX wrapper for Metadata API found here https://github.com/financialforcedev/apex-mdapi
Looking at the test coverage, there are a lot of lines uncovered. Can this be improved easily?

A: I posted an issue report on github here https://github.com/financialforcedev/apex-mdapi/issues/119
I've created the missing invocations to get the coverage close to 100%
Add this code (also in the github-issue) into your MetadataServiceTest.cls and you will be fine:
@IsTest
private static void elfMissingGetRecordsTest() { // elf patch
    new MetadataService.ReadFlowResult().getRecords();
    new MetadataService.ReadWorkflowResult().getRecords();
    new MetadataService.ReadWorkflowRuleResult().getRecords();
    new MetadataService.ReadAssignmentRulesResult().getRecords();
    new MetadataService.ReadAssignmentRuleResult().getRecords();
    new MetadataService.ReadAutoResponseRulesResult().getRecords();
    new MetadataService.ReadAutoResponseRuleResult().getRecords();
    new MetadataService.ReadEscalationRulesResult().getRecords();
    new MetadataService.ReadEscalationRuleResult().getRecords();
    new MetadataService.ReadPostTemplateResult().getRecords();
    new MetadataService.ReadApprovalProcessResult().getRecords();
    new MetadataService.ReadHomePageComponentResult().getRecords();
    new MetadataService.ReadHomePageLayoutResult().getRecords();
    new MetadataService.ReadCustomObjectTranslationResult().getRecords();
    new MetadataService.ReadTranslationsResult().getRecords();
    new MetadataService.ReadProfileResult().getRecords();
    new MetadataService.ReadPermissionSetResult().getRecords();
    new MetadataService.ReadDataCategoryGroupResult().getRecords();
    new MetadataService.ReadRemoteSiteSettingResult().getRecords();
    new MetadataService.ReadPackageResult().getRecords();
    new MetadataService.ReadAuthProviderResult().getRecords();
    new MetadataService.ReadKnowledgeSettingsResult().getRecords();
    new MetadataService.ReadSharingSetResult().getRecords();
    new MetadataService.ReadSecuritySettingsResult().getRecords();
    new MetadataService.ReadIdeasSettingsResult().getRecords();
    new MetadataService.ReadChatterAnswersSettingsResult().getRecords();
    new MetadataService.ReadCommunityResult().getRecords();
    new MetadataService.ReadActivitiesSettingsResult().getRecords();
    new MetadataService.ReadContractSettingsResult().getRecords();
    new MetadataService.ReadOrderSettingsResult().getRecords();
    new MetadataService.ReadOpportunitySettingsResult().getRecords();
    new MetadataService.ReadProductSettingsResult().getRecords();
    new MetadataService.ReadQuoteSettingsResult().getRecords();
    new MetadataService.ReadCallCenterResult().getRecords();
    new MetadataService.ReadEntitlementProcessResult().getRecords();
    new MetadataService.ReadMilestoneTypeResult().getRecords();
    new MetadataService.ReadEntitlementTemplateResult().getRecords();
    new MetadataService.ReadEntitlementSettingsResult().getRecords();
    new MetadataService.ReadBusinessHoursSettingsResult().getRecords();
    new MetadataService.ReadBusinessHoursEntryResult().getRecords();
    new MetadataService.ReadConnectedAppResult().getRecords();
    new MetadataService.ReadAppMenuResult().getRecords();
    new MetadataService.ReadMobileSettingsResult().getRecords();
    new MetadataService.ReadNetworkResult().getRecords();
    new MetadataService.ReadCompanySettingsResult().getRecords();
    new MetadataService.ReadForecastingSettingsResult().getRecords();
    new MetadataService.ReadSamlSsoConfigResult().getRecords();
    new MetadataService.ReadLiveAgentSettingsResult().getRecords();
    new MetadataService.ReadSkillResult().getRecords();
    new MetadataService.ReadLiveChatDeploymentResult().getRecords();
    new MetadataService.ReadLiveChatButtonResult().getRecords();
    new MetadataService.ReadLiveChatAgentConfigResult().getRecords();
    new MetadataService.ReadSynonymDictionaryResult().getRecords();
    new MetadataService.ReadFolderResult().getRecords();
    new MetadataService.ReadReportFolderResult().getRecords();
    new MetadataService.ReadDashboardFolderResult().getRecords();
    new MetadataService.ReadDocumentFolderResult().getRecords();
    new MetadataService.ReadEmailFolderResult().getRecords();
    new MetadataService.ReadRoleOrTerritoryResult().getRecords();
    new MetadataService.ReadWorkflowActionResult().getRecords();
    new MetadataService.ReadSiteDotComResult().getRecords();
    new MetadataService.ReadWorkflowTaskResult().getRecords();
    new MetadataService.ReadWorkflowSendResult().getRecords();
    new MetadataService.ReadWorkflowOutboundMessageResult().getRecords();
    new MetadataService.ReadWorkflowKnowledgePublishResult().getRecords();
    new MetadataService.ReadWorkflowFieldUpdateResult().getRecords();
    new MetadataService.ReadWorkflowAlertResult().getRecords();
    new MetadataService.ReadVisualizationPluginResult().getRecords();
    new MetadataService.ReadCustomMetadataResult().getRecords();
    new MetadataService.ReadNameSettingsResult().getRecords();
    new MetadataService.ReadMarketingActionSettingsResult().getRecords();
    new MetadataService.ReadCustomPermissionResult().getRecords();
    new MetadataService.ReadAuraDefinitionBundleResult().getRecords();
    new MetadataService.ReadCorsWhitelistOriginResult().getRecords();
    new MetadataService.ReadManagedTopicsResult().getRecords();
    new MetadataService.ReadTerritory2Result().getRecords();
    new MetadataService.ReadTerritory2ModelResult().getRecords();
    new MetadataService.ReadTerritory2SettingsResult().getRecords();
    new MetadataService.ReadTerritory2TypeResult().getRecords();
    new MetadataService.ReadXOrgHubResult().getRecords();
    new MetadataService.ReadActionLinkGroupTemplateResult().getRecords();
    new MetadataService.ReadLicenseDefinitionResult().getRecords();
    new MetadataService.ReadMarketingResourceTypeResult().getRecords();
    new MetadataService.ReadMatchingRuleResult().getRecords();
    new MetadataService.ReadMatchingRulesResult().getRecords();
    new MetadataService.ReadNamedCredentialResult().getRecords();
    new MetadataService.ReadPersonalJourneySettingsResult().getRecords();
    new MetadataService.ReadSharingRulesResult().getRecords();
    new MetadataService.ReadSharingBaseRuleResult().getRecords();
    new MetadataService.ReadSharingCriteriaRuleResult().getRecords();
    new MetadataService.ReadSharingOwnerRuleResult().getRecords();
    new MetadataService.ReadSharingTerritoryRuleResult().getRecords();
    new MetadataService.ReadMetadataWithContentResult().getRecords();

    new MetadataService.ReadCustomSiteResult().getRecords();
    new MetadataService.ReadListViewResult().getRecords();
    new MetadataService.ReadInstalledPackageResult().getRecords();
    new MetadataService.ReadCustomFieldResult().getRecords();
    new MetadataService.ReadFieldSetResult().getRecords();
    new MetadataService.ReadPicklistValueResult().getRecords();
    new MetadataService.ReadRecordTypeResult().getRecords();
    new MetadataService.ReadWebLinkResult().getRecords();
    new MetadataService.ReadAddressSettingsResult().getRecords();
    new MetadataService.ReadCaseSettingsResult().getRecords();
    new MetadataService.ReadCustomObjectResult().getRecords();
    new MetadataService.ReadLayoutResult().getRecords();
    new MetadataService.ReadEmailTemplateResult().getRecords();
    new MetadataService.ReadScontrolResult().getRecords();
    new MetadataService.ReadApexPageResult().getRecords();
    new MetadataService.ReadApexComponentResult().getRecords();
    new MetadataService.ReadApexClassResult().getRecords();
    new MetadataService.ReadApexTriggerResult().getRecords();
    new MetadataService.ReadStaticResourceResult().getRecords();
    new MetadataService.ReadDocumentResult().getRecords();
    new MetadataService.ReadCustomLabelsResult().getRecords();
    new MetadataService.ReadCustomLabelResult().getRecords();
    new MetadataService.ReadAccountSettingsResult().getRecords();
    new MetadataService.ReadQueueResult().getRecords();
    new MetadataService.ReadCustomDataTypeResult().getRecords();
    new MetadataService.ReadExternalDataSourceResult().getRecords();
    new MetadataService.ReadGroupResult().getRecords();
    new MetadataService.ReadBusinessProcessResult().getRecords();
    new MetadataService.ReadCompactLayoutResult().getRecords();
    new MetadataService.ReadSharingReasonResult().getRecords();
    new MetadataService.ReadValidationRuleResult().getRecords();
    new MetadataService.ReadReportTypeResult().getRecords();
    new MetadataService.ReadReportResult().getRecords();
    new MetadataService.ReadDashboardResult().getRecords();
    new MetadataService.ReadAnalyticSnapshotResult().getRecords();
    new MetadataService.ReadCustomPageWebLinkResult().getRecords();
    new MetadataService.ReadQuickActionResult().getRecords();
    new MetadataService.ReadFlexiPageResult().getRecords();
    new MetadataService.ReadCustomTabResult().getRecords();
    new MetadataService.ReadCustomApplicationComponentResult().getRecords();
    new MetadataService.ReadCustomApplicationResult().getRecords();
    new MetadataService.ReadPortalResult().getRecords();
    new MetadataService.ReadLetterheadResult().getRecords();

    new MetadataService.ReadFlowResult().getRecords();
    new MetadataService.ReadFlowResult().getRecords();

}

@IsTest
private static void elfMissingGetResultTest() { // elf patch
    new MetadataService.checkStatus_element();
    new MetadataService.checkStatusResponse_element();

    new MetadataService.readWorkflowRuleResponse_element().getResult();
    new MetadataService.readSamlSsoConfigResponse_element().getResult();
    new MetadataService.readCustomLabelResponse_element().getResult();
    new MetadataService.readBusinessHoursEntryResponse_element().getResult();
    new MetadataService.readMobileSettingsResponse_element().getResult();
    new MetadataService.readChatterAnswersSettingsResponse_element().getResult();
    new MetadataService.readSharingRulesResponse_element().getResult();
    new MetadataService.readPortalResponse_element().getResult();
    new MetadataService.readSkillResponse_element().getResult();
    new MetadataService.readEscalationRulesResponse_element().getResult();
    new MetadataService.readCustomDataTypeResponse_element().getResult();
    new MetadataService.readExternalDataSourceResponse_element().getResult();
    new MetadataService.readEntitlementProcessResponse_element().getResult();
    new MetadataService.readRecordTypeResponse_element().getResult();
    new MetadataService.readScontrolResponse_element().getResult();
    new MetadataService.readDataCategoryGroupResponse_element().getResult();
    new MetadataService.readValidationRuleResponse_element().getResult();
    new MetadataService.readProfileResponse_element().getResult();
    new MetadataService.readIdeasSettingsResponse_element().getResult();
    new MetadataService.readConnectedAppResponse_element().getResult();
    new MetadataService.readApexPageResponse_element().getResult();
    new MetadataService.readProductSettingsResponse_element().getResult();
    new MetadataService.readLiveAgentSettingsResponse_element().getResult();
    new MetadataService.readOpportunitySettingsResponse_element().getResult();
    new MetadataService.readLiveChatDeploymentResponse_element().getResult();
    new MetadataService.readActivitiesSettingsResponse_element().getResult();
    new MetadataService.readLayoutResponse_element().getResult();
    new MetadataService.readWebLinkResponse_element().getResult();
    new MetadataService.readSiteDotComResponse_element().getResult();
    new MetadataService.readCompanySettingsResponse_element().getResult();
    new MetadataService.readHomePageLayoutResponse_element().getResult();
    new MetadataService.readDashboardResponse_element().getResult();
    new MetadataService.readAssignmentRulesResponse_element().getResult();
    new MetadataService.readAnalyticSnapshotResponse_element().getResult();
    new MetadataService.readEscalationRuleResponse_element().getResult();
    new MetadataService.readCustomSiteResponse_element().getResult();
    new MetadataService.readGroupResponse_element().getResult();
    new MetadataService.readReportTypeResponse_element().getResult();
    new MetadataService.readQuickActionResponse_element().getResult();
    new MetadataService.readCustomPageWebLinkResponse_element().getResult();
    new MetadataService.readApexComponentResponse_element().getResult();
    // new MetadataService.readBaseSharingRuleResponse_element().getResult();
    new MetadataService.readEntitlementTemplateResponse_element().getResult();
    new MetadataService.readFlexiPageResponse_element().getResult();
    new MetadataService.readWorkflowResponse_element().getResult();
    new MetadataService.readWorkflowActionResponse_element().getResult();
    new MetadataService.readAddressSettingsResponse_element().getResult();
    new MetadataService.readContractSettingsResponse_element().getResult();
    new MetadataService.readCustomObjectResponse_element().getResult();
    new MetadataService.readTranslationsResponse_element().getResult();
    new MetadataService.readRoleOrTerritoryResponse_element().getResult();
    new MetadataService.readApexTriggerResponse_element().getResult();
    new MetadataService.readCustomLabelsResponse_element().getResult();
    new MetadataService.readSecuritySettingsResponse_element().getResult();
    new MetadataService.readCallCenterResponse_element().getResult();
    new MetadataService.readPicklistValueResponse_element().getResult();
    new MetadataService.readRemoteSiteSettingResponse_element().getResult();
    new MetadataService.readQuoteSettingsResponse_element().getResult();
    new MetadataService.readSynonymDictionaryResponse_element().getResult();
    new MetadataService.readPostTemplateResponse_element().getResult();
    new MetadataService.readCustomTabResponse_element().getResult();
    new MetadataService.readLetterheadResponse_element().getResult();
    new MetadataService.readInstalledPackageResponse_element().getResult();
    new MetadataService.readQueueResponse_element().getResult();
    new MetadataService.readAuthProviderResponse_element().getResult();
    new MetadataService.readEntitlementSettingsResponse_element().getResult();
    new MetadataService.readCustomFieldResponse_element().getResult();
    new MetadataService.readStaticResourceResponse_element().getResult();
    new MetadataService.readEmailTemplateResponse_element().getResult();
    new MetadataService.readSharingReasonResponse_element().getResult();
    new MetadataService.readLiveChatButtonResponse_element().getResult();
    new MetadataService.readNetworkResponse_element().getResult();
    new MetadataService.readApprovalProcessResponse_element().getResult();
    new MetadataService.readMilestoneTypeResponse_element().getResult();
    new MetadataService.readAssignmentRuleResponse_element().getResult();
    new MetadataService.readCompactLayoutResponse_element().getResult();
    new MetadataService.readLiveChatAgentConfigResponse_element().getResult();
    new MetadataService.readAccountSettingsResponse_element().getResult();
    new MetadataService.readBusinessProcessResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readAutoResponseRuleResponse_element().getResult();
    new MetadataService.readPermissionSetResponse_element().getResult();
    new MetadataService.readBusinessHoursSettingsResponse_element().getResult();
    new MetadataService.readForecastingSettingsResponse_element().getResult();
    new MetadataService.readReportResponse_element().getResult();
    new MetadataService.readAppMenuResponse_element().getResult();
    new MetadataService.readListViewResponse_element().getResult();
    new MetadataService.readOrderSettingsResponse_element().getResult();
    new MetadataService.readCustomObjectTranslationResponse_element().getResult();
    new MetadataService.readCustomApplicationResponse_element().getResult();
    new MetadataService.readKnowledgeSettingsResponse_element().getResult();
    new MetadataService.readCaseSettingsResponse_element().getResult();
    new MetadataService.readApexClassResponse_element().getResult();
    new MetadataService.readPackageResponse_element().getResult();
    new MetadataService.readCommunityResponse_element().getResult();
    new MetadataService.readDocumentResponse_element().getResult();
    new MetadataService.readAutoResponseRulesResponse_element().getResult();
    new MetadataService.readFolderResponse_element().getResult();
    new MetadataService.readCustomApplicationComponentResponse_element().getResult();
    new MetadataService.readFieldSetResponse_element().getResult();
    new MetadataService.readSharingSetResponse_element().getResult();
    new MetadataService.readHomePageComponentResponse_element().getResult();

    new MetadataService.readReportFolderResponse_element().getResult();
    new MetadataService.readDashboardFolderResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readDocumentFolderResponse_element().getResult();
    new MetadataService.readEmailFolderResponse_element().getResult();
    new MetadataService.readWorkflowTaskResponse_element().getResult();
    new MetadataService.readWorkflowSendResponse_element().getResult();
    new MetadataService.readWorkflowOutboundMessageResponse_element().getResult();
    new MetadataService.readWorkflowKnowledgePublishResponse_element().getResult();
    new MetadataService.readWorkflowFieldUpdateResponse_element().getResult();
    new MetadataService.readWorkflowAlertResponse_element().getResult();
    new MetadataService.readVisualizationPluginResponse_element().getResult();
    new MetadataService.readCustomMetadataResponse_element().getResult();
    new MetadataService.readNameSettingsResponse_element().getResult();
    new MetadataService.readMarketingActionSettingsResponse_element().getResult();
    new MetadataService.readCustomPermissionResponse_element().getResult();
    new MetadataService.readAuraDefinitionBundleResponse_element().getResult();
    new MetadataService.readCorsWhitelistOriginResponse_element().getResult();
    new MetadataService.readManagedTopicsResponse_element().getResult();
    new MetadataService.readTerritory2Response_element().getResult();
    new MetadataService.readTerritory2ModelResponse_element().getResult();
    new MetadataService.readTerritory2SettingsResponse_element().getResult();
    new MetadataService.readTerritory2TypeResponse_element().getResult();
    new MetadataService.readXOrgHubResponse_element().getResult();
    new MetadataService.readActionLinkGroupTemplateResponse_element().getResult();
    new MetadataService.readLicenseDefinitionResponse_element().getResult();
    new MetadataService.readMarketingResourceTypeResponse_element().getResult();
    new MetadataService.readMatchingRuleResponse_element().getResult();
    new MetadataService.readMatchingRulesResponse_element().getResult();
    new MetadataService.readNamedCredentialResponse_element().getResult();
    new MetadataService.readPersonalJourneySettingsResponse_element().getResult();
    new MetadataService.readSharingBaseRuleResponse_element().getResult();
    new MetadataService.readSharingCriteriaRuleResponse_element().getResult();
    new MetadataService.readSharingOwnerRuleResponse_element().getResult();
    new MetadataService.readSharingTerritoryRuleResponse_element().getResult();
    new MetadataService.readMetadataWithContentResponse_element().getResult();

}


text:
Q: OpenGL constructing and using data on the GPU I am not a graphics programmer, I use C++ and C mainly, and every time I try to go into OpenGL, every book, and every resource starts like this:
GLfloat Vertices[] = {
some, numbers, here,
some, more, numbers,
numbers, numbers, numbers
};

Or they may even be vec4.
But then you do something like this:
for(int i = 0; i < 10000; i++)
    for(int j = 0; j < 10000; j++)
        make_vertex();

And you get a problem. That loop is going to take a significant amount of time to finish- and if the make_vertex() function is anything like a saxpy or something of the sort, it is not just a problem... it is a big problem. For example, let us assume I wish to create fractal terrain. For any modern graphic card this would be trivial.
I understand the paradigm goes like this: Write the vertices manually -> Send them over to the GPU -> GPU does vertex processing, geometry, rasterization all the good stuff. I am sure it all makes sense. But why do I have to do the entire 'Send it over' step? Is there no way to skip that entire intermediary step, and just create vertices on the GPU, and draw them, without the obvious bottleneck?
I would very much appreciate at least a point in the right direction.
I also wonder if there is a possible solution without delving into compute shaders or CUDA? Does openGL or GLSL not provide a suitable random function which can be executed in parallel?

A: I think what you're asking for could work by generating height maps with a compute shader, and mapping that onto a grid with fixed spacing which can be generated trivially. That's a possible solution off the top of my head. You can use GL Compute shaders, OpenCL, or CUDA. Details can be generated with geometry and tessellation shaders.
As for preventing the camera from clipping, you'd probably have to use transform feedback and do a check per frame to see if the direction you're moving in will intersect the geometry.

A: Your entire question seems to be built on a huge misconception, that vertices are the only things which need to be "crunched" by the GPU.
First, you should understand that GPUs are far more superior than CPUs when it comes to parallelism (heck, GPUs sacrifice conditional control jumping for the sake of parallelism). Second, shaders and these buffers you make are all stored on the GPU after being uploaded by the CPU. The reason you don't just create all vertices on the GPU? It's the same reason for why you load an image from the hard drive instead of creating a raw 2D array and start filling it up with your pixel data inline. Even then, your image would be stored in the executable program file, which is stored on the hard disk and only loaded to memory when you run it. In an actual application, you'll want to load your graphics off assets stored somewhere (usually the hard drive). Why not let the GPU load the assets from the hard drive by itself? The GPU isn't connected to a hardware's storage directly, but barely to the system's main memory via some BUS. That's because to connect to any storage directly, the GPU will have to deal with the file system which is managed by the OS. That's one of the things the CPU would be faster at doing since we're dealing with serialized data.
Now what shaders deal with is this data you upload to the GPU (vertices, texture coordinates, textures..etc). In ancient OpenGL, no one had to write any shaders. Graphics drivers came with a builtin pipeline which handles regular rendering requests for you. You'd provide it with 4 vertices, 4 texture coordinates and a texture among other things (transformation matrices..etc), and it'd draw your graphics for you on the screen. You could go a bit farther and add some lights to your scene and maybe customize a few things about it, but things were still pretty tight. New OpenGL specifications gave more freedom to the developer by allowing them to rewrite parts of the pipeline with shaders. The developer becomes responsible for transforming vertices into place and doing all sort of other calculations related to lighting etc.

I would very much appreciate at least a point in the right direction.
  I am guessing it has something to do with uniforms, but really, with
  me skipping pages, I really cannot understand how a shader program
  runs or what the lifetime of the variables is.

uniforms are variables you can send to the shaders from the CPU every frame before you use it to render graphics. When you use the saturation slider in Photoshop or Gimp, it (probably) sends the saturation factor value to the shader as a uniform of type float. uniforms are what you use to communicate little settings like these to your shaders from your application.
To use a shader program, you first have to set it up. A shader program consists of at least 2 types of shaders linked together, a fragment shader and a vertex shader. You use some OpenGL functions to upload your shader sources to the GPU, issue an order of compilation followed by linking, and it'll give you the program's ID. To use this program, you simply glUseProgram(programId) and everything following this call will use it for drawing. The vertex shader is the code that runs on the vertices you send to position them on the screen correctly. This is where you can do transformations on your geometry like scaling, rotation etc. A fragment shader runs at some stage afterwards using interpolated (transitioned) values outputted from the vertex shader to define the color and the depth of every unit fragment on what you're drawing. This is where you can do post-processing effects on your pixels.
Anyway, I hope I've helped making a few things clearer to you, but I can only tell you that there are no shortcuts. OpenGL has quite a steep learning curve, but it all connects and things start to make sense after a while. If you're getting so bored of books and such, then consider maybe taking code snippets of every lesson, compile them, and start messing around with them while trying to rationalize as you go. You'll have to resort to written documents eventually, but hopefully then things will fit easier into your head when you have some experience with the implementation components. Good luck.
Edit:
If you're trying to generate vertices on the fly using some algorithm, then try looking into Geometry Shaders. They may give you what you want.

A: You probably want to use CUDA for the things you are used to do in C or C++, and let OpenGL access the rasterizer and other graphics stuff.
OpenGL an CUDA interact somehow nicely. A good entry point to customize the contents of a buffer object is here: http://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__OPENGL.html#group__CUDART__OPENGL_1g0fd33bea77ca7b1e69d1619caf44214b , with cudaGraphicsGLRegisterBuffer method.
You may also want to have a look at the nbody sample from NVIDIA GPU SDK samples the come with current CUDA installs.


text:
Q: Why are the three dots written to a new line? puts "Hello! Reading temperature value from data file..."
num = File.read("temp.dat")
puts "The number is #{num}..."
celsius = num.to_i
fahrenheit = (celsius.to_i * 9 / 5) + 32
puts "The Fahrenheit value is: #{ fahrenheit }."

In the third line, the ... after the #{num} block are printed in a new line. I was under the impression that using that block was passing parameter to the display allowing easier formatting.
Why are the dots going to a new line?

A: When you read in a file, you get the newlines, too. Maybe what you're looking for is this:
celsius = File.readlines("temp.dat").first.to_i
puts "The number is #{celsius}..."

If you have a look at what you're reading it might make sense:
puts num.inspect
# => "20\n"

A: Presumably temp.dat ends with a newline character, num contains a newline character. To remove the newline character, you can use the String#chomp method, which removes any newline character at the end of a string.

A: My guess is that the newline is coming in from the file
If that is the case then
puts "The number is #{num.strip}..."

should fix it.

A: When you read the file, you are also reading the carriage return/newline in the file.  Use String#chomp to strip off this extra unwanted whitespace:
num = File.read("temp.dat").chomp
puts "The number is #{num}..."

See http://ruby-doc.org/core/classes/String.html#M001188 for more information.

A: Since you're trying to read an integer, the simplest way I know to read a single number from a file is:
File.read('temp.dat').to_i
# => 42

to_i will parse until the first non-digit which would be the "\n". At that point it'll stop reading and will return only the value, converted to an integer.
Doing that lets you clean your code and reduce it to:
puts "Hello! Reading temperature value from data file..."
celsius = File.read("temp.dat").to_i
puts "The number is #{ celsius }..."
fahrenheit = (celsius * 9 / 5) + 32
puts "The Fahrenheit value is: #{ fahrenheit }."

This is NOT how to read a file in general, it's just an answer to this particular question.


text:
Q: Regexp if contains XXX but not contains XXX Trying to archive a regexp to filter bounced emails differing them from SPAM or temporary undeliverable.
Our idea is to grab certain words the expression could contain (code + word) but ignore the whole line if it contans others such as (SPAM|temporarily undeliverable|disk quota exceeded) etc, as this would not be considered permanent bounces. We've managed the first part and found a couple of answers here about negative regexp (http://stackoverflow.com/questions/1153856/string-negation-using-regular-expressions) but been completely unsuccessful in mixing both in one group sentence so far.
Something like:
.*(5.3.0|5.1.0).*(User unknown|invalid|Unknown address|doesn't have a)

but not match if anywhere else on the same line contains xxx words. Something like:
^(?!(SPAM|temporarily undeliverable|disk quota exceeded)).*$

So the following first line would match but the second should not

Diagnostic-Code: smtp; 5.3.0 - Other mail system problem 554-"delivery
  error: dd This user doesn't have a btinternet.com account
  (xxxxxxxx@xxxxxinternet.com) [0] - mta1000.bt.mail.ird.yahoo.com"
  (delivery attempts: 0)
Diagnostic-Code: smtp; 5.1.0 - Unknown address error 550-'RCPT
  TO: Mailbox disk quota exceeded' (delivery
  attempts: 0)

A: You are searching only at the start of the string for your negation. You just need to add a .*
try
^(?!.*(SPAM|temporarily undeliverable|disk quota exceeded)).*(5.3.0|5.1.0).*(User unknown|invalid|Unknown address|doesn't have a)

See it here on Regexr