• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:30
CEST 17:30
KST 00:30
  • 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
Team Liquid Map Contest #22 - The Finalists14[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers11Maestros of the Game 2 announced32026 GSL Tour plans announced11Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid22
StarCraft 2
General
MaNa leaves Team Liquid 2026 GSL Tour plans announced Team Liquid Map Contest #22 - The Finalists Weekly Cups (April 6-12): herO doubles, "Villains" prevail Oliveira Would Have Returned If EWC Continued
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament GSL CK: More events planned pending crowdfunding 2026 GSL Season 1 Qualifiers Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly)
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 # 521 Memorable Boss Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
Gypsy to Korea ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Pros React To: Tulbo in Ro.16 Group A Data needed
Tourneys
Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro16 Group A [ASL21] Ro16 Group B
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
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
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2034 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
Hyrule19203 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
Ladder Legends
15:00
Valedictorian Cup #1 Qualifier
SteadfastSC11
Liquipedia
WardiTV Map Contest Tou…
11:00
Group D
WardiTV1102
IndyStarCraft 303
Rex104
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 303
LamboSC2 169
Rex 104
BRAT_OK 54
Codebar 25
EmSc Tv 16
SteadfastSC 11
StarCraft: Brood War
Britney 125743
Calm 4292
EffOrt 1868
Horang2 1749
ggaemo 608
Mini 502
BeSt 420
firebathero 253
Mind 246
PianO 155
[ Show more ]
Soulkey 105
Hyun 100
Sexy 74
Sea.KH 55
Killer 43
Sharp 34
sSak 34
Shinee 34
Movie 33
zelot 20
Rock 20
GoRush 17
Hm[arnc] 17
yabsab 16
Terrorterran 13
SilentControl 8
Dewaltoss 5
eros_byul 1
Dota 2
Gorgc7606
ODPixel45
League of Legends
Reynor63
Counter-Strike
fl0m6054
olofmeister3888
byalli453
Super Smash Bros
Mew2King171
Heroes of the Storm
Khaldor758
Liquid`Hasu353
Other Games
singsing1958
B2W.Neo1178
Beastyqt634
FrodaN491
mouzStarbuck189
Hui .180
XaKoH 171
KnowMe37
RotterdaM32
MindelVK8
Organizations
Dota 2
PGL Dota 2 - Main Stream13899
PGL Dota 2 - Secondary Stream1281
Other Games
BasetradeTV530
StarCraft 2
EmSc Tv 16
EmSc2Tv 16
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• EnkiAlexander 37
• Adnapsc2 32
• poizon28 25
• Shameless 23
• Kozan
• Migwel
• sooper7s
• AfreecaTV YouTube
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Jankos2039
• Nemesis1477
• TFBlade1311
Other Games
• Shiphtur112
Upcoming Events
IPSL
30m
JDConan vs TBD
Aegong vs rasowy
BSL
3h 30m
StRyKeR vs rasowy
Artosis vs Aether
JDConan vs OyAji
Hawk vs izu
CranKy Ducklings
8h 30m
Replay Cast
17h 30m
Wardi Open
18h 30m
Afreeca Starleague
18h 30m
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
1d
RSL Revival
1d 10h
Afreeca Starleague
1d 18h
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
1d 19h
[ Show More ]
RSL Revival
2 days
Replay Cast
3 days
The PondCast
3 days
KCM Race Survival
3 days
WardiTV Map Contest Tou…
3 days
Replay Cast
4 days
Escore
4 days
RSL Revival
5 days
WardiTV Map Contest Tou…
5 days
Ladder Legends
5 days
uThermal 2v2 Circuit
5 days
BSL
6 days
Sparkling Tuna Cup
6 days
WardiTV Map Contest Tou…
6 days
Ladder Legends
6 days
Liquipedia Results

Completed

Escore Tournament S2: W3
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 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
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
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
BLAST Rivals Spring 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.