pseudorandom21 166 Practically a Posting Shark

Kind of trying to help, I suppose.

pseudorandom21 166 Practically a Posting Shark

An array of characters, when interpreted as a string, is often called a C string or a C-style string.

It has the special property that most code expects it to be NULL terminated, meaning the last character in the array (or the end of the string) has a NULL value.

take this for example:

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
char buffer[256] = {1};//<-- the array contains ones.
strcpy(buffer,"Hello, C string.");//<-- this function automatically appends a NULL

//Now printing the string characters interpreted as integers will show this.
for(int i = 0; i < 256; i++)
cout << (int)buffer[i] << ' ';//<-- casted to an integer.
}
pseudorandom21 166 Practically a Posting Shark

I'm not entirely believing this is for an actual production application, but if it is then you probably should realize you may not yet be qualified to code authentication mechanisms.

pseudorandom21 166 Practically a Posting Shark

Yes I think that's a good idea also.

pseudorandom21 166 Practically a Posting Shark

You can also enable collapsing of things such as for loops inside of functions (for C/C++ at least).

on VS2010:
tools -> options -> text editor -> C/C++ -> Formatting -> Outlining ->
set Outline statement blocks = true.

and not to get off topic, but if someone uses F# could you give me some information about your experience learning it, or at least learning a functional language in general.

pseudorandom21 166 Practically a Posting Shark

Hey I've used VI before, it's supposed to be "powerful" somehow, but I never figured out how. It certainly isn't intuitive, or at least, the version that I used.

pseudorandom21 166 Practically a Posting Shark

Hello all, a lot of times I see C# code written without the use of #region and #endregion, I'm just wondering if there is any reason not to use it, and what are your thoughts on using it.

I think it's an amazing feature that lets you clearly identify groups of functions/classes with similar functionality.

i.e.,

#region PROGRAM_INIT
//Functions to initialize variables, etc.
#endregion

#region STRUCTION
//ctor
//dtor
#endregion

#region EVENTS
//Program events go here.
#endregion
ddanbe commented: Good question. +14
pseudorandom21 166 Practically a Posting Shark

Sounds like a bad deal.

pseudorandom21 166 Practically a Posting Shark

Oh wow, I think this forum has a bug! I definitely posted that somewhere else. I've had other forums do this to me too... Hmm.. Maybe it was user error then, oh well. Disregard that.

pseudorandom21 166 Practically a Posting Shark

If you're using Vista or W7 you may need to give your application administrator privileges to modify something in the root directory like that.

pseudorandom21 166 Practically a Posting Shark

Perhaps I am mistaken but I thought the point of a cast was to unconditionally force the bits of one POD type to another. Where does this "wrapping around" behavior enter the scene?

two bytes:
1 0 1 0 _ 1 0 1 0 - 1 0 1 0 _ 1 0 1 0

now casted down to a single byte, as far as I knew would be:

1 0 1 0 _ 1 0 1 0

using the least significant 8 bits.


:

#include <iostream>
#include <limits>
#include <bitset>
#include <cassert>
#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	assert(sizeof(short) == 2);
	assert(sizeof(signed char) == 1);

	string bigBitString = "0111111100000000";
	string smallBitString = "00000000";
	bitset<16> big;
	bitset<8> small;

	for(string::size_type i = 0; i < bigBitString.size(); i++)
	{
		big[i] = bigBitString[i] == '1' ? 1 : 0;
	}

	for(string::size_type i = 0; i < smallBitString.size(); i++)
	{
		small[i] = smallBitString[i] == '1' ? 1 : 0;
	}
	short sBig = (short)big.to_ulong();
	signed char cSmall = (signed char)small.to_ulong();
	cout << "Sizeof short: " << sizeof(short) << endl;
	cout << "Sizeof signed char: " << sizeof(signed char) << endl;
	cout << "Short bits: " << big.to_string() << endl;
	cout << "Signed char bits: " << small.to_string() << endl;

	signed char casted = (signed char) big.to_ulong();
	bitset<8> castedBits(casted);
	cout << "Signed char bits after down-casting: " << castedBits.to_string() << endl;

	return 0;
}

Isn't the entire point of specifying a down-cast …

pseudorandom21 166 Practically a Posting Shark

Dev-C++ is no longer supported, last I checked. A better IDE will probably compile it.

pseudorandom21 166 Practically a Posting Shark

Try checking your GLUT install then.

Also, I think you're leaking your key states array. (need to delete the memory)

pseudorandom21 166 Practically a Posting Shark

Hi, is there a function to increment a character in F# ?

I'm working with:

let workingSet = ['a' .. 'z'];;
let inc x = x++;;
let rslt = workingSet |> List.map inc ;;
pseudorandom21 166 Practically a Posting Shark

http://en.wikipedia.org/wiki/Primality_test

You might also look into the sieve of eratosthenes, and other algorithms for generating primes.

http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

There are links to other algorithms at the bottom, such as the sieve of sundaram, etc.

pseudorandom21 166 Practically a Posting Shark

I think a sieve that uses a bit of memory is way better than using that much CPU time, you can generate millions of primes in a few seconds using a sieve.

pseudorandom21 166 Practically a Posting Shark

hmm, if you're using Windows have you tried running the application in administrator mode? Just making sure that wasn't overlooked.

pseudorandom21 166 Practically a Posting Shark

First off I agree with Mike, but I will also add that after a while, the C++ aspect of the programming language becomes almost second nature. I will be struggling with the maths, [ that somehow never becomes second nature :( ] and with the main design, or the likely runtime or memory problems, but the language takes a second place -- often I am not even aware which language I am programming in. [Yes I have put bits of C++ into a the middle of f90 method -- the compiler reminded me to get more coffee before coding.]

Much agreed, the language becomes much, much less important. That's around the time you begin to see the benefits of one language over another IMO.

pseudorandom21 166 Practically a Posting Shark

I think I'm driven by frustration sometimes.

pseudorandom21 166 Practically a Posting Shark

Why would anyone prefer Turbo C++ anyway?

pseudorandom21 166 Practically a Posting Shark

Problem is solved, by invalidating a rectangle of the screen it clears it. WinApi func is InvalidateRect.

pseudorandom21 166 Practically a Posting Shark

There is a major problem with my application at the moment, everything it draws STAYS on the screen. Any good ideas guys?

http://imageshack.us/photo/my-images/121/appfail.png/

pseudorandom21 166 Practically a Posting Shark

just wanted it integrated, but if not then i guess i'll just have two applications open.

pseudorandom21 166 Practically a Posting Shark

I'm trying to draw a "selection box" with a Graphics created with an HDC to the PrimaryScreen, but it doesn't appear to update properly, as in when I draw something it tends to stay there. Am I doing something wrong, or is there something I'm not aware of?

[disregard]
Actually it also appears this is not what I was wanting at all, it doesn't appear on top of the content area of open programs. Any suggestions?[/disregard]

Woops, sorry actually it does appear, my text color is white and so is the window. (doh!)

pseudorandom21 166 Practically a Posting Shark

It's probably 10x easier in C# but it can be done.

pseudorandom21 166 Practically a Posting Shark

Do any of you know of a plugin for VS2010 that plays music? I'm kind of assuming plugins for VS are written in some kind of native code...

pseudorandom21 166 Practically a Posting Shark

There are plenty of data structures useful for sorting, but the problem is that you are trying to store the entire file in memory. Obviously a solution is to not store the entire file in memory. It can be done.

pseudorandom21 166 Practically a Posting Shark

AAShape is an abstract base class from which 3 classes are derived.

pseudorandom21 166 Practically a Posting Shark

Do I just need to add

[Serializable]

above the class or what?

pseudorandom21 166 Practically a Posting Shark

I wanted to minimize changes to code in my save-file function by only making changes in the class that will be saved. Instead of making a "save-file" function in the class, I decided to try making it serializable but I receive a runtime error saying "PublicKeyToken=null" not marked as serializable.

Here's the class I want to make serializable:

[Serializable()]
    public class Marker// : ISerializable     
    {
        public Marker()
        {
            commonId++;
            id = commonId;
        }
        public AAShape shape;
        public int nextLinkId;
        public int id;
        static int commonId = 0;

        
        //public void GetObjectData(SerializationInfo info, StreamingContext context)
        //{
        //    if (info == null)
        //        throw new System.ArgumentException("info == null");
        //    info.AddValue("Shape", shape);
        //    info.AddValue("nextLinkId", nextLinkId);
        //    info.AddValue("id", id);
        //    info.AddValue("commonId", commonId);
        //}
    }

also note that AAShape is a different class that I will also make serializable.

pseudorandom21 166 Practically a Posting Shark

That doesn't answer my question, how do I find the keys & values I need to post to the form?

for instance, assume an HTTP form is on a webpage named "somewebsite.com"

with some http like "method="POST"
<other stuff> name="bla" id = "blaa"
</form>

I send what key with with my value to the form?

pseudorandom21 166 Practically a Posting Shark

I plan to use the WebRequest class to POST some data to a form, specifically a message and a file.

I don't know the first thing about websites so I was hoping someone could help me out. I know how the message data is supposed to be formatted and how to use the WebRequest and WebResponse classes together, I really just have no idea what key/value pairs to post.

For instance, if I wished to post to this random website: http://www.magpiemobile.com/hc3.asp
what key/value pairs should I post to search, and then how do I retrieve the result?

pseudorandom21 166 Practically a Posting Shark

Another loop.

line by line your program prints a number of '*'.

so for each line, print your number of '*' and then move to the next line, and run that loop again.

for( ;; )
{
for( ;; )
{
}
}

pseudorandom21 166 Practically a Posting Shark

Press F5.

pseudorandom21 166 Practically a Posting Shark

@Agilemind,

But when you provide something for free they have more money to spend on drugs. It seems almost inevitable unless it's a luxury that they don't really need. The school programs are probably the best idea.

pseudorandom21 166 Practically a Posting Shark

@firstPerson

There is no software out there that has perfect speech analyzer, because of how much speech can vary, and just a little variation can cause a lot of trouble.

Statements like this bother me because areas in which something like this might be practical are so well funded and probably top-secret there is no way in hell that you know that. You might be surprised.

pseudorandom21 166 Practically a Posting Shark

Well... Being overly generous to the pyschopath side, I got a 5.

I do know a friend who would probably get like a 20-30 at least, however.

pseudorandom21 166 Practically a Posting Shark

One algorithm candidate is:
input = [h][e][l][l][o][ ][w][o][r][l][d] for each char c in input
if c is a space
then shift the contents to the left, removing the space.

Of course it would probably be more efficient to copy the array, assuming it is of a manageable size.

pseudorandom21 166 Practically a Posting Shark

:) I like that idea. I would rather work on voice sampling software, the kind that takes a sample, analyzes it, and simulates speech.

I'm using C# to make a game plan creator for my Americas Army 2 gaming buddies. It's almost done, just a minor bug left--and it should be pretty useful when we want/need to use it.

Also working on some input mapping software for the xbox 360 controller, and keeping my mind open to new ideas.

pseudorandom21 166 Practically a Posting Shark

:D

I've seen a lot of ghetto, when they get money they spend it on drugs. Not to say this is true of everyone in every ghetto, but I would say the likelihood of such a thing being widespread is quite a concern for someone feeling righteous. There is trash living in America the likes of which you may not believe.

Osama is dead, so can't we move on to other criminals?

pseudorandom21 166 Practically a Posting Shark

haha oh man but those crappy search engines in the 90's were the best!!

oh ma gawd, who remembers MSN chat ???

To put things into my warped perspective, google's ability to track your searching and browsing is tantamount to a star of david on your shirt in germany during the 40's.

pseudorandom21 166 Practically a Posting Shark

IMHO...

>> In the news previously, probably a month or so, I read an article regarding intelligence agencies' inability to monitor encrypted skype communications.

>> Microsoft buys Skype. My thoughts? Does this mean our calls will remain heavily encrypted? Who knows.

pseudorandom21 166 Practically a Posting Shark

Blogspot definitely. I have made $40.00 in advertising on two blogs in the last 3 days. You can't argue with results.

pseudorandom21 166 Practically a Posting Shark

Murder is quite common, sometimes necessary. Sorry the world isn't perfect. Hooray! A terrorist is dead!

If only we could rid the ghettos of all the criminals as well we would live in a much better place :D

It could only get better if to rid the government of legalized criminals as well!

pseudorandom21 166 Practically a Posting Shark

Fight Club--it can be interpreted in so many ways.

Romper Stomper is also a classic you may want to check out sometime.

pseudorandom21 166 Practically a Posting Shark

Windows does this already.

pseudorandom21 166 Practically a Posting Shark

Do we really have some situations that we must take the price of code bloat?

Do we really have some situations where we couldn't use assembly?

pseudorandom21 166 Practically a Posting Shark

Unfortunately polystudent, that doesn't seem to be correct in my opinion. I think you should read the directions again, and actually look at the example.

pseudorandom21 166 Practically a Posting Shark

More than likely you subscripted something (probably an STL container) out of range.

http://www.cplusplus.com/reference/std/stdexcept/out_of_range/

pseudorandom21 166 Practically a Posting Shark

probably want to include windows.h before any other includes.