Build a WPF Interactive Animation Application
IntroductionThis article describes how to make a basic game – a window where bomb user controls drop from the top – to prompt the user to intercept them. To do this we are going to use Expression Blend 4, as anyone who has ever used this developer tool knows that the Design space is easily switched to an Animation space. WPF applications are sometimes easier to build using Expression Blend. Todd Miranda has a plethora of educational videos about how to use Expression Blend, found at expression.microsoft.com/en-us/cc197141.aspx . I am writing this article to show both the importance of C# in two code-behind files: one for the Main Window, and the other for the bomb, which is a UserControl, an added new item. If you are unfamiliar with how this application derives its output, do not be intimidated. Expression Blend 4 functions as a superior vector-based design tool used to gain a stronger hold on both of the Windows Presentation Foundation technology and Silverlight. Here is a look at the WPF application. Many beginners, me included, develop WPF applications to implement the powerful graphics, animations, and media facilities. This application serves as an amusing little game, or it can serve as a skeleton application for the reader to expand on. Read more: Codeproject
How to execute a TSQL statement for all databases
Posted by
jasper22
at
09:53
|
I wanted a quick way to execute a TSQL command against all databases. I was having hard time getting the sp_MSforeachdb to work and didn’t want to write a cursor, so I instead built a TSQL command which makes the commands I need to execute. Not fancy, but it got the job done. --Command to be exeuted on all databases
SELECT DATABASEPROPERTY( 'Northwind' ,'IsFulltextEnabled')
--undocumented command, but hard to get syntax correct with imbedded ' (quotes)
sp_MSforeachdb "SELECT DATABASEPROPERTY( ? ,'IsFulltextEnabled')"
--Use statement below to build the TSQL commands to be executed
--Set Output-to-Text before running.
select 'SELECT DATABASEPROPERTY( ' + char(39) + name + char(39) + ',' + char(39)
+ 'IsFulltextEnabled' + char(39) + ')'
from sysdatabasesRead more: REPLTalk covers Using and Tuning SQL Replication
SELECT DATABASEPROPERTY( 'Northwind' ,'IsFulltextEnabled')
--undocumented command, but hard to get syntax correct with imbedded ' (quotes)
sp_MSforeachdb "SELECT DATABASEPROPERTY( ? ,'IsFulltextEnabled')"
--Use statement below to build the TSQL commands to be executed
--Set Output-to-Text before running.
select 'SELECT DATABASEPROPERTY( ' + char(39) + name + char(39) + ',' + char(39)
+ 'IsFulltextEnabled' + char(39) + ')'
from sysdatabasesRead more: REPLTalk covers Using and Tuning SQL Replication
Системные переменные MySQL сервера.
Posted by
jasper22
at
09:52
|
auto_increment_increment
Устанавливает приращение для механизма AUTO_INCREMENT. Возможные значения: 1 - 65 535. Значение по умолчанию: 1. При установке значения 0,получает значение 1, при попытке присвоить значение меньше нуля или больше 65 535, принимает значение 65 535. Если например, присвоить данной переменной значение 10, то значения счетчика автоинкремента, будет увеличиваться не на 1, а на 10.Введена с версии 5.0.2. auto_increment_offset
Устанавливает начальное значение счетчика для механизма AUTO_INCREMENT. Возможные значения: 1 - 65 535. Значение по умолчанию: 1. При установке значения 0, получает значение 1, при попытке присвоить значение меньше нуля или больше 65 535, принимает значение 65 535. Если присвоить этой переменной значение 7, счетчик автоинкремента, начнет увеличиваться не с 1, а с 7. Введена с версии 5.0.2. back_log
Размер очереди запросов на подключение клиентов. При получении вхлдящего запроса на соединение, основной поток MySQL сервера, после проверки запроса, запускает новый поток. Если запросов на соединение пришло слишком много за короткий промежуток времени, на их обслуживание потребуется некоторое время. Данная переменная устанавливает количество запросов, которые могут быть помещены в стек, на время, пока не освободится основной поток для их обслуживания. Все соединения выше данного значения - отбрасываются, клиенту выдается соответствующее сообщение. По сути, данная переменная устанавливает длину очереди, входящих TCP соединений, и не может привышать значение, установленной операционной системой. basedir
Содержит путь к базовому каталогу установки. Может быть установлена с помощью параметра командной строки: --basedirRead more: BSDADMIN.RU
Устанавливает приращение для механизма AUTO_INCREMENT. Возможные значения: 1 - 65 535. Значение по умолчанию: 1. При установке значения 0,получает значение 1, при попытке присвоить значение меньше нуля или больше 65 535, принимает значение 65 535. Если например, присвоить данной переменной значение 10, то значения счетчика автоинкремента, будет увеличиваться не на 1, а на 10.Введена с версии 5.0.2. auto_increment_offset
Устанавливает начальное значение счетчика для механизма AUTO_INCREMENT. Возможные значения: 1 - 65 535. Значение по умолчанию: 1. При установке значения 0, получает значение 1, при попытке присвоить значение меньше нуля или больше 65 535, принимает значение 65 535. Если присвоить этой переменной значение 7, счетчик автоинкремента, начнет увеличиваться не с 1, а с 7. Введена с версии 5.0.2. back_log
Размер очереди запросов на подключение клиентов. При получении вхлдящего запроса на соединение, основной поток MySQL сервера, после проверки запроса, запускает новый поток. Если запросов на соединение пришло слишком много за короткий промежуток времени, на их обслуживание потребуется некоторое время. Данная переменная устанавливает количество запросов, которые могут быть помещены в стек, на время, пока не освободится основной поток для их обслуживания. Все соединения выше данного значения - отбрасываются, клиенту выдается соответствующее сообщение. По сути, данная переменная устанавливает длину очереди, входящих TCP соединений, и не может привышать значение, установленной операционной системой. basedir
Содержит путь к базовому каталогу установки. Может быть установлена с помощью параметра командной строки: --basedirRead more: BSDADMIN.RU
Xaps Minifier. Дополнение для Visual Studio 2010, позволяющее уменьшать размер Silverlight приложений
Posted by
jasper22
at
09:52
|
Я постоянно работаю с Silverlight приложениями и выкладываю релизы регулярно. Как правило, я использую паттерн MVVM и его реализацию Prism. В результате создаётся несколько XAP файлов, содержащих сборки приложения и манифест. Каждый, кто работает в соответствии с таким подходом, замечает, что большинство XAP файлов содержат дублирующиеся сборки. Например, при использовании библиотеки Prism, практически каждый XAP файл будет содержать все сборки из этой библиотеки. Prism добавляет порядка 300 Кб к каждому XAP файлу, что может увеличить размер приложения более чем на 1 Мб (при наличии 4-5 XAP файлов). Кроме того, дополнительные библиотеки (в первую очередь UI элементов) могут ещё более увеличить размер приложения. Все эти факты заставили меня начать поиск пути уменьшения размеров XAP файлов.ИдеяЯ работал над одной проблемой, когда наткнулся на заметку в блоге Jeff Prosise. Он упоминал, что сборка может быть добавлена в приложение, но не в XAP файл. Для этого достаточно установить параметр CopyLocal=false для каждой требуемой сборки, которая находится в списке References. В этом случае проект будет ссылаться на нужную сборку, но не будет добавлять её в папку bin при компиляции. Это натолкнуло меня на мысль, что всем дублирующимся сборкам в приложении можно проставить CopyLocal=false не изменяя только параметры сборок главного XAP файла. Именно главный XAP файл должен содержать все дублирующиеся сборки, которые будут автоматически загружаться в Application Domain, и будут доступны для всех сборок из остальных XAP файлов. Read more: Habrahabr.ru
NET Hidden Gems - Memory fail points
Posted by
jasper22
at
09:42
|
I am embarking in a series of mini post called .NET hidden gems, not necessarily new bits but usually unknown. They are dedicated to those small features and components that are not commonly used but can deliver interesting value in certain scenarios.
Today I am going to show you some functions that can help you to understand the memory state of your application when you need to store large objects.
The first hidden gem is the MemoryFailPoint object, this can be accessed through the System.Runtime namespace.
The main function of it is validating that there is enough memory to perform an operation.[SecurityCritical]
public MemoryFailPoint(int sizeInMegabytes);
It is very easy to use it, just create an instance when you need the memory:
//
// Do I have enough memory to run this method?
//
System.Runtime.MemoryFailPoint CheckForMemory = new System.Runtime.MemoryFailPoint(1000);Internally, it checks the global memory status of the process; if it does not have enough it will perform a full collection. Read more: MSDN Utopia
Today I am going to show you some functions that can help you to understand the memory state of your application when you need to store large objects.
The first hidden gem is the MemoryFailPoint object, this can be accessed through the System.Runtime namespace.
The main function of it is validating that there is enough memory to perform an operation.[SecurityCritical]
public MemoryFailPoint(int sizeInMegabytes);
It is very easy to use it, just create an instance when you need the memory:
//
// Do I have enough memory to run this method?
//
System.Runtime.MemoryFailPoint CheckForMemory = new System.Runtime.MemoryFailPoint(1000);Internally, it checks the global memory status of the process; if it does not have enough it will perform a full collection. Read more: MSDN Utopia
Community Goodies: Silverlight for PC
Posted by
jasper22
at
09:41
|
Tools and Enviroment
Read more: Community Goodies
Enviroment
Visual Studio 2008Visual Studio 2008 SP1Visual Studio 2010Expression Studio 3Expression Blend 4 RC
Tools
Silverlight ToolkitSilverlight3 Tools for Visual Studio 2008 SP1Silverlight4 Tools RC2 for Visual Studio 2010WCF RIA RC2WCF RIA Services ToolkitWCF RIA Hotfix(For WCF RIA Beta)
Features
Application and Programming ModelsManaged API for SilverlightDynamic Languages in SilverlightCommunication Between Local Silverlight-Based ApplicationsOut-of-Browser SupportAlternative HostingLayout, Text, and InputControlsGraphics, Animation, and MediaXAMLIntegrating Silverlight with a Web PageTypes, Properties, Methods, and EventsData Access and Data StructuresNetworking and CommunicationDebugging, Error Handling, and ExceptionsDeployment and LocalizationPerformanceSecurity
Read more: Community Goodies
Debugging an OOB Silverlight Business Application
Posted by
jasper22
at
09:39
|
Recently, we came across a bug with the Silverlight Business Application with respect to an Out of Browser application. In the RTM bits for Silverlight 4 Tools a new feature was added to enable a better debugging experience with Out of Browser application. The feature basically launched the app in OOB window when run with the debugger attached. If you have tried that with the business application template, you will notice that the app does not run. It crashes with an exception, that the URI path is not valid. We realize this is an issue most folks are running into and we have fixed this template and we are looking ways to get you access to it. However, there is a relatively easy workaround to fix this issue.The steps involved are :- Create a new or open up an existing application that was created using the BusinessApplicationTemplate
Once the project is open, go to the Project Properties page for the Silverlight Application.
In that, first uncheck the OOB option which is enabled by default
Save the project
Close the Project Property Page
Open the Project Property page again
Then go ahead and check the OOB option.Read more: @deepeshm
Once the project is open, go to the Project Properties page for the Silverlight Application.
In that, first uncheck the OOB option which is enabled by default
Save the project
Close the Project Property Page
Open the Project Property page again
Then go ahead and check the OOB option.Read more: @deepeshm
Ubuntu Kung-Fu – 10 Best Tricks (and some even work on Macs)
Posted by
jasper22
at
09:39
|
If your vision of a great vacation is laying down with a laptop on your belly, banging away on new bash commands and scripts, then this is the book for you.Now here are my favorite 10 tips.1. Command History Search with Ctrl+R – In a terminal, the up and down arrow shuffles through recent commands on almost any operating system. I had been using grep to search my history (history | grep something) until I found out about Ctrl+R. When you type Ctrl+R, the terminal goes into a matching mode where it tries to guess the entry from your history based on what you type. So type the first few letters of a recent command and the entire thing comes up. This is great, and I use it regularly to expand out “git pu” into a full “git pull origin master”. But don’t get the wrong idea! I still think git is awful. 2. Running jobs with & and nohup – I discovered & long ago. If you run a program from the command line then the terminal is frozen until the program completes. But if you append & (for instance, “gedit &”) then it launches as a job and you can use the terminal again while your program runs simultaneously. The problem is if you close the terminal then your other program closes as well. Instead use nohup (”nohup gedit”) so that your program does not hang up when the terminal closes. 3. Use Trash for Command Line File Deletes – There are a bunch of safe alternatives to deleting files using “rm -rf”, and this type lists yet another one. However, I prefer to use the “trash” package. Just run:
sudo apt-get install trash Read more: canoo
sudo apt-get install trash Read more: canoo
Knights, Knaves, Protected and Internal
Posted by
jasper22
at
09:37
|
When you override a virtual method in C# you are required to ensure that the stated accessibility of the overridden method - that is, whether it is public, internal, protected or protected internal(*) – is exactly re-stated in the overriding method. Except in one case. I refer you to section 10.6.4 of the specification, which states: an override declaration cannot change the accessibility of the virtual method. However, if the overridden base method is protected internal and it is declared in a different assembly than the assembly containing the override method then the override method’s declared accessibility must be protected. What the heck is up with that? Surely if an overridden method is protected internal then it only makes sense that the overriding method should be exactly the same: protected internal.I’ll explain why we have this rule, but first, a brief digression. A certain island is inhabited by only knights and knaves. Knights make only true statements and only answer questions truthfully; knaves make only false statements and only answer questions untruthfully. If you walk up to an inhabitant of the (aptly-named) Island of Knights and Knaves you can rapidly ascertain whether a particular individual is a knight or a knave by asking a question you know the answer to. For example “does two plus two equal four?” A knight will answer “yes” (**), and a knave will answer “no”. Knaves are prone to saying things like “my mother is a male knight”, which is plainly false. It might seem at first glance that there is no statement which could be made by both a knight and a knave. Since knights tell the truth and knaves lie, they cannot both make the same statement, right? But in fact there are many statements that can be made by both. Can you think of one? Read more: Fabulous Adventures In Coding
Fresh Mono Baked
Posted by
jasper22
at
09:27
|
Andrew just announced Mono 2.6.7, the version that is replacing our long-term maintenance release of Mono with plenty of bug fixes as well as the following new features:Microsoft's ASP.NET MVC2 is now bundled with Mono.
Upgraded xbuild tool (Mono's msbuild)
Upgraded our LINQ to SQL (DbLinq)
Upgraded our Soft Debugger
We now publish CentOS/RHEL packages.Our CentOS/RHEL packages install on /opt/novell/mono, just like our packages for SUSE Linux Enterprise and should not conflict with your own packages of Mono that you might have from some other sources. Read more: Miguel de Icaza's web log
Upgraded xbuild tool (Mono's msbuild)
Upgraded our LINQ to SQL (DbLinq)
Upgraded our Soft Debugger
We now publish CentOS/RHEL packages.Our CentOS/RHEL packages install on /opt/novell/mono, just like our packages for SUSE Linux Enterprise and should not conflict with your own packages of Mono that you might have from some other sources. Read more: Miguel de Icaza's web log
Import Data from Excel to DataGridView in C#
Posted by
jasper22
at
09:27
|
First need to add the reference "Microsoft ADO Ext. 2.8". You can easily add it from COM components.Add an open Dialog box control on form Put the following code on Browser button click events….. private void button1_Click_1(object sender, EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "Select file";
fdlg.InitialDirectory = @"c:\";
fdlg.FileName = txtFileName.Text;
fdlg.Filter = "Excel Sheet(*.xls)|*.xls|All Files(*.*)|*.*";
fdlg.FilterIndex = 1;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txtFileName.Text = fdlg.FileName;
Import();
Application.DoEvents();
}
}This will filter only Excel file from your Machine. This Excel file can contains more than one Sheet. You need to add another form to all excel sheets name so that user can select any one excel sheet which he want to import.Write the following code on Page Load even of this form private void Select_Tables_Load(object sender, EventArgs e)
{
if (!DataTables)
{
if (Tables != null)
{
for (int tables = 0; tables < Tables.Length; tables++)
{
try
{
ListViewItem lv = new ListViewItem();
lv.Text = Tables[tables].ToString();
lv.Tag = tables;
lstViewTables.Items.Add(lv);
}
catch (Exception ex)
{ }
}
}
}
elseRead more: C# Corner
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "Select file";
fdlg.InitialDirectory = @"c:\";
fdlg.FileName = txtFileName.Text;
fdlg.Filter = "Excel Sheet(*.xls)|*.xls|All Files(*.*)|*.*";
fdlg.FilterIndex = 1;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txtFileName.Text = fdlg.FileName;
Import();
Application.DoEvents();
}
}This will filter only Excel file from your Machine. This Excel file can contains more than one Sheet. You need to add another form to all excel sheets name so that user can select any one excel sheet which he want to import.Write the following code on Page Load even of this form private void Select_Tables_Load(object sender, EventArgs e)
{
if (!DataTables)
{
if (Tables != null)
{
for (int tables = 0; tables < Tables.Length; tables++)
{
try
{
ListViewItem lv = new ListViewItem();
lv.Text = Tables[tables].ToString();
lv.Tag = tables;
lstViewTables.Items.Add(lv);
}
catch (Exception ex)
{ }
}
}
}
elseRead more: C# Corner
Mono's Git Migration
Posted by
jasper22
at
09:26
|
Mono's source code is being migrated to GitHub on July 22nd, starting at 9am Boston time.We are psyched that Github was kind enough to host Mono's large repositories for free on their system. We are also taking advantage of their new Organizations functionality. Gonzalo posted the following details about the migration:We are moving our source code repository to GitHub.On July 22nd ~9am EDT (1300 GMT) the subversion repository at "svn+ssh://mono-cvs.ximian.com/source" will be set to read-only mode and kept that way forever. We estimate that the process of migrating all the projects and moving them to GitHub will take more than 3 and less than 8 hours. Once it is completed we will send an email to this list with URLs to the new repositories, FAQs,... Read more: Miguel de Icaza's web log
How to be a Cool C# Programmer
Posted by
jasper22
at
09:26
|
There are many C# programmers out there… but you probably want to be the coolest… it’s not enough to just call a bunch of methods, invoke some delegates, etc. You need to write it cool.Here are some ways you can make yourself a cool C# programmer (and pick up geeky chicks at your local C# party): 1. Use anonymous delegates whenever possible (or lambda expressions, see 2):var nums = new List<int>();
//...
var nums2 = nums.FindAll(delegate(int n) {
return n % 2 == 0;
}); 2. Use lambda expressions when delegates are required (this is super-cool): button1.Click += (s, e) => {
MessageBox.Show("This is super-cool!");
};
3. If you’re using a lambda expression that accepts one argument and you don’t need it, provide its name as underscore: ThreadPool.QueueUserWorkItem((_) => {
Console.WriteLine("This is way too cool!");
}); 4. When raising events, the event should be checked to be non-null, but the cool thing to do is always register an empty handler so the check is unnecessary: class Printer {
public event EventHandler PagePrinted = delegate { };
//...
protected virtual void OnPagePrinted() {
PagePrinted(this, EventArgs.Empty); // look ma, no check!
}
} 5. Use LINQ whenever possible, using complex operators if you can:var procs = from p in Process.GetProcesses()
where p.Threads.Count > 15
orderby p.ProcessName
group new {
Name = p.ProcessName,
Id = p.Id,
Threads = p.Threads.Count
} by p.BasePriority into g
orderby g.Key descending
select g; foreach(var g in procs) {
Console.WriteLine("Priority {0}", g.Key);
foreach(var p in g)
Console.WriteLine(" {0}", p);
}Read more: Pavel's Blog
//...
var nums2 = nums.FindAll(delegate(int n) {
return n % 2 == 0;
}); 2. Use lambda expressions when delegates are required (this is super-cool): button1.Click += (s, e) => {
MessageBox.Show("This is super-cool!");
};
3. If you’re using a lambda expression that accepts one argument and you don’t need it, provide its name as underscore: ThreadPool.QueueUserWorkItem((_) => {
Console.WriteLine("This is way too cool!");
}); 4. When raising events, the event should be checked to be non-null, but the cool thing to do is always register an empty handler so the check is unnecessary: class Printer {
public event EventHandler PagePrinted = delegate { };
//...
protected virtual void OnPagePrinted() {
PagePrinted(this, EventArgs.Empty); // look ma, no check!
}
} 5. Use LINQ whenever possible, using complex operators if you can:var procs = from p in Process.GetProcesses()
where p.Threads.Count > 15
orderby p.ProcessName
group new {
Name = p.ProcessName,
Id = p.Id,
Threads = p.Threads.Count
} by p.BasePriority into g
orderby g.Key descending
select g; foreach(var g in procs) {
Console.WriteLine("Priority {0}", g.Key);
foreach(var p in g)
Console.WriteLine(" {0}", p);
}Read more: Pavel's Blog
Dokan.Mem, a filesystem prototype
Posted by
jasper22
at
09:23
|
IntroductionHiroki Asakawa created a device driver that enables an application in user-mode to simulate a file-system, and distributed it under a MIT-style license. This post shows how that's used in C# to create the functionality of a RAM-Disk, with some tips on rolling your own file-system application. Before you can run the code, you have to run the installer to install a proxy driver (dokan.sys). This driver then acts as an intermediate between the kernel and our custom .NET solution. The installer for the proxy driver is also included with the sourcecode here, but I'd recommend downloading the package from the original website as they contain two cool examples; The first implements a mirror of your C-drive, and the second makes the Registry available as a readonly drive. This article briefly explains how the Dokan-libraries are used to build something that resembles a RAM-disk in functionality Having the option to expose data as a file-system has several advantages. It makes your data instantaneous available for other applications, without the need for a complicated UI.Download the basic installer and .NET bindings to Dokan here[^]. Using the codeLog in as administrator, run the installer (it's just 513 Kb), open the project and hit F5; a trayicon should appear, and on doubleclick it should open the Windows-Explorer, pointing to a simulated harddisk. It'll mount on the first available free drive-letter. Paste a zipfile on there and extract it :) I choose to implement a basic RAM-Disk to test the library (version 0.5.3), with the results documented here.There's three projects in the solution;DokanNet - these are the .NET bindings to the Dokan libraries
Buffers - used to replace the MemoryStream
Dokan.Mem - example-implementation of the Dokan-interface, simulating a RAM-DiskRead more: Codeproject
Buffers - used to replace the MemoryStream
Dokan.Mem - example-implementation of the Dokan-interface, simulating a RAM-DiskRead more: Codeproject
Install LAMP with just one command line on Debian/Ubuntu
Posted by
jasper22
at
09:23
|
I'm so tired of install Apache with MySQL and PHP. I always have to make lots of "apt-get"s tto get all the packages installed just because I don't remember all of them at the first "apt-get". Here is the line to install all you (probably) need:apt-get install mysql-client mysql-common mysql-server mysql-server php5-mysql php-apc php-db php-pear php5 php5-cli php5-common php5-curl php5-gd php5-imagick php5-mcrypt php5-memcache php5-memcache php5-mysql php5-sqlite php5-suhosin apache2 apache2-doc apache2-mpm-prefork apache2-suexec apache2-utils apache2.2-common libapache2-mod-php5 Now we have to do some fine tunning. I know... it brokes the "Just One Command" that I was promising, but it's for a good cause :)Read more: diogomelo.net
Deploying Microsoft RemoteFX for Virtual Desktop Pools Step-by-Step Guide
Posted by
jasper22
at
09:22
|
This step-by-step guide walks you through the process of setting up a working virtual desktop pool that uses RemoteFX in a test environment. Upon completion of this step-by-step guide, you will have a virtual desktop pool with RemoteFX that users can connect to by using RD Web Access. Read more: MS Download
BUG: .NET 4.0 (System.Net.Mail) Unable to send emails with large attachments (more than 3MB)
Posted by
jasper22
at
09:21
|
This is probably the first bug reported by customer so far for System.Net.Mail Class in .NET 4.0 Framework, or at least the first one I worked on. This was pretty straight forward repro and I did not had to do much to reproduce the issue locally. static void Main(string[] args) { SmtpClient client = new SmtpClient("contoso_smtp_server");
client.Credentials = new System.Net.NetworkCredential("User1", "Password", "contoso");
MailMessage msg = new MailMessage("user1@contoso.com", "user2@contoso.com", "Large Attachment Mail", "Large Attachment - Test Body"); Attachment attachment = new Attachment(@"d:\3mb.dat");
msg.Attachments.Add(attachment); client.Send(msg);
}
That was the simplest code you could possibly write to send out email using SNM but the problem is it Fail with an “Error in sending email” message. So I looked around what was happening and found that the problem was not directly related to SNM but its underlying classes and specifically the Base64Encoding class which was used as default method of encoding emails attachments while sending. That saved me more troubleshooting and I changed the way the attachments were being encoded from Base64 to 7Bit and it worked like charm.So all you need to do is add any of the following line to your code to make it work. // Any "one" of those two code section will work
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit; Read more: Jive into Messaging world
client.Credentials = new System.Net.NetworkCredential("User1", "Password", "contoso");
MailMessage msg = new MailMessage("user1@contoso.com", "user2@contoso.com", "Large Attachment Mail", "Large Attachment - Test Body"); Attachment attachment = new Attachment(@"d:\3mb.dat");
msg.Attachments.Add(attachment); client.Send(msg);
}
That was the simplest code you could possibly write to send out email using SNM but the problem is it Fail with an “Error in sending email” message. So I looked around what was happening and found that the problem was not directly related to SNM but its underlying classes and specifically the Base64Encoding class which was used as default method of encoding emails attachments while sending. That saved me more troubleshooting and I changed the way the attachments were being encoded from Base64 to 7Bit and it worked like charm.So all you need to do is add any of the following line to your code to make it work. // Any "one" of those two code section will work
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit; Read more: Jive into Messaging world
Back in business
Posted by
jasper22
at
09:18
|
I've been off for some time but now I'm back in business. A lot of material will be uploaded in this and next week.
HTTP-TunnelClien
HTTP-TunnelClient™allows you to access your Internet programs with not be monitored at work, school, or the goverment and gives you a extra layer of protection against hackers, spyware, ID theft's with our encryption. Bypass any firewall also that gives you access and security of the web in one program. Surf, IM, P2P, Game, etc. FeaturesIf you answer yes to any of these, HTTP-Tunnel is the answer:
Read more: HTTP-TunnelClien
- Need to use your favorite program monitor free
- Need secure internet browsing
- Bypass Firewall without causing any security risk
- Need to use favorite programs, (browsing, IM, Game, P2P ) which are currently not access with out being monitored by work, school, ISP or gov.
- Extra security for online transactions
- Use your favorite applications that are now blocked
- Hide your IP address
- Encrypt all your Internet traffic.
- Make it impossible to be identify online.
- Need play online games
- Visit sites that are now blocked to you.
- Free unlimited data transfer
- 128-bit Encryption. Secure all your browsing just like you are viewing your bank website
- Uses HTTP and/or Socks protocols. TCP
Read more: HTTP-TunnelClien
Sagan
Posted by
jasper22
at
08:19
|
Sagan is a multi-threaded, real time system and event log monitoring system, but with a twist. Sagan uses a "Snort" like rule set for detecting bad things happening on your network and/or computer systems. If Sagan detects a "bad thing" happening, that event can be stored to a Snort database (MySQL/PostgreSQL) and Sagan will attempt to correlate the event with your Snort Intrusion Detection/Intrusion Prevention (IDS/IPS) system.
Read more: Sagan
- Sagan is fast - Sagan is written in C and is a multi-threaded application. Sagan is threaded to prevent blocking Input/Output (I/O). For example, data processing doesn't stop when an SQL query is needed.
- Sagan uses a "Snort" like rule set - If you're a user of "Snort" and understand Snort rule sets, then you already understand Sagan rule sets. Essentially, Sagan is compatible with Snort rule management utilities. For example, "oinkmaster" and "pulledpork".
- Sagan can log to Snort databases - Sagan will operate as a separate "sensor" ID to a Snort database. This means, your IDS/IPS events from Snort will remain separate from your Sagan (syslog/event log). Since Sagan can utilize Snort databases, using Snort front-ends like BASE and Snorby will not only work with your IDS/IPS event, but also with your syslog/events as well!
- Sagan output formats - You don't have to be a Snort user to use Sagan. Sagan supports multiple output formats, such as a standard output file log format (similar to Snort), e-mailing of alerts (via libesmtp), Logzilla support and external based programs that you can develop using the language you prefer (Perl/Python/C/etc).
- Sagan is actively developed - Softwink, Inc. actively develops and maintains the Sagan source code and rule sets. Softwink, Inc. uses Sagan to monitor security related log events on a 24/7 basis.
Read more: Sagan
Subscribe to:
Posts (Atom)