Programming Regs Lounge

  • 345,645 Views
  • 17,774 Replies
New Topic Respond to this Topic
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Online!
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge Jun. 14th, 2012 @ 03:19 PM Reply

At 6/13/12 05:51 PM, WizMystery wrote: Well, I tried the windows def/include and it still doesn't work. I get the same errors as I did before :/

Made it, all you have to do is add #define __WINDOWS_MM__ after #define RTMIDI_H in the rtmidi.h file and it should work

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jun. 14th, 2012 @ 05:40 PM Reply

At 6/14/12 03:19 PM, kiwi-kiwi wrote:
At 6/13/12 05:51 PM, WizMystery wrote: Well, I tried the windows def/include and it still doesn't work. I get the same errors as I did before :/
Made it, all you have to do is add #define __WINDOWS_MM__ after #define RTMIDI_H in the rtmidi.h file and it should work

Alright it's working perfectly now, thanks again :D

Now I need to figure out how to hook it to different synths besides the default wavetable...

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 17th, 2012 @ 08:07 PM Reply

I wonder if anyone knows why cookies I set using jQuery's cookie module, I can't unset (delete) using PHP? I mean it's so freaking annoying.

I tried looking at Chrome content settings (where all cookies with their params are listed), used identical params - still no go. what the heck

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jun. 17th, 2012 @ 08:37 PM Reply

What happens when you try? They just don't get unset?

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 17th, 2012 @ 09:29 PM Reply

At 6/17/12 08:37 PM, Diki wrote: What happens when you try? They just don't get unset?

yup. I use this module

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jun. 17th, 2012 @ 11:09 PM Reply

I just used this cookie and it removed the cookie just fine:
Setting Cookie

jQuery.cookie("test", "hello world", {"expires":1}});

Accessing/Removing Cookie:

<?php
if (isset($_GET["rmv"]))
{
	setcookie("test", "", time()-1);
	header("Location: cookie.php");
}

$cookie = $_COOKIE['test'];
?>
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="UTF-8">
		
		<title></title>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
		<script src="js/jquery.cookie.js"></script>
	</head>
	<body>
		<?php echo "test => {$cookie}"; ?>
	</body>
</html>

What's your code?
What are you trying to do? It should work.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Online!
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge Jun. 18th, 2012 @ 05:18 PM Reply

If anyone has too much time on their hands and is looking for an interesting challenge, try programming a plugin for the mongoose webserver for some random interpreted language.
I made one for lua and it was tons of fun.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jun. 20th, 2012 @ 02:10 PM Reply

Alright, I think I know enough about the ins and outs of C++ to actually start working on a project now.

Can anyone suggest a starting point if I wanted to go right into making a professionally marketed indie game?

NorskeDrittsekk
NorskeDrittsekk
  • Member since: Apr. 10, 2012
  • Offline.
Forum Stats
Member
Level 02
Musician
Response to Programming Regs Lounge Jun. 20th, 2012 @ 10:12 PM Reply

At 6/20/12 02:10 PM, WizMystery wrote: Alright, I think I know enough about the ins and outs of C++ to actually start working on a project now.

Can anyone suggest a starting point if I wanted to go right into making a professionally marketed indie game?

I think you should sharpen your programming skills before turning to big stuff. Why the hell does every beginner want to do game development while they don't even know what they doing? The irony most comes from C++ wannabes. Surprised the hell out of me.

I was quite surprised that you have troubles with exporting data to certain types of file in C++, which already told me enough about your skills. Talk is cheap, show me your code.

Also, I had been playing and coding around with Rtmidi last week, check your PM, I have some suggestions and examples for you.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jun. 20th, 2012 @ 10:38 PM Reply

At 6/20/12 10:12 PM, NorskeDrittsekk wrote: Why the hell does every beginner want to do game development while they don't even know what they doing?

Because the game can be amended to at any time when I learn more advanced material? I've already established in my mind how classes, pointers, polymorphism, inheritance, etc work - therefore I know the minimum about the language it takes to create a large program of nondescript type, and I've already learned game-specific material such as the loop, states, physics... I really don't see why I can't start with those and gradually look up what I don't know as long as I don't write anything overbearingly and unnecessarily taxing.

I was quite surprised that you have troubles with exporting data to certain types of file in C++, which already told me enough about your skills. Talk is cheap, show me your code.

Well if you want to see an (admittedly useless) program I wrote from scratch I'd be happy to show it to you. I'd honestly like the criticism.

Also, I had been playing and coding around with Rtmidi last week, check your PM, I have some suggestions and examples for you.

There's nothing there :X

Jon-86
Jon-86
  • Member since: Jan. 30, 2007
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Programming Regs Lounge Jun. 21st, 2012 @ 05:59 PM Reply

At 6/14/12 10:56 AM, deckheadtottie wrote: World's first 'tax' on Microsoft's Internet Explorer 7

I'm sure of you will appreciate this article.

One of the best ideas I've seen in ages, I emailed it round all our front end guys and gals when I did and they loved it as well. Shame we don't run eCommerce sites or I'd just implement it and tell our manager later :D

But luckily I'm doing less web work and more application development work, if that makes sense. So IE is becoming less of a nuisance for me anyway. And that can only be a good thing.


PHP Main :: C++ Main :: Java Main :: Vorsprung durch Technik
irc.freenode.net #ngprogramming

BBS Signature
DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to Programming Regs Lounge Jun. 21st, 2012 @ 08:31 PM Reply

Long time no post, and a little bit drunk, but I need to post this somewhere...

Because maybe happiness doesn't need to be measured. Maybe it's something that desires to be released... Something that someone other than yourself can feel, and grab, and relinquish... So that someone else can copy the same pattern. And with that pattern, they can feel that happinesss, they can grab it, and then they can release it.... And although you never feel it yourself, you sit safe in the knowledge that countless others have benefited from it due to your ability to let go, pass on, and share with an otherwise undeserving world. Because maybe it takes that sole-less act and selfless response from somebody - to keep what we have going, and carry on an action-plan that we believe to be routine.


|| Portfolio || Facebook || Twitter ||

BBS Signature
DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to Programming Regs Lounge Jun. 22nd, 2012 @ 12:55 PM Reply

Evidently I was drunker than I thought last night.


|| Portfolio || Facebook || Twitter ||

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jun. 22nd, 2012 @ 02:39 PM Reply

A thread created for discussing programming was a certainly an interesting place to post that opinion. I'll give you that.

Shakyjake
Shakyjake
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Programming Regs Lounge Jun. 24th, 2012 @ 04:52 AM Reply

At 6/14/12 10:56 AM, deckheadtottie wrote: World's first 'tax' on Microsoft's Internet Explorer 7

I'm sure of you will appreciate this article.

Pity it was just a PR stunt. They didn't actually charge you the IE7 tax.

http://www.netmagazine.com/news/retailer-announces-ie7-tax-1 22022
(3rd-last and 2nd-last paragraphs).

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 25th, 2012 @ 08:49 PM Reply

At 6/17/12 11:09 PM, Diki wrote: What's your code?
What are you trying to do? It should work.

Firstly, thanks for your trying to help me. I really appreciate it. Secondly, I really don't have the will to try it again. I just knew it didn't work, and it gave me some frustration, but i overcame it eventually. I'm sure it works if used properly as your demonstrated, so obviously it was my fault.

I'm actually having another difficulty at the moment, with URL rewriting. I'm trying to match anything after a slash.
In brief:

http://something.com/folder/nicenicenice - works
but
http://something.com/folder/http%3A%2F%2Fwww.youtube.com%2Fw atch%3Fv%3D7pxFl01RHF8 -- doesnt work

This is my regexp:

^folder\/(.*)$ file.php?param=$1

Yeah. greedy. Any ideas why (.*) doesn't accept chars outside of A-z0-9 range?

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jun. 25th, 2012 @ 10:22 PM Reply

You cannot match a query string using an HTACCESS file with a rewrite rule.
The greedy match should be matching everything up to the question mark, in other words you should be getting http://www.youtube.com/watch as the value of the GET variable "param". If not it might be caused by you escaping the forward slash, though I'm pretty sure that won't make any difference (you can exclude the backslash).

So, if you want to pass a YouTube link to your site using an HTACCESS redirect then you would really only need to pass the query string value 7pxFl01RHF8, which you can then easily turn into http://www.youtube.com/watch?v=7pxFl01RHF8.

Long story short: you can't match query strings.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jun. 25th, 2012 @ 10:29 PM Reply

At 6/25/12 10:22 PM, Diki wrote: So, if you want to pass a YouTube link to your site using an HTACCESS redirect then you would really only need to pass the query string value 7pxFl01RHF8, which you can then easily turn into http://www.youtube.com/watch?v=7pxFl01RHF8.

Just to clarify, by this I mean you would do something like this: http://something.com/folder/7pxFl01RHF8.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jun. 25th, 2012 @ 11:11 PM Reply

At 6/20/12 10:12 PM, NorskeDrittsekk wrote: Also, I had been playing and coding around with Rtmidi last week, check your PM, I have some suggestions and examples for you.

Whatever happened to this :X

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 26th, 2012 @ 11:34 AM Reply

At 6/25/12 10:22 PM, Diki wrote: Long story short: you can't match query strings.

Yeah, it seems that's the case. So I decided to go the easy way I use base64 instead of encoding URLs.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to Programming Regs Lounge Jun. 28th, 2012 @ 05:30 PM Reply

At 6/27/12 11:49 PM, Diki wrote: ASUS really dropped the ball on security.

yowch. I'm glad I don't have an ASUS server, as there doesn't seem to be a fix yet.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 28th, 2012 @ 08:07 PM Reply

Guys, I need a lil favor.
I got this lilttle job to make a mirror of a site (using wget) and some other stuff, but the problem is that wget downloaded the site's file's like this Index.aspx_l=IT and QueryForm.aspx_pd=0512e548-fc63-42fb-a27b-bf77459a299b&l=IT. Notice, ? character got replaced with _ char. I need a mod_rewrite regexp to make it work. This is the site at my server: http://labs.recgr.com/labs/ts/

This is my htaccess:

AddType text/html .wshtml .aspx
AddHandler text/html .wshtml .aspx

RewriteEngine On
Options +FollowSymLinks

RewriteRule ^(.*)\.aspx\?(.*)$ $1.apsx_$2

Not working. Any ideas? Thanks bros

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Online!
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge Jun. 28th, 2012 @ 08:14 PM Reply

Yesterday I found out that casting operators can be overriden.
Of course the first use case I could think of was trolling:

operator Base*(){return NULL; // You shall not cast}

I didn't actually write this anywhere, it was just a thought crossing my mind.

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 29th, 2012 @ 04:42 PM Reply

Google released Chrome for iOS today. It's beyond neat.

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge Jun. 30th, 2012 @ 02:00 PM Reply

At 6/28/12 08:07 PM, NinoGrounds wrote: Guys, I need a lil favor.
I got this lilttle job to make a mirror of a site (using wget) and some other stuff, but the problem is that wget downloaded the site's file's like this Index.aspx_l=IT and QueryForm.aspx_pd=0512e548-fc63-42fb-a27b-bf77459a299b&l=IT. Notice, ? character got replaced with _ char. I need a mod_rewrite regexp to make it work. This is the site at my server: http://labs.recgr.com/labs/ts/

This is my htaccess:

AddType text/html .wshtml .aspx
AddHandler text/html .wshtml .aspx

RewriteEngine On
Options +FollowSymLinks

RewriteRule ^(.*)\.aspx\?(.*)$ $1.apsx_$2

Not working. Any ideas? Thanks bros

Update on this. I decided not to use htacess for rewriting because I found out linux filenames can contain ? (unlike windows). So, I managed to upload files named like Dictionary.aspx?dctc=B&l=HR to the server, but when I go for its URL (http://labs.recgr.com/terme/Dictionary.aspx?dctc=B&l=HR), I still get a not found error.

Any ideas?

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jul. 1st, 2012 @ 12:11 AM Reply

Just a general C++ question:

How can I declare a class object in a narrow scope and be able to delete it outside of that scope?

Basically what I'm doing is creating a World class to hold all the objects (other class objects) relevant to a certain World State of a game. I have a function which is supposed to declare all objects, each dynamically allocated, and put it in a list private to the World class. From the list I'm able to do anything I want to the objects, but when I want to initialize to the next level (delete the current world object in main, make a new one, and call the Init function), I've found I have no way of deleting the objects from inside the World class. Does deleting world also delete all objects inside of it?

Even if that's so, I want to be able to somehow delete an object from the scope of the list, but that's not looking like it's possible.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jul. 1st, 2012 @ 12:46 AM Reply

I assume by "list" you mean the std::list container.
If you want to de-allocate all of the elements that contain dynamically allocated data you could just do something like this:

while (yourList.empty() == false)
{
	delete yourList.back();
	yourList.pop_back();
}

If that doesn't help then you should post your code, it will give me a better idea of your problem.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge Jul. 1st, 2012 @ 12:50 AM Reply

At 6/30/12 02:00 PM, NinoGrounds wrote: So, I managed to upload files named like Dictionary.aspx?dctc=B&l=HR to the server, but when I go for its URL (http://labs.recgr.com/terme/Dictionary.aspx?dctc=B&l=HR), I still get a not found error.

Any ideas?

You cannot have a question mark in the filename and then browse to that file on Apache; it just doesn't work that way.
The query string gets in the way and Apache can't find the file. That's what is producing your 404 error.

Why do you need query strings to be in the filename?
I can't fathom why you would ever need to do that.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge Jul. 1st, 2012 @ 01:03 AM Reply

At 7/1/12 12:46 AM, Diki wrote: I assume by "list" you mean the std::list container.
If you want to de-allocate all of the elements that contain dynamically allocated data you could just do something like this:

while (yourList.empty() == false)
{
delete yourList.back();
yourList.pop_back();
}

If that doesn't help then you should post your code, it will give me a better idea of your problem.

Oh...

Actually that answers my question completely. (yes, I meant std::list)