• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:00
CEST 10:00
KST 17:00
  • 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
[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Stellar Fest TWO the Moon (Dec 16-20)8Weekly Cups (August 24-30): Patches' balance mod takes over2New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6Weekly Cups (August 10-16): SHIN doubles4
StarCraft 2
General
Weekly Cups (August 10-16): SHIN doubles Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL II: SC2 Player Announcement 6/8 - Maru Weekly Cups (August 24-30): Patches' balance mod takes over How would you feel about frequent/monthly balance patches for SC2?
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement Stellar Fest TWO the Moon (Dec 16-20) PIG STY FESTIVAL 8.0! (13 - 23 August)
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
ASL22 General Discussion BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [Personal Project Share] Terran Defense v0.60 XUN appreciation thread
Tourneys
KCM Race Survival 2026 Season 3 [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS [ASL22] Ro24 Group F
Strategy
Replay Review Process - What do you do? Game Theory for Starcraft Odyssey Mineral Stack Saturation Fighting Spirit mining rates
Other Games
General Games
[Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread Stratus: Battle for the sky now on steam Early acc Nintendo Switch Thread Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Paid Marketing Services | Drive Leads & Sales with Things Aren’t Peaceful in Palestine Is a Spice Mill Worth It for Everyday Cooking? Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3938 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
Hyrule19252 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
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech141
EnDerr 31
StarCraft: Brood War
sSak 88
Shinee 34
Bisu 25
League of Legends
JimRising 503
Counter-Strike
shoxiejesuss741
byalli93
Super Smash Bros
hungrybox304
Mew2King0
Other Games
ceh9555
XaKoH 261
m0e_tv258
crisheroes244
Happy210
Livibee125
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH213
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Light_VIP 12
• iopq 9
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos261
Other Games
• WagamamaTV187
Upcoming Events
The PondCast
2h
OSC
14h 30m
IntoTheTV X SOOP
1d 3h
CranKy Ducklings
2 days
Sparkling Tuna Cup
3 days
OSC
3 days
Shopify Rebellion Sundays
3 days
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Afreeca Starleague
4 days
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
4 days
Afreeca Starleague
5 days
Leta vs ggaemo
Jaedong vs Queen
[ Show More ]
GSL
5 days
PiGosaur Cup
5 days
Kung Fu Cup
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

Acropolis #5
Acropolis #5 - TRS
Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
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.