Robin19's Profile User Rating: *****

Reputation: 256 Architect
Group:
Expert
Active Posts:
529 (0.38 per day)
Joined:
07-July 10
Profile Views:
8,023
Last Active:
User is offline Apr 17 2014 12:12 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
100
Expert In:
C#

Latest Visitors

Icon   Robin19 has not set their status

Posts I've Made

  1. In Topic: Inheritance property issue

    Posted 10 Mar 2014

    Even though HeartbeatSupervisor is a child, it cannot reference a protected member on another (even parent) class. It can only reference protected members on itself.

    Is it possible for HeartbeatSupervisor to not hold a Server, but for you to simply cast the Server as a HeartbeatSupervisor?

    public class HeartbeatSupervisor : Server
    {
    ...
       void DoSomething()
       {
          PingReply reply = pingSender.Send(this.Id);
       }
    ...
    }
    
    Server server = GetServerFromSomewhere();
    
    HeartbeatSupervisor heartbeatSupervisor = (HeartbeatSupervisor)server;
    heartbeatSupervisor.DoSomething();
    
  2. In Topic: Using Lambdas with events

    Posted 24 Feb 2014

    Lambda Expression is just an anonymous method written with syntactical sugar. It is possible to just use regular methods. Just like how Properties are just get/set methods. Both are ways to write code quicker and that reads easier and both can be written in other ways.

    Which Event is the View sending? And which Event is the RS232 listening for? Why can't this be the same event? Then the Control can register the two together.
    myView.SendSomethingEvent += myRS232Object.ReceiveSomethingEventHandler
    
  3. In Topic: Record Retrieval Problem in android sqlite

    Posted 14 Jan 2014

    Look at your LogCat. There is a NullPointerException What is the first message that references a class you created? It tells you the problem happened at Database.java:96.

    Line 96:
    Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
    

    Toast.makeText is a static method. That is not null.
    e is a thrown exception. That is not null.
    Toast.LENGTH_SHORT is a static field. That is not null.

    So the only possibilities are that the makeText method returns null or the context is null. My guess is that the context is null. context is injected in via the constructor.

    My guess (and this is only a guess) is that you create the Database object and pass it around. By the time you use it, the Activity that created the Context injected is destroyed. You don't control when an Activity is destroyed if it is not being displayed. I would inject the Context object to the method (or let the calling Activity create it) and see what happens.

    Then you need to debug what error is causing this line to run. My guess is that it is a similar problem.
  4. In Topic: Ask the user to enter their two numbers separated by a comma.

    Posted 31 Dec 2013

    I think you should ask someone at your post secondary institution for some help. Not because we don't want to help you. Someone is paying a lot of money for you to attend classes at a school. That payment is in exchange for them helping you learn a trade. It will be easier to learn if you are working with someone in person than over a web forum. We could help you accomplish this one task, but you will be better off learning to become a programmer. You are missing a great opportunity and setting yourself back several steps if you do not use the resources your school provides. If the school cannot or will not give you these resources, I suggest you ask for a refund and apply to a different school.
  5. In Topic: List, ForEach, Skipping one element efficiently.

    Posted 31 Dec 2013

    I don't think you are saving anything if you are retrieving the index from the list. List<T>.IndexOf is a O(n) operation.

    My guess on how it is implemented:
    public static int IndexOf<T>(this List<T> list, T obj)
    {
       var index = -0;
       foreach (var item in list)
       {
          if (obj.Equals(item))
          {
             return index;
          }
          index++;
       }
       return -1;
    }
    


    Edit: What is the drawback of updating the sender? I'm wondering if it might be better to push off this logic to it.

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
June 15
Gender:
Programming Languages:
C#, Java, C++, VB.NET, WPF, XNA

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    ni44ko Icon

    23 Nov 2010 - 19:19
    thanks. i want to be your apprentice.
Page 1 of 1