Search Results

Search found 6357 results on 255 pages for 'generic relations'.

Page 62/255 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • Search Engine Optimization PR - Is it Buzz Worthy Or Over Hyped?

    Public Relations (PR) is a business practice that plays a pivotal role in defining a business' relationship with its employees, customers, and shareholders. Good PR strengthens brands and builds the public's trust in it - the primary reason most businesses have PR professionals to take care of public communications such as conferences, press releases, social media engagement, crisis communication, and media and employee communications.

    Read the article

  • Card Shuffling in C#

    - by Jeff
    I am trying to write a code for a project that lists the contents of a deck of cards, asks how much times the person wants to shuffle the deck, and then shuffles them. It has to use a method to create two random integers using the System.Random class. These are my classes: Program.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { Deck mydeck = new Deck(); foreach (Card c in mydeck.Cards) { Console.WriteLine(c); } Console.WriteLine("How Many Times Do You Want To Shuffle?"); } } } Deck.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Deck { Card[] cards = new Card[52]; string[] numbers = new string[] { "2", "3", "4", "5", "6", "7", "8", "9", "J", "Q", "K" }; public Deck() { int i = 0; foreach(string s in numbers) { cards[i] = new Card(Suits.Clubs, s); i++; } foreach (string s in numbers) { cards[i] = new Card(Suits.Spades, s); i++; } foreach (string s in numbers) { cards[i] = new Card(Suits.Hearts, s); i++; } foreach (string s in numbers) { cards[i] = new Card(Suits.Diamonds, s); i++; } } public Card[] Cards { get { return cards; } } } } classes.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { enum Suits { Hearts, Diamonds, Spades, Clubs } } Card.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Card { protected Suits suit; protected string cardvalue; public Card() { } public Card(Suits suit2, string cardvalue2) { suit = suit2; cardvalue = cardvalue2; } public override string ToString() { return string.Format("{0} of {1}", cardvalue, suit); } } } Please tell me how to make the cards shuffle as much as the person wants and then list the shuffled cards. Sorry about the formatting im new to this site.

    Read the article

  • Linq to List and IEnumerable issues

    - by Otaku
    I am querying an HTML file with Linq. It looks something like this: <html> <body> <div class="Players"> <div class="role">Goalies</div> <div class="name">John Smith</div> <div class="name">Shawn Xie</div> <div class="role">Right Wings</div> <div class="name">Jack Davis</div> <div class="name">Carl Yuns</div> <div class="name">Wayne Gortonia</div> <div class="role">Centers</div> <div class="name">Lutz Gaspy</div> <div class="name">John Jacobs</div> </div </html> </body> What I'm trying to do is create a list of these folks like in a list of a structure called Players: Structure Players Public Name As String Public Position As String End Structure But I've quickly found out I don't really know what I'm doing when it comes to Linq. I've got this far my my queries: Dim goalieList = From d In player.Elements _ Where d.Value = "Goalies" _ Select From g In d.ElementsAfterSelf _ Take While (g.@class <> "role") _ Select New Players With {.Position = "Goalie", _ .Name = g.Value} Dim centersList = From d In player.Elements _ Where d.Value = "Centers" _ Select From g In d.ElementsAfterSelf _ Take While (g.@class <> "role") _ Select New Players With {.Position = "Centers", _ .Name = g.Value} Which gets me down to the the players by position, but then I can't do much with this afterwards the result type is System.Collections.Generic.IEnumerable(Of System.Collections.Generic.IEnumerable(Of Player)) What I want to do is add these two results to a new list, like: Dim playersList As List(Of Players) = Nothing playersList.AddRange(centersList) playersList.AddRange(goalieList) So that I can then query the list and use it. But it kicks the error: Unable to cast object of type 'WhereSelectEnumerableIterator2[System.Xml.Linq.XElement,System.Collections.Generic.IEnumerable1[Players]]' to type 'System.Collections.Generic.IEnumerable`1[Players]' As you can see, I may really have no idea how to work with all these objects/classes. Does anyone have any insight on what I may be doing wrong and how I can resolve it? RESOLVED: The Linq query needs to return a single iEnumerable, like this: Dim goalieList = From l In _ (From d In players.Elements _ Where d.Value = "Goalies" _ Select d.ElementsAfterSelf.TakeWhile(Function(f) f.@class <> "role")) _ Select New Players With {.Position = "Goalie", .Name = l.Value} and then use goalieList.ToList

    Read the article

  • Hibernate GenericDAO for parent/child relationships and DAO/DTO patterns

    - by Marco
    Hi, I'm looking for a Generic DAO implementation in Hibernate that includes parent/child relationship management (adding, removing, getting childs, setting parents, etc). Actually the most used generic DAO on the web is the one i found on http://community.jboss.org/wiki/GenericDataAccessObjects. And also, i was looking for some DAO/DTO sample implementations and design patterns. Do you know some good resources out there?

    Read the article

  • How to have Moose return a child class instance instead of its own class, for polymorphism

    - by alex8657
    I want to create a generic class, whose builder would not return an instance of this generic class, but an instance of a dedicated children class. As Moose does automatic object building, i do not get to understand if this something possible, and how to create a Moose class with Moose syntax and having this behaviour Eg: The user asks: $file = Repository-new(uri='sftp://blabla') .... and is returned an Repository::_Sftp instance User would use $file as if it is a Repository instance, without the need to know the real subclass (polymorphism)

    Read the article

  • C# cast Foo<Bar> to Foo<object>

    - by Michael
    Hi, does anyone know if it is possible to cast a generic type with a certain type parameter (e.g. Bar) to the same generic type with the type parameter being a base type of Bar (such as object in my case). And, if it is possible, how would it be done? What I want to do is have a collection of Foo but be able to add Foos with more specific type arguments. Thanks

    Read the article

  • LINQ "table" variable

    - by Cat
    I'm trying to turn a method I have right now into a more "generic" method that returns a string. Right now, the method uses a statement like this: var app = (from d in testContext.DAPPs where d.sserID == (Guid)user.ProviderUserKey select d).ToList(); I process the results of "app", add extra text etc. The piece that changes (that I need to make more "generic") is the table name (DAPPs). Is there a way I can do that, or, a better way to go around this all together?

    Read the article

  • Move item up in IEnumerable

    - by Nina
    Hi I have a need to move an item in an IEnumerable< up, that is move one item above another. What is the simplest way to do this? A similar question was asked here but I don't have a generic list only an IEnumerable<: http://stackoverflow.com/questions/450233/generic-list-moving-an-item-within-the-list

    Read the article

  • basic client/server programming

    - by Zachary
    I am new to web programming...I have been asked to create a simple Internet search application which would allow transmit to the browser some data stored remotely in the server. Considering the client/server architecture (which I am new to) I would like to know if the "client" is represented only by the Internet browser and therefore the entire code of the web application should be stored in the server. As it's a very generic question a generic answer is also well accepted.

    Read the article

  • Fatal IO error 0 (Success) on X server

    - by Ori Pessach
    What does the error "Fatal IO error 0 (Success) on X server" mean? The error is produced when an X client tries to call XvCreateImage(), and it results in the client terminating. X.0.log shows the following version information: X.Org X Server 1.6.4 Release Date: 2009-9-27 X Protocol Version 11, Revision 0 Build Operating System: Linux 2.6.24-23-server i686 Ubuntu Current Operating System: Linux ori-laptop 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 16:20:31 UTC 2009 i686 Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.31-17-generic root=UUID=df637de9-47ed-4453-9393-67e2e2ffaa2f ro quiet splas

    Read the article

  • Cannot call action method 'System.Web.Mvc.PartialViewResult Foo[T](T)' on controller 'Controller' be

    - by MedicineMan
    Cannot call action method 'System.Web.Mvc.PartialViewResult FooT' on controller 'Controller' because the action method is a generic method <% Html.RenderAction("Foo", model = Model}); %> Is there a workaround for this limitation on ASP MVC 2? I would really prefer to use a generic. The workaround that I have come up with is to change the model type to be an object. It works, but is not preferred: public PartialViewResult Foo<T>(T model) where T : class { // do stuff }

    Read the article

  • Can you add items to a context menu in a parents menu?

    - by Joel Barsotti
    or conversly can you import a parents menu items into a child window? So I have an UI that is composed of controls that all have their own context menu, but we also have a datagrid that get's nested inside our generic contaier. So when you right click the datagrid elements I want to show both the context items I've created for the datagrid and the items from the generic container.

    Read the article

  • Storing GenericForeignKey content_type in another model?

    - by slypete
    I have a typical definition/instance situation in my data modeling. I'm trying to store the content_type of a GenericForeignKey in another model (the definition model) like so: class IndicatorFieldInstance(models.Model): definition = models.ForeignKey(IndicatorField) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey(definition.content_type, 'object_id') indicator_instance = models.ForeignKey(IndicatorInstance) I've also tried it like this: content_object = generic.GenericForeignKey('definition__content_type', 'object_id') Neither of these methods seem to work. Is it possible to achieve this? For reference, here's the definition model: class IndicatorField(models.Model): name = models.CharField(max_length='255') content_type = models.ForeignKey(ContentType) indicator = models.ForeignKey(Indicator) Thanks, Pete

    Read the article

  • Having trouble returning a value from a method call when sending an array and the program is error out when run in reference to the sort

    - by programmerNOOB
    I am getting the following output when this program is run: Please enter the Social Security Number for taxpayer 0: 111111111 Please enter the gross income for taxpayer 0: 20000 Please enter the Social Security Number for taxpayer 1: 555555555 Please enter the gross income for taxpayer 1: 50000 Please enter the Social Security Number for taxpayer 2: 333333333 Please enter the gross income for taxpayer 2: 5464166 Please enter the Social Security Number for taxpayer 3: 222222222 Please enter the gross income for taxpayer 3: 645641 Please enter the Social Security Number for taxpayer 4: 444444444 Please enter the gross income for taxpayer 4: 29000 Taxpayer # 1 SSN: 111111111, Income is $20,000.00, Tax is $0.00 Taxpayer # 2 SSN: 555555555, Income is $50,000.00, Tax is $0.00 Taxpayer # 3 SSN: 333333333, Income is $5,464,166.00, Tax is $0.00 Taxpayer # 4 SSN: 222222222, Income is $645,641.00, Tax is $0.00 Taxpayer # 5 SSN: 444444444, Income is $29,000.00, Tax is $0.00 Unhandled Exception: System.InvalidOperationException: Failed to compare two elements in the array. --- System.ArgumentException: At least one object must implement IComparable. at System.Collections.Comparer.Compare(Object a, Object b) at System.Collections.Generic.ObjectComparer`1.Compare(T x, T y) at System.Collections.Generic.ArraySortHelper`1.SwapIfGreaterWithItems(T[] keys, IComparer`1 comparer, Int32 a, Int32 b) at System.Collections.Generic.ArraySortHelper`1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer) at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) --- End of inner exception stack trace --- at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer) at System.Array.Sort[T](T[] array) at Assignment5.Taxpayer.Main(String[] args) in Program.cs:line 150 Notice the 0s at the end of the line that should be the tax amount??? Here is the code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace taxes { class Rates { // Create a class named rates that has the following data members: private int incLimit; private double lowTaxRate; private double highTaxRate; // use read-only accessor public int IncomeLimit { get { return incLimit; } } public double LowTaxRate { get { return lowTaxRate; } } public double HighTaxRate { get { return highTaxRate; } } //A class constructor that assigns default values public Rates() { int limit = 30000; double lowRate = .15; double highRate = .28; incLimit = limit; lowTaxRate = lowRate; highTaxRate = highRate; } //A class constructor that takes three parameters to assign input values for limit, low rate and high rate. public Rates(int limit, double lowRate, double highRate) { } // A CalculateTax method that takes an income parameter and computes the tax as follows: public int CalculateTax(int income) { int limit = 0; double lowRate = 0; double highRate = 0; int taxOwed = 0; // If income is less than the limit then return the tax as income times low rate. if (income < limit) taxOwed = Convert.ToInt32(income * lowRate); // If income is greater than or equal to the limit then return the tax as income times high rate. if (income >= limit) taxOwed = Convert.ToInt32(income * highRate); return taxOwed; } } //end class Rates // Create a class named Taxpayer that has the following data members: public class Taxpayer { //Use get and set accessors. string SSN { get; set; } int grossIncome { get; set; } // Use read-only accessor. public int taxOwed { get { return taxOwed; } } // The Taxpayer class should be set up so that its objects are comparable to each other based on tax owed. class taxpayer : IComparable { public int taxOwed { get; set; } public int income { get; set; } int IComparable.CompareTo(Object o) { int returnVal; taxpayer temp = (taxpayer)o; if (this.taxOwed > temp.taxOwed) returnVal = 1; else if (this.taxOwed < temp.taxOwed) returnVal = -1; else returnVal = 0; return returnVal; } // End IComparable.CompareTo } //end taxpayer IComparable class // **The tax should be calculated whenever the income is set. // The Taxpayer class should have a getRates class method that has the following. public static void GetRates() { // Local method data members for income limit, low rate and high rate. int incLimit = 0; double lowRate; double highRate; string userInput; // Prompt the user to enter a selection for either default settings or user input of settings. Console.Write("Would you like the default values (D) or would you like to enter the values (E)?: "); /* If the user selects default the default values you will instantiate a rates object using the default constructor * and set the Taxpayer class data member for tax equal to the value returned from calling the rates object CalculateTax method.*/ userInput = Convert.ToString(Console.ReadLine()); if (userInput == "D" || userInput == "d") { Rates rates = new Rates(); rates.CalculateTax(incLimit); } // end if /* If the user selects to enter the rates data then prompt the user to enter values for income limit, low rate and high rate, * instantiate a rates object using the three-argument constructor passing those three entries as the constructor arguments and * set the Taxpayer class data member for tax equal to the valuereturned from calling the rates object CalculateTax method. */ if (userInput == "E" || userInput == "e") { Console.Write("Please enter the income limit: "); incLimit = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter the low rate: "); lowRate = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter the high rate: "); highRate = Convert.ToDouble(Console.ReadLine()); Rates rates = new Rates(incLimit, lowRate, highRate); rates.CalculateTax(incLimit); } } static void Main(string[] args) { Taxpayer[] taxArray = new Taxpayer[5]; Rates taxRates = new Rates(); // Implement a for-loop that will prompt the user to enter the Social Security Number and gross income. for (int x = 0; x < taxArray.Length; ++x) { taxArray[x] = new Taxpayer(); Console.Write("Please enter the Social Security Number for taxpayer {0}: ", x + 1); taxArray[x].SSN = Console.ReadLine(); Console.Write("Please enter the gross income for taxpayer {0}: ", x + 1); taxArray[x].grossIncome = Convert.ToInt32(Console.ReadLine()); } Taxpayer.GetRates(); // Implement a for-loop that will display each object as formatted taxpayer SSN, income and calculated tax. for (int i = 0; i < taxArray.Length; ++i) { Console.WriteLine("Taxpayer # {0} SSN: {1}, Income is {2:c}, Tax is {3:c}", i + 1, taxArray[i].SSN, taxArray[i].grossIncome, taxRates.CalculateTax(taxArray[i].grossIncome)); } // end for // Implement a for-loop that will sort the five objects in order by the amount of tax owed Array.Sort(taxArray); Console.WriteLine("Sorted by tax owed"); for (int i = 0; i < taxArray.Length; ++i) { Console.WriteLine("Taxpayer # {0} SSN: {1}, Income is {2:c}, Tax is {3:c}", i + 1, taxArray[i].SSN, taxArray[i].grossIncome, taxRates.CalculateTax(taxArray[i].grossIncome)); } } //end main } // end Taxpayer class } //end Any clues as to why the dollar amount is coming up as 0 and why the sort is not working?

    Read the article

  • How can I specify a relative path in a Python logging config file?

    - by ClaudioA
    I've the following file to config logging: [loggers] keys=root [handlers] keys = root [formatters] keys = generic # Loggers [logger_root] level = DEBUG handlers = root # Handlers [handler_root] class = handlers.RotatingFileHandler args = ("test.log", "maxBytes=1*1024*1024", "backupCount=10") level = NOTSET formatter = generic # Formatters [formatter_generic] format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s datefmt = %Y-%m-%d %H:%M:%S In Development this works great, but when I deploy the application test.log is trying to be written in a path in which I don't have the necessary permission. So my question is, How can I do to specify a relative path in this configuration file.

    Read the article

  • More trivia than really important: Why no new() constraint on Activator.CreateInstance<T>() ?

    - by flq
    I think there are people who may be able to answer this, this is a question out of curiosity: The generic CreateInstance method from System.Activator, introduced in .NET v2 has no type constraints on the generic argument but does require a default constructor on the activated type, otherwise a MissingMethodException is thrown. To me it seems obvious that this method should have a type constraint like Activator.CreateInstance<T>() where T : new() { ... } Just an omission or some anecdote lurking here?

    Read the article

  • Convert IDictionary to Dictionary

    - by croisharp
    I have to convert System.Collections.Generic.IDictionary<string, decimal> to System.Collections.Generic.Dictionary<string, decimal>, and i can't. I tried the ToDictionary method and can't specify right arguments. I've tried the following: // my dictionary is PlannedSurfaces (of type IDictionary<string, decimal>) blabla.ToDictionary<string, decimal>(localConstruction.PlannedSurfaces)

    Read the article

  • How do I get all the calendar entries for a particular time range using Google Calendar API

    - by BeWarned
    I want to view events over specific time range for a specific calendar, but am having trouble using the API, It is a generic API, and it reminds me of using the DOM. The problem is that it seems difficult to work with because much of the information is in generic base classes. How do I get the events for a calendar using Groovy or Java? Does anybody have an example of passing credentials using curl? Example code would be appreciated.

    Read the article

  • Django: select_related and GenericRelation

    - by Parand
    Does select_related work for GenericRelation relations, or is there a reasonable alternative? At the moment Django's doing individual sql calls for each item in my queryset, and I'd like to avoid that using something like select_related. class Claim(models.Model): proof = generic.GenericRelation(Proof) class Proof(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') I'm selecting a bunch of Claims, and I'd like the related Proofs to be pulled in instead of queried individually.

    Read the article

  • Is there a way to get direct_to_template to pass RequestContext in django?

    - by BigJason
    I have found myself writing the same view over and over. It is basically this: def home_index(request): return render_to_response('home/index.html', RequestContext(request)) To keep with the dry principal, I would like to utilize a generic view. I have seen direct_to_template, but it passes an empty context. So how can I use a generic view and still get the power of RequestContext?

    Read the article

  • Ubuntu 9.10 Server (minimal virtual machine) partitioning

    - by John
    I am setting up a generic Ubuntu server and am trying to figure out the (best) way to partition the machine. Again, this is just a generic one: The default drive is 20GB. Some guides show: Separate /home, /usr, /var and /tmp partitions Another one suggested something like this: / 4GB /boot 512MB /tmp 1GB /home 5GB /usr 5GB /var 5GB What is the best way to accomplish this?

    Read the article

  • PowerShell function won't return object

    - by Dan
    I have a simple function that creates a generic List: function test() { $genericType = [Type] "System.Collections.Generic.List``1" [type[]] $typedParameters = ,"System.String" $closedType = $genericType.MakeGenericType($typedParameters) [Activator]::CreateInstance($closedType) } $a = test The problem is that $a is always null no matter what I try. If I execute the same code outside of the function it works properly. Thoughts?

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >