• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:49
CEST 20:49
KST 03:49
  • 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 1 - Final Week6[ASL19] Finals Recap: Standing Tall12HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Esports World Cup 2025 - Brackets Revealed10Weekly Cups (July 7-13): Classic continues to roll4Team TLMC #5 - Submission extension3Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7
StarCraft 2
General
The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread Who will win EWC 2025? Weekly Cups (July 7-13): Classic continues to roll Esports World Cup 2025 - Brackets Revealed
Tourneys
FEL Cracov 2025 (July 27) - $8000 live event RSL: Revival, a new crowdfunded tournament series $5,100+ SEL Season 2 Championship (SC: Evo) WardiTV Mondays Sparkling Tuna Cup - Weekly Open Tournament
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
External Content
Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome
Brood War
General
Flash Announces (and Retracts) Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Starcraft in widescreen A cwal.gg Extension - Easily keep track of anyone
Tourneys
[Megathread] Daily Proleagues Cosmonarchy Pro Showmatches CSL Xiamen International Invitational [BSL20] Non-Korean Championship 4x BSL + 4x China
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread CCLP - Command & Conquer League Project The PlayStation 5
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Future of Porn Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2025!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 2024 - 2025 Football Thread NBA General Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 713 users

The Big Programming Thread - Page 803

Forum Index > General Forum
Post a Reply
Prev 1 801 802 803 804 805 1031 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.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
November 25 2016 03:15 GMT
#16041
No libraries due to boss saying so basically. Just something to get started with, I've just read https://developers.google.com/web/fundamentals/design-and-ui/responsive/ and found it very helpful so anything along those lines perhaps? Not really sure if there's a "bible" of responsive web design or some standard resource, if there isn't then I can keep potting around on the web reading different resources.
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
shz
Profile Blog Joined October 2010
Germany2687 Posts
November 25 2016 12:17 GMT
#16042
This looks like a good reference: http://cssreference.io/#hn

Not a complete guide, though :/
Liquipedia
Manit0u
Profile Blog Joined August 2004
Poland17249 Posts
Last Edited: 2016-11-25 13:49:54
November 25 2016 13:39 GMT
#16043
On November 25 2016 12:15 Birdie wrote:
No libraries due to boss saying so basically. Just something to get started with, I've just read https://developers.google.com/web/fundamentals/design-and-ui/responsive/ and found it very helpful so anything along those lines perhaps? Not really sure if there's a "bible" of responsive web design or some standard resource, if there isn't then I can keep potting around on the web reading different resources.


So, basically, your boss wants you to implement from scratch something that has already been done, tried and tested. Then spend a bazillion hours fixing and testing it for all kinds of different browsers and devices and then keeping it up to date with changes in those browsers and devices?

If you don't have a very good reason to do that - like hitting magic frame count and request round trip sweet spot for mobile devices being absolutely necessary or you trying to enter the market with the product that's going to compete with responsive layout libraries - then it's a very poor business decision if you ask me, because you're wasting precious time and resources on developing something that's already out there.

If the libraries are simply too big for your specs you should know that you can trim them down a lot by only including components you'll actually use (bootstrap even has a page where you can customize your download to suit your needs).

Anyway, here's some stuff that might help you:

http://blog.froont.com/9-basic-principles-of-responsive-web-design/
https://responsivedesign.is/
http://bradfrost.github.io/this-is-responsive/

The last 2 links should have everything you need, with plenty of links to other resources (books, articles, videos) that will teach you what you need to know. Just be aware that there's a lot of it.
Time is precious. Waste it wisely.
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
November 25 2016 14:59 GMT
#16044
Did anyone here use nodejs or python with native C/C++ bindings? How good is it performance-wise?
"windows bash is a steaming heap of shit" tofucake
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
November 25 2016 16:15 GMT
#16045
Okay so, I have an assignment where I am making my own HashSet. It's an array of buckets, buckets have linked lists (also self defined, not using premade structures).

One of the methods I have to define is "getSize" - which returns total number of elements.

A requirement of the project is that it is fast.

And so I ask, what is to keep me from just defining an int variable "size" that increments whenever an element is added and decrements when one is taken away? Wouldn't that be super quick?
AKnopf
Profile Blog Joined March 2011
Germany259 Posts
Last Edited: 2016-11-25 16:33:07
November 25 2016 16:23 GMT
#16046
Hi,

yes, that would make it very fast. But it would slow down the "add" operation (not asymptotically though)

How was "fast" defined in the requirement?




Edit:
On November 24 2016 22:23 Manit0u wrote:

public static function bool2int($variable) {
if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;
} else {
$result = null;
}
return $result;
}


Kill me...


The other day I saw my boss write code like this:

public bool Even(int number)
{
bool even = false;
if (number % 2 == 0)
{
even = true;
}
if (even != true)
{
return false;
}
else
{
return true;
}
}


Yes, code like this still gets written. And no, he was not trolling, I promise.
The world - its a funny place
RoomOfMush
Profile Joined March 2015
1296 Posts
Last Edited: 2016-11-25 16:28:25
November 25 2016 16:27 GMT
#16047
On November 26 2016 01:15 travis wrote:
Okay so, I have an assignment where I am making my own HashSet. It's an array of buckets, buckets have linked lists (also self defined, not using premade structures).

One of the methods I have to define is "getSize" - which returns total number of elements.

A requirement of the project is that it is fast.

And so I ask, what is to keep me from just defining an int variable "size" that increments whenever an element is added and decrements when one is taken away? Wouldn't that be super quick?

That is probably what you are supposed to do since it is what all implementations in the standard library do. Not all exercises are supposed to be very difficult or challenging. Sometimes its important to understand that trivially simple solutions are the best solutions.
Manit0u
Profile Blog Joined August 2004
Poland17249 Posts
November 25 2016 16:32 GMT
#16048
Don't all such structures in Java hold their length as a static property anyway?

You could simply return the sum of lengths of each element. That should be pretty fast. If you want it faster then you add overhead on adding elements and doing it as you pointed out, having the property in your hash set to store it in and recalculating it every time something is added to any of the elements.
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
November 25 2016 16:44 GMT
#16049
ok cool thanks guys. they didn't really define fast

On November 26 2016 01:32 Manit0u wrote:
Don't all such structures in Java hold their length as a static property anyway?

You could simply return the sum of lengths of each element. That should be pretty fast. If you want it faster then you add overhead on adding elements and doing it as you pointed out, having the property in your hash set to store it in and recalculating it every time something is added to any of the elements.


My structure is an array of connecting nodes (an arraylist I have to create myself). So I would have to write something to store their length myself.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 25 2016 17:03 GMT
#16050
Doing anything other than keeping a size variable around is very rare for container classes. It's a negligible memory and performance impact and a massive improvement for getSize.

Calculating the sum of the size of your buckets is actually fairly slow because ideally you have at most one element per bucket - if the hash is good.
If you have a good reason to disagree with the above, please tell me. Thank you.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2016-11-25 17:45:50
November 25 2016 17:38 GMT
#16051
If you have an integer and you read it as bytes (4 bytes on Windows?), is it in binary mode already? I know binary is 01100110 stuff, but I'm not sure about bytes in this case. I studied Computer Science, but I either forgot or don't know if bytes is still in binary format.

Edit: Well, I remember hearing about bits which are in binary. I guess I just didn't put two and two together.
RoomOfMush
Profile Joined March 2015
1296 Posts
November 25 2016 18:24 GMT
#16052
On November 26 2016 02:38 Shield wrote:
If you have an integer and you read it as bytes (4 bytes on Windows?), is it in binary mode already? I know binary is 01100110 stuff, but I'm not sure about bytes in this case. I studied Computer Science, but I either forgot or don't know if bytes is still in binary format.

Edit: Well, I remember hearing about bits which are in binary. I guess I just didn't put two and two together.

How many bytes an integer is has nothing to do with windows. The programming language defines what an integer is. In Java an int (and Integer) is always 4 bytes no matter what. Even on your toaster it would be 4 bytes if your toaster did support java.
In C and C++ an integer has the size of a data word native to your CPU-architecture. For most x86 CPU's that would be 4 bytes but it doesnt have to be.

"binary" is only a representation for numbers much like decimal or hexadecimal. Any number can be written in binary. Any number can be written in hexadecimal too. Computer really dont care about binary, decimal or hexadecimal. For a computer these things dont exist. They are only important for humans when they attempt to read data from a computer.

A bit is simply the smallest data structure that exists. It is effectively a mathematical boolean. A set of bits can be read as a number written in binary but doesnt have to be. Its all about what you make of it. Its just information.
tofucake
Profile Blog Joined October 2009
Hyrule19035 Posts
November 25 2016 18:31 GMT
#16053
Technically everything on a computer is binary...
Liquipediaasante sana squash banana
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2016-11-25 19:09:18
November 25 2016 19:08 GMT
#16054
On November 26 2016 03:31 tofucake wrote:
Technically everything on a computer is binary...


Exactly. That's what I remember from Computer Science as well. I was confused about that part from previous comment.

On November 26 2016 03:24 RoomOfMush wrote:
Computer really dont care about binary, decimal or hexadecimal

RoomOfMush
Profile Joined March 2015
1296 Posts
November 25 2016 19:34 GMT
#16055
On November 26 2016 03:31 tofucake wrote:
Technically everything on a computer is binary...

No that doesnt make any sense. Binary is a representation of numbers. A computer is a complex physical machine. Everything inside it is currents of electricity. Binary is how we humans decided to interprete it as. Its just a number format that is convenient to use. Binary doesnt happen until you enter the software-level.
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
Last Edited: 2016-11-25 20:08:05
November 25 2016 19:54 GMT
#16056
On November 26 2016 01:15 travis wrote:
Okay so, I have an assignment where I am making my own HashSet. It's an array of buckets, buckets have linked lists (also self defined, not using premade structures).

One of the methods I have to define is "getSize" - which returns total number of elements.

A requirement of the project is that it is fast.

And so I ask, what is to keep me from just defining an int variable "size" that increments whenever an element is added and decrements when one is taken away? Wouldn't that be super quick?


Thread safety if you care for it (which you probably don't since implementing concurrent hash maps is really hard). Other than that, nothing. You need to be able to quickly calculate load (which is size/capacity) to make growth/shrinkage decisions on each operation anyway.

On November 26 2016 01:44 travis wrote:
ok cool thanks guys. they didn't really define fast.


Size calculation for a hash table is required to be O(1). Since you have to maintain the upper bound on the load (otherwise guarantees of O(1) on other operations are broken for large data sets), you have to check if you should grow/reallocate your underlying array on each insert. Since size calculation is now a part of the insert, it is too bounded by O(1).
You want 20 good men, but you need a bad pussy.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 25 2016 20:22 GMT
#16057
On November 26 2016 04:54 BluzMan wrote:
Show nested quote +
On November 26 2016 01:15 travis wrote:
Okay so, I have an assignment where I am making my own HashSet. It's an array of buckets, buckets have linked lists (also self defined, not using premade structures).

One of the methods I have to define is "getSize" - which returns total number of elements.

A requirement of the project is that it is fast.

And so I ask, what is to keep me from just defining an int variable "size" that increments whenever an element is added and decrements when one is taken away? Wouldn't that be super quick?


Thread safety if you care for it (which you probably don't since implementing concurrent hash maps is really hard).

Atomic increment/decrement is the least of your problems in that case.
If you have a good reason to disagree with the above, please tell me. Thank you.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-11-25 20:44:08
November 25 2016 20:35 GMT
#16058
ah solved my own problem

but I am left with a question

are objects that have been declared but not initialized set as "null" in java?

I am reading they are
but then why does eclipse give me errors when I don't initialize them (it makes me explicitly say that they = null)
RoomOfMush
Profile Joined March 2015
1296 Posts
Last Edited: 2016-11-25 20:50:48
November 25 2016 20:50 GMT
#16059
On November 26 2016 05:35 travis wrote:
ah solved my own problem

but I am left with a question

are objects that have been declared but not initialized set as "null" in java?

I am reading they are
but then why does eclipse give me errors when I don't initialize them (it makes me explicitly say that they = null)

You never declare objects. You declare variables; they are not the same thing as an object. An object is only created when the "new" keyword is used. That is the only way for an object to ever be. (if we ignore black voodoo magic like TheUnsafe and compiler magic like Boxing / Strings)

For example:
String a = new String("Hello World");
String b = a;
String c;
String d = null;
new String("Test");

The above code has 4 variables but only 2 Objects. 2 Variables (a, b) point to the same object. One variable (c) was declared but not initialized; it points to no object at all. This variable is not usable until it is initialized. The last variable (d) is pointing to null which is "no object" in java.
Our second Object is created but has no variable pointing to it. We can not do anything with it anymore because we have no reference to work with.

Its different with member variables (attributes) though. These are ALWAYS initialized because the Compiler enforces that. A member variable of object type is always initialized with null unless you initialize it with something else.
Acrofales
Profile Joined August 2010
Spain17976 Posts
November 25 2016 20:51 GMT
#16060
On November 26 2016 05:35 travis wrote:
ah solved my own problem

but I am left with a question

are objects that have been declared but not initialized set as "null" in java?

I am reading they are
but then why does eclipse give me errors when I don't initialize them (it makes me explicitly say that they = null)

Was about to answer, but you did it yourself. Not quite sure about the rest. Java changed that shit at some point. It used to be undefined (and effectively initialized to null), and good practice was to initialize them explicitly to null. Then it became explicit for fields (I think in Java 6), and it was unnecessary to initialize fields to null (and you got a warning that that code did nothing... thank you). I have no idea whether variables follow the former or the latter initialization rules. Clearly you are being told to initialize it to null, so it's probably the former. Or you're working with a really old version of Java.
Prev 1 801 802 803 804 805 1031 Next
Please log in or register to reply.
Live Events Refresh
WardiTV European League
16:00
Swiss Groups Day 4
Harstem vs HeRoMaRinELIVE!
WardiTV1046
TKL 307
IndyStarCraft 279
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 566
TKL 307
IndyStarCraft 279
UpATreeSC 156
BRAT_OK 82
MindelVK 35
StarCraft: Brood War
EffOrt 687
Rush 615
BeSt 354
firebathero 346
Larva 60
PianO 52
Movie 42
Aegong 26
JulyZerg 23
sas.Sziky 23
[ Show more ]
yabsab 15
sSak 8
SilentControl 5
Dota 2
qojqva3888
canceldota66
League of Legends
Grubby3649
Counter-Strike
pashabiceps1197
flusha300
Heroes of the Storm
Liquid`Hasu137
Other Games
FrodaN4790
Beastyqt722
ceh9685
mouzStarbuck167
oskar140
Skadoodle137
elazer114
C9.Mang084
ArmadaUGS82
Mew2King62
Trikslyr61
QueenE60
Organizations
Other Games
gamesdonequick3389
StarCraft 2
angryscii 9
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• davetesta23
• intothetv
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• IndyKCrew
• Kozan
StarCraft: Brood War
• 80smullet 18
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 2615
League of Legends
• Nemesis2831
• Jankos1904
• TFBlade829
Other Games
• imaqtpie1592
• Shiphtur214
Upcoming Events
PiGosaur Monday
5h 11m
uThermal 2v2 Circuit
21h 11m
Replay Cast
1d 5h
The PondCast
1d 15h
WardiTV European League
1d 21h
Replay Cast
2 days
Epic.LAN
2 days
CranKy Ducklings
3 days
Epic.LAN
3 days
CSO Contender
3 days
[ Show More ]
BSL20 Non-Korean Champi…
3 days
Bonyth vs Sziky
Dewalt vs Hawk
Hawk vs QiaoGege
Sziky vs Dewalt
Mihu vs Bonyth
Zhanhun vs QiaoGege
QiaoGege vs Fengzi
Sparkling Tuna Cup
4 days
Online Event
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs Zhanhun
Dewalt vs Mihu
Hawk vs Sziky
Sziky vs QiaoGege
Mihu vs Hawk
Zhanhun vs Dewalt
Fengzi vs Bonyth
Esports World Cup
6 days
ByuN vs Astrea
Lambo vs HeRoMaRinE
Clem vs TBD
Solar vs Zoun
SHIN vs Reynor
Maru vs TriGGeR
herO vs Lancer
Cure vs ShoWTimE
Liquipedia Results

Completed

2025 ACS Season 2: Qualifier
RSL Revival: Season 1
Murky Cup #2

Ongoing

JPL Season 2
BSL 2v2 Season 3
Copa Latinoamericana 4
Jiahua Invitational
BSL20 Non-Korean Championship
Championship of Russia 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters

Upcoming

CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
2025 ACS Season 2
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
BSL Season 21
K-Championship
RSL Revival: Season 2
SEL Season 2 Championship
uThermal 2v2 Main Event
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
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
IEM Cologne 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.