|
Hello people!
Im making a little game with SDL.NET. And because I want to spread my game, I ship all the dll's, now my folder is filled with dll's, and it is not looking neat. Is there a way to combine them ( resource for example ) and use them ? Or put them in a folder called "depencies" for example ?
All .NET dll's can I combine with Netz, so that is not a problem, the unmanged dlls are .
Good night!
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
namespace ColinAngusMackay.NumbersInWords
public class English
{
public static string NumberToEnglish(int number)
{
// Special case for zero
if (number == 0)
return "zero";
// Special case for int.MinValue.
if (number == int.MinValue)
return "negative two billion one hundred and forty seven million " +
"four hundred and eighty three thousand six hundred and forty eight";
// set up possible prefix for negative numbers
string prefix = "";
if (number < 0)
prefix = "negative ";
int absNumber = Math.Abs(number);
return string.Concat(prefix,
TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven(absNumber));
}
private static string TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven(int number)
{
if (number < 1000000000)
return TranslateOneToNineHundredAndNintyNineMillionNineHundredAndNintyNineThousandNineHundredAndNintyNine(number);
int billions = number / 1000000000;
string result = string.Concat(TranslateOneToNineteen(billions), " billion");
int remainder = number % 1000000000;
if (remainder == 0)
return result;
if (remainder < 100)
return string.Concat(result, " and ", TranslateOneToNinetyNine(remainder));
return string.Concat(result, " ",
TranslateOneToNineHundredAndNintyNineMillionNineHundredAndNintyNineThousandNineHundredAndNintyNine(remainder));
}
private static string TranslateOneToNineHundredAndNintyNineMillionNineHundredAndNintyNineThousandNineHundredAndNintyNine(int number)
{
if (number < 1000000)
return TranslateOneToNineHundredAndNinetyNineThousandNineHundredAndNinetyNine(number);
int millions = number / 1000000;
string result = string.Concat(TranslateOneToNineHundredAndNinetyNine(millions),
" million");
int remainder = number % 1000000;
if (remainder == 0)
return result;
if (remainder < 100)
return string.Concat(result, " and ",
TranslateOneToNinetyNine(remainder));
return string.Concat(result, " ",
TranslateOneToNineHundredAndNinetyNineThousandNineHundredAndNinetyNine(remainder));
}
private static string TranslateOneToNineHundredAndNinetyNineThousandNineHundredAndNinetyNine(int number)
{
if (number < 1000)
return TranslateOneToNineHundredAndNinetyNine(number);
int thousands = number / 1000;
string result = string.Concat(TranslateOneToNineHundredAndNinetyNine(thousands),
" thousand");
int remainder = number % 1000;
if (remainder == 0)
return result;
if (remainder < 100)
return string.Concat(result, " and ",
TranslateOneToNinetyNine(remainder));
return string.Concat(result, " ",
TranslateOneToNineHundredAndNinetyNine(remainder));
}
private static string TranslateOneToNineHundredAndNinetyNine(int number)
{
if (number < 100)
return TranslateOneToNinetyNine(number);
int hundreds = number / 100;
string result = string.Concat(TranslateOneToNineteen(hundreds),
" hundred");
int remainder = number % 100;
if (remainder == 0)
return result;
return string.Concat(result, " and ", TranslateOneToNinetyNine(remainder));
}
private static string TranslateOneToNinetyNine(int number)
{
if (number < 20)
return TranslateOneToNineteen(number);
int units = number % 10;
int tens = number / 10;
string result = "";
switch (tens)
{
case 2:
result = "twenty";
break;
case 3:
result = "thirty";
break;
case 4:
result = "forty";
break;
case 5:
result = "fifty";
break;
case 6:
result = "sixty";
break;
case 7:
result = "seventy";
break;
case 8:
result = "eighty";
break;
default:
result = "ninety";
break;
}
if (units != 0)
result = string.Concat(result, " ", TranslateOneToNineteen(units));
return result;
}
private static string TranslateOneToNineteen(int number)
{
switch (number)
{
case 1:
return "one";
case 2:
return "two";
case 3:
return "three";
case 4:
return "four";
case 5:
return "five";
case 6:
return "six";
case 7:
return "seven";
case 8:
return "eight";
case 9:
return "nine";
case 10:
return "ten";
case 11:
return "eleven";
case 12:
return "twelve";
case 13:
return "thirteen";
case 14:
return "fourteen";
case 15:
return "fifteen";
case 16:
return "sixteen";
case 17:
return "seventeen";
case 18:
return "eighteen";
default:
return "nineteen";
}
}
}
}
***the program want to convert the numbers in to characters
-- modified at 18:18 Tuesday 23rd October, 2007
|
|
|
|
|
The subject line is supposed to be a short description, not a complete sentence.
When posting code, use the pre tag to preserve the formatting.
When posting code, keep it short.
What error are you talking about? Do you get an error message?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: Do you get an error message?
one? how about a few dozen, including complaints about missing breaks...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
to start your namespace is there but a class within it comes before the opeing "{" bracket and the ending one is already there.
IE you have
namespace mynamespace
class myclass
{
}
}
when you should have
namespace mynamespace
{
class myclass
{
}
}
second there isn't a static void Main(string[] args) { } function and this appears to be a console application (not using widows form classes) and only one class, then your class requires a Main function for the windows entry point into your code
after adding
static void Main(string[] args)
{
Console.WriteLine(NumberToEnglish(10002));
}
worked for me. if you have issues then you can put a break where you call it then step though it with the debugger it is easy to spot
Run it with [F5] with a break at the start of the call of convert then step-into it with [F11] then step through with [F10] looking at the auto, till you see an error. Break before the error then reset with [Shift]+[F5] then [F5] and [F5] again to goto the new break. Press [F11] to step into the code area where your error was repeat till you see the mistake.
also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven() " is a very good choice for a function name
-- modified at 18:50 Tuesday 23rd October, 2007
|
|
|
|
|
Thanks for the material....
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
|
|
|
|
|
Truely, a "coding horror" if I ever saw one!
|
|
|
|
|
Dave Kreskowiak wrote: Truely, a "coding horror" if I ever saw one!
Oops! I didn't think anyone would take that code so seriously...
|
|
|
|
|
At least with crazy function names it becomes easy to see who copies my code.
|
|
|
|
|
Hi All,
I have a data base, and a C# application.
my application need to import and export the database from and to a XML file.
One of my tables have a DATETIME field, when I try to import from the XML to the DB I got the following error: "Conversion failed when converting datetime from character string."
What should I do?
Thanks in advance for your kind help.
|
|
|
|
|
How are you importing from the XML to DB? You may need to use DateTime.Parse to convert the date string in the XML file
only two letters away from being an asset
|
|
|
|
|
Hi Gang,
I've got an app that I built with ASP linked to a MySQL database (oh please save your BOO's ). I have a field that is encrypted with a salt value, and uses the MySQL AES_Encrypt() and AES_Decrypt() methods. The data must be stored in an ecrypted fashion, use a salt value to be re-used to decrypt it later.
Recommendations?
Thanks.
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
Recommendations for what?? You said you already have this stuff, so I fail to see the point of the question.
|
|
|
|
|
Encrypt/Decrypt with a salt value - not one-way encryption like MD5 one-way encryption.
Thanks.
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
That doesn't help. I figured that much. I still don't have a clue what you're after...
Are you looking to implement this in SQL Server instead?? (Your subject line mentions SQL Server)
Are you looking for hepl on using the MySQL functions?? A better source of information on tht would be a forum dedicated to MySQL, not C#.
Or are you looking for an entirely C# implementation of a two-way encryption, storing the encrypted value in a database field??
|
|
|
|
|
Dave,
Sorry about that. Let me clarify. I am looking for a C# implementation of a two-way encryption algorythm which uses a salt value.
I'm porting an application's data-store from MySQL to SQL Server.
Thanks!
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
What I want to do is to use the shadow service to deal with in-use files when backing up with 7zip.
At the moment my 7zip implementation is merely to launch 7zg with command line parameters from within my C# app. I'm using NTBackup to deal with locked files but I don't want to depend on it due to compatibility issues (no NTBackup in Vista).
So I need a way to create a shadow copy, then 7zip from it. I don't care if it's more command line tools, I just don't have a clue where to start really.
|
|
|
|
|
Extremely difficult at best. There is no managed wrapper for the Shadow Copy Service and the COM exports are spotty at best at this point. You'd be better off writing a wrapper in C++/CLI to expose the functionality you want, then consuming that in a managed code app written in VB.NET or C#.
|
|
|
|
|
i need a program immediately to read and display an image using c code
pls help
dhariiiiiiiii
|
|
|
|
|
You'd better hurry up and write one then...
Paul Marfleet
|
|
|
|
|
Have you tried google... Or yahoo... Or SQLH?
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
You problem is answered here[^] at #2
|
|
|
|
|
dharikitty wrote: using c code
Go over to the C forum, and don't post this question there.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
dharikitty wrote: i need a program immediately to read and display an image using c code
Dear,
And I need a new widescreen LCD TV real bad. Perhaps we could work out a mutually beneficial deal?
I'm a talented programmer with decades of experience, an author of several patents, and an accomplished synchronized swimmer. Please contact me and let me know if you're interested in my services.
Thanks,
/ravi
PS: Should the program display a specific image or can I choose one of my own liking?
|
|
|
|
|
For my current (and first) project in C# / ASP.net 2.0 I need some set operations (like intersect, union, minus), preferrably for a SortedList. Since I didn't find any, I wrote my own.
The problem is, it seems the method affects the objects outside the method, even though I'm sure I called the method using call by value instead of call by reference.
This is the method Minus:
<code>
public SortedList Minus(SortedList a, SortedList b)
{
/*
* Bildet a \ b
* Values werden aus a übernommen.
*
*/
if (a != null && b != null)
{
for (int i = 0; i < b.Count; i++)
{
if (a.ContainsKey(b.GetKey(i)))
{
a.Remove(b.GetKey(i));
}
}
return a;
}
else
{
return new SortedList();
}
}
</code>
And here's how I call it.
<code>
SortedList sl1 = new SortedList();
SortedList sl2 = new SortedList();
SortedList sl3 = new SortedList();
sl1.Add("1", "eins");
sl1.Add("2", "zwei");
sl1.Add("3", "drei");
sl2.Add("2", "dkjfs");
Response.Write("before: sl1: <br />\n");
helper_show_sortedlist(sl1);
Response.Write("before: sl2: <br />\n");
helper_show_sortedlist(sl2);
//sl3 = Minus((SortedList)sl1.Clone(),(SortedList)sl2.Clone());
sl3 = Minus(sl1, sl2);
Response.Write("<br />\n");
Response.Write("after: sl1: <br />\n");
helper_show_sortedlist(sl1);
Response.Write("after: sl2: <br />\n");
helper_show_sortedlist(sl2);
Response.Write("after: sl3: <br />\n");
helper_show_sortedlist(sl3);
</code>
If I do Minus(sll, sl2), the output is
<code>
before: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
before: sl2:
i=0: Key: 2, Value: dkjfs
after: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
after: sl2:
i=0: Key: 2, Value: dkjfs
after: sl3:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
</code>
Obviously, the Method acted like if I gave only a reference to sl1 and sl2 and changed sl1!
If I call it explicitly with copies of the two SortedLists, it gives the behaviour I would normally expect from the first way already:
<code>
before: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
before: sl2:
i=0: Key: 2, Value: dkjfs
after: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
after: sl2:
i=0: Key: 2, Value: dkjfs
after: sl3:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
</code>
So I'm just wondering what I'm doing wrong here. I'd like to call methods like this the "normal" call-by-value-way, without explicitly giving them copies of what I'm going to give them.
|
|
|
|