• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:14
CEST 19:14
KST 02:14
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro8 Preview Pt2: Progenitors0Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results02026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Code S Season 1 (2026) - RO12 Results Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid
Tourneys
RSL Revival: Season 5 - Qualifiers and Main Event GSL Code S Season 1 (2026) SC2 INu's Battles#15 <BO.9 2Matches> WardiTV Spring Cup SEL Masters #6 - Solar vs Classic (SC: Evo)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
BW General Discussion Why there arent any 256x256 pro maps? [ASL21] Ro8 Preview Pt2: Progenitors BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[Megathread] Daily Proleagues [ASL21] Ro8 Day 2 Escore Tournament StarCraft Season 2 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread Daigo vs Menard Best of 10 Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1230 users

The Big Programming Thread - Page 456

Forum Index > General Forum
Post a Reply
Prev 1 454 455 456 457 458 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Rollin
Profile Joined March 2011
Australia1552 Posts
March 13 2014 17:41 GMT
#9101
On March 14 2014 02:17 LaNague wrote:I dont know you and i dont know where this class is held, but i have seen a lot of young students who think they know everything better than the professor because they had a bit of experience and the intro course is boring to them and they make the mistake of thinking the level of the course is the level the professor operates at on a daily basis.

I hear ya. If I notice it in myself I try to correct that attitude too hey, it's not good for anyone.

If you're truly ahead of the current teaching material then extend it as much as you can to test yourself and get a potentially deeper understanding, even if it's not required of the course.
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
Cyx.
Profile Joined November 2010
Canada806 Posts
March 13 2014 20:02 GMT
#9102
On March 14 2014 02:41 Rollin wrote:
Show nested quote +
On March 14 2014 02:17 LaNague wrote:I dont know you and i dont know where this class is held, but i have seen a lot of young students who think they know everything better than the professor because they had a bit of experience and the intro course is boring to them and they make the mistake of thinking the level of the course is the level the professor operates at on a daily basis.

I hear ya. If I notice it in myself I try to correct that attitude too hey, it's not good for anyone.

If you're truly ahead of the current teaching material then extend it as much as you can to test yourself and get a potentially deeper understanding, even if it's not required of the course.

Yeah... I honestly was just having a shitty day, I really do like that teacher and I feel bad for even having said anything now. At least it was on the Internet and not in real life... I feel stupid now but at least only people on teamliquid know ^^
ceycey
Profile Joined March 2014
Netherlands3 Posts
March 14 2014 13:58 GMT
#9103
On March 09 2014 03:26 Vladix wrote:
Friends of mine are "playing" this game :

http://theaigames.com/competitions/conquest

It is about making a bot to play "Risk".
Perhaps some of you guys will enjoy it.


I saw a nice thread on a Dutch forum about this competition: link.

Here's my attempt at translation:

(link to image, because I can't post images yet..): image

Warlight AI Challenge (the name just changed from Conquest to Warlight AI Challenge, as it's in cooperation with Warlight) is a Risk-type game, where you place troops in regions on a map, attack and eventually wipe your enemies off the face of the earth.

The AI Games (sponsored by StarApple) is a programming contest (platform) that publishes programming competitions where you write programs that play games, this time with a grand prize of 1024 euros (~1400 dollars). Other prizes are lower powers of 2 euros (e.g. 512, 256, 128 etc).

The Game
In the picture you see a world map. To start off, you give your preferences regarding starting posititions, these will receive two troops each. On the countries that aren't owned by any players, two neutral troops will be placed who will only defend.

War! Both players receive five troops each turn plus any bonusses they might have for owning any continents, and give orders that are executed in order, but randomly alternated between orders of the opponent it might happen that a transfer turns into an attack, or the troops you wanted to transfer are already dead after an enemy attack. Upon wiping the enemym you win.

Need to know
* Difficulty: easy - 20 lines of Java are enough of a base, so you'll only have to insert your own strategy - to intermediate, depending on the 'quality' of your own bot.
* Finals: Somewhere in May, make sure your bot passes the qualifying rounds that already running and gets to the top 24 (48 if there enough competitors).
* Allowed languages: C, C++ (-std=c++0x), C# (Mono 2.10.8), Java, PHP, Python and Go. Scala might come in the near future.

Useful links
Competition Site
Game Description
Getting started (and rules)
Server Source Code
Warlight (the actual game the competition is based on)
Java Starter Bot

Tips
In the current competition, only a single map is used, which can be analysed for better results.
More troops mean higher difference needed between attacking and defending troops.

P.S. I wanted to open a new thread for this competition (like the thread linked above), but I can't make it as nice, with images and all, 'cause I'm new. If anyone else wants to, feel free to do so.
Every day is a day
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-03-15 00:34:01
March 15 2014 00:28 GMT
#9104
--- Nuked ---
KurtistheTurtle
Profile Blog Joined December 2008
United States1966 Posts
March 15 2014 00:44 GMT
#9105
Hey, I'm a newer (<5 months) rails developer and it's finally time to work through some of my blind-spots:

What are some good resources for (all this front-end stuff):

- html/css/scss & bootstrap
- javascript
- jquery
- coffeescript?

And when I say good resources, this is what I mean: they explain what the best code looks like, WHY it is that way, and then how to produce it

and I mean books, courses, screencasts, everything - what's worked for you, or that you know of? I'm in the investigation phase right now
“Reject your sense of injury and the injury itself disappears."
ceycey
Profile Joined March 2014
Netherlands3 Posts
March 15 2014 12:46 GMT
#9106
On March 15 2014 09:28 Nesserev wrote:
Show nested quote +
On March 14 2014 22:58 ceycey wrote:
Warlight AI Challenge (the name just changed from Conquest to Warlight AI Challenge, as it's in cooperation with Warlight) is a Risk-type game, where you place troops in regions on a map, attack and eventually wipe your enemies off the face of the earth.

The AI Games (sponsored by StarApple) is a programming contest (platform) that publishes programming competitions where you write programs that play games, this time with a grand prize of 1024 euros (~1400 dollars). Other prizes are lower powers of 2 euros (e.g. 512, 256, 128 etc).

Thanks for the link to this contest. Didn't know about it, and I was looking for a cool project Great first post. Welcome!!
Probably gonna pull an alnighter, this is very interesting...

The server code is kinda messy, also, lack of comments
But I was able to get the local server running, and now working on my bot in python (python is the way to go imo). The highest bots seem to be very optimized already.

EDIT: You can join/form institutions, and the best institution gets a prize. If more people here on teamliquid are interested, we could form an institution ourselves and try to win...


Thanks,

I have just used the starterbot and have optimize my bot yet, but I am the first user of organization teamliquid . Should be fun if tehre are more teamliquid members, you need 5 to go for the price.

Every day is a day
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
March 16 2014 00:50 GMT
#9107
I have recently completed an online assessment for a job (Graduate Software Developer for an insurance company). Questions were:

1) Numerical reasoning (percentages, ratio, graphs, etc)
2) Logical reasoning (very similar to IQ tests where you get a few figures, and you have to predict the next one)

Really weird test, but I hope I have done well.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
March 18 2014 17:12 GMT
#9108
Hey I have a question about Jmeter. I started using it for a school project and was just curious:

With Jmeter, can the bottleneck to your test results be your computer or network traffic? Say you make 500 requests in 50 seconds. What if the server can respond to all the requests but jmeter takes time to process them all? Doesn't that make your computer the bottleneck? If 500 actual users tested your server they might not see any problems whereas you would?
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
March 18 2014 19:43 GMT
#9109
On March 15 2014 09:44 KurtistheTurtle wrote:
Hey, I'm a newer (<5 months) rails developer and it's finally time to work through some of my blind-spots:

What are some good resources for (all this front-end stuff):

- html/css/scss & bootstrap
- javascript
- jquery
- coffeescript?

And when I say good resources, this is what I mean: they explain what the best code looks like, WHY it is that way, and then how to produce it

and I mean books, courses, screencasts, everything - what's worked for you, or that you know of? I'm in the investigation phase right now


What worked for me was getting into some hard projects with very basic initial knowledge. I've had to check tons of examples and do a lot of research to make things work. That's for html/css. You just need some practice with it and then it becomes relatively easy. I'd find some reading on good page design and SEO (especially how important various html blocks are and how to utilize them) this helps a lot. Basically, the biggest leap I've made was when reading about creating pages for blind people, this puts huge emphasis on correct tag usage throughout the page to work properly with 'read the page aloud to me' software.

You shouldn't worry too much about how your html/css/js code looks like. Just make it as readable as possible and later it's all most likely going to be stripped of whitespaces and compressed so the deployed code hasn't got much to do with how it looked in the beginning.

Also, a useful tip. When working with html it's a good idea to add comments on begin and end of certain blocks/sections/divs. This makes your life much easier down the line (and I know a few back end developers who praised me greatly for doing that).
Time is precious. Waste it wisely.
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2014-03-19 01:17:28
March 19 2014 00:57 GMT
#9110
On March 19 2014 02:12 obesechicken13 wrote:
Hey I have a question about Jmeter. I started using it for a school project and was just curious:

With Jmeter, can the bottleneck to your test results be your computer or network traffic? Say you make 500 requests in 50 seconds. What if the server can respond to all the requests but jmeter takes time to process them all? Doesn't that make your computer the bottleneck? If 500 actual users tested your server they might not see any problems whereas you would?


It's possible but if it were me I would want to prove it was JMeter instead of just assuming that to be the case. There are a couple different ways to do this:

Find a way to log out the server performance time of a request. You should be able to find a correlation between the results of JMeter and the server performance.

Use a tool such as AB to benchmark the same requests without processing them. If you don't process the responses and you still see a bottleneck then it's probably the server that is having problems.

Edit: How about some more info. What is the server? What are you doing on the server?
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
March 19 2014 01:41 GMT
#9111
On March 19 2014 09:57 berated- wrote:
Show nested quote +
On March 19 2014 02:12 obesechicken13 wrote:
Hey I have a question about Jmeter. I started using it for a school project and was just curious:

With Jmeter, can the bottleneck to your test results be your computer or network traffic? Say you make 500 requests in 50 seconds. What if the server can respond to all the requests but jmeter takes time to process them all? Doesn't that make your computer the bottleneck? If 500 actual users tested your server they might not see any problems whereas you would?


It's possible but if it were me I would want to prove it was JMeter instead of just assuming that to be the case. There are a couple different ways to do this:

Find a way to log out the server performance time of a request. You should be able to find a correlation between the results of JMeter and the server performance.

Use a tool such as AB to benchmark the same requests without processing them. If you don't process the responses and you still see a bottleneck then it's probably the server that is having problems.

Edit: How about some more info. What is the server? What are you doing on the server?

It's an EC2 server. So the load never grows too much over the server capacity for long as new instances start up automatically.

All we're doing is requesting data from the database and displaying it in a table.
Oh and logging in.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
berated-
Profile Blog Joined February 2007
United States1134 Posts
March 19 2014 08:23 GMT
#9112
On March 19 2014 10:41 obesechicken13 wrote:
Show nested quote +
On March 19 2014 09:57 berated- wrote:
On March 19 2014 02:12 obesechicken13 wrote:
Hey I have a question about Jmeter. I started using it for a school project and was just curious:

With Jmeter, can the bottleneck to your test results be your computer or network traffic? Say you make 500 requests in 50 seconds. What if the server can respond to all the requests but jmeter takes time to process them all? Doesn't that make your computer the bottleneck? If 500 actual users tested your server they might not see any problems whereas you would?


It's possible but if it were me I would want to prove it was JMeter instead of just assuming that to be the case. There are a couple different ways to do this:

Find a way to log out the server performance time of a request. You should be able to find a correlation between the results of JMeter and the server performance.

Use a tool such as AB to benchmark the same requests without processing them. If you don't process the responses and you still see a bottleneck then it's probably the server that is having problems.

Edit: How about some more info. What is the server? What are you doing on the server?

It's an EC2 server. So the load never grows too much over the server capacity for long as new instances start up automatically.

All we're doing is requesting data from the database and displaying it in a table.
Oh and logging in.


The server performance log is still going to be valuable. You mention that you see a problem, what is the problem? I think you are trivializing the problem, there is a lot that can go wrong with just logging in and selecting rows from a table. Ec2 server running what? Are you using database pooling to get to table and results? What is the size of the pool if so? What is the size of the table you are querying? what is the size of the result set you are returning? You're not locking the table right? Is the result set big enough that you need an index and you don't have one?

When running benmarks against a server, I've more often ran into the limitations of the server before limitations of the benchmark tool.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
March 19 2014 09:49 GMT
#9113
On March 19 2014 17:23 berated- wrote:
Show nested quote +
On March 19 2014 10:41 obesechicken13 wrote:
On March 19 2014 09:57 berated- wrote:
On March 19 2014 02:12 obesechicken13 wrote:
Hey I have a question about Jmeter. I started using it for a school project and was just curious:

With Jmeter, can the bottleneck to your test results be your computer or network traffic? Say you make 500 requests in 50 seconds. What if the server can respond to all the requests but jmeter takes time to process them all? Doesn't that make your computer the bottleneck? If 500 actual users tested your server they might not see any problems whereas you would?


It's possible but if it were me I would want to prove it was JMeter instead of just assuming that to be the case. There are a couple different ways to do this:

Find a way to log out the server performance time of a request. You should be able to find a correlation between the results of JMeter and the server performance.

Use a tool such as AB to benchmark the same requests without processing them. If you don't process the responses and you still see a bottleneck then it's probably the server that is having problems.

Edit: How about some more info. What is the server? What are you doing on the server?

It's an EC2 server. So the load never grows too much over the server capacity for long as new instances start up automatically.

All we're doing is requesting data from the database and displaying it in a table.
Oh and logging in.


The server performance log is still going to be valuable. You mention that you see a problem, what is the problem? I think you are trivializing the problem, there is a lot that can go wrong with just logging in and selecting rows from a table. Ec2 server running what? Are you using database pooling to get to table and results? What is the size of the pool if so? What is the size of the table you are querying? what is the size of the result set you are returning? You're not locking the table right? Is the result set big enough that you need an index and you don't have one?

When running benmarks against a server, I've more often ran into the limitations of the server before limitations of the benchmark tool.

Good to know. Thanks!
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
Last Edited: 2014-03-19 14:16:29
March 19 2014 13:55 GMT
#9114
Long shot here, but I'll give it a try. I have this recaptcha code that for some reason always fails. The thing is, I took it from another form/php script I have that works correctly, and I can't figure out why one works and the other doesn't. Here is the working form and php script, I'm removing the public/private keys and emails:
+ Show Spoiler +

<form id="myform" action="php/suggestionFunc.php" method="post" title="suggestion" >

<fieldset>
<legend>Service Area</legend>

<div class="option">
<select name="serviceArea" required>
<option value="" selected />Select...</option>
<option value="Website" />Website</option>
<option value="Reference" />Reference</option>
<option value="Circulation" />Circulation</option>
<option value="Collection" />Collection</option>
<option value="Instruction" />Instruction</option>
</select>
</div>

</fieldset>

<fieldset>
<legend>Comment</legend>
<div>


<div class="fm-req">
<label for="comments">Comments: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Optional" />
</div>

<div class="radio">
<ul>
<li><input class="radio" type="radio" name="status" value="Faculty" checked /> <label>Faculty</label></li>
<li><input class="radio" type="radio" name="status" value="Staff" /> <label>Staff</label></li>
<li><input class="radio" type="radio" name="status" value="Student" /> <label>Student</label></li>
<li><input class="radio" type="radio" name="status" value="Other" /> <label>Other</label></li>
</ul>
</div>
</fieldset>
<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>


<?php
// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */
$emailSubject = 'Suggestion Box';
$EmailTo = 'removed';


/* Data Variables */
$serviceField = $_POST['serviceArea'];
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Service Area: $serviceField <br/>
Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
Permission to post publicly: $permissionField <br/>
EOD;

$headers = "From: Suggestion_Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;
echo "<script>alert('Thank you for your submission');</script>";
}

?>



These are two separate files, obviously, I'm just combing them here. Here is the non-working recaptcha form and php:

+ Show Spoiler +


<legend>Complaint:</legend>
<form id="myform" action="php/complaintFunc.php" method="post" title="suggestion" >
<div class="fm-req">
<label for="comments">Issue: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Name" required />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Email" required />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Phone" required />
</div>


<div id="radio">
<input type="radio" id="radio1" name="status" value="Faculty"><label for="radio1">Faculty</label>
<input type="radio" id="radio2" name="status" value="Student"><label for="radio2">Student</label>
<input type="radio" id="radio3" name="status" value="Staff"><label for="radio3">Staff</label>
<input type="radio" id="radio4" name="status" value="Other"><label for="radio4">Other</label>
</div>
</fieldset>

<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>

<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>

<?php

// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */


$emailSubject = 'Complaint';
$EmailTo = 'removed';


/* Data Variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
EOD;

$headers = "From: Complaint Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;

}


?>




Anyone have experience with these?
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
aksfjh
Profile Joined November 2010
United States4853 Posts
March 19 2014 14:06 GMT
#9115
On March 19 2014 22:55 HardlyNever wrote:
Long shot here, but I'll give it a try. I have this recaptcha code that for some reason always fails. The thing is, I took it from another form/php script I have that works correctly, and I can't figure out why one works and the other doesn't. Here is the working form and php script, I'm removing the public/private keys and emails:
+ Show Spoiler +

<form id="myform" action="php/suggestionFunc.php" method="post" title="suggestion" >

<fieldset>
<legend>Service Area</legend>

<div class="option">
<select name="serviceArea" required>
<option value="" selected />Select...</option>
<option value="Website" />Website</option>
<option value="Reference" />Reference</option>
<option value="Circulation" />Circulation</option>
<option value="Collection" />Collection</option>
<option value="Instruction" />Instruction</option>
</select>
</div>

</fieldset>

<fieldset>
<legend>Comment</legend>
<div>


<div class="fm-req">
<label for="comments">Comments: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Optional" />
</div>

<div class="radio">
<ul>
<li><input class="radio" type="radio" name="status" value="Faculty" checked /> <label>Faculty</label></li>
<li><input class="radio" type="radio" name="status" value="Staff" /> <label>Staff</label></li>
<li><input class="radio" type="radio" name="status" value="Student" /> <label>Student</label></li>
<li><input class="radio" type="radio" name="status" value="Other" /> <label>Other</label></li>
</ul>
</div>
</fieldset>
<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>


<?php
// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"];

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */
$emailSubject = 'Suggestion Box';
$EmailTo = 'removed';


/* Data Variables */
$serviceField = $_POST['serviceArea'];
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Service Area: $serviceField <br/>
Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
Permission to post publicly: $permissionField <br/>
EOD;

$headers = "From: Suggestion_Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;
echo "<script>alert('Thank you for your submission');</script>";
}

?>



These are two separate files, obviously, I'm just combing them here. Here is the non-working recaptcha form and php:

+ Show Spoiler +


<legend>Complaint:</legend>
<form id="myform" action="php/complaintFunc.php" method="post" title="suggestion" >
<div class="fm-req">
<label for="comments">Issue: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Name" required />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Email" required />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Phone" required />
</div>


<div id="radio">
<input type="radio" id="radio1" name="status" value="Faculty"><label for="radio1">Faculty</label>
<input type="radio" id="radio2" name="status" value="Student"><label for="radio2">Student</label>
<input type="radio" id="radio3" name="status" value="Staff"><label for="radio3">Staff</label>
<input type="radio" id="radio4" name="status" value="Other"><label for="radio4">Other</label>
</div>
</fieldset>

<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>

<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>

<?php

// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"];

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */


$emailSubject = 'Complaint';
$EmailTo = 'removed';


/* Data Variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
EOD;

$headers = "From: Complaint Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;




?>

}



Anyone have experience with these?

I don't know php really at all, but the 2nd code snippet (the broken one) has the tag to end the php snippet before the curly bracket to end the if-else block. Just a guess.
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
March 19 2014 14:17 GMT
#9116
Sorry, that was just a typo. I had to do some minor code editing in the actual post, and that got moved. I fixed it.
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
Chezus
Profile Joined January 2011
Netherlands427 Posts
March 19 2014 14:29 GMT
#9117
On March 09 2014 03:26 Vladix wrote:
Friends of mine are "playing" this game :

http://theaigames.com/competitions/conquest

It is about making a bot to play "Risk".
Perhaps some of you guys will enjoy it.


Hey, thanks! Gonna have a lot of fun with this.
Khainer
Profile Joined May 2011
Netherlands54 Posts
March 19 2014 18:40 GMT
#9118
This is my account: http://theaigames.com/players/khainer
My bot is currently at version 22 and finally winning some stuff
Its written in Java.
"Move or be moved" -Spawn
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
March 19 2014 18:54 GMT
#9119
On March 19 2014 22:55 HardlyNever wrote:
Long shot here, but I'll give it a try. I have this recaptcha code that for some reason always fails. The thing is, I took it from another form/php script I have that works correctly, and I can't figure out why one works and the other doesn't. Here is the working form and php script, I'm removing the public/private keys and emails:
+ Show Spoiler +

<form id="myform" action="php/suggestionFunc.php" method="post" title="suggestion" >

<fieldset>
<legend>Service Area</legend>

<div class="option">
<select name="serviceArea" required>
<option value="" selected />Select...</option>
<option value="Website" />Website</option>
<option value="Reference" />Reference</option>
<option value="Circulation" />Circulation</option>
<option value="Collection" />Collection</option>
<option value="Instruction" />Instruction</option>
</select>
</div>

</fieldset>

<fieldset>
<legend>Comment</legend>
<div>


<div class="fm-req">
<label for="comments">Comments: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Optional" />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Optional" />
</div>

<div class="radio">
<ul>
<li><input class="radio" type="radio" name="status" value="Faculty" checked /> <label>Faculty</label></li>
<li><input class="radio" type="radio" name="status" value="Staff" /> <label>Staff</label></li>
<li><input class="radio" type="radio" name="status" value="Student" /> <label>Student</label></li>
<li><input class="radio" type="radio" name="status" value="Other" /> <label>Other</label></li>
</ul>
</div>
</fieldset>
<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>


<?php
// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"];

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */
$emailSubject = 'Suggestion Box';
$EmailTo = 'removed';


/* Data Variables */
$serviceField = $_POST['serviceArea'];
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Service Area: $serviceField <br/>
Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
Permission to post publicly: $permissionField <br/>
EOD;

$headers = "From: Suggestion_Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;
echo "<script>alert('Thank you for your submission');</script>";
}

?>



These are two separate files, obviously, I'm just combing them here. Here is the non-working recaptcha form and php:

+ Show Spoiler +


<legend>Complaint:</legend>
<form id="myform" action="php/complaintFunc.php" method="post" title="suggestion" >
<div class="fm-req">
<label for="comments">Issue: </label>
<textarea rows="5" cols="50" name="comments" id="comments" placeholder="enter comments" required ></textarea>
</div>

</div>
</fieldset>



<fieldset>
<legend>Contact Information:</legend>

<p>(Optional, If you would like a response)</p>
<br>
<div class="fm-opt">
<label for=name>Name:</label>
<input type="text" size="50" name="name" id="name" placeholder="Name" required />
</div>

<div class="fm-opt">
<label for=email>E-Mail:</label>
<input type="email" size="50" name="email" id="email" placeholder="Email" required />
</div>

<div class="fm-opt">
<label for=phone>Phone:</label>
<input type="text" size="50" name="phone" id="phone" placeholder="Phone" required />
</div>


<div id="radio">
<input type="radio" id="radio1" name="status" value="Faculty"><label for="radio1">Faculty</label>
<input type="radio" id="radio2" name="status" value="Student"><label for="radio2">Student</label>
<input type="radio" id="radio3" name="status" value="Staff"><label for="radio3">Staff</label>
<input type="radio" id="radio4" name="status" value="Other"><label for="radio4">Other</label>
</div>
</fieldset>

<?php
require_once('php/recaptchalib.php');
$publickey = "removed"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>

<div id="fm-submit">
<input id="submit" type="submit" name="Submit" value="Submit" />
<input id="reset" type="reset" name="Reset" value="Reset" />
</div>
</form>

<?php

// recaptcha check from recaptcha page
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"];

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
echo"<script>alert('The captcha was incorrect, please try again.');</script>";
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {

//successful captcha, sends email
$captcha = true;
/* subject and email variables */


$emailSubject = 'Complaint';
$EmailTo = 'removed';


/* Data Variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$statusField = $_POST['status'];
$commentsField = $_POST['comments'];
$permissionField = $_POST['public'];

$body = <<<EOD

Name : $nameField <br/>
Email : $emailField <br/>
Phone : $phoneField <br/>
Status : $statusField <br/>
Comments : $commentsField <br/>
EOD;

$headers = "From: Complaint Box\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($EmailTo, $emailSubject, $body ,$headers);

/* User Results */

$theResults = <<<EOD


EOD;

}


?>




Anyone have experience with these?


I got it working. I just got frustrated and copied the entire form and function and edited it from there. Honestly, I'm not sure what broke it still, but it's working now at least.
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
Last Edited: 2014-03-20 05:57:24
March 20 2014 05:48 GMT
#9120
Ok, I have a bit of a problem with character encoding in C#.

I have this:

string[] lines = File.ReadAllLines (@"path\to\file");


Then I enter the loop to parse all lines and extract substrings from them that I need. The problem I'm facing is that the file is encoded in ASCII (has to be) and I'm not quite sure how to enforce this encoding on the stream I'm getting from the file (not to mention that I want to add write to file part soon and it'll have to be in ASCII too). Do I have to change it to byte[] and make it a char array? That would be very inconvenient since I'm using quite a lot of quite long strings in there (lines are ~400 characters wide) and actually very few characters in there are using non-latin letters (which I want to preserve in my strings).

Do any of you have experience with this sort of stuff?
Time is precious. Waste it wisely.
Prev 1 454 455 456 457 458 1032 Next
Please log in or register to reply.
Live Events Refresh
uThermal 2v2 Circuit
14:00
Season 2 - May 2026
RotterdaM747
uThermal488
mouzHeroMarine472
IndyStarCraft 228
SteadfastSC199
elazer76
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 747
uThermal 488
mouzHeroMarine 472
IndyStarCraft 228
SteadfastSC 199
Railgan 114
elazer 76
StarCraft: Brood War
Britney 29466
Horang2 1752
EffOrt 1246
Shuttle 1226
ggaemo 512
Hyuk 239
firebathero 231
Leta 165
PianO 128
Dewaltoss 117
[ Show more ]
Sharp 86
actioN 74
ToSsGirL 52
Barracks 51
Hm[arnc] 32
Pusan 26
Sacsri 26
Rock 23
Terrorterran 16
Shine 11
Dota 2
Gorgc6891
qojqva2696
monkeys_forever254
Fuzer 224
Counter-Strike
fl0m1652
olofmeister437
Heroes of the Storm
Khaldor477
MindelVK9
Other Games
B2W.Neo1457
Liquid`RaSZi1195
FrodaN1080
Beastyqt908
KnowMe192
mouzStarbuck40
Organizations
Other Games
BasetradeTV572
gamesdonequick429
Dota 2
PGL Dota 2 - Main Stream70
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• Adnapsc2 12
• Reevou 3
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV695
League of Legends
• Jankos2391
Other Games
• imaqtpie397
• Shiphtur331
Upcoming Events
BSL
1h 46m
IPSL
1h 46m
eOnzErG vs TBD
G5 vs Nesh
Patches Events
6h 46m
Replay Cast
15h 46m
Wardi Open
16h 46m
Afreeca Starleague
16h 46m
Jaedong vs Light
Monday Night Weeklies
22h 46m
Replay Cast
1d 6h
Sparkling Tuna Cup
1d 16h
Afreeca Starleague
1d 16h
Snow vs Flash
[ Show More ]
WardiTV Invitational
1d 17h
GSL
2 days
Classic vs Cure
Maru vs Rogue
GSL
3 days
SHIN vs Zoun
ByuN vs herO
OSC
3 days
OSC
3 days
Replay Cast
4 days
Escore
4 days
The PondCast
4 days
WardiTV Invitational
4 days
Replay Cast
5 days
CranKy Ducklings
5 days
RSL Revival
5 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
5 days
BSL
6 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
KK 2v2 League Season 1
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W6
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.