• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:40
CET 23:40
KST 07:40
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets0$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)12Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822
StarCraft 2
General
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns Spontaneous hotkey change zerg Chinese SC2 server to reopen; live all-star event in Hangzhou SC2 All-Star Invitational: Jan 17-18
Tourneys
$25,000 Streamerzone StarCraft Pro Series announced $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) WardiTV Winter Cup WardiTV Mondays SC2 AI Tournament 2026
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
Potential ASL qualifier breakthroughs? BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion StarCraft & BroodWar Campaign Speedrun Quest Data analysis on 70 million replays
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Beyond All Reason Nintendo Switch Thread Awesome Games Done Quick 2026! Mechabellum Stormgate/Frost Giant Megathread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2367 users

The Big Programming Thread - Page 118

Forum Index > General Forum
Post a Reply
Prev 1 116 117 118 119 120 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 States17274 Posts
Last Edited: 2012-02-21 22:21:30
February 21 2012 22:20 GMT
#2341
I have a Windows Mobile application I'm working on and I want to connect to a SQL Server database (housed within SQL Server 2008 that's located on another machine). The problem is there doesn't seem to be (or at least I can't find) any way to do this. There's no System.Data to use, nor is there a way to add such a reference. It seems like connecting to a database should definitely be possible for a phone application to do, though, which is why it seems odd that I can't find anything on how to do it.

Really what I'm looking for is some kind of mobile equivalent for SQLConnection and SQLCommand. Any thoughts?
twitch.tv/cratonz
tofucake
Profile Blog Joined October 2009
Hyrule19188 Posts
February 21 2012 22:22 GMT
#2342
Your googlefu is weak...
Liquipediaasante sana squash banana
noonoo
Profile Joined February 2012
3 Posts
February 21 2012 22:23 GMT
#2343
--- Nuked ---
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
February 22 2012 19:10 GMT
#2344
Hey guys, I'm having trouble with a function in c.

I'm trying to make a function that takes an array of characters (basically a string/phrase) and count how many words out of it. A "word" is defined to be a sequence of non-null, non-whitespace characters, separated from other words by whitespace.

This is what I have right now.


int words( char sentence[]){
int wrd = 0;
int i, j;

for (i = 0; sentence[i] != '\0'; i++){

if(sentence[i] != '\t' && sentence[i] != ' ' && sentence[i] != '\n' && sentence[i] != '\0'){

while(sentence[i] != '\t' && sentence[i] != ' ' && sentence[i] != '\n' && sentence[i] != '\0'){

i++;

}
wrd++;
}

}

return wrd;
}



right now I'm using the phrase " R2! \t\t Where \n\n are you?" (exactly as typed) and I get 5 words when there is only 4 (R2!, Where, are, you?. Yes they all count).

Help?
Aiyeeeee
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
February 22 2012 19:30 GMT
#2345
I think at the last word, your while loop puts i at the /0. Then your for loop does the i++ instruction after executing its block. So now your sentence[i] is the next byte in memory after your string. I am not sure though.
And all is illuminated.
LukeNukeEm
Profile Joined February 2012
31 Posts
February 22 2012 19:32 GMT
#2346
Your iteration is off. Imagine the sentence "abc", which is {'a', 'b', 'c', '\0'}. Your inner while-loop increases i, until it reaches '\0'.
Then your for-loop increases i again, and you are in a place where you shouldn't be.
supereddie
Profile Joined March 2011
Netherlands151 Posts
Last Edited: 2012-02-22 19:43:07
February 22 2012 19:41 GMT
#2347
try something like this (much easier)
int wrd = 0, i = 0;
while(sentence[i] != '\0')
if (sentence[i++] == ' ') wrd++;

if(i > 0) wrd++;

Basically, number of words equals number of spaces + 1
Do some checking of course to prevent more than one sequential space being counted as more than one word.
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
darthfoley
Profile Blog Joined February 2011
United States8004 Posts
February 22 2012 19:53 GMT
#2348
As a COMPLETE noob in this subject, i'm thankful for all of you who do the things i find too confusing to try! <3
watch the wall collide with my fist, mostly over problems that i know i should fix
Holy_AT
Profile Joined July 2010
Austria978 Posts
February 22 2012 19:58 GMT
#2349
On February 23 2012 04:41 supereddie wrote:
try something like this (much easier)
int wrd = 0, i = 0;
while(sentence[i] != '\0')
if (sentence[i++] == ' ') wrd++;

if(i > 0) wrd++;

Basically, number of words equals number of spaces + 1
Do some checking of course to prevent more than one sequential space being counted as more than one word.


I dont think it is a good approach, you could have multiple white spaces between words and your method would not work. A good approach is to count the switches. Just tore the before value and if the before value == " " and the actual value is something else then " " then he should count.
Insane
Profile Blog Joined November 2003
United States4991 Posts
Last Edited: 2012-02-22 19:59:13
February 22 2012 19:58 GMT
#2350
On the assumption that you don't want to just use some library that splits strings as this is for some assignment, it's probably easiest just to do a 1-pass through of the string and keep track of whether you're in a word or not.


int isInWord = 0;
for (i = 0; sentence[i] != '\0'; i++)
{
if (IsWhiteSpace(sentence[i]))
{
if (isInWord)
{
wrd++;
}

isInWord = false;
}
else
{
isInWord = true;
}
}

if (isInWord)
{
wrd++;
}



Generally increasing the for-looped variable inside the loop itself is something you should be very careful/wary about doing . Also note that you never used 'j' anywhere from what I can see.

e: IsWhiteSpace would be a function you'd write that has the characters that for the sake of this you're considering whitespace...
Holy_AT
Profile Joined July 2010
Austria978 Posts
February 22 2012 20:07 GMT
#2351
sentence[i] != '\0'


I am more the C# guy, but isnt that a bad way to query for the end of an array ?

isnt there some sentence.count or something like that to get the array length ? And stop the loop if i >array.length ?
LukeNukeEm
Profile Joined February 2012
31 Posts
February 22 2012 20:12 GMT
#2352
In plain C no, there isn't.
Insane
Profile Blog Joined November 2003
United States4991 Posts
Last Edited: 2012-02-22 20:21:35
February 22 2012 20:14 GMT
#2353
On February 23 2012 05:07 Holy_AT wrote:
Show nested quote +
sentence[i] != '\0'


I am more the C# guy, but isnt that a bad way to query for the end of an array ?

isnt there some sentence.count or something like that to get the array length ? And stop the loop if i >array.length ?

If it's just a char pointer array thingy you don't know what the length is without iterating until you find null. There are functions to do that for you obviously, but for classroom assignments I'd be wary about using library functions unless you know you are allowed to use them.

For C# it's a trivial one liner with sentence.Split anyway FWIW . return sentence.Split(new[] { ' ', '\n', '\0', '\t' }, StringSplitOptions.RemoveEmptyEntries).Length;
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
February 22 2012 20:20 GMT
#2354
damn you high level languages!
And all is illuminated.
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
February 22 2012 20:35 GMT
#2355
Happy birthday Luke!

Thanks guys for the advice. As for that j, it was used for a different algorithm that I had but it didn't end up the way I wanted it to be.

I managed to get the function working, onward to the second function (which I think I'll need some help...).
Aiyeeeee
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
February 24 2012 04:33 GMT
#2356
Wrote another blog post on game programming in C! Thought you guys here would find it interesting: link.
NoSlack
Profile Joined November 2010
United States112 Posts
February 24 2012 17:15 GMT
#2357
On February 24 2012 13:33 CecilSunkure wrote:
Wrote another blog post on game programming in C! Thought you guys here would find it interesting: link.


Awesome read thanks!

I'm afraid that learning on my own just isn't working, I'm going to need some college classes. I need to be around people that are doing the same thing. As an infantryman in the army, there aren't too many people around me interested in programming

Some day...
FoxyMayhem
Profile Blog Joined April 2011
624 Posts
February 24 2012 17:46 GMT
#2358
I have a goal with a website I'm in charge of. It's for a family business. I dipped in HTML back in 04 and 05, but what I want to do is currently beyond my knowledge. In otherwords, I don't know where to look to start learning what I need -- or, perhaps, who to hire.

Is anyone in this good community interested in a little web development side project, or pointing me in the right direction?

Details
+ Show Spoiler +
Currently, the horse pedigrees look like this.
[image loading]

That, my brother said, is the absolute best we can do. I know he's wrong. I'd like the pedigree like this:
[image loading]

With Tooltips Like This:
[image loading]

So, what's the best way to go about creating this? Ideally, it can work inside of our wordpress. Those mockups are my work, so graphics is not so much a problem, just the technical side of things.

Thanks guys.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
February 24 2012 19:50 GMT
#2359
On February 25 2012 02:15 NoSlack wrote:
Show nested quote +
On February 24 2012 13:33 CecilSunkure wrote:
Wrote another blog post on game programming in C! Thought you guys here would find it interesting: link.


Awesome read thanks!

I'm afraid that learning on my own just isn't working, I'm going to need some college classes. I need to be around people that are doing the same thing. As an infantryman in the army, there aren't too many people around me interested in programming

Some day...

Hey glad you liked it! Bump that thread if you get a chance, would love more people to see and potentially get into programming.
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
February 24 2012 19:55 GMT
#2360
On February 25 2012 02:46 FoxyMayhem wrote:
I have a goal with a website I'm in charge of. It's for a family business. I dipped in HTML back in 04 and 05, but what I want to do is currently beyond my knowledge. In otherwords, I don't know where to look to start learning what I need -- or, perhaps, who to hire.

Is anyone in this good community interested in a little web development side project, or pointing me in the right direction?

Details
+ Show Spoiler +
Currently, the horse pedigrees look like this.
[image loading]

That, my brother said, is the absolute best we can do. I know he's wrong. I'd like the pedigree like this:
[image loading]

With Tooltips Like This:
[image loading]

So, what's the best way to go about creating this? Ideally, it can work inside of our wordpress. Those mockups are my work, so graphics is not so much a problem, just the technical side of things.

Thanks guys.


That is extremely easy to achieve, especially if the content is static and you don't plan on changing that often. All you need is to read tutorials on HTML and CSS.

Basically what you have there is a table, so learn how to fancy the tables with CSS and you are ready to go.
"When the geyser died, a probe came out" - SirJolt
Prev 1 116 117 118 119 120 1032 Next
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
17:30
#36
SteadfastSC100
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft403
UpATreeSC 116
JuggernautJason111
SteadfastSC 100
Nathanias 96
elazer 12
CosmosSc2 1
StarCraft: Brood War
Shuttle 538
Sexy 35
Dota 2
monkeys_forever266
Pyrionflax224
capcasts91
League of Legends
C9.Mang0192
Counter-Strike
pashabiceps1469
Foxcn312
Other Games
Grubby3582
tarik_tv3218
Liquid`RaSZi2984
shahzam498
ToD394
B2W.Neo278
Liquid`Hasu275
XaKoH 124
QueenE99
Dewaltoss74
ZombieGrub39
Ketroc2
Organizations
Other Games
gamesdonequick4382
BasetradeTV30
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• davetesta12
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• intothetv
• IndyKCrew
StarCraft: Brood War
• Eskiya23 17
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21195
• WagamamaTV438
League of Legends
• TFBlade948
Other Games
• imaqtpie2382
• Shiphtur270
Upcoming Events
WardiTV Invitational
13h 20m
PiGosaur Cup
1d 2h
WardiTV Invitational
1d 13h
The PondCast
2 days
OSC
2 days
OSC
3 days
All Star Teams
4 days
INnoVation vs soO
sOs vs Scarlett
uThermal 2v2 Circuit
4 days
All Star Teams
5 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
5 days
[ Show More ]
OSC
5 days
Replay Cast
6 days
Wardi Open
6 days
Liquipedia Results

Completed

Proleague 2026-01-11
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
Proleague 2026-01-12
OSC Championship Season 13
Underdog Cup #3
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Thunderfire SC2 All-star 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.