|
yes sorting but how sort bubble method and how sort quick method?
|
|
|
|
|
Google is your friend...even for homework questions. The answer is probably also in your textbook.
|
|
|
|
|
Rob Graham wrote: Google is your friend...even for homework questions
It won't flame you or get mad
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Hence Google is your good friend, see here [^] and here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hullo Folks,
Am trying to develop a point of sale system for a mobile company.
The point of sale is of distribution of airtime to customers.
The Server is on a Linux box and has MySQL database(This is where the phone Airtime recharge numbers are stored)
Am to develop a client application using C#, the POS is to work in such away that.
The distributor goes to the mobile company, pays say $3000,
So whenever he sells airtime on his account is reduced.
The client will communicate with the server(has MySQL database) over a GSM modem.
However whenever the Distributor requests for Air-time from the server,
The amount he gets will be cached; the amount cached is what he will sell until,
It goes to zero, then he will request more from the server…then cache it….
This will go on and on until his account at the server goes to Zero.
Look at it in this way, you have a bank account, you need say $500,get to the ATM, withdraw the $500,u will have the $500,but your account balance has been reduced by $500,
So you use that $500,till its over and when you need more, you go back to the ATM for more.
How the airtime will be distributed is in 2 ways.
· The point of sale printer will print the recharge number on a piece of paper
Say 123-674-627-63,which will be given to the customer.
· The distributor should be able to directly load the airtime onto the customer’s phone
Can I please have help on how I can go about this one?
Especially the communication over the GSM modem to the server, which is Linux box.
Waskira
|
|
|
|
|
Hi,
I get the above exception while using my code and I really do not know why. The code creates a jagged string array which includes two arrays. Each array holds 20 string items. (In the following code I removed some of it as to not overload this page...).
I then use a for statement (it made en exception using foreach as well), inwhich I create a new Regex variable and use it to replace text. The code is:
string[][] newInfo = new string[2][];
newInfo[0] = new string[20] {"string 1", "string 2", "string 3", ... };
newInfo[1] = new string[20] {"string 1", "string 2", "string 3", ... };
for (int i = 0; i < newInfo[0].Length; i++) {
string parameter = newInfo[0][i];
string value = newInfo[1][Array.IndexOf(newInfo[0], parameter)];
if (value != "-")
{
Regex rxParameter = new Regex("\x7C" + parameter + "=" + ".*" + "\x7C");
p.text = rxParameter.Replace(p.text, "\x7C" + parameter + "=" + value + "\x7C");
}
}
After compiling and running this, the program get stuck at i=3, at the replace function. I dont know why the program is out of memory. Does anyone know what I should do?
Thanks,
Yoni
|
|
|
|
|
Did you look at the call stack for the exception? Did it have any InnerException set? Is the OutOfMemoryException reproducible always at i = 3?
|
|
|
|
|
I am new to C#. I use a text writer called EditPlus to edit the code; and MSDOS to compile it and make an exe out of it. All I get is the exception. I do not know what the "call stack for the exception" or else enything else. I do know that the OutOfMemoryException apears every time I run the program, and every time at i=3. I can also add that i=0 and i=1 goes through quick, less than half a second; i=2 has a small delay, of like half a second, and then i=3 just stalls. I have the free Visual C++ 2005 Express but I have no idea how to use it (i.e. how to load my .cs file).
I know this sound hopeless, but I really do not see a way out of this...
Thanks,
Yoni
|
|
|
|
|
Express edition is really easy to use. You may have to create a new "empty project", then copy and past in your c# program. That should give you all the debugging info so you can see the stack
there are several vedio files for getting started with the express edition. Check microsoft web page.
|
|
|
|
|
Thanks for the tip, I'll check out Microsoft's site..
Yoni
|
|
|
|
|
Is your application a console app or a windows app? If it's a console app, after the OutOfMemoryException occurs, you should be able to see the stack trace on the console window. The stack trace simply lists the sequence of function calls that triggered the exception. Even otherwise, you can wrap the code that you think is causing this exception with a try catch block like this
try
{
}
catch(Exception e)
{
Console.WriteLine(e);
}
VC# Express is a pretty good IDE, you must learn how to use it. You get a very good debugger, at the very least.
|
|
|
|
|
Thanks, I am aware of the try-catch statement, tho it didnt help me so much. Anyway, the problem with the regex has been fixed. The VC# Express is actually a VC++ Express, but I guess C# will work there as well.
Thanks for your help,
Yoni
|
|
|
|
|
How is declared p?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am using the DotNetWikiBot framework[^].
p is of type Page. I dont think this is the problem, since p.text is of type String.
Yoni
|
|
|
|
|
Hi,
when running your code, the text will explode (increase exponentially in the for loop),
until the out-of-memory situation occurs. Just print the length (or the content) after
each iteration.
Check your regular expression, vertical bar (or pipe) is a special character that means OR,
but its left operand is empty???
Luc Pattyn
|
|
|
|
|
Hi,
Thanks for your help. What do you mean "Just print the length or the content"? lenght of content of what? p.text?
Regarding the regular expression, I have pipes because the text has pipes. i.e. that's what I want to replace. When I tried to escape them using "\", the compiler gave me an error - unrecognized escape character. I then tried using "@" but it jammed with an Out-of-memory Exception. I then moved on to a Hex escape, which also gives me this exepction.
Yoni
|
|
|
|
|
Hi Yoni,
1)
to see what goes wrong, look at the intermediate results, so print at least p.text.Lenght,
and if necessary (but this may get very large) p.text itself, or part of it, e.g.
p.text.Substring(0,80)
You may want to create a function that does this in an intelligent way, i.e.
printing length, and full or partial contentdepending on size.
2)
regular expressions use special characters such as \ and | and some more.
to get them literally, you should escape them so to get a | you need a \|
But then the C/C++/C# languages will try to interpret the backslash, so you must
either escape it again (hence \\|) or prefix the entire constant string by a @ sign
(@"...\|...")
3)
I dont think there is a need to use 0x7C when what you want is a vertical bar;
just type | and you will get more readable code.
4)
general advice: if something goes wrong, break it down into smaller pieces, until]
you can easily see where it starts to go wrong. In this particular case:
print intermediate values, reduce the size of the problem (fewer than 20 strings!);
if this does not help, perform some experiments (e.g. on the behaviour of Regex).
Greetings,
:cool:
Luc Pattyn
|
|
|
|
|
Thanks for your help. It turns out the regex was a problem. Indeed - the "\\|" in the regex worked. And regarding 3 you were also correct, just a | did the job as well and made the code more readable.
Yoni
|
|
|
|
|
Hi,
I have create a assembly (DLL) that contains important controls, contains Dataset of my database. Because .NET allow referencing, anyone can use the library to modify my database using their application. What I want is that the library only work with my application not other application. And the application that I develop not only one application, it can be two or more that use that library. Any suggestion? Because the library is critical and the application is pay type, so I not want disappointing customers.
Regards,
Ariston Darmayuda
Newbie on "Genetic Programming" or "Nets Programming"
|
|
|
|
|
You can obfuscate it.
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
PaulC1972 wrote: You can obfuscate it.
So with obfuscate we can prevent someone use our component on our obfuscated assembly. As I know that obfuscate is used to protect our assembly for be disassembling (with MSIL Disassembler). But the case is like this, if someone try to add component on toolbox so he/she browse my assembly, then the component will be listed on toolbox. What I want to do is that only my IDE can use the components, no one except me. Like Janus or other third party component, they can create a trial component. Any reference to create a trial component?
Thanks.
|
|
|
|
|
as i see a sample not remember where they build an algorithm which checks every time for the genuine key
what they did was they take the any system specific id number and encrypt it highly they stored a reference number in the end of dll file using binary editor (the some part of dll /exe can be used for this purpose ) if the reference number does not match they simply gives out message box and just skip all process of dll for registering it they made special exe which write the code on the dll which will match and unlock the dll and for demo there are two ways 1> limited functionality (can be achieved by setting flags in your dll ) 2> limit the number of days you have to check each time what date of system is and store date (encrypted) in dll itself and changing the number stored in dll every time dll is used until it reach lock mode
rest Google may help
it is good to be important but it is more important to be good
|
|
|
|
|
|
Hi everybody!
I have an interface called Renderer , there are classes like 3DRenderer , 2DRender etc implementing it.
Everything is fine, but I'd like all classes to be singletons. They all should have a static method getInstance() which other classes need to call to get an instance of this singleton renderer object.
Is this possible with interfaces, abstract classes or somehow at all?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I assume you'd want 3DRenderer , 2DRenderer etc. to be separate singletons i.e one instance of 3DRenderer , one instance of 2DRenderer . In that case, I'm afraid you need to have static references in each of the derived classes, as a single static reference in a base class would mean that all derived classes will share that single instance.
|
|
|
|
|