Recent Updates Page 2 RSS Toggle Comment Threads | Keyboard Shortcuts

  • arturito 8:46 am on July 4, 2010 Permalink | Reply  

    Sony Vaio VGN NW11S Memory Stick Card Reader Writer Driver for Windows 7 

    Sometime ago I bought this  model of Sony Vaio which originally came with Windows Vista installed.  Since it is not my favorite OS I partitioned , formatted disk and installed Windows 7. I managed to get most of the drivers from sony vaio website http://support.vaio.sony.eu/computing/vaio/downloads/updates/index.aspx?l=en_GB&m=VGN-NW11S_S&os=10
    There was only one device which didn’t install – it was memory stick card reader and writer. (Device Manager marked “System Base Device”  with yellow exclamation mark) I found this driver which worked for me:
    http://esupport.sony.com/US/perl/swu-download.pl?mdl=VGNFW378JB&upd_id=4315&os_id=34
    The installation is in Spanish though the download is from US mirror (????) and it says it is for VGN-FW378J/B. But I can assure you the driver works fine on NW11S.  You can also google for the file RIDMSC-00165677-64.EXE

    Good Luck!


     
  • arturito 7:28 pm on June 14, 2010 Permalink | Reply  

    USB Typewriter Demo 

     
  • arturito 11:37 am on June 14, 2010 Permalink | Reply  

    Accesing shared mailbox in Exchange Web Services 2007 Service Pack 1 and downloading attachments with C# 

    In one of the previous articles I presented a sample code which allows to download attachments from email in Microsoft Exchange Server 2003 using WebDAV.
    However, with Microsoft exchange 2007 it can be achieved by using Exchange Web Service (EWS). In order to authenticate, user requires
    webmail access. Here is the sample code that allows to access mail resources of the shared mailbox.
    	    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
                NetworkCredential cred = new NetworkCredential("username", "password", "domain");
                Uri url = new Uri(@"https://server/EWS/Exchange.asmx");
                service.Url = url;
                service.Credentials = cred;
    
                //Mailbox mb = new Mailbox("artur.kedzior@ext.oami.europa.eu");
                Mailbox mb = new Mailbox("sharedmailbox@yourcompany.com");
    
                FolderId fid1 = new FolderId(WellKnownFolderName.Inbox, mb);
    
                // Add a search filter that searches on the body or subject.
                List<SearchFilter> searchFilterCollection = new List<SearchFilter>();
                searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Subject, "Financial Reports"));
                SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection.ToArray());
    
                // Create a view with a page size of 10.
                ItemView view = new ItemView(10);
    
                // Identify the Subject and DateTimeReceived properties to return.
                // Indicate that the base property will be the item identifier
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, ItemSchema.DateTimeReceived);
    
                // Order the search results by the DateTimeReceived in descending order.
                view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Ascending);
    
                // Set the traversal to shallow. (Shallow is the default option; other options are Associated and SoftDeleted.)
                view.Traversal = ItemTraversal.Shallow;
    
                FindItemsResults<Item> findResults = service.FindItems(fid1, searchFilter,view);
                foreach (Item item in findResults.Items)
                {
                    EmailMessage message = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.IdOnly, ItemSchema.Attachments));
    
                    foreach (Attachment attachment in message.Attachments)
                    {
                        if (attachment is FileAttachment)
                        {
                            FileAttachment fileAttachment = attachment as FileAttachment;
    
                            // Load the file attachment into memory and print out its file name.
                            fileAttachment.Load();
                            Console.WriteLine("Attachment name: " + fileAttachment.Name);
    
                            // Stream attachment contents into a file.
                            FileStream theStream = new FileStream("D:\\Downloads\\Attachments\\" + fileAttachment.Name, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                            fileAttachment.Load(theStream);
                            theStream.Close();
                            theStream.Dispose();
                        }
                        else // Attachment is an item attachment.
                        {
                            // Load attachment into memory and write out the subject.
                            ItemAttachment itemAttachment = attachment as ItemAttachment;
                            itemAttachment.Load();
                            Console.WriteLine("Subject: " + itemAttachment.Item.Subject);
                        }
                    }
                }
    
     
    • CJ 5:08 pm on August 10, 2010 Permalink | Reply

      Hi,

      Thanks for this posting. I had a request from a client of mine. They wanted to filter the attached email by the subject line. Which is the itemAttachment.Item.subject in your code. Then load the file attachment based on the subject line of the attached email to a folder that was named after the subject line. Since the email that they received could have multiple emails attached to them, and each attached email could have multiple attached files asscoiated. I am trying to figure out a way to link the item attachment with the file attachment in the attached email and group them by the item attachment subject.

      Would you please give me some pointers on how to implement this?

      Thanks in advance,

      - CJ

    • arturito 4:39 pm on August 11, 2010 Permalink | Reply

      To be honest I’ve never had a need to do it.

      But you could possibly compare the FileAttachment.ContentId with ItemAttachment.ContentId.

      http://msdn.microsoft.com/en-us/library/dd636130(v=EXCHG.80).aspx

      http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.fileattachment_members(v=EXCHG.80).aspx

      Hope this helps!

  • arturito 12:44 pm on May 28, 2010 Permalink | Reply  

    Aggressive Maneuvers for Autonomous Quadrotor Flight 

     
  • arturito 7:18 pm on May 25, 2010 Permalink | Reply  

    Worst Fight Scene Ever 

    This one is really funny! :)

     
    • Fernando 5:57 am on August 12, 2010 Permalink | Reply

      Hi Arturito,

      I agree that is not the best one but you must consider that the fight is in a very strange world in a distant galaxy…
      And the most important, Picard is God and Kirk his prophet and we must respect our prophets as the bajorian do.

      See you.

      • arturito 4:48 pm on August 12, 2010 Permalink | Reply

        Oh, I do know that! :)
        It is just the movements and the motion of the fight that makes me laugh.
        I see you are a Trekky too :) I’m in the Star Wars camp.
        Darh Vader is God and the whole Empire is just badass! :)

  • arturito 12:15 pm on May 20, 2010 Permalink | Reply  

    C# ASP.NET Ajax AutoCompleteExtender with AjaxControlToolkit 

    Here is a tutorial on how to create autocomplete using AjaxControlToolkit

    Create ASP.NET Web Application and paste this code:

        <div>
            <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
            <asp:AutoCompleteExtender ID="AutoCompleteExtender1"
                                      runat="server"
                                      TargetControlID="TextBox1"
                                      ServicePath="AutoCompleter.asmx"
                                      ServiceMethod="GetFilmTitles"
                                      MinimumPrefixLength="1"
                                      Enabled="true"
                                      EnableCaching="true"
            >
            </asp:AutoCompleteExtender>
        </div>
    

    Add WebService to the project and call it AutoCompleter.

    Paste this code:

    
    [WebService(Namespace = "http://tempuri.org/")]
    
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    
    [ToolboxItem(false)]
    
    [ScriptService]
    
    public class AutoCompleter : System.Web.Services.WebService
    
    {
    
    [WebMethod]
    
    [ScriptMethod()]
    
    public string[] GetFilmTitles(string prefixText)
    
    {
    
    ArrayList sampleList = new ArrayList();
    
    sampleList.Add("Akira");
    
    sampleList.Add("Afro Samurai");
    
    sampleList.Add("Gantz");
    
    sampleList.Add("Naruto");
    
    sampleList.Add("Darker Than Black");
    
    sampleList.Add("Monster");
    
    sampleList.Add("Death Note");
    
    sampleList.Add("Berkserk");
    
    sampleList.Add("Evangelion");
    
    sampleList.Add("Full Metal Alchemist");
    
    sampleList.Add("One Piece");
    
    sampleList.Add("Elfen Lied");
    
    sampleList.Add("Ghost In The Shell");<span style="white-space: pre;"> </span>
    
    ArrayList filteredList = new ArrayList();
    
    foreach (string s in sampleList)
    
    {
    
    if (s.ToLower().StartsWith(prefixText.ToLower()))
    
    filteredList.Add(s);
    
    }
    
    return (string[])filteredList.ToArray(typeof(string));
    
    }
    
    }
    

    and vuala! :)

     
    • Anjana 8:11 am on June 29, 2010 Permalink | Reply

      AutoCompleteExtender is getting hide from other dropdown control which is just below the AutoCompleteExtender

      • arturito 8:51 am on July 4, 2010 Permalink | Reply

        You mean the top AutoCompleter goes under the one which is below? In that case it is the matter of changing css property: z-index. (I had exactly the same problem :) )

  • arturito 10:02 am on May 14, 2010 Permalink | Reply  

    Dan The Man – really funny computer game like animation 

    That is a big LOL.

     
  • arturito 9:54 am on May 14, 2010 Permalink | Reply  

    Sending emails via Microsoft Exchange 2003 using WebDav 

    Here is the sample of the code that I have been using to send emails vai Exchange 2003 using WebDAV.
    Domain user that authenticates  against mailbox need to have permissions to access webmail.

    	   static void Sendmail(string server,string alias,string password,string domain, string to, string subject,string text)
            {
                System.Net.HttpWebRequest PUTRequest;
                System.Net.HttpWebRequest PUTRequest1;
                System.Net.WebResponse PUTResponse;
                System.Net.WebResponse PUTResponse1;
                System.Net.HttpWebRequest PROPPATCHRequest;
                System.Net.WebResponse PROPPATCHResponse;
                System.Net.HttpWebRequest MOVERequest;
                System.Net.WebResponse MOVEResponse;
                System.Net.CredentialCache MyCredentialCache;
                string strMailboxURI = "http://"+server+"/Exchange/";
                string strSubURI = "http://" + server + "Exchange/";
                string strTempURI = "http://" + server + "/Exchange/";
                string strServer = server;
                string strPassword = password;
                string strDomain = domain;
                string strAlias = alias;
                string strTo = to;
                string strSubject = subject;
                string strText = text;
                string strBody = "";
                byte[] bytes = null;
    
                System.IO.Stream PUTRequestStream = null;
    
                try
                {
                    // Build the mailbox URI.
    
                    strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;
    
                    // Build the submission URI for the message. If Secure
                    // Sockets Layer (SSL) is set up on the server, use
                    // "https://" instead of "http://".
    
                    strSubURI = "http://" + strServer + "/exchange/" + strAlias +
                               "/##DavMailSubmissionURI##/";
                    // Build the temporary URI for the message. If SSL is set
                    // up on the server, use "https://" instead of "http://".
                    strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +
                                   strSubject + ".eml/";
    
                    // Construct the RFC 822 formatted body of the PUT request.
                    // Note: If the From: header is included here,
                    // the MOVE method request will return a
                    // 403 (Forbidden) status. The From address will
                    // be generated by the Exchange server.
                    strBody = "To: " + strTo + "\n" +
                             "Subject: " + strSubject + "\n" +
                             "Date: " + System.DateTime.Now +
                             "X-Mailer: test mailer" + "\n" +
                             "MIME-Version: 1.0" + "\n" +
                             "Content-Type: text/plain;" + "\n" +
                             "Charset = \"iso-8859-1\"" + "\n" +
                             "Content-Transfer-Encoding: 7bit" + "\n" +
                             "\n" + strText;
                    // Create a new CredentialCache object and fill it with the network
                    // credentials required to access the server.
                    MyCredentialCache = new System.Net.CredentialCache();
                    MyCredentialCache.Add(new System.Uri(strMailboxURI),
                    "Basic",
                    new System.Net.NetworkCredential(strAlias, strPassword, strDomain)
                    );
    
                    // Create the HttpWebRequest object.
                    PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);
                    // Add the network credentials to the request.
                    PUTRequest.Credentials = MyCredentialCache;
                    // Specify the PUT method.
                    PUTRequest.Method = "PUT";
                    // Encode the body using UTF-8.
                    bytes = Encoding.UTF8.GetBytes((string)strBody);
                    // Set the content header length. This must be
                    // done before writing data to the request stream.
                    PUTRequest.ContentLength = bytes.Length;
                    // Get a reference to the request stream.
                    PUTRequestStream = PUTRequest.GetRequestStream();
                    // Write the message body to the request stream.
                    PUTRequestStream.Write(bytes, 0, bytes.Length);
                    // Close the Stream object to release the connection
                    // for further use.
                    PUTRequestStream.Close();
                    // Set the Content-Type header to the RFC 822 message format.
                    PUTRequest.ContentType = "message/rfc822";
                    // PUT the message in the Drafts folder of the
                    // sender's mailbox.
                    PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();
                    // Create the HttpWebRequest object.
                    MOVERequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);
                    // Add the network credentials to the request.
                    MOVERequest.Credentials = MyCredentialCache;
                    // Specify the MOVE method.
                    MOVERequest.Method = "MOVE";
                    // Set the Destination header to the
                    // mail submission URI.
                    MOVERequest.Headers.Add("Destination", strSubURI);
                    // Send the message by moving it from the Drafts folder of the
                    // sender's mailbox to the mail submission URI.
                    MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();
                    Console.WriteLine("Message successfully sent.");
                    // Clean up.
                    PUTResponse.Close();
                    MOVEResponse.Close();
                }
                catch (Exception ex)
                {
                    // Catch any exceptions. Any error codes from the PUT
                    // or MOVE method requests on the server will be caught
                    // here, also.
                    Console.WriteLine(ex.Message);
                }
            }
    
     
  • arturito 9:45 am on May 14, 2010 Permalink | Reply  

    Microsoft SQL 2005 large ldf file size 

    If you happen to run out of disk space in your database server,  you might want to check how much your database log files occupy.In order to avoid it I normally set Recovery model to Simple, but when I forget to do so, on the creation of database by default Recovery Model is set to Full and log file (ldf) grows quickly and it can take huge amount of disk space.

    Solution:

    1. Set Recover Model to Simple

    Here is the overview of Recovery Models
    http://msdn.microsoft.com/en-us/library/ms189275.aspx

    2. Execute:

    USE my_db;
    BACKUP LOG my_db WITH TRUNCATE_ONLY
    DBCC SHRINKFILE('my_db_log',1)
    

    Note: I recommend reading about database shrinking and how it affects your database here:
    http://msdn.microsoft.com/en-us/library/aa258824(SQL.80).aspx

     
  • arturito 8:41 pm on March 26, 2010 Permalink | Reply  

    Binbows 

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel