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
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.
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#
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("Hosted Server :" + job.HostingPrintServer.Name.ToString());
UpdateText("No of Pages :" + job.NumberOfPages.ToString());
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:
So when we add a child object to one of those collections of SharedObj, we have a method like this:
// 'entity' is of type 'SharedObj'publicvoid AddObj(ObjType objType, int objId)
// case/break for each remaining entity type
"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.
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.
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/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.
Last Visit: 31-Dec-99 19:00 Last Update: 3-Feb-23 19:20