• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:14
CET 01:14
KST 09:14
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down23ISSL (IntoTheTV x SOOP SC2 League): Premier7Weekly Cups (October 12-18): 5.0.17 era begins1
StarCraft 2
General
[D] Hacker peak in sc2 ? No more SC2 streamers on team liquid? Liquibets sc2 season 30 Evil Geniuses - shutting down Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win
Tourneys
SC4ALL: II Venue Change Announcement! Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays ISSL (IntoTheTV x SOOP SC2 League): Premier Stellar Fest TWO the Moon (Dec 16-20)
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 550 Graveyard Shift The PondCast: SC2 News & Results Mutation # 549 Endless Sparkles Mutation # 548 Shining Bright
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Rollback Netcode in Brood War SC4ALL: II Venue Change Announcement! Ziemie's Starcraft 1 Prequel Campaign 🇺🇦 Ukrainian StarCraft:BroodWar community reborn
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 4
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Deus Ex 3!? Mobile Legends: Bang Bang Armies of Exigo - YesYes?
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Dating: How's your luck? Trading/Investing Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9575 users

The Big Programming Thread - Page 544

Forum Index > General Forum
Post a Reply
Prev 1 542 543 544 545 546 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.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
Last Edited: 2014-11-07 02:52:13
November 07 2014 02:44 GMT
#10861
On November 05 2014 23:40 Gowerly wrote:
I posted that link and then realised I didn't mean it.
If I'm in Ruby, I will put braces in differently. If I'm doing something like

myArr.each { |item|
item.DoThing()
}

then my braces are like that. I don't know if Ruby even works without it as I'm still rather new.


For ruby if you want to one-line a block you use braces, otherwise you use do ... end

# one liner with braces
my_array.each { |item| item.do_thing }

# better one-liner
my_array.each(&:do_thing)

# even better
results = my_array.map(&:thing)

#block
my_array.each do |item|
item.do_thing
end


A couple stylistic things:
local variable and function names should be snake_case
No parens if you're not passing anything to the function
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 07 2014 02:49 GMT
#10862
On November 06 2014 22:55 djookz wrote:
Hey guys,
I've been an avid reader since this page came out but never felt the urge to make an account, but upon seeing this thread for the first time now (Usually not looking at General), I wanted to ask if some people here use R?

I'm starting a large data analysis project at work, so I've been doing a lot of research on various solutions. Looking at R it seems very useful for expressing complex mathematical expressions succinctly. Using it within Hadoop map/reduce jobs wouldn't be the worst thing the world, but Python, Mlib, and GraphX on top of Spark make it kind of an out-of-the-way solution.

If I were working with a smaller data set and focusing on machine learning R would be on the short list.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
November 07 2014 14:33 GMT
#10863
On November 07 2014 11:49 CatNzHat wrote:
Show nested quote +
On November 06 2014 22:55 djookz wrote:
Hey guys,
I've been an avid reader since this page came out but never felt the urge to make an account, but upon seeing this thread for the first time now (Usually not looking at General), I wanted to ask if some people here use R?

I'm starting a large data analysis project at work, so I've been doing a lot of research on various solutions. Looking at R it seems very useful for expressing complex mathematical expressions succinctly. Using it within Hadoop map/reduce jobs wouldn't be the worst thing the world, but Python, Mlib, and GraphX on top of Spark make it kind of an out-of-the-way solution.

If I were working with a smaller data set and focusing on machine learning R would be on the short list.

If you are a fan of shell scripting, perl, javascript and other inconsistent, ugly languages, then r is just for you.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 07 2014 18:27 GMT
#10864
Apparently R is beautiful if you're a mathematician versus a programmer. Read somewhere that the language constructs are designed to feel good for math usage.
There is no one like you in the universe.
SilverSkyLark
Profile Blog Joined April 2008
Philippines8437 Posts
Last Edited: 2014-11-09 16:46:22
November 09 2014 03:53 GMT
#10865
Hi guys. I'm developing a web application in Ext JS 4.2.

I have a floating form where I have a print button which prints the form programmatically. I got the code from this wordpress website. So far, it works great if the form contains basic fields such as text fields, labels, images.

However, I'm starting to have problems printing a form with a Grid Panel and a Property Panel in it. Most of the time (around 9 times out of 10), when the print dialog comes up, it shows "Print Preview Failed". In instances that it does print, the bottom and right borders of the Grid Panel and the Property Grid doesn't show up at all - even if the form in the browser shows that my borders are there.


What I've done so far is I copy pasted my web app folder and tinkered with the duplicate. I've confirmed there that removing the Grid Panel and the Property Grid makes the printing process more consistent. Now I'm thinking that the CSS of the Grids may be messing me up. I've tried asking in StackOverFlow but they haven't answered.


Edit 1: The CSS doesn't matter.

Edit 2: Found a different way to do this using a different class, however, I'm having a tough time including an Ext.ux class while using the MVC framework.

Question in SO is over here
"If i lost an arm, I would play w3." -IntoTheWow || "Member of Hyuk Hyuk Hyuk cafe. He's the next Jaedong, baby!"
berated-
Profile Blog Joined February 2007
United States1134 Posts
November 09 2014 17:50 GMT
#10866
On November 05 2014 23:59 Manit0u wrote:
Ok guys, now I have a different problem... Had to switch branches with the code, all looks fine, except there's 2x more code like stuff I posted on the previous page. I ignore it for the moment but there are other funny things happening.

1. Compiling this code to .war produces file that's 5x smaller than previously, probably missing some dependencies...
2. Errors be thrown: java.lang.NoClassDefFoundError, definitely dependencies are missing...
3. 'mvn depdendency:resolve' downloads all the required stuff, 1 and 2 remain unchanged.

Help? I've recompiled the code like 15 times now, updated everything, all looks cool and dandy, maven is able to install, clean package and all that jazz, but it doesn't work

And yes, all deps are properly included in pom.xml and class that's throwing the error does import the right thing.


You make any progress on this? Did you switch maven versions from 2 to 3? Are you able to replicate the old build at all? Are you able to do a diff on the branches to see how the pom is different?

Just because the code compiles doesn't mean that you have have all your dependencies. If you are using internal libraries that don't declare their dependencies correctly then maven cannot correctly pull in all the transitive libraries. Did you mark all your dependencies as provided for some reason?

Do you have the old war file? Trying to spot the difference of which jars are in the old and not the new should help more quickly point you to why they are in the old but not the new.
MinoMoto
Profile Joined June 2011
Latvia107 Posts
November 09 2014 18:38 GMT
#10867
C# - How I can draw a triangle using a cycle
The size is set by the user.
Please help.
I can only make squares.
[image loading]
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-11-09 23:42:24
November 09 2014 23:34 GMT
#10868
generic lambdas in c++ are so god damned, so GOD DAMNED COOL.
[image loading]
screeeeaaaaaaaaaaaaaaaaaaaaaaaaaam!
conspired against by a confederacy of dunces.
Manit0u
Profile Blog Joined August 2004
Poland17871 Posts
Last Edited: 2014-11-10 03:04:54
November 10 2014 03:04 GMT
#10869
On November 10 2014 02:50 berated- wrote:
Show nested quote +
On November 05 2014 23:59 Manit0u wrote:
Ok guys, now I have a different problem... Had to switch branches with the code, all looks fine, except there's 2x more code like stuff I posted on the previous page. I ignore it for the moment but there are other funny things happening.

1. Compiling this code to .war produces file that's 5x smaller than previously, probably missing some dependencies...
2. Errors be thrown: java.lang.NoClassDefFoundError, definitely dependencies are missing...
3. 'mvn depdendency:resolve' downloads all the required stuff, 1 and 2 remain unchanged.

Help? I've recompiled the code like 15 times now, updated everything, all looks cool and dandy, maven is able to install, clean package and all that jazz, but it doesn't work

And yes, all deps are properly included in pom.xml and class that's throwing the error does import the right thing.


You make any progress on this? Did you switch maven versions from 2 to 3? Are you able to replicate the old build at all? Are you able to do a diff on the branches to see how the pom is different?

Just because the code compiles doesn't mean that you have have all your dependencies. If you are using internal libraries that don't declare their dependencies correctly then maven cannot correctly pull in all the transitive libraries. Did you mark all your dependencies as provided for some reason?

Do you have the old war file? Trying to spot the difference of which jars are in the old and not the new should help more quickly point you to why they are in the old but not the new.


A bit of progress. I managed to get old war to work on a new server partially. The biggest problem is the server configuration at the moment, because I have the old war (which is working on an old server perfectly) but I have no sources for it, only the compiled classes and there are no deps included in the old war, they're installed globally on the old server but I can't find them The dude who was setting it up did some truly magic things.
Time is precious. Waste it wisely.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 10 2014 03:56 GMT
#10870
On November 10 2014 08:34 nunez wrote:
generic lambdas in c++ are so god damned, so GOD DAMNED COOL.
screeeeaaaaaaaaaaaaaaaaaaaaaaaaaam!


too bad the syntax for c++ lambdas is absolutely unreadable ;-;
There is no one like you in the universe.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
November 10 2014 07:45 GMT
#10871
blasphemer! repent!
conspired against by a confederacy of dunces.
Isualin
Profile Joined March 2011
Germany1903 Posts
Last Edited: 2014-11-10 08:49:47
November 10 2014 08:45 GMT
#10872
Is there anyone who can help me with Apache Nutch? I need to match comments with articles from a website.
Comments in the website have a url to the article in www.domain.com/?p=##### format but it redirects to www.domain.com/headline-of-the-article-identifier. Looks like i need to index original target urls as well in case of redirects.
Edit: To be more clear, i am asking how can i get the value of original target urls and add them to nutchdocument for indexing? I am not hopeful to get an anwser but this is the best place on this forum to ask.
| INnoVation | The literal god TY | ByuNjwa | LRSL when? |
actionbastrd
Profile Blog Joined September 2010
Congo598 Posts
Last Edited: 2014-11-10 10:26:55
November 10 2014 10:26 GMT
#10873
Hey i am currently learning classes and multiple files using headers. C++

I am running into an issue where i have 2 classes, two different .h files. One class holds all the functions for displaying information, labeled display.h, and the other holds all the information gathered from the user. information.h. (the classes are corrispondingly named).

I want to have the header file of information.h inside of my display.h. I have been reading about header gaurds, but i am not sure how to implement them. Any assistance would be great. I have yet to be formally introduced to these header file concepts, but am trying to figure it out regardless.

Here is what i understand.
-at the top of the header file

display.h

#ifndef headername
#define headername

#include "information.h"
/* all content of .h file? Unsure. */

#endif

I cant seem to get it to work, and am a little confused on the header gaurd concept. Do i do this for every header? Does it go into main aswell? Any help will be great. I can easy finish my task without this, but i really want to understand this for my own desire.
It rained today inside my head...
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-11-10 10:48:39
November 10 2014 10:46 GMT
#10874
relevant wiki-material: one definition rule!

display.h:
#ifndef DISPLAY_H
#define DISPLAY_H

#endif

in a translation unit, the first time the file display.h is included (barring any unfortunate circumstance), the macro DISPLAY_H is undefined, so the code between #ifndef DISPLAY_H and #endif will be compiled.
the key point is that this code conatins the definition of the macro DISPLAY_H (second line of the code)!

the next time display.h is included in that same translation unit, the macro DISPLAY_H (barring any unfortunate circumstance) is now defined, and the code between #ifndef DISPLAY_H and #endif will be ignored.

thus any function definition within display.h will only appear once.

personally i just use #pragma once instead of header guards. this is not unproblematic, but it hasn't been a problem for me yet
conspired against by a confederacy of dunces.
Khalum
Profile Joined September 2010
Austria831 Posts
November 10 2014 12:57 GMT
#10875
On November 10 2014 19:26 actionbastrd wrote:
Does it go into main aswell?

Since it wasn't explicitly answered I'd like to mention that you do indeed only need header guards for header files (.h).
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-11-10 20:26:33
November 10 2014 20:21 GMT
#10876
On November 10 2014 08:34 nunez wrote:
generic lambdas in c++ are so god damned, so GOD DAMNED COOL.
[image loading]
screeeeaaaaaaaaaaaaaaaaaaaaaaaaaam!


Haha, you're such a nerd. Do you work? If yes, I imagine your company hasn't yet transitioned to C++14 if there is a working compiler at all.

On a different note, I'll soon have to re-install Windows on my personal computer, and I wonder whether I should stick with Windows 7 or Windows 8.1. I've read Windows 8.1 is 'faster' but is that really true?
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-11-10 21:43:28
November 10 2014 20:54 GMT
#10877
i have a part time programming job alongside my studies.
i haven't used generic lambdas there yet though (~supported by vs14), but used decltype(auto) for return type deduction!

here's a pretty neat, and super terse way of defining a type trait via overloaded function definitions:
#include<iostream>
#include<type_traits>
using namespace std;

float type_trait(int);
double type_trait(char);

template<class input>
using type_trait_t=decltype(type_trait(*(input*)(0))); //altenatively decltype(type_trait(declval<input>()))

template<class input>
type_trait_t<input>
func()
{ return 0; }

int main(){
static_assert(
is_same<decltype(func<int>()),float>::value&&
is_same<decltype(func<char>()),double>::value,
"type trait test fail"
);
}

the input type you want to specialize the trait for is placed as the argument type in the function overload definition, and the output type of the trait is placed as the return type. the output type for a given input type is produced by letting the compiler deduce the return type of the function call with a declvaled

the test is succesfull if it compiles, and it does. it doesn't impose any restrictions on the input types constructibility as the type traits output is deduced from an unevaluated context (inside decltype).

haven't tested it out much yet, as i only realized it was a viable approach today after writing that post about header guards, but in the cases i can get away with this instead of using nested type-aliases i think i prefer it.

here's the more common variant for comparison:
#include<iostream>
#include<type_traits>
using namespace std;

template<class input>
struct
type_trait;

template<>
struct
type_trait<int>
{ using type=float; };

template<>
struct
type_trait<char>
{ using type=double; };

template<class input>
using type_trait_t=typename type_trait<input>::type;

template<class input>
type_trait_t<input>
func()
{ return 0; }

int main(){
static_assert(
is_same<decltype(func<int>()),float>::value&&
is_same<decltype(func<char>()),double>::value,
"type trait test fail"
);
}
conspired against by a confederacy of dunces.
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2014-11-10 21:36:20
November 10 2014 21:35 GMT
#10878
Hey guys, quick C question :

Assume I have a linked list of structures containing structures containing an int and a string, and that I have to keep all this information through different calls to the function that creates and manages the list.
I define the list as static, and this part seems to be working, but when I try to access the structures inside it segfaults on the second call to the function. I did not defined those as statics, is this where the error comes from ? I assumed only keeping the list of pointers would work...
Uranium
Profile Blog Joined May 2010
United States1077 Posts
November 10 2014 21:53 GMT
#10879
If this was C++ and you had a class that housed a linked list, then declared a static instance of that class within a function, I'd say you were safe, and that any segfaults were likely an issue with your implementation of the linked list.

However in C, it depends. How are you allocating the memory for the structures that you are attaching to the static list header inside the function?
"Sentry imba! You see? YOU SEE??!!" - Sen | "Marauder die die!" - oGsMC | "Oh my god, she texted me back!" - Day[9]
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2014-11-10 22:14:39
November 10 2014 22:14 GMT
#10880
relevant code in the .c
int             get_next_line(int const fd, char **line)
{
int ret;
static t_list *files;
t_list *cursor;
t_file *new_file;

ret = 0;
if (files)
{
cursor = files;
while (cursor && cursor->content
&& ((t_file *)cursor->content)->fd != fd)
cursor = cursor->next;
if (cursor->content && ((t_file *)cursor->content)->fd == fd)
ret = ft_read_file(fd, cursor->content, line);
}
else
{
if (!(files = (t_list *)ft_memalloc(sizeof(*files))))
return (-1);
if (!(new_file = (t_file *)ft_memalloc(sizeof(*new_file))))
return (-1);
cursor = ft_lstnew(new_file, sizeof(*new_file));
((t_file *)cursor->content)->fd = fd;
((t_file *)cursor->content)->left_over = 0;
ft_lstadd(&files, cursor);
ret = ft_read_file(fd, cursor->content, line);
}
return (ret);
}

in the .h
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H

# define BUFF_SIZE 32
# define EOF "\n"

#include <string.h>

typedef struct s_list
{
void *content;
size_t content_size;
struct s_list *next;
} t_list;

typedef struct s_file
{
int fd;
char *left_over;
} t_file;

The segfault happens with the second call to get_next_line, when if (files) is checked and the program tries to access cursor->content->fd.
Prev 1 542 543 544 545 546 1032 Next
Please log in or register to reply.
Live Events Refresh
PSISTORM Gaming Misc
09:00
FSL season 12 opener: HM vs ST
Freeedom13
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 25
StarCraft: Brood War
Britney 7748
Dota 2
PGG 215
League of Legends
Doublelift4592
JimRising 703
Counter-Strike
jkaem74
Other Games
summit1g9002
gofns8726
Grubby2221
shahzam444
PiGStarcraft308
C9.Mang0259
Day[9].tv237
syndereN189
XaKoH 97
Maynarde68
Fuzer 64
NeuroSwarm53
ViBE41
Railgan20
KnowMe19
PPMD19
JuggernautJason3
Organizations
Other Games
gamesdonequick318
BasetradeTV176
Counter-Strike
PGL89
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 63
• RyuSc2 37
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Laughngamez YouTube
• Migwel
StarCraft: Brood War
• HerbMon 34
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3286
• Jankos3195
• Scarra895
Other Games
• imaqtpie624
• Day9tv237
• Shiphtur173
Upcoming Events
IntoTheTV X SOOP
10h 46m
Reynor vs Solar
ByuN vs SHIN
Clem vs MaxPax
herO vs Rogue
IPSL
16h 46m
WorsT vs nOmaD
Dewalt vs andersOn
AI Arena Tournament
18h 46m
IntoTheTV X SOOP
1d 10h
IPSL
1d 16h
Azhi_Dahaki vs ggnore13
Double vs WIZARD
Replay Cast
1d 22h
Replay Cast
2 days
Sparkling Tuna Cup
3 days
WardiTV Invitational
3 days
YoungYakov vs Lambo
SHIN vs TBD
Percival vs Shameless
Solar vs TBD
PiGosaur Cup
4 days
[ Show More ]
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Invitational
5 days
Liquipedia Results

Completed

Proleague 2026-11-05
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026

Upcoming

Sector 951
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Underdog Cup 2026 Div 2-3
PGL Bucharest 2027
BLAST Bounty Winter 2027
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 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.