• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:16
CET 01:16
KST 09:16
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation13Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
[TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ FlaSh on: Biggest Problem With SnOw's Playstyle What happened to TvZ on Retro? SnOw's ASL S20 Finals Review BW General Discussion
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Path of Exile Clair Obscur - Expedition 33 Should offensive tower rushing be viable in RTS games? Stormgate/Frost Giant Megathread Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread About SC2SEA.COM Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
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
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2151 users

The Big Programming Thread - Page 75

Forum Index > General Forum
Post a Reply
Prev 1 73 74 75 76 77 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.
Craton
Profile Blog Joined December 2009
United States17266 Posts
Last Edited: 2011-08-22 21:51:11
August 22 2011 20:43 GMT
#1481
So for example it says: SensorChannel([channel_ID]):GetRawSum()

Do I need to add the [ and ] or do I just add the sensor channel between the () so does it look like ([sensor channel]) or (sensor channel)

This is where you should reference the code you already have. In this case:
sumGB = math.ceil((SensorChannel(1):GetRawSum()/1024/1024/1024))


Notably this part:
SensorChannel(1):GetRawSum()

As you can see, the brackets themselves are not used (this is a standard convention), but rather denote that a certain thing should be used.


Also this: invoice:AddItem([name], [value])
- Add an item to the <#itemtable> placeholder in the template.

There is no "<#itemtable> int he template. Would I just type in <#itemtable> at the bottom of the script?

Not 100% on this. Sounds like there's a default placeholder that's already made as part of the invoice, so all you have to is add items to it using AddItem([name], [value]) and they'll be handled internally. It's not explicitly listed in the documentation, but it's possibly the class given to the table that gets generated, e.g.
<table class="itemtable">
twitch.tv/cratonz
UltimateHurl
Profile Blog Joined September 2010
Ireland591 Posts
August 23 2011 07:10 GMT
#1482
On August 23 2011 05:22 TadH wrote:
Show nested quote +
On August 23 2011 05:19 UltimateHurl wrote:
How did I just see this thread? Did my undergrad in software engineering, about to learn lua in my spare time just because.



You wanna give me a hand then? :D


Craton got to it before I could, but as he says anything in square brackets like that is probably just a placeholder for whatever you put there, so don't use the square brackets, they are like quotes in "put whatever you want here". If <#itemtable> isn't auto-generated you might need to add it yourself. Still working on learning Lua, hope that helps
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
August 25 2011 14:49 GMT
#1483
again i would like to ask for tl's help here, im really new to haskell and i want to apply this function

crossproduct :: [a] -> [b] -> [(a,b)]
crossproduct (a:as) (b:bs) = (a,b) : crossproduct as bs
crossproduct _ _ = []

as i try to use that function, it says that my a and b are not in the scope. i realky think there is missing but i really dont know
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
Last Edited: 2011-08-26 02:35:37
August 25 2011 23:11 GMT
#1484
With C# is there a way to dynamically NAME your arrays? Or perhaps a different solution all around? I tried looking it up, but most discussions are about what dynamic arrays are, which I understand. I essentially want to name this dynamic array by a dynamically created value.

The basic situation is I am reading in nodes from a WSDL. I want to find a way to store all the parent nodes that are read into parentNodeArrays (named according to the element name of the parentNode, which will be dynamically read in), and then the childNodeArrays likewise into different dynamic arrays for child nodes.

I know I cannot just do something like:
int arrayCounter = 0;
List<t>(parentNodeGroupName + arrayCounter) = new List<t>();
arrayCounter++;

Obviously that won't work. But I hope that gives a better idea of what I'm trying to accomplish? Other ideas I've considered have been using XDocument to create an XML file with a custom defined structure based on the information read in.

edit: http://stackoverflow.com/questions/5033675/how-do-i-name-variables-dynamically-in-c
Found this. Basically the same idea as what I wanted. Perhaps a keyed collection would do the trick...
Undefeated TL Tecmo Super Bowl League Champion
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
Last Edited: 2011-08-25 23:22:22
August 25 2011 23:21 GMT
#1485
On August 25 2011 23:49 icystorage wrote:
again i would like to ask for tl's help here, im really new to haskell and i want to apply this function

crossproduct :: [a] -> [b] -> [(a,b)]
crossproduct (a:as) (b:bs) = (a,b) : crossproduct as bs
crossproduct _ _ = []

as i try to use that function, it says that my a and b are not in the scope. i realky think there is missing but i really dont know


dunno if that helps, but try the bracketing trick:

crossproduct (a:as) (b:bs) = ((a,b) : (crossproduct as bs))

also, juding from the name of your function, are you looking for something more along these lines?

crossproduct as bs = crossproductt as bs bs

crossprodcutt :: [a] -> [b] -> [b] -> [(a,b)]
crossproductt (a:as) (b:bs) bbs = (a,b) : crossproduct (a:as) bs bbs
crossproductt (a:as) _ bbs= crossproduct as bbs bbs
crossproductt _ _ _ = []

(could ofc be done nicer with predefined functions in the likes of map/fold/etc, but i really didn't code any haskell for too long, so i have no clue how the syntax would need to be there.
Gold isn't everything in life... you need wood, too!
Kambing
Profile Joined May 2010
United States1176 Posts
Last Edited: 2011-08-26 15:50:46
August 26 2011 15:41 GMT
#1486
On August 26 2011 08:21 MisterD wrote:
Show nested quote +
On August 25 2011 23:49 icystorage wrote:
again i would like to ask for tl's help here, im really new to haskell and i want to apply this function

crossproduct :: [a] -> [b] -> [(a,b)]
crossproduct (a:as) (b:bs) = (a,b) : crossproduct as bs
crossproduct _ _ = []

as i try to use that function, it says that my a and b are not in the scope. i realky think there is missing but i really dont know


dunno if that helps, but try the bracketing trick:

crossproduct (a:as) (b:bs) = ((a,b) : (crossproduct as bs))

also, juding from the name of your function, are you looking for something more along these lines?

crossproduct as bs = crossproductt as bs bs

crossprodcutt :: [a] -> [b] -> [b] -> [(a,b)]
crossproductt (a:as) (b:bs) bbs = (a,b) : crossproduct (a:as) bs bbs
crossproductt (a:as) _ bbs= crossproduct as bbs bbs
crossproductt _ _ _ = []

(could ofc be done nicer with predefined functions in the likes of map/fold/etc, but i really didn't code any haskell for too long, so i have no clue how the syntax would need to be there.


How are you using the function? Because the code compiles fine and ghci accepts uses of it readily:


crossprod :: [a] -> [b] -> [(a, b)]
crossprod (a:as) (b:bs) = (a,b) : crossprod as bs
crossprod _ _ = []

===

*Main> crossprod [1, 2, 3] [4, 5, 6]
[(1,4),(2,5),(3,6)]


And to try to clear your confusion up front, on the first line, a and b are type parameters to crossprod. On the second line, a and b are pattern variables that are bound to values. So on each line they have a different meaning (and indeed you can rename them to whatever you want to alleviate the confusion), but just like how a function parameter does not have meaning outside of the context it was declared, a and b do not have meaning outside of these two lines.

Also it sounds like that you're writing this for practice which is great, but it is worthwhile to point out that crossprod is really zip.


zip :: [a] -> [b] -> [(a, b)]

zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded.


Furthermore, what you wrote is precisely the implementation of zip (which is good!)


----------------------------------------------
-- | 'zip' takes two lists and returns a list of corresponding pairs.
-- If one input list is short, excess elements of the longer list are
-- discarded.
zip :: [a] -> [b] -> [(a,b)]
zip (a:as) (b:bs) = (a,b) : zip as bs
zip _ _ = []


Hoogle is your best friend and one of the many reasons why Haskell is a great language to use.
Frigo
Profile Joined August 2009
Hungary1023 Posts
August 31 2011 23:45 GMT
#1487
I just spent the last 6+ hours thinking up some construct to extract the return type of arbitrary functions, even in the presence of functions with the same name. I finally succeeded, but the approach requires C++0x extensions, namely variadic templates and macros. I thought I'd share it.

using namespace std;

#define resultof(f, ...) typeof(Param<__VA_ARGS__>::Func(f))

template <class... Args>
class Param
{
public:
template <class R>
static R Func (R (*) (Args...));
template <class R, class C>
static R Func (R (C::*) (Args...));
};

int f ();
double f (int x);
int f (int x, int y);

int main (int argc, char* argv[])
{
resultof(f, int) d = 1.1;
cout << d << endl;
}
http://www.fimfiction.net/user/Treasure_Chest
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
September 02 2011 01:34 GMT
#1488
Do any of you listen to music while coding? I have a Pandora subscription, so I usually have it on while I'm coding at work. I tend to listen to Pandora's "Black Dog" station, since they're one of my favorite ambient-electronic groups and other related groups are good too. I find it easy to concentrate with ambient music, and very difficult with rock/lyrical music. Any suggestions for bands/groups that won't be too distracting?

Sorry if this is too off-topic...
Undefeated TL Tecmo Super Bowl League Champion
Antedelerium
Profile Joined June 2010
United States224 Posts
September 02 2011 02:06 GMT
#1489
On September 02 2011 10:34 EscPlan9 wrote:
Do any of you listen to music while coding? I have a Pandora subscription, so I usually have it on while I'm coding at work. I tend to listen to Pandora's "Black Dog" station, since they're one of my favorite ambient-electronic groups and other related groups are good too. I find it easy to concentrate with ambient music, and very difficult with rock/lyrical music. Any suggestions for bands/groups that won't be too distracting?

Sorry if this is too off-topic...


Shouldn't be that off-topic considering this comes up at work all the time. I recommend Kaskade's albums since they flow together along with Pretty Lights. Those two are usually pretty solid for just getting in the zone while coding.
"Isn't it ironic to yell the word silence?" ~B.C.
Frigo
Profile Joined August 2009
Hungary1023 Posts
September 02 2011 02:31 GMT
#1490
I like several genres of music, but ambient and related calm, slow genres are good for coding. They make everything crystal clear and easy to focus. Repetitive, sharp, strong music just dulls me and breaks my concentration.

My friend is the opposite, he can not stand ambient music, he seemingly has a hyperactive imagination and his mind wanders off the code and into a world induced by ambient music, filled with spaceships, oceans and flutes. He listens to Suicide Commando instead.
http://www.fimfiction.net/user/Treasure_Chest
Kryt0s
Profile Joined August 2010
Germany209 Posts
September 02 2011 13:47 GMT
#1491
I am never sure if its progaming or programming xD Anyone else?^^
NerdOpinionShow
Profile Blog Joined September 2010
United States92 Posts
September 02 2011 23:58 GMT
#1492
Time for a noobish question. Can you use the same object over multiple c++ files?
Call me "NOS"
Neshapotamus
Profile Blog Joined May 2006
United States163 Posts
September 03 2011 00:16 GMT
#1493
EscPlan9, I dont understand your post at all. First off, if you have a WSDL, cant you generate a webservice proxy and use strongly typed object. If that approach doesnt work out and sounds like your getting XML, do you have the XSD for the XML. That way, you can serialize and deserialize the XML into a object. If you dont want to do it that way, can't you use LINQ to XML to and create a annonoymous object with the name for the property you would want.

Maybe, an example of what your trying to do and I can be more clear on taking the best approach.
Dragom
Profile Joined December 2010
194 Posts
September 03 2011 00:22 GMT
#1494
Can i get a small tutorial on how to link .dat files and mp3 files to a python executable?
"The second thing to go is your memory...ergh, I can't remember what the first thing is..."
Neshapotamus
Profile Blog Joined May 2006
United States163 Posts
September 03 2011 00:28 GMT
#1495
NerdOpinionShow, I will try to answer your question but I also haven't used C++ in ages. You only have one entry point into your code which should be in main function.


For Example, you can have multiple files with dependencies like such:

FILE 1:

public class A
{
public A()
{
}
}

FILE 2:

public class B
{
Public B(A a)
{
}
}


FILE 3


public Program
{
int Main() // <- Entry point
{
A a = new A();
B b = new B(a); // <- this in example takes the same object over multiple files
}
}

Please forgive my C++ syntax. But that should be the general gist of C++
If that doesn't help, I probably did not understand your question correctly.
Frigo
Profile Joined August 2009
Hungary1023 Posts
Last Edited: 2011-09-03 01:00:27
September 03 2011 01:00 GMT
#1496
On September 03 2011 08:58 NerdOpinionShow wrote:
Time for a noobish question. Can you use the same object over multiple c++ files?

If you compile separately then link, you need to declare it as extern I believe, and initialize in a single cpp file. Never actually done it, I always declare and initialize them in header files and compile & link in one pass. I am pretty sure it would cause complications like double objects if I were to compile separately.
http://www.fimfiction.net/user/Treasure_Chest
japro
Profile Joined August 2010
172 Posts
Last Edited: 2011-09-03 01:09:34
September 03 2011 01:08 GMT
#1497
On September 03 2011 08:58 NerdOpinionShow wrote:
Time for a noobish question. Can you use the same object over multiple c++ files?

Sure, that's what globals do. You have some header:
global.h

#ifndef GLOBAL_H
#define GLOBAL_H

#include "MyObject.h"

extern MyObject global_object;

#endif

and a cpp file:
global.cpp

#include "global.h"

MyObject global_object;


now global_object is accessible from every file that includes global.h

But generally globals are an indicator of questionable design. Instead of having a global access point for a object that lots of other objects need access to, it is usually better to "inject" that object into the others with pointers.
Frigo
Profile Joined August 2009
Hungary1023 Posts
Last Edited: 2011-09-05 11:20:52
September 05 2011 10:58 GMT
#1498
> Working on a reference / pointer wrapper class in C++0x that proxies most of its operators to the contained class
> For 4+ days
> Encountering the third compiler bug / unimplemented feature that nullifies the current implementation
> Would need GCC 4.7+ to implement it properly
> Requires me to redesign my wrapper
> mfw

[image loading]

Here's the abomination for show

One question though, should I interpret


ref<T> x = new T(...);
ref<T> y = new T(...);
x += y;


As
x = ref<T>(x.get() += y.get());
or
x = ref<T>(x.get() + y.get());
?

The former modifies the pointed object as well, the latter modifies only the reference wrapper. I am not sure how Java does it, are compound assignment operators applicable only to primitives?

In fact, should I convert results of all operators to ref<U> where U is the normal return type of the operator? For example in the case of double Test::operator + (int), ref<Test> would have a ref<double> ref<Test>::operator + (int) function. Or should I leave it as it is, double ref<Test>::operator (int)?
http://www.fimfiction.net/user/Treasure_Chest
tofucake
Profile Blog Joined October 2009
Hyrule19155 Posts
Last Edited: 2011-09-05 12:13:14
September 05 2011 12:12 GMT
#1499
It would be the second, as you cannot use assignment on a getter (unless it's designed horribly).
Liquipediaasante sana squash banana
RogerX
Profile Blog Joined December 2010
New Zealand3180 Posts
Last Edited: 2011-09-05 13:00:15
September 05 2011 12:59 GMT
#1500
I am the noobiest of the noobs when it comes to coding since I just began but...

In visual Dataflex (Language 4GL) How do I save information from the array so that the text file displays something like this:

Student information Example1 | Address Example | Money Example
Student information Example2 | Address Example | Money Example
Student information Example3 | Address Example | Money Example
Student information Example4 | Address Example | Money Example

Pretty much saying my GUI has three inputs and I want to give a line for each new information(Student info, address example, Money example) The three sections needs the columns for each info.

In addition how would I display a new information on the bottom of all the information on the .txt file? This only takes one line. (For example, total amount of students entered)
Stick it up. take it up. step aside and see the world
Prev 1 73 74 75 76 77 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
23:00
WardiTV Mondays #59
CranKy Ducklings103
LiquipediaDiscussion
BSL 21
20:00
ProLeague - RO32 Group D
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
ZZZero.O247
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nathanias 181
Ketroc 50
StarCraft: Brood War
Artosis 580
ZZZero.O 247
NaDa 30
Light 8
yabsab 6
Dota 2
monkeys_forever230
NeuroSwarm55
League of Legends
JimRising 476
Counter-Strike
fl0m1623
Super Smash Bros
hungrybox564
AZ_Axe126
Heroes of the Storm
Khaldor170
Other Games
summit1g4465
Grubby4110
ToD143
Maynarde114
febbydoto3
Organizations
Other Games
EGCTV863
gamesdonequick703
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• Hupsaiya 77
• RyuSc2 40
• HeavenSC 25
• musti20045 24
• Adnapsc2 15
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• HerbMon 4
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21387
• Ler49
League of Legends
• Doublelift3145
Other Games
• imaqtpie1722
Upcoming Events
Wardi Open
11h 44m
Monday Night Weeklies
16h 44m
Replay Cast
22h 44m
WardiTV Korean Royale
1d 11h
BSL: GosuLeague
1d 20h
The PondCast
2 days
Replay Cast
2 days
RSL Revival
3 days
BSL: GosuLeague
3 days
RSL Revival
4 days
[ Show More ]
WardiTV Korean Royale
4 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
IPSL
5 days
Julia vs Artosis
JDConan vs DragOn
RSL Revival
6 days
Wardi Open
6 days
IPSL
6 days
StRyKeR vs OldBoy
Sziky vs Tarson
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-11-14
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 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.