• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:06
CET 08:06
KST 16:06
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
StarCraft Evolution League (SC Evo Biweekly) RSL Offline Finals Info - Dec 13 and 14! RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread ZeroSpace Megathread Nintendo Switch Thread The Perfect Game Path of Exile
Dota 2
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 Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1385 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
Hyrule19173 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
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 112
-ZergGirl 29
StarCraft: Brood War
Stork 937
Tasteless 229
Sacsri 102
Shine 54
Bale 49
ZergMaN 20
Dota 2
febbydoto373
NeuroSwarm159
League of Legends
JimRising 608
Other Games
summit1g11228
WinterStarcraft562
C9.Mang0280
crisheroes109
RuFF_SC297
Mew2King48
Organizations
Other Games
gamesdonequick689
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH156
• practicex 40
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1254
Upcoming Events
The PondCast
2h 55m
OSC
8h 55m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
16h 55m
Korean StarCraft League
1d 19h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.