deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Install Visual Studio Express, buy a book on C# and read it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So I did some investigation, and our community activity took a DRAMATIC 30% hit the day that we switched over from vBulletin to our new proprietary platform, and never recovered since, despite traffic levels.

Out of curiosity, are you accounting for the spammers that were overwhelming us prior to the move being immediately reduced to 0% when the new system went live? If 30% of our traffic was 90+% spammers, I'm okay with the reduction.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

can you please notify me that whether i will get my a/c back or not

Sorry, but that account has been deleted and it's been stated multiple times that the process is irreversible. If there was any question about whether you wanted it back, you shouldn't have deleted it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

number is a local variable whose lifetime ends when the constructor terminates. What do you suspect happens when the lifetime of the reference exceeds the lifetime of the referred?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If I requested 8 bytes of memory, I wouldn't go and try to stick 16 bytes into the block I was just given, so what purpose does it have?

Once again, malloc() is required to align for any type. Just because you requested 8 bytes doesn't negate that requirement. That's not to say malloc() couldn't interpret the requested size and shrinkwrap the alignment accordingly, but the standards committee clearly chose not to go that route.

However, note that C11 (the latest standard) added aligned_alloc(), which supports specifying the alignment you want for a specific object rather than the maximally portable alignment.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I saw this one coming as soon as Dani gave members the ability to delete their account.

They got the power what they wanted, now they have to deal with the responsibility. I find myself lacking any sympathy at all, especially given how hard we make it to delete an account and how many "this is irreversible" notices they have to click through to make it happen.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Because there's no overloaded operator>> that does this for you. It's simple enough to write, though you could just as easily reverse the operation and dump cin into Mystr:

Mystr << cin.rdbuf();

That's probably why the overloaded operator doesn't exist, it's unnecessary.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Swap the data with the next node and then delete that node. This trick is obviously incomplete and its suitability depends on the design of the list, but if you're working with unreasonable requirements, you often have no choice but to enforce unreasonable limitations on the solution.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Given the choice between making the experience for new members worse, and asking mods to move a few threads every now and then from a well defined and consistent drop location, I'd favor the latter. The Community Center is a good spot too, because regardless of our individual favorite forums, I think most (if not all) moderators frequent the Community Center and will see these rogue threads.

pritaeas commented: Exactly. +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I do not understand why did you make 3 for loops?

The real question would be why did the OP not format his code in an understandable way. Reread the original code, it doesn't have three nested loops.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've seen these as well, and it's somewhat frustrating given the point of tags. I'll look into a programmatic solution, but in the meantime, please report those posts so that a mod can fix the tags.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Always change that as well.
n=n+1;

I hope you're not changing code that someone else wrote just to suit your own aesthetic preferences. That's an excellent way to introduce bugs.

I'd also argue that your preference is unconventional and will cause programmers to stumble over your code not because they don't understand it, but because they don't trust that you understand it. When a language supports x += y or x++ for example, any use of x = x + y will be viewed with suspicion; this is justified, in my opinion, because bad programmers are the ones that use such constructs without good reason.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

There are two different things here, I think.

  1. Votes: These are the actual point values that contribute to your total up and total down vote counts.
  2. Currently positive or negative posts: These are lists of posts that are currently positive or negative when all votes on the post are taken into account.

If a post that's negative at -1 gets a positive vote, the value becomes 0 and the post is removed from the negative posts list. However, the downvote that put it on the list in the first place isn't deleted; that record remains in the database and still applies to both the post in question and your totals.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Then either the car is still traveling

Nope, the question clearly states that the car traveled (past tense) from A to B (a complete trip).

or it jumped part of the distance?

Or the person asking this question is math impaired? I still think that the most rational answer is 72km/hour and a broken odometer. How else would a car travel 36km and only report traveling 28km?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The speed of the car was 72km/hour, and the odometer is broken. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

NOW THE QUES IS THAT I CAN'T UNDERSTAND

Which part don't you understand? The instructions are very explicit, though there's an assumption that you'll figure out how to calculate the distance between two points. I would expect a programming instructor to at least remind the class that the distance between two points can be solved with an equivalence of the Pythagorean theorem:

double a = a.getX() - b.getX();
double b = a.getY() - b.getY();
double c = sqrt(a * a + b * b);
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

One shouldn't expect people to consistently vote on every post one makes, it's really all about who sees it, what their opinion is, and if their opinion is strong enough at the time to make a vote. Further, votes are completely subjective and not restricted to any guidelines (barring personal guidelines the individual voter chooses to follow).

However, it's important to recognize that your votes will trend over time depending on your actual post quality. Those with consistently good quality posts will have an amortized good vote rating, and those with consistently bad quality posts will have an amortized bad rating. For people who fluctuate, the votes should even out over time between positive and negative. If a member is active in the community for a number of months or longer, their overall trend should be reasonably accurate.

Ultimately we all get votes we think weren't fair, but all of these metrics are really just for e-peen points. What really matters is your intangible reputation among the community. There are no numbers for that, it's strictly what everyone thinks about you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can Coffee Really wipe out sleepiness. I do it a lot but still i become sleepy.

Coffee doesn't make you less sleepy, it's a stimulant that temporarily suppresses the sleepiness. Like all stimulants, there's a crash when it wears off that has you worse off than before. The best way to avoid sleepiness is to get enough sleep.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That "for" loop (according to what you have said) is the same as a while loop saying:

Close. It's more like this (note that the braces introducing a scope are significant):

{
    int i = 5;

    while (i < 2)
    {
        System.out.println("What?");
        i++;
    }
}

System.out.println("Who?");

Since i is never less than 2, the loop body is never entered, and the only output is "Who?".

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My first approach would be to monitor the last write time for the USBSTOR registry key in a windows service and persist those results in a separate database or file. Really the most difficult part of that would be working around the complete lack of support for time stamps in registry keys. So you'd have to drop down to the Win32 API for that information.

For example:

using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;

class Program
{
    static void Main(string[] args)
    {
        string usbStor = @"SYSTEM\ControlSet001\Enum\USBSTOR";

        using (var keyUsbStor = Registry.LocalMachine.OpenSubKey(usbStor))
        {
            var usbDevices = from className in keyUsbStor.GetSubKeyNames()
                             let keyUsbClass = keyUsbStor.OpenSubKey(className)
                             from instanceName in keyUsbClass.GetSubKeyNames()
                             let keyUsbInstance = new RegistryKeyEx(keyUsbClass.OpenSubKey(instanceName))
                             select new
                             {
                                 UsbName = keyUsbInstance.Key.GetValue("FriendlyName"),
                                 ConnectTime = keyUsbInstance.LastWriteTime
                             };

            foreach (var usbDevice in usbDevices.OrderBy(x => x.ConnectTime))
            {
                Console.WriteLine("({0}) -- '{1}'", usbDevice.ConnectTime, usbDevice.UsbName);
            }
        }
    }
}

/// <summary>
/// Wraps a RegistryKey object and corresponding last write time.
/// </summary>
/// <remarks>
/// .NET doesn't expose the last write time for a registry key 
/// in the RegistryKey class, so P/Invoke is required.
/// </remarks>
public class RegistryKeyEx
{
    #region P/Invoke Declarations
    // This declaration is intended to be used for the last write time only. int is used
    // instead of more convenient types so that dummy values of 0 reduce verbosity.
    [DllImport("advapi32.dll", EntryPoint = "RegQueryInfoKey", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
    extern private static int RegQueryInfoKey(
        SafeRegistryHandle hkey,
        int lpClass,
        int lpcbClass,
        int lpReserved,
        int lpcSubKeys,
        int lpcbMaxSubKeyLen,
        int …
ddanbe commented: Phew man, you know some things! +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Apply electric shocks to your genitals.

Kinky.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

what was the greatest programming challenge you ever had

Being a good programmer. It's a constant challenge. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

it adds automatically an empty line between 1. Item One and 2. Item Two

Yes, that's a quirk or the Markdown formatting that I've been unable to fix without introducing other quirks.

When going to submit I get this error:

Yup, that's because you indented the nested items with a tab or 4+ spaces. Markdown will accept the nesting regardless of source text indentation, so you can just ignore it and leave everything at column 0. However, if you want to have nested lists of the same type, you can use a 1, 2, or 3 space indentation to give a hint to the parser and still get around our code validation. Here's an example with 2 spaces:

* Item One
* Item Two
  * Nested One
  * Nested Two
* Item Three

Which is formatted like this:

  • Item One
  • Item Two

    • Nested One
    • Nested Two
  • Item Three

Also, I thought the absence of an empty line before and after a presumed "code block" as a nested list, would have avoided the check.

No, that ensures that you'll get an error. ;) The editor will not format such text as code, but the validation runs after you try to submit.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That's a very myopic view of geekdom.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

He passed away a couple years ago, I think it's time for DaniWeb to retire his account and move on.

No offense toward Dave's memory in any way as he was easily one of my best friends online, but why would we need to retire his account? How is it different from any other member that suddenly stops posting?

I guess it should mean that it is deactivated in the sense that it won't "participate" anymore (e.g., doesn't show up on endorsements, cannot send him PMs, etc.). But obviously, all past posts and stuff should remain, probably also the user profile (maybe with a eulogy-like notice).

There's no way to do that presently, we don't make a distinction between active accounts an inactive accounts except through hard deletion (though deletion does a lot of what "retiring" seems to be). And I'd be against deleting Dave's account, for personal reasons.

What DaniWeb needs is a 'memorial account' option, similar to Facebook, perhaps?

That I can get behind. Something to mark an account as being special in the hearts of the community even though it's no longer active.

But how would you know if a Daniwebber is no longer living...? Wouldn't that be kind of challenging to figure out?

It depends on the cause of death and how friendly the member is with other members. In Dave's case it was advanced cancer. While things progressed shockingly fast, there was plenty of advance warning that …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Pass the size in using two more parameters. There's no standard way to determine the size of an array when given nothing but a pointer to the first element.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Well, with that rule absolutely any and every word is permissible. Can a filter of any kind, for words or images, be justified with such a rule?

Exactly my point. No word should inherently be prohibited because it's not the word that's the problem, it's the way the word is used. If the word is used in a non-offensive context, it shouldn't be offensive, in my opinion. Then again, profanity never bothered me even when it was intended to be offensive. And one could certainly argue what it means to be "offensive". In our current social climate, people tend to be extremely sensitive, which is why Daniweb has a censor in the first place.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's _Bool, not _bool. Case matters. ;) But yes, if you use _Bool, 0, and 1, then you don't need to include any headers.

can u plzz give a small program or prototype so i can clearly understand the syntax!

...

This is C (assuming C99 or newer):

#include <stdbool.h>
#include <stdio.h>

int main(void)
{
    _Bool x = 0;
    bool y = false;

    if (x) {
        puts("x is true");
    }
    else {
        puts("x is false");
    }

    if (y) {
        puts("y is true");
    }
    else {
        puts("y is false");
    }

    x = 1;
    y = true;

    if (x) {
        puts("x is true");
    }
    else {
        puts("x is false");
    }

    if (y) {
        puts("y is true");
    }
    else {
        puts("y is false");
    }

    return 0;
}

If <stdbool.h> is included, you can mix and match the defined keywords, such as bool x = 0, or _Bool x = false. The usage in C++ is the same, except _Bool is not an accepted keyword and you don't include any special headers.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

James, did you really mean to say that given the context? If so, then kudos to you sir! :)

The choice of wording was intentional, yes. ;)

However, there is a danger in taking the freedome of speech route that aomething really offensive could either go unnoticed or, much worse, get noticed by others but left undealt with by mods for a period of time

People aren't stupid. It's not difficult to infer from context what the poster actually typed. I'm of the opinion that it isn't the words themselves that are the problem, but the intention with which they are used. Replacing "shit" with "poo" but retaining the offensive context is no less offensive than if you used "shit", for example. This focus on words completely ignores the very real fact that it's the intentionally offensive use of some arbitrary word that constitutes profanity, not necessarily the arbitrary word itself.

That's precisely why I try to avoid calling people names of any kind. If I call someone a poo-poo eater or a short bus window licker, it might encourage a giggle because they're silly, but if I mean it as a serious attack on that person, those names are no better than more ubiquitous or universally recognized profanity.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How difficult will it be for a 41 year old, former CPA but recently graduated Computer Science major, to find a good programming job?

Probably as difficult as it would be for anyone with your level of experience. Age generally isn't that big of a deal in our field, not to mention the myriad age anti-discrimination laws out there that will probably help you out.

Also, I am interested to know the viability of breaking into a gaming programming role?

Heh, good luck. The game programming field is extremely competitive and intense. It would be difficult to get your foot in the door with little to no prior development experience, which seems to be the case in your situation. That doesn't mean you shouldn't try, just don't get your hopes up.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It really would be best to use word granularity rather than character granularity. Collect all of the words in a list and then you can use a simply greedy word wrapping algorithm to display them in a bounded area. For example:

#include <algorithm>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
#include <utility>
#include <vector>

using namespace std;

namespace {
    const string::size_type line_width = 40;
}

int main()
{
    ifstream in("test.txt");

    if (in) {
        vector<string> words;
        string line;

        // Build the word list
        //
        while (getline(in, line)) {
            auto x = vector<string>(
                sregex_token_iterator(line.begin(), line.end(), regex("\\s+"), -1), 
                sregex_token_iterator());

            x.erase(remove_if(x.begin(), x.end(), [](const string& s) { return s.empty(); }), x.end());

            for (auto& word : x) {
                words.push_back(move(word));
            }
        }

        // Display each wrapped line
        //
        auto remaining = line_width;

        cout << string(line_width, '#') << '\n';

        for (const auto& word : words) {
            auto width = word.size() + 1;
            bool wrap = width > remaining;

            cout << (wrap ? "\n" : "") << word << ' ';
            remaining = (wrap ? line_width : remaining) - width;
        }

        cout << '\n' << string(line_width, '#') << '\n';
    }
}

How you collect the words is up to you and generally straightforward, so I did something concise. The important part is the word wrapping algorithm.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why?

The long and short of it is that shit, while technically profanity, is rarely used as a malicious attack in the context of our community. Most often it's a descriptive term for actions, objects, or concepts (eg. "That code is shit", "Your idea is shitty", "That's some funny shit"). Sometimes it's an exclamation (eg. "Well, shit!"). The key usage that's rare to the point of not being present would be a pejorative term against another, such as "You're a piece of shit". However, even that smells better than the more ubiquitous "fuck you", which happens to be censored. ;)

Ultimately it's pretty subjective what gets censored. For example, piss was censored for the longest time, and I'd like to think that my whining about it (I like to use "piss off" and "piss poor") was the main catalyst for getting it off the list on both the forum and IRC. ;)

My personal opinion is that nothing should be censored, and abusive profanity should be reported for the moderators to deal with. It's just too much trouble and too difficult to censor words programmatically in a way that makes everyone happy.

~s.o.s~ commented: And I agree with this opinion +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What is your best high school achievement(s)?

I tore down then rebuilt an automatic transmission...and it worked.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The potential exists for someone to log onto my old account, and please don't tell me about passwords, since it would seem that the hack occurs down the line, so anything I enter is likely to be captured

So your solution is to avoid fixing the actual security issue and instead focus on closing all possible endpoints as reactive damage control? Interesting approach.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Thanks. Is there some "official" place where that is said, I couldn't find one.

Well, there's only one "official" place and that's the ISO standard. Now that I think of it I don't recall seeing it explicitly written out anywhere else authoritative (if you don't count my reading of the standard to be authoritative ;D). However, it's been stated explicitly in a number of conferences, presentations, and talks about C++0x/C++11 that I've attended where the presenters were most certainly authoritative (Herb Sutter, Scott Meyers, Andrei Alexandrescu, Bjarne Stroustrup, Stephan Lavavej, etc...).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

they don't explain clearly what the benefit of using them is, why I need them

Say you have two libraries, each in a separate assembly. Neither use namespaces, but both define a class called Widget. How do you know which Widget is which without some way to categorize them? The answer is namespaces.

when I need them

When there's a potential for name conflicts.

and why they're generated automatically

It's best practice to wrap everything in a namespace at the beginning, if only because it saves you the effort when you invariably discover that it needs to be done later down the road.

Say I have a class that I want to use in multiple projects, what namespace do I give it?

Something that's unique and descriptive. For example, I have a scheduling library for polling services with this structure (company name removed to protect the innocent):

CompanyName.Scheduling
    ScheduleEditor
    ScheduleTimer
    ScheduleTimerPulseEventArgs
    ScheduleOverlord

The namespace ensures that when I want a ScheduleEditor, I can get my company's editor by saying CompanyName.Scheduling.ScheduleEditor. We only have one scheduling library, so there's no need to be more granular than that. But ScheduleEditor isn't such a unique name that another third party library we use certainly won't use it.

Everytime I paste a class from one project into another I have to change the namespace and it's getting annoying. How can I avoid this pointless excersize?

Yes, that does get annoying if you …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

As long as the vector object itself is in scope, it takes up memory. But if you want to well and truly destroy the items stored by the vector and release the allocated memory, you use the swap trick:

vData.swap(std::vector<std::wstring>());

You could also copy assign an empty vector, which can potentially be less performant than the swap trick, but has the benefit of clarity over the more obscure (if idiomatic) swap trick:

vData = std::vector<std::wstring>();

And invariably someone will chime in that the shiny new shrink_to_fit() method is available in C++11 for this very purpose:

vData.clear();
vData.shrink_to_fit();

But that's just a hint, and the compiler is not obligated to honor it and deallocate memory immediately.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Should be easy few lines of code but I'm a Beginner!

I'd suspect that the problem is you don't understand how to reduce a fraction using the gcd, or normalize two fractions from the lcm. Like you said, it's an easy few lines, but if you don't know how to do it manually, you'll never be able to write the code for it.

So your first step is to break out the old elementary math book and read up on fractions. The "hard" parts are already done: gcd and lcm are already written and can be used to reduce and normalize.

First of all that code is cryptic and you're not really saying what is the problem.

How is the code cryptic? It looks straightforward to me. Obviously the question is how to write fraction reduction and common denominator for addition and subtraction. When gcd and lcm are already written, those two functions are absolutely trivial (two or three lines of code apiece), provided one knows the math behind it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

No, ultimately the sequence you get is still bound by the randomness of the library. But if that process produces a reasonably random seed for the library, it's a net win, though I'm not sure it's worth the effort over something simpler and probably faster like taking a hash of the current system time.

ddanbe commented: I agree, was just wondering. +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

yes deceptikon...that's what i am suggesting.Peolpe outside conversation are not allowed to have downvoting option.

If you want to lock down negative votes to avoid abuse (for whatever you define as "abuse"), I'd be more inclined to have a different barrier of entry. Something like a minimum membership level or minimum reputation points. But requiring someone to post in a thread before being allowed to downvote is just asking for valueless posts. The assumption that posting for the sake of downvote rights would result in something that helps the OP is not a safe one, in my opinion.

But ultimately, your suggestion goes against the spirit of the voting system. If there are hoops to jump through when voting, nobody will vote. The feature is intended to be quick, easy, subjective, and open to all.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So if I work with it professionally and can produce relevant programs with the language then I can say that I know it.

Change the "and" to "or" and I'd agree. Either you currently work with it professionally or you're capable of working with it professionally, both would be justification for placing the language on your resume. And let's be realistic, the bar for entry in using a language professionally isn't that high. ;)

Does that still apply if I spend half my time googling and using DaniWeb to get to get a programming problem solved? :)

That depends. Are you simply cutting and pasting code that you don't understand or are you searching for help with solutions that you could figure out on your own if given time to do so? I often "borrow" code snippets to solve a problem quickly, but I don't use anything that I don't understand first.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

There might be option that only person in the conversation can downvote because if he/she is downvoting then they must have reason for that and solution for that.

People outside of a conversation aren't allowed to have an opinion?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The ultimate pickup line: "Hi."

Rationale: Canned pickup lines are a fantastic way to fail early in the game. Just confidently approach the man or woman you're interested in and strike up a conversation.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The MouseMove event needs to take the current state of drag into account:

Private Sub PictureBox1_MouseMove() Handles PictureBox1.MouseMove
    If drag Then
        Me.Top = Windows.Forms.Cursor.Position.Y - mousey
        Me.Left = Windows.Forms.Cursor.Position.X - mousex
    End If
End Sub
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I faced similar issue transferring CSV file into database, but after splitting the string using String.split() function the files are properly inserted into the table.

Until you're given a complex CSV file where one or more fields contain embedded commas or line breaks. ;) The ReadLine() and Split() approach is viable only for simple "CSV" files where the only commas are separating fields and the only line breaks are the record terminator.

Begginnerdev commented: I have had nightmares about complex CSV files... +8
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Just use the file name and not the full path in the query. The path without the filename would go in the connection string. Here's a working example you can use as a template if you'd like:

    Private Function CsvGenerateView(filename As String, hasHeader As Boolean) As DataSet
        Dim connectionString = String.Format( _
            "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""{0}"";Extended Properties=""Text;HDR={1}FMT=CSVDelimited"";", _
            Path.GetDirectoryName(filename), _
            If(hasHeader, "Yes", "No"))
        Dim query = "select * from [" & Path.GetFileName(filename) & "]"
        Dim ds As New DataSet

        Using connection As New OleDbConnection(connectionString)
            Using cmd As New OleDbCommand(query, connection)
                connection.Open()

                Using da As New OleDbDataAdapter(cmd)
                    da.Fill(ds)
                End Using
            End Using
        End Using

        Return ds
    End Function
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The problem with instant/realtime updates is that they can hammer the server, and it gets worse the more notifications you offer. Your example was Facebook, but I can guarantee that Facebook doesn't have the same server and database limitations that we do, and keeping the site responsive (not to mention avoiding crashes) is somewhat important. ;)

I agree that it'd be a great feature, I'm just not sure it's feasible at the moment.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Console.Readline(); by itself will pause the console.

Any input request will pause the console, but if your goal is to 1) not pollute the console's output and 2) accept any key press for continuing, then ReadLine() isn't ideal because it echoes the characters you type and requires the Enter key to finalize the request.

The canonical getch() is what you'd want, and conveniently enough .NET standardizes that behavior with Console.ReadKey() and a false parameter to disable echo.

ddanbe commented: I cannot do other then rep you +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You need to divide and modulo by 16 instead of 8, and you need to use the letters 'A' through 'F' when x is greater than 9. A fun trick is with a table lookup of digits:

public static void convert(int a){
    String digits = "0123456789ABCDEF";
    String obrnuti = " ";

    while (a > 0){
        int x = a % 16;
        obrnuti += digits.charAt(x);
        a /= 16;
    }

    System.out.println(reverse(obrnuti));
}

you're making it way too difficult.

That's all well and good, but it's not unreasonable to assume that a teacher is disallowing use of the standard library for this exercise.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's certainly frustrating when I'm working with a programmer who clearly has a weak fundamentals, but I don't think "modern" languages (whatever you choose to mean by that) are the only culprit, or even the most prominent culprit. More likely is this wonderful resource we have called the internet, and the fact that one can practically cut and paste their way to a reasonably functional application with little more than a laundry list of Google queries.

It's simple evolution concerning languages that do a lot of the grunt work for you, because software is becoming ever more complex, yet our deadlines for writing it remain short, and the capacity of our brains remains limited.

deltascrow commented: I agree, though I sort of was referring to the detailed libraries given out with the language(s). Though it makes coding easier, new people tend to stop using their minds once they see the libraries. Just saying. :\ +0