Forum Replies Created

Abhey Member

You should handle these things with only one form. Also, some error reporting is also good, so I added that for you too.

You should also add some validation of user data somewhere in there, but I will let you think about it first.

Also, proper indenting is very important for more complex codes and I suggest you to get on with it right when you start programming (if you are looking for a future in this profession, I mean).

Examine the code and if you have questions, feel free to ask.



   
      Simple Upload Form
   
   
       'The uploaded file exceeds the upload_max_filesize directive in php.ini',
         2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
         3 => 'The uploaded file was only partially uploaded',
         4 => 'No file was uploaded',
         5 => 'Missing a temporary folder',
         6 => 'Failed to write file to disk',
         7 => 'A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help',
      );
      $radio_info = array(
         'male' => 'You think you are a male.',
         'female' => 'You think you are a female.',
      );

      function get_document_root() {
          $server = $_SERVER["DOCUMENT_ROOT"];
          $last = substr($server, -1);
          $slash = $last == '/' ? '' : '/';

          return $_SERVER["DOCUMENT_ROOT"] . $slash;
      }

      if (isset($_POST['Submit'])) {
         // handle gender select
         $selected_radio = $_POST['gender'];

         if ($selected_radio == 'male') {
            $male_status = 'checked = "checked"';
         }
         if ($selected_radio == 'female') {
            $female_status = 'checked = "checked"';
         }
         echo $radio_info[$selected_radio] . '
'; // handle file upload $root = get_document_root(); $plus_path = "YOUR_UPLOAD_FOLDER/uploads/"; // edit this to your path $target_path = $root . $plus_path . basename($_FILES['uploadedfile']['name']); if ($_FILES['uploadedfile']['error'] > 0) { echo $file_errors[$_FILES['uploadedfile']['error']]; } else { if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename($_FILES['uploadedfile']['name']) . " has been uploaded."; } else { echo "There was an error uploading the file, please try again!"; } } } ?>
Choose a file to upload:
/>Male />Female
Abhey Member

Here are some tips that will help you steer yourself down the right path for graduation:

1. CHANGE. Improve your grades, immediately. You need to fix your study habits. You still have time to rebound that GPA to over a 3.00. With a C+ average is ~2.33 gpa, and on that basis alone you will be automatically rejected from major tech companies (unless you have some friends which can refer you). Don’t let this deter you from applying for internships over the summer. Although they inspect gpa’s for interns and don’t normally hire many freshmen or sophomores, exceptions are made.

2. SELF-IMPROVEMENT. You’re at one of the best points in your CS career (for starting off), as in ~2 years, you will be a brand new computer science graduate with some new programming knowledge that last year’s grads didn’t get (so they think). While you’re improving your grades, get (more) active in collegiate activities. Build your confidence and social interaction skills. At the same time, focus on yourself. What are you good at? How can you sell yourself to a recruiter? What projects have you done in which you took some key knowledge away from them?

3. FOCUS. Dont waste time making your warez site. This will take a lot of time to set up for not much return.

4. LEARN. Follow TheBlindSide007’s advice. Pick up new languages and new technologies. Bonus points for technologies created by companies you talk to, like, C# and .NET with Microsoft, or AngularJS by Google.

5. PARTICIPATION. Participating on github or open source projects is a good idea. Create a linkedin profile if you haven’t yet. Create a stackoverflow profile if you haven’t done so yet. When you reach enough reputation, they allow you to register on stackover careers. The importance is to show an interest in the community as well as the fact that you know what you’re talking about. People bs their resumes all the time, but if you are a stackoverflow member with 5k rep, you have to have gotten a few things right (or asked a lot of good questions, which is still a +).

Abhey Member

An OCJP will help you get the job, but it won’t help you do your job.. Yeah it will give you a good understanding of the internals of standard Java, but in the industry we make use of frameworks such as the Spring framework for Java. I’m not saying that you shouldn’t do an OCJP, just that it won’t necessarily give you the better edge. If you want to gain an edge, learn relevant technologies in the language of your choice. This will let the interviewers know that you already know the relevant technologies so you won’t need to be trained as intensively. Usually graduates get assigned mentors, so that way the mentor doesn’t need to spend as much time on training the junior.

For Java these include (these aren’t the actual definitions, but it will give you an idea):
– JQuery: a JavaScript framework that is very customizable
– Google Web Toolkit (GWT): A framework that allows you to write Java code (the style feels similar to old-school Swing GUI programming) that gets compiled into javascript.
– JSP/JSF: Front-end web technologies that take care of the servlet code for you. Instead of writing HTML pages you’ll use a syntax similar to it, but it gets compiled into servlets at runtime.
– Spring MVC: A front-end web technology that uses the Model-View-Controller design pattern. It makes creating web applications quite easy.
– Spring WS: A web service framework.
– Hibernate/JPA: used for persistence (it takes care of the database interaction for you)
– Maven: a build manager that resolves dependencies (it even downloads them for you). There are also many plugins for it, for example plugins to check how much of your code is covered by your unit tests.
– Unit Testing: this isn’t actually a technology on its own, but many graduates don’t know what unit tests are. Learn how to write efficient unit tests.

Just Google for web application tutorials – ex. “Spring MVC 3 tutorial” and see if you can get it working. Use an application server such as JBoss to run your web applications.

If you don’t know enough Java to understand these topics then work on some standard Java stuff and by all means do an OCJP, but don’t depend on it to give you an edge.

If you want to contribute to open source projects, join websites for those projects that you are interested in and get in touch with the community. You’ll probably do things like documentation and testing at first, but its a good way to get to know the processes.

Abhey Member

As others also suggested, start with a simple language like PHP or Python. Pick a language, and stick with it for next couple of months. The most important step is to see and understand the logic, where the code is of lesser importance in the beginning (in my opinion). Once you see/know/understand the logic, you’re good. Know where to use if, while, for, foreach, and other statements. Also learn where not to use them. When you understand the logic behind the code you are going to use, it will be way easier to learn the code itself. This makes learning other languages that might come on your path easier as well.

One more important thing to remember, is to understand the code, and not learn it. Knowing how to use ‘print’ (for example) does, and understanding what ‘print’ does is a world of difference.

Abhey Member

First, I’ll presume your setup is pretty standard, with a web server (e.g. Apache) accessed by a browser. What you have now is a JS setup that handles one part of the problem. The other part is handled by the server. So, my recommendation is that the JS calls XmlHttpRequest to a URL on your server which is you PHP code, passing whatever parameters are required, and the call replies with the content of the file. When this response is received, the JS can update the cells as you wish. I would recommend that you use JSON as your response from the server, since that’s much easier to manage from JS.

This pattern is called REST, and there are a few common mistakes made by people when they first start writing this kind of code. The most common is to include the verb in the URL, something like myserver.com/getNumbers. Instead, it should be myserver.com/numbers, using HTTP GET. When adding to the file, use POST, for update use PUT and for removing use DELETE. Also, always sanitise the data going in *and* coming out.

Abhey Member
var form = document.forms[0];
for(var i = 0; i < form.length; i++){
    if(form[i].value === undefined || typeof(form[i].value) === 'undefined' || form[i].value == "" || form[i].value.length < 1)
    {
        alert('You didn't fill in all the columns');
        return false; //Showing the message one time should be enough
    }
}

This is the simplest snippet I could think of for your case.
You are checking for 'null'. Javascript doesn't have a 'null-object'. Check for undefined, or typeof(object). See my example for this. Personally I'd rather use the last bit of the if in my example, because if someone fills in his or her name as a single letter, it's easier to check for that as well.

Abhey Member

Most SCCS/RCS systems handle any file type, although sometimes you have to tell it that your file is binary. For text files, the system typically stores the changes, while for binary files, it assumes the entire file has changed. One of the easiest systems to use is CVS and that assumes that everything is text. However, you can use -kb to tell it to not normalize line endings and to not expand keywords, for a specific file, and you can use the CVSWrappers file to specify which files should be treated as binary by default.

So you can use CVS, RCS, SVN. git, etc., etc. My personal choice would be to use Subversion (svn) – it’s easy to set up and easy to manage, very reliable and easy to use.

Abhey Member

Maybe this isn’t as hard?. Decoding algorithm (at least for sampled data) can be defined as simple circular, right bitwise shift. Number of shifted digits, depends of number of ‘1’ in 48-bits digit binary representation. All clear now? No? So let’s make quick example:

0x15 =
00000000 00000000 00000000 00000000 00000000 00010101 in 48-bits binary representation.
How many '1' it had? 3, so we need to shift everything 3 places to the right, now we got:
10100000 00000000 00000000 00000000 00000000 00000010
3 is odd Number, right? So we dont need to do anything else, and A00000000002 (hex representation of digit above) is our answer.

When number of '1' in encoded data is even number, final result is negation of result obtained by shifting operation. In above case it will be:
01011111 11111111 11111111 11111111 11111111 11111101 (but we don't need do that for 0x15)

Decoding algorithm in C++ can be implemented that way:

__int64 encode(__int64 d)
{
   int one_cunter = 0;
   __int64 mask = 0;
   __int64 ander = 1;


   for(int i = 0; i < 48; i++)
   {
      if(d & (ander<> one_cunter);

   return one_cunter % 2 ? ret :  ~ret & 0x0000FFFFFFFFFFFF;
}



int _tmain(int argc, _TCHAR* argv[])
{

   __int64 data[] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
   for (int i = 0; i < 20; i++)
   {
      std::cout<< std::hex << data[i] << " ->\t"<< std::setfill ('0') << std::setw(12)  << encode(data[i]) << std::endl;
   }
}
Abhey Member

UNIX tools are generally better for programming with, as the operating system was made for programmers (Or at least it’s maintained by people who seem to take this ethos),
in comparison windows is too locked down as a system so it suffers dramatically.

I’ve also noticed a trend where people who use windows are less likely to be as proficient a programmer as someone who uses *nix. (This is just my personal experience, but as always correlation != causation). The tools being built in to the system, and the sheer configurability, means that *nix is generally considered a programming OS. In my time I’ve programmed on both windows and *nix, but unless you use MSVC then you are going to suffer with the fact that the tools for programming on windows aren’t as good as the ones on *nix (Again, personal experience here, if you can shoot some tools my way that aren’t then please do

Abhey Member

Grab a good copy of the second edition K&R (Programming C by Dennis Ritchie and Brian Kernighan). It’s co-written by someone who designed and implemented the C language, has some solid advice in there. It teaches pointers better than any youtube tutorial ever can, and has some handy advice about the nooks and crannies of the language. And all in in the space of 1/2 and inch. It is considered THE DEFINITIVE GUIDE to C.

After you’ve learned C, find a project you really really like, and start hacking on it! It could be anything, a game, a itch-scratching tool, et cetera

Abhey Member

Think of a project(game, whatever) you want to create, try to make it. You will gain experience and remember better code

Abhey Member

Use only one DataGridView and then use Ling to filter out the results. If you don’t need to edit/modify the results, it will be a bit easy Take a look at this link below. Basically you change the DataGridView source based on the query. So ProductId, CustomerId, and OrderId would pull from the same database, but you would use a filter to set each datasource. Let’s say you have a ComboBox you can just have the DataGridView.DataSource change depending on the ComboBox selection.

If I have time tomorrow, I’ll put together a working sample, just let me know if you need to edit the results, because that’s more involved.

http://stackoverflow.com/questions/1000801/simplest-way-to-use-a-datagridview-with-linq-to-sql

Take a look at this for more Linq queries.

http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b

Abhey Member

SELECT Region FROM Members WHERE Gender == ‘M’ AND City LIKE ‘A%’;

            Members Andy = new Members();
            Andy.gender = 'M';
            Andy.region = "USA";
            Andy.city = "Wherever";
            Andy.firstName = "Andy";
            Andy.lastName = "Johnson";

            Members Rich = new Members();

            Rich.gender = 'M';
            Rich.region = "USA";
            Rich.city = "Anytown";
            Rich.firstName = "Rich";
            Rich.lastName = "Smith";

            Members Lisa = new Members();

            Lisa.gender = 'F';
            Lisa.region = "Canada";
            Lisa.city = "Somewhere";
            Lisa.firstName = "Lisa";
            Lisa.lastName = "Benson";

            Members John = new Members();

            John.gender = 'M';
            John.region = "Canada";
            John.city = "Anywhere";
            John.firstName = "John";
            John.lastName = "Marx";

            List list = new List();
            list.Add(Andy);
            list.Add(Rich);
            list.Add(Lisa);
            list.Add(John);

            var results = from l in list
            where l.city.StartsWith("A") && l.gender == 'M'
            select l.region; 
Abhey Member

before starting out to do that , get clear on the terms front end and back end …

frontend : what the user can see in front and the software that makes the website looking like it is
backend : the stuff in the background making this happening

you will need to bridge the frontend and backend, bringing them together , example :

front end : PHP with shell module and LAMP
backend : FTP Server

if the user clicks a link , the front end will send a command to the backend, instructing it to do something, for example, create a ftp account , this info is relayed back to the front end API and displayed while a shell script sets up the user , group and password, home directory etc.

If you plan a website that does not only display standard html / php stuff with a database in the backend , think of the language needed to do what you want it to do and write it ….

as to how : not really sure, id say google for backend web programming or something. But you will need to know first what you want to create , then search for an API that makes the bridge to the backend services

Abhey Member

To summarize: you have little programming experience and you want to know which OS would be best to develop games for and how to do it?

  • iOS costs money just to start. Android does not.
  • iOS is done in C. Android is typically Java.
  • Legal issues should not be a concern as long as you don’t steal an existing product.
  • Don’t expect to be churning out big money makers in a few months. There’s a ton to learn and a ton of competition from companies (yes, companies, not just individuals) that are already well ahead of you.
  • Work hard, do what you enjoy and you’ll eventually profit.
Viewing 15 posts - 31 through 45 (of 110 total)
en_USEnglish