Rss Feed Like Us on facebook Google Plus

September 11, 2013

Upload files to FTP server using C#

Upload any type of files (text,zip,images etc.) to FTP using C#


In order to upload a file using FTP details, one should know the server’s FTP URL, FTP username and FTP password.

We can achieve the file uploading task by using the below three inbuilt classes of .NET: FtpWebRequest,WebRequestMethods, and NetworkCredential.

Here is a sample code to upload TEXT file.

using System;
using System.IO;
using System.Net;
using System.Text;
 
namespace Examples.System.Net
{
    public class WebRequestGetExample
    {
        public static void Main ()
        {
            // Get the object used to communicate with the server.
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
            request.Method = WebRequestMethods.Ftp.UploadFile;
 
            // This example assumes the FTP site uses anonymous logon.
            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");
            
            // Copy the contents of the file to the request stream.
            StreamReader sourceStream = new StreamReader("testfile.txt");
            byte [] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
            sourceStream.Close();
            request.ContentLength = fileContents.Length;
 
            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();
 
            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
    
            Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
    
            response.Close();
            }
        }
    }
}

>> As we know streamreader used only to read text files / binary files. here is sample code to upload all type of files.

private static void up(string sourceFile, string targetFile)
{            
    try
    {
        string ftpServerIP = ConfigurationManager.AppSettings["ftpIP"];
        string ftpUserID = ConfigurationManager.AppSettings["ftpUser"];
        string ftpPassword = ConfigurationManager.AppSettings["ftpPass"];
        ////string ftpURI = "";
        string filename = "ftp://" + ftpServerIP + "//" + targetFile; 
        FtpWebRequest ftpReq = (FtpWebRequest)WebRequest.Create(filename);
        ftpReq.UseBinary = true;
        ftpReq.Method = WebRequestMethods.Ftp.UploadFile;
        ftpReq.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
 
        byte[] b = File.ReadAllBytes(sourceFile);
 
        ftpReq.ContentLength = b.Length;
        using (Stream s = ftpReq.GetRequestStream())
        {
            s.Write(b, 0, b.Length);
        }
 
        FtpWebResponse ftpResp = (FtpWebResponse)ftpReq.GetResponse();
 
        if (ftpResp != null)
        {
            MessageBox.Show(ftpResp.StatusDescription);
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
    }
}



Read More

September 5, 2013

Unable to load SQL Server OLEDB Provider Resource DLL

Problem :  While accessing any window application follwing error may occur: SQL
Server OLEDB provider support error Unable to load SQL Server OLEDB provider resource DLL. The application cannot continue.

Solution:

  1. Following the steps below may help to resolve the issue.
  2. Open My Computer 
  3. Double Click C (Local Disk) 
  4. Double Click Program Files 
  5. Double Click Common Files 
  6. Double Click System
  7. Double Click OLE DB 
  8. Check that the following files are listed: SQLOLEDB.RLL andSQLOLEDB.DLL
  9. If the files are not listed they will need to be copied from another machine



Read More

September 4, 2013

MxBox v3.5 Revision 2.6 Latest Setup Free Download

MxBox v3.5 revision 2.6, Public-Release


TIP >> After downloaded,just rename that .zzz file to .zip 

Features
  1. NOKIA module updated to version 2.6
  2. added: WP8 support 
  3. Refurbish Flashing support by USB
  4. Recovery(Dead) Flashing support by USB
  5. added: Service Utility for WP8
  6. Factory Reset without flashing



  • Read/Write Producttion Data(Product Code,PSN,HW version, etc ..) )*
  • Read/Write WP8 NV items )*
  • Read/Write WP8 CERTIFICATE(NPC,CCC,HWC,RDC) )
  • Write CoverColor )*
  • added: SuperDongle Auth for WP8 phones
  • SuperDongle Auth is required to write important/secure data
  • bugfixed: RAPUV2 security repair function
  • revised internal fire module to enable download firmware package by product code

Read More

Gpg Dragon V3.28 Free Download


Gpg Dragon V3.28 Latest Release

Download Now


Key Features:

M-Star in the Read code add the Clear_code function
if you tick this,software will click the password form your read flash and make new flash file with out the password then you can write this new file to mobile.
  • it will not loose any user data
  • if you select read password and un-tick the clear_code
  • software only read password form flash file only
  • Fix the MTK 6575 after download DSP_BL return data error bugs

Check out OLD Versions..
GPG Dragon Box v3.25
GPG Dragon Box v3.26 

Download Also
GPG Dragon Box v3.3
Read More

Semantics : HTML5 Features

Semantics is one of the most distinctive features of the Web Platform versus other application platforms. Developers usually ignore or de-prioritize such feature but the mastery of it can bring many benefits to our projects.

The Web is text and text has a meaning. Ultimately the content that our browsers read is pure text. Web sites and web applications have been created in an ecosystem where text based content is linkable, searchable and mashable. In the open web scenario our content can be shown, fed and remixed by third parties, search engines and accessibility tools. All these benefits don't come for free. 

Automated tools can only do half of the job at recognizing the nature of the content. The better job the developer does at marking the right semantics of the content the easier will be for the rest of the agents to deal with it. HTML5 provides a series of tools to make developers life easier too:
  • New media elements.
  • New structural elements.
  • New semantics for internationalization.
  • New link relation types.
  • New attributes.
  • New form types.
  • New microdata syntax for additional semantics.

New Semantic Elements in HTML5

Many of existing web sites today contains HTML code like this: <div id="nav">, <div class="header">, or <div id="footer">, to indicate navigation links, header, and footer.

HTML5 offers new semantic elements to clearly define different parts of a web page:
  • <header>
  • <nav>
  • <section>
  • <article>
  • <aside>
  • <figcaption>
  • <figure>
  • <footer>



HTML5 <section> Element

The <section> element defines a section in a document.
According to W3C,  "A section is a thematic grouping of content, typically with a heading."

Example:
<section>
  <h1>TECH IMPULSION</h1>
  <p>"A Comprehensive technology blog with great articles."</p>
</section>


HTML5 <article> Element

The <article> element specifies independent, self-contained content.

"An article should make sense on its own and it should be possible to distribute it independently from the rest of the web site."

Examples of where an <article> element can be used:

  •     Forum post
  •     Blog post
  •     News story
  •     Comment

Example:
<article>
  <h1>Microsoft Launches Internet Explorer 10</h1>
  <p>Windows Internet Explorer 10 (abbreviated as IE10) was released to
  the  public by Microsoft.....</p>
</article>

HTML5 <nav> Element

The <nav> element defines a set of navigation links.

"The <nav> element is intended for large blocks of navigation links. However, not all links in a document should be inside a <nav> element!"


Example:
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>

HTML5 <aside> Element

"The <aside> element defines some content aside from the content it is placed in (like a sidebar)."

The aside content should be related to the surrounding content.


Example:
<p>My family and I visited The Epcot center this summer.</p>
 
<aside>
  <h4>Epcot Center</h4>
  <p>The Epcot Center is a theme park in Disney World, Florida.</p>
</aside>

HTML5 <header> Element

The <header> element specifies a header for a document or section.

"The <header> element should be used as a container for introductory content."

You can have several <header> elements in one document.

The following example defines a header for an article:

Example:
<article>
  <header>
    <h1>Internet Explorer 9</h1>
    <p><time pubdate datetime="2011-03-15"></time></p>
  </header>
  <p>Windows Internet Explorer 9 (abbreviated as IE9) was released to
  the  public on March 14, 2011 at 21:00 PDT.....</p>
</article>

HTML5 <footer> Element

The <footer> element specifies a footer for a document or section.

A <footer> element should contain information about its containing element.

"A footer typically contains the author of the document, copyright information, links to terms of use, contact information, etc."

You can have several <footer> elements in one document.

Example:
<footer>
  <p>Posted by: Azziet Singh</p>
  <p><time pubdate datetime="2012-03-01"></time></p>
</footer>

HTML5 <figure> and <figcaption> Elements

"The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc."

While the content of the <figure> element is related to the main flow, its position is independent of the main flow, and if removed it should not affect the flow of the document.

The <figcaption> tag defines a caption for a <figure> element.

The <figcaption> element can be placed as the first or last child of the <figure> element.

Example:
<figure>
  <img src="img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
  <figcaption>Fig1. - The Pulpit Pock, Norway.</figcaption>
</figure>



Read More

September 3, 2013

Volcano Box Setup 2.1.9








Volcano Box v2.2.9 Update Setup Download

Download Now

How to Read MTK Android Full Flash in Factory Tool Format.
You have to perform as you read from here for Success !

1- Phone must be Rooted & Usb Debug On & Working Condition & Memory Card must be Inserted ( more than 2 Gb & 32 bit Formatted )
2- Plug phone with usb
3- Download VolcanoBox 2.2.9 & Extract it & Open it
4- Select MTK tab
5- Select One-Key Root
6- Select Back Flash
7- Select Folder to Save Flash file Backup in FACTORY Format
8- Do wait... Software will tell you Completed
It's ready now for Factory Tool Flasher to Flash your phone

  • Search & Download Latest Smart Phone Flash Tool ( MTK Original Flash tool )
  • Select Scatter File
  • Click on download


Wait for flashing and Your will be Done !

Read More

HTML5 Introduction

HTML5 is the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML). In this version, new features are introduced to help Web application authors, new elements are introduced based on research into prevailing authoring practices, and special attention has been given to defining clear conformance criteria for user agents in an effort to improve interoperability.
                                                                                                            W3.org

HTML5 is the ubiquitous platform for the web. Whether you're a mobile web developer, an enterprise with specific business needs, or a serious game dev looking to explore the web as a new platform, HTML5 has something for you! Choose your path: 
                                                                                                          HTML5 Rocks


HTML5 - New Features

Some of the most interesting new features in HTML5:
    HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Multimedia, Semantics, and Offline & Storage
  • The <canvas> element for 2D drawing
  • The <video> and <audio> elements for media playback
  • Support for local storage
  • New content-specific elements, like <article>, <footer>, <header>, <nav>, <section>
  • New form controls, like calendar, date, time, email, url, search

Browser Support for HTML5

Mozilla Firefox, Google Chrome, Opera , Safari , IE 9+




Read More

August 30, 2013

Download Lemon B229 Flash File

Lemon B229 Flash File 16MB

Download

Detection initiated...
Vcc: null
Gnd: 2 4
Analyzing D+ and D-...
D+ = 6, D- = 8
Analyzing USB device, please wait...
Find USB device:SCI USB2Serial (COM5), (VID_1782&PID_4D00)





Read More

August 29, 2013

Error 0x80070522: A required privilege is not held by the client.

This Problem occurs when you copy files to c drive or any other drive. the error message comes and you are not able to copy files.

or any window software not able to generate files in C drive...
This issue might occur permissions are not set properly for the C Drive.
Make sure that you are logged in as Administrator.

To take ownership of C Drive, follow these steps:
  • Right-click the C Drive and then click Properties.
  •  Click the Security tab.
  • Click Advanced, and then click the Owner tab.
  • In the Name list, click your user name, or click Administrator if you are logged in as Administrator, or click the Administrators group.
  • Click on Edit and then put a check mark against "Replace all existing inheritable permissions on all descendants with inheritable permissions from this object".
  • Click OK, and then click Yes when you receive the following message:
  • This will replace explicitly defined permissions on all descendants of this object with inheritable permissions from C-Drive (C:).
  • Do you wish to continue?
  • Once the permissions are replaced, click on OK.
  • Check if you are able to copy, paste or delete any documents now.

OR you can try the steps below

If the above steps fail then you may also want to disable UAC and check if that helps.
  • Click Start, type msconfig in the start search box, and then press Enter.
  • If you are prompted for an administrator password or for a confirmation, type the password, or click Continue.
  • Click the Tools tab.
  • Click Disable UAC and then click Launch.
  • A command window appears, and shortly thereafter, a notification bubble appears informing you that UAC is disabled.
  • Click OK and restart your computer to apply the change.
OR you can try this (it will definitely solve your problem)
  • Reboot into Safe Mode.
  • Log on as Administrator.
  • Click Start
  • Type the three letters cmd
  • Press Ctrl+Shift+Enter
  • Run the process as Administrator.
  • Type the following commands and press Enter after each:

    takeown /f c:\ /a /r /d y
    cacls c:\  /t /c /g administrators:F  System:F  everyone:F
    (Answer "yes" when prompted "Are you sure?")


The commands will make you the owner of drive C: and will give full access to everyone to all of its folders.

Read More

JQuery ColorBox : Do Postback for inline HTML

While using JQuery Color Box with inline content , postback of submit button is not working...



CAUSE:
Color Box script generates an iframe for your target Page/Html.In case of inline content/html ColorBox generates an iframe outside the  <form> tag. As we all know to do postback we need  <form> tag. So in generated iframe HTML there is no  <form> tag available.

SOLUTION:
very simple hack , we have to just append the generated iframe html to <form> tag. checkout the below script.

SCRIPT

<script type="text/javascript">
        function cbox() {
            $.colorbox({ inline: true, width: "50%", href: "#inline_content", onOpen: AllowPostback });
        }
        function AllowPostback() {
            $("div#cboxOverlay").appendTo("form:first");
            $("div#colorbox").appendTo("form:first");
        }
    </script>

HTML

<div id='inline_content' style='padding:10px; background:#fff;'>
      <h2>Inline Content </h2>
      <input type="submit" id="btn" name="btn" />
</div>



Read More

August 25, 2013

GPG Dragon Box v3.27 Ready to download


GPG Dragon software updates to latest version automatically. It also provides detailed news, information and features for latest release if available with if a popup window.

If you face any error you can use the GPG Dragon v3.26 .
  • Add SPD 8825\6825 CPU Support [First in the World]
  • Add SPD 8825\6825 CPU Write Flash Support
  • Just Support Factory Flash PAC Format File
  • Move the MTK 6575 NAND Write Flash Support 0x840 page .
  • Add MTK android IMEI Change with USB Cable Support .
  • <Without Root\more easy do it!!!> 
  • Software Add Set Pinout Windows 
  • in Software Tools Add Dragon V2 software 
  • Add Reset Foramt for SPD android Phone [beta]


Reference:-
http://www.4shared.com/get/ixBiMR_a/Dragon_V327_new.html

Check out OLD Versions..
GPG Dragon Box v3.25
GPG Dragon Box v3.26 
Read More

August 24, 2013

Use More Than One Web.Config File : Asp.Net

If you have planned to have different Web.config files for sub-folders in the application root folder. It helps us to have small and easily maintainable configuration files.

System wide configuration settings are defined in the Machine.config for the .NET Framework. The Machine.config file is located in the  C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG
folder. The settings defined in this file are applicable to all ASP.NET applications in that system.

We can override these default settings by including a Web.config file in the application's root folder.

By including Web.config files in sub-folders, we can override the settings defined in the Web.config file in the application's root folder.

The following are sample section declarations from a Machine.config file:
<section name="processModel" 
  type="System.Web.Configuration.ProcessModelConfigurationHandler, 
        System.Web, Version=1.0.5000.0, Culture=neutral, 
        PublicKeyToken=b03f5f7f11d50a3a" 
  allowDefinition="MachineOnly"/>
 
<section name="sessionState" 
  type="System.Web.SessionState.SessionStateSectionHandler, 
        System.Web, Version=1.0.5000.0, Culture=neutral, 
        PublicKeyToken=b03f5f7f11d50a3a" 
  allowDefinition="MachineToApplication"/>
 
<section name="appSettings" 
  type="System.Configuration.NameValueFileSectionHandler, System,
        Version=1.0.5000.0, Culture=neutral, 
        PublicKeyToken=b77a5c561934e089"/>
There is an attribute allowDefinition specified in the first two section declarations with the values: MachineOnlyand MachineToApplication.

What it does mean?

If allowDefinition="MachineOnly", then we can not override this section either in application level or in folder level. The only section declared in the Machine.config file with this settings is processModel.

If allowDefinition="MachineToApplication", then we can override these sections by the root directoryWeb.config. Sections with this setting 
in Machine.config are authenticationmachineKeysessionStatetrust, and securityPolicy.
If allowDefinition attribute is omitted in a section declaration of the Machine.config file, we can override that section at any level.

We can override the section appSettings at any level and can access it by usingConfigurationSettings.AppSettings easily.


Read More

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.