What is "System.ComponentModel.Design.DateTimeEditor+DateTimeUI"? - c#-2.0

Greetings,
doing research into outside code I got this control returning
{
Name = "DateTimeUI"
FullName = "System.ComponentModel.Design.DateTimeEditor+DateTimeUI"
}
to Type.GetType(). I've no idea what DateTimeUI is, and "DateTimeEditor+DateTimeUI" seems pretty confusing aswell. The class isnt defined in the code I was researching.
Googling yielded no relevant results except this, which didnt help; I'm all out of sources to draw from, and would appreciate any clarification on the matter

Based on the class name DateTimeUI is a class nested inside the System.ComponentModel.Design.DateTimeEditor class. If you need to dig in further - disassemble the code with RedGate reflector

Related

Super simple but hard question for a Dart beginner

I am trying to learn Dart language. Following code seems very straight forward but does not work. I know it may be a foolish question for an expert but for me hard to understand why not ?
class Car{
carFun(){
print("Test");
}
}
main(){
Car.carFun();
}
Already answered but I'll give more context.
You need to mark your method as static:
static carFun(){ ...
This makes the method available as a 'Class Method'; right now, as you have defined it, it is an 'Object Method'. This means that you need to make an object out of the class Car to be able to use it, which would be something like this:
var myCar = new Car();
myCar.carFun();
This way you instantiated an object and used a defined method for it. Marking it as static would make this approach not work. This is one of the many differences between a Class and an Object.
Mark your method as static. Read more: https://dart.dev/guides/language/language-tour#class-variables-and-methods

what is the function of "extend" syntax in lua?

i am new to lua. Recently i encounter a syntax call "extend" in lua, i look up the internet, but nothing can be found.
local item = require "item"
local object = item:extend()
I suspect it is related to inheritance, but no info online. Please help me to clear my doubt or point me to the right resource, thank you.
There is no extend function in standard Lua. The extend function in your code snippet is a user-defined function coming from item. To know what it does, you'd need to look at the source code or documentation for it, not for Lua itself.
Hello
What item:extend() have done is stored in object. So simply check what object is. First with:
print(type(object))
...isit a table, function, number, string, userdata, nil or boolean?

Using NSClassFromString() on a Swift declared class requires a fully qualified name

I have an issue where in Swift I have a class defined named Person, and when talking to some objective-c code, it will try to create new instances of that class.
Obviously NSClassFromString(#"Person") fails, because it needs to be a fully qualified name such as DBAccess_Test.Person.
My question is, am I able to programatically generate the DBAccess_Test. portion, by possibly searching through a registry of classes perhaps?
The reason being, that for an ORM we maintain, a Swift programmer may well decide to have all of his storage classes within a separate namespace to the application. But we wish to maintain standard table naming practices that match the names of the class as understood by the developer.
For instance, instead of a query being:
NSArray* r = [[[[Person query]
where:#"surname IN (SELECT surname FROM Employees)"]
orderBy:#"forename"]
fetch];
it would become:
NSArray* r = [[[[Person query]
where:#"surname IN (SELECT surname FROM DBAccess_Test_Employees)"]
orderBy:#"forename"]
fetch];
The ORM already has a bit of an identity crisis. We just wish to keep in check the table names, with the class names that the programmer will use.
Thanks in advance foe your help.
Annoyingly, I stumble across the answer as soon as I post this (Despite searching for hours).
You must put #objc(SwiftClassName) above your swift class.
Like:
#objc(SubClass)
class SubClass: SuperClass {...}
Then all of your original Objective-c code will see these classes and not try to do anything funky with them!
Thanks to #klaus
Original post can be found here:
https://stackoverflow.com/a/24448786/846035

Delphi Win32 Programming/Access Violation problems

I wasn't entirely sure how to name this, so apologies in advance.
You see, I'm trying to teach myself Win32/DirectX programming, utilizing Delphi (my language of choice) using this site - http://rastertek.com/tutindex.html
Of course, the site being all in C++, I have to port it to Delphi. It seemed simple enough, at first. I'm on the second tutorial for DirectX 11 - setting up the framework and getting the initial window to show up.
Now for my actual problem. I was getting Access Violation errors. So I found and started to use MadExcept to try and find out what was going on. So it tells me the lines, but I'm clueless as to how to solve the issues at hand.
I have everything set up to mimic as well as I can the original source code. The only real difference being that in the instances where a pointer to a class for a variable, such as the case with m_input, m_grahics, and system, I made a type for those. So I have the TSystemClass, TInputClass, TGraphicsClass, and then I have PSystemClass, etc. that = ^TSystemClass, etc. I figured that this would make things a bit simpler and more neater. On a side note, I assume it should be said, but I for the construction of the copy constructors made the initial classes inherit from TPersistent so I could use it's Assign procedure.
So, back to the Access Violation errors. So first, the problem was in the main program with system being of type PSystemClass. So for a reason unknown to me, when I tried to use system.create, it was at that very instant, creating the access violation. I then realized however that I wasn't assigning system the system.create. So I tried this, and it said that, and rightfully so I suppose, at compile time an error that the two were incompatible since system.create is of type TSystemClass, and system is of PSystemClass. So I tried typecasting it, and that worked. but once again, still getting the dreaded access violations.
So then I had an odd idea, maybe I should call the regular constructor right from the TSystemClass itself. And I tried, needed to typecast again. So I did. And it worked! No longer an access violation error there! Now... New problem! Or rather in this case "problems". There's 3 things now listed in the call stack in MadExcept. The first one:
m_hinstance := GetModuleHandle(nil);
It's saying that this is causing an access violation error. Though why is this, exactly? From what I understand and have read, if GetModuleHandle is set to null/nil, it should retrieve the handle for the file that called it, right? And from what the documentation says, that should be executable.
However note: I'm not sure if the fact that I have the main program, the systemclass stuff, the inputclass stuff, and the graphicsclass stuff, all in different program/unit files to mimic the nature of the original source code. So is this possibly what's causing it? And if so how would I fix it? By putting all of the code from the unit files into the main program file? Though that, in my own personal opinion, would be quite messy and unintuitive.
The next one baffles me even more.
InitializeWindows(ScreenWidth, ScreenHeight);
I'm not dealing with anything other then a function to register the window class and set things up for the window and all here. So I'm not quite sure what the problem here is since it only deals with 2 parameters and they're defined and all already before it's called. So I'm not quite sure what the problem here is at all and what exactly is causing the access violation.
and then finally the final one is in the main program:
return := system.initialize;
Return is what I used in all instances of the result variable of the original source code, as result is of course a built in variable of all functions.
I suppose if system is never able to properly do what it's meant to do then something could/should happen here. Likewise, because I used TSystemClass.Create (typecasted to PSystemClass) earlier to create system would that do anything here? And is it possibly linked to the other two because they're not able to do their own thing properly?
And on a final note; there is one last thing actually on the call stack in MadExcept.
It says Kernel32.dll in the module section, but aside from the main thread, it lists nothing else. (If this information is needed I'll gladly put it up).
Thanks in advance to anyone who's read this far and I hope to find some help on this problem so I may further my studies.
You're instantiating your classes all wrong. Here's an example from TSystemClass.Initialize:
m_Input := PInputClass(m_Input.create);
That's a variable you declared as a PInputClass.
Earlier, in TSystemClass.Create, you initialized that variable:
m_Input := nil;
So, since you have a null reference, it should be clear that you can't call any methods on it. In particular, you cannot call Create on it. Instead, call Create on the class you want to instantiate: TInputClass.Create.
That constructor returns a value of the type you constructed, a TInputClass. It doesn't return a PInputClass, so your type-cast is wrong. As Cosmin's comment explains, Delphi object variables are already pointers. It's exceedingly rare to have to declare a pointer type based on Delphi classes. The correct code is this:
m_Input := TInputClass.Create;
After that line, you check whether m_Input is null. You never have to do that in Delphi; a constructor either returns a valid object, or it doesn't return at all. If there's a problem constructing an object, the constructor throws an exception and the assignment statement never executes. (The original C++ code does it wrong, too. The new operator hasn't returned a null pointer on failure for over a decade, long before anyone was in a position to start writing a DirectX 11 tutorial.)
You should first of all try to get rid of the TPersistent inheritance. If you want to pass an object to a library its interface should be exactly the same as the original that is used in C++. By inheriting from TPersistent you take a whole lot of load into your class that might be not needed or might even be the reason of your problems.
Additionally it would help if you posted the exact output of the exceptions. Or even the CallStack. That might help tracing down the error.

Please help me with ASP.NET MVC Paging error

I am getting the following error in my mvc application when I am doing the paging functionality
CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'HasPreviousPage' and no extension method 'HasPreviousPage' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
please tell me what to do and what is that Model.
This reminds me of the PaginatedList<T> class found in the Conery et al MVC 1.0 Wrox book... (And probably also found in the NerdDinner app.) I actually have this book right here next to me and have this section tabbed. And sure enough they have a property called HasPreviousPage, which leads me to guess this is what you are working with? It is in Chapter 1, which is a free download. (Google for it.) I highly recommend taking a look at this chapter, or at least this section, as there are many other helpful suggestions and tips to be found!
Best of luck!
I think that you may be missing a namespace import.
Is HasPreviousPage a method or a property? If it is a helpermethod on the type of list you are returning then you need to import that namespace in your aspx file (or in the web.config to reflect on all pages)
You need to change the controller to use Paging, check out http://blogs.embarcadero.com/johnk/2009/04/02/38871 for more info
EDIT: To clarify, so somewhere in the Controller, you're gonna see something to the effect of "return View(someModelObject)" - you need to use PaginationHelper.AsPagination here to turn someModelObject into a pageable object
There are a few possibilities here:
First off, Model is your object, or class. HasPreviousPage is a method or function in Model.
Here are some possibilities:
Model is not defined because the file is not included in the page
HasPreviousPage does not exist as a method
HasPreviousPage is actually a property and needs more information to extract data (as tster is saying)
The signature for HasPreviousPage is incorrect. You are sending too much, or not enough data.
My guess is it's either a boolean property, or a method that returns a boolean. Either way the compiler has no idea what to do with it, so you need to track it down. Try doing a find in your solution for "HasPreviousPage". See if it's been referenced anywhere, or where it is located.
Ctrl + F
Find What:
HasPreviousPage
Look In:
Entire Solution

Resources