• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:14
CEST 14:14
KST 21:14
  • 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
Team TLMC #5 - Finalists & Open Tournaments1[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
StarCraft II 5.0.15 PTR Patch Notes146BSL 2025 Warsaw LAN + Legends Showmatch2Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8
StarCraft 2
General
StarCraft II 5.0.15 PTR Patch Notes Why Storm Should NOT Be Nerfed – A Core Part of Pr #1: Maru - Greatest Players of All Time Team TLMC #5 - Finalists & Open Tournaments Team Liquid Map Contest #21 - Presented by Monster Energy
Tourneys
RSL: Revival, a new crowdfunded tournament series Stellar Fest KSL Week 80 StarCraft Evolution League (SC Evo Biweekly) SC2's Safe House 2 - October 18 & 19
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Soulkey on ASL S20 ASL20 General Discussion BW General Discussion Diplomacy, Cosmonarchy Edition ASL TICKET LIVE help! :D
Tourneys
[ASL20] Ro16 Group D BSL 2025 Warsaw LAN + Legends Showmatch [ASL20] Ro16 Group C Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Borderlands 3 Nintendo Switch Thread General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
Community
General
US Politics Mega-thread The Big Programming Thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
Too Many LANs? Tournament Ov…
TrAiDoS
i'm really bored guys
Peanutsc
I <=> 9
KrillinFromwales
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1583 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 States17253 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
Hyrule19087 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 States8003 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
RSL Revival
10:00
Season 2: Playoffs Day 7
Cure vs ZounLIVE!
Tasteless1253
Crank 1116
IndyStarCraft 228
CranKy Ducklings104
Rex103
3DClanTV 46
IntoTheiNu 19
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 1253
Crank 1116
IndyStarCraft 228
Rex 103
MindelVK 38
Railgan 26
StarCraft: Brood War
Britney 44101
Calm 7883
Rain 2649
Horang2 2266
Flash 2062
GuemChi 1160
EffOrt 818
Larva 536
BeSt 467
actioN 423
[ Show more ]
Hyuk 315
Hyun 286
Zeus 206
Last 193
firebathero 182
Soma 114
Rush 113
ZZZero.O 92
Aegong 90
Light 85
Soulkey 69
sSak 67
Sharp 65
Free 58
ajuk12(nOOB) 56
Nal_rA 46
Movie 41
Mong 39
soO 34
sas.Sziky 31
Sacsri 29
Sexy 27
ivOry 21
Icarus 17
Hm[arnc] 10
Terrorterran 4
Noble 3
Dota 2
singsing2890
Gorgc2340
qojqva1380
Dendi1218
XcaliburYe734
Fuzer 207
Counter-Strike
allub268
Heroes of the Storm
Khaldor183
Other Games
B2W.Neo1050
DeMusliM495
crisheroes374
Lowko175
Hui .144
NeuroSwarm45
Trikslyr24
Organizations
Other Games
gamesdonequick713
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
League of Legends
• Jankos1883
• Stunt552
Other Games
• WagamamaTV269
Upcoming Events
BSL Open LAN 2025 - War…
2h 46m
OSC
8h 46m
BSL Open LAN 2025 - War…
19h 46m
RSL Revival
21h 46m
Classic vs TBD
WardiTV Invitational
22h 46m
Online Event
1d 3h
Wardi Open
1d 22h
Monday Night Weeklies
2 days
Sparkling Tuna Cup
2 days
LiuLi Cup
3 days
[ Show More ]
The PondCast
4 days
CranKy Ducklings
5 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
RSL Revival: Season 2
Maestros of the Game
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

Upcoming

IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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.