beatgammit
Members-
Content Count
84 -
Joined
-
Last visited
Everything posted by beatgammit
-
Firefox Inventing Its Own Html?
beatgammit replied to Bảo Tuấn's topic in Websites and Web Designing
Firefox does not use a different kind of HTML (HTML is universal among all browsers), but it does have a different method of displaying HTML pages. Firefox uses a rendering engine called Gecko, created by Netscape, that renders HTML according to strict rendering standards. IE ignores these standards, letting incorrect, and possibly harmful, HTML and JavaScript "code" to be rendered. One such example is the document.all property in JavaScript. I was trying to include a simple timer on my web page depending on the pendule of the document. I copied the source from a web site and it worked fine on IE, but it got all messed up with Firefox. I changed one of the properties to "document.all" and it worked fine.In fine, Firefox renders web pages more exactly than IE does. IE spawned "bad" HTML, HTML that does not adhere to the standards but IE renders fine anyway.To solve your problem, go through your "code" and make sure that everything is standardized. I don't know how you have it set up, but it could be something very simple. Give an example of your code to us and we'll try to help you. -
Everything depends on what you need the programming language to do. If you need to build applications, I would go with C#, as it is easy, powerful, and integrated into Microsoft Windows environment. If you are looking more for a web interface, I would go with Flash (I don't like it, but it is the most practical) or PHP. PHP is not a programming language, but a scripting language. This means that it mainly works to format web pages based on server input and user input. From what you seem to need it for, I would stick with C#. C# is very similar to Microsoft's ASP.Net (I think it may even be the same thing), so you are covered with server stuff and independent stand-alone applications.Most programming languages are very similar, so I would just choose one that you like and learn programming through it. You can adapt to any new language pretty easily. I have experience in Java, but I have adapted my programming skills to C++, C# and even PHP. All you need to do is learn how to do programming, and then you can choose a language.If you're into online games, go with Java. Otherwise, stick with one of the other ones I have mentioned.If you want an easy, artistic way to display information on a web page, go with Flash. Flash can do most of what you need it to do, but it kind of sucks in speed compared with PHP.
-
How To Convert A Kick Into A Goal?
beatgammit replied to Tech Live's topic in Science and Technology
This is pretty cool. I always like hearing about when science and sports come together. It seems that, logically, the kicker would psychologically lean towards the bigger side, assuming that the goalie is trying to make the smaller side easier to defend. But this idea could, in fact, lead to the exact opposite results though. If the kicker knew about this, they could get accustomed to figuring out which side the goalie was slightly larger, and then kick it to the smaller side, thus outsmarting the goalie. This brings a whole new psychological element to the game, allowing the goalie to use queues other than just body language to predict where the kicker will kick to. -
Check if any of the points of one object are inside of the other object, if so, you are definitely overlapping.Check if any of the edges of one object cut across any of the edges/points of the other object. This is a little more difficult. Here are the steps of what you need to do for each edge:Find the equation for the edgePlug in the x coordinate in to the equation, then the y coordinate (basically find the points on the line that are on the same plane as the point in question). Figure out which side of the line the point in question is. If the point is "inside" of the object, there is overlap, if not, there is no overlap. Do this with every relevant point (you should be able to figure out which points are relevant depending on the type of shape).Get the next edge, and repeat.If your object could be a circle, you can do similar things, but you will only have one edge. Circles have no points, so comparing two circles is a bit challenging. You need to use some calculus-type equations to find the intercepts of the circles. If they have more than one intercept, then there is overlap, otherwise, it is just touching (which isn't technically overlapping) or isn't touching at all. The equations themselves aren't all that difficult, but may be a bit difficult to program. You should split the circles into 4 sections and then find the equations for those sections, and then compare the each equation and if they have any overlaps, then you have two overlapping circles. This is a bit difficult. I haven't done calculus for a while, so I can't supply you with anything useful.I hope this helps you!!
-
Software Copy Protection looking for ideas
beatgammit replied to mitchellmckain's topic in Programming
I think the simplest thing to do is to do a serial check on start-up. You can encode something using their computer name and a key stored in an ini file. You could have a hard-coded key in the program that "decodes" the ini key with the computer information. As long as somebody doesn't figure out the encryption algorithm, you should be safe, and you wouldn't have to worry about people using your software without registering. Since your program is probably not the highest of targets for fraud, you shouldn't have to worry too much about people hacking your algorithm. Implementation: To do this, I would convert their computer-name into a hex-representation, and then do some logarithmic function on it (choose some ridiculous base like 13 or something), and then store the result as the base. Do the reverse (an exponential function) to the key on startup, and if the result matches the computer-name, you're good to go. If not, end the program and give some insulting message box that tells them to stop trying to steal your program. This is not copy protection, but it will not allow unauthorized use of your program, so long as somebody doesn't figure out what you did. You could use some other piece of information from their computer, such as hard-drive name/serial number, or some ridiculous piece of hardware that will never change. You could also store the result into some weird base, like base 5 or base 7. Use your imagination. Anyway, hope this helps; good luck!! -
Linux Needs Windows To Run! Dugg it up on Digg
beatgammit replied to nightfox1405241487's topic in Websites and Web Designing
Sadly, I wasn't too surprised by this. I have many friends who have not used anything but Windows and thus don't believe there is any other possible way to implement a system. All they see is the GUI and assume that is the Operating System (as most Microsoft OS releases pretty much just change the GUI [well, there ARE others, but seriously, not many]). Apparently he believes that Vista is the "all-knowing high and mighty" Godlike operating system to come and save all mankind.This is part of a bigger trend, which I will term as Micro-ignorant. They believe that Microsoft was the "original" OS, even though Apple beat them to the GUI and IBM gave Microsoft their start, and that nothing can exist except it runs off of the original. They believe that there is only one way to create a "basic" operating system, and that everything must necessarily run off of it. This is analogous to a house; they would believe that the structure of every house is the same, but the placement of the walls and the color theme are the only thing that changes, just like an OS internal (same structure, different interface). The Unix kernel runs on completely different terms than Microsoft's kernel. Pretty much any semi-knowledgeable programmer can rebuild their kernel, and change some minute things in it, but not many can build the whole system from the ground up.Even the fundamental goal of Unix is starkly different from that of Microsoft's. Unix was built as a networking machine, allowing software to be shared across a network ridiculously easily, while Microsoft requires software to be installed on each individual system. Unix innately supports the workspace environment, where people can access their own user-profile anywhere within the work environment, while Microsoft's Windows was built as a personal system, in which multiple users across a network is a little more difficult, and draws everything from a repository. Windows server is trying to change this, but Windows just isn't built for it.Every Unix user would gag at the thought of using Microsoft's kernels in a Unix environment- there is this little thing called self-respect (no offense Microsoft). Unix programmers are constantly searching for the "best" system, the one that runs the best and best integrates open-source software into its environment, while producing maximum protection and hopefully a decent end-user environment (the end-user environment isn't the most important though). Microsoft, on the other hand, wants to make their OS as easy to use, thus reducing security of the system.Hopefully this kid will grow up and stop reading conspiracy theory websites and propaganda from mindless Microsoft proponents. -
Sorting- Using Java Language First of all, why the heck should I care about sorting? Easier to present data- it is very frustrating to be looking for some information and it is not in order Faster searching algorithms- most searching algorithms require looking at every element in a list until the requested one is found, but if it is sorted, you can use binary search (I'll explain in another tutorial) to drastically cut search time Less memory for searching- there ARE ways to increase search time in unsorted lists (with indexing and such), but these take much more memory than just keeping a list sorted, and memory is precious in web-user interfaces Can't I just use the ones given to me? I see some structures already inherently support sorting. Simply put, no. If you are considering using a TreeSet or something, it would need to sort every time you added something. This is not a problem if you only add one every once in a while, but sorting a random array takes quite a while. Even if these algorithms were fast, creating your own code is always much faster, and you can tweak the code yourself to make it even faster if you need it to. The Arrays.sort method is quite fast (faster than any algorithm that you could devise), but not every programming language has the equivalent. Why do I care if my sorting algorithms are fast? My Computer Science teacher told me that if your website takes more than four seconds to load, you have lost business; customers will move to another website with the same content and you lose advertising dollars (or, if your service has no advertising, bragging rights). A sorted list allows for faster presentation of data to the user. Alright, you convinced me. How do I do it? There are many different methods for sorting- insertion sort, bubble sort, merge sort, shell sort, quick sort, etc. Insertion sort creates a new array/list and stores the original values in order. This can be quite time consuming; if an element must go to the beginning of the new list, the rest of the elements must be moved down, requiring a lot of processing power. Bubble sort starts at the beginning of the array and moves a value until all of the values before it are smaller than it, bouncing the value until it finds its correct location. This is also very time consuming. There are a few other sorting algorithms, but I am only going to talk about shell, merge, and quick sorts. Shell Sort Shell sort was created by a very smart man by the name of Shell before computers were created to take advantage of his algorithm (1958 or 1959, I can't remember). Anyway, his algorithm was very mathematically based and is a very efficient way of sorting, although it seems to be quite arduous. This sorting algorithm is, in my own words, âjust plain sweetâ. Enough introductions, let's meet the guest of honor: Here's an example list (I just typed random numbers): 79451383 To begin, we divide the list into two: 7945 1383 We then swap every corresponding value from each side, putting the smaller values on the left and bigger values on the right: 1343 7985 We then split each group in two: 13 43 79 85 And then swap values from each group, again: 13 43 75 89 It is pretty close to being sorted, so we now do the whole list: 13345789 This may sound like it is very time, and resource, consuming, but put to tests, it nearly always beats out the âlesserâ sorts (it only looses to some of the sorts in already sorted lists and ones where maybe the last two are switched, or something extremely minor like that). In code it looks like this: void sort(int data[]) { for(int gap = data.length / 2; gap > 0; gap = gap == 2 ? 1 : (int)(gap / 2.2)){ for(int i = gap; i < data.length; i++){ short tmp = data[i]; int j = i; for(; j >= gap && tmp < data[j - gap]; j -= gap){ data[j] = data[j - gap]; } data[j] = tmp; } } return data;} Merge Sort Shell sort is pretty sexy, but it is not the fastest. Merge sort often beats it in trials. So what is it?? Merge sort takes two sorted arrays and fills a third array by inserting the lowest of both arrays into this new array. But, what if the array isn't sorted?? We have a problem, or so it seems. What we'd do is recursively build two sorted lists and then merge both of them. Here's the code: Call the recursive mergeSort routine void mergeSort(Comparable[] a ){ mergeSort(a, 0, a.length - 1);} Recursively sort the first half, then the second half, then merge them. void mergeSort(Comparable[] a, int left, int right){ if(left < right) { int center = (left + right) / 2; mergeSort(a, left, center); mergeSort(a, center + 1, right); merge(a, left, center, right); }} This is one way to implement a merge routine, you could use two arrays if you like. void merge(Comparable [] a, int left, int center, int right){ int size = right - left + 1; Comparable[] tmp = new Comparable[size]; int i = 0; int leftPos = left; int rightPos = center + 1; while(leftPos <= center && rightPos <= right) if(a[leftPos].compareTo( a[rightPos]) <= 0) tmp[i++] = a[leftPos++]; else tmp[i++] = a[rightPos++]; while(leftPos <= center) tmp[i++] = a[leftPos++]; while(rightPos <= right) tmp[i++] = a[rightPos++]; for(i = 0; i < size; i++) a[left + i] = tmp[i];} Here's a breakdown of how it works with a random list:79451383 7945 1383 79 45 13 83 7 9 4 5 1 3 8 3 79 46 13 38 4679 1338 13346789 Merge sort uses a lot of memory (3 arrays) and for this reason is generally impractical for general use. Quick Sort This is the fastest known way to sort an array and does not take up all that much memory (it uses only one array). What it does is pick a âpivotâ, an approximation to the median (the middle if the array was sorted) and move all of the numbers bigger than it to one side and all of the ones smaller than it to the other side. It keeps doing this recursively until the list is completely sorted. Here's the code: Calls the recursive quicksort method. void quicksort( Comparable [ ] a ) { quicksort( a, 0, a.length - 1 );} Sorts the first half and then the second half, according to the pivot. void quicksort( Comparable [ ] a, int low, int high ) { if( low < high ) { int pivot = partition(a, low, high); quicksort( a, low, pivot - 1 ); quicksort( a, pivot + 1, high ); }} Picks a pivot (by getting the median of three [much safer than guessing low or high]) and moves low closer to high and high closer to low and switches them when low is > pivot and high is < pivot. The pivot is moved where low and high cross int partition (Comparable[] a, int low, int high){ Comparable pivot = new Comparable(); int center = (low â high) / 2; if(a[low] < a[high]){ if(a[center] >= a[low]){ if(a[center] < a[high]{ pivot = a[center]; }else{ pivot = a[high]; } }else{ pivot = a[low]; } }else if(a[center] >= a[high]{ if(a[center] < a[low]){ pivot = a[center]; }else{ pivot = a[low]; } }else{ pivot = a[high]; } int i = low; int j = high+1; while (i < j) { do i++; while(i < j && a[ i ].compareTo(pivot) < 0 ); do j--; while(i <= j && a[ j ].compareTo(pivot) > 0 ); if (i < j) { Comparable temp = a[i]; a[i] = a[j]; a[j] = temp; } } a[low] = a[j]; a[j] = pivot; return j;} Here's the rundown of how it works with a random list of numbers (pivot is bold):79451383 low = 7; High = 3; middle = 1 31 3 45978 lows = 3,4; highs = 1,8; middle = 3,9 1 3 3 457 8 9 low = 4, high = 7, middle = 5 13345789 The example I gave kinda sucked, but that comes with the territory. When it runs most efficiently, or at least decently efficiently, it is the fastest algorithm because it breaks up the sorting into independent chunks. You are guaranteed that your pivot is in the right place because everything left of it is smaller and everything right of it is bigger, thus it is in the right place. This allows for a really efficient search of a random listâquickselect. Quick select is just quicksort except you don't partition the half that your requested value is not in. This is really helpful when searching unordered, complex data. Conclusions: These sorts are really not all that important, especially if you are using Java because Java's built-in sort runs with the fastest algorithms; if you implement Comparable, you can take advantage of this functionality. Other programming languages may not have such algorithms, so applying these sorts can drastically improve performance.
-
On Why Java Is 'c'ooler! additions / criticisms invited
beatgammit replied to shiv's topic in Programming
Good review!! I really like Java, especially the Garbage Collection part. I like to have my code managed for me-- it just seems to be the "right" way of doing things. I also really like the cross-platform capabilities of Java, where Java can be run by any machine having a Java JRE, which is nearly every operating system out there. C# is pretty cool too, but it does not have a much cross-platform capabilities as Java does. I have used C++, C#, and Java (among other programming and scripting languages) and I definitely like Java the best. I do not, however, like how Java handles XML, but I guess that's ok. I'll probably just build my own XML parser frontend. -
Scrutinize My Chess Game! Check out my coding skillz
beatgammit replied to eubanksd's topic in Programming
I took a look at your game (haven't taken a look at the source code though) and was quite impressed. I have a few suggestions to make it better: Don't allow a piece to capture the King. This is never possible in a real chess game as only a checkmate can end the game. Allow for en passant ("In passing")- a special pawn move where a pawn can capture a pawn next to it. Click here for the rules. I'm sure you've thought of this, but... don't let one side move more than once before the other side moves. You could also include a simple undo which would allow a player to take back a move within a mutually acceptable time-limit. Include ability to make timed games. Speed chess is VERY popular online, so if you include a timer that starts/stops whenever a move is made (you'd have a timer for each player), that would make the game quite seamless. Allow for multi player online. You could put a list of possible players and allow two players to play against each other. This can get quite tricky, but it would be really cool if you got it to work correctly. Make the pieces more close to the center of the square. It looks like you just made a little buffer of about 10-20 and calculated the drawing from the bottom. You should draw the pieces from the middle so the pieces are more centralized in the square. This is just a minor GUI change, but I think it is nice to have the pieces centralized (personal preference). You could also make the pawns a little bigger so that every piece is the same size. I've seen this done in many chess games. These changes are pretty easy to do, except for the multi player one (find a good Socket tutorial if you are confused). I liked your game and it seemed quite professional; just make sure that your code is professional as well. The applet took a little long to load the first time, so perhaps you should try to reduce the amount of code in the startup and build the board and all of that after it is loaded. A simple "Start Game" button would do the trick. Good work, I am impressed. -
When Democrats Win Presidency In 2008...
beatgammit replied to demolaynyc's topic in General Discussion
Alright, I guess I'm going to have to take the opposing argument. I personally like Bush; I think he has successfully led our country in this war in the Middle East and has kept our economy soaring in the process. It doesn't matter whether you think we were justified in going to war in Iraq (I have always supported the war); we are in the war, and now we have to finish it. We cannot cut-and-run; the government isn't strong enough to defend itself from the insurgents. It is getting closer, taking control in most of the recent battles, but it is not strong enough to be left alone.As for Democrats taking the Presidency, I do not think this is necessarily true. We will need a different kind of leader, but we don't necessarily need one from another party. The current package of presidential candidates seems to bode well for the Republican party:Democratic Party Hopefuls:Hilary Clinton- too liberal and will drive away the vote of the more conservative Democrats, competition with BarackBarack Obama- little experience and will have to fight to even take the black vote from HilaryAl Gore: lost his chanceJohn Edwards: doesn't standout in any facetRepublican Party Hopefuls:Mitt Romney- sure he's Mormon (I am too; controversy buys media time), but he has great experience in streamlining government and reducing debt (Massachusetts example); he appeals to the Democrats as well as RepublicansNewt Gringrich- big-wig in the Republican party, but not too well known by the general publicRudy Giuliani- too liberal for Republicans and only appeals to New York DemocratsJohn McCain- kinda shady (no evidence except someone in his "camp" attacked Romney's religion), didn't attend Republican meeting this week ("schedule conflicts")A victory for the Democrats is definitely NOT guaranteed, and not necessarily the best move for America at this point. We need to slim the government (and in the process reduce national debt), not expand the social programs it offers (which would increase the national debt without increasing taxes). I would guess that many of the moderates would vote Republican this election because of the financial status we are currently in. Social programs are nice, if money is available, and NOBODY likes taxes (except the most masochistic of Americans). Sure we pay less in taxes than nearly every country in the world, but to Americans, we are paying too much. -
Google - Better Before? google is going from good to average
beatgammit replied to Zlash's topic in Search Engines
I don't think Google is loosing its touch. These virus and spy ware sites have found out how Google does its search and have capitalized on this to bring up their page ranking. Their results are still miles ahead of its competitors, with Yahoo being the only "real" competitor in the search market. If you want specialized search, Google's customizable search is pretty good and will only get better and easier to use. As to the music and video searches, I think Google is getting a lot better; Google video now includes YouTube and, although it is blocked at my school, YouTube has a lot of content that Google video just doesn't have. Google's music search isn't all that great, but that is because it doesn't host any music. I use Yahoo to find music to listen to, sometimes. MSN, or Live now, is just a poor search engine--it has nothing that stands out about it. LiveSpaces sucks and has hardly any members; it is completely thrashed by MySpace and Facebook (Facebook is my favorite in this category). Hotmail still sucks, but at least it has more space now. I really like DogPile for finding ridiculous stuff because DogPile includes search results from each search engine, resulting in a wide selection of results from their different search algorithms. -
I have used Gmail for a long time and I will continue to call it Gmail, regardless of what they change the name to. It really wouldn't matter if they renamed their service GoogleMail, because Gmail meant that anyway; it is just an extension of the existing anagram. Google could possibly buy the rights and pay for the damages of the changing of the name of IIR's product (only 60 or so million according to the article). Google is such a massive company that they can just pay off anybody they want without too much difficulty. I hold stock in Google, but I don't think a simple change of name would matter, considering that Google can keep the domain name. I expect Google to fight this one pretty hard because they are a higher profile company than IIR and have more to loose in changing their name.
-
Introduction Last summer, I worked as an intern for a small software development company, which only had three workers, apart from myself, there everyday, with a few other workers selling their product around the country. My job was to convert the data storage methodology from binary to XML. At first, I thought that this was a waste of time because, after all, "if it ain't broke, don't fix it". This is how I approached it from the beginning, until I realized the power behind it. I started using XML for all of my pet projects at home. You may be asking, "What is XML?" or, at least, "What makes it so cool?" Thank you for asking, I'll tell you. Definition XML (extensible markup language) is actually not a language, it is more of a methodology or specification. The format is similar to HTML (hypertext markup language), so if you know HTML, you know the basic "syntax" of XML. XML is a method of standardized data storage, where data can be stored in a common format. XML, while being based on text, isn't as small in file size as binary or other forms of database management, and thus not as fast for computes, but it is very efficient for what it is. I cannot think of any other way to make a text-based data storage methodology that is more efficient as XML. The beauty of XML is the ease, and efficiency, of extracting the data. Hopefully by the end of this tutorial you will understand where I'm coming from. Basics of XML To explain the power of XML, I'll teach by example. Lets say that we are needing to store information about a musical band. To do this, we must specify the various parts of a band, which include: Name Albums Members Alright, we have the basic format of a band down now, but we must define what constitutes a member or an album. Here's a list of member attributes: Name Instrument Here is a list of album attributes: Title Date Released Tracks Alright, now we need to say what constitutes a track: Title Length Lyrics Track Number As you can see, this is a very basic definition of what constitutes a band. In a normal database, we would probably have four databases in this instance: Band database- band definitions and references to member database and album database Member database- member definitions Album database- album definition and references to track database Track database- track definitions (and possible reference to album database) It is possible to have this all in one database, but this would be pretty messy, and would require some advanced database programming scripts, or an advanced database that allowed entries with entries with entries. With XML, we can do this all in one file. I'll give you the XML file that will store this data with some values, and then we'll examine the file together. <Band name="Modest Mouse"> <Member name="Isaac Brock" instrument="Vocals/Lead Guitar" /> <Member name="Eric Judy" instrument="Bass" /> <Member name="Jeremiah Green" instrument="Percussion" /> <Album title="Good News For People Who Love Bad News" releaseDate="Apr 06, 2004"> <Track Title="The World at Large" TrackNumber="02" Length="4:31"> <Lyrics> </Lyrics> </Track> <Track Title="Float On" TrackNumber="03" Length="3:27"> <Lyrics> I backed my car into a cop-car, the other day. Well, he just drove off, sometimes life's okay. </Lyrics> </Track> </Album> <Album Title="The Moon and Antartica" ReleaseDate="Mar 09, 2000"> <Track Title="3rd Planet" TrackNumber="01" Length="3:58"> <Lyrics> The third planed is sure that they're being watched By an eye in the sky, that cannot be stopped. </Lyrics> </Track> <Track Title="Gravity Rides Everything"> <Lyrics> </Lyrics> </Track> <Track Title="Dark Center of the Universe" TrackNumber="03" Length="5:02"/> </Album></Band>If you know HTML, this may seem pretty familiar. Let's take a look at the basic format of XML. The basic building block of XML is the XML Element. An Element has Attributes. An Element starts at a '<' and ends at a '>', just like HTML tags. Between this lies the Attributes. An element follows this pattern:<NameOfElement Attribute1="Value" Attribute2="Value" Attribute3="Value"></NameOfElement> You may have noticed that in my example, the "</NameOfElement>" did not appear after some Elements. Only elements that contain other Elements need to have this closing tag, which wraps around the other elements. Instead, the methodology is to place a '/' just before the closing '>' of the Element. Now, back to the example. In the example, the first Element reads: <Band name="Modest Mouse">. The word Band is the NameOfElement in my little template, and name is the Attribute name, and "Modest Mouse" is the value of the data. All data is stored in strings, so integers must be represented as strings. This is really handy for debugging, but it does take up a bit of space. Inside of this Band Element, we find a bunch of Elements inside of it. We call these child Elements. Some of these child Elements have the same Element name. This is because these are all related. They are all of type Member or Album, and all have similar Attributes. It is possible for some to have more or less information than others, but usually they are pretty similar (it depends on the code, I'll get to that later). Let's take a look at the Album Elements. I included two of these elements, just to show that I can include as many as I want. Lets look at the first one. This has two elements, with various values in their Attributes, but they have the same Attributes. Each has a "Lyrics" Element, but none of them have any Attributes. So what good is an Element without an attribute to define the value of the Lyrics? Take a look at the second Element, trackNumber 3. Between the opening and closing tags (the <Lyrics> and the </Lyrics> tags) there is some text. This text is called "inner text". This is not an attribute, but is whatever information you want to have. Every Element can have inner text, even those with child elements. Now let's take a look at the second album. This album has three Elements. The first element has lyrics entered into it's inner text, the second node is missing the trackNumber and length Attributes, and third node has no lyrics Element. All of these Elements are valid, but probably not preferred. Everything depends on the implementation, which is my next topic. At the end of the code, we find the closing Band tag. Implementing XML- unleashing the power By now, you hopefully understand the basic structure of XML, but you probably don't understand how to implement it. Implementation of XML is the fun part. To pull the data out, we use something called XPath (I'll explain this after I explain how XML can be used). For full documentation, click here. It is quite a lengthy documentation, so I'll give you the basics that you'll need. To start using XML, you must first have some data to store. You must decide on a storage hierarchy that makes the most sense to your data (such as the Band example). Once you have a structure that you have decided on, you can then begin programming your code to use XML. Most programming languages support XML and provide you with XML parsers. An XML parser "translates" the XML into a structure that makes sense. This structure is made up of Elements, each of which has child Elements. The parser lets you "iterate" through the list and pull out the Elements. Once each Element is pulled out, you can pull out the individual Attributes and store them. Then you can get that Element's child Elements, and so on until you get all of the information you need. This seems kind of tedious if, say, you wanted all of the Tracks in a band with a length greater than three minutes. You would have to go through all of the XML data in order to get at the information you care about. This is not very efficient code. Well, you're in luck; the developers of XML foresaw this problem and developed a standard called XPath. With XPath, you can give it a "criteria" for the data that you want. As introduced in two paragraphs above, XPath is quite lengthy and arduous to learn, but I'll give you the basics. XPath is based off of strings containing patterns recognized by the XPath parser (the thing that interprets what you ask and gives you what you want). Here are some basics: Get children by Element name: Most parsers have build-in functionality like GetNodes(ElementName) and you can use XPath to get further down the hierarchy than the first level. Just make the string like a FilePath string, with the format- "Child/Child/Child", where each Child is a child of the Element above it. This will get all of the children of whom this path will work for from the current place in the XML file. Get child by Element index (or children of a specific Element index): In order to get a specific list (if you know the order of the children), you can use the format- "Child[ChildIndex]/Child[ChildIndex]/Child" etc until you get at the specific children, or child, that you want. Get children by attribute value: In order to get a child with a specific attribute, you follow similar syntax as described above for a child by index, except instead of supplying the index number, you will supply the attribute name and the value you are looking for. This follows the format- "Child[@AttributeName=Value]". The syntax for the attribute name follows syntax, '@' then the attribute name, an '=' sign, and then the "Value", where Value is the value you are looking for. This can be extended as far down the hierarchy, as far as you need, but remember, if you make your criteria too strict, you may get no results. Get the parent of the current Element: To get the parent, you can either use the XPath parser provided Element.GetParent() or something like that. If you need to go further than this, you can use '..' to go up one level, or use "../../" to go as far as you like. Get a specific attribute of the parent of this Element: To get this, XPath provides some cool functionality. Use the syntax- "../@AttributeName"- to get the parent's attribute AttributeName. Make sure to put the '@' in there. You can go as far up the hierarchy as you like. Conclusion XML is a very powerful, and standardized, method for data storage. Many large corporations are using this to simplify their data storage habits. XML is becoming increasingly popular in online data storage, especially for RSS feeds. One of the best parts about XML is that it is easy to modify and get information out of. It is also really easy to create software that can work with files in XML format. I hope you understand the power behind XML, and if you did not, it is most likely due to my inabilities of explanation, not to any shortcomings of the XML standard. There are many more things that can be done with XPath, but these are the ones that I use the most. I apologize if this tutorial was a bit confusing because this is my first tutorial. Please respond if you would like clarification on any of the topics I discussed or help with XPath. Thank you for reading my Tutorial on XML and XPath. Happy coding!!
-
I was reading an article from the newspaper talking about recent deaths in Iraq. The article started by saying that 16 Americans (I think it was 16) died in a helicopter crash in Iraq. The story went on to tell about the incident and what exactly happened in the incident. This took up 2/3 of the article. The last third mentioned that American soldiers killed over 30 insurgents and apprehended (arrested) 5 or so terrorists. The media just slid this little pro-Iraq tidbit of information in at the very end, after most people stop reading. I hate how they look for the news that supports their side of the story and focus on that. Usually they don't ignore one side, they just don't give it much clout.Similarly, have you ever heard any news about Afghanistan? News flash, we're still at WAR there!! In Afghanistan, we have established a "stable", as stable as you can get with insurgency, government and are now rebuilding schools. The insurgents no longer have support of the government or the people. The media totally ignores this whole issue under the guise that Iraq is "more interesting" or "more pertinent", but really, they are ignoring this whole issue because it does not support their view that these wars are inherently bad. Afghanistan is showing that we CAN be successful, and that we ARE being successful. Once the people of Iraq turn whole-heartedly from the insurgents, the insurgents have no more foundation, and can only attack from the outside, not the inside. Iraq will eventually become stable, as long as we get the confidence of the people (that was our downfall in Vietnam, I'm sure we learned SOMETHING from that).One of the main reasons that the media does not like the Bush administration is because he refuses to talk with them. He is not like Pres. Carter or Pres. Reagan where they had a metaphorical "love affair" with the media. He gives out only the information necessary to the media, and the media fills the void with anti-Bush "propaganda". This is also the reason why Bush's approval rating is so low. Bush does not do his job to please the people, he does his job to protect the people. The general populace does not understand the war in Iraq because they do not have all of the information. The only information they have is the information provided them by the media, which media is biased into anti-Bush/anti-Iraq war propaganda. The population is "duped" into believing that the Iraqis do not want us there, that we are losing the war, and that no Democracy is not possible. The truth, on the other hand, is that Iraqis DO want us there (we see this in the execution of Hussein), we are not losing the war (we ARE having difficulties, but that's to be expected with terrorists), and that Democracy is just beginning (every country adopting Democracy had a rocky beginning, America for example).I think that the media is biased towards the liberal point of view. I do not profess to have absolute knowledge on the subject, so I would like to hear your thoughts on the subject. Is the media run by liberals, is it neutral, or is it run by the republicans? Please explain your thoughts, I am anxious to hear about what you think.
-
I had heard about NetBeans a while ago when the earlier versions came out, but it didn't seem like that viable of a solution for my quest for a Java IDE (I used Eclipse then). I was searching for a better way to make my GUI better, when I remembered about NetBeans. I saw that it was one of the most downloaded programs on the Sun site, so I decided to give it a try. I used their form creator, and it worked really well!! I thought that it would be kind of like the C++ or Visual Basic form editors, but it wasn't. I was able to make my own "Beans", forms that I could use on forms, to better imitate what I was doing without a GUI developer. NetBeans was really easy to use and allowed for easy inclusion, or duplication, of my existing code. It made Java on the same level as C# in ease of development with the addition of the GUI developer. The Javadoc tool was amazing. It tells you what you haven't documented yet, which makes Javadocing much easier to do.I was wondering if any of you have used NetBeans. If so, what did you like about it and what did you not like about it? What do you like about other IDEs over what NetBeans offers?
-
This sounds very promising, but so did flash memory. This will probably be very expensive and will never beat out silicon in price. Since these "nanotubes" are rediculously small, they will always be expensive to produce, unless we find some new way of manufacturing rediculously small things in the future. I can see these being used in cell phones and other small devices, but not in home desktop computers. What may happen, though, is that these chips can be put into portable devices and plugged into a computer shell (with memory and ports and stuff) and act as the cpu for it, but this would be a hassle for the average user.Flash memory never replaced hard-drives because hard-drives hold more memory, are cheaper, and already have market share. I think the same thing will happen with these carbon "nanotubes". They may eventually catch on, but not for a long time, at least 10 years in my opinion.
-
Does Google Have A Sinister Ploy For Future
beatgammit replied to saneax's topic in Websites and Web Designing
There have been rumors of a Google OS. From what I have heard, Google is only using this within their own company and it will not be released to the public. This is consistent with their business model and motto, where they want to "control the world's information". A Google OS would be overkill, but if they do release one, it would not be an effort to displace Windows. Their current Google desktop is the closest that I think they will come.As for Google providing domains, this makes sense for their business model. They already offer advertising for sites, and if they offer domains, they can more effectively index, and thus advertise for, websites that they sell domains for. Google has promised that their offering Domains will not interfere with current web hosting companies. Google IS offering web hosting, but that is not a huge threat to other web hosting companies geared to their customers.As for the "sinister plans", I do not think that Google is targeting ISPs. Instead, Google is only trying to provide the "best" content for their users. If the ISPs cannot offer enough bandwidth for their usage, then that is their problem, not Google's. The only way that I could think that Google is targeting ISPs is if Google were using extra, unnecessary, bandwidth so as to artificially run up bandwidth. Google's applications seem, to me, to be very band-width friendly (they shrink their images to make load times faster, transfer as little of the information to the end user as possible by doing most computing on their servers, etc). Google seems to be a very responsible company, and any "sinister plans" are just them providing more content to the end-user faster, thus the end-user is able to use more bandwidth.As for Google controlling the internet, this just sounds like a conspiracy theory. If Google was, in fact, trying to "control the internet", Microsoft, Yahoo, and other huge internet players would DEFINITELY have something to say about it. There would be many lawsuits all over the media (when a big corporation like Microsoft takes on another big corporation like Google, this is HUGE news). Since there have not been these huge lawsuits, these companies don't see a thread of the magnitude of "controlling the internet". The reason that Google just doesn't buy out other companies is the whole issue of monopoly laws. Microsoft has run into this issue many times in its history. Google cannot just "buy the internet" by buying every company that has anything to do with it because that would be seen as Google being a monopoly (as it should be). Google does not want to be a monopoly. Instead, Google just "plugs into" the internet. Google develops software and services that enhance the internet experience for the user.The reason for all of the bandwidth is that Google is trying to create a huge information bank. Google is trying to upload every book, ever, onto their services, they must support YouTube and Google Video, Gmail takes a bunch of bandwidth supplying gigs of space to their users, Picasa is growing and takes a bunch of bandwidth, etc. Google has a lot of services that require a lot of bandwidth.So, in short, Google is expanding to support the services it offers, not because it is trying to dominate the internet. I love Google, but I would turn on them once I thought they became a monopoly (I'm just a Benedict Arnold like that). -
Linux + Laptop = No No? A question for those who know..
beatgammit replied to Adwodon's topic in Websites and Web Designing
I've had several friends, and some professors, that have linux installed on their laptops without any problems. I don't know how the BIOS could get screwed up through using Linux, but if anything happens, you can "unscrew" it up with a flash overwrite (or whatever it's technically called). I would dual-boot if I were you, just so you don't get all freaked out by the switch. Keep it as a play-thing at first, and then begin to rely on it once you understand how it works, that way you won't risk getting your data screwed up (VERY BAD and VERY POSSIBLE). Once you feel comfortable with it, go for the gusto and switch cold-turkey.I would recommend getting a "hold your hand" type *nix like Ubuntu first, just to get the flavor of *nix, and then move into something deeper like Debian or BSD. -
I like Eclipse and BlueJ.Eclipse offers a smörgåsbord of features and is really powerful. It does take up a bit of memory and sometimes takes a little bit to load the first time you run it after booting up windows, but that is to be expected from a Java-based IDE.BlueJ is a simple IDE which doesn't have nearly the feature count as Eclipse, but it does have UML diagrams. The diagrams are good for seeing the correlation between classes, showing inheritance, dependence, etc. I used this during my first Java class and it worked well, and then I switched to the more powerful Eclipse.NetBeans is another option, but I haven't played with it much.TextPad is a text editing software that has some basic Java compiling and running functionality, if you want really basic, but a step up from command line.
-
MySpace This one has been long awaited
beatgammit replied to nightfox1405241487's topic in General Discussion
Yeah, I too hate MySpace. I keep mine around, but only check it when I get a message or a friend request (both of which are usually spam). I have a few friends back home (I am currently at college) who use MySpace and not Facebook. Facebook definitely wins by comparison. Facebook has a lot of stalker prevention built in where profiles cannot be seen except by being a friend (or limited profiles, whatever the user decides). Facebook also does not let the user add content like videos or scripting to their pages, thus reducing the load times and also the risk of "contracting" a virus. My roommate's computer was hosed due to MySpace profiles.MySpace is also poorly run. They try to do too much and don't try to improve their features. PureVolume wins in the music arena and Facebook wins in the networking arena. Facebook is now adding band profiles (I believe), so that may impact MySpace's dominance. MySpace has become a playground for pedophiles and stalkers. I have seen many a child-molestation program on TV where molesters found their victims through "social networking sites", which invariably means MySpace. MySpace had good intentions to start with, but their business practices got way-laid by their greed.True, it's fun to edit and customize your content on your page, but there are so many "better" ways of doing it. Have it be controlled by the "hoster" where backgrounds and css styles can be edited without letting the user add javascript functionality into their webpage. If the user wants extra content, they can add from a list of supported add-ons. This is the way social networking sites should work, and that would NOT reduce the individuality of the page; rather, it would increase security and load times of each individual page.Thus, the juries must agree, MySpace sucks. -
Google is very new to email, so they cannot be expected to be the best in everything right away. The virus scanning is just the first step. I remember the days when Yahoo blocked exe's when they first introduced virus scanning (and I am not that old, only 18). Google will, undoubtedly, add exe scanning to their Gmail service once they find a really good way to do it. They are not going to enter that arena until they have top notch virus scanning software. That is the difference between Google and other vendors. Other vendors just want to get their product out there with as many features as possible and will improve it later. Google, on the other hand, puts their products out there with a high quality standard. They may not be the most fully featured to begin with, but they improve over time (look at Google Finance or Picasa or Google homepage). Google is all about offering quality pieces of software, instead of a whole slew of less than stellar chunks. My guess is that in the next couple of years, we will see the ability to send exe's, dll's, zip's and pretty much any other format we want. As for now, I guess we must just send the source code and have the user on the other end compile it. I love Gmail above every other email client and I suspect they will continue to grow their services as time goes on.
-
Why can't you download it? You just need to burn it to a CD, and bam, you have done the same thing that they have done. Anyway, Ubuntu is a different story. I read a little background about them, and apparently some really rich guy in South Africa somewhere really wanted to create a good version of Unix that could rival Microsoft and Apple. He invested millions into a free OS (now called Ubuntu) and distributes several versions, some for Education, some for Companies, and some for Users. Anyway, he is a man on a mission, and can afford to send out CDs for free. Most other distributions of Unix are created by a coalition of part-time developers who develop on their spare time. There is no organization. This guy from Africa has a whole company type thing going, so he has the structure available to be able to distribute the CDs. In short, Ubuntu is a special case, so don't go looking too hard for another one. Only a distribution that is easily found is going to be available for free mail delivery, that's just the sad truth.
-
I have used several anti-virus programs, and I have found Panda anti-virus to be the best. I have not been impressed with McAfee. McAfee seems to use too much memory and does not do that good of a job. Norton does not seem to catch much of the new viruses. These two seem to be two of the most popular anti-virus programs. I am at school right now, and they use Symantec. They don't seem to be that bad, but they do take up a lot of memory to run. I have talked to many IT professionals, and they swear by the Panda line. I find Panda to be the best for my money.As for open-source free anti-virus programs, I don't trust them. Since they are open-source, their source can (obviously) be seen by any hacker that would ever want to get past it. I don't like the feeling of being protected by something that I am not paid for, by something that does not have highly paid, and hopefully highly competitive, software engineers producing.With anti-spy-ware, I don't bother with it much. Panda comes with a spy-ware check that seems to do a good job. Among others, Spybot is a good product. I usually clear out my temporary files periodically through my browser, so I don't have to worry that much about spy-ware.
-
OpenOffice Writer Vs Microsoft Word Which do you prefer??
beatgammit replied to beatgammit's topic in Software
Thank-you everyone for your posts so far. In my summer internship, I worked as a computer programmer for a small computer software business. While there, I discovered the beauty of standardization. With standardization, more products can work together to create a better experience for the user, which is the end goal of software, correct? Anyway, I think that OO has taken more steps to adopt a standardized way of creating and editing text files. People on other OS's, like Mac and Linux, are forced to convert between the different file formats, or pay out the wazoo for enterprise software.I like that OO has a file format that is accepted by a variety of software, like Mac and Linux, and can also save in .doc format. I know that Microsoft is adopting a more open standard, but they are trying to force everyone to use their standard instead of using the existing standard. Sure, Microsoft's office suite has more features, but it also ignores other software out there. At college I know alot of people who are forced to use a product that can read .doc files.I think OO has taken a step in the right direction. I like OO because of a "moral" point of view, not a feature point of view. If M$ were responsible, I would adopt their way of doing things, but since they make no room for other systems, I prefer OO. Both get the same job done anyway. -
I do not think this is possible. To explain why, I will have to explain what a vaccuum is. A vaccuum is any space where there exists no gasses or any other matter. A vaccuum (the commercial kind) works by creating an absence of air so objects will be sucked into it via the law of diffusion, where if there is more of one gas in one area, it will want to move into the other area to equal it out.With this definition, I do not think that creating a situation where there is no air would effectively create enough energy to power something. There must be something moving, like a chain or a rotor, inside, and I think that our current combustable engines work well enough. If there were some easier way to create a vacuum other than creating a combustion engine and then a vacuum, this might be feasable, but the creation of the vacuum would not save any energy; actually, it would probably loose more energy than just a combustion engine.