Search Results

Search found 316 results on 13 pages for 'silver'.

Page 3/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Measuring the performance of classification algorithm

    - by Silver Dragon
    I've got a classification problem in my hand, which I'd like to address with a machine learning algorithm ( Bayes, or Markovian probably, the question is independent on the classifier to be used). Given a number of training instances, I'm looking for a way to measure the performance of an implemented classificator, with taking data overfitting problem into account. That is: given N[1..100] training samples, if I run the training algorithm on every one of the samples, and use this very same samples to measure fitness, it might stuck into a data overfitting problem -the classifier will know the exact answers for the training instances, without having much predictive power, rendering the fitness results useless. An obvious solution would be seperating the hand-tagged samples into training, and test samples; and I'd like to learn about methods selecting the statistically significant samples for training. White papers, book pointers, and PDFs much appreciated!

    Read the article

  • How to manually (bitwise) perform (float)x? (homework)

    - by Silver
    Now, here is the function header of the function I'm supposed to implement: /* * float_from_int - Return bit-level equivalent of expression (float) x * Result is returned as unsigned int, but * it is to be interpreted as the bit-level representation of a * single-precision floating point values. * Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while * Max ops: 30 * Rating: 4 */ unsigned float_from_int(int x) { ... } We aren't allowed to do float operations, or any kind of casting. Now I tried to implement the first algorithm given at this site: http://locklessinc.com/articles/i2f/ Here's my code: unsigned float_from_int(int x) { // grab sign bit int xIsNegative = 0; int absValOfX = x; if(x < 0){ xIsNegative = 1; absValOfX = -x; } // zero case if(x == 0){ return 0; } //int shiftsNeeded = 0; /*while(){ shiftsNeeded++; }*/ unsigned I2F_MAX_BITS = 15; unsigned I2F_MAX_INPUT = ((1 << I2F_MAX_BITS) - 1); unsigned I2F_SHIFT = (24 - I2F_MAX_BITS); unsigned result, i, exponent, fraction; if ((absValOfX & I2F_MAX_INPUT) == 0) result = 0; else { exponent = 126 + I2F_MAX_BITS; fraction = (absValOfX & I2F_MAX_INPUT) << I2F_SHIFT; i = 0; while(i < I2F_MAX_BITS) { if (fraction & 0x800000) break; else { fraction = fraction << 1; exponent = exponent - 1; } i++; } result = (xIsNegative << 31) | exponent << 23 | (fraction & 0x7fffff); } return result; } But it didn't work (see test error below): Test float_from_int(-2147483648[0x80000000]) failed... ...Gives 0[0x0]. Should be -822083584[0xcf000000] 4 4 0 float_times_four I don't know where to go from here. How should I go about parsing the float from this int?

    Read the article

  • Why this query is so slow?

    - by Silver Light
    This query appears in mysql slow query log: it takes 11 seconds. INSERT INTO record_visits ( record_id, visit_day ) VALUES ( '567', NOW() ); The table has 501043 records and it's structure looks like this: CREATE TABLE IF NOT EXISTS `record_visits` ( `id` int(11) NOT NULL AUTO_INCREMENT, `record_id` int(11) DEFAULT NULL, `visit_day` date DEFAULT NULL, `visit_cnt` bigint(20) DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `record_id_visit_day` (`record_id`,`visit_day`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; What could be wrong? Why this INSERT takes so long?

    Read the article

  • Django: Get bound IP address inside settings.py

    - by Silver Light
    Hello! I want to enable debug (DEBUG = True) For my Django project only if it runs on localhost. How can I get user IP address inside settings.py? I would like something like this to work: #Debugging only on localhost if user_ip = '127.0.0.1': DEBUG = True else: DEBUG = False How do I put user IP address in user_ip variable inside settings.py file?

    Read the article

  • Different Rendering of SimpleModal on IE7 and Chrome

    - by Silver Gun
    Hey Guys I tried out Simple Modal for my modal dialog needs. The jQuery $(function() { $('#showDialog').click(function() { $('<div><p> Click Here! </p></div>').modal({ overlayClose: true, opacity: 30 }) }); }); The CSS was as follows: #simplemodal-overlay { background-color: #000; } #simplemodal-container { background-color: #333; border: 8px solid #444; padding: 12px; } In IE6 and 7, it displays a nice, very transparent, gray overlay with a dark small box in the middle with the text 'Click Here!'. But in CHROME (4.0.249.43) I get a dark black overlay with 100% opacity. Any ideas? Thanks in advance

    Read the article

  • How much information do pdb files contain? (C# / .NET)

    - by Silver Dragon
    Is is wise to redistribute the pdb files along with a commercial application? Occasionally, I'm using the stack trace to get a more detailed error reporting logs from the deployed applications; can this functionality be achieved without relying to those files? Also, how much hints of the original source code does these files contain? Would it be easier to reverse-engineer my application using it?

    Read the article

  • Help on MySQL table indexing when GROUP BY is used in a query

    - by Silver Light
    Thank you for your attention. There are two INNODB tables: Table authors id INT nickname VARCHAR(50) status ENUM('active', 'blocked') about TEXT Table books author_id INT title VARCHAR(150) I'm running a query against these tables, to get each author and a count of books he has: SELECT a. * , COUNT( b.id ) AS book_count FROM authors AS a, books AS b WHERE a.status != 'blocked' AND b.author_id = a.id GROUP BY a.id ORDER BY a.nickname This query is very slow (takes about 6 seconds to execute). I have an index on books.author_id and it works perfectly, but I do not know how to create an index on authors table, so that this query could use it. Here is how current EXPLAIN looks: id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE a ALL PRIMARY,id_status_nickname NULL NULL NULL 3305 Using where; Using temporary; Using filesort 1 SIMPLE b ref key_author_id key_author_id 5 a.id 2 Using where; Using index I've looked at MySQL manual on optimizing queries with group by, but could not figure out how I can apply it on my query. I'll appreciate any help and hints on this - what must be the index structure, so that MySQL could use it?

    Read the article

  • Django: getting the list of related records for a list of objects

    - by Silver Light
    Hello! I have two models related one-to many: class Person(models.Model): name = models.CharField(max_length=255); surname = models.CharField(max_length=255); age = models.IntegerField(); class Dog(models.Model): name = models.CharField(max_length=255); owner = models.ForeignKey('Person'); I want to output a list of persons below each person a list of dogs he has. Here's how I can do it: in view: persons = Person.objects.all()[0:100]; in template: {% for p in persons %} {{ p.name }} has dogs:<br /> {% for d in persons.dog_set.all %} - {{ d.name }}<br /> {% endfor %} {% endfor %} But if I do it like that, Django will execute 101 SQL queries which is very inefficient. I tried to make a custom manager, which will get all the persons, then all the dogs and links them in python, but then I can't use paginator (my another question: http://stackoverflow.com/questions/2532475/django-paginator-raw-sql-query ) and it looks quite ugly. Is there a more graceful way doing this?

    Read the article

  • MySQL: searh by host name in field containing urls

    - by Silver Light
    Hello! I have this database table: id | url ----------------------------------------- 1 | http://stackoverflow.com/ 2 | http://www.google.com 3 | http://example.com/somepage 4 | https://another.net?id=88 5 | http://hello.org/index.php?hello=2 6 | http://google.com?q=hello+world I need to search all fields, where URL belongs to a certain host. For example, if I give the query 'google.com', it will return rows 2 and 6 (www is ignored). I get the host using PHP parse_url() function. How this SQL query would look like?

    Read the article

  • Oracle MAA Part 1: When One Size Does Not Fit All

    - by JoeMeeks
    The good news is that Oracle Maximum Availability Architecture (MAA) best practices combined with Oracle Database 12c (see video) introduce first-in-the-industry database capabilities that truly make unplanned outages and planned maintenance transparent to users. The trouble with such good news is that Oracle’s enthusiasm in evangelizing its latest innovations may leave some to wonder if we’ve lost sight of the fact that not all database applications are created equal. Afterall, many databases don’t have the business requirements for high availability and data protection that require all of Oracle’s ‘stuff’. For many real world applications, a controlled amount of downtime and/or data loss is OK if it saves money and effort. Well, not to worry. Oracle knows that enterprises need solutions that address the full continuum of requirements for data protection and availability. Oracle MAA accomplishes this by defining four HA service level tiers: BRONZE, SILVER, GOLD and PLATINUM. The figure below shows the progression in service levels provided by each tier. Each tier uses a different MAA reference architecture to deploy the optimal set of Oracle HA capabilities that reliably achieve a given service level (SLA) at the lowest cost.  Each tier includes all of the capabilities of the previous tier and builds upon the architecture to handle an expanded fault domain. Bronze is appropriate for databases where simple restart or restore from backup is ‘HA enough’. Bronze is based upon a single instance Oracle Database with MAA best practices that use the many capabilities for data protection and HA included with every Oracle Enterprise Edition license. Oracle-optimized backups using Oracle Recovery Manager (RMAN) provide data protection and are used to restore availability should an outage prevent the database from being able to restart. Silver provides an additional level of HA for databases that require minimal or zero downtime in the event of database instance or server failure as well as many types of planned maintenance. Silver adds clustering technology - either Oracle RAC or RAC One Node. RMAN provides database-optimized backups to protect data and restore availability should an outage prevent the cluster from being able to restart. Gold raises the game substantially for business critical applications that can’t accept vulnerability to single points-of-failure. Gold adds database-aware replication technologies, Active Data Guard and Oracle GoldenGate, which synchronize one or more replicas of the production database to provide real time data protection and availability. Database-aware replication greatly increases HA and data protection beyond what is possible with storage replication technologies. It also reduces cost while improving return on investment by actively utilizing all replicas at all times. Platinum introduces all of the sexy new Oracle Database 12c capabilities that Oracle staff will gush over with great enthusiasm. These capabilities include Application Continuity for reliable replay of in-flight transactions that masks outages from users; Active Data Guard Far Sync for zero data loss protection at any distance; new Oracle GoldenGate enhancements for zero downtime upgrades and migrations; and Global Data Services for automated service management and workload balancing in replicated database environments. Each of these technologies requires additional effort to implement. But they deliver substantial value for your most critical applications where downtime and data loss are not an option. The MAA reference architectures are inherently designed to address conflicting realities. On one hand, not every application has the same objectives for availability and data protection – the Not One Size Fits All title of this blog post. On the other hand, standard infrastructure is an operational requirement and a business necessity in order to reduce complexity and cost. MAA reference architectures address both realities by providing a standard infrastructure optimized for Oracle Database that enables you to dial-in the level of HA appropriate for different service level requirements. This makes it simple to move a database from one HA tier to the next should business requirements change, or from one hardware platform to another – whether it’s your favorite non-Oracle vendor or an Oracle Engineered System. Please stay tuned for additional blog posts in this series that dive into the details of each MAA reference architecture. Meanwhile, more information on Oracle HA solutions and the Maximum Availability Architecture can be found at: Oracle Maximum Availability Architecture - Webcast Maximize Availability with Oracle Database 12c - Technical White Paper

    Read the article

  • Object in Array is not recognised as having "methods"

    - by kevin Mendoza
    I got my application working Awhile back, but after completely and accidentally deleting it, I have tried to create it from square one. unfortunately my rewritten program is a bit cranky; does anyone see or know the possible sources of error? Also, my if statements are acting up. -(void)loadAnnotations { CLLocationCoordinate2D workingCoordinate; iProspectLiteAppDelegate *appDelegate = (iProspectLiteAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableArray *mines =[[NSMutableArray alloc] initWithArray:(NSMutableArray *) appDelegate.mines]; BOOL gold = [[NSUserDefaults standardUserDefaults] boolForKey:@"goldControl"]; BOOL silver = [[NSUserDefaults standardUserDefaults] boolForKey:@"silverControl"]; BOOL copper = [[NSUserDefaults standardUserDefaults] boolForKey:@"copperControl"]; for(id mine in mines) { NSLog(@"in the loop"); workingCoordinate.latitude = [[mine latitudeInitial] doubleValue]; workingCoordinate.longitude = [[mine longitudeInitial] doubleValue]; iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate]; [tempMine setTite:[mine mineName]]; if ([[mine commodity] isEqualToString:@"Gold"] && [gold == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeGold]; [mapView addAnnotation:tempMine]; } if([[mine commodity] isEqualToString:@"Silver"] && [silver == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeSilver]; } if([[mine commodity] isEqualToString:@"Copper"] && [copper == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeCopper]; } } [mines dealloc]; } where the workingCoordinate.latitude = [[mine latitudeInitial] doubleValue], as well as the longitude, and [mine mineName],it says " No '-latitudeInitiallongitudeInitial' method found" or the mineName/LongitudeInitial. also, it complains about : before ] at all the if statement lines. I don't see any errors, do you?

    Read the article

  • Sort MySQL query result by a alphanumeric field

    - by Jason Shultz
    I'm querying a table in a db using php. one of the fields is a column called "rank" and has data like the following: none 1-bronze 2-silver 3-gold ... 10-ambassador 11-president I want to be able to sort the results based on that "rank" column. any results where the field is "none" get excluded, so those don't factor in. As you can already guess, right now the results are coming back like this: 1-bronze 10-ambassador 11-president 2-silver 3-gold Of course, I would like for it to be sorted so it is like the following: 1-bronze 2-silver 3-gold ... 10-ambassador 11-president Right now the query is being returned as an object. I've tried different sort options like natsort, sort, array_multisort but haven't got it to work the way I'm sure it can. I would prefer keeping the results in an object form if possible. I'm passing the data on to a view in the next step. although, it's perfectly acceptable to pass the object to the view and then do the work there. so it's not an issue after all. :) thank you for your help. i'm hoping I'm making sense.

    Read the article

  • Obama’s win and the geeky stuff behind his success

    - by Gopinath
    Mr. Obama is elected as President of United States for the second term with a great majority. Here are few geeky bytes associated with Mr.Obama’s success and the world records he set up Obama Creates New Records on Twitter and Facebook – Just after winning the race for president, Barak Obama setup world records on Twitter & Facebook. His tweet “Four more years” re-tweeted more than 770K times and his Facebook post received 3.8 million likes. Twitter Kills the Fail Whale, One Tweet at a Time – Twitter handled insane user loads with millions of tweets related to election and proved that it’s platform is now more robust than ever. In a post on the company’s engineering blog, Twitter said people sent 31 million election-related tweets on Tuesday alone. From 8:11 p.m. to 9:11 p.m. P.S.T., Twitter processed an average 9,965 tweets per second, with a one-second peak of 15,107 tweets per second at 8:20 p.m., the company said. Obama’s win a big vindication for Nate Silver, king of the quants – Nate Silver, a statistician and blogger was spot on in predicting Obama’s win many weeks. He did not depend on astrology or surveys to predict Obama’s success. He used big data and statistical analysis to project votes. CNET says “Despite some incredulous political pundits, the FiveThirtyEight statistician appears to have correctly predicted the winner in all 50 states in the presidential election” Inside the Secret World of the Data Crunchers Who Helped Obama Win – Team Obama used big data and analytical systems to win the elections!! Barack Obama Goes On Reddit For Last Campaign Stop Of Political Career – Reditt is getting a lot of Obama’s attention these days. He is quite often stopping by Reditt to say hi to the nerds & geeks hanging out there. His chat with nerds on Reddit has paid rich dividends.

    Read the article

  • What are the disadvantages of automated testing?

    - by jkohlhepp
    There are a number of questions on this site that give plenty of information about the benefits that can be gained from automated testing. But I didn't see anything that represented the other side of the coin: what are the disadvantages? Everything in life is a tradeoff and there are no silver bullets, so surely there must be some valid reasons not to do automated testing. What are they? Here's a few that I've come up with: Requires more initial developer time for a given feature Requires a higher skill level of team members Increase tooling needs (test runners, frameworks, etc.) Complex analysis required when a failed test in encountered - is this test obsolete due to my change or is it telling me I made a mistake? Edit I should say that I am a huge proponent of automated testing, and I'm not looking to be convinced to do it. I'm looking to understand what the disadvantages are so when I go to my company to make a case for it I don't look like I'm throwing around the next imaginary silver bullet. Also, I'm explicity not looking for someone to dispute my examples above. I am taking as true that there must be some disadvantages (everything has trade-offs) and I want to understand what those are.

    Read the article

  • Working with Reporting Services Filters – Part 2: The LIKE Operator

    - by smisner
    In the first post of this series, I introduced the use of filters within the report rather than in the query. I included a list of filter operators, and then focused on the use of the IN operator. As I mentioned in the previous post, the use of some of these operators is not obvious, so I'm going to spend some time explaining them as well as describing ways that you can use report filters in Reporting Services in this series of blog posts. Now let's look at the LIKE operator. If you write T-SQL queries, you've undoubtedly used the LIKE operator to produce a query using the % symbol as a wildcard for multiple characters like this: select * from DimProduct where EnglishProductName like '%Silver%' And you know that you can use the _ symbol as a wildcard for a single character like this: select * from DimProduct where EnglishProductName like '_L Mountain Frame - Black, 4_'   So when you encounter the LIKE operator in a Reporting Services filter, you probably expect it to work the same way. But it doesn't. You use the * symbol as a wildcard for multiple characters as shown here: Expression Data Type Operator Value [EnglishProductName] Text Like *Silver* Note that you don’t have to include quotes around the string that you use for comparison. Books Online has an example of using the % symbol as a wildcard for a single character, but I have not been able to successfully use this wildcard. If anyone has a working example, I’d love to see it!

    Read the article

  • Android TableRow RelativeLayout Issue

    - by phogel
    I have the following <TableRow xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/admin_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:background="@color/silver"> I dynamically populate the table but with the relative layout colored silver it only spans about 3/4 of the table row. If I put a LinearLayout with horizontal orientation it spans completely but if I change it to vertical the same problem occurs. I need a relative layout in the table row because I need to something like this: Value Detail MoreDetail. Any ideas on getting the relative layout to span the table row?

    Read the article

  • WPF Linear Fill

    - by Ben
    Hi, I have found some example code that creates a gradient fill in a WPF rectangle control: <Rectangle Height="{Binding ElementName=txtName}" Width="{Binding ElementName=txtName}"> <Rectangle.Fill> <LinearGradientBrush> <GradientStop Color="Silver" Offset="0.0" /> <GradientStop Color="Black" Offset="0.5" /> <GradientStop Color="white" Offset="1.0" /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> I have some written some code that displays a collection of ListBox's that contain details from MyObject: <UserControl.Resources> <DataTemplate x:Key="CustomerTemplate"> <Border BorderThickness="2" BorderBrush="Silver" CornerRadius="5" Padding="1" Height="50"> <Grid x:Name="thisGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" > <Image Source="C:\MyImage.jpg" Height="50" Width="100" ></Image> </StackPanel> <Border Grid.Column="1" Margin="0" Padding="0"> <StackPanel Orientation="Vertical"> <TextBlock Name="txtName" Text="{Binding Name}" Background="Silver" Foreground="Black" FontSize="16" FontWeight="Bold" Height="25"/> </StackPanel> </Border> </Grid> </Border> </DataTemplate> </UserControl.Resources> <ListBox ItemsSource="{Binding}" ItemTemplate="{StaticResource CustomerTemplate}" Name="grdList" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" > </ListBox> I would like to apply the same stlye of fill that i get with the first example, in each of my ListBox's. I can't quite figure out how to do this. Can anyone help? Thanks

    Read the article

  • Using mx.charts in a Flex Hero mobile project

    - by Alexander Farber
    Hello, Adobe states that Charts are supported in mobile projects but when I try to change the following working files (created project with File - New - Flex Mobile Project - Google Nexus One): MyTest.mxml: <?xml version="1.0" encoding="utf-8"?> <s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.MyTestHome"> <s:navigationContent> <s:Button label="Home" click="navigator.popToFirstView();"/> </s:navigationContent> <s:actionContent/> </s:MobileApplication> MyTestHome.mxml: <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Test Chart"> </s:View> to the new MyTestHome.mxml: <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" title="Test Chart"> <fx:Script> <![CDATA[ import mx.collections.*; [Bindable] private var medalsAC:ArrayCollection = new ArrayCollection( [ {Country: "USA", Gold: 35, Silver:39, Bronze: 29 }, {Country:"China", Gold: 32, Silver:17, Bronze: 14 }, {Country:"Russia", Gold: 27, Silver:27, Bronze: 38 } ]); ]]> </fx:Script> <mx:PieChart id="chart" height="100%" width="100%" paddingRight="5" paddingLeft="5" color="0x323232" dataProvider="{medalsAC}" > <mx:series> <mx:PieSeries labelPosition="callout" field="Gold"> <mx:calloutStroke> <s:SolidColorStroke weight="0" color="0x888888" alpha="1.0"/> </mx:calloutStroke> <mx:radialStroke> <s:SolidColorStroke weight="0" color="#FFFFFF" alpha="0.20"/> </mx:radialStroke> <mx:stroke> <s:SolidColorStroke color="0" alpha="0.20" weight="2"/> </mx:stroke> </mx:PieSeries> </mx:series> </mx:PieChart> </s:View> and also add c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\datavisualization.swc c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\sparkskins.swc c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\mx\mx.swc to Flex Build Path (clicking "Add SWC" button): Then it fails with the error: Could not resolve to a component implementation. Does anybody please have an idea here? Alex

    Read the article

  • C# Working with Linq binding

    - by Isuru
    I have designed Types as follow: class Cricket { string type; Team tm; public Team Team { get { return tm; } set { tm = value; } } public string Type { get { return type; } set { type = value; } } } class Team { string country; Players plr; public Players Players { get {return plr; } set { plr = value; } } public string Country { get { return country; } set { country = value; } } } class Players { string name; DateTime dob; int run; public string Name { get { return name; } set { name = value; } } public DateTime DOB { get { return dob; } set { dob = value; } } public int Run { get { return run; } set { run = value; } } } I have to get the following using LINQ techniques. 1) Youngest all data of the youngest player among all teams 2) Oldest Player of each team 3) The highest run scorer will receive Gold Medal,rest of the players of all team will receive Silver medal. (Please look at the GetPlayer() i have declared var Medal=new String[] {"Gold","Silver"} to associate the Medal ) public void GetPlayer() { var TeamMatrix = new Cricket[] { new Cricket{ Type="Twenty20", Team=new Team{ Country="England", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1989"), Name="Russel", Run=45}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="England", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1991"), Name="Joel", Run=56}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="Australia", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1990"), Name="Clark", Run=145}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="Australia", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1971"), Name="Bevan", Run=156}}} }; var Medal = new string[] { "Gold", "Silver" }; var tm = (from mat in TeamMatrix select new { mat.Team.Players.DOB }).Max(); Console.WriteLine("Youngest Age={0}",tm); } When I declare var tm = (from mat in TeamMatrix select new { mat.Team.Players.DOB }).Max(); I receive error atleast one object must implement IComparable. What is the actual way to complete the above three tasks? ( Tasks 1 ,2 ,3 are explained above). Thanks to all.

    Read the article

  • PHP array pointer craziness

    - by JMan
    I'm trying to create a "GetCurrentLevel" method that takes a point value as an input and returns what "Level" that corresponds to. I'm storing the Level = Points mapping in an array, but the array pointer is not moving logically when I use it a foreach loop. I've added echo statements for debugging. Here's my class definition: class Levels extends Model { protected $_map = array ( 'None' => 0, 'Bronze' => 50, 'Silver' => 200, 'Gold' => 500 ); public function __construct() { parent::__construct(); } public function GetCurrentLevel($points) { foreach ($this->_map as $name => $threshold) { echo "Level Name: $name<br/>"; echo "Level Threshold: $threshold<br/>"; echo "Current Level: " . key($this->_map) . "<br/>"; echo "Current Threshold: " . current($this->_map) . "<br/>"; if ($points < $threshold) /* Threshold is now above the points, so need to go back one level */ { $previousThreshold = prev($this->_map); echo "Previous Threshold: $previousThreshold<br/>"; echo "Final Level: " . key($this->_map) . "<br/>"; return key($this->_map); } echo "Go to next level <br/>"; } } And here is what I see when I call GetCurrentLevel(60): Level Name: None Level Threshold: 0 Current Level: Bronze //* Looks like foreach immediately moves the array pointer *// Current Threshold: 50 Go to next level Level Name: Bronze Level Threshold: 50 Current Level: Bronze //* WTF? Why hasn't the array pointer moved? *// Current Threshold: 50 Go to next level Level Name: Silver Level Threshold: 200 Current Level: Bronze //* WTF? Why hasn't the array pointer moved? *// Current Threshold: 50 Previous Threshold: 0 Final Level: None But the "Final Level" should be 'Bronze' since 60 points is above the 50 points needed for a Bronze medal, but below the 200 points needed for a Silver medal. Sorry for the long post. Thanks for your help!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >