Welcome, Guest. Please login or register.
July 20, 2025, 12:38:43 AM

Login with username, password and session length

Search:     Advanced search
we're back, baby
*
Home Help Search Login Register
f13.net  |  f13.net General Forums  |  General Discussion  |  Serious Business  |  Topic: Useless Conversation 0 Members and 4 Guests are viewing this topic.
Pages: 1 ... 357 358 [359] 360 361 ... 1141 Go Down Print
Author Topic: Useless Conversation  (Read 4156612 times)
Arthur_Parker
Terracotta Army
Posts: 5865

Internet Detective


Reply #12530 on: January 05, 2011, 12:19:16 PM

Might not be his account anyway.

Edit my money is on it being DV.
« Last Edit: January 05, 2011, 12:23:10 PM by Arthur_Parker »
Lantyssa
Terracotta Army
Posts: 20848


Reply #12531 on: January 05, 2011, 12:59:55 PM

Gah.  A bit of code is driving me nuts.  Fancy PHP to form a string out three (or less) fields in a row then repeat if necessary:

Code:
1   Ant
2   Bee
3   Cat
4   Dog
5   Egg
6   Fuck
Code:
  while ($row = mysql_fetch_object($result))
  {
    $str .= "<tr align='center'>";
    for ($x=0; $x<3 && $row = mysql_fetch_object($result); $x++)
      $str .= "<td><a href='?id=$row->name'>$row->name</a></td>";
    $str .= "</tr>\n";
  }

What I think it should do is the while statement evaluates the first fetch.  If it finds something the first pass through the for loop should be automatic.  Two more passes through the for loop if there are subsequent rows to fetch.  Then it'll start over back at the while.

It's acting as if it's evaluating the second expression of the for loop in the first pass though, as it drops the first row as it is written.  So a full pass comes out as
Quote
Bee Cat Dog
Fuck

Putting a string append prior to the for loop and setting $x<2 formats the data as I want, or putting the fetch within the loop instead of the second expression condition, so I know it's making a fetch in the initial pass for some reason.  Obviously I can do to work around it, but I'm trying to understand this quirk of PHP, or to have my faulty logic explained if I've gone completely crazy.

Hahahaha!  I'm really good at this!
Oban
Terracotta Army
Posts: 4662


Reply #12532 on: January 05, 2011, 02:12:54 PM

I am eager to see how bee cat dog fuck turns out.

Palin 2012 : Let's go out with a bang!
naum
Terracotta Army
Posts: 4263


WWW
Reply #12533 on: January 05, 2011, 02:55:19 PM

Gah.  A bit of code is driving me nuts.  Fancy PHP to form a string out three (or less) fields in a row then repeat if necessary:

Code:
1   Ant
2   Bee
3   Cat
4   Dog
5   Egg
6   Fuck
Code:
  while ($row = mysql_fetch_object($result))
  {
    $str .= "<tr align='center'>";
    for ($x=0; $x<3 && $row = mysql_fetch_object($result); $x++)
      $str .= "<td><a href='?id=$row->name'>$row->name</a></td>";
    $str .= "</tr>\n";
  }

What I think it should do is the while statement evaluates the first fetch.  If it finds something the first pass through the for loop should be automatic.  Two more passes through the for loop if there are subsequent rows to fetch.  Then it'll start over back at the while.

It's acting as if it's evaluating the second expression of the for loop in the first pass though, as it drops the first row as it is written.  So a full pass comes out as
Quote
Bee Cat Dog
Fuck

Putting a string append prior to the for loop and setting $x<2 formats the data as I want, or putting the fetch within the loop instead of the second expression condition, so I know it's making a fetch in the initial pass for some reason.  Obviously I can do to work around it, but I'm trying to understand this quirk of PHP, or to have my faulty logic explained if I've gone completely crazy.

You are blowing the initial variable setting away in your priming, er first read with the conditional in the expression…

In frameworks I have coded to chunk list items, I would have the SQL return an array of objects, then traverse it by an array function (some languages include an Enumerable/Array method to do this but it's not hard to brew up yourself) which grabs items in pairs, threes, fours, etc.…

"Should the batman kill Joker because it would save more lives?" is a fundamentally different question from "should the batman have a bunch of machineguns that go BATBATBATBATBAT because its totally cool?". ~Goumindong
Merusk
Terracotta Army
Posts: 27449

Badge Whore


Reply #12534 on: January 05, 2011, 03:00:30 PM

How the HELL does one childproof an office?  With all the blinky lights and things to yank, and boxes and bins to spill, it's a wonder I get anything done around here! 

They sell these things called "playpens" for those who can't baby gate their doors due to size.  They're really portable prisons/ cubicle trainers.  Get them ready for a life in a 5x5 cube early.

The past cannot be changed. The future is yet within your power.
Lantyssa
Terracotta Army
Posts: 20848


Reply #12535 on: January 05, 2011, 03:02:16 PM

It's 'cause I'm stupid.  I haven't used a for loop in years, oddly enough.  Expression 2 is evaluated each pass.  Do-while is what executes once unconditionally, and I read through the for-loop documentation too quickly.


Hahahaha!  I'm really good at this!
Salamok
Terracotta Army
Posts: 2803


Reply #12536 on: January 05, 2011, 03:37:48 PM

Code:
 while ($row = mysql_fetch_object($result))
  {
    $str .= "<tr align='center'>";
    for ($x=0; $x<3 && $row = mysql_fetch_object($result); $x++)
      $str .= "<td><a href='?id=$row->name'>$row->name</a></td>";
    $str .= "</tr>\n";
  }
you shouldn't read the contents of row in both loops, you are advancing the row pointer in the while then doing it again in the for.  Ditch the for loop and add a manual $row_count variable in the while, then toss in a mod 3 check to see if you need a row break
Code:
if ($row_count % 3 == 0) //do some wrapping shit here.
then again there are hundreds of ways to skin this cat.

edit: basically you are advancing the pointer on the while and doing nothing with the result, then doing the 4 loop 3x and doing something with that result, then hitting the while loop 1x and doing nothing with it, so every 4th row is getting ditched or somesuch.

edit2: something like -
Code:
 $row_count=0;
 while ($row = mysql_fetch_object($result))
  {
    if ($row_count % 3 == 0) $str .= "<tr align='center'>";
    $row_count++;
    $str .= "<td><a href='?id=$row->name'>$row->name</a></td>";
    if ($row_count % 3 == 0) $str .= "</tr>\n";
  }
  if ($row_count % 3 != 0) $str .= "</tr>\n";
« Last Edit: January 05, 2011, 04:01:26 PM by Salamok »
rattran
Moderator
Posts: 4258

Unreasonable


Reply #12537 on: January 05, 2011, 03:47:47 PM

I've found that if I drink more than 12 cups of coffee in a day, I get twitchy and irritable.

This also happens if I drink less than 4 cups of coffee in a day.
MuffinMan
Terracotta Army
Posts: 1789


Reply #12538 on: January 05, 2011, 04:02:38 PM

I've cut out caffeine the past week and I'm starting to feel like a normal human again. It sucks that I started eating healthy and exercising again right before the 1st because now it looks like it was a New Years resolution. It's actually because my high blood pressure is making me afraid I'm going to die.  ACK!

I'm very mysterious when I'm inside you.
Nebu
Terracotta Army
Posts: 17613


Reply #12539 on: January 05, 2011, 04:31:32 PM

I'm on a 1200 Calorie a day cut phase.

Wake up, run 3 miles, work 4 hours, lift for an hour, work 6 more hours, 30 mins on the bike, and get ready for bed.  Eating only 1200 Cal makes me feel freaking tired all the time.  I hate it.   To say that I'm irritable would be an understatement. 

"Always do what is right. It will gratify half of mankind and astound the other."

-  Mark Twain
Ingmar
Terracotta Army
Posts: 19280

Auto Assault Affectionado


Reply #12540 on: January 05, 2011, 05:12:24 PM

Now is the best possible time for you to try a new MMO.

The Transcendent One: AH... THE ROGUE CONSTRUCT.
Nordom: Sense of closure: imminent.
Cyrrex
Terracotta Army
Posts: 10603


Reply #12541 on: January 06, 2011, 05:31:16 AM

I'm on a 1200 Calorie a day cut phase.

Wake up, run 3 miles, work 4 hours, lift for an hour, work 6 more hours, 30 mins on the bike, and get ready for bed.  Eating only 1200 Cal makes me feel freaking tired all the time.  I hate it.   To say that I'm irritable would be an understatement. 

I've been doing something similar over the last three or four weeks, so I feel ya.  Cutting phase no likey.  I'm not so much tired (I get more energy the more cardio I do), but god dammit I am hungry.  And the worse thing about cutting is that I feel like such a pussy in the weight room.  Everything feels so damn heavy all of a sudden.

"...maybe if you cleaned the piss out of the sunny d bottles under your desks and returned em, you could upgrade you vid cards, fucken lusers.." - Grunk
Oban
Terracotta Army
Posts: 4662


Reply #12542 on: January 06, 2011, 06:01:20 AM

Apple's App Store just launched.  One less reason to have a cd/dvd drive I guess.



Palin 2012 : Let's go out with a bang!
Yegolev
Moderator
Posts: 24440

2/10 WOULD NOT INGEST


WWW
Reply #12543 on: January 06, 2011, 07:29:16 AM

I see Salamok referred to a "for loop" as a "4 loop".  That's 1337.

Why am I homeless?  Why do all you motherfuckers need homes is the real question.
They called it The Prayer, its answer was law
Mommy come back 'cause the water's all gone
Paelos
Contributor
Posts: 27075

Error 404: Title not found.


Reply #12544 on: January 06, 2011, 07:32:07 AM

I see Salamok referred to a "for loop" as a "4 loop".  That's 1337.

Quit picking the on kids and have a sandwich, you grumpy bastard.

EDIT: Oh no wait, that's Nebu who's grumpy and not eating. Have a cookie, then.
« Last Edit: January 06, 2011, 07:34:14 AM by Paelos »

CPA, CFO, Sports Fan, Game when I have the time
Yegolev
Moderator
Posts: 24440

2/10 WOULD NOT INGEST


WWW
Reply #12545 on: January 06, 2011, 07:56:01 AM

I am also looking to eat more healthy.

Why am I homeless?  Why do all you motherfuckers need homes is the real question.
They called it The Prayer, its answer was law
Mommy come back 'cause the water's all gone
Salamok
Terracotta Army
Posts: 2803


Reply #12546 on: January 06, 2011, 08:06:21 AM

I see Salamok referred to a "for loop" as a "4 loop".  That's 1337.
I suppose I can call it whatever F I want when the solution works.  Feel free to dump a load of crap on me if I ever come here asking for teh infoz on how to fix mah 4 loop though.  Tbh I was a bit tired and did not actually intend to use 4 in place of for, but help is help so who really gives a crap.
Samwise
Moderator
Posts: 19324

sentient yeast infection


WWW
Reply #12547 on: January 06, 2011, 09:26:00 AM

I've been eating sufficiently healthily for the past half a year that in addition to dropping something like 45 pounds my LDL has gone from 148 to 100 (as my FB friends already know because the first thing I did was brag about it on there like a dork).  

I think my New Year's resolution is going to be to have dinner at the House of Prime Rib to celebrate.   DRILLING AND MANLINESS
RhyssaFireheart
Terracotta Army
Posts: 3525


WWW
Reply #12548 on: January 06, 2011, 09:56:58 AM

I am also looking to eat more healthy.
Same.

This year is my "improve myself" year.  Can't stand the weight any longer, can't stand the little niggling issues like no energy, aches, pains, not sleeping properly.  My first step was to start keeping a food journal (I use an online site called FitDay.com to keep track of different information) because I never thought I ate particularly bad, just didn't eat well.  It's illuminating to look at a list of what I've eaten for a particular day and realize how much I do/don't eat.

Next step is to start adding exercise into the mix, now that we've gotten the gym membership straightened out again.

NowhereMan
Terracotta Army
Posts: 7353


Reply #12549 on: January 06, 2011, 10:41:40 AM

I'm still all cry because my stupid foot hasn't healed up enough to go running yet. It's been about 7 weeks, thought it was better and ran on Sunday. Took it easy but it was starting to hurt too much for me to want to risk really making it worse about 6k in. Back to icing and resting it but almost getting a proper run just reminded me how much I've gotten to like running and I was bummed out I had to finish by walking home. On the bright side I'm now into week 10 (with 2 weeks off, so week 9 was back before Christmas) of that Something Awful modified Starting Strength programme. Goddamn my legs and general body hurt for the last few days getting back into it. Still need to take a better look at my diet at some point though, it's not horrible as long as I watch my alcohol intake but I'd probably some much quicker progress if I actually spent a while being stricter with myself.

However I don't think I want to do anything that makes me feel weaker than I already am in the gym.

"Look at my car. Do you think that was bought with the earnest love of geeks?" - HaemishM
Merusk
Terracotta Army
Posts: 27449

Badge Whore


Reply #12550 on: January 06, 2011, 10:44:52 AM

Fuck eating healthy, I'm jobless again.  Time to drink.  Hello Johnny Walker Black.

Really though, as I was beginning to loathe my job and the creepy coworker who stalked people on Facebook I see this as an opportunity to do something else.  If you know anyone who needs a CAD Manager or intern Architect (I really should take that exam but.. $1400..)  I'm willing to relocate.

The past cannot be changed. The future is yet within your power.
WayAbvPar
Moderator
Posts: 19270


Reply #12551 on: January 06, 2011, 10:57:42 AM

Fuck eating healthy, I'm jobless again.  Time to drink.  Hello Johnny Walker Black.

Really though, as I was beginning to loathe my job and the creepy coworker who stalked people on Facebook I see this as an opportunity to do something else.  If you know anyone who needs a CAD Manager or intern Architect (I really should take that exam but.. $1400..)  I'm willing to relocate.

It seemed over the past year or two you were getting more and more miserable there, so this is probably a blessing in disguise. Maybe you should run for Congress! Your state could really use an upgrade.

When speaking of the MMOG industry, the glass may be half full, but it's full of urine. HaemishM

Always wear clean underwear because you never know when a Tory Government is going to fuck you.- Ironwood

Libertarians make fun of everyone because they can't see beyond the event horizons of their own assholes Surlyboi
Merusk
Terracotta Army
Posts: 27449

Badge Whore


Reply #12552 on: January 06, 2011, 11:10:05 AM

I was less than pleased with the direction (or rather, lack thereof) and decision making abilities of my new corporate overlords.  16th largest builder in the country, but I'll be damned if they could make a decision or find their ass with both hands a lot of the time.  Too much corporate bullshit and ass-covering, not enough decision making and leadership.  I've had corporate jobs before but it was the worst of them on the organization side and combined with the c.a. 1999 technology policies* I was just getting miserable.

*We have to swap a backup tape out ourselves? Really?  No migration policy for moving off of XP, i.e. 5 or Office 2001 and no plans to do so in the next 5 years?  awesome, for real  I'm the only guy offering support for Autodesk Products for 3 divisions, but I'm blocked from reading the sites that give me info because they're web boards? Nice.  The real kicker was searching for info on some gypsum board and having THAT manufacturer's site blocked as porn.

The past cannot be changed. The future is yet within your power.
rattran
Moderator
Posts: 4258

Unreasonable


Reply #12553 on: January 06, 2011, 11:43:07 AM

One of my friends works for a major insurance company here doing internal tech support, and they have monster.com and several other job sites blocked as 'porn'
Oban
Terracotta Army
Posts: 4662


Reply #12554 on: January 06, 2011, 11:57:23 AM

Job pron.

Palin 2012 : Let's go out with a bang!
Lantyssa
Terracotta Army
Posts: 20848


Reply #12555 on: January 06, 2011, 12:03:02 PM

Tbh I was a bit tired and did not actually intend to use 4 in place of for, but help is help so who really gives a crap.
Speaking of, once I got out of my coding daze/tooth pain distraction/embarrassing memory lapse and remembered how the evaluation conditions work in a for loop, I changed it up to a do-while with the for loop inside.  A check if $row is not zero in the do-while and it works nice and neatly.

I originally did use mod with the table row tags, but it wasn't as elegant, which was part of the prompt to rewrite it in the first place.

Hahahaha!  I'm really good at this!
Ingmar
Terracotta Army
Posts: 19280

Auto Assault Affectionado


Reply #12556 on: January 07, 2011, 03:46:00 PM

Company just announced our Friday beer party things are going down to 1/month.  Heartbreak

The Transcendent One: AH... THE ROGUE CONSTRUCT.
Nordom: Sense of closure: imminent.
Oban
Terracotta Army
Posts: 4662


Reply #12557 on: January 07, 2011, 04:18:29 PM

I have to go back to work next week.   ACK!

Palin 2012 : Let's go out with a bang!
Lantyssa
Terracotta Army
Posts: 20848


Reply #12558 on: January 08, 2011, 06:00:35 AM

Two wisdom teeth out and I couldn't keep anything down long enough all yesterday to take pain pills. cry

Hahahaha!  I'm really good at this!
bhodi
Moderator
Posts: 6817

No lie.


Reply #12559 on: January 08, 2011, 07:42:48 AM

Two wisdom teeth out and I couldn't keep anything down long enough all yesterday to take pain pills. cry
Yikes! That really sucks :(

As a note, get yourself a waterpik. Use it on low. It really helps with where the teeth used to be, getting all that food crud out of there.

Then use it afterwards because waterpiks are awesome. I love mine.
Selby
Terracotta Army
Posts: 2963


Reply #12560 on: January 08, 2011, 07:52:29 AM

Two wisdom teeth out and I couldn't keep anything down long enough all yesterday to take pain pills. cry
I had the same problem.  Mine was related to the pain pills though (made me sick) so food was out of the question.  I had to endure on ibuprofen alone (my surgeon said he was amazed that someone would do that).
Lantyssa
Terracotta Army
Posts: 20848


Reply #12561 on: January 08, 2011, 08:46:17 AM

I'm not sure if it was the pain or the ambien that made it so I couldn't eat.  Had half a cup of pudding this morning, took my pills, then made myself go back to bed when I was feeling a little quesy.  For whatever reason I wasn't retching when asleep yesterday, I had just hit a point where I couldn't sleep any more.  Seems to have worked since I finished off the other half of the pudding and no reaction so far.

Hahahaha!  I'm really good at this!
Engels
Terracotta Army
Posts: 9029

inflicts shingles.


Reply #12562 on: January 08, 2011, 08:50:31 AM

If its any consolation Lantyssa, I have to get oral surgery myself. They're gonna lift the gums on the front teeth, go in with a bone drill, make a hole, clean out an infection at the base of a tooth's dead root canal, then squirt cement in there, then stitch it up. Oh, and did I mention that its just local anesthetic? I'm so excited!

In any event, I hope you're feeling marginally better today.

I should get back to nature, too.  You know, like going to a shop for groceries instead of the computer.  Maybe a condo in the woods that doesn't even have a health club or restaurant attached.  Buy a car with only two cup holders or something. -Signe

I LIKE being bounced around by Tonkors. - Lantyssa

Babies shooting themselves in the head is the state bird of West Virginia. - schild
Nebu
Terracotta Army
Posts: 17613


Reply #12563 on: January 08, 2011, 08:51:47 AM

Two wisdom teeth out and I couldn't keep anything down long enough all yesterday to take pain pills. cry

That's likely due to the anesthetic used during extraction.  It will get better. 

Hope you're feeling better. 

"Always do what is right. It will gratify half of mankind and astound the other."

-  Mark Twain
IainC
Developers
Posts: 6538

Wargaming.net


WWW
Reply #12564 on: January 08, 2011, 08:58:56 AM

When I had mine out, the cocktail of anaesthetics, anti-inflammatories, antibiotics and painkillers made me feel decidedly rancid. Mine did not come out easily and I had to have my gums opened up for a good distance. Originally the dentist thought he'd have to break my jaw to get them out but thankfully this wasn't necessary. It gets better after a day or so.

- And in stranger Iains, even Death may die -

SerialForeigner Photography.
Pages: 1 ... 357 358 [359] 360 361 ... 1141 Go Up Print 
f13.net  |  f13.net General Forums  |  General Discussion  |  Serious Business  |  Topic: Useless Conversation  
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC