• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:29
CET 16:29
KST 00:29
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation6Weekly 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 Weekly Cups (Nov 3-9): Clem Conquers in Canada Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle Terran 1:35 12 Gas Optimization BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET [ASL20] Grand Finals [Megathread] Daily Proleagues
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
EVE Corporation Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Path of Exile
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 Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! 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: 1235 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 States17264 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
Hyrule19151 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
OSC
11:30
Mid Season Playoffs
Krystianer vs PercivalLIVE!
WardiTV1063
TKL 199
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 199
SteadfastSC 109
Rex 91
StarCraft: Brood War
Calm 3367
Bisu 2918
Rain 2430
Hyuk 1473
Horang2 984
Flash 514
Soma 498
Stork 393
Rush 303
Soulkey 121
[ Show more ]
Backho 114
Barracks 58
sas.Sziky 46
hero 38
Aegong 27
zelot 22
sSak 21
Terrorterran 20
Rock 19
Killer 16
Dota 2
Gorgc3152
qojqva2018
Dendi1105
BananaSlamJamma123
XcaliburYe100
Other Games
hiko638
Sick526
DeMusliM442
Hui .346
Fuzer 199
Mew2King94
QueenE50
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 9
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• poizon28 22
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 10
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 3021
• WagamamaTV453
League of Legends
• Nemesis4037
• TFBlade977
Upcoming Events
Tenacious Turtle Tussle
7h 31m
The PondCast
18h 31m
RSL Revival
18h 31m
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
20h 31m
WardiTV Korean Royale
20h 31m
PiGosaur Monday
1d 9h
RSL Revival
1d 18h
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
1d 20h
CranKy Ducklings
2 days
RSL Revival
2 days
herO vs Gerald
ByuN vs SHIN
[ Show More ]
Kung Fu Cup
2 days
IPSL
3 days
ZZZero vs rasowy
Napoleon vs KameZerg
BSL 21
3 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
3 days
RSL Revival
3 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
3 days
WardiTV Korean Royale
3 days
BSL 21
4 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
4 days
Dewalt vs WolFix
eOnzErG vs Bonyth
Wardi Open
4 days
Monday Night Weeklies
5 days
WardiTV Korean Royale
5 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
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
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
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
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.