pseudorandom21 166 Practically a Posting Shark

Most of these so called shooters release some extremist bit of propaganda to go along with their act of violence.

I guess it gives them a twisted way to justify what they've done. But if you look closely... most of the reasons are just plain old baloney.

'The reason I am going to shoot up a whole load of people is because 'insert___extremist___rhetoric___here.'

The reason why most these individuals do these things is because they just suck at life... Compounded with clear psychiatric problems, because NO sane individual would shoot up a load of people, this is just like a time bomb waiting to go off.

Unfortunately, with no real psychiatric support and continued rejection in an area of life they clearly suck at, these individuals begin a downward spiral into oblivion.

The sad thing is, all it may have taken, was someone to grab this guy by the scruff of his neck when he was sucking at whatever he was bad at life, shown him how to do it properly... and a few successes later he'd be a normal, happy everyday citizen.

You might shoot up a bunch of people if they were about to become human-flesh-eating zombies.

pseudorandom21 166 Practically a Posting Shark

Meh didn't LulzSec say something about an FBI botnet?

pseudorandom21 166 Practically a Posting Shark
#include <time.h>
time_t whatTime(const char* month, const char* day, const char* year)
{
    time_t rawTime;
    time(&rawTime);
    struct tm* convTime = localtime(&rawTime);
    std::cout << "Today is: " << ((convTime->tm_mon)+1) << "/"
                              << convTime->tm_mday << "/"
                              << convTime->tm_year << std::endl;
}

When using this code I get the output '7/27/111'
Why does the year appear as 111 instead of 11?

tm::tm_year is the number of years since 1900, which is 111.

pseudorandom21 166 Practically a Posting Shark

Interesting, So you must actually believe the US can avoid defaulting/going bankrupt without raising taxes on anyone or anything.... Guess you don't need a military or health-care for senior (I mean they are just a drain on society so just let them die) or poor people (Hope you don't lose your job anytime soon).

Plus if we stop enforcement of the taxes that still remain in place bye-bye revenue so usage fees will have to skyrocket (or is he against that as well...) hum. I guess schools could still be privatized and do we really need all that border security?, or the CIA they're just another massive bureaucracy cut them off too.

Plus if the debt ceiling thing isn't resolved the credit rating will drop so the USA will be paying massive interest so the feds will probably be barely able to cover it, so you might as well cut all federal programs/services. Oh well, if senior now don't have health care or pensions they can go back to work the lazy buggers what do they think their doing "retiring" that's sooo pre-recession.

But the rich will be able to switch to gold so they will be safe from the hyper inflation when the US realizes it can't hope to pay off the debt and starts printing money to pay off the creditors. So alls well (you are relying on your own personal stack of gold for retirement aren't you?)

http://www.youtube.com/user/ronpaul?blend=1&ob=5

pseudorandom21 166 Practically a Posting Shark

I enter u and it stringstreams that. I don't know why but the number comes out very large and if the number isnt greater than -999999999 then run the default numbers. When i enter u, its supposed to use the default number in the text file. And uc changes that default number.I'll add functions and see if it works. Does anyone know how to detect if an inputed string is not a number?

Sorry could you explain that in better English? Basically I'm wondering what: "greater than" "logical not" means.

pseudorandom21 166 Practically a Posting Shark

I do believe there are things worth dying for, but the dude is obviously in the wrong. You don't just kill people to promote a book! Unless the book is going to save the world, but somehow I doubt that if we don't read it the world will split in half and shoot demons from it's core (hey that might be a cool book).

Shooter = Crazy.

pseudorandom21 166 Practically a Posting Shark

What exactly does this do? if(ff1 >! -999999999)

pseudorandom21 166 Practically a Posting Shark

Interesting, So you must actually believe the US can avoid defaulting/going bankrupt without raising taxes on anyone or anything.... Guess you don't need a military or health-care for senior (I mean they are just a drain on society so just let them die) or poor people (Hope you don't lose your job anytime soon).

Plus if we stop enforcement of the taxes that still remain in place bye-bye revenue so usage fees will have to skyrocket (or is he against that as well...) hum. I guess schools could still be privatized and do we really need all that border security?, or the CIA they're just another massive bureaucracy cut them off too.

Plus if the debt ceiling thing isn't resolved the credit rating will drop so the USA will be paying massive interest so the feds will probably be barely able to cover it, so you might as well cut all federal programs/services. Oh well, if senior now don't have health care or pensions they can go back to work the lazy buggers what do they think their doing "retiring" that's sooo pre-recession.

But the rich will be able to switch to gold so they will be safe from the hyper inflation when the US realizes it can't hope to pay off the debt and starts printing money to pay off the creditors. So alls well (you are relying on your own personal stack of gold for retirement aren't you?)

Absolutely, Ron Paul 2012!!!

pseudorandom21 166 Practically a Posting Shark

Hey, I'm wondering if it's a good idea to put my email in the about box of a utility I wrote, and in the source code.

My thinking is the developers or users will be able to contact me if they have problems with it or ever need to update it but I get the feeling it may turn out badly.

What do you think about this idea?

pseudorandom21 166 Practically a Posting Shark

It is normal to have that blank column on the far left, that's where the special stuff goes in a DGV. Yes, you'll have a blank column because you aren't using that column :)

There is no simple way to fix this as you only want to remove the tab from the front of each line (if you removed all the tabs then your pasting into the spreadsheet would no longer align the columns or each line would end up in one cell).

If the data isn't too large, you could read it into a string, use String.Split on the newline characters to get each line, create a new string by combining each of the lines (skipping the first tab) and inserting a newline between each line as you go.

Quick sample here, have not tested and you might have to make modifications:

String clipData = Clipboard.GetText();
String[] lines = clipData.Split(Environment.Newline);
StringBuilder newClipData = new StringBuilder();
foreach (String line in lines) {
    newClipData.Append(line.Substring(line.IndexOf("\t")+1) + Environment.Newline);
}
Clipboard.SetText(newClipData.ToString());

Woohoo! Problem solved, with simple modifications:

private static void DoDataGridClip(DataGridView dgv)
        {
            String clipData = dgv.GetClipboardContent().GetText();
            String[] lines = Regex.Split(clipData, "\r\n");
            //String[] lines = clipData.Split(Environment.NewLine.ToArray<char>());
            StringBuilder newClipData = new StringBuilder();
            foreach (String line in lines)
            {
                newClipData.Append(line.Substring(line.IndexOf("\t") + 1) + Environment.NewLine);
            }
            Clipboard.SetText(newClipData.ToString(), TextDataFormat.Text);
        }
pseudorandom21 166 Practically a Posting Shark

It's placing a tab between each column of the DGV.

Ehh, how would you recommend I fix it? Is it normal to have a blank column on the far left? I get the feeling if I paste this into Excel it will have a blank column on the left, but I don't have Excel :(

pseudorandom21 166 Practically a Posting Shark

They're horizontal tabs according to my hex editor.

0D 0A 09

09 = horizontal tab

Is there something really wrong with this I'm missing?

dgv.SelectAll();
            try
            {
                // Add the selection to the clipboard.
                Clipboard.SetDataObject(dgv.GetClipboardContent(),true);
                this.toolStripStatusLabel1.Text =
                    "Data has been copied to the Clipboard.";
            }
            catch (System.Runtime.InteropServices.ExternalException)
            {
                MessageBeep(MB_ICONEXCLAMATION);
                this.toolStripStatusLabel1.Text =
                    "The Clipboard could not be accessed. Please try again.";
            }
            dgv.ClearSelection();
pseudorandom21 166 Practically a Posting Shark

I copy data from a "DataGridView" to the clipboard, but it contains lots of mysterious tabs that shouldn't be a part of the data, here's a sample of what I mean:

Keywords	Searches
	omaha nebraska apartments 	260
	houses for rent in omaha nebraska 	140
	houses in omaha nebraska 	720

Notice the tabs on the left side of the clipboard data? I don't know where they came from!
When I try to paste that into my OpenOffice "Calc" application (Excel replacement) it is skewed one column to the right, and I'm sure that's unacceptable.

If someone has MS Excel could you try copying & pasting that into a spreadsheet?

pseudorandom21 166 Practically a Posting Shark

Learning C++ is probably going to take you quite a while.

This link will help you at some point,
http://www.cplusplus.com

pseudorandom21 166 Practically a Posting Shark

It's called an imagination, in my country those who don't have one shouldn't be writing a thesis.

Salem commented: Damn straight! +0
pseudorandom21 166 Practically a Posting Shark

I'm probably going to vote for Ron Paul, and join his political party, and put up flyers.

pseudorandom21 166 Practically a Posting Shark

I'm not entirely sure that works.

int i;
                            if(Int32.TryParse((line.Split(' ').Last()),out i))
                            {

Oh sorry my tokens are sometimes separated by tabs...

I finally found my answer too. string[] tokens = Regex.Split(line, @"\s+");

pseudorandom21 166 Practically a Posting Shark
String myString = "omaha nebraska weather 2400";
int myInt = Int32.Parse(myString.Split(' ').Last());

I'm not entirely sure that works.

int i;
                            if(Int32.TryParse((line.Split(' ').Last()),out i))
                            {

Oh sorry my tokens are sometimes separated by tabs...

pseudorandom21 166 Practically a Posting Shark

Hi, currently my application uses panels to put all the controls on and manage docking, but I need a resizable border. How is this done?

pseudorandom21 166 Practically a Posting Shark

I need to extract an integer value from the end of a string, and I'm a little bit lost on algorithm functions/classes in C#.

Is there any sort of convenient class/function to help with this? Here is a sample string:
"omaha nebraska weather 2400"

pseudorandom21 166 Practically a Posting Shark

I recently stumbled upon a boost installer (which I think is awesome), here http://www.boostpro.com/download/

and I was wondering if there is anything similar for QT and Visual Studio 2010?

On the QT Website I found this page, but no VS2010 installer. Will the 2008 one work ?

http://qt.nokia.com/downloads

I suppose if there isn't an installer that works I will build it myself, thanks.

pseudorandom21 166 Practically a Posting Shark

Read a tutorial on C style strings, or better yet "Arrays" in C.

pseudorandom21 166 Practically a Posting Shark

http://msdn.microsoft.com/en-us/library/ms228963.aspx
or maybe http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx


I'm not sure how it fits into your design but couldn't you "Raise" an event every time the progress bar needs updated? Do you know what a delegate is? You may also be able to call an update function directly as opposed to raising an event.

Alternatively maybe this would be fine:

while(something)
{
Application.DoEvents();
}
pseudorandom21 166 Practically a Posting Shark

Well that can be bad under few circumstances. But I dont hate GPL(though I hate it sometimes, when libraries are GPL'ed). The idea of so much restriction in GPL is to support fellow open source developers. I remember an article by RMS, where he explains the reasons.

I know it's a good thing..sort of..

pseudorandom21 166 Practically a Posting Shark

I've found that the math function "y = (x^2)/n" is easy to work with, assume n is the height and width of the window (they need to be the same) and the curve (parabola) the function produces will pass through (0,0) and the upper-right-most coordinate of the viewing window.

So then you have a function to make a parabola that looks like this with a defined height and width (see attachment).

otherwise it's much more complicated, I used this graph for mouse sensitivity in a project. If you knew the math you could use an expression parsing library to find the functions for curves that pass through specific points.

http://www.codeproject.com/KB/recipes/FastMathParser.aspx#idExample

sergent commented: :) +4
pseudorandom21 166 Practically a Posting Shark

Sorry, but that sounds stupid. If you want to increase you skills, why use something that doesn't have the skills you need? Would you ask your little brother to check your calculus homework? Would you ask an armless man to teach you to shoot baskets? Would you ask a blind man to teach you to draw?

Garbage code is garbage code. What positive things can you actually learn from it? You're fighting the learning process all the way.

The intention was purely to add some small amount of credibility to my profile, I assure you.

pseudorandom21 166 Practically a Posting Shark

Hi this project is actually C++/CLI but I expected more useful help from the .NET developers (most things are similar).

So, I have a transparent form (completely transparent) and I want to draw a visible rectangle onto it and since I am using C++/CLI I was hoping to do it in WinForms instead of WPF. A quick google search gave me some results that didn't work (or at least I couldn't make them work.)

--Actually I decided setting the transparency key to "control" works.

pseudorandom21 166 Practically a Posting Shark

You wrote a global hook in a purely .Net platform and are confused as to how to capture a combination of inputs? That seems strange...lol. The former is much more involved than the latter.

Well I was wondering about a better way to do it, the logic gets all confusing using the FSM :(

pseudorandom21 166 Practically a Posting Shark

I was referring to the algorithm. Tweaking the parameters (slope_max, slope_change and line_length) can
produce interesting results. Making slope_change and line_length variable can also yield very interesting results.


There's nothing wrong with hacky multi-line macros. On the contrary, they make my code more boost-like :D

Noo! That's what inline functions are for..

pseudorandom21 166 Practically a Posting Shark

Getting a global windows message hook is not very trivial in C#. This is because in order to capture every proc's messages, you must inject into every procs address space. With a native language this wouldnt be so bad, but since .Net languages require a CLI to run, that would also have to be injected into every proc. (The CLI is by no means lightweight).

Here's some links to check out:
Global Hooks In C#
A class to hook other procs winproc's -> Upon further reading, I am not sure if this is global
More global hooks
Hope this helps!

I've written them before, more than a couple times actually lol.

pseudorandom21 166 Practically a Posting Shark

Nevermind, bad question.

I remember needing to write a program that generates curve functions, as in specify a begin point an end point and a point or points the curve needs to pass through. Sadly I never got around to it.

But! My math teacher told me it involved solving three or more equations .. or something.

pseudorandom21 166 Practically a Posting Shark

Not all people are as selfish as you are. You can sell the free software if you want to(see here). It is free as in freedom, not as in free beer. I want people to modify my program, and make it better. I also want to make it free so everyone can use it. I strongly disagree with US copyright and patent laws. For example, the copyright are intended to protect the author, so he makes money from the book/song or anything else he/she makes. Then why the f*** do copyright laws last 75 years AFTER the author dies. It only encourages big companies like Itunes, and other huge music corporation to become even richer then they already are.

Also, if a singer, became a famous and rich, only then will people pirate his music. So everyone who says, most of the signers in US are poor and they need to earn some money, pirating doesn't hurt them at all. They are poor mostly because of other reasons (crappy singing I will guess). Right now, pirating only makes big singing stars lose some money, which is fair. It makes there earning more closer to what they would earn on a normal REAL job.

There is some kinds of pirating that can hurt people who make things. For example, authors who write books. Most of them are not rich, and books are there only way to get money. I sometimes pirate books on my Kindle, but every BOOK that …

pseudorandom21 166 Practically a Posting Shark

>> "oh shit, not another gung-ho ..."

Alright ardav, I give up. I know you're thinking of someone in particular, but I'm drawing a blank. At least give us a hint.


P.S. What happened to the bad word filter?

At least Ron Paul doesn't seem like a gung-ho, he wants to withdraw the troops, he says we can't afford the war.

I guess the real issue is it more important to have troops somewhere in asia/middle east or is it more important to keep the US economy from crumbling?

I for one would rather not see homeless Americans and soldiers brought back in boxes.

pseudorandom21 166 Practically a Posting Shark

yeah! and that guy is awesome.

Yeah Linus Torvalds is an amazing engineer.

pseudorandom21 166 Practically a Posting Shark

I'm not going to use it, I was just taking the "C programming" skills test on oDesk, and it always uses "void main()" or "main()" and it's god-awful garbage code on the test the whole way through.

I still plan to use oDesk though because the testing thing is at least a nice idea.

pseudorandom21 166 Practically a Posting Shark

I need to know a bit about this "default int" thing in C. What I mean is, is this actually ok and with what version of C is it ok?

main()
{

return 0;
}

As far as I knew this was standard modern C (i.e., no retarded default-int)

int main()
{
return 0;
}
pseudorandom21 166 Practically a Posting Shark

Umm, I'm not sure I would be giving out any personal information even if I have a phone number to call.

pseudorandom21 166 Practically a Posting Shark

I'm no licensing expert but I do know that I hate the GPL, what if someone wants to use a part of your code in a product, or something that you don't want to give the source away? What if *you* want to use a part of it in something you don't want to give the source away? The GPL is just a license saying "you can't sell this and you have to give source code if you use it".

F' the GPL and the "Open Source Initiative" free the code!

The way I see it the GPL is imposing restrictions on the finished product and I don't think that's a good thing. I, understandably as a developer, want free source code instead of free software.

jwenting commented: well said +0
pseudorandom21 166 Practically a Posting Shark

It's becoming that time again where Americans have to choose which idiot to vote for. In recent years I haven't voted nor have I been educated about the candidates, and so for 2012 I have decided to change that.

Firstly, what is a good source of news for learning about our American presidential candidates?

Secondly, what are you opinions on Ron Paul and Barack Obama? I think Barack Obama dodges topics and is mainly full of crap, while Ron Paul is a sensible candidate with clearly defined goals. But I have only read about these candidates from a handful of websites, so I'm uncertain as to the information's validity. Other candidates didn't appeal to my concerns for the state of the union.

So, fellow geeks, where do you find your education before voting?

pseudorandom21 166 Practically a Posting Shark

Hm, does this capture key-strokes outside of the application? That's what I'm using a global low-level keyboard hook for (or was). The library I have been using was acting funny from the start, and it just isn't worth the hassle. I think I'm going to re-write the application (it's rather trivial) using C++/CLI because then I don't have to use a buggy library, it will be easy to write a simple C hook procedure and I can still use my WinForms GUI stuff.

pseudorandom21 166 Practically a Posting Shark

vector will not work because I haven't learned about them yet. So I have to do this using arrays.

Did my post help you any?

xxlt3xx commented: very helpful thank you +0
pseudorandom21 166 Practically a Posting Shark

In the past I used a "Finite State Machine" to follow a sequence of keystrokes to completion, but I don't think it's effective and I was wondering how you guys would implement this:

(I have the keyboard & mouse hook lib worked out)

When a sequence of events (keystrokes & a mouse-click) occur I need to do something while the mouse button is held down. When I used the FSM it was complicated and somewhat hard to debug.

Events = ctrl + shift + lmb down ... lmb up

lmb up ends the sequence.

any ideas?

pseudorandom21 166 Practically a Posting Shark

I think use the vector is better.

vector<int>  neg;
	vector<int> posEven;
	vecotor<int> posOdd;
if (input number<0) poseven.push_back(number);
else if( number>0 && is_Even(number) ) posEven.pub_back(number);

Yes I also agree that the vector is better, it's up to the poster to decide what he wants to use.

pseudorandom21 166 Practically a Posting Shark

I don't normally opt to use applications written in Java because they seem to not be as responsive on my system. If an application written in a different language is available I normally choose it.

If one day soon bleeding-edge PC games are written in Java I will be surprised, but until then I think C/C++ is really the performance king.

pseudorandom21 166 Practically a Posting Shark

Stream manipulator "setw" in <iomanip>

pseudorandom21 166 Practically a Posting Shark

Apple has not opted for an upgradeable storage option with the iPad, for reasons which escape me

^^ It's due purely to stupidity, or perhaps just pure douche-baggery, I can't decide which.

pseudorandom21 166 Practically a Posting Shark

Does this help?

using namespace std;

const string FILENAME = "INTEGERS.TXT";
const string AUTHOR = "Rf";
const string ROLE = ", (s)\n";
const string SOLTXT = "\nSolution by ";
const string INFILE_ERR_MSG = "File does not exist or it is empty!\n";
const int EXIT_ERR_INFILE = -1;  // Error with input file

const int MAX_INT = 500;

bool openFileForInput(ifstream&);
bool getNum(ifstream &inp, ofstream &otp);


int main()
{
	srand ((unsigned int)time(NULL));

	/* Populating INTEGERS.txt */
	ofstream outData(FILENAME.c_str());
	int base = -250;
	for (int i = 0; i < MAX_INT; i++)
		outData << base + rand()%500 << endl;
	outData.close();

	/* Processing INTEGERS.txt */
	ifstream inData;
	if (!openFileForInput(inData))
	{
		cout << INFILE_ERR_MSG;
		system("PAUSE");
		return EXIT_ERR_INFILE;
	}
	
	cout << endl << endl;
	system ("PAUSE");
	return 0;
}

// Open a file for input
// Check for existence of file in current directory
// If file exists, is there any data in the file
bool openFileForInput(ifstream& inp)
{
	inp.open(FILENAME.c_str()); // See if we can open
	inp.peek();  // Determine whether file is not empty
	return (inp && !inp.eof()); // checks if the file exists and not empty
}

bool getNum(ifstream &inp, ofstream &otp)
{
	//Let's start with 3 arrays.
	int neg[MAX_INT] = {0};
	int posEven[MAX_INT] = {0};
	int posOdd[MAX_INT] = {0};
	//Let's also use 3 size_t to store our
	//current index as we populate the arrays.
	size_t negativeSize, positiveEvenSize, positiveOddSize;
	negativeSize = positiveEvenSize = positiveOddSize = 0;

	int temp = 0;
	while(inp >> temp) //<-- this is a safe mechanism for reading the file.
	{
		//Using …
pseudorandom21 166 Practically a Posting Shark

>>Hey mike the "-> bool" specifies a return type?

Yeah, that's the Lambda expression syntax.

It is also a new way to specify return types for normal functions, with the "auto" keyword. As so:

auto my_function() -> int {
  //..
};

This is especially useful for function and class templates where the return type can be contingent on the parameter types in a non-trivial way.

thx.

pseudorandom21 166 Practically a Posting Shark

a software written in python to change the extension of all existing exe files on a system to a randomly generated integer would prevent a conventional virus as knowing the file is an executable and hence from infecting it. i know there are easy ways of getting around this. so this method cant be widespread. but would it work on 1 machine ?

one could write a program to run these exe files with integer extensions quite simply

Or determine it's executable from it's content, .exe files have a special header on Windows systems don't they? I'm unsure, sorry. It depends on the virus, I would say.

pseudorandom21 166 Practically a Posting Shark

While you are using C++0x, then you might as well do:

my_list.remove_if( [](int x) -> bool { return x == 4; } );

Hey mike the "-> bool" specifies a return type?