|
|
i hard dependency injection can be implemented like constructor injection, getter/setter injection, service locator. i just know the term but not well familiar how to implement it writing code. so anyone can redirect me to good starter article on dependency injection implementation with many ways like constructor injection, getter/setter injection, service locator etc. thanks
tbhattacharjee
|
|
|
|
|
How about starting to do some research on your own before you post these very broad open-ended questions ?
Like: searching CodeProject, and reading relevant articles here ?
« I had therefore to remove knowledge, in order to make room for belief » Immanuel Kant
|
|
|
|
|
|
I have updated my answer. Please look in to that link.
Please up vote if it helped you
Thanks And Regards
Sibeesh
|
|
|
|
|
I want to make USB Blocker Using vb.net or C# in windows Application.Can anyone help me
|
|
|
|
|
Do you want to disable the USB ports in the PC?
|
|
|
|
|
Yes. But keyboard and mouse will be work.
Thanking you
|
|
|
|
|
|
thank you sir.I want to show on Windows balloon tool tip and the taskbar notification area when the software is running.Please Help
Thanking you
|
|
|
|
|
Eh, what software?
Is this a new question or related to blocking USB ports?
|
|
|
|
|
yes its related to USB port.I implement the software it work in windows platform. I want to run this software in Linux platform.Is it possible?
Thanking You,
Regards
Debapriyo Saha
|
|
|
|
|
I have no idea, but you do have a browser on your computer, right?
Then follow these steps and you will find the answer.
1. Start your browser.
2. Select your favorite search engine, like Google or Bing or whatever.
3. Copy this string "block USB ports linux" into the search field.
4. Press Enter or click the search button.
5. Select one of the links that will appear.
6. Read about the subject.
7. Solve the problem.
8. Done.
|
|
|
|
|
If you just want to disable/enable all USB ports you can use this code. Note, you must have administrator privileges to change the registry.
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);
Read More : code for USB Blocking in c#[^]
Please up vote if it helped you
Thanks And Regards
Sibeesh
|
|
|
|
|
I am having a no of word files .Each word file have some common heading.I want to retrieve the content under the common heading from all files.
For example for a no of resumes have the same heading like objective,qualification etc.I want to list the content under these particular heading using c#
Anybody know please help me to solve
|
|
|
|
|
|
Here is my code. I Get the printticket from print job. I Need Printjob informations like copycount, media size, media type, duplex printing and other details. But I can default values from the printticket like copycount is always 1 and sometime no. of pages in job also comes 0. Now struggle with this problem. I Need Help to solve this problem.
PrintServer myPrintServer = new PrintServer(@"\\MyMachine");
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
foreach (PrintQueue pq in myPrintQueues)
{
if (pq.QueueStatus != PrintQueueStatus.Error)
{
foreach (PrintSystemJobInfo job in pq.GetPrintJobInfoCollection())
{
if (bNewJob == true)
{
PrintTicket pt = job.HostingPrintQueue.CurrentJobSettings.CurrentPrintTicket;
UpdateText("Current Copies : " + pt.CopyCount.Value.ToString());
UpdateText("Default Copies : " + dpt.CopyCount.Value.ToString());
UpdateText("User Copies : " + upt.CopyCount.Value.ToString());
UpdateText("Full Name :" + job.HostingPrintQueue.FullName.ToString());
UpdateText("Job ID : " + job.JobIdentifier.ToString());
UpdateText("Job Name : " + job.JobName.ToString());
DateTime dt = job.TimeJobSubmitted;
UpdateText("Submitter :" + job.Submitter.ToString());
UpdateText("Date:"+dt.Day.ToString()+"/"+dt.Month.ToString()+"/"+ dt.Year.ToString());
UpdateText("Hosted Server :" + job.HostingPrintServer.Name.ToString());
UpdateText("No of Pages :" + job.NumberOfPages.ToString());
}
}
}
}
Have A Nice Day!
Murali.M
Blog
|
|
|
|
|
While this project I'm on is MVC, this question isn't specific to MVC, so I felt like this was the right place. Anyhow, we are using the Repository pattern for data access. One particular entity type, e.g. SharedObj, has several other entity types that the SharedObj entity can be tied to. Each is an IEnumerable, like this:
public class SharedObj
{
IEnumerable<Obj1> Obj1s;
IEnumerable<Obj2> Obj2s;
IEnumerable<Obj3> Obj3s;
}
So when we add a child object to one of those collections of SharedObj, we have a method like this:
public void AddObj(ObjType objType, int objId)
{
switch (objType)
{
case ObjType.Obj1:
entity.Obj1s.Add(GetRepository<Obj1>().GetByID(objId);
break;
case ObjType.Obj2:
entity.Obj2s.Add(GetRepository<Obj2>().GetByID(objId);
break;
case ObjType.Obj3:
entity.Obj3s.Add(GetRepository<Obj3>().GetByID(objId);
break;
}
}
"ObjType" is an enumeration of object types. The "GetRepository" method calls "DependencyResolver.Current.GetService<irepository<t>>();" and we use Unity for dependency injection.
Is there a way to make a more generic "Add" call based on the supplied "ObjType"? Or is this the only concept that can be applied in order to achieve what we're doing?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Map an Action to the enum in a dictionary and execute the appropriate entry when you need to use it.
|
|
|
|
|
Similar to what Pete said; I'd prefer to use a Dictionary<type,List<whatever>>
And I think that having AddObj perform GetRepository and GetByID violates the Single Responsibility Principle.
By passing in the object, you could probably also leverage generics and simplify things even more.
|
|
|
|
|
Hello,
i need integrate any bill acceptor in my c# application. Can you help me please? Do you know if exist any library in c#?
Beste Regards.
|
|
|
|
|
You mean like PayPal or something? Where are you stuck? You'll have to contact whatever vendor you want to work with and get their SDK documentation.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Do you know any bill aceptor model that i can buy that have a sdk in c#?
i have't find a sdk in c# but only in visual c o java.
I need urgently to acept bill in my c# program.
thanks
|
|
|
|
|
I don't know of any products that will integrate with multiple payment processors, although there probably are some.
If you want to use PayPal then refer to https://developer.paypal.com/docs/api/[^]
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi every one.
I want to create all rhythmic figures in music. I have an array for durations:
public static double[] duration_fltarray = new double[7];
duration_fltarray[0] = 1;
duration_fltarray[1] = 0.5;
duration_fltarray[2] = 0.25;
duration_fltarray[3] = 0.125;
duration_fltarray[4] = 0.625;
duration_fltarray[5] = 0.3125;
duration_fltarray[6] = 0.15625;
This array shows music times: 1 - 1/2 - 1/4 - 1/8 and so on.
I think it should be written by recursive function, because I couldn't do it by while and for loop.
Now, I need all sorted figures that sum of them are equal 1. For example:
1
1/2 - 1/2
1/2 - 1/4 - 1/4
1/4 - 1/2 - 1/4
1/4 - 1/4 - 1/2
1/4 - 1/4 - 1/4 - 1/4
1/8 - 1/2 - 1/4 - 1/8
1/8 - 1/2 - 1/8 - 1/4
1/8 - 1/2 - 1/8 - 1/8 - 1/8
...
Of course, number of figures will be too many more if we add 1/16 and 1/32 and ... .
I can print them in a web page(response.write) or in a c console; it's not important. But the algorithm should be as simple as possible.
Thank you all.
|
|
|
|