- Strength to Increase Rep
- +16
- Strength to Decrease Rep
- -4
- Upvotes Received
- 574
- Posts with Upvotes
- 467
- Upvoting Members
- 183
- Downvotes Received
- 128
- Posts with Downvotes
- 103
- Downvoting Members
- 18
Software Engineer
- Interests
- Software Development
- PC Specs
- vrooom!!11!
2,245 Posted Topics
| |
Re: You could use generics and extensions for this: [code] public static void Shuffle<T>(this IList<T> list) { Random rng = new Random(); int n = list.Count; while (n > 1) { n--; int k = rng.Next(n + 1); T value = list[k]; list[k] = list[n]; list[n] = value; } } [/code] … | |
Re: The problem is both projects can't access one another. There is a compile order you can see (click the "Debug"/"Release" dropdown and select options at the bottom, its in there). It first compiles project A, then project B. But if it cannot compile Project A until Project B has been … | |
Re: Here is another approach. [code] Imports System.Data.SqlClient 'IF OBJECT_ID('PDF', 'U') IS NOT NULL DROP TABLE PDF 'CREATE TABLE PDF '( ' RecordId int identity(1000, 1) PRIMARY KEY, ' PDF varbinary(max) ') Public Class frmPDF Private Sub ButtonUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonUpload.Click Using conn As New … | |
Re: You didn't marshal all the strings: [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Security; using System.Security.Principal; namespace daniweb { public class WindowsLoadUserProfile { /// /// The LogonUser function attempts to log a user on to the local computer. /// [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = … | |
Re: Very nice! You have brought a lot of code together :) | |
Re: It could likely be modified somewhere else in your store procedure that you did not post here. Also -- this is not a good idea: [code=sql] IF OBJECT_ID('tempdb..#Test', 'U') IS NOT NULL DROP TABLE #Test Create Table #Test ( PK varchar(5) UNIQUE, Value1 decimal(5,2) ) GO Insert Into #Test (PK, … | |
Re: Are you running your software on both ends of the connection? [URL="http://en.wikipedia.org/wiki/Media_Access_Control"]MAC addresses[/URL] are only "guaranteed valid" for [URL="http://en.wikipedia.org/wiki/OSI_model#Layer_2:_Data_Link_Layer"]layer 2[/URL] communications in a LAN. They do not traverse a router as you would think. That being said if it is your software running on both ends then you can use … | |
Re: Count them: da.UpdateCommand.CommandText = "update per010_ssk set " + " izin_tipi=?, " {1} + " hareket_tipi=?, " {2} + " izin_sure=? ," {3} + " kullanim_sure=?, " {4} + " baslama_tarih=?, " {5} + " bitis_tarih=?, " {6} + " hakedis_tarih=?, " {7} + " sua=? " {8} + " … | |
Re: I do the same thing in a number of my applications and there is no "right" or "wrong" answer in my opinion, but the way I chose doesn't seem to be popular to internet folks. What I do is have an "Install Wizard" run as a separate application and it … | |
Re: Page: [code] <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DownloadForm.aspx.cs" Inherits="daniweb.asp.DownloadForm" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </div> </form> </body> </html> [/code] Code behind: [code=c#] using System; using System.Collections.Generic; using System.Linq; using … | |
Re: Here is an example. See if you can modify it to suit your needs: [code=sql] Select Count(*) As CustCnt, (Select Count(*) From Invoice Where Invoice.CustNumber = Customer.CustNumber) As InvCnt From Customer Group By Customer.CustNumber [/code] | |
Re: **G_Waddell**: Short answer: You are using the wrong build type. My guess: you are running on a 64-bit version of windows and have your compiler output settings to "Any CPU prefer 32-bit", or "x86". See configuration options for solution:  Long answer: The problem is build output on your … | |
Re: Why not just validate on the postback and come back with an error message if it is <10 characters? I can't think of any website that enforces a minimum length validation browser side. | |
Re: Take a look at this thread: [url]http://www.daniweb.com/forums/thread247583.html[/url] [URL="http://www.daniweb.com/forums/member633074.html"]MeSampath[/URL] provided this code: [code] MySqlConnection mcon = null; MySqlCommand cmd = null; FileStream fsObj = null; BinaryReader binRdr = null; try { //converting image to bytes fsObj = File.OpenRead(pictureBox1.ImageLocation); byte[] imgContent = new byte[fsObj.Length]; binRdr = new BinaryReader(fsObj); imgContent = binRdr.ReadBytes((int)fsObj.Length); mcon … | |
Re: Try this: [code=c#] private void DoExcel() { const string Fname = @"C:\dotnetwin\daniweb\Book1.xlsx"; Microsoft.Office.Interop.Excel.ApplicationClass excel = null; Microsoft.Office.Interop.Excel.Workbook wb = null; Microsoft.Office.Interop.Excel.Worksheet ws = null; Microsoft.Office.Interop.Excel.Range rng = null; object missing = Type.Missing; //bool ReadOnly = false; //true or missing gives the same try { //Excel.Application is abstract class so I … | |
Re: I can't figure out how to preview this post or what Dani did with code tags. I'll let the mods sort that out. My thoughts: You have a few problems 1) You didn't post complete code 2) The 4th argument of File.Open() you have FileShare.Read. You need _exclusive_ file access … | |
Re: As far as I know you cannot save over a file that already exists. With Excel automation I always save the file to a temp file and overwrite the old file: [code=c#] private void DoExcel() { const string Fname = @"C:\dotnetwin\daniweb\Book1.xlsx"; Microsoft.Office.Interop.Excel.ApplicationClass excel = null; Microsoft.Office.Interop.Excel.Workbook wb = null; Microsoft.Office.Interop.Excel.Worksheet … | |
Re: It is a code file automatically generated by your designer to hold the form's layout information that was created using the Visual Studio IDE. Previous versions of Visual Studio stored all of the information contained in the .designer.cs file in the main code file but the split it out due … | |
Re: Sometimes malware installs itself and forces an outbound proxy so it can hijack connections. I would run antivirus and antimalware first. If that isn't the issue then post back and we'll go from there. | |
Re: You want to "embed" the excel application inside of the page? That isn't going to be easy... if its' even possible. | |
Re: I don't know the capabilities of the wrt54g but you could plug a hub in to the router and branch the traffic off to your machine and run a packet sniffer such as wireshark and monitor all network traffic. You would see IM, emails, etc in addition to websites. Before … | |
Re: [code=sql] Insert Into aTable (SomeString, SomeDateTime) Values ('abc', GetDate()) [/code] [code=sql] Update aTable Set SomeDateTime = GetDate() [/code] | |
Re: Is there any reason you're trying to build it from source rather than installing it from the package repository? [code=bash] sk:~# apt-cache search libpcap | grep ^libp libpcap-dev - Development library for libpcap (transitional package) libpcap-ruby1.8 - Ruby interface for the libpcap packet capture library libpcap0.7 - System interface for … | |
Re: Sign your assemblies and don't distribute your application. The .NET assemblies are in MSIL so they can always be decompiled. | |
Re: [quote] KeyboardHookProc() stopped getting called: [/quote] I cant be sure of this without you posting a sample application, but from the sound of it you are either closing the connection OR the connection variables is going out of scope and becomes breakfast for the garbage collector. [quote] Another problem was … | |
Re: What kind of barcode reader? You can use a [URL="http://www.waspbarcode.com/"]wasp barcode reader[/URL] to scan barcodes and it will send the barcode data over via ps2/usb. Or are you talking about OCR recognition of barcodes in image files? I use [URL="http://www.atalasoft.com/"]Atalasoft[/URL]'s barcode ocr library for image detection. They have a runtime … | |
Re: Just test the length. [code] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace daniweb { public partial class frmLoginScreen : Form { public frmLoginScreen() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("You must enter a … | |
Here is a sample code snippet of logging in a user against a user table in an MSSQL database with password encryption. Scott Knake | |
Re: Also take a look at "mshtml". | |
Re: You may also want to check out this post for many examples: [url]http://www.daniweb.com/web-development/aspnet/threads/209172/940891#post940891[/url] | |
Re: The table: [code=sql] Create Table Picture ( ID int identity(1000, 1) PRIMARY KEY, Picture image ) [/code] Code behind: [code=csharp] using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.IO; namespace daniweb.web { public partial class PagePost : System.Web.UI.Page { … | |
Re: I don't understand the problem. File.AppendAllText() creates a file if it does not exist and appends the text (not a line). This code will append the text, create the file if needed, and display the output after each write. [code=c#] using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; namespace daniweb … | |
Re: Please start new threads for your questions. You probably have another thread created that is not running as a background thread which will stop your application from closing until the thread aborts. You probably need to review if this is this case, or upload your project demonstrating the behavior. Please … | |
Re: [code=csharp] private void button14_Click(object sender, EventArgs e) { FileInfo[] files = new DirectoryInfo(@"C:\").GetFiles(@"*.txt"); foreach (FileInfo file in files) { if (DateTime.UtcNow.Subtract(file.LastWriteTimeUtc).TotalDays >= 3) { Console.WriteLine(file.FullName + " needs to be copied"); } } } [/code] | |
Re: Get the Gridview's selected row handle or associated data row and call [icode].Delete()[/icode] on the DataRow then [icode].AcceptChanges()[/icode] on the associated data table. | |
Re: You should create a DataSet with the IDE and use it OR you should just execute your queries dynamically without the use of a DataSet. I personally don't consider creating a DataSet in code functionally identical to a designer generated DataSet. Since an INSERT can have triggers that execute post-update … | |
Re: [B]>>Try using WebRequest instead of HttpWebRequest:[/B] What does that have to do with the problem though? WebRequest is an abstract base class for Http requests, Ftp requests, etc. Even in your code its still creating an HttpWebRequest based on the URI format: [code] private void button3_Click(object sender, EventArgs e) { … | |
Re: You answered your own question. MSDN recommends it so yes. Anything implementing IDisposable should be disposed when it is no longer needed. Local variables are not destroyed immediately when they go out of scope but they are no longer accessible. Calling dispose immediately frees up any resources it can then … | |
Re: You should never call the garbage collector from code: [icode]GC.Collect();[/icode]. Also that is the expected behavior of the Excel assembly. Think about it -- you're calling SaveAs() which is a [icode]void[/icode] method meaning you can't return a value. If you call [icode]SaveAs()[/icode] then you expect the file to be saved. … | |
Re: Regardless of whether or not the scanner is USB or Keyboard it will basically send key presses like a keyboard so that doesn't matter as far as your application is concerned. Secondly the barcode scanner can be programmed with a barcode prefix and suffix. This information and programming barcodes can … | |
Re: [icode]SqlConnection[/icode], [icode]SqlCommand[/icode] and [icode]SqlDataReader[/icode] all implement [icode]IDisposable[/icode] and should be cleaned up in code or wrapped in [icode]using()[/icode] statements: [code=c#] /// <summary> /// Concatenates the query string /// </summary> /// <param name="Sql"></param> /// <returns></returns> private static string GetText(List<string> Sql) { StringBuilder sb = new StringBuilder(); for (int i1 = 0; … | |
Re: Type initializers can fail for a number of reasons. The exception being thrown should have an InnerException with more detail as to why initialization failed. | |
Re: Welcome to Daniweb darkocean! Please use code tags when posting code To answer your question you can delete a single row this way: Excel.Range ran; ran = (Excel.Range)this.Application.Rows[12, missing]; ran.Select(); ran.Delete(Excel.XlDirection.xlUp); To delete multiple rows: //Get a set of cells in the rows Excel.Range rng = ws.get_Range("a12", "A14"); //Then act … | |
Re: You can also use the mailto: extension to open up the default email client: [code=c#] private void button1_Click(object sender, EventArgs e) { string to = "test@gmail.com; test2@gmail.com"; string subject = "test subject"; string body = "test body"; MailTo(to, subject, body); } public static void MailTo(string To, string Subject, string Body) … | |
Re: Thanks serkan ;) For installing SQL2005 you will want to use the command line args. Here they are for SQL2005: [code] //setup.exe /qb ADDLOCAL=SQL_Engine,SQL_Data_Files,SQL_Replication,Client_Components,Connectivity,SQL_SSMSEE INSTANCENAME=SrvMgrEnt SAVESYSDB=1 SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 SECURITYMODE=SQL SAPWD=PASSWORD123 DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ADDUSERASADMIN=1 INSTALLSQLDIR="%ProgramFiles%\Microsoft SQL Server\" [/code] To assemble them in code you only need to modify a … | |
Re: You should do analysis on your log files to deteremine the number of visitors. Check out "smarter stats." | |
Re: It doesn't as far as I know. Are you deploying it with your application or is something creating it? | |
Re: One of the biggest causes for memory leaking is event handlers not being removed. I highly suspect that somewhere you're not cleaning up resources. Keep up your investigations with the memory profiler | |
Re: >>1)is there any connection string ? Please see code below >>2)if so i am using windows authendication in sql server 2005 management studio so am not entering any user id and password to enter in sql server Please see code below >>3)so what should be the userid and password for … |
The End.