• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 01:19
CET 07:19
KST 15:19
  • 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
BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
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
Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion FlaSh's Valkyrie Copium BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Nintendo Switch Thread Should offensive tower rushing be viable in RTS games?
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
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-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: 1374 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
Poland17490 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
Poland17490 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
Poland17490 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 5h 41m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 183
RuFF_SC2 155
SortOf 90
trigger 22
ProTech20
StarCraft: Brood War
actioN 407
PianO 144
Noble 41
NotJumperer 17
Icarus 7
Dota 2
XaKoH 415
League of Legends
JimRising 721
Other Games
summit1g14629
WinterStarcraft552
C9.Mang0325
Organizations
Other Games
gamesdonequick814
StarCraft: Brood War
UltimateBattle 13
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH144
• Hupsaiya 92
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki38
• Diggity8
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1177
• Stunt472
Upcoming Events
Wardi Open
5h 41m
StarCraft2.fi
10h 41m
Replay Cast
17h 41m
The PondCast
1d 3h
OSC
1d 9h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 17h
Korean StarCraft League
2 days
CranKy Ducklings
3 days
SC Evo League
3 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
[ Show More ]
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
4 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
5 days
Wardi Open
5 days
StarCraft2.fi
5 days
Replay Cast
5 days
StarCraft2.fi
6 days
PiGosaur Monday
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.