• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:01
CEST 20:01
KST 03:01
  • 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
TL.net Map Contest #21: Voting10[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Chinese SC2 server to reopen; live all-star event in Hangzhou17Weekly Cups (Oct 13-19): Clem Goes for Four2BSL Team A vs Koreans - Sat-Sun 16:00 CET6Weekly Cups (Oct 6-12): Four star herO85.0.15 Patch Balance Hotfix (2025-10-8)81
StarCraft 2
General
5.0.15 Patch Balance Hotfix (2025-10-8) RotterdaM "Serral is the GOAT, and it's not close" Weekly Cups (Oct 13-19): Clem Goes for Four Chinese SC2 server to reopen; live all-star event in Hangzhou Weekly Cups (March 17-23): Clem Bounces Back
Tourneys
RSL Season 2 Qualifier Links and Dates $1,200 WardiTV October (Oct 21st-31st) SC2's Safe House 2 - October 18 & 19 INu's Battles #13 - ByuN vs Zoun Tenacious Turtle Tussle
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 496 Endless Infection Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers
Brood War
General
SnOw's Awful Building Placements vs barracks Is there anyway to get a private coach? BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion BSL Season 21
Tourneys
[Megathread] Daily Proleagues 300$ 3D!Community Brood War Super Cup #4 [ASL20] Semifinal B Azhi's Colosseum - Anonymous Tournament
Strategy
Current Meta Roaring Currents ASL final [I] Funny Protoss Builds/Strategies BW - ajfirecracker Strategy & Training
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Dawn of War IV ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine The Chess Thread Russo-Ukrainian War Thread Men's Fashion Thread
Fan Clubs
The herO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Sabrina was soooo lame on S…
Peanutsc
Our Last Hope in th…
KrillinFromwales
Certified Crazy
Hildegard
Rocket League: Traits, Abili…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2125 users

The Big Programming Thread - Page 40

Forum Index > General Forum
Post a Reply
Prev 1 38 39 40 41 42 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.
Siniyas
Profile Joined January 2011
Germany66 Posts
Last Edited: 2011-03-02 16:57:05
March 02 2011 16:40 GMT
#781
On March 03 2011 01:15 FunkyLich wrote:
Okay, I am supposed to be making a linked list with java and I have a different problem than the person who brought up linked lists earlier. I understand the linked list concept very well. And I would love to be able to do it in C because I feel like pointers would make it easier. But I have to do it in Java.

This is the crux of my problem: I simply do not know how to iteratively create objects (see how this ties in with linked lists further down). According to my faulty understanding of objects, I need a variable for every object I make. Thus every time I make an object, I need to write a line like this.

CLASS object-variable = new CLASS();

If someone could be so kind to explain why this is unnecessary in java, and what is wrong with my understanding of objects that hinders me from seeing the light, that would be great. This is really all I'm asking, but if you want specifics keep reading.



In the way I have it set up, the linked list is (when instantiated) an object of objects. The objects that make the list are simple nodes with two data values (some integer and a reference value to the second node). The linked list class takes an array input and generates a linked list based on the size of the array. So with a length 100 array, the linked list class would need to instantiate 100 nodes. And I would need to do this iteratively of course (or recursively if you want). I just need a way to make these nodes without each of them needing its own variable.


Hopefully im understanding your problem right. So you have your class ListObject with a variable of the same type.
So what i would do for an array is simply write constructor which takes a ListObject and the integer and then you can simply do this
ListObject head = new ListObject(null,yourArray[0]);
for(int i = 1;i++,i<yourArray.size() ){
head = new ListObject(head,yourArray[i])
}

which is practically the same as in c++. What you are doing here, is putting a reference to a new ListObject into head, while putting the reference to the old object into the ListObject variable of this object.

Also in general you can use new even without a variable declaration.
For example calling a method that takes an Object you can just write, myMethod(new Object());
or you can even just use new by itself, for example if you have a class Calc, that calculates the squareroot of a number and then prints it a line like this is ok.
new Calc(x);
and it prints out result.
you can even call methods directly on these.
new Calc(x).showSteps();

Hope that helps in your understanding.


As an extra, there is a LinkedList already in Java, so you can look at its sourcecode for further understanding on other problems you might have.
Let it rip
FunkyLich
Profile Blog Joined August 2010
United States107 Posts
March 02 2011 16:52 GMT
#782
I believe it does. So I can create an object without assigning it a variable.

Many thanks for the prompt reply. I will try this out and report back if I run into another major snag.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
Last Edited: 2011-03-03 14:40:37
March 03 2011 14:37 GMT
#783
hey guys, ive been searching the internet on how to keep your C program running until the user terminates it.

The idea is that my program is showing some results/output until the user terminates it.

I tried opening time.h and use

while((start_time / CLOCKS_PER_SEC * 1000) != 15)

doesnt work =/
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
Last Edited: 2011-03-03 15:23:38
March 03 2011 15:21 GMT
#784
Just keep a loop in your main that prevents the program from returning untill a condition is met

int main() {
not_done = 1;

while (not_done) {
.....
}
return 0;
}


Or poll for input or something. You are going to have to use some form of loop, just find a good loop condition and you are set.
England will fight to the last American
SpearThruster
Profile Joined March 2011
18 Posts
March 04 2011 04:29 GMT
#785
Okey guys, i have hit a wall here with my JavaScript code. I wanna force event bubbling on my site, in order to circumvent the onMouseDown() in favor for onClick() (button). I need some tips for an elegant solution please.

+ Show Spoiler +
<body onMouseDown="updateMouse()">
<P ID = "p1">This is a paragraph obviously. </P>
<input type="button" value="Start" onClick="startProcessing()">
<input type="button" value="End" onClick="showResult()">
</body>


Blisse
Profile Blog Joined July 2010
Canada3710 Posts
March 04 2011 04:49 GMT
#786
OKAY well I got 60/75 on the Junior Programs for the Canadian Computing Competition by Waterloo. Pretty good since I haven't done any programming in 8 or so months, and this was way more advanced than anything I've ever done. Couldn't for the life of me think of a solution to the last question though, worth the remaining 15 marks.
There is no one like you in the universe.
Craton
Profile Blog Joined December 2009
United States17256 Posts
March 04 2011 05:20 GMT
#787
And you're not going to tell us said question?
twitch.tv/cratonz
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
March 04 2011 05:26 GMT
#788
On March 04 2011 14:20 Craton wrote:
And you're not going to tell us said question?


LOL well it had something to do with finding out the number of ways you can remove people in a friends list if you can't remove yourself, or people that your friends invited if the maximum list size is 6. I was hoping to look at the question again tomorrow and get back to you (guys). :3

From what I recall, you are given an integer, n, from 1-6 where the highest number is the user (deleter). Then you are given n-1 numbers telling you who invited who into the list.

So if you are given

3
3
3

Then there are three people, the user is the third, and friend one and friend two were both invited by the user (three). I'll try to find the whole question, but where would I start in solving that?
There is no one like you in the universe.
Zocat
Profile Joined April 2010
Germany2229 Posts
Last Edited: 2011-03-08 15:36:22
March 08 2011 15:35 GMT
#789
On March 04 2011 14:26 Blisse wrote:
Show nested quote +
On March 04 2011 14:20 Craton wrote:
And you're not going to tell us said question?


LOL well it had something to do with finding out the number of ways you can remove people in a friends list if you can't remove yourself, or people that your friends invited if the maximum list size is 6. I was hoping to look at the question again tomorrow and get back to you (guys). :3

From what I recall, you are given an integer, n, from 1-6 where the highest number is the user (deleter). Then you are given n-1 numbers telling you who invited who into the list.

So if you are given

3
3
3

Then there are three people, the user is the third, and friend one and friend two were both invited by the user (three). I'll try to find the whole question, but where would I start in solving that?


Well, from what you told us:
If there are people on the list who you havent invited and arent friends of someone you invited you cannot remove those. They're therefor irrelevant.

I think you are able to remove people who were invited from your friends as soon as you remove the friend (or else the problem wouldnt make any sense. Just count the people you invited and it's basic combinatorics how many different ways are there to remove them).
So let's assume my thought is correct. Build a "tree" with yourself as the root. Then each chilldnode (of the root) is a person who you invited. Their children are the persons they invited.
Now count how many different ways you can find which visits all edges of the tree.


AoN.DimSum
Profile Blog Joined September 2008
United States2983 Posts
March 09 2011 17:05 GMT
#790
Hi, does anyone know how to break a video into frames using java? I used MATLAB to write a little program for playing a video in reverse. I have relatively no knowledge of java, since MATLAB has the functions programmed in so I didn't need to learn any programming. I now need to convert it to java and I dont have a clue where to start. It would be great if anyone can point me in the right direction! thanks
by my idol krokkis : "U better hope Finland wont have WCG next year and that I wont gain shitloads of skill, cause then I will wash ur mouth with soap, little man."
Phunkapotamus
Profile Joined April 2010
United States496 Posts
March 09 2011 18:01 GMT
#791
On March 10 2011 02:05 AoN.DimSum wrote:
Hi, does anyone know how to break a video into frames using java? I used MATLAB to write a little program for playing a video in reverse. I have relatively no knowledge of java, since MATLAB has the functions programmed in so I didn't need to learn any programming. I now need to convert it to java and I dont have a clue where to start. It would be great if anyone can point me in the right direction! thanks


It depends on the video format for how you would convert a frame's data into an image. I would try and find some open source video decoder that can support multiple video formats. Chances are it will convert the video's frames into a common renderable surface. Then you can choose to grab that data and convert it to the image format of your choice.

"Do a barrel roll"
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
March 12 2011 09:04 GMT
#792
On March 09 2011 00:35 Zocat wrote:
Show nested quote +
On March 04 2011 14:26 Blisse wrote:
On March 04 2011 14:20 Craton wrote:
And you're not going to tell us said question?


LOL well it had something to do with finding out the number of ways you can remove people in a friends list if you can't remove yourself, or people that your friends invited if the maximum list size is 6. I was hoping to look at the question again tomorrow and get back to you (guys). :3

From what I recall, you are given an integer, n, from 1-6 where the highest number is the user (deleter). Then you are given n-1 numbers telling you who invited who into the list.

So if you are given

3
3
3

Then there are three people, the user is the third, and friend one and friend two were both invited by the user (three). I'll try to find the whole question, but where would I start in solving that?


Well, from what you told us:
If there are people on the list who you havent invited and arent friends of someone you invited you cannot remove those. They're therefor irrelevant.

I think you are able to remove people who were invited from your friends as soon as you remove the friend (or else the problem wouldnt make any sense. Just count the people you invited and it's basic combinatorics how many different ways are there to remove them).
So let's assume my thought is correct. Build a "tree" with yourself as the root. Then each chilldnode (of the root) is a person who you invited. Their children are the persons they invited.
Now count how many different ways you can find which visits all edges of the tree.


Yes! That's the way I felt I should have went. Sadly, I have no idea how to build a tree. In any language other than written. Also have to subtract something too I feel because some options don't work? Ugh. At least I knew something about tree diagrams... stupid site won't show this year's questions/answers (answers are in java/c, so no help for python). I'm happy because 60/75 last year was rank 35 of the competitors. Pretty good imo for a novice.

On the other side, the senior competitors, only two people got above 60, one was on the dot, another got 72... yikes! I'm glad I only did the junior one.
There is no one like you in the universe.
djcube
Profile Blog Joined July 2009
United States985 Posts
March 13 2011 04:32 GMT
#793
Java question here:

For anyone familiar with the javax.sound packages, is it possible to capture internal audio data like from the Digital Audio (S/PDIF) device? I've found several examples of capturing audio data from a microphone, but can't find anything related to what I'm looking for, so I'm just wondering if it's possible with the javax.sound packages.
coZen
Profile Joined August 2010
United States192 Posts
March 16 2011 00:49 GMT
#794
C++ assistance:

If anybody would like to help me out on a programming assignment, I would greatly appreciate it. Im doing an intro to C++ course and I just cant get the grasp of this assignment.

The program:
Basically a conversion program that gets a metric input and converts it depending on what the user chooses. Its basically a couple of functions and switches. More details if anybody wishes to help me.
AoN.DimSum
Profile Blog Joined September 2008
United States2983 Posts
March 16 2011 02:02 GMT
#795
On March 10 2011 03:01 Phunkapotamus wrote:
Show nested quote +
On March 10 2011 02:05 AoN.DimSum wrote:
Hi, does anyone know how to break a video into frames using java? I used MATLAB to write a little program for playing a video in reverse. I have relatively no knowledge of java, since MATLAB has the functions programmed in so I didn't need to learn any programming. I now need to convert it to java and I dont have a clue where to start. It would be great if anyone can point me in the right direction! thanks


It depends on the video format for how you would convert a frame's data into an image. I would try and find some open source video decoder that can support multiple video formats. Chances are it will convert the video's frames into a common renderable surface. Then you can choose to grab that data and convert it to the image format of your choice.




thank you, I will play around with that.
by my idol krokkis : "U better hope Finland wont have WCG next year and that I wont gain shitloads of skill, cause then I will wash ur mouth with soap, little man."
Ace
Profile Blog Joined October 2002
United States16096 Posts
March 16 2011 02:05 GMT
#796
On March 16 2011 09:49 coZen wrote:
C++ assistance:

If anybody would like to help me out on a programming assignment, I would greatly appreciate it. Im doing an intro to C++ course and I just cant get the grasp of this assignment.

The program:
Basically a conversion program that gets a metric input and converts it depending on what the user chooses. Its basically a couple of functions and switches. More details if anybody wishes to help me.


What is the problem? An issue with the functions?
Math me up, scumboi. - Acrofales
Augury
Profile Blog Joined September 2008
United States758 Posts
Last Edited: 2011-03-16 02:09:02
March 16 2011 02:08 GMT
#797
On March 16 2011 09:49 coZen wrote:
C++ assistance:

If anybody would like to help me out on a programming assignment, I would greatly appreciate it. Im doing an intro to C++ course and I just cant get the grasp of this assignment.

The program:
Basically a conversion program that gets a metric input and converts it depending on what the user chooses. Its basically a couple of functions and switches. More details if anybody wishes to help me.


This should be pretty simple, just assign the user input for the value to a variable, then write a chain of if statements that check the value of the conversion field.

numericValue = userinputforvalue
conversionType = userinputforconversion

if inches then
output = numericValue * googledconvrate

else if pounds then
output = numericValue * google

else

etc. etc.

display output

Edit: not sure what you're struggling with, need more info tbh
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
March 16 2011 12:59 GMT
#798
For anyone struggling with an intro class, I think it's mostly because they don't have a programmer's mindset yet. You have to be able to think about what the big problem is, splice it up into smaller portions, and then map out what basically needs to be done for each part. I personally like to use comments to organize what needs to happen at the different areas before I go hardcore into the coding. Like for this case, it seems like this is the basic problem:

//obtain user input

//obtain conversion type

//calculate conversion

//display result
Undefeated TL Tecmo Super Bowl League Champion
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
March 16 2011 13:19 GMT
#799
On March 16 2011 21:59 EscPlan9 wrote:
For anyone struggling with an intro class, I think it's mostly because they don't have a programmer's mindset yet. You have to be able to think about what the big problem is, splice it up into smaller portions, and then map out what basically needs to be done for each part. I personally like to use comments to organize what needs to happen at the different areas before I go hardcore into the coding. Like for this case, it seems like this is the basic problem:

//obtain user input

//obtain conversion type

//calculate conversion

//display result


I usually recommend to just think about "how would i do this manually?". Write all steps down on a paper and program one step after the other. If the step is too big to be written in 3 lines of code, think about how to do this one step manually and refine it until you can write a single step of it in 3 lines. Repeat until code is finished. After that, care about optimizing, structure or the other - for beginners not important - aspects.

It's a good starting point, though very tedious. I prefer my "read/hear the problem - have complete code written out in your mind before the problem description is complete" mindset, but that takes ages of practical experience.
ATeddyBear
Profile Blog Joined December 2005
Canada2843 Posts
March 16 2011 13:29 GMT
#800
Any ASP.Net 4 users here?

I am building a web application where a user can search a database for a garbage item (which is associated with a ID) stored in a xls file. When they've selected one from a list, I access another list based on the ID of the item and display a description for which that ID belongs too, this description list is stored an a second sheet in the same xls file.

Problem I have is creating a database storing the data in the xls file and accessing it. I was told to either use SQL or Oracle, but I have never programmed on this platform or using any of those additional languages. Any help on where to get started would be greatly appreciated.
Professional twice over - an analyst and a therapist. The world’s first analrapist.
Prev 1 38 39 40 41 42 1032 Next
Please log in or register to reply.
Live Events Refresh
OSC
16:00
Masters Cup #150 Qual 1-2
davetesta27
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech103
BRAT_OK 95
UpATreeSC 75
Codebar 32
MindelVK 20
JuggernautJason8
StarCraft: Brood War
Bisu 1273
firebathero 425
Soulkey 178
Hyun 155
Mind 96
Movie 42
Yoon 34
scan(afreeca) 24
Rock 18
Mong 1
Dota 2
qojqva4981
Dendi1361
LuMiX1
Counter-Strike
fl0m1055
Other Games
Grubby1895
FrodaN1082
Beastyqt626
ceh9432
B2W.Neo404
mouzStarbuck229
KnowMe204
Skadoodle143
ArmadaUGS86
C9.Mang085
Trikslyr58
Mew2King53
QueenE51
OptimusSC23
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• maralekos1
• IndyKCrew
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• Migwel
• LaughNgamezSOOP
StarCraft: Brood War
• Michael_bg 5
• Pr0nogo 4
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 2807
League of Legends
• Nemesis3523
• imaqtpie1379
• TFBlade704
Upcoming Events
Tenacious Turtle Tussle
4h 59m
The PondCast
15h 59m
OSC
17h 59m
WardiTV Invitational
1d 16h
Online Event
1d 21h
RSL Revival
2 days
RSL Revival
2 days
WardiTV Invitational
2 days
Afreeca Starleague
3 days
Snow vs Soma
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV Invitational
3 days
CrankTV Team League
3 days
RSL Revival
3 days
Wardi Open
4 days
CrankTV Team League
4 days
Replay Cast
5 days
WardiTV Invitational
5 days
CrankTV Team League
5 days
Replay Cast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
BSL 21 Non-Korean Championship
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 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.