• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:25
CET 10:25
KST 18:25
  • 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] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (October 19-25): Clem triples first in 5.0.174Evil Geniuses - shutting down20ISSL (IntoTheTV x SOOP SC2 League): Premier5Weekly Cups (October 12-18): 5.0.17 era begins1[$1250] International ShieldBattery League92
StarCraft 2
General
How do you feel about the mass reverts in the 5.0.17 PTR? Weekly Cups (October 19-25): Clem triples first in 5.0.17 Evil Geniuses - shutting down REPORT: StarCraft 2: Remastered In Development No more SC2 streamers on team liquid?
Tourneys
2026 KungFu Cup Announcement RSL goes to London! 2026 Offline Finals Nov 21-22 ScienceCraft (October 24-25) - Live Event Sparkling Tuna Cup - Weekly Open Tournament ISSL (IntoTheTV x SOOP SC2 League): Premier
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Simple Questions/Answers [G] How to playtest arcade maps [A] Nemrods 1/4 players
External Content
Mutation # 549 Endless Sparkles The PondCast: SC2 News & Results Mutation # 548 Shining Bright Mutation # 547 Temple Of Terror
Brood War
General
BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ Do we even care about balance? Starcraft player cRuZa Passed away. SCHNAIL now supports Remastered
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues KCM Race Survival 2026 Season 4 [BSL23] RO24 Group D - Sunday 21:00 CET
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Mobile Legends: Bang Bang Armies of Exigo - YesYes? General RTS Discussion Thread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine The Chess Thread
Fan Clubs
Reynor Fan Club The Flash Fan Club Serral Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9077 users

The Big Programming Thread - Page 402

Forum Index > General Forum
Post a Reply
Prev 1 400 401 402 403 404 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.
SpiZe
Profile Joined December 2010
Canada3640 Posts
November 29 2013 16:45 GMT
#8021
Hi people,

For a school assignment, I have to create a Client/Server application in Java that uses sockets to communicate. All communications have to be in XML format. Now, the difficulty of the assignment is that we have never done Client/Server programing in Java up until now, so I'm kinda lost. I managed to set up pretty much everything except for the XML communication and I'm lost. I use the JDOM library to create a small XML document in my server, and I attempt to send it through a stream to the client. Now thing is, I'm not sure what I need to send. I have a Document object that I guess that I could send, but it's not really XML, it's an object so it can't be read by a say, a python client does it ? Do I actually have to create a file, send the file, delete the file just to send my xml to the client ? Can anyone give me a hint I'm really lost here. Would it be easier in another library ?
DeltaX
Profile Joined August 2011
United States287 Posts
November 29 2013 17:27 GMT
#8022
Think of XML as a format for text. HTML is actually a specific subset of XML if you think about it and that is always just sent as text. When you want to send it to a client, you can turn it into a string and send that. Then the client can look at the string and either recreate the document object or just process the string depending on if the client is another server or something like a javascript ajax call.
Manit0u
Profile Blog Joined August 2004
Poland17865 Posts
Last Edited: 2013-11-29 22:45:23
November 29 2013 22:44 GMT
#8023
On November 25 2013 05:14 3FFA wrote:
Another thing I would like to know is what exactly are the differences between the various C's? Is there specific purposes/situations each is better for?


I think this wasn't explained well enough earlier on since everyone just started talking about what they program in and even I posted a video that only explained how different platforms utilise various C-family languages.

I think it's a valid question that many people ask themselves and I can start explaining it for posteriority here. Since I'm not familiar with all of C's offspring I'll only cover what I know.

Basically, the main difference here will be the level of abstraction and what libraries those languages use for the most part.

Abstraction-wise it's more or less like that:

C < C++ < C#

This means that you will have to put in more work into accomplishing the same thing when using language that has lower abstraction level. It has both its drawbacks and benefits. While you can do something really easy in C# it won't give you the level of control and optimization that C++ offers (and I won't even mention C with manual memory management) as it's closer to the inner-workings of a system and hardware.

Let's take a closer look at the differences between C++ and C# now (since C is too far removed from this layer of abstraction to really talk about it in the same way). On the Windows platform they can both be used for the same things for the most part but C# with higher abstraction is easier to do stuff using .NET libraries. C++ on the other hand is king when it comes to developing using the DirectX and has much greater support for Win32 and COM API stuff than C#.

The choice of preferred language is up to the person using it and what you want to do with it. If you want to build huge databases and an application that spends more time "thinking" than "doing" then you might want to consider F#, if you want to create a simple Metro app then why not use HTML5/CSS/JS?

Perhaps others can add their 2 cents regarding other C offspring (Java, Objective C, JavaScript).
Time is precious. Waste it wisely.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-11-30 09:06:15
November 30 2013 08:54 GMT
#8024
On November 30 2013 01:45 SpiZe wrote:
Hi people,

For a school assignment, I have to create a Client/Server application in Java that uses sockets to communicate. All communications have to be in XML format. Now, the difficulty of the assignment is that we have never done Client/Server programing in Java up until now, so I'm kinda lost. I managed to set up pretty much everything except for the XML communication and I'm lost. I use the JDOM library to create a small XML document in my server, and I attempt to send it through a stream to the client. Now thing is, I'm not sure what I need to send. I have a Document object that I guess that I could send, but it's not really XML, it's an object so it can't be read by a say, a python client does it ? Do I actually have to create a file, send the file, delete the file just to send my xml to the client ? Can anyone give me a hint I'm really lost here. Would it be easier in another library ?

Java has some great libraries for communicating with SQL. I did that for a course earlier, but I haven't tried doing client server connections with XML. Sorry I can't be much help. I don't see why you can't read the file and send the contents of the file by stream though.


Unrelated to the above, does anyone know if there is any point to using dateTime vs dateTimeOffset?

DateTimeOffset has everything DateTime does and DateTimeOffset also supports timezones.
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.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 30 2013 09:04 GMT
#8025
On November 30 2013 17:54 obesechicken13 wrote:
Unrelated to the above, does anyone know if there is any point to using dateTime vs dateTimeOffset?

DateTimeOffset has everything DateTime does and DateTimeOffset also supports timezones.

It would always be nice to also mention the language. If it's C#, I think I remember there being some pretty concrete advice on MSDN on this subject.
If you have a good reason to disagree with the above, please tell me. Thank you.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-11-30 09:36:09
November 30 2013 09:05 GMT
#8026
On November 30 2013 18:04 spinesheath wrote:
Show nested quote +
On November 30 2013 17:54 obesechicken13 wrote:
Unrelated to the above, does anyone know if there is any point to using dateTime vs dateTimeOffset?

DateTimeOffset has everything DateTime does and DateTimeOffset also supports timezones.

It would always be nice to also mention the language. If it's C#, I think I remember there being some pretty concrete advice on MSDN on this subject.

It is C#.

DateTimeOffset
http://msdn.microsoft.com/en-us/library/bb630289.aspx
DateTime
http://msdn.microsoft.com/en-us/library/bb677335.aspx#feedback
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.
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
Last Edited: 2013-11-30 09:35:27
November 30 2013 09:31 GMT
#8027
On November 30 2013 18:05 obesechicken13 wrote:
Show nested quote +
On November 30 2013 18:04 spinesheath wrote:
On November 30 2013 17:54 obesechicken13 wrote:
Unrelated to the above, does anyone know if there is any point to using dateTime vs dateTimeOffset?

DateTimeOffset has everything DateTime does and DateTimeOffset also supports timezones.

It would always be nice to also mention the language. If it's C#, I think I remember there being some pretty concrete advice on MSDN on this subject.

It is C#.

dateTimeOffset
http://msdn.microsoft.com/en-us/library/bb630289.aspx
DateTime
http://msdn.microsoft.com/en-us/library/bb677335.aspx#feedback

This is not C#, it's T-SQL

As for reason to use one or the other, datetime2 requires at most 8 bytes, at minimum 6 bytes. datetimeoffset requires 10 bytes always. I guess that's a reason to use datetime2, but really, whoever sits on a database so big that this would matter, yet cares about this difference in bytes, is doing something wrong.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-11-30 09:35:45
November 30 2013 09:35 GMT
#8028
On November 30 2013 18:31 Tobberoth wrote:
Show nested quote +
On November 30 2013 18:05 obesechicken13 wrote:
On November 30 2013 18:04 spinesheath wrote:
On November 30 2013 17:54 obesechicken13 wrote:
Unrelated to the above, does anyone know if there is any point to using dateTime vs dateTimeOffset?

DateTimeOffset has everything DateTime does and DateTimeOffset also supports timezones.

It would always be nice to also mention the language. If it's C#, I think I remember there being some pretty concrete advice on MSDN on this subject.

It is C#.

dateTimeOffset
http://msdn.microsoft.com/en-us/library/bb630289.aspx
DateTime
http://msdn.microsoft.com/en-us/library/bb677335.aspx#feedback

This is not C#, it's T-SQL

Fk, yes, it is T-SQL. My bad!
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.
soiii
Profile Joined July 2011
Germany266 Posts
Last Edited: 2013-11-30 11:39:00
November 30 2013 11:33 GMT
#8029
Can somebody give me a hint what is happening when I declare a struct variable like so (C++): "MyStruct *struct_name();" ?
I have no idea what is happening here

Edit: figured it out, that is actually a function declaration ^^. I am quite new to C++.
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
November 30 2013 13:36 GMT
#8030
I'm learning ARM assembly these days, any idea of something easy to make?
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
Warri
Profile Joined May 2010
Germany3208 Posts
November 30 2013 13:48 GMT
#8031
On November 30 2013 22:36 Arnstein wrote:
I'm learning ARM assembly these days, any idea of something easy to make?

Do all the sorts!
Manit0u
Profile Blog Joined August 2004
Poland17865 Posts
November 30 2013 15:10 GMT
#8032
On November 30 2013 20:33 soiii wrote:
Can somebody give me a hint what is happening when I declare a struct variable like so (C++): "MyStruct *struct_name();" ?
I have no idea what is happening here

Edit: figured it out, that is actually a function declaration ^^. I am quite new to C++.


This is strange though. You create structs like so:


struct MyStruct{ };


And then if you want to do stuff with it you declare functions like that:


struct MyStruct* MyFunction(args)


Or I'm messing something here?
Time is precious. Waste it wisely.
Rollin
Profile Joined March 2011
Australia1552 Posts
Last Edited: 2013-11-30 15:41:31
November 30 2013 15:26 GMT
#8033
On December 01 2013 00:10 Manit0u wrote:
+ Show Spoiler +
On November 30 2013 20:33 soiii wrote:
Can somebody give me a hint what is happening when I declare a struct variable like so (C++): "MyStruct *struct_name();" ?
I have no idea what is happening here

Edit: figured it out, that is actually a function declaration ^^. I am quite new to C++.


This is strange though. You create structs like so:

struct MyStruct{ };


And then if you want to do stuff with it you declare functions like that:

struct MyStruct* MyFunction(args)


Or I'm messing something here?

C++ doesn't require the struct keyword to set the type (outside of initialisation ofc) regardless of whether or not you use a typedef in the intitalisation. C (ansi at least) requires the struct keyword if you don't typedef the struct.

ie:
typedef struct{
...
} MyStruct;

MyStruct *MyFunction();

Works in ANSI C.

struct{
...
} MyStruct;

struct MyStruct *MyFunction();

Also works in ANSI C.

struct{
...
} MyStruct;

MyStruct *MyFunction();

Only works in C++.

Thus his function prototype was valid =).
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 30 2013 19:22 GMT
#8034
Hey everyone,

For my own personal curiosity, and for a future(legal) business idea I'm looking into creating a botnet by myself. Could someone please point me to a good basic guide for creating a botnet? It doesn't need much info on bypassing security because I'm assuming for now that it will be allowed through.

Thank you.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Zocat
Profile Joined April 2010
Germany2229 Posts
November 30 2013 19:39 GMT
#8035
You have to find an attack vector. Vulnerabilities in (common) server software - look through open source code to find those. Use those to upload your bot software.
Have them connect to another server (IRC is often used) to command them.
Warri
Profile Joined May 2010
Germany3208 Posts
Last Edited: 2013-11-30 19:43:07
November 30 2013 19:42 GMT
#8036
Woa java is driving me nuts today.
I have this endless loop:

boolean pause=true;
while (true) {
if (!pause) {
update();
}
}

At the start of the program pause is set to true and is not changed in the class which contains the loop. It is only changed in another class, which contains a gui. And heres the weird part: pause gets set to false correctly, but the loop still doesnt run. However, if i add a System.out.println("foo"); inside the loop, it works. So my assumption is, java falsely "optimizes", aka removes, the loop, because the condition is never changed to true inside the class. How can i prevent that without adding dummy commands?
Nyxisto
Profile Joined August 2010
Germany6287 Posts
November 30 2013 19:51 GMT
#8037
I also have desperate java problems today:

So the task was to write a method that reads hex numbers from a file, converts them, and prints them out through the console.
Problem is, we're not allowed to use Buffered Readers or something similar, we're forced to use a "StdIn" class that we were given, which has a bunch of methods to read from the Standard Input, and we should redirect the Standard Input to read from the file instead from the console.
So i looked it up and the Syntax seems to be something like "java classname.java < filename.txt"
But if i run the program and type that into the console, it just echoes "java classname.java < filename.txt" instead of actually printing out the content of the file.

Would be glad if anyone has an idea what's wrong here.
Manit0u
Profile Blog Joined August 2004
Poland17865 Posts
Last Edited: 2013-11-30 20:05:25
November 30 2013 20:00 GMT
#8038
On December 01 2013 04:42 Warri wrote:
Woa java is driving me nuts today.
I have this endless loop:

boolean pause=true;
while (true) {
if (!pause) {
update();
}
}

At the start of the program pause is set to true and is not changed in the class which contains the loop. It is only changed in another class, which contains a gui. And heres the weird part: pause gets set to false correctly, but the loop still doesnt run. However, if i add a System.out.println("foo"); inside the loop, it works. So my assumption is, java falsely "optimizes", aka removes, the loop, because the condition is never changed to true inside the class. How can i prevent that without adding dummy commands?


Can you make it more like this?

Class A

while (true) {
if (!ClassB->queryPause(pause)) {
update();
}
}


Class B

boolean pause = true;

... do stuff with pause ...

public boolean queryPause(boolean pause)
{
return pause;
}


I think it would be even better if you had 3 classes. 2 that actually do stuff and have all the data and another one acting as an interface for the other two to communicate. This way you can easily shuffle stuff around and change things later.
Time is precious. Waste it wisely.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
November 30 2013 20:04 GMT
#8039
So this answered my question from before:
http://msdn.microsoft.com/en-us/library/bb384267(v=vs.110).aspx
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.
Warri
Profile Joined May 2010
Germany3208 Posts
Last Edited: 2013-11-30 20:11:29
November 30 2013 20:10 GMT
#8040
On December 01 2013 05:00 Manit0u wrote:
Show nested quote +
On December 01 2013 04:42 Warri wrote:
Woa java is driving me nuts today.
I have this endless loop:

boolean pause=true;
while (true) {
if (!pause) {
update();
}
}

At the start of the program pause is set to true and is not changed in the class which contains the loop. It is only changed in another class, which contains a gui. And heres the weird part: pause gets set to false correctly, but the loop still doesnt run. However, if i add a System.out.println("foo"); inside the loop, it works. So my assumption is, java falsely "optimizes", aka removes, the loop, because the condition is never changed to true inside the class. How can i prevent that without adding dummy commands?


Can you make it more like this?

Class A

while (true) {
if (!ClassB->queryPause(pause)) {
update();
}
}


Class B

boolean pause = true;

... do stuff with pause ...

public boolean queryPause(boolean pause)
{
return pause;
}


I think it would be even better if you had 3 classes. 2 that actually do stuff and have all the data and another one acting as an interface for the other two to communicate. This way you can easily shuffle stuff around and change things later.

Hm i dont understand what the parameter is for in queryPause, if pause is a member of Class B?
I tried this:
Class A:

while (true) {
if (!B.getPause()) {
update();
}
}

Class B:

boolean pause=true;
...
public boolean getPause() {
return pause;
}

This also doesnt work. But again, if i change the getPause() method to

public boolean getPause() {
System.out.println("qwe");
return pause;
}

it starts working... i dont get it
Prev 1 400 401 402 403 404 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 35m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 134
StarCraft: Brood War
Bisu 577
Pusan 340
Zeus 186
EffOrt 139
Stork 116
910 76
ZerO 73
Sharp 52
ggaemo 51
Mind 51
[ Show more ]
NaDa 27
sSak 24
yabsab 22
ToSsGirL 14
Noble 9
Dota 2
Gorgc3258
Counter-Strike
olofmeister512
allub434
Other Games
ceh9472
Livibee193
crisheroes146
ZerO(Twitch)5
ArmadaUGS1
Organizations
Counter-Strike
PGL16827
Other Games
gamesdonequick535
StarCraft: Brood War
lovetv 7
[ Show 12 non-featured ]
StarCraft 2
• LUISG 21
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• iopq 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2232
League of Legends
• Stunt792
Upcoming Events
KCM Race Survival
35m
IntoTheTV X SOOP
1h 35m
SHIN vs GuMiho
Clem vs Classic
OSC
4h 35m
OSC
12h 35m
GSL
1d 2h
Epic.LAN
1d 3h
Replay Cast
1d 13h
Sparkling Tuna Cup
2 days
WardiTV Invitational
2 days
Epic.LAN
2 days
[ Show More ]
AI Arena Tournament
2 days
Yamato Cup
3 days
Map Test Tournament
3 days
WardiTV Weekly
4 days
Replay Cast
4 days
Rogue vs Classic
Patches Events
5 days
PiGosaur Cup
5 days
Kung Fu Cup
6 days
Liquipedia Results

Completed

Proleague 2026-10-27
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
PGL Masters Bucharest 2026
Stake Ranked Episode 5
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
BLAST Open Fall 2026
Esports World Cup 2026

Upcoming

IPSL Winter 2026-27
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 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.