The Way to Programming
The Way to Programming
Given a single property representing the number of seconds, you should be able to break it down into a number of whole hours, whole minutes and remaining seconds.
Suppose you have 5000 seconds, this is the same as 1 hour, 23 minutes, 20 seconds.
So store the data in a total_seconds property. Rewrite the getters to use the the right math: getHour() { return total_seconds % 3600;} and so forth. Then the setters do the opposite:
setHour( int h ) { int hr = (h >= 0 && h <= 23) ? h : 0; total_seconds = 3600 * hr + 60 * getMinute() + getSecond(); }
This is called spell checking. Google for “c# spell check” and there are a ton of resources available. If you try to implement and have issues, we should be able to assist more directly.
Normally I would say that that is not a quick, easy task. You would need to have your webhost use whatever language (like php) to read the Excel file and export it to an XML file using RSS formatting. But in this case, Google comes to the rescue.
http://www.automateexcel.com/2004/12/15/create_an_rss_feed_with_excel/
Thank you this is what I was looking for but I want to save the images not just in the upload folder I want to make a few categories (folders) inside the upload folder example if I select pets I want to upload it to /uploads/pets and when I select food I want to store it in uploads/food/.
Precisely. Furthermore new features require more work and usually employers demand something that works and has all the functions that they need and can be delivered fast. Updates can then be made to patch things up. Unfortunately, functionality beats performance nowadays precisely because we have some great new technology.
I’m really not sure what you’re looking for, but C# supports verbatim strings which eliminates the headache with escape sequences.
Console.WriteLine(@"Hell 'o' World")
will print Hell ‘o’ World (Note that ‘ ‘ doesn’t require any escape sequences)
our question suggest you are not yet familiar with C/C++, as it doesn’t matter much what OS you use if you want to practice the language in general without heavy OS dependent stuff. A good start is the famous cplusplus.com site, it offers a comperhensive documentation of the standard syntax and library aswell as tutorials for beginners: http://www.cplusplus.com/doc/tutorial/
it also makes some suggestions about development environments you could use and provides basic aspects of programming in general if that is of use for you.
Be aware that C++ is very mighty and depending on your foreknowledge it might take some time before you get your head around concepts such as classes and templates.
Just download Eclipse and the respective C/C++ plugin and you’re good to go. If you’re new to it, then it’s perfect because it even helps your writing correct things rather than just programming everything on gedit and then finding out the errors in compile time.
Strcpy and strcat are not safe they are prone to bugs and buffer overflow exploitation. Use memcpy it’s quicker because the function does not check each copied byte for a null byte and is much safer
I think programmer over DBA. I think DBA’s top out.. there is a peak and the job becomes redundant. Programmers have no limit and their skills are applicable to a much wider range of topics
DBA is quite fun, or at least my limited experience of it is. Messing with mysql configs, optimising out of queries etc.
DBA is always better. It’s not a job where you want to work all day by sitting on computer and typing things. Don’t forget, those who are DBA are aware of programming language and that’s how they manage all the things. Coding is considered as lowest level of development in software company.
Just remove the two lines:
new mq('m1'); new mq('m2');
and you will be good to go
Don’t worry man, programming is a bit of a mindfug at times. You’ll get your head around it. Just take a break when you need to and use a pen and paper to write down the state of each variable.
I think you’re just getting a bit confused with all the variables and because the variable and method names are not sensible?
I simplified the program by removing unnecessary code and renaming some of the variables to something more sensible (for me at least). I didn’t comment on all the code as you already seem to understand most of it.
Get out a piece of paper or use Excel to write down all the variables and for each increment of x, write down the new value of each variable in a new row.
public class Mix4 { int visits = 0; public static void main(String[] args) { int count = 0; Mix4[] m4a = new Mix4[20]; int position = 0; while (position < 2) { m4a[position] = new Mix4(); // Counter only gets incremented once so this is equivalent to m4a[x].counter = m4a[x].counter + 1; m4a[position].visits = 1; count = count + 1; // This line checks if the while loop has executed less times than the limit (limit = 2 in this example) // After it is done checking if position is < 2, it adds the result to the counter // So in our example, this will be: // count = 1 + 1 when position = 0 (because 0 < 2) // count = 1 + 1 when position = 1 (because 1 < 2) count = count + m4a[position].checkIfLimitIsGreaterThan(position); position = position + 1; } // Answer will be 4 1 System.out.println(count + " " + m4a[1].visits); } public int checkIfLimitIsGreaterThan(int currentPosition) { // currentPosition can be 0 or 1 // limit is 2 if (currentPosition < 2) { return 1; } else { return 0; } } }
As for the second example, maybe try to think about what each statement in the snippet pool needs before it can be used.
http://developer.android.com/reference/android/widget/Button.html
http://developer.android.com/reference/android/view/View.OnClickListener.html
The View parameter on buttonClicked event passes the view (a Button is a View) that was clicked.
I suggest that instead of reading a book, which only give us a general view about Android programming, just read the documentation which give us deeper understanding about the features presented in Android API.
Sign in to your account