• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:27
CEST 15:27
KST 22:27
  • 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
[ASL21] Ro16 Preview Pt1: Fresh Flow5[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21ByuL: The Forgotten Master of ZvT30
Community News
MaNa leaves Team Liquid13$5,000 WardiTV TLMC tournament - Presented by Monster Energy5GSL CK: More events planned pending crowdfunding7Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win0[BSL22] RO32 Group Stage5
StarCraft 2
General
MaNa leaves Team Liquid Team Liquid Map Contest #22 - Presented by Monster Energy Quebec Clan still alive ? BGE Stara Zagora 2026 cancelled Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament $5,000 WardiTV TLMC tournament - Presented by Monster Energy RSL Revival: Season 5 - Qualifiers and Main Event GSL CK: More events planned pending crowdfunding Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 521 Memorable Boss The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
ASL21 General Discussion [ASL21] Ro16 Preview Pt1: Fresh Flow BGH Auto Balance -> http://bghmmr.eu/ JD's Ro24 review The Korean Terminology Thread
Tourneys
[ASL21] Ro16 Group A Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro24 Group F
Strategy
Any training maps people recommend? Fighting Spirit mining rates Muta micro map competition What's the deal with APM & what's its true value
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread General RTS Discussion Thread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Canadian Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread US Politics Mega-thread The China Politics Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
lurker extra damage testi…
StaticNine
How Streamers Inspire Gamers…
TrAiDoS
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2107 users

The Big Programming Thread - Page 840

Forum Index > General Forum
Post a Reply
Prev 1 838 839 840 841 842 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.
Manit0u
Profile Blog Joined August 2004
Poland17720 Posts
February 09 2017 15:21 GMT
#16781
On February 09 2017 23:45 Morfildur wrote:
My company wants to replace all ~1500 PCs across all stores so they can access the coming web frontend since the old XP/IE8 boxes can't do HTML5 and stuff and so wont Work with the Hybris shop that is in the works.

I was just thinking about using thin clients that just use remote desktop or something like that instead. What solutions would work for 1500 PCs across all of europe without requiring the same amount of physical hardware? Maybe stuff that works decently with not-that-modern Internet connections as well?

I'm a programmer, not an admin, so it's not really my field of expertise.


Well, if all those computers will be used for is accessing the store, then you could redistribute the work by having 1 central computer in each major location and some slave computers using remote login/desktop on that (how usually classroom computers are set up). This has the added benefit of being able to update everything on numerous computers from a single location.

This way, you have a network of "hubs" (central computers) with slaves connected to them and you only really need to worry about the hubs (should be decent) while slaves can be super cheap garbage.

If you can't do it like that, there's always an option of either getting 1500 new low end computers (or simply using what's in place already) but replacing their OS with lightweight modern Linux distro. This way you don't need a lot of power but get all the benefits of modern browsing.
Time is precious. Waste it wisely.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
February 09 2017 16:52 GMT
#16782
The stores only have 1-2 PCs each, we just have a bit over 1000 stores. They also need to run some ancient Lotus Notes application, so Linux is sadly not an option. I think management already decided on buying full PCs for every store, but maybe in a few years when we would have to do that *again*, we'll switch to thin clients or something like that.
RoomOfMush
Profile Joined March 2015
1296 Posts
February 09 2017 17:42 GMT
#16783
I recently had to work with C# and I was baffled that I couldnt find many very useful methods from the java standard library in the C# standard library. I was doing some online research and couldnt find any satisfying answers there either. So I turn to you guys with the following questions:

1) Is there any build-in way of printing arrays and lists nicely? (similar or equal to the java toString method)
2) Is there any easy way of comparing the contents of two wildcard arrays? Similar to the following java code:
	public static <T, K> boolean arrayEquals(T[] a1, K[] a2) {
int length = a1.length;
if (length != a2.length) {
return false;
}
for (int i = 0; i < length; i++) {
if (!Objects.equals(a1[i], a2[i])) {
return false;
}
}
return true;
}

3) Same as 2) but for lists of any type.

It would be incredible if these things are really as difficult in C# as they appear to be...
Thanks for any help.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
February 09 2017 18:28 GMT
#16784
On February 10 2017 02:42 RoomOfMush wrote:
I recently had to work with C# and I was baffled that I couldnt find many very useful methods from the java standard library in the C# standard library. I was doing some online research and couldnt find any satisfying answers there either. So I turn to you guys with the following questions:

1) Is there any build-in way of printing arrays and lists nicely? (similar or equal to the java toString method)
2) Is there any easy way of comparing the contents of two wildcard arrays? Similar to the following java code:
	public static <T, K> boolean arrayEquals(T[] a1, K[] a2) {
int length = a1.length;
if (length != a2.length) {
return false;
}
for (int i = 0; i < length; i++) {
if (!Objects.equals(a1[i], a2[i])) {
return false;
}
}
return true;
}

3) Same as 2) but for lists of any type.

It would be incredible if these things are really as difficult in C# as they appear to be...
Thanks for any help.

1) What format does Java's ToString() bring back? If comma or space delimited, you can do a String.Join(',', a1). You can also override ToString in C# for all objects.

2+3) SequenceEquals, if I'm reading correctly.
Average means I'm better than half of you.
Artesimo
Profile Joined February 2015
Germany571 Posts
February 09 2017 19:21 GMT
#16785
+ Show Spoiler +

Next DB question, regarding the n+1 problem with default fetching:

A JPA-query fetches a list of all books of publishers with a specific location.

Tables/Columns:
Publisher(PublisherID[primaryKey], name, location))
Book(ISBN[primaryKey], titel, price, publisherID[foreignKey])

About 700 publishers, 40 of them in the specific location, each of which has about 200 books in its inventory.

Question: Explain the n+1 problem, regarding the 40 publishers. How many selects willbe send to the database?

Answer: We got 41 selects that are send to the database. 1 select to get all the publishers of the specific location(40) and for each publisher we have a select to get all published books, therefore we got another 40 selects.


And another regarding the difference of data I get from a fetch join / join in an application:
Join will give back a single entity per member/facutly combination, like all members of a faculty while fetch join would give me 2 entities per member/facutly combination: the member and the faculty seperately


Another question. I got 2 Entities:
@Entity
public class Product {
@id
private Long id;
private String productName;
@ManyToOne
private Brand brand;}

@Entity
public class Brand {
@id
private Long id;
private String brandName;
@OneToMany(mappedBy="brand")
private Set <Product> products = new HashSet();
}

Find the brandname of the product with the ID 17, formualte an efficient JPQL-Querry
My solution:
System.out.println(em.createQuery(
"SELECT n.brandName
FROM product p join p.brand
WHERE p.id = 17").getSingleResult();
RoomOfMush
Profile Joined March 2015
1296 Posts
Last Edited: 2017-02-09 19:24:47
February 09 2017 19:22 GMT
#16786
2, 3) SequenceEquals doesnt work because it expects both arrays to be of the same generic type. The problem is that I deserialize the arrays (lists) from a bytestream and the runtime type is not known at compile time.

1) The format of the string is not that important as long as it is humanly readable. Why is there no sensible ToString method for arrays and lists? The problem with the join method is that I do not know the runtime type of the list or array as stated above. The nice thing about javas generics is that the runtime type doesnt matter since it is compiled away to object anyway. In C# that is not the case though and typecasts or wildcards dont work that well.

Just imagine I have a List of some arbitrary type but the only reference I have is an object reference. The generic type of the list is not known at compile time. I need to print the contents of the list though. In java I could do this:
	public static String ListToString(Object obj) {
List<?> list = (List<?>) obj;
StringBuilder sb = new StringBuilder();
for (Object element : list) {
sb.append(element);
sb.append(" ");
}
return sb.toString();
}

But since wildcards do not exist in C# what could I do in this case? Maybe cast to some non-generic enumerable interface? Would it work to cast to IList?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
February 09 2017 20:08 GMT
#16787
The nice thing about C# is that you don't work with lists of objects of unknown types. Fix your design, don't try to force bad java stuff on C#.

Also don't use the non-generic collections/interfaces. They are pretty much obsolete. If you really must, try
var e = obj as IEnumberable<object>;
if (null != e)
return string.Join(" ", e);
return e.ToString();
If you have a good reason to disagree with the above, please tell me. Thank you.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
February 09 2017 20:25 GMT
#16788
So the issue is more related to generics than anything else?

I'm not really seeing anything in your examples that couldn't be implemented through C#'s generics. ToString is inherited by all objects so you can print out any List regardless of type, and you should be able to compare two lists of generics even if they're different types.

Of course, string format or comparison may not be to your liking, but you can override and implement your own methods for those. Now, Java's wildcards may be required in other circumstances, but...
Average means I'm better than half of you.
AKnopf
Profile Blog Joined March 2011
Germany259 Posts
February 09 2017 20:26 GMT
#16789
Casting should not be a problem for you, actually.(?)
So you already deserialized your array of Foo from your bytestream, right? What is the type of your variable for that array?

Say all you want to do is, iterate over something iterable and call toString() on its elements and append those strings. You would probably end up writing something like this.


public static <T> string ToCustomString(this IEnumerable<T> enumerable)
{
return enumerable.Select(elem => elem.ToString()).Join();
}

Forgive me any syntax errors since I don't have a compiler here.
Since T can be anything and T is always derived from Object and ToString() is defined in Object, you should be fine to call ToString() here. The "this" in before the parameter is the extension method syntax. You can look it up here: http://www.dotnettricks.com/learn/csharp/c-sharp-extension-method


I guess your actual problem is that you don't know how to declare the stuff that comes from your bytestream, since you don't know the type at runtime. This is a very specific question and we don't know anything about your objects. To me it seems weird that you want to deserialize something without knowing anything about the type of data you want to deserialize. In this case, I guess you can only declare it as byte[]. This way you would end up with IEnumerable<byte[]> :/


TL;DR: I'm not quite sure, what your problem is. So im rambling around hoping to hit the right spot.

P.S.: If you extend IEnumerable always remember to also extend IQueriable... #csharpthings
The world - its a funny place
Manit0u
Profile Blog Joined August 2004
Poland17720 Posts
Last Edited: 2017-02-09 20:44:56
February 09 2017 20:27 GMT
#16790
On February 10 2017 04:21 Artesimo wrote:
Another question. I got 2 Entities:
@Entity
public class Product {
@id
private Long id;
private String productName;
@ManyToOne
private Brand brand;}

@Entity
public class Brand {
@id
private Long id;
private String brandName;
@OneToMany(mappedBy="brand")
private Set <Product> products = new HashSet();
}

Find the brandname of the product with the ID 17, formualte an efficient JPQL-Querry
My solution:
System.out.println(em.createQuery(
"SELECT n.brandName
FROM product p join p.brand
WHERE p.id = 17").getSingleResult();


First of all, if the tables and columns are not provided, you should change productName and brandName to simply name. You avoid information duplication, and you don't do weird-looking things like Product.getProductName().

Now, on to the query:

Query q = em.createQuery(
"SELECT b.name FROM brands b WHERE b.product_id = :productId")
.setParameter("productId", 17)
.getSingleResult();


That would be the optimal query. But getSingleResult() throws exception on null (which is a perfectly viable db response, mind you). Also, JPQL blows hard, but many things do after you've been using cool stuff like Doctrine and now ActiveRecord for Rails:


Brand.where(product: product).pluck(:name).first


So much less writing superfluous stuff. You just state your intent and it happens
Time is precious. Waste it wisely.
Artesimo
Profile Joined February 2015
Germany571 Posts
Last Edited: 2017-02-09 20:51:37
February 09 2017 20:45 GMT
#16791
On February 10 2017 05:27 Manit0u wrote:
First of all, if the tables and columns are not provided, you should change productName and brandName to simply name. You avoid information duplication, and you don't do weird-looking things like Product.getProductName().

Now, on to the query:

Query q = em.createQuery(
"SELECT b.name FROM brand b WHERE b.product_id = :productId")
.setParameter("productId", 17)
.getSingleResult();


That would be the optimal query. But getSingleResult() throws exception on null (which is a perfectly viable db response, mind you). Also, JPQL blows hard, but many things do after you've been using cool stuff like Doctrine and now ActiveRecord for Rails:


Brand.find_by(product: product).pluck(:name)


So much less writing superfluous stuff. You just state your intent and it happens


Thanks a lot. I am currently doing pracitce exams so I just copy pasted straight from the PDF, so everything but the Query was given and I can't really do much beyond that. Not very confident when it comes to data bases.
Your non JPQL-example is the equivalent of getting
System.out.println(myEntityManager.find(Product.class, 17).getBrand().getBrandName()

I assume? I can't really say much about JPQL vs other stuff since I only know JPQL and even that only in theory.


EDIT: Wait... where does b.product_id actually comes from in your example? Does the ID-row of a Table accesed by TABLENAME_ROWNAME when accesed this way?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2017-02-09 21:23:36
February 09 2017 21:23 GMT
#16792
On February 09 2017 17:08 Manit0u wrote:
Show nested quote +
On February 09 2017 16:28 Shield wrote:
On February 09 2017 10:31 Blisse wrote:
On February 09 2017 08:24 Artesimo wrote:
On February 09 2017 08:12 Blisse wrote:
On February 09 2017 08:07 Artesimo wrote:
On February 09 2017 07:45 Manit0u wrote:
Just compare the code. In your example plenty of things could go wrong. You could go out of transaction scope unexpectedly, you make two commits for a single change operation, etc.

Bonus question: What would happen to the original code if no object was fetched from the db?

I'm not entirely sure why they're assigning you such questions. I would personally use a hatchet on anyone trying to push code like that.


Yeah, which is why I was asking in here... I am not really sure what exactly the point of the question is. I am pretty sure they are looking for one/two very specific answers but I am just not sure...

About the bonus question: I assume since there hasn't been fetched an actual object from the DB, the entity is empty and you would get some kind of error since you are calling a non static function (setName) in a static enviroment?


The point of the question was ensuring if you knew why the databases are transactional and what are the errors that occur if they're used non-transactionally. Sometimes it's the too-obvious answer.

For the bonus I don't believe static has to do with anything here.


You can call a static funtcion without an actual entity, and you can call a function that doesn't affect the attributes of an object (like a simple print) even if the variable doesn't contain the object yet.

RandomClass x = null;
x.JustPrintsHello();//works
x.getSomeAttribute();//doesn't work;


EDIT: I might be wrong though, but I am sure I had the exact error in my code once and that static/dynamic error message was handed to me by glorious netbeans


I meant it more in the sense that it wasn't a static method so bringing static-ness into it doesn't really apply. It'd be simply an error because either the object is null, or the object was fetched but out-of-sync, or however that database handles that situation as Shield described.

I've never seen people call a static method thruogh a null object before ... but I just tested it in Java and it works. freaky af, please don't do that purposely irl lol.

Object a = null; 
a.staticMethod(); // worked normally


I suppose it works because it is translated into Class.staticMethod() rather than a.staticMethod(). It's weird when 'a' object is null.


But, shouldn't you call static methods with :: instead of .?


If it's C++, yes. I don't think C# and Java use ::; they seem to prefer Class.function() but I remember Java is happy with object.function() when function() is static.
Manit0u
Profile Blog Joined August 2004
Poland17720 Posts
February 09 2017 22:53 GMT
#16793
On February 10 2017 05:45 Artesimo wrote:
Show nested quote +
On February 10 2017 05:27 Manit0u wrote:
First of all, if the tables and columns are not provided, you should change productName and brandName to simply name. You avoid information duplication, and you don't do weird-looking things like Product.getProductName().

Now, on to the query:

Query q = em.createQuery(
"SELECT b.name FROM brand b WHERE b.product_id = :productId")
.setParameter("productId", 17)
.getSingleResult();


That would be the optimal query. But getSingleResult() throws exception on null (which is a perfectly viable db response, mind you). Also, JPQL blows hard, but many things do after you've been using cool stuff like Doctrine and now ActiveRecord for Rails:


Brand.find_by(product: product).pluck(:name)


So much less writing superfluous stuff. You just state your intent and it happens


Thanks a lot. I am currently doing pracitce exams so I just copy pasted straight from the PDF, so everything but the Query was given and I can't really do much beyond that. Not very confident when it comes to data bases.
Your non JPQL-example is the equivalent of getting
System.out.println(myEntityManager.find(Product.class, 17).getBrand().getBrandName()

I assume? I can't really say much about JPQL vs other stuff since I only know JPQL and even that only in theory.


EDIT: Wait... where does b.product_id actually comes from in your example? Does the ID-row of a Table accesed by TABLENAME_ROWNAME when accesed this way?


I've updated my Rails example so it doesn't instantiate the object and returns a single string instead.

You're right about my mistake (I'm bloody tired after 10 hours at work). The join goes the other way, so the query should look more like this:


Query q = em.createQuery(
"SELECT b.name FROM brand b
JOIN producs p
WHERE p.id = :productId")
.setParameter("productId", 17)
.getSingleResult();


Note: You can swap out tables in FROM and JOIN clauses and it'll work the same. JOIN == INNER JOIN.
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-09 23:29:46
February 09 2017 23:03 GMT
#16794
let's verify that I understand this terminology from my discrete math class

our domain: all the reals
our function: f(x) = x^4

what possible co-domains can we have (select all that apply)

1.) Naturals
2.) Integers
3.) Reals >= 0
4.) Reals
5.) Complex numbers


ok so, based on my understanding of co-domain, I believe that the answer is just reals >= 0. But when I look up the term "co-domain" it's a little confusing as to whether co-domain is EXACTLY the set that includes all possible outputs of the function, or if it can be a superset of the set that includes all possible outputs of the function

because if it is the latter, then I believe that #4 also applies




edit: this shit makes no sense. websites (and my teacher's slides) define codomain as a set that has every possible output of the domain in it. but then in his slides he's asking about making functions injective/surjective and he seems to be restricting the codomain at will.

edit: oh i get an example I was just confused about
Artesimo
Profile Joined February 2015
Germany571 Posts
February 09 2017 23:16 GMT
#16795
On February 10 2017 07:53 Manit0u wrote:
I've updated my Rails example so it doesn't instantiate the object and returns a single string instead.

You're right about my mistake (I'm bloody tired after 10 hours at work). The join goes the other way, so the query should look more like this:


Query q = em.createQuery(
"SELECT b.name FROM brand b
JOIN producs p
WHERE p.id = :productId")
.setParameter("productId", 17)
.getSingleResult();


Note: You can swap out tables in FROM and JOIN clauses and it'll work the same. JOIN == INNER JOIN.


Thank you twice then, for helping me out even though your had a hard day. You really helped me a lot.
slmw
Profile Blog Joined October 2010
Finland233 Posts
February 09 2017 23:31 GMT
#16796
Codomain is part of the function's definition. You can have a function [ f(x)=x+1: Integers -> Reals]. You can also have [ f(x)=x+1: Integers -> Integers]. The function itself does the same calculation in each case, but in the first case some of the elements in the codomain do not have a mapping to an element in the domain.

Codomain is always a superset of the image of the function. Therefore 3,4, and 5 are the correct answers to the question.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 09 2017 23:37 GMT
#16797
ahhh
because a complex number can be a real number?

thank you that makes sense
Artesimo
Profile Joined February 2015
Germany571 Posts
Last Edited: 2017-02-10 00:34:45
February 10 2017 00:00 GMT
#16798
On February 10 2017 07:53 Manit0u wrote:

Query q = em.createQuery(
"SELECT b.name FROM brand b
JOIN producs p
WHERE p.id = :productId")
.setParameter("productId", 17)
.getSingleResult();


Another Question, shouldn't it be:

Query q = em.createQuery(
"SELECT b.name FROM brand b
JOIN b.products p
WHERE p.id = :productId")
.setParameter("productId", 17)
.getSingleResult();


I don't haven't really found a good explanation, but every example I stumbled across during my research, joins always had the format "something.Table x" other that the 'x' is what you are refering to, to access the from the join resulting table.


Also: I have two entities, say account and owner with a ManyToMany relationship account being the inverse side. If I wanted the names of the owners of all accounts that have <0 money and the accountnumber, can I just use:

Query q = em.createQuery(
"SELECT c.firstName, c.LastName, a.id
FROM Customer c, Accounts a
JOIN c.accounts
WHERE a.balance<0")
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 10 2017 03:18 GMT
#16799
What is an elegant way to set a bunch of div colours in SASS?

I would ideally like to do something like
$brown: #955436
$lightblue: #AAE0FA
$pink: #D93A96
$orange: #F7941D
$red: #ED1B24
$yellow: #FEF224
$green: #1FB25A
$darkblue: #0072BB

.block-(colorexample)
background-color:$colorexample


where I could have divs with classes like
block-brown
and have it automatically sub in the colour. Should I just not bother and make a block-colour for every single colour I have?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Manit0u
Profile Blog Joined August 2004
Poland17720 Posts
Last Edited: 2017-02-10 09:45:38
February 10 2017 07:39 GMT
#16800
On February 10 2017 12:18 WarSame wrote:
What is an elegant way to set a bunch of div colours in SASS?

I would ideally like to do something like
$brown: #955436
$lightblue: #AAE0FA
$pink: #D93A96
$orange: #F7941D
$red: #ED1B24
$yellow: #FEF224
$green: #1FB25A
$darkblue: #0072BB

.block-(colorexample)
background-color:$colorexample


where I could have divs with classes like
block-brown
and have it automatically sub in the colour. Should I just not bother and make a block-colour for every single colour I have?


Try this:

@mixin block($color) {
.block-#{$color} {
background-color: $color;
}
}


http://sass-lang.com/documentation/file.SASS_REFERENCE.html#interpolation_

And speaking of databases, I've run into a super weird issue with PGSQL. I have unique index on a column, I also have model-side validation for said uniqueness but it still lets me put duplicate values into the table... As a bonus, when I'm trying to UPDATE said column for a specific row, it nullifies one other column. I'm flabbergasted.

Edit: Nevermind. Found errors in my fixtures and some broken callbacks. Thank god for automated tests.
Time is precious. Waste it wisely.
Prev 1 838 839 840 841 842 1032 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
11:00
#82
WardiTV679
OGKoka 365
Rex115
Liquipedia
Afreeca Starleague
10:00
Ro16 Group A
Soma vs YSC
Sharp vs sSak
Afreeca ASL 12581
StarCastTV_EN347
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 365
Lowko301
ProTech138
Rex 115
Codebar 18
StarCraft: Brood War
Sea 24733
Calm 15179
Bisu 7586
Jaedong 3090
Horang2 1923
BeSt 1026
EffOrt 821
Mini 609
Stork 554
firebathero 524
[ Show more ]
Light 430
actioN 359
Zeus 358
Pusan 343
ZerO 224
Soulkey 209
Hyun 161
Larva 157
Mind 89
Rush 74
Killer 72
Sea.KH 51
ToSsGirL 51
Barracks 46
yabsab 38
zelot 29
Nal_rA 27
Movie 17
soO 16
Terrorterran 15
Shinee 15
[sc1f]eonzerg 15
Bale 14
Hm[arnc] 13
Sacsri 13
scan(afreeca) 12
GoRush 10
IntoTheRainbow 10
Noble 10
SilentControl 8
Icarus 7
Dota 2
qojqva1064
syndereN12
febbydoto11
Counter-Strike
olofmeister3397
fl0m2176
x6flipin403
byalli400
markeloff86
Other Games
singsing1733
B2W.Neo1047
hiko657
crisheroes298
Pyrionflax185
Liquid`LucifroN102
Liquid`VortiX88
QueenE78
Mew2King49
KnowMe47
RotterdaM29
Organizations
Other Games
BasetradeTV764
StarCraft: Brood War
UltimateBattle 305
Counter-Strike
PGL302
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 56
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis2899
• TFBlade1515
• Stunt580
Upcoming Events
Monday Night Weeklies
2h 34m
OSC
10h 34m
Afreeca Starleague
20h 34m
Snow vs PianO
hero vs Rain
WardiTV Map Contest Tou…
20h 34m
GSL
22h 34m
PiGosaur Cup
1d 10h
CranKy Ducklings
1d 19h
Kung Fu Cup
1d 22h
Replay Cast
2 days
The PondCast
2 days
[ Show More ]
WardiTV Map Contest Tou…
2 days
Replay Cast
3 days
Escore
3 days
WardiTV Map Contest Tou…
3 days
Korean StarCraft League
4 days
CranKy Ducklings
4 days
WardiTV Map Contest Tou…
4 days
IPSL
5 days
WolFix vs nOmaD
dxtr13 vs Razz
BSL
5 days
Sparkling Tuna Cup
5 days
WardiTV Map Contest Tou…
5 days
Ladder Legends
6 days
BSL
6 days
IPSL
6 days
JDConan vs TBD
Aegong vs rasowy
Replay Cast
6 days
Replay Cast
6 days
Wardi Open
6 days
Afreeca Starleague
6 days
Bisu vs Ample
Jaedong vs Flash
Liquipedia Results

Completed

Escore Tournament S2: W2
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
WardiTV TLMC #16
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 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.