• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:38
CEST 08:38
KST 15:38
  • 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
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Reynor: GSL Loss Wasn't About Preparation Format12[IPSL] Spring 2026 Grand Finals - This Weekend!1Weekly Cups (July 6 - 12): Protoss strike back12BSL Season 22 Full Overview & Conclusion8BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Is the larve respawn broken? Weekly Cups (July 6 - 12): Protoss strike back Serral wins HomeStory Cup 29 Yamato Cup Series Interview with an American 16 Year Old Grandmaster
Tourneys
WardiTV Summer Cup 2026 GSL CK #5 Race War RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29 Vespene Cup #1 — $300+ USD, July 10
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
Etiquete rules in Asl? Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) screpdb: new Starcraft reporting tool ASL 22 Proposed Map Pool BSL Season 22 Full Overview & Conclusion
Tourneys
[Megathread] Daily Proleagues [ASL22] Wildcard Qualifier [IPSL] Spring 2026 Grand Finals - This Weekend! IPSL Spring 2026 Top 4!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Path of Exile Nintendo Switch Thread General RTS Discussion Thread Stormgate/Frost Giant Megathread Summer Games Done Quick 2026!
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread UK Politics Mega-thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion! Series you have seen recently...
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Tennis[sport] Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
Poker (part 2)
Nebuchad
The Experiences We Want and …
TrAiDoS
An Exploration of th…
waywardstrategy
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 11140 users

The Big Programming Thread - Page 320

Forum Index > General Forum
Post a Reply
Prev 1 318 319 320 321 322 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.
HyunA
Profile Joined July 2010
Romania362 Posts
Last Edited: 2013-07-03 16:00:28
July 03 2013 15:50 GMT
#6381
On July 04 2013 00:45 Intgrl wrote:
You should rewrite your while-loop. Just put while (true) and check if the number is even or odd and do the changes, then immediately after changing the number you check if it's 1 and then break;
Remember to print the numbers after every change.

Hope I didn't help too much(?)

Thanks for your help.
Intgrl
Profile Joined June 2012
27 Posts
July 03 2013 16:00 GMT
#6382
On July 04 2013 00:50 HyunA wrote:
Show nested quote +
On July 04 2013 00:45 Intgrl wrote:
You should rewrite your while-loop. Just put while (true) and check if the number is even or odd and do the changes, then immediately after changing the number you check if it's 1 and then break;
Remember to print the numbers after every change.

Hope I didn't help too much(?)

I still can't manage to get it to work, I give up. Thanks for your help.

Well if you want to see the code, it's here http://pastebin.com/kNw5Yuun
Just make sure if you really want to see it or if you'll try it again later. Up to you.
among the mindless
bangsholt
Profile Joined June 2011
Denmark138 Posts
July 03 2013 16:15 GMT
#6383
Why do you want to use a while(true) loop? It's prettier to keep the logic in the while loop construct rather than needing to break out of it.

A pastebin.

while(true) is OK for doing threads and so on, but otherwise... meh.
Zocat
Profile Joined April 2010
Germany2229 Posts
July 03 2013 16:42 GMT
#6384
The problem screams recursion. Go away with your loops.
Intgrl
Profile Joined June 2012
27 Posts
July 03 2013 16:51 GMT
#6385
On July 04 2013 01:15 bangsholt wrote:
Why do you want to use a while(true) loop? It's prettier to keep the logic in the while loop construct rather than needing to break out of it.

A pastebin.

while(true) is OK for doing threads and so on, but otherwise... meh.

Well, I'm not going to defend my while(true) loop. It's just whatever came to my mind first and I posted it.
among the mindless
heroyi
Profile Blog Joined March 2009
United States1064 Posts
July 03 2013 17:04 GMT
#6386
Not looking for an actual code but instead just a simple draft/explanation on how it would work.

How would one go about creating a program that can automate a simple task of (for example):

search address for companies
paste the result in microsoft excel

Assume best case scenario (all addresses are formatted same way and are easily found on web by your program, user is not an idiot). Would you use something like javascript? Or could you use some higher level language and code it to open a browser, go search on google etc...? What is the go to language or the basic procedure to create a program that would do automated work something similar like above?

wat wat in my pants
bangsholt
Profile Joined June 2011
Denmark138 Posts
July 03 2013 17:14 GMT
#6387
On July 04 2013 01:42 Zocat wrote:
The problem screams recursion. Go away with your loops.


You start with one problem, and apply recursion. Now you have two...

On July 04 2013 02:04 heroyi wrote:
Not looking for an actual code but instead just a simple draft/explanation on how it would work.

How would one go about creating a program that can automate a simple task of (for example):

search address for companies
paste the result in microsoft excel

Assume best case scenario (all addresses are formatted same way and are easily found on web by your program, user is not an idiot). Would you use something like javascript? Or could you use some higher level language and code it to open a browser, go search on google etc...? What is the go to language or the basic procedure to create a program that would do automated work something similar like above?


.NET platform. Use OpenXML to write the Excel doc. Probably your local phone book company has a nice and detailed database they have exposed through web services or something similar - you really don't want to scrape pages, that is not only hard but also unreliable. That's how I would do it, at least.
sylverfyre
Profile Joined May 2010
United States8298 Posts
Last Edited: 2013-07-03 19:32:01
July 03 2013 19:31 GMT
#6388
Oh man, some really... goofy humour about things when you examine how specific languages deal with... strange statements.

https://www.destroyallsoftware.com/talks/wat
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
July 03 2013 20:08 GMT
#6389
On July 04 2013 02:14 bangsholt wrote:
Show nested quote +
On July 04 2013 01:42 Zocat wrote:
The problem screams recursion. Go away with your loops.


You start with one problem, and apply recursion. Now you have two...


The base case and the inductive step?
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
tofucake
Profile Blog Joined October 2009
Hyrule19228 Posts
July 03 2013 20:11 GMT
#6390
On July 04 2013 04:31 sylverfyre wrote:
Oh man, some really... goofy humour about things when you examine how specific languages deal with... strange statements.

https://www.destroyallsoftware.com/talks/wat

I like to watch that a few times a year. :D
Liquipediaasante sana squash banana
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
July 03 2013 20:46 GMT
#6391
On July 04 2013 05:11 tofucake wrote:
Show nested quote +
On July 04 2013 04:31 sylverfyre wrote:
Oh man, some really... goofy humour about things when you examine how specific languages deal with... strange statements.

https://www.destroyallsoftware.com/talks/wat

I like to watch that a few times a year. :D


Yeah it's pretty wat ^^
There is no one like you in the universe.
Bayyne
Profile Joined January 2011
United States1967 Posts
Last Edited: 2013-07-04 00:28:41
July 03 2013 21:11 GMT
#6392
I am learning about arrays in C++ right now (total newbie btw) and I can see the amount of complexity that this will lead to. I'm guessing there can be multi-dimensional arrays that can indicate points in space in, say, games. My head is about to explode.
Remember not only to say the right thing in the right place, but far more difficult still, to leave unsaid the wrong thing at the tempting moment.
Millitron
Profile Blog Joined August 2010
United States2611 Posts
July 03 2013 23:11 GMT
#6393
On July 04 2013 06:11 Bayyne wrote:
I am learning about arrays in C++ right now (total newbie btw) and I can see the amount complexity that this will lead to. I'm guessing there can be multi-dimensional arrays that can indicate points in space in, say, games. My head is about to explode.

There can indeed be multi-dimensional arrays.

Have fun!
Who called in the fleet?
CptCutter
Profile Joined September 2010
United Kingdom370 Posts
Last Edited: 2013-07-03 23:28:17
July 03 2013 23:27 GMT
#6394
On July 04 2013 06:11 Bayyne wrote:
I am learning about arrays in C++ right now (total newbie btw) and I can see the amount complexity that this will lead to. I'm guessing there can be multi-dimensional arrays that can indicate points in space in, say, games. My head is about to explode.


i dont think you would use it for points in space, after all most of space is 'nothingness', but definitely for standard games. Minecraft for example uses in a theoretical sense, 5D arrays, but that still amounts to the same amount of blocks as a 3D array would, just better organised for various things.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
July 04 2013 02:17 GMT
#6395
On July 04 2013 08:27 CptCutter wrote:
Show nested quote +
On July 04 2013 06:11 Bayyne wrote:
I am learning about arrays in C++ right now (total newbie btw) and I can see the amount complexity that this will lead to. I'm guessing there can be multi-dimensional arrays that can indicate points in space in, say, games. My head is about to explode.


i dont think you would use it for points in space, after all most of space is 'nothingness', but definitely for standard games. Minecraft for example uses in a theoretical sense, 5D arrays, but that still amounts to the same amount of blocks as a 3D array would, just better organised for various things.


I think he meant space as in .. 3D space and vectors lol
There is no one like you in the universe.
WindWolf
Profile Blog Joined July 2012
Sweden11767 Posts
July 04 2013 08:44 GMT
#6396
On July 03 2013 03:56 WindWolf wrote:
Anyone else using Visual Studio 2012 Update 3 (more specifically, for C++-programming) on 64-bit Windows 7 that has problems that it freezes frequently (and at times, Windows all completely)? Today, it has happened for me a couple of times already, and it's getting really annoying. Now, as a result, I have to set up a new project because it caused corrupted files. It's not the code files that are the problem, those are on my Dropbox and I can revert should I need it, It's the project itself.

Before the most recent freeze, it said some error message about that my graphics card driver has crashed (I don't know what, I didn't manage to screenshot it). I'm running a Nvidia GeForce 555M with driver 320.49

Update: downgraded to driver 320.18 and now it runs as well as it did before
EZ4ENCE
Azerbaijan
Profile Blog Joined January 2010
United States660 Posts
Last Edited: 2013-07-06 13:16:36
July 05 2013 21:54 GMT
#6397
As3 question.
I have a friend that wants to make flash games for some extra money and I want to learn some OO so I said why not but learning as3 is the most frustrating thing I've tried since I started programming. I am probably missing something really obvious but I cannot figure out why this won't work.

I have a png of a squid that I want to pop up on the stage where the mouse is when the stage is clicked. Both my trace statements are showing up so I know the stage knows it is being clicked and that the squid class constructor is being called but nothing is showing up on my stage :/

I am doing this just to try and figure out how some of this works; the intent is to maybe eventually have a squid that the player controls or something but I am stuck on this simple junk. I kind of hate as3. Any help is appreciated.

Main Class
+ Show Spoiler +


package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;

public class Main extends Sprite
{


public function Main()
{
stage.addEventListener(MouseEvent.CLICK, createSquid);
}

public function createSquid(e:MouseEvent):void
{
trace("stage clicked");
var newSquid:Sprite = new squid();
stage.addChild(newSquid);

}
}

}



Squid Class
+ Show Spoiler +


package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

public class squid extends Sprite
{
[Embed(source = "/../lib/Squid.png")] public var squidPic:Class;

public function squid()
{
trace("SQUID");
var mysquid:Bitmap = new squidPic();
mysquid.x = mouseX;
mysquid.y = mouseY;
addChild(mysquid);

}

}

}



EDIT:
False alarm. Turns out my code works fine but I didn't realize my png was actually a ton of whitespace around my squid which altogether was larger than my stage. I trimmed it down and now it works. I still don't like as3; seems to be a lot of code to do something so simple.
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
Last Edited: 2013-07-06 02:45:48
July 06 2013 02:37 GMT
#6398
On July 06 2013 06:54 Azerbaijan wrote:
As3 question.
I have a friend that wants to make flash games for some extra money and I want to learn some OO so I said why not but learning as3 is the most frustrating thing I've tried since I started programming. I am probably missing something really obvious but I cannot figure out why this won't work.

I have a png of a squid that I want to pop up on the stage where the mouse is when the stage is clicked. Both my trace statements are showing up so I know the stage knows it is being clicked and that the squid class constructor is being called but nothing is showing up on my stage :/

I am doing this just to try and figure out how some of this works; the intent is to maybe eventually have a squid that the player controls or something but I am stuck on this simple junk. I kind of hate as3. Any help is appreciated.

Main Class
+ Show Spoiler +


package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;

public class Main extends Sprite
{


public function Main()
{
stage.addEventListener(MouseEvent.CLICK, createSquid);
}

public function createSquid(e:MouseEvent):void
{
trace("stage clicked");
var newSquid:Sprite = new squid();
stage.addChild(newSquid);

}
}

}



Squid Class
+ Show Spoiler +


package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

public class squid extends Sprite
{
[Embed(source = "/../lib/Squid.png")] public var squidPic:Class;

public function squid()
{
trace("SQUID");
var mysquid:Bitmap = new squidPic();
mysquid.x = mouseX;
mysquid.y = mouseY;
addChild(mysquid);

}

}

}





I'm more experienced with AS2 but I'll give this a shot. According to the examples I've looked at online, the code looks alright for the most part. My first suggestion would be to remove the forward slash from your path (ie. "../lib/Squid.png"). Second, verify that the path to your image is accurate, relative to the .swf file's location. After that, I would move 'public var squidPic:Class;' down to a new line below the Embed tag, as it might be that it's looking at the line below and not the same line (that would be strange though).

Typically though, I'm more used to importing items and creating movieclips in the library, and referencing them through their linkage IDs. It might be an alternative option worth exploring if you continue to have trouble. Here's a pretty decent tutorial on it: http://www.atksolutions.com/articles/flash_as3_load_display_sprite.html

EDIT: Oho, apparently I made a poor assumption, the path is supposed to be relative to the .as file, not necessarily the .swf file, as referenced here: http://www.bit-101.com/blog/?p=883
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
July 06 2013 19:14 GMT
#6399
On July 04 2013 02:04 heroyi wrote:
Not looking for an actual code but instead just a simple draft/explanation on how it would work.

How would one go about creating a program that can automate a simple task of (for example):

search address for companies
paste the result in microsoft excel

Assume best case scenario (all addresses are formatted same way and are easily found on web by your program, user is not an idiot). Would you use something like javascript? Or could you use some higher level language and code it to open a browser, go search on google etc...? What is the go to language or the basic procedure to create a program that would do automated work something similar like above?


Might be possible with Autohotkey.

As long as it is only restful interfaces you can use something like curl to interact with websites. I'm not sure if there is a better alternative as I'm not too familiar with rest.
If you really need UI automation for something complicated on the web then you need selenium webdriver/ide.

The pasting to excel part should either be done with autohotkey or your language of choice.
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.
mustache
Profile Joined April 2010
Switzerland309 Posts
Last Edited: 2013-07-07 15:11:45
July 07 2013 15:11 GMT
#6400
C++ TCP socket programming question:

I've written a small chat program where the client can send a message to the server.
i'm using the following piece of code to establish the connection


sockaddr_in connectionInfo;
connectionInfo.sin_addr.s_addr = inet_addr("127.0.0.1");
connectionInfo.sin_family = AF_INET;
connectionInfo.sin_port = htons(54345);
int connectionInfoLen = sizeof(connectionInfo);

connect(clientSocket, (struct sockaddr*)&connectionInfo,connectionInfoLen);


this works perfectly fine when im using my own pc as both client and server, the IP i enter on both sides is simply 127.0.0.1

But what IP do I use if I want to connect to my friends PC if we both have a router in between? only the router's IPs are unique, so wouldnt i have to specify both the unique router IP as well as the internal IP of the PC?

I searched google but I couldnt find anything related to this, possibly because im not searching for the right keywords.
Prev 1 318 319 320 321 322 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 23m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft800
ProTech171
Nina 125
StarCraft: Brood War
GuemChi 3889
actioN 129
ZergMaN 78
Bale 24
Icarus 10
Dota 2
NeuroSwarm207
Fuzer 64
League of Legends
JimRising 692
Counter-Strike
Coldzera 1375
Other Games
summit1g6998
ceh9249
Maynarde154
XaKoH 152
Organizations
Other Games
gamesdonequick2649
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH318
• Light_VIP 12
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota279
League of Legends
• Rush1407
• Stunt403
Upcoming Events
Replay Cast
2h 23m
CrankTV Team League
4h 23m
Replay Cast
1d 2h
CrankTV Team League
1d 4h
Replay Cast
1d 17h
RSL Revival
2 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
2 days
IPSL
2 days
Dragon vs Hawk
RSL Revival
3 days
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
3 days
[ Show More ]
IPSL
3 days
Bonyth vs Ret
WardiTV Weekly
4 days
Monday Night Weeklies
4 days
PiGosaur Cup
5 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2026-07-13
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026

Upcoming

Escore Tournament S3: W3
ASL S22 SEASON OPEN Day 1
Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
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.