Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. You do know that whenever you have a table or column that matches a reserved word you can enclose it in back ticks (`) and continue to use the name? You'd still have to update all your queries, but at least you wouldn't have had to rename the table!
  2. Shouldn't: .td { display: table-column; } be: .td { display: table-cell; } I think I tried doing that once and ran into trouble though.
  3. Perhaps this can help explain the difference to you then. When dealing with language, whether a computer language or a spoken language, we have two concepts: syntax & semantics. Syntax Syntax defines the structure of language. Basically, syntax is the set of rules we must follow to use a language correctly. An example of a syntax rule when speaking English is that adjectives come before nouns. Example: The brown fox jumped high. The above sentence is syntactically correct because the adjective brown comes before the noun fox. Semantics Semantics are slightly more difficult to explain. I guess you can think of semantics as the implied meaning behind language elements. The best way to explain is with an extension of our example above. The microscopic fox jumped high. Again, the sentence is syntactically correct because the adjective microscopic comes before the noun fox. However, a fox can not be microscopic, so even though the sentence is syntactically correct, it is not semantically correct. Here is a programming example of semantics, taken from wikipedia: $x += $y; $x = $x + $y; Both of the above statements use a different syntax, however they both have the same meaning (semantics): add $x and $y and store the result in $x. Now I will try and tie it back to your original question: I think where you're getting confused is you are looking at this only from a syntactical standpoint. In your mind, you are doing this: Let A = table = div Let B = tr = ul Let C = td = li Then you are doing a direct substitution and coming up with this: <A><B><C>Link 1</C><C>Link 2</C></B></A> In that regard, both statements are syntactically exact. Also, it is no more difficult for a screen-reader or robot to read one than the other. Screen-readers and robots are just computer programs that parse text; it is no more or less difficult to parse a table tag than a div tag, a tr tag than a ul tag, and a td tag than a li tag. So again, in that regard, both methods are the same. To really understand how they are different and one is better than the other (for layouts), you have to examine the semantics. A table tag has a semantic meaning that tabular data is about to follow. Although you can use tables to make a layout, a layout is not tabular data. Therefore, using a table to create a layout is syntactically correct but semantically incorrect. Now if you understand everything to this point, you're thinking, "Big whoop. So what?" The importance comes into play with programs (like screen readers and robots) that examine the source markup of your website. These programs look at the tags you use and apply a semantic meaning to them. This meaning varies from program to program. A screen reader may attempt to apply a semantic meaning that makes a text-to-speech conversion more convenient for a blind person. A robot might attach a semantic meaning that affects page rank within a search engine. Take the following HTML: <div> <ul> <li> <a href="home.php">Home</a> </li> <li> <a href="about.php">About</a> </li> </ul> </div> It is pretty obvious to you and me that is a navigation menu. A robot could also examine that and determine that it is a navigation menu, simply because the author of the robot decided to make it capable of doing so. This robot may index or rate your page higher (or better) than one that places a navigation menu within a table tag. Again, this is at the whim of the person that wrote the robot. Does that help any?
  4. I'll try for a third time: Azu, do you understand what semantics are? The answer to this question has a lot of bearing on this discussion.
  5. So I just discovered sshfs; it's pretty hawt. For those that don't know what it is, it allows you to mount a remote directory to your local file system via ssh. Here's a tutorial: http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/
  6. Have you done any research into "data-driven design" or do you know what that is?
  7. Are you referring to a card game called 'cheat?' If so, never heard of it.
  8. I've never cheated. Not once. On anything. I think its pathetic when people can't float or sink by their own merits.
  9. Azu, you didn't answer the question: Do you know what semantics are?
  10. Azu, do you understand what semantics are?
  11. I think you are beyond help in understanding this Azu. If you can't understand the benefits of adding whitespace to your code, there is little hope of you seeing any benefit to this way of doing things. But I will make one last attempt via an analogy. Let's say you and I were in a room and I told you to close your eyes. Next I told you to hold out your hand so I could put a piece of candy in it. You close your eyes, hold out your hand, and I kick you in the nuts. Aside from being in pain, you'd likely be confused. "Why did he kick me in the bollocks when he said to hold out my hand?" That is how the blind person using a screen reader feels while looking at a table-based site. They are being told by the screen reader that part of the page is one thing, but then being given another. The experience for them is confusing and painful.
  12. Seriously, wtf. I think you missed the point of the "article."
  13. No. The HTML will be in one file, the Javascript in another, and the CSS in another. The browser will used cached files as long as they have not changed. So if you style your sheet you can constantly modify the content without changing the style and the browser will never have to download the style sheet (until you modify it).
  14. Azu, I'm not posting this in any way to be malicious or mean, but I just remembered a couple things about you that may explain why you're having such a hard time wrapping your head around the difference. In the "best editor" poll you said this: In the MySQL forum you posted this code: set_time_limit(120); $a0=timed_query("select `id` from `db`.`Topics`"); while($b0=mysqli_fetch_row($a0)){$q=0;$x=0; $x=mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b0[0]")); if(!$a1=timed_query("select `id` from `db`.`Topics` where `parent`=$b0[0]"))break; $q=mysqli_num_rows($a1); while($b1=mysqli_fetch_row($a1)){ if(!$a2=timed_query("select `id` from `db`.`Topics` where `parent`=$b1[0]"))break; $q=$q+mysqli_num_rows($a2); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b1[0]")); while($b2=mysqli_fetch_row($a2)){ if(!$a3=timed_query("select `id` from `db`.`Topics` where `parent`=$b2[0]"))break; $q=$q+mysqli_num_rows($a3); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b2[0]")); while($b3=mysqli_fetch_row($a3)){ if(!$a4=timed_query("select `id` from `db`.`Topics` where `parent`=$b3[0]"))break; $q=$q+mysqli_num_rows($a4); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b3[0]")); while($b4=mysqli_fetch_row($a4)){ if(!$a5=timed_query("select `id` from `db`.`Topics` where `parent`=$b4[0]"))break; $q=$q+mysqli_num_rows($a5); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b4[0]")); while($b5=mysqli_fetch_row($a5)){ if(!$a6=timed_query("select `id` from `db`.`Topics` where `parent`=$b5[0]"))break; $q=$q+mysqli_num_rows($a6); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b5[0]")); while($b5=mysqli_fetch_row($a5)){ if(!$a6=timed_query("select `id` from `db`.`Topics` where `parent`=$b5[0]"))break; $q=$q+mysqli_num_rows($a6); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b5[0]")); while($b5=mysqli_fetch_row($a5)){ if(!$a6=timed_query("select `id` from `db`.`Topics` where `parent`=$b5[0]"))break; $q=$q+mysqli_num_rows($a6); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b5[0]")); while($b5=mysqli_fetch_row($a5)){ if(!$a6=timed_query("select `id` from `db`.`Topics` where `parent`=$b5[0]"))break; $q=$q+mysqli_num_rows($a6); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b5[0]")); while($b5=mysqli_fetch_row($a5)){ if(!$a6=timed_query("select `id` from `db`.`Topics` where `parent`=$b5[0]"))break; $q=$q+mysqli_num_rows($a6); $x=$x+mysqli_result(timed_query("select count(*) from `db`.`Posts` where `question_id`=$b5[0]"));}}}}}}}}} timed_query("update `db`.`Topics` set `subs`=$q,`reply`=$x where `id`=$b0[0]");}} exit;} From an outsider looking in, organization and maintainability do not appear to be things that you concern yourself with. Separating the layout from the markup (i.e. dropping tables in favor of generic tags and using CSS to apply layout) is an organizational thing. I don't believe in God, but if I did, the first prayer I'd make is that I was never asked to maintain anything written by you.
  15. In most cases it is not. However, in the table structure, a layout is implied by the tags, which is a horizontal layout. In the div.ul.li structure, there is no implied layout; you are simply creating a division which contains an unordered list. Now, the browser will give this a vertical layout that you are free to change with appropriate CSS. For 99% of today's use that they are practically equivalent. But let's say you went with the table layout and created a horizontal navigation menu. Eventually your boss comes to you and says, "10% of our users are visiting the site through alternate browsing devices, such as PDAs and hand-helds. We are receiving numerous complaints about the way the site displays in those devices, especially the width of the menu, and are even losing customers." Now you are tasked with creating an alternate layout for the page. Since you went with the table-based design, you now have to create two separate HTML templates. Whereas if you'd gone with the div.ul.li and CSS approach, you just create an alternate CSS file to override how that one element displays (from horizontal to vertical) and append it to the page for those users. The persistent goal in programming is segregation and performing tasks through layers. Your pages should be accessing the database through a data abstraction layer. Your Javascript should not be present in your HTML. Basically, while you are certainly free to do otherwise, the "best practice" in web design is to remove formatting information from HTML and use CSS. If you are unable to buy any of the arguments for why this is the best practice, then just take it on faith and try to adhere to it. Eventually things will fall into place.
  16. Your script will continue to run even though it hasn't connected to the database. This isn't necessarily bad, but it certainly could be.
  17. I understand all of the issues with why not to use tables for layouts and I do avoid using them for non-tabular data. However, there is still one place where I use a table, and that is to make a multi-column layout. It's been a while since I've done so, but the last time I was working on it I spent quite a bit of time trying to get it to behave properly. Every time I thought I had it, it would break on some new page or in a different browser. Most of the solutions to this (at the time I was dealing with it) were to either: 1) introduce IE only CSS files 2) add extra divs to the layout to do things like clear, etc. In regards to #1, I avoid anything specific to any one browser; I refuse to entangle myself in that mess. In regards to #2, I thought the part of the point of CSS was to create cleaner markup and remove unnecessary tags, so adding an empty div simply to clear something seems silly to me. Basically, I agree that using a table to create a multi-column layout is a bad way to do things, but it takes all of 10 minutes to do and is widely supported. The CSS solution to the multi-column layout (again, at the time I was dealing with it) didn't solve any problems, it just relocated them into two different areas. I guess I'll just have to spend more time on it next time I make a layout. I know I'm going to come under fire for having posted this, but oh well. For the record, I only use the table for the multi column part of the content. My header and footers are both divs and I don't use tables anywhere else unless I'm displaying tabular data. So I'm not entirely evil!
  18. I first learned of Linux around 1999 or so and always wanted to try it out. I made several attempts in the past to get it going but always hit a block when it came to my network card. A computer without internet does me no good. Probably 80% of all my time on the computer is spent in internet-related tasks, not counting online games. So in the past I'd spend several hours trying to find drivers for my card and figuring out how to install them, but always losing patience and going back to windows; keep in mind my last real attempt was around 2001 so it was a while ago. The other major downfall of Linux in the past was the lack of gaming support. I'll be honest, I used to play lots of video games. A lot more than most of you do; I think my freshman year in college I played RA2 (a quake 2 mod) no less than 5 hours every day. Now, in the past, I would have been perfectly happy with a dual boot installation where I used Linux for computing and windows only for games. However, since I couldn't get networking to work properly in Linux, what would be the point? So like I said, I'd always go crawling back to windows. As I mentioned previously, I was on win2k at home, which meant I was pretty due for an upgrade. Between Vista and XP, I'd go with XP. However, in the grand scheme of things, I'll some day have to go to Vista or some other MS OS based on Vista. I really don't like the idea of Vista. Just look at the hardware requirements, I don't care if its an OS or not, it requires 15GB of disk space. Also you have the fact that windows is windows, over time your install becomes bloated and sluggish and you have one of two choices: re-install or use a myriad of utilities to clean it up. Looking to try new software? Hunt on Google and install 4 or 5 trial versions which won't completely uninstall and sneak other crap onto your system. We all know the drill. Anyways, as far as Linux is concerned a few things have happened to me personally that make the transition easier. The first is that I play less games; in fact I've been intentionally taking up hobbies and activities that involve me not sitting in front of a computer screen, simply because I'm tired of staring at one by the time I get home from work. So even though my CS:S is sort-of-but-not-entirely-working I don't really care; I'm not going to die if I can't play CS:S tonight. The second is that I'm not in school anymore so I don't have to worry about not having a PC at home. I don't have to worry about being able to open every file that comes my way and if I can't print something that's OK too. The third is that I'm involved in web development, which can be done on any platform. The last thing that made the conversion possible happened in the Linux community. Ubuntu has to be the easiest installation of Linux I've ever dealt with. It picked up my network card so my biggest Linux hurdle was instantly overcome. After that it informed me that it was using a standard video driver instead of the nVidia one because the nVidia driver was not open source and the community had no way of updating it; but it gave me the option of installing it, which I did. So within a few minutes I had video and network support. Now I had read about Ubuntu's apt-get utility and the praise associated with it, and I'm particularly in love with the GUI interface provided by Synaptic. This is the greatest thing ever. For those of you that don't know what it is, let me explain. You can obtain everything in Linux via source code, which you have to compile by hand; this is a major PITA for newcomers. The next step up, you can obtain pre-built binary packages and install them on your system; the downside here is packages are dependent on other packages. So if you're a newcomer you probably don't know which packages you have installed and which ones you need, with patience you can overcome this easily. However, Synaptic takes care of it all for you. For example, I wanted to install a basic LAMP server. On windows I'd probably just go with XAMPP, which I'd download from the XAMPP site. With Synaptic, I just ran a search for apache. It then lists anything and everything having to do with apache. I scroll through the list, "Ah! Here it is, the main apache2 package." I mark it for installation. A box pops up telling me that additional dependencies will be installed as well. "Sure, install those too." I click a button labeled "Apply." It starts downloading files, then it tells me its installing stuff, then it says it's done. I start FF and go to localhost, I get a page that says "It works!" I do a quick search on my system and find apache's htdocs is in my /var/www folder. I wrote a basic phpinfo() script and refreshed my browser, it prompted me to download a .php file. Ok, PHP wasn't installed, I'll have to do that. I fire Synaptic up again, search for PHP, look through the list, check off a PHP5 package, again it tells me there are dependencies, then it proceeds to download and install everything. I reload the page and yes, there it is, a phpinfo() page. I search and see that I'm missing MySQL. You guessed it, I use synaptic and within moments my phpinfo() script reports MySQL is installed. How about phpmyadmin? Ah good old synaptic. I later go to watch a DVD. I insert the disk, some movie player opens up, but reports an error in playing the DVD. Damn it! Everything was so perfect until now. A quick google search: "ubuntu 7.10 watch dvd" Numerous hits, apparently a common problem. It seems that my media player is using the gstreamer back-end and there are problems, some users suggest switching to xine and installing some libraries to watch encrypted DVDs. I fire up Synaptic again, search for xine and these libraries, selecting to install xine tells me it will uninstall gstreamer, "Sure, it didn't work anyways." Within minutes I'm watching a DVD. How about eclipse. I tried it on Windows for a bit, it's ok. It's probably my best bet at a PHP IDE in Linux. I'm hesitant since it's Java-based; Java-based programs always suffer poor performance in my Windows systems. In any case, with synaptic its easy to install or remove, so again using this wonderful tool, within minutes I have eclipse running. What's more, it appears to be blazingly fast. My fiance has been watching me intently this entire time. I've been explaining Linux to her, she has a hard time believing what she's hearing. It's free? She notices how easy it is to install stuff. We're going to move her onto it later this week. She's borderline between a basic user and an advanced user. She understands basic computing principles, such as directories, files, and programs. She's more tied to the MS world because she's an accounting major; all of her finance classes require Excel and to some extent Access. She also uses Quicken, which there is an equivalent called gnucash, but apparently it's not as nice. I figure if we can't find a Linux equivalent we'll try wine. If that doesn't work she has a second drive and we can turn her system into a dual-boot, although I don't think we'll need to. I'll report back later in the week on how the transition goes. Anyways, to make a long story longer, I think Linux is almost ready for prime-time. Keeping a Linux system up to date as well as installing new software is much, much easier than on Windows. I think 9 out of 10 windows users would want to switch instantly if they saw how easy Synaptic is to use. IMO, the folks over at Ubuntu have done a wonderful job. They're just shy of a mass conversion and here's what's missing: * Better support for dual-booting. I'm sorry but there are still too many people who can't afford to lose their PC for a few days, a week, or who can't always have the patience to figure linux out. This audience needs to know that if they can't get it to work in linux they can go back to their comfortable windows environment very easily. If the ubuntu installation program were able to resize windows partitions or if there was an easy to use, windows-based GNU utility that could do so, I think more people would be willing to risk installing Linux. * A better gaurantee that certain windows programs or files will work. Everyone uses windows at work, which means if they try linux it will be an experiment at home. But they need to have access to work files and stuff at home. It can all be done with patience and effort, but it needs to be more seemless. There's just a certain level of uncertainty about "Can I complete this project at home and then bring it back to work?" which causes fear. Of course, with better support for dual-booting this can be avoided. In addition, game companies need to make an effort to creat games that run on Linux. Ironically, gamers are probably the biggest audience that are willing to convert but don't because the one thing they require is not supported. It will be a while before this ever happens, if it happens at all. Perhaps if a distribution decided to gear itself towards gamers and make setting up their software easier more of that audience could be captured as well. On the flip side of things, MS could learn a bit from linux. If Microsoft's Windows Update also updated 3rd party software, that'd be huge. IMO, it would be wise for MS to "pull an Apple" and abandon windows in favor of a *nix core that they just develop a shell for. If I pulled any sway at MS, I'd be pointing out that MS is slowly losing market share to alternatives that they could be supporting. MS has seemingly unlimited resources, it would be interesting to see what they could accomplish if they decided to become involved in linux. In the long run I don't think any of it matters. More and more businesses are looking to web-based applications for their custom software solutions. These applications are easier to support, maintain, and deploy than stuff installed on individual workstations. In the next 20 years or so, it probably won't matter which environment you run as you'll just be doing all of your work in a web browser anyways. Also, I suspect that some of the things we complain about most in windows will start to rear their ugly heads as the linux user-base grows to accomodate non-tech-savvy users. Whew, long post!
  19. It looks like he's running a command that resizes images, probably to thumbnails. On *nix you can direct the output of the command to /dev/null and it will execute without holding up your PHP script. Although I sort of have to wonder why you'd want to do that with an image resizing command; granted there are a lot of variables but the one my application runs is very fast.
  20. Synaptic, where have you been all my life? /drool
  21. So I've been using Win2k Pro for a long time at home and WinXP at work, since it came installed on my laptop. I really don't want to use Vista and MS will eventually stop pushing updates for XP. Also, because of MS stupid "Verified Windows" crap I can't update my legitimate copy of Win2k anymore. So I finally decided, "Screw it!" I backed up all my data and posting this via a fresh install of Ubuntu. Steam is downloading CS:S so as long as that goes smoothly I don't see any reason why I'll switch back.
  22. I've been watching you! (No, I'm not Filipino.)
  23. JSON stands for Javascript Object Notation. You are correct in your understanding of it. I'll give a short example anyways. You start JSON with open curly bracket and close it with closing curly bracket. In between are property-value pairs. The property-value pairs are separated by commas. You separate a property from it's value with a colon. // This object has a single property named 'msg' with the value 'Hello!' var tmp = { msg : "Hello!" }; // This object has two properties (msg, action) with two values ('Hello!', 'Wave') var tmp = { msg : "Hello!", action : "Wave" }; // You can embed JSON in other JSON var tmp = { internalObj : { msg : "Hello!" }, msg : "Good bye!" }; alert(tmp.msg); alert(tmp.internalObj.msg); // You can even declare methods (functions) var tmp = { msg : "A message!", action : function(){ alert(this.msg); } Here is a PHP function that takes a PHP array and converts it into a JSON string. By no means is it comprehensive or fool-proof, but it works for my application. <?php /** * Array2JSObj * Convert a PHP array to a Javascript Object literal */ function Array2JSObj($arr){ $js = ""; if(is_array($arr) && ($num = count($arr))){ $js = "{"; $i = 0; foreach($arr as $key => $val){ if(is_string($val)){ $val = str_replace("\\", "\\\\", $val); $val = str_replace("\n", "\\n", $val); $val = str_replace("\"", "\\\"", $val); $val = str_replace("\r", "", $val); $val = "\"" . $val . "\""; }else if(is_bool($val)){ $val = $val ? "true" : "false"; }else if(is_null($val)){ $val = "null"; } $js .= $key . " : " . $val; if($i < $num - 1){ $js .= ","; } $i++; } $js .= "}"; }else{ $js = "alert(\"Bad PHP Array\");"; } return $js; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.