|
I followed your advice, but assumed that anyone with experience with this subject may be able to shed some light. Wasn't really sure how likely I would be to get a response as the article was initially published in 2015.
|
|
|
|
|
That's only two years ago! We have active member that have been here 6 times that long - I've been here for over 7 years, and I'm still plugging away...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
see this class code
public class ShipperFactory
{
private static TShip Create<TShip>()
where TShip : IShip,
new()
{
return new TShip();
}
public static readonly IDictionary<Shipper, Func<IShip>> Creators =
new Dictionary<Shipper, Func<IShip>>()
{
{ Shipper.UPS, () => Create<ShipperUPS>() },
{ Shipper.FedEx, () => Create<ShipperFedEx>() },
{ Shipper.Purolator, () => Create<ShipperPurolator>() }
};
public static IShip CreateInstance(Shipper enumModuleName)
{
return Creators[enumModuleName]();
}
}
specially the below code is not clear where
public static readonly IDictionary<Shipper, Func<IShip>> Creators =
new Dictionary<Shipper, Func<IShip>>()
{
{ Shipper.UPS, () => Create<ShipperUPS>() },
{ Shipper.FedEx, () => Create<ShipperFedEx>() },
{ Shipper.Purolator, () => Create<ShipperPurolator>() }
};
1) see this line whose meaning is not clea. what is the meaning of Func<iship> ?
new Dictionary<shipper, func<iship="">>()
Dictionary usage is not clear. help me to understand the code of Dictionary and as well as ShipperFactory class.
it is required to use both interface and abstract class ? is it not redundant here ?
here giving the full code which show how i am using ShipperFactory class
calling like this way
--------------------------
private void btnUPS_Click(object sender, EventArgs e)
{
ShipperFactory.CreateInstance(Shipper.UPS).Ship();
}
private void btnFedEx_Click(object sender, EventArgs e)
{
ShipperFactory.CreateInstance(Shipper.FedEx).Ship();
}
private void btnPurolator_Click(object sender, EventArgs e)
{
ShipperFactory.CreateInstance(Shipper.Purolator).Ship();
}
public enum Shipper
{
UPS,
FedEx,
Purolator
}
public interface IShip
{
void Ship();
}
public abstract class ShipperBase : IShip
{
public abstract void Ship();
}
public class ShipperUPS : ShipperBase
{
public override void Ship()
{
MessageBox.Show("UPS ship start");
}
}
public class ShipperFedEx : ShipperBase
{
public override void Ship()
{
MessageBox.Show("FedEX ship start");
}
}
public class ShipperPurolator : ShipperBase
{
public override void Ship()
{
MessageBox.Show("Purolator ship start");
}
}
public class ShipperFactory
{
private static TShip Create<TShip>()
where TShip : IShip,
new()
{
return new TShip();
}
public static readonly IDictionary<Shipper, Func<IShip>> Creators =
new Dictionary<Shipper, Func<IShip>>()
{
{ Shipper.UPS, () => Create<ShipperUPS>() },
{ Shipper.FedEx, () => Create<ShipperFedEx>() },
{ Shipper.Purolator, () => Create<ShipperPurolator>() }
};
public static IShip CreateInstance(Shipper enumModuleName)
{
return Creators[enumModuleName]();
}
}
looking for help. thanks
tbhattacharjee
|
|
|
|
|
The dictionary contains a "key" for each carrier and a "function" (value) that is used to create an instance of that carrier.
Over-engineered and pointless indirection (IMO).
(A "carrier" class and a "carrier id / ident" would be simpler).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
DNFTHV *
* Do not feed the Help Vampire
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It's actually passive aggression
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Some of these don't deserve "passive" - they just don't want to think for themselves...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Tridip Bhattacharjee wrote: looking for help Try asking the person who wrote the code.
|
|
|
|
|
i want to create a dynamic report ( ADD columns at run time ) with ASP.NET MVC 5
i tired for this , but there is no result for now
could you help me, please ???
|
|
|
|
|
Show us what you tried, and we would help make it work.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
He knew someone would advise if you can get in a desktop application username and password from the form to the current web page, which I have just entered? If yes, how? Thanks for any reply
Thanks.
Lubos
|
|
|
|
|
Your "question" makes no sense at all.
If you're asking how to grab the username and password from a Windows Forms app in javascript code in a web page, you can't.
|
|
|
|
|
Thank you Dave.
The page is opened. I just write username and password to to this page or to login form on page. I want to get this data to string in my desktop application. It is possible?
Best regards.
Thanks.
Lubos
|
|
|
|
|
These are the things that I have just written.
Thanks.
Lubos
|
|
|
|
|
The last two words. They must to be anywhere in my computer.
Thanks.
Lubos
|
|
|
|
|
Why do you think they must be somewhere?
The username is, probably, because it's a string and doesn't need any protection.
The password? Maybe, maybe not - it depends on the person who wrote the browser and how security aware they are.
But the real problem is: where? Almost certainly not in the same place for all browsers, pretty certainly not in the same place in memory if pages are opened in a different order. And they definitely won't be tagged as "This is the username" or "This is the password" to make them easy to find, because the browser doesn't know - or care - what the data is, though it may store username / password combos when it spots them (that storage is encrypted however, so you won't get it from there.
Basically, if you want to access this kind of stuff, the chances are it going to be:
1) Difficult.
2) Probably malicious.
And there's the rub: We do not condone, support, or assist in the production of malicious code in any way, form, or manner. This is a professional site for professional developers, and there is no good reason for password capture. As far as I can see, you are on your own with this one.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have a feeling that we do not understand each other. I do not want to download passwords that have been saved. I just want to programmatically save to my database username and password that I just wrote that I did not have to write again. I write two words and I want to save them to the database. I do not want to write it twice. That is all.
Thanks.
Lubos
|
|
|
|
|
Then do it the other way around: store them in your DB and get your app to write them to the browser. That way, you aren't trying to do anything that could be seen as malicious (and is a damn sight easier as well).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
This has already occurred before. But user friendlier seems to me to write a name and password, click the button and it is stored. I have such an idea to capture keystrokes. But this also do not like themselves.
Thanks.
Lubos
|
|
|
|
|
The "browser" can track passwords; why do you think you can do better?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Why better? I want to store all the passwords that I have written to the database.
Best regards
Thanks.
Lubos
|
|
|
|
|
The problem is your code has NO WAY OF
1) identifying a password field in any web page.
2) knowing that field is filled in with a CORRECT password
3) knowing that the form was submitted signalling that the password entry is complete.
There is a reason why you don't see these applications being written the way you're attempting.
|
|
|
|
|
Not important website. Important are the last two words that I wrote.
Thanks.
Lubos
|
|
|
|
|
You'll have to learn "web page automation" then, because not all password fields allow "pasting".
And you might as well tag on a key logger.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thanks. See bellow.
Thanks.
Lubos
|
|
|
|