• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 19:07
CET 00:07
KST 08:07
  • 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
ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
2026 KongFu Cup Announcement3BGE Stara Zagora 2026 cancelled11Blizzard Classic Cup - Tastosis announced as captains15Weekly Cups (March 2-8): ByuN overcomes PvT block4GSL CK - New online series18
StarCraft 2
General
Blizzard Classic Cup - Tastosis announced as captains BGE Stara Zagora 2026 cancelled BGE Stara Zagora 2026 announced ByuL: The Forgotten Master of ZvT Terran AddOns placement
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament 2026 KongFu Cup Announcement [GSL CK] Team Maru vs. Team herO StarCraft Evolution League (SC Evo Biweekly)
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 516 Specter of Death Mutation # 515 Together Forever Mutation # 514 Ulnar New Year
Brood War
General
BSL 22 Map Contest — Submissions OPEN to March 10 ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Are you ready for ASL 21? Hype VIDEO Gypsy to Korea
Tourneys
[Megathread] Daily Proleagues [BSL22] Open Qualifiers & Ladder Tours IPSL Spring 2026 is here! ASL Season 21 Qualifiers March 7-8
Strategy
Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Zealot bombing is no longer popular?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread PC Games Sales Thread No Man's Sky (PS4 and PC)
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
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
Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Mexico's Drug War Russo-Ukrainian War Thread NASA and the Private Sector
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
Formula 1 Discussion 2024 - 2026 Football Thread General nutrition recommendations Cricket [SPORT] TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1540 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 States17281 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
Hyrule19194 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
BSL
20:00
S22 - Ladder Tour #1
ZZZero.O89
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
elazer 313
PiGStarcraft188
Nathanias 95
JuggernautJason59
Ketroc 54
ROOTCatZ 53
Nina 39
StarCraft: Brood War
Sea 11073
ZZZero.O 89
Aegong 84
Backho 55
Dota 2
monkeys_forever326
canceldota18
LuMiX2
Super Smash Bros
hungrybox704
Heroes of the Storm
Khaldor316
Other Games
summit1g9885
FrodaN4504
Grubby4319
KnowMe413
crisheroes231
mouzStarbuck186
ArmadaUGS80
ViBE33
Organizations
Other Games
gamesdonequick2262
ComeBackTV 221
BasetradeTV51
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• musti20045 44
• HeavenSC 41
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• Azhi_Dahaki13
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21533
League of Legends
• Doublelift4524
• Scarra712
Other Games
• imaqtpie1328
Upcoming Events
Sparkling Tuna Cup
10h 53m
RSL Revival
10h 53m
ByuN vs SHIN
Maru vs Krystianer
WardiTV Team League
12h 53m
Patches Events
17h 53m
BSL
20h 53m
Replay Cast
1d
Replay Cast
1d 9h
Wardi Open
1d 12h
Monday Night Weeklies
1d 17h
OSC
2 days
[ Show More ]
WardiTV Team League
2 days
GSL
3 days
The PondCast
4 days
KCM Race Survival
4 days
WardiTV Team League
4 days
Replay Cast
5 days
KCM Race Survival
5 days
WardiTV Team League
5 days
Korean StarCraft League
6 days
uThermal 2v2 Circuit
6 days
BSL
6 days
Liquipedia Results

Completed

Proleague 2026-03-13
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
BSL Season 22
RSL Revival: Season 4
Nations Cup 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

CSL Elite League 2026
ASL Season 21
Acropolis #4 - TS6
2026 Changsha Offline CUP
Acropolis #4
IPSL Spring 2026
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
NationLESS Cup
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 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.