Jump to content


Photo

In Which I Let On That I Don't Understand Joins


  • Please log in to reply
60 replies to this topic

#41 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 09 February 2012 - 10:24 PM

So then where do I put <?php session_start() ?> ? It's saying 'headers already sent'.
I put it in the only place that made it work, which was before doctype, but then firefox ignores the height stuff again.

sum day ill eat ur cat ricko...


#42 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 09 February 2012 - 10:41 PM

Yeah, that's where the php should go (as long as you don't echo anything). As far as firefox is concerned, check if it supports that. As I said, it's a CSS3 thing so it may not be supported yet.

#43 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 09 February 2012 - 11:16 PM

Oi, I have crawled all over Google to try to get any answer on this. Not a single person seems to be having the same problem as I am. "Oh, background image height, right? Do this." "Oh, padding and margin, right? Do this." "Oh you mean this one thing that works in firefox but not in IE?" "Oh, you're from six years ago? Oh wait, eight years?"
:(

Overflow-y definitely works in Firefox.
I think that leaves this as the problem...: I have two divs, content and chat. Content is 60% and chat is 40%. Chat has three divs. The first and the third are display:table-rows and the second is height:100%, which should stretch to take up all available vertical space, which it does.
The problem is that when the content of this div exceeds the space available, the div stretches, and the entire document gets a scrollbar so that you have to scroll down the whole page to see the lines of chat which have run off the bottom edge, and beyond that for the shunted chat input field.
I've tried max-height:100%, that doesn't work.

sum day ill eat ur cat ricko...


#44 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 10 February 2012 - 11:42 PM

Why are you using display:table-row on something that is not a table row? Div's should be either display:block or display:none. You can make them inline, but you might as well use a span. What exactly do you want to accomplish? Make a diagram and I can make you cross-browser code to do it. :)

#45 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 11 February 2012 - 12:03 AM

I saw you in chat, mister poop butts!

Okay, like this: http://caseyweederma...date=2012-01-30
Only without the stuff spilling out the bottom.
100% window{
 60% top{
  n pixels : menu bar at the top
  expand to fill the remaining of the 60% but not exceed it : everything else going on there
 }
 40% bottom{
  n pixels : bar at the top for channel tabs
  expand to fill the remaining of the 40% but not exceed it and especially not push the bottom textarea off the page causing ugly scrolling : div for lines of chat
  n pixels (always on the bottom edge of the page) : textarea for chat input
 }
}

I had display:table and table-row so that these things will line up. I had a bugger of a time trying to make that chat input bar hug the bottom edge of the screen.

sum day ill eat ur cat ricko...


#46 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 12 February 2012 - 04:47 PM

Ok, after a bunch of fiddling, I think this is what you want:
<!DOCTYPE html>
<html>
	<head>
		<title>Test</title>
		<style type="text/css">
			html, body {width:100%; height:100%; margin:0; padding:0; }
			
			#top,#bottom {
				margin:0;
				overflow:hidden;
				position:relative;
			}
			#top {
				height:60%;
				background:red;
			}
			#bottom {
				height:40%;
				background:blue;
			}
			
			#topmenu {
				position:absolute;
				top:0;
				left:0;
				height:40px;
				width:100%;
				background:green;
			}
			#topcontent {
				position:absolute;
				top:40px;/* Height of menu bar */
				left:0;
				right:0;
				bottom:0;
				background:yellow;
				overflow-x:hidden;
				overflow-y:auto;
			}
			
			#bottopmenu {
				height:30px;
				width:100%;
				position:absolute;
				top:0;
				background:orange;
			}
			#botcontainer {
				position:absolute;
				top:30px;/* Height of top menu bar */
				left:0;
				right:0;
				bottom:0;
			}
			#botcontent {
				position:absolute;
				top:0;
				left:0;
				right:0;
				bottom:20px;/* Height of bottom bar */
				background:teal;
				overflow-x:hidden;
				overflow-y:auto;
			}
			#botchat {
				position:absolute;
				bottom:0;
				width:100%;
				height:20px;
			}
			#botchat input {
				width:100%;
				height:20px;
				border:0;
			}
		</style>
	</head>
	<body>
		<div id="top">
			<div id="topmenu">[ Item 1 ] | [ Item 2 ] | [ Item 3 ]</div>
			<div id="topcontent">daa<br />dab<br />dac<br />dad<br />dae<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da</div>
		</div>
		<div id="bottom">
			<div id="bottopmenu">[ Item 1 ] | [ Item 2 ] | [ Item 3 ]</div>
			<div id="botcontainer">
				<div id="botcontent">daa<br />dab<br />dac<br />dad<br />dae<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da<br />da</div>
				<div id="botchat"><input type="text" /></div>
			</div>
		</div>
	</body>
</html>


#47 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 12 February 2012 - 08:08 PM

Yeah, that's perfect! Weird, I messed around with position:absolute and it just made things cover other things and wasn't very pretty.
Thanks!

sum day ill eat ur cat ricko...


#48 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 12 February 2012 - 09:42 PM

Yeah, absolute positioning has certain considerations that you have to take into account when you use it but I'm glad it's what you wanted. :)

#49 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 12 February 2012 - 10:57 PM

It looks great in Firefox, but now chat is running down behind the chat input box in Chrome. #chat is ignoring its bottom, despite being absolute. I'll figure it out...
Oh, and what was that thing you said about changing the mail icon by swapping styles? Is there a style for image source?

sum day ill eat ur cat ricko...


#50 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 14 February 2012 - 12:23 PM

Note that if you use that absolute positioning trick with setting some sides to zero, you cannot have two opposite sides with non-zero values. For example, if you have:
top:10px;
left:10px;
then bottom and right must be zero or it breaks (at least it did in my tests).

Regarding the icon, this is how I would do it:
  • Get both of your icons in the same image. It should be like this: |inactive |active | (Note that the individual images should be equally sized.)
  • Give an ID to your icon div/span.
  • Using the ID in your CSS, set it to display:block (important if you want it not to ignore the width and height) and set the width and height to the width and height of an icon (not the full image with both icons, just the size of one icon).
  • Set the background CSS style like so: background:url('path/to/image.png') 0 0 no-repeat; (0 0 means at position (0,0), this basically shows the first icon)
  • Add a new CSS class called something like .mailhighlight and only set this CSS property: background-position:100% 0; (Note: it may be -100%, I don't remember exactly)
  • Now, when you want to highlight it, just give the div that class!
Easy peasy. :)

Also, this is how you use "sprites" in CSS. You can chock a single image full of all the little icons and then just use background positioning and CSS classes to apply them at different spots on the site. This means that, rather than requesting and loading many small images, you just load one. :)

#51 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 16 February 2012 - 11:57 PM

Sweet! I haven't quite gotten to that, but I will definitely be referring to your post the next time I add some icons and redo the mail image.
I'm very confused now, though, because chat will sometimes duplicate lines a whole bunch on the client side, and every time I think I've fixed it it pops up from another direction. Confusing!


ALSO WHAT THE HECK TRIPLE ESCAPING

sum day ill eat ur cat ricko...


#52 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 23 February 2012 - 11:55 PM

Here's a quick primer on escaping in php: http://www.homeandle...php/php7p7.html

Now, when you put stuff into the database, you also have to escape it to prevent SQL injection type attacks.

Let's say you have string: $temp = "this \"is\" a test";
Now, that already has its double quotes escaped, but what if you escape it again? It will become: $temp = "this \\\"is\\\" a test";
Oops, now you've double escaped it. Now, php has a built in feature called magic quotes that automatically escapes strings for you. It may or may not be enabled in some servers so you have to make sure that, before you escape your sql strings, you ensure that they haven't already been escaped or you'll be double escaping them.

Check out this link to see how to check whether magic quotes is turned on.

If it is and you're using $_POST variables without stripping the slashes, you'll be finding you have escaped strings in the database, which you don't want.

#53 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 19 March 2012 - 06:40 PM

Nice, did cpanel just get updated?
Thanks for the advice on escaping. I haven't gotten around to it yet but that doesn't mean I don't appreciate it. It means I'm scatterbrained and very susceptible to distraction.
Ooh! Rewrite combat! Yeah!

sum day ill eat ur cat ricko...


#54 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 04 April 2012 - 10:06 AM

I'm back! I finally got into using Mercurial (and developing on something that is not the live and running game).
I have a question!
My model is to write to a file and upload that to the server, which probably isn't running Mercurial.
If the server isn't running Mercurial, how do I merge the projects?
I guess, is there a way to track all commits since the last... I dunno, upload? The changelog isn't showing me individual files, but I assume what I'd do is look at a list of files changed and just upload those.
It's a workflow question then!
Oh. Or, can I 'push' all the changes to the server? Can I set that up to upload via ftp?
Or! Or can Mercurial just be installed on the server? :P

Okay, I think I've got it. I'll wait to commit until I've successfully uploaded all of the files shown in an hg diff. Then I'll commit so that the next time I run a diff it'll only show the changes made since the last upload.
Hm, that's not so satisfying for local version control. I can't just revert back a couple changes if it's been two weeks since I've committed anything.

Oh! Clones! I can have a stable build and a development build and wait, wouldn't a merge just... No, that might work, I think.

sum day ill eat ur cat ricko...


#55 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 05 April 2012 - 03:01 PM

Well, the way I use it on client sites at work is this:

  • I have my development directory in, say, webroot/site1
  • This maps to http://localhost/site1
  • I do my development there -- Editing. Testing. Committing as much as necessary.
  • When I'm ready to post the changes, I:
    • Commit everything that's changed.
    • Run a handy script I made which copies the files to the live website folder (which is a mapped drive).
      • The script updates all files in the folder with the latest files I have in my repo.
  • That's it!

The contents of the script (in batch format, you'll have to convert it to bash and add the ftp bit):
hg archive W:\site1\
del W:\site1\.hg_archival.txt
pause

The first line uses the mercurial "archive" command to create a version of the repo at it's current state but without the extra mercurial files/folders.
That was a bit of a lie, it creates one file called .hg_archival.txt. The second line removes this.
The third line just holds the window for input so I can see that everything went well.


So, what I think you should do is use this process and modify the script to:
  • Archive to a temp directory
  • FTP the files to the site while overwriting
  • Delete the temp directory or its contents
The site is probably small enough that it won't be a problem re-uploading everything. Especially since you'll only be doing it once in a while when you want to push updates.

#56 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 10 June 2012 - 10:40 PM

Sweet. I've got a setup I really enjoy.
Now I'm finally getting to the double- and triple-escaping bit, and dang, do I ever resent magic_quotes.
I tried disabling it in .htaccess, but that just took the whole site down (500 Server Error), and using stripslashes while pulling things out of the database just isn't working for some reason.
I guess there's no way to change that from this end, eh?
Edit: I wrestled it into submission and now it is stripping slashes as things are pulled out of the database. Magic quotes are laaaame.
Second edit: Wait, why should I even need to do this if I'm using prepared statements? Do magic quotes affect prepared statements too? Blah.

The project is coming along really well. Kickpuncher is finally feeling more and more like a game and less like an abstract non-sequence of concepts. It feels really good. Thanks for all your help.

sum day ill eat ur cat ricko...


#57 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 13 June 2012 - 02:30 PM

500 internal server error's are generic errors for when things go wrong. Typically this means you typed something wrong in the .htaccess or gave bad permissions to a file. If the .htaccess code I sent you isn't working, try looking for a php.ini file in your FTP root (above public_html). Here's info on how to disable them in php.ini. Also, apparently they're removed as of php 5.4. Woo hoo! I've also read that you can add a php.ini file to the directory you're running scripts in (doesn't propagate to sub-directories) to modify some settings. I haven't verified this but it's worth a try.

With the double escaping, keep in mind that using prepared statements escapes things for you so if magic quotes works on something going INTO the db in a prepared statement, it's going to escape the quotes put in by magic quotes. Then, when you pull them out, you'll get the magic quotes quotes in your string. It's really unclear and frustrating, I know. :P

If you want to skype while your deving just send me a message. I'm usually on at least to text chat.

#58 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 11 January 2013 - 12:22 PM

Help heeeeelp.

I forget my password. >.<


sum day ill eat ur cat ricko...


#59 Drackir

Drackir

    Admin/Project Leader

  • Admin
  • PipPipPipPip
  • 1,519 posts
  • Gender:Male
  • Location:Canada

Posted 16 January 2013 - 11:50 PM

For what? Message me on skype or email me or something. :)



#60 Caseyweederman

Caseyweederman

    Moderator/Corridors of Time Admin

  • Admin
  • PipPipPipPip
  • 1,147 posts
  • Gender:Male

Posted 23 January 2013 - 02:35 PM

For punchlands!

Also I need to fix Skype.


sum day ill eat ur cat ricko...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users