GetYourFix()

A C# blog for the Junkies by the Junkie. .NET, C#, MS SQL, W2X and more.

About the Junkie

I am a Software and Network Engineer in Los Angeles working for a non-profit organization. I have been working on the .NET platform for the last couple of years.

I am a Mechanical Engineering graduate who defected due to a lack of interesting jobs in the field and my fascination for computers and programming. It has been a fun transition and satisfying I might add.It can be very frustrating when you hit a roadblock while programming, the blogs and other resources can be life savers during this time and have helped me immensely on many occasions. I have always wanted to have a blog to share the problems and their fixes. And I have finally taken the plunge.

I hope this blog helps.

.NET Junkie

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Cannot access properties, methods of winforms Form1

If you cannot access the properties or methods of the Form1 of the type System.Windows.Forms.Form , try this. to access the properties and methods. e.g, this.Text="Skynet Application"; this.Enabled=false;

Tags: ,

Categories: Programming

Sending bulk emails with C# and Windows 2003 POP3 Server: Part 3 of 3 – DNS, MX and SPF Records

to be completed….


Categories: Network | Programming

Sending bulk emails with C# and Windows 2003 POP3 Server: Part 2 of 3 - POP3 Server Setup

I had to find a mail server software I could use with my C# code. I found the following potential software after a quick search. 1. Exchange Server 2. hMail Server 3. MailEnable 4. SendMail 5. Windows POP3 Service (didn't have high hopes on this one, but you never know) Since I didn't have enough time to research this list more closely, please take my conclusion with a pound of salt! Based on my quick research I found that hmail and send mail didn't have an API I could use with C# and I think MailEnable had C# API available for paid versions (or it could be SendMail). When I started to install Exchange Server I quickly found out I will need an AD without which I would not be able install it. While installing Exchange server I decided to give Windows POP3 server a try and sent out an email to my personal email addresses using for example austinpowers@groovybaby.com (say www.groovybaby.com is my department's domain). I received the emails which I expected to work. Now the real tes... [More]


Categories: Network | Programming

Sending bulk emails with C# and Windows 2003 POP3 Server: Part 1 of 3 - C# Code

Problem: As stated in the previous article I had to write code to send bulk emails with a 6MB PDF attachments individually. The source of the email body was from a .htm template file which had references to images such as the company logo and others. This email should also have an alternate plain text format in case the recipient's email client accepted only plain text email. Solution: The code is pretty simple and straight forward. We will be using the following classes from .NET MailMessage, EmbeddedMailObject, MailDefinition, MailAttachment and SMTPClient. C# Code using System.IO; using System.Net; using System.Net.Mail; using System.Web.UI.WebControls; namespace Mail_CA01 { class Mail { // folder where this console application will reside public static string directory = @"C:\SendMail"; public static void SendMail() { try { // read all the email addresses stored in this text f... [More]


Categories: Network | Programming

Sending bulk emails with C# and Windows 2003 POP3 Server: Attachments, Images and HTML

At a short notice I had to use C# to send out bulk emails to a few thousand recipients. Of course short notice is not the problem of the problem. To keep things interesting I couldn't use our company's Exchange Server and the domain email address, which would have been straight forward. All I would have to do is write code to send emails through this server. But that was not going to happen. I had to use our department's domain name which is different from the company and there were no email servers setup nor were there any email addresses created for this domain. So the problem is four fold. 1. Write C# code to send individual html formatted emails with a plain text option, from a html template file with images in the email and a 6MB PDF attachment to boot. 2. Setup a server and find viable mail server software to create email addresses, send and receive emails for the domain in question. 3. Set up the DNS entries including the MX records and SPF record to avoid the emails being re... [More]


Categories: Network | Programming

BlogEngine.NET publishes wrong time for new posts

To correct this go to Settings –> Basic Settings. Change ‘Server time offset’ to the appropriate value.


Categories: General

Office Live and Sky Drive

Microsoft is offering free 5GB storage with Office Live and 25GB with Sky Drive. Of course you need a Windows Live ID or Hotmail. You can keep your files private, public or share them with people you choose. You can upload almost any type of file with few exceptions. The current upload capacity per file is 50MB. With Office Live Update, you can access your online documents directly from Office applications. Apparently they have been offering this for a while and I was totally unaware of this. I must have been living in a cave.

Tags:

Categories: General

MS SQL adds white space to nchar() columns

If you use nchar(n) for a column, say n=5 and the length of the string you enter for this column is 3. MS SQL adds whitespace to this string to make it 5 characters long. Be mindful of that, this can break a DropDownList when you try to assign this string as the SelectedValue and the dropdownlist is pre-populated manually or from a different source. I of course learnt this the hard way after spending considerable time.

Tags:

Categories: Programming

Inserting and Updating Enum values in Detailsview with Objectdatasource

I recently had to use the detailsview with my custom object ‘Subscriber’ which had a property ‘Subscription’ of type enum. I ran into a problem when inserting / updating this object. During this operation I received the error ‘Objectdatasource couldnt find a non-generic method….’ .I used the Objectdatasource to bind the  ‘Subscriber’ object to the Detailsview. When I did this, the Detailsview didn't not automatically generate the column for the enum property ‘Subcription’, but the ObjectDataSource’s parameters list had this enum listed, I had to manually add this property as a column. After spending sometime I found the solution, which I have presented below. Enum: public enum Subscription { Unsubscribed, New, Subscribed } Custom Object: [DataObject] public class Subscriber : BusinessObject { private int _subscriberID = 0; publ... [More]


Categories: Programming

Installing BlogEngine.NET on GoDaddy

I finally decided to have my own blog and chose Blogengine.net as my blog platform. It would be apt for my first blog to be about Blogengine.net. In this blog I will briefly outline the steps I took to install it on Godaddy hosting. Environment: Blog platform: BlogEngine.NET 1.5 Final (Download the  BlogEngine.NET 1.5 (web) version) DataProvider: MS SQL 2005 Hosting: GoDaddy Deluxe Account FTP Client: FileZilla – Its Free! Code Highlighter: SyntaxHighlighter 2.0 BE.NET Extension Windows Live Writer Extension   Installation:   BlogEngine.NET 1. Download and unzip the contents of BlogEngine.Web.zip. 2. Edit the robots.txt, remove the ‘#’ from the last line and replace the text ‘http://example.com/sitemap.axd ’ with your website, add ‘www.’ if you would like. In my case it is ‘http://www.dotnetjunkie.com/sitemap.axd’. 3. Go to your GoDaddy Hosting account and go to Content –> IIS Management. Maks... [More]