• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:33
CEST 12:33
KST 19:33
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles0[BSL20] Non-Korean Championship 4x BSL + 4x China7Flash Announces Hiatus From ASL63Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
ASL20 Preliminary Maps SC uni coach streams logging into betting site Player “Jedi” cheat on CSL Flash Announces Hiatus From ASL BW General Discussion
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [BSL20] Non-Korean Championship 4x BSL + 4x China CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024! Summer Games Done Quick 2025! Russo-Ukrainian War Thread
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 684 users

The Big Programming Thread - Page 118

Forum Index > General Forum
Post a Reply
Prev 1 116 117 118 119 120 1031 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 States17247 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
Hyrule19031 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 States8001 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 27m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Creator 99
Rex 0
StarCraft: Brood War
Hyuk 759
Pusan 491
Soma 457
Stork 309
Jaedong 205
ZerO 170
Sharp 160
Larva 134
sorry 129
sSak 98
[ Show more ]
Soulkey 98
Shine 65
yabsab 51
Aegong 39
Snow 39
Free 27
zelot 26
JulyZerg 25
Mind 24
IntoTheRainbow 10
ivOry 3
Dota 2
XcaliburYe586
XaKoH 466
syndereN92
Counter-Strike
shoxiejesuss675
x6flipin382
allub147
Super Smash Bros
Mew2King215
Other Games
Pyrionflax305
crisheroes265
SortOf152
rGuardiaN49
ZerO(Twitch)16
Organizations
Other Games
gamesdonequick29158
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2227
League of Legends
• HappyZerGling100
Other Games
• WagamamaTV166
Upcoming Events
Wardi Open
27m
Replay Cast
13h 27m
Sparkling Tuna Cup
23h 27m
WardiTV European League
1d 5h
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 13h
The PondCast
1d 23h
WardiTV European League
2 days
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
[ Show More ]
Replay Cast
3 days
RSL Revival
3 days
Classic vs Cure
FEL
4 days
RSL Revival
4 days
FEL
5 days
FEL
5 days
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
6 days
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.