d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Make Me A Better Programmer - From Step 2
Prev14567810Next
Add Reply New Topic New Poll
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 29 2015 06:27pm
just found out my library has a deal with OverDrive to lend out audio books digitally. and of course their search/browse sucks worse than audible's. *rolls up sleeves* a lot of work ahead of me.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Apr 29 2015 06:43pm
Quote (carteblanche @ Apr 29 2015 08:27pm)
just found out my library has a deal with OverDrive to lend out audio books digitally. and of course their search/browse sucks worse than audible's. *rolls up sleeves* a lot of work ahead of me.


Be a hero, rip all the audiobooks and upload them illegally.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 29 2015 06:54pm
I'm the hero jsp needs, but not the one it deserves right now
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Apr 29 2015 07:52pm
Quote (carteblanche @ Apr 29 2015 07:54pm)
I'm the hero jsp needs, but not the one it deserves right now


we need minko
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 29 2015 08:12pm
Quote (Eep @ Apr 29 2015 09:52pm)
we need minko


he needs ph like a drug addict needs a cig. doesn't help, but reminds them what they're missing.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Apr 29 2015 08:48pm
Hacking on this hardware router lately. The guys who made it locked it down so you can't access it via serial root console, and the external filesystem on the USB is encrypted. I managed to dump the firmware/filesystem via serial and uboot hacks and wrote a ruby script to translate the raw hexdump into a binary image.

Bad part is even after I uncompress it (lzma) among other things, I am left with a JFFS2 image I can't mount to steal the decryption keys :<
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Apr 29 2015 09:52pm
since you guys are out and about tonight -

can anyone offer me a decent website to explain REAL WORLD USE CASES for reflection?

I get introspection, but I read somewhere that introspection is only a part of reflection....that reflection gives us some more power.


I just can't find a single goddamn explanation I understand.

edit:

So far, from what I've read, reflection is apparently:

1: Introspection (getting information about an object at run time, for example)
2: You can invoke methods via strings.

and that is it

This post was edited by Eep on Apr 29 2015 09:53pm
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Apr 29 2015 10:06pm
Reflection is good when you want to be at peace with ones self via meditation.

I really have no idea what reflection or introspection are tbh. Fuck that OOP religious shit.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Apr 29 2015 10:08pm
Quote (AbDuCt @ Apr 29 2015 11:06pm)
Reflection is good when you want to be at peace with ones self via meditation.

I really have no idea what reflection or introspection are tbh. Fuck that OOP religious shit.


that is pretty much my mantra right now....

If I can't get a solid understanding after 2+ hours of research and viewing code which implements it.....then the concept probably SUCKZ MAJOR BALLZ
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 30 2015 06:41am
Quote (Eep @ Apr 29 2015 11:52pm)
since you guys are out and about tonight -

can anyone offer me a decent website to explain REAL WORLD USE CASES for reflection?

I get introspection, but I read somewhere that introspection is only a part of reflection....that reflection gives us some more power.


I just can't find a single goddamn explanation I understand.

edit:

So far, from what I've read, reflection is apparently:

1: Introspection (getting information about an object at run time, for example)
2: You can invoke methods via strings.

and that is it


there are other use cases. we used it at my internship to get around circular dependencies for factories.

so we have a few dozen Entities, each in a different project, and some Entities implement ITaskOwner which is in a common project. so we have a TaskOwnerType (which refers to the entity) and a TaskOwnerId (surrogate key per table). and we have a general screen that explains a Task and you need to see the TaskOwner. so we have a TaskOwnerFactory. normally, you'd try something like this:

Code

public ITaskOwner getTaskOwner(taskOwnerType, taskOwnerId){
ITaskOwner taskOwner = null;
if (taskOwnerType == TaskOwnerType.Document){
taskOwner = new Document().findById(taskOwnerId);
} else if (taskOwnerType == TaskOwnerType.Policy){
taskOwner = new Policy().findById(taskOwnerId);
}
// etc
}


unfortunately, we have a problem. ITaskOwner is part of a "Common" project which all our other projects use as a library. so, if we tried to use the Document class here, we'd get a circular reference and it won't compile. but we can get around that using reflection.

i can't remember the syntax offhand, but something like:

taskOwner = ((Entity)Activator.CreateInstance(Typeof("com.blah.blah.Document"))).findById(taskOwnerId);

by using the full name of the class, we can use reflection to create the instance
Go Back To Programming & Development Topic List
Prev14567810Next
Add Reply New Topic New Poll