• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:52
CEST 22:52
KST 05:52
  • 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
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
IntoTheTV X SOOP SC2 League : Weekly & Monthly4Clem: "I don't have that much hope in Blizzard"6ZeroSpace Early Access is Now Live!34Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters2Balance hotfix patch 5.0.16b (July 16)103
StarCraft 2
General
Terran or Protoss Clem: "I don't have that much hope in Blizzard" Balance hotfix patch 5.0.16b (July 16) How would you feel about frequent/monthly balance patches for SC2? 3kb/s downloading patch..... are we back to 1998?
Tourneys
PIG STY FESTIVAL 8.0! (13 - 23 August) RSL Revival: Season 6 - Qualifiers and Main Event IntoTheTV X SOOP SC2 League : Weekly & Monthly INu's Battles#18 - Cure, herO, Rogue & ByuN Master Swan Open (Global Bronze-Master 2)
Strategy
[G] Having the right mentality to improve
Custom Maps
[M] (2) Industrial Park New Map Maker - Looking for Advice - Love or Hate
External Content
Mutation # 536 Railroad Switch The PondCast: SC2 News & Results Mutation # 535 Assembly of Vengeance Mutation # 534 Burning Evacuation
Brood War
General
BW General Discussion ASL22 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Recent recommended BW games screpdb: new Starcraft reporting tool
Tourneys
2v2v2v2 Tournament Star Con San Diego 2026 Escore Tournament - Season 3 [Megathread] Daily Proleagues
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers PvT advise for noobs
Other Games
General Games
Path of Exile ZeroSpace Early Access is Now Live! Stormgate/Frost Giant Megathread General RTS Discussion Thread Nintendo Switch Thread
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Artificial Intelligence Thread European Politico-economics QA Mega-thread How to buy a book - shipping from Korea to Europe
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread Series you have seen recently... [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread 2026-27 Football Thread placeholder TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
Games, Hormones, and "Dark" …
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8904 users

The Big Programming Thread - Page 32

Forum Index > General Forum
Post a Reply
Prev 1 30 31 32 33 34 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.
imDerek
Profile Blog Joined August 2007
United States1944 Posts
January 04 2011 03:27 GMT
#621
shell sort - it's pretty neat but not sure if it is widely used in practice
heap sort can be done in-place by heapifying the array directly (assuming you are sorting an array)
quick sort - randomize the pivot choice will give you expected O(n log n) running time. it's actually pretty good in practice.

Heapsort and quicksort are both nice comparison based sorting algorithms. Also consider mergesort which is O(n log n) running time and it is also a stable sort, and easily scalable.

Quicksort and switching to insertion sort on base cases (eg. when length is <= some number) does pretty well.
Least favorite progamers: Leta, Zero, Mind, Shine, free, really <-- newly added
Craton
Profile Blog Joined December 2009
United States17302 Posts
Last Edited: 2011-01-04 15:47:33
January 04 2011 14:46 GMT
#622
On January 04 2011 10:39 hucskool wrote:
If you are still having issues with this and you are using MS SQL Server 05 (or higher), you could probably do this with a OUTER APPLY. I'm not sure what your schema looks like and I don't have anything here at home to check the syntax with but something like this would let you access the itmcheckout record for the given item id.



SELECT DISTINCT itm.*, ua.lastName + ', ' + ua.firstName as responsible_party,
itmstatref.item_status_ref_name as item_status_ref_name,
itmtyperef.item_type_name as item_type_name,
itmcheckout.*
FROM ITEM itm
INNER JOIN USERACCOUNTS ua ON ua.userUID=itm.userUID
INNER JOIN ITEM_STATUS itmstat ON itm.item_id=itmstat.item_id
INNER JOIN ITEM_STATUS_REF itmstatref ON itmstat.item_status_ref_id=itmstatref.item_status_ref_id
INNER JOIN ITEM_TYPE_REF itmtyperef ON itm.item_type_id=itmtyperef.item_type_id
OUTER APPLY
(
SELECT MAX(itmcheckout.item_checkin_dt) as item_checkin_dt, itmcheckout.item_checkout_dt, uac.lastName + ', ' + uac.firstName as checked_out_by
FROM item_checkout itmcheckout INNER JOIN USERACCOUNTS uac on itmcheckout.userUID=uac.userUID
WHERE itmcheckout.item_id=itm.item_id
GROUP BY itmcheckout.item_checkin_dt, itmcheckout.item_checkout_dt, uac.firstName, uac.LastName
) as itmcheckout
ORDER BY itm.item_id, itm.item_inv_no

Huzzah. I think this will get me where I need to be.

Full thing:
+ Show Spoiler +
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_InventoryItem_select]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_InventoryItem_select]
GO

CREATE PROCEDURE [dbo].[sp_InventoryItem_select]
(
@mode varchar(20) = null,
@item_id int = null,
@item_name varchar(50) = null,
@item_inv_no numeric(18, 0) = null,
@item_type_id int = null,
@item_enable_checkout bit = null,
@userUID int = null
)
WITH ENCRYPTION
AS
SET NOCOUNT ON
begin
SELECT DISTINCT itm.*, ua.lastName + ', ' + ua.firstName as responsible_party,
itmstatref.item_status_ref_name as item_status_ref_name,
itmtyperef.item_type_name as item_type_name,
itmcheckout.*
FROM ITEM itm
INNER JOIN USERACCOUNTS ua ON ua.userUID=itm.userUID
INNER JOIN ITEM_STATUS itmstat ON itm.item_id=itmstat.item_id
INNER JOIN ITEM_STATUS_REF itmstatref ON itmstat.item_status_ref_id=itmstatref.item_status_ref_id
INNER JOIN ITEM_TYPE_REF itmtyperef ON itm.item_type_id=itmtyperef.item_type_id
OUTER APPLY
(
SELECT MAX(itmcheckout.item_checkin_dt) as item_checkin_dt, itmcheckout.item_checkout_dt, uac.lastName + ', ' + uac.firstName as checked_out_by
FROM item_checkout itmcheckout INNER JOIN USERACCOUNTS uac on itmcheckout.userUID=uac.userUID
WHERE itmcheckout.item_id=itm.item_id
GROUP BY itmcheckout.item_checkin_dt, itmcheckout.item_checkout_dt, uac.firstName, uac.LastName
) as itmcheckout
WHERE (@item_id is null or itm.item_id = @item_id)
and (@item_name is null or itm.item_name = @item_name)
and (@item_inv_no is null or itm.item_inv_no = @item_inv_no)
and (@item_type_id is null or itm.item_type_id = @item_type_id)
and (@item_enable_checkout is null or itm.item_enable_checkout = @item_enable_checkout)
and (@userUID is null or itm.userUID = @userUID)
ORDER BY itm.item_id, itm.item_inv_no
end
GO
twitch.tv/cratonz
Senx
Profile Blog Joined March 2008
Sweden5901 Posts
January 04 2011 17:16 GMT
#623
Can anyone help me out with actionscript 3.0 a bit? Im quite the newbie at it. Im making an asteroids game and im right now wanting to control the spaceship from left to right. Most of the game must be controlled from external .as files.

So here's what I want to do: I want to add my movieclip(a spaceship) to the stage through an external .as file, but I keep getting an error.

Here's the code for the actionscript file:

package {

import flash.display.MovieClip;
import flash.events.*;

public class Spaceship extends MovieClip {
public function Space () {

onClipEvent(enterFrame)
if(Key.isDown(Key.LEFT)){
_x -= 6;
}else if(Key.isDown(Key.RIGHT)){
_x += 6;
}
}
}
}

in the .fla file:
addChild(Spaceship);


Error message:
TypeError: Error #1034: Type Coercion failed: cannot convert Spaceship$ to flash.display.DisplayObject.
at Gustaf_fla::MainTimeline/frame1()

I've been reading up that I need some sort of var code to store the creation/removal of this movieclip instance, but im not sure how to use it.. any ideas?
"trash micro but win - its marine" MC commentary during HSC 4
XuoriG
Profile Blog Joined October 2007
Canada165 Posts
January 05 2011 01:06 GMT
#624
+ Show Spoiler +
<html>
<head>
<style type="text/css">
li
{
display:inline;
}
body
{
background-color:black;
}
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}
a:hover,a:active
{
background-color:red;
}
ul
{
list-style-type:none;
margin:0;
padding:0;
border:5px white;
padding-top:5px;
padding-bottom:5px;
}

</style>
</head>
<body>
<ul>
<li><a href="#">Biographie</a></li>
<li><a href="#">Multimedia</a></li>
<li><a href="#">Discographie</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Liens</a></li>
<li><a href="#">Blablabla</a></li>
</ul>
</body>
</html>


Hey guys, i'm a total noob at programming for now, but I've been working on improving my skills lately. (I've been messing around with HTML CSS and Javascript)

Anyways, for fun I tried to do a horizontal menu with hover stuff. But I cant get it to be horizontal... Vertical menu works though. It seems like my : display:inline; doesnt have any effect...

I've tryed using float:left and it works but I really wanted to make the other way work.

Could any body tell me why it doesnt seem to recognise the inline?

Thanks a lot, this thread is really encouraging.
Nizaris
Profile Joined May 2010
Belgium2230 Posts
Last Edited: 2011-01-05 01:20:08
January 05 2011 01:10 GMT
#625
On January 05 2011 10:06 Rutluv wrote:
+ Show Spoiler +
<html>
<head>
<style type="text/css">
li
{
display:inline;
}
body
{
background-color:black;
}
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}
a:hover,a:active
{
background-color:red;
}
ul
{
list-style-type:none;
margin:0;
padding:0;
border:5px white;
padding-top:5px;
padding-bottom:5px;
}

</style>
</head>
<body>
<ul>
<li><a href="#">Biographie</a></li>
<li><a href="#">Multimedia</a></li>
<li><a href="#">Discographie</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Liens</a></li>
<li><a href="#">Blablabla</a></li>
</ul>
</body>
</html>


Hey guys, i'm a total noob at programming for now, but I've been working on improving my skills lately. (I've been messing around with HTML CSS and Javascript)

Anyways, for fun I tried to do a horizontal menu with hover stuff. But I cant get it to be horizontal... Vertical menu works though. It seems like my : display:inline; doesnt have any effect...

I've tryed using float:left and it works but I really wanted to make the other way work.

Could any body tell me why it doesnt seem to recognise the inline?

Thanks a lot, this thread is really encouraging.


If you want the items to be horizontal the easiest way is to put them in a table. or position divs individually. Can't say why inline doesn't work sry i don't use it, but i'm fairly certain you wouldn't use it to put items horizontally.

something like+ Show Spoiler +
<table>
<tr>
<td>item 1</td>
<td>item 2</td>
<td>item 3</td>
<td>item 4</td>
</tr>
</table>


float: left is usually bad, except in a few cases. it'll end up screwing up your stuff if they don't exactly all have the same height.
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
January 05 2011 04:48 GMT
#626
Anyone have the breakdown on ELO? Finding it hard to google out formulas to copy-paste, I don't want the deep mathematical stuff, I know the basic outline and just want to implement it for fun.
Craton
Profile Blog Joined December 2009
United States17302 Posts
Last Edited: 2011-01-05 15:37:45
January 05 2011 15:31 GMT
#627
On January 05 2011 10:06 Rutluv wrote:
+ Show Spoiler +
<html>
<head>
<style type="text/css">
li
{
display:inline;
}
body
{
background-color:black;
}
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}
a:hover,a:active
{
background-color:red;
}
ul
{
list-style-type:none;
margin:0;
padding:0;
border:5px white;
padding-top:5px;
padding-bottom:5px;
}

</style>
</head>
<body>
<ul>
<li><a href="#">Biographie</a></li>
<li><a href="#">Multimedia</a></li>
<li><a href="#">Discographie</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Liens</a></li>
<li><a href="#">Blablabla</a></li>
</ul>
</body>
</html>


Hey guys, i'm a total noob at programming for now, but I've been working on improving my skills lately. (I've been messing around with HTML CSS and Javascript)

Anyways, for fun I tried to do a horizontal menu with hover stuff. But I cant get it to be horizontal... Vertical menu works though. It seems like my : display:inline; doesnt have any effect...

I've tryed using float:left and it works but I really wanted to make the other way work.

Could any body tell me why it doesnt seem to recognise the inline?

Thanks a lot, this thread is really encouraging.

Well, HTML and CSS aren't programming per se.

To answer your question: you have the CSS for your links set as block, but your list items set as inline. You aren't allowed to have both, as they are mutually exclusive. The block style, in this case, is taking precedence, which is why you get them on multiple lines (I believe this is because <a> is the innermost style). Delete "display:block;" inside
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}
twitch.tv/cratonz
zingmars
Profile Joined April 2010
Latvia189 Posts
January 05 2011 15:44 GMT
#628
OP should add these sites to the 1st post of this thread:
PHP: Zend - Devzone
C++: Learn C++ in 21 days
I'm sure I could find/remember more, but heh, might do that later.
That said - Is there any *FUN* way to learn C++? The guides always seem to be really boring. Usually video tutorials seem to be more fun to watch however they too usually become boring/generic after awhile. Any suggestions?
"I think there is a world market for maybe five computers." -- Thomas Watson
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
January 05 2011 21:14 GMT
#629
On January 05 2011 13:48 Adeny wrote:
Anyone have the breakdown on ELO? Finding it hard to google out formulas to copy-paste, I don't want the deep mathematical stuff, I know the basic outline and just want to implement it for fun.

Some key things to consider are: (1) how to manage provisional ratings for new players, (2) how inflated you want the numbers to be (K constant), (3) chronological order of events, and (4) does ELO make sense with the tournament format.

(1) How to manage provisional ratings for new players.
I recommend you check out http://www.chessatwork.com/help/index.php?help=faq, under "How is my rating calculated?" It's a very simple and nice explanation on how they manage new players, and I think it works great. I've used their system before in my own implementation.

(2) How inflated you want the numbers to be (K constant).
If you've googled the actual ELO mathematical equations, you'll come across the K constant. It's basically a constant that determines how much you want the numbers to fluctuate. The higher the constant, the larger the numbers will change after a given match. In the official Chess ELO format, they use a larger constant if you're below 2400, but a smaller constant above 2400. You don't have to do that, but it's something to think about

(3) Chronological order of events.
It's very important that ratings are calculated in the chronological order they happened. If you calculate them as they happen, this isn't a problem. But sometimes that's not always the case. You might enter two or three tournaments worth of data at once, and later learn there was some other tournament in between that you forgot to input, and you've basically got to recalculate from the very beginning. You'll need to account for that if you're developing some kind of program for this.

(4) Does ELO make sense with the tournament format.
The simple fact is, ELO makes no sense at all for the standard brackets you typically see. You know, those that work great when the number of participants is a factor of 2 (2,4,8,16,32,64). Especially ones that are seeded properly based on historical results. Those kinds of tournaments produce accurate ELO ratings for just the top three or so, because they play the most games. ELO is much better for swiss or round-robin tournaments.
Osmoses
Profile Blog Joined October 2008
Sweden5302 Posts
Last Edited: 2011-01-05 21:32:39
January 05 2011 21:31 GMT
#630
On January 05 2011 02:16 Senx wrote:
Can anyone help me out with actionscript 3.0 a bit? Im quite the newbie at it. Im making an asteroids game and im right now wanting to control the spaceship from left to right. Most of the game must be controlled from external .as files.

So here's what I want to do: I want to add my movieclip(a spaceship) to the stage through an external .as file, but I keep getting an error.

Here's the code for the actionscript file:

package {

import flash.display.MovieClip;
import flash.events.*;

public class Spaceship extends MovieClip {
public function Space () {

onClipEvent(enterFrame)
if(Key.isDown(Key.LEFT)){
_x -= 6;
}else if(Key.isDown(Key.RIGHT)){
_x += 6;
}
}
}
}

in the .fla file:
addChild(Spaceship);


Error message:
TypeError: Error #1034: Type Coercion failed: cannot convert Spaceship$ to flash.display.DisplayObject.
at Gustaf_fla::MainTimeline/frame1()

I've been reading up that I need some sort of var code to store the creation/removal of this movieclip instance, but im not sure how to use it.. any ideas?

Well from what I can see, first of all you need a constructor for your spaceship class, as I'm pretty sure as3 does not support default constructors. Basically I'm thinking you probably want your Space function to be named Spaceship.

Also, onClipEvent I think is an as2 function. Try

addEventListener(Event.ENTER_FRAME, function(evt:Event){ //code });

in the fla instead. The EnterFrame event does not deal in keystrokes however, so I suggest you make a different listener for that.

addEventListener(KeyboardEvent.KEY_UP, function(evt:Event){ if(evt.keyCode == 123) etc });

in the fla should work.

edit: oh yeah, and you need to instansiate the spaceship class,


var myVariable = new spaceShip();
addChild(myVariable);
Excuse me hun, but what is your name? Vivian? I woke up next to you naked and, uh, did we, um?
zoombini
Profile Joined June 2010
United States67 Posts
January 05 2011 22:22 GMT
#631
On January 04 2011 08:15 uNiGNoRe wrote:
Show nested quote +
On January 04 2011 03:25 Phunkapotamus wrote:
icystorage:
You shouldn't need to include "Node.h" for a struct definition and for this to compile. Your latest snippet will work. However, if you wish to use the 'node' struct outside of the current file it would be better practice to move the definition elsewhere- such that you can use it in multiple places easier.

For c++ you don't need to put 'struct' every time you use your 'node'. If you're getting errors relating to how 'node' is used, then you may be compiling as c instead of c++. My snippet has a solution that works for both.

If I may, I would like to recommend that you work towards a better variable naming conventions. Taking your example, mixed with bigpet's, this is how we would like to see code in the game industry:

+ Show Spoiler +

typedef struct _IcyNode
{
int m_data;
_IcyNode* m_next;
} IcyNode;

IcyNode* BuildOneTwoThree()
{
const int icyNodeSize = sizeof(IcyNode);
IcyNode* oneNode = static_cast< IcyNode* >(malloc(icyNodeSize));
oneNode->m_data = 1;
IcyNode* twoNode = static_cast< IcyNode* >(malloc(icyNodeSize));
twoNode ->m_data = 2;
IcyNode* threeNode = static_cast< IcyNode* >(malloc(icyNodeSize));
threeNode ->m_data = 3;

oneNode->m_next = twoNode;
twoNode->m_next = threeNode;
threeNode->m_next = NULL;

return oneNode;
}

int main()
{
BuildOneTwoThree();
return 0;
}


I have a question: why do you use
IcyNode* oneNode = static_cast< IcyNode* >(malloc(icyNodeSize));

instead of
IcyNode* oneNode = (IcyNode*)malloc(icyNodeSize);


You should check this out for an explanation of C++ casts: http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used
SaYyId
Profile Joined August 2010
Portugal277 Posts
January 05 2011 22:40 GMT
#632
Pretty bold request, but can anyone here teach me how to code? The basics and such, nothing too fancy, as I remember being on MPGH looking like a noob that was there just for the hacks, not giving anithing in return. I really feel like I should learn how to code.
No Strings. No attachments.
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
January 06 2011 02:28 GMT
#633
On January 06 2011 06:14 enigmaticcam wrote:
Show nested quote +
On January 05 2011 13:48 Adeny wrote:
Anyone have the breakdown on ELO? Finding it hard to google out formulas to copy-paste, I don't want the deep mathematical stuff, I know the basic outline and just want to implement it for fun.

Some key things to consider are: (1) how to manage provisional ratings for new players, (2) how inflated you want the numbers to be (K constant), (3) chronological order of events, and (4) does ELO make sense with the tournament format.

(1) How to manage provisional ratings for new players.
I recommend you check out http://www.chessatwork.com/help/index.php?help=faq, under "How is my rating calculated?" It's a very simple and nice explanation on how they manage new players, and I think it works great. I've used their system before in my own implementation.

(2) How inflated you want the numbers to be (K constant).
If you've googled the actual ELO mathematical equations, you'll come across the K constant. It's basically a constant that determines how much you want the numbers to fluctuate. The higher the constant, the larger the numbers will change after a given match. In the official Chess ELO format, they use a larger constant if you're below 2400, but a smaller constant above 2400. You don't have to do that, but it's something to think about

(3) Chronological order of events.
It's very important that ratings are calculated in the chronological order they happened. If you calculate them as they happen, this isn't a problem. But sometimes that's not always the case. You might enter two or three tournaments worth of data at once, and later learn there was some other tournament in between that you forgot to input, and you've basically got to recalculate from the very beginning. You'll need to account for that if you're developing some kind of program for this.

(4) Does ELO make sense with the tournament format.
The simple fact is, ELO makes no sense at all for the standard brackets you typically see. You know, those that work great when the number of participants is a factor of 2 (2,4,8,16,32,64). Especially ones that are seeded properly based on historical results. Those kinds of tournaments produce accurate ELO ratings for just the top three or so, because they play the most games. ELO is much better for swiss or round-robin tournaments.


Sick reply, thanks a lot!
Craton
Profile Blog Joined December 2009
United States17302 Posts
January 06 2011 05:14 GMT
#634
On January 06 2011 07:40 SaYyId wrote:
Pretty bold request, but can anyone here teach me how to code? The basics and such, nothing too fancy, as I remember being on MPGH looking like a noob that was there just for the hacks, not giving anithing in return. I really feel like I should learn how to code.

Pick some basic tutorials and run with them. Should be plenty on the OP links.
twitch.tv/cratonz
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
January 06 2011 18:44 GMT
#635
On January 06 2011 11:28 Adeny wrote:

Sick reply, thanks a lot!

No problem
RainWhisper
Profile Joined May 2009
United Arab Emirates333 Posts
January 07 2011 01:47 GMT
#636
Guys, ive finally caved and ive come here. Im trying to develop something, AND ITS FOR TEAM LIQUID yay!!! But alas i hit a pylon wall and i need major help with RegExp(Regular Expressions). I believe PERL RegExp.

If this makes ANY sense to you than you are probably the person i need

RegExp="(?siU)Featured Streams.*<h>(.*)Live Streams"

Anyone familiar with this type of Regular expressions, i need a gosu. I can understand this, but i need to basically write a way more complex Regular Expression.
Hi can i get one McGracken please?
uNiGNoRe
Profile Blog Joined June 2007
Germany1115 Posts
January 07 2011 02:30 GMT
#637
On January 06 2011 07:22 zoombini wrote:
Show nested quote +
On January 04 2011 08:15 uNiGNoRe wrote:
On January 04 2011 03:25 Phunkapotamus wrote:
icystorage:
You shouldn't need to include "Node.h" for a struct definition and for this to compile. Your latest snippet will work. However, if you wish to use the 'node' struct outside of the current file it would be better practice to move the definition elsewhere- such that you can use it in multiple places easier.

For c++ you don't need to put 'struct' every time you use your 'node'. If you're getting errors relating to how 'node' is used, then you may be compiling as c instead of c++. My snippet has a solution that works for both.

If I may, I would like to recommend that you work towards a better variable naming conventions. Taking your example, mixed with bigpet's, this is how we would like to see code in the game industry:

+ Show Spoiler +

typedef struct _IcyNode
{
int m_data;
_IcyNode* m_next;
} IcyNode;

IcyNode* BuildOneTwoThree()
{
const int icyNodeSize = sizeof(IcyNode);
IcyNode* oneNode = static_cast< IcyNode* >(malloc(icyNodeSize));
oneNode->m_data = 1;
IcyNode* twoNode = static_cast< IcyNode* >(malloc(icyNodeSize));
twoNode ->m_data = 2;
IcyNode* threeNode = static_cast< IcyNode* >(malloc(icyNodeSize));
threeNode ->m_data = 3;

oneNode->m_next = twoNode;
twoNode->m_next = threeNode;
threeNode->m_next = NULL;

return oneNode;
}

int main()
{
BuildOneTwoThree();
return 0;
}


I have a question: why do you use
IcyNode* oneNode = static_cast< IcyNode* >(malloc(icyNodeSize));

instead of
IcyNode* oneNode = (IcyNode*)malloc(icyNodeSize);


You should check this out for an explanation of C++ casts: http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used

Thank you. Very helpful. But after reading that and some other sources, I cannot imagine when using dynamic_cast would actually be a good idea. I mean, if you need to cast a pointer where you aren't sure what it points to even at runtime, you should probably rethink you code...

Now another question: I'm currently reading the OpenGL Programming Guide parallel to a computer graphics course at the university. I'd like to program a 3D graphics engine to put that into practice. My question is, can anyone recommend a good (english) book about OpenGL programming? Especially if it covers features that were added with later OpenGL releases since the guide covers only 1.0 and 1.1. And/or a book that focuses on programming a game graphics engine with OpenGL?
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2011-01-07 02:49:02
January 07 2011 02:48 GMT
#638
On January 06 2011 00:31 Craton wrote:
Show nested quote +
On January 05 2011 10:06 Rutluv wrote:
+ Show Spoiler +
<html>
<head>
<style type="text/css">
li
{
display:inline;
}
body
{
background-color:black;
}
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}
a:hover,a:active
{
background-color:red;
}
ul
{
list-style-type:none;
margin:0;
padding:0;
border:5px white;
padding-top:5px;
padding-bottom:5px;
}

</style>
</head>
<body>
<ul>
<li><a href="#">Biographie</a></li>
<li><a href="#">Multimedia</a></li>
<li><a href="#">Discographie</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Liens</a></li>
<li><a href="#">Blablabla</a></li>
</ul>
</body>
</html>


Hey guys, i'm a total noob at programming for now, but I've been working on improving my skills lately. (I've been messing around with HTML CSS and Javascript)

Anyways, for fun I tried to do a horizontal menu with hover stuff. But I cant get it to be horizontal... Vertical menu works though. It seems like my : display:inline; doesnt have any effect...

I've tryed using float:left and it works but I really wanted to make the other way work.

Could any body tell me why it doesnt seem to recognise the inline?

Thanks a lot, this thread is really encouraging.

Well, HTML and CSS aren't programming per se.

To answer your question: you have the CSS for your links set as block, but your list items set as inline. You aren't allowed to have both, as they are mutually exclusive. The block style, in this case, is taking precedence, which is why you get them on multiple lines (I believe this is because <a> is the innermost style). Delete "display:block;" inside
a:link,a:visited
{
display:block;
color:white;
background-color:green;
font-weight:bold;
width:140px;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase
}



First and foremost rutluv, unless you are just leaving out the doctype while pasting in your code, you really need to make sure you add one to your html pages. It will save you a lot of headache on your future learnings...

Reading about why you need a doctype

In your example its displaying on each line because the a is a block, as craton pointed out. The li are still trying to display inline but it isn't visible because the li has no other styles.

Yes its painful to get right cross browser but the float based navigation style is going to be a better implementation until the mythical inline block finally becomes consistent across browsers because the floated li will allow for you to nest block level elements inside of them, unlike the inline elements as you have already figured out.
gravity
Profile Joined March 2004
Australia2198 Posts
January 07 2011 03:41 GMT
#639
On January 07 2011 11:30 uNiGNoRe wrote:
Now another question: I'm currently reading the OpenGL Programming Guide parallel to a computer graphics course at the university. I'd like to program a 3D graphics engine to put that into practice. My question is, can anyone recommend a good (english) book about OpenGL programming? Especially if it covers features that were added with later OpenGL releases since the guide covers only 1.0 and 1.1. And/or a book that focuses on programming a game graphics engine with OpenGL?

I'm currently reading OpenGL SuperBible 5th edition. It's very clearly written and focuses on OpenGL 3.0+.
Bigpet
Profile Joined July 2010
Germany533 Posts
January 07 2011 05:51 GMT
#640
On January 07 2011 10:47 MarwanBaki wrote:
Guys, ive finally caved and ive come here. Im trying to develop something, AND ITS FOR TEAM LIQUID yay!!! But alas i hit a pylon wall and i need major help with RegExp(Regular Expressions). I believe PERL RegExp.

If this makes ANY sense to you than you are probably the person i need

RegExp="(?siU)Featured Streams.*<h>(.*)Live Streams"

Anyone familiar with this type of Regular expressions, i need a gosu. I can understand this, but i need to basically write a way more complex Regular Expression.


I am sorry but your post contains no question other then "can anybody help me?".
Please just ask your question and we'll answer it.

Also you could ask the guys resposible for the site if they'll maybe make a XML interface or a seperate simple website like teamliquid.net/streams.php to ease both your task and their netload.
Because parsing a full website when asking the programmers could spare you a lot of trouble is really silly.
I'm NOT the caster with a similar nick
Prev 1 30 31 32 33 34 1032 Next
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
16:00
#60
RotterdaM1271
TaKeTV 485
TKL 367
IndyStarCraft 268
SteadfastSC211
ZombieGrub149
BRAT_OK 127
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 1271
ByuN 572
TKL 367
IndyStarCraft 268
SteadfastSC 211
ZombieGrub149
BRAT_OK 127
ProTech100
StarCraft: Brood War
Calm 3595
Mini 538
EffOrt 493
ggaemo 172
Mong 53
yabsab 13
sorry 12
Dota 2
monkeys_forever425
League of Legends
Doublelift2006
Super Smash Bros
PPMD5
Heroes of the Storm
Liquid`Hasu522
Other Games
Grubby3559
shahzam684
Beastyqt638
Mlord467
B2W.Neo357
ToD267
Pyrionflax189
C9.Mang0176
UpATreeSC119
Livibee118
JuggernautJason93
Mew2King52
Trikslyr41
Organizations
Other Games
BasetradeTV97
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• kabyraGe 177
• StrangeGG 49
• Reevou 11
• RyuSc2 7
• IndyKCrew
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• Eskiya23 12
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3110
• masondota21012
Other Games
• imaqtpie1045
• Shiphtur565
Upcoming Events
Sparkling Tuna Cup
13h 8m
INu's Battles
14h 8m
Cure vs herO
ByuN vs Rogue
PiGosaur Cup
1d 3h
The PondCast
1d 13h
Kung Fu Cup
1d 14h
Patches Events
1d 19h
Replay Cast
2 days
CrankTV Team League
2 days
OSC
2 days
Replay Cast
3 days
[ Show More ]
Escore
3 days
CrankTV Team League
3 days
Replay Cast
4 days
Afreeca Starleague
4 days
RSL Revival
4 days
ByuN vs SHIN
Solar vs Lambo
WardiTV Summer Champion…
4 days
Afreeca Starleague
5 days
RSL Revival
5 days
Clem vs Serral
herO vs Rogue
WardiTV Summer Champion…
5 days
WardiTV Weekly
6 days
Liquipedia Results

Completed

Acropolis #4
SCTL 2026 Spring
Eternal Conflict S2 Finale

Ongoing

CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

Escore Tournament S3: W5
ASL Season 22: Qualifier #1
ASL Season 22: Qualifier #2
Acropolis #5
CSLAN 4
ASL Season 22
Acropolis #5 - TRS
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
PiG Sty Festival 8.0
Light Tournament 2026
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 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.