Search Results

Search found 713 results on 29 pages for 'barry brown'.

Page 19/29 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Changing the background color of a view in real-time.

    - by Tarmon
    Hey Everyone, I am trying to implement a ListView that is composed of rows that contain a View on the left followed by a TextView to the right of that. I want to be able to change the background color of the first View based on it's position in the ListView. Below is what I have at this point but it doesn't seem to due anything. public class Routes extends ListActivity { String[] ROUTES; TextView selection; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ROUTES = getResources().getStringArray(R.array.routes); setContentView(R.layout.routes); setListAdapter(new IconicAdapter()); selection=(TextView)findViewById(R.id.selection); } public void onListItemClick(ListView parent, View v, int position, long id) { selection.setText(ROUTES[position]); } class IconicAdapter extends ArrayAdapter<String> { IconicAdapter() { super(Routes.this, R.layout.row, R.id.label, ROUTES); } } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View row = inflater.inflate(R.layout.row, parent, false); TextView label = (TextView) row.findViewById(R.id.label); label.setText(ROUTES[position]); View icon = (View) row.findViewById(R.id.icon); switch(position){ case 0: icon.setBackgroundColor(R.color.Red); break; case 1: icon.setBackgroundColor(R.color.Red); break; case 2: icon.setBackgroundColor(R.color.Green); break; case 3: icon.setBackgroundColor(R.color.Green); break; case 4: icon.setBackgroundColor(R.color.Blue); break; case 5: icon.setBackgroundColor(R.color.Blue); break; case 6: icon.setBackgroundColor(R.color.Gray); break; case 7: icon.setBackgroundColor(R.color.Yellow); break; case 8: icon.setBackgroundColor(R.color.Brown); break; case 9: icon.setBackgroundColor(R.color.Brown); break; case 10: icon.setBackgroundColor(R.color.Brown); break; case 11: icon.setBackgroundColor(R.color.Purple); break; case 12: icon.setBackgroundColor(R.color.Red); break; case 13: icon.setBackgroundColor(R.color.Gold); break; case 14: icon.setBackgroundColor(R.color.Orange); break; } return(row); } } Any input is appreciated and if you have any questions don't hesitate to ask! Thanks, Rob

    Read the article

  • Having problem loading data from AppDelegate using UITableView into a flip view, loads first view bu

    - by Ms. Ryann
    AppDelegate: @implementation Ripe_ProduceGuideAppDelegate -(void)applicationDidFinishLaunching:(UIApplication *)application { Greens *apricot = [[Greens alloc] init]; apricot.produceName = @"Apricot"; apricot.produceSight = @"Deep orange or yellow orange in appearance, may have red tinge, no marks or bruises. "; apricot.produceTouch = @"Firm to touch and give to gentle pressure, plump."; apricot.produceSmell = @"Should be Fragrant"; apricot.produceHtoP = @"raw, salads, baked, sauces, glazes, desserts, poached, stuffing."; apricot.produceStore = @"Not ripe: place in brown paper bag, at room temperature and out of direct sunlight, close bag for 2 - 3 days. Last for a week. Warning: Only refrigerate ripe apricots."; apricot.produceBest = @"Spring & Summer"; apricot.producePic = [UIImage imageNamed:@"apricot.jpg"]; Greens *artichoke = [[Greens alloc] init]; artichoke.produceName = @"Artichoke"; artichoke.produceSight = @"Slightly glossy dark green color and sheen, tight petals that are not be too open, no marks, no brown petals or dried out look. Stem should not be dark brown or black."; artichoke.produceTouch = @"No soft spots"; artichoke.produceSmell = @" Should not smell"; artichoke.produceHtoP = @"steam, boil, grill, saute, soups"; artichoke.produceStore = @"Stand up in vase of cold water, keeps for 2 -3 days. Or, place in refrigerator loose without plastic bag. May be frozen, if cooked but not raw."; artichoke.produceBest = @"Spring"; artichoke.producePic = [UIImage imageNamed:@"artichoke.jpg"]; self.produce = [[NSMutableArray alloc] initWithObjects:apricot, artichoke, nil]; [apricot release]; [artichoke release]; FirstView: @implementation ProduceView -(id)initWithIndexPath: (NSIndexPath *)indexPath { if (self == [super init] ){ index = indexPath; } return self; } -(void)viewDidLoad { Ripe_ProduceGuideAppDelegate *delegate = (Ripe_ProduceGuideAppDelegate *) [[UIApplication sharedApplication] delegate]; Greens *thisProduce = [delegate.produce objectAtIndex:index.row]; self.title = thisProduce.produceName; sightView.text = thisProduce.produceSight; touchView.text = thisProduce.produceTouch; smellView.text = thisProduce.produceSmell; picView.image = thisProduce.producePic; } FlipView: @implementation FlipsideViewController @synthesize flipDelegate; -(id)initWithIndexPath: (NSIndexPath *)indexPath { if ( self == [super init]) { index = indexPath; } return self; } -(void)viewDidLoad { Ripe_ProduceGuideAppDelegate *delegate = (Ripe_ProduceGuideAppDelegate *) [[UIApplication sharedApplication] delegate]; Greens*thisProduce = [delegate.produce objectAtIndex:index.row]; self.title = thisProduce.produceName; bestView.text = thisProduce.produceBest; htopView.text = thisProduce.produceHtoP; storeView.text = thisProduce.produceStore; picView.image = thisProduce.producePic; } *the app works, the flip view for Artichoke shows the information for Apricot. Been working on it for two days. I have been working with iPhone apps for two months now and would very much appreciate any assistance with this problem. Thank you very much.

    Read the article

  • when to use a scaled/enterprise agile software development framework and when to let agile processes 'emerge'?

    - by SHC
    There are quite a few enterprise agile software development frameworks available: Scott Ambler: Disciplined Agile Delivery Dean Leffingwell: Scaled Agile Framework Alan Shalloway: Enterprise Agile Book Craig Larman: Scaling Lean and Agile Barry Boehm: Balancing Agility and Discipline Brian Wernham: Agile Project Management in Government - DSDM I've also spoken with people that state that your enterprise agile processes should just 'emerge' and that you shouldn't need or use a framework because they constrain you. Question 1: When should one choose an enterprise agile software development framework, and when should one just let their agile processes 'emerge'. Question 2: If choosing an enterprise agile software development framework, how does one select the appropriate framework to use for their organisation? Please provide evidence of your experience or research when answering questions rather than just presenting opinions.

    Read the article

  • Customer Spotlight: Land O’Lakes

    - by kellsey.ruppel
    Land O’Lakes, Inc. is one of America’s premier member-owned cooperatives, offering local cooperatives and agricultural producers across the nation an extensive line of agricultural supplies, as well as state-of-the-art production and business services. WinField Solutions, a company within Land O’Lakes, is using Oracle WebCenter to improve online experiences for their customers, partners, and employees. The company’s more than 3,000 seed customers, and its more than 300 internal and external sales force members and business partners, use Oracle WebCenter to handle all aspects of account management and order entry through a consolidated, personalized, secure user interface. Learn more about Land O’Lakes and Oracle WebCenter by reading this interview with Barry Libenson, Land O’Lakes chief information officer, or by watching this video.

    Read the article

  • Visual Studio 2010 Launch with DotNet Rocks and ESRI

    tweetmeme_url = 'http://alpascual.com/blog/visual-studio-2010-launch-with-dotnet-rocks-and-esri/';tweetmeme_source = 'alpascual';.NET Rocks is coming to town for the The Visual Studio 2010 launch will be hosted at ESRI. Thanks to James Johnson & Jim Barry to organize this event. This is a huge event for the Inland Empire, Richard Campbell and Carl Franklin from the popular podcast and website, .NET Rocks. Looks like they are bringing a guess speaker, the entity of that speaker is unknown. ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Java EE/GlassFish@JMaghreb

    - by reza_rahman
    The inaugural JMaghreb conference was held on November 2-3 in Morocco. Organized by the Morocco JUG, this was the first conference of it's kind in the North-West African Maghreb region. The conference was a runaway success with 1400+ attendees from 5 different countries, 30 sessions and 18 world-class speakers. Arun Gupta along with Simon Ritter delivered the keynote. Arun also presented a session on JSR 356/WebSocket and a full-house Java EE 6 hands-on lab. Sonya Barry spoke about the JCP and java.net. Oracle was the exclusive platinum sponsor for the conferenec and we wish the fledgling conference every success in this critical part of the globe. You can read more about the conference here.

    Read the article

  • Java.net Reborn

    - by Tori Wieldt
    Java.net, the home of  Java community projects, has been re-launched with a new look and new tools for developers.  The move from CollabNet to the Kenai infrastructure offers more flexibility for developers who want to host or contribute to community projects.  Instead of the large, fixed infrastructure per project (for example, several mailing lists per project), Kenai's ala carte features allow users to take only what they need. "We will continue to have the great mix of blogs, forums, and editorial content as well as new tools on the project side, including Mercurial, Git, and JIRA for developers," Java.net Community Manager Sonya Barry explains. The migration was huge effort. Over 1400 projects were migrated (and some 30 projects are left to go). A large part of the migration was a big cleanup of abandoned projects. With the high abandonment rate of open source projects, the was a lot to remove. The new java.net site is smaller, faster and now the percentage of good, current content is much higher.Check it out at http://home.java.net/

    Read the article

  • SQL SERVER – Update Statistics are Sampled By Default

    - by pinaldave
    After reading my earlier post SQL SERVER – Create Primary Key with Specific Name when Creating Table on Statistics, I have received another question by a blog reader. The question is as follows: Question: Are the statistics sampled by default? Answer: Yes. The sampling rate can be specified by the user and it can be anywhere between a very low value to 100%. Let us do a small experiment to verify if the auto update on statistics is left on. Also, let’s examine a very large table that is created and statistics by default- whether the statistics are sampled or not. USE [AdventureWorks] GO -- Create Table CREATE TABLE [dbo].[StatsTest]( [ID] [int] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](100) NULL, [LastName] [varchar](100) NULL, [City] [varchar](100) NULL, CONSTRAINT [PK_StatsTest] PRIMARY KEY CLUSTERED ([ID] ASC) ) ON [PRIMARY] GO -- Insert 1 Million Rows INSERT INTO [dbo].[StatsTest] (FirstName,LastName,City) SELECT TOP 1000000 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Update the statistics UPDATE STATISTICS [dbo].[StatsTest] GO -- Shows the statistics DBCC SHOW_STATISTICS ("StatsTest"PK_StatsTest) GO -- Clean up DROP TABLE [dbo].[StatsTest] GO Now let us observe the result of the DBCC SHOW_STATISTICS. The result shows that Resultset is for sure sampling for a large dataset. The percentage of sampling is based on data distribution as well as the kind of data in the table. Before dropping the table, let us check first the size of the table. The size of the table is 35 MB. Now, let us run the above code with lesser number of the rows. USE [AdventureWorks] GO -- Create Table CREATE TABLE [dbo].[StatsTest]( [ID] [int] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](100) NULL, [LastName] [varchar](100) NULL, [City] [varchar](100) NULL, CONSTRAINT [PK_StatsTest] PRIMARY KEY CLUSTERED ([ID] ASC) ) ON [PRIMARY] GO -- Insert 1 Hundred Thousand Rows INSERT INTO [dbo].[StatsTest] (FirstName,LastName,City) SELECT TOP 100000 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Update the statistics UPDATE STATISTICS [dbo].[StatsTest] GO -- Shows the statistics DBCC SHOW_STATISTICS ("StatsTest"PK_StatsTest) GO -- Clean up DROP TABLE [dbo].[StatsTest] GO You can see that Rows Sampled is just the same as Rows of the table. In this case, the sample rate is 100%. Before dropping the table, let us also check the size of the table. The size of the table is less than 4 MB. Let us compare the Result set just for a valid reference. Test 1: Total Rows: 1000000, Rows Sampled: 255420, Size of the Table: 35.516 MB Test 2: Total Rows: 100000, Rows Sampled: 100000, Size of the Table: 3.555 MB The reason behind the sample in the Test1 is that the data space is larger than 8 MB, and therefore it uses more than 1024 data pages. If the data space is smaller than 8 MB and uses less than 1024 data pages, then the sampling does not happen. Sampling aids in reducing excessive data scan; however, sometimes it reduces the accuracy of the data as well. Please note that this is just a sample test and there is no way it can be claimed as a benchmark test. The result can be dissimilar on different machines. There are lots of other information can be included when talking about this subject. I will write detail post covering all the subject very soon. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Index, SQL Optimization, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Statistics

    Read the article

  • SQL SERVER – Puzzle – Statistics are not Updated but are Created Once

    - by pinaldave
    After having excellent response to my quiz – Why SELECT * throws an error but SELECT COUNT(*) does not?I have decided to ask another puzzling question to all of you. I am running this test on SQL Server 2008 R2. Here is the quick scenario about my setup. Create Table Insert 1000 Records Check the Statistics Now insert 10 times more 10,000 indexes Check the Statistics – it will be NOT updated Note: Auto Update Statistics and Auto Create Statistics for database is TRUE Expected Result – Statistics should be updated – SQL SERVER – When are Statistics Updated – What triggers Statistics to Update Now the question is why the statistics are not updated? The common answer is – we can update the statistics ourselves using UPDATE STATISTICS TableName WITH FULLSCAN, ALL However, the solution I am looking is where statistics should be updated automatically based on algorithm mentioned here. Now the solution is to ____________________. Vinod Kumar is not allowed to take participate over here as he is the one who has helped me to build this puzzle. I will publish the solution on next week. Please leave a comment and if your comment consist valid answer, I will publish with due credit. Here is the script to reproduce the scenario which I mentioned. -- Execution Plans Difference -- Create Sample Database CREATE DATABASE SampleDB GO USE SampleDB GO -- Create Table CREATE TABLE ExecTable (ID INT, FirstName VARCHAR(100), LastName VARCHAR(100), City VARCHAR(100)) GO -- Insert One Thousand Records -- INSERT 1 INSERT INTO ExecTable (ID,FirstName,LastName,City) SELECT TOP 1000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%20 = 1 THEN 'New York' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 5 THEN 'San Marino' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 3 THEN 'Los Angeles' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 7 THEN 'La Cinega' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 13 THEN 'San Diego' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 17 THEN 'Las Vegas' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Display statistics of the table - none listed sp_helpstats N'ExecTable', 'ALL' GO -- Select Statement SELECT FirstName, LastName, City FROM ExecTable WHERE City  = 'New York' GO -- Display statistics of the table sp_helpstats N'ExecTable', 'ALL' GO -- Replace your Statistics over here -- NOTE: Replace your _WA_Sys with stats from above query DBCC SHOW_STATISTICS('ExecTable', _WA_Sys_00000004_7D78A4E7); GO -------------------------------------------------------------- -- Round 2 -- Insert Ten Thousand Records -- INSERT 2 INSERT INTO ExecTable (ID,FirstName,LastName,City) SELECT TOP 10000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%20 = 1 THEN 'New York' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 5 THEN 'San Marino' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 3 THEN 'Los Angeles' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 7 THEN 'La Cinega' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 13 THEN 'San Diego' WHEN  ROW_NUMBER() OVER (ORDER BY a.name)%20 = 17 THEN 'Las Vegas' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Select Statement SELECT FirstName, LastName, City FROM ExecTable WHERE City  = 'New York' GO -- Display statistics of the table sp_helpstats N'ExecTable', 'ALL' GO -- Replace your Statistics over here -- NOTE: Replace your _WA_Sys with stats from above query DBCC SHOW_STATISTICS('ExecTable', _WA_Sys_00000004_7D78A4E7); GO -- You will notice that Statistics are still updated with 1000 rows -- Clean up Database DROP TABLE ExecTable GO USE MASTER GO ALTER DATABASE SampleDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO DROP DATABASE SampleDB GO Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Index, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Statistics, Statistics

    Read the article

  • Silverlight Cream for June 08, 2010 -- #877

    - by Dave Campbell
    In this Issue: Miroslav Miroslavov, Chris Klug, Beau, Christian Schormann(-2-), Dan Wahlin, Pete Brown, Michael S. Scherotter, Philipp Sumi, Andy Wigley, and Phil Middlemiss. Shoutouts: Mark Tucker set about learning Caliburn, and in the process is writing a Caliburn Book: Chapters 1-3 Jesse Liberty has a great link-laden post up about why we should all be learning/using Blend: Why Developers Should, Must, Do Care About The New Expression Blend be sure to read what he says about WP7 development, however! Charlie Kindel announced an Install problem with the Developer Tools CTP Refresh and the WP7 tools... check this out if you're having problems. John Papa has a good post up on the happenings yesterday: Expression Studio 4 Launch of Blend, SketchFlow, Encoder and More! Erik Mork & Company's latest "This Week in Silverlight" is titled First Drop: Prism v4 – First Drop is Available From SilverlightCream.com: Animated navigation between Pages Miroslav Miroslavov has Part 8 of his "Silverlight in Action" series up, detailing cool things from the CompleteIT site... this one is on Animated navigation between pages. Subtitling videos Chris Klug got a gig adding subtitles to videos for Microsoft (sweet) ... and no, not *that* kind of subtitles... read how he approached the final solution. Silverlight Watermark TextBox I'm not sure we can have too many Watermark TextBoxes, and neither does Beau , who sent me a link to this one... give it a dance and decide. Blend 4: Collaborative SketchFlow Feedback with SharePoint With the new Blend release, Christian Schormann has a post up describing the lashup to Sharepoint for sharing Sketchflow and getting feedback. New Utility, Links, and Tutorials for Path-Based Layout Christian Schormann also has a collection of resources for Path-Based Layouts, including a utility "that lets you apply a whole bunch of position-specific effects without having to write any code"... lots of links to resources here. Tales from the Trenches – Building a Real-World Silverlight Line of Business Application Dan Wahlin draws on his recent experience and lays out some of the fun and pitfalls of building LOB apps in Silverlight... WCF, MVVM, slides, and code included WPF (and Silverlight): Choose your Fonts and Text Rendering Options Wisely Pete Brown has a great post up on using fonts wisely across multiple platforms... lots of info and good discussion in the comments as well. Ball Watch USA Remember the awesome watch Michael S. Scherotter did in Silverlight 1 and then converted to Updated Ball Trainmaster Cannonball Watch to Silverlight 2? Well... there's now a contest underfoot and 8 videos to help you get started... all good stuff, and good luck! ... Michael has a post up about the contest: Enter to Win a Ball Watch by Creating One in Silverlight Announcing Sketchables – Rapid Mockup Creation with SketchFlow By way of Jesse Libertyhttp://jesseliberty.com/2010/06/08/why-developers-should-must-do-care-about-the-new-expression-blend/, this is a cool production by Philipp Sumi about a simple mockup framework he's created. Perst - a database for Windows Phone 7 Silverlight I think one of my first comments to Michael Washington back at the MVP Summit 2010 was that we'd need a database engine, and too cool, but we've got one, Andy Wigley discusses Perst in this post... to save you some time, here's the Perst site A Chrome and Glass Theme - Part 7 Phil Middlemiss has part 7 of his great theme-building series up... this time he's giving the accordian control a once-over. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for December 12, 2010 -- #1008

    - by Dave Campbell
    In this Issue: Michael Washington, Samuel Jack, Alfred Astort(-2-), Nokola(-2-), Avi Pilosof, Chris Klug, Pete Brown, Laurent Bugnion(-2-), and Jaime Rodriguez(-2-, -3-). Above the Fold: Silverlight: "Sharing resources and styles between projects in Silverlight" Chris Klug WP7: "Windows Phone Application Performance at Silverlight Firestarter" Jaime Rodriguez Training: "Silverlight View Model (MVVM) - A Play In One Act" Michael Washington Shoutouts: Koen Zwikstra announced the availability of the first Silverlight Spy 4 Preview 1 Gavin Wignall announced the Launch of Festive game built with Silverlight 4, hosted on Azure ... free to play. From SilverlightCream.com: Silverlight View Model (MVVM) - A Play In One Act Michael Washington has an interesting take on writing a blog post with this 'play' version of Silverlight View Models and Expression Blend with a heaping dose of Behaviors added in for flavoring. Build a Windows Phone Game in 3 days – Day 1 Samuel Jack is attempting to build a WP7 game in 3 days including downloading the tools and an XNA book... interesting to see where he's headed wth this venture. 4 of 10 - Make sure your finger can hit the target and text is legible Continuing with a series of tips from the folks reviewing apps for the marketplace via Alfred Astort is this number 4 -- touch target size and legible text. 5 of 10 - Give feedback on touch and progress within your UI Alfred Astort's number 5 is also up, and continues the touch discussion with this tip about giving the user feedback on their touch. Fantasia Painter Released for Windows Phone 7 + Tips Nokola took the release of his Fantasia Painter on WP& as an opportunity not only to blog about the fact that we can go buy it, but has a blog full of hints and tips that he gathered while working on it. Games for Windows Phone 7 Resources: Reducing Load Times, RPG Kit; Other Nokola also blogged about the release of the new games education pack, and gives up the cursor he uses in his videos after being asked... The simplest way to do design-time ViewModels with MVVM and Blend. Avi Pilosof attacks the design-time ViewModel issue in Blend with a 'no code' solution. Sharing resources and styles between projects in Silverlight Chris Klug is talking about sharing resources and styles across a large Silverlight project... near and dear to my heart at this moment. Dynamically Generating Controls in WPF and Silverlight Pete Brown has a post up that's generated some interest... creating controls at runtime... and he's demonstrating several different ways for both Silverlight and WPF #twitter for Windows Phone 7 protips (#wp7) Laurent Bugnion was posting these great tips for Twitter for WP7 and rolled all 16 of them up into a blog post... check them and the app out... Increasing touch surface (#wp7dev) Laurent Bugnion's most current post should be of great interest to WP7 devs... providing more touch surface for your user's fat fingers, err, I mean their fat fingerings :) ... great information and samples ... and interesting it is a fail point as listed by Alfred Astort above. Windows Phone Application Performance at Silverlight Firestarter This material from Jaime Rodriguez actually hit prior to his Firestarter presentation, but should be required reading for anyone doing a WP7 app... great Performance tips from the trenches... slide deck, cheat-sheet, and code. UpdateSourceTrigger on Windows Phone data bindings Another post from Jaime Rodriguez actually went through a couple revisions already.. how about a WP7 TextBox that fires notifications to the ViewModel when the text changes? ... would you like a behavior with that? Details on the Push Notification app limits Jaime Rodriguez has yet another required reading post up on Push Notification limits ... what it really entails and how you can be a good WP7 citizen by the way you program your app. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for April 16, 2010 -- #838

    - by Dave Campbell
    In this Issue: Alan Beasley(-2-, -3-, -4-, -5-), Brian, Rishi, Pete Brown, Yavor Georgiev, and David Anson. Shoutouts: As usual, Tim Heuer has all the scoop on all the hot-off-the-presses releases: Silverlight 4 released. Availability of tools announcement. He covers all the main parts of interest. Tim Heuer also discusses Backward Compatibility with Silverlight 4 applications And before you ask, Tim Heuer announced the Silverlight Client for Facebook updated for Silverlight 4 release If you're having trouble with the install, Peter Bromberg has a post up to help bail you out: Get Silverlight 4 Installed: Tips and Tricks Christian Schormann has a link to probably the fastest intro to SketchFlow I've seen: Video: SketchFlow in 90 seconds, with Jon Harris Chris Rouw has a Summary of Silverlight at DevConnections on his site. I had the opportunity to spend some time with Chris and we had some good discussions. Rene Schulte describes how to get started with the new final Silverlight 4 RTW build and announces that he updated his samples and open source projects. He also shares what he wishes for the next Silverlight version: Silverlight 4 Up and Running From SilverlightCream.com: Building Better Buttons in Expression Blend and Silverlight I generally end up missing articles embedded at CodeProject, so Alan Beasley emailed me a link to these, they were new to me. In this first one, he's got a very nice tutorial up on making some awesome buttons in Expression Blend Arcade Button in Expression Blend and Silverlight Alan Beasley's second Expression Blend Button tutorial is the classic 'arcade button' ... this is great stuff.. check it out. Picture Frame Control in Expression Blend and Silverlight I wasn't going to do the full list Alan Beasley had sent me in one post, but they're all so good! This third takes an excursion away from buttons to do a Picture Frame control. Styled to the max, and another great Blend tutorial! The last building buttons article (Part1), in Expression Blend and Silverlight Alan Beasley finishes what may be a definitive work on buttons in Blend... even if you don't want to follow the tutorials (and why wouldn't you??) ... he's got 10 buttons you can download! ListBox Styling (Part1-ScrollBars) in Expression Blend & Silverlight In Alan Beasley's 5th post at Code Project, He has a great long tutorial on Styling Listbox Scrollbars in Expression Blend ... the ScrollBars are Part 1 of a series. Some Notes on DRM in Silverlight 4 Brian at Silverlight SDK has a post up on DRM ... WMDRM and PlayReady. If you're planning on utilizing this, Brian's post looks like a good starting point. nRoute: Now, More Wholesome Rishi has a detailed post up explaining the latest nRoute release now supporting Silverlight 4, WP7, and WPF. What a piece of work! Scanning an Image from Silverlight 4 using WIA Automation Pete Brown demonstrates using VS2010 and SL4 to lash up to his scanner. Lots of code and external links... all good stuff, Pete! Dealing with those pesky WCF CommunicationException “NotFound” errors in Silverlight Yavor Georgiev has a quick post up discussing WCF CommunicationException errors in Silverlight with a couple external links to explain the solution. New Silverlight 4 Toolkit released with today's Silverlight 4 RTW! David Anson blogged about the new Toolkit release that is live right now along with the Silverlight 4 Release, and has some release notes up on the Toolkit. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for May 08, 2010 -- #858

    - by Dave Campbell
    In this Issue: Phil Middlemiss, Jaime Rodriguez, Senthil Kumar, Mike Snow, DaveDev, Gergely Orosz, Kirupa, Cheryl Simmons, András Velvárt, Dan Wahlin, Michael D. Brown, and Ben Rush. Shoutouts: Erik Mork and crew have their latest up: This Week In Silverlight – Where’s the Tablet? Chris Rouw has a good link post and instructions on WCF RIA services: Deploying and Configuring Silverlight 4 and WCF RIA Services From SilverlightCream.com: Quick and Easy Sscalable Rounded Bevels Phil Middlemiss duplicates some bevel-edged rectangles in Blend, and they look great. Now you don't have to import all the other PhotoShop bits to get those things looking the way you want! A transparent Windows PHONE FAQ Jaime Rodriguez combined a bunch of information into a WP7 FAQ that he's going to keep up to date, so bookmark the page. He also has links to the Training Kit, on and offline versions. Windows Phone Developer Training Kit April Refresh is now available for Download Thanks to Senthil Kumar, I found out there is an April refresh of the WP7 Training kit at Channel 9 -- go get yours now --- I'll still be here when you get back! Silverlight Tip of the Day #16 – Working with IgnoreImageCache Mike Snow's Tip of the day #16 covers IgnoreImageCache and like many other things in life, until you read Mike's post you may be surprised at how it works. DoodlePad – A fun, free, sketching application for Windows Phone 7 DaveDev has a new WP7 App up that lets you or your kids 'Doodle' on the phone... could be a note, or could be a drawing... good post with all the links you need to get this cranked up on the emulator. Printing in Silverlight: Printing Charts and Auto Scaling Gergely Orosz's latest post is a very useful one on auto-scaling charts to fit a printed page and then getting them to print. Smoothly Scrolling a ListBox Check out the smooth scrolling Kirupa has on the ListBox near the top of his post... all good stuff... you wanna know how to do that! Plus... it's dead simple and all in Blend :) http://www.sparklingclient.com/wheres-the-silverlight-tablet/ Cheryl Simmons has a great tip up at the SilverlightSDK if you haven't burned through to figure it out yet ... changing the watermark on a DatePicker control... looks great! The story of a wicked bug András Velvárt tells a story of a bug that just defied logic or being found. Read how he tracked it down and what it actually was... could save you some time. Story learned: if I have a problem that bad, I'm calling András :) Text Trimming in Silverlight 4 Dan Wahlin gives a quick run-through of what TextBox trimming is, and then by a good real example... check it out and start using it in your projects. Enterprise Patterns with WCF RIA Services Michael D. Brown has an article in MSDN Magazine on RIA Services. Great information and link-packed article, with all the source avialable for download. Building Custom Players with the Silverlight Media Framework Ben Rush has a nice long tutorial on the Silverlight Media Framework up on the MSDN Magazine site ... lots of information in there. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Strings in .NET are Enumerable

    - by Scott Dorman
    It seems like there is always some confusion concerning strings in .NET. This is both from developers who are new to the Framework and those that have been working with it for quite some time. Strings in the .NET Framework are represented by the System.String class, which encapsulates the data manipulation, sorting, and searching methods you most commonly perform on string data. In the .NET Framework, you can use System.String (which is the actual type name or the language alias (for C#, string). They are equivalent so use whichever naming convention you prefer but be consistent. Common usage (and my preference) is to use the language alias (string) when referring to the data type and String (the actual type name) when accessing the static members of the class. Many mainstream programming languages (like C and C++) treat strings as a null terminated array of characters. The .NET Framework, however, treats strings as an immutable sequence of Unicode characters which cannot be modified after it has been created. Because strings are immutable, all operations which modify the string contents are actually creating new string instances and returning those. They never modify the original string data. There is one important word in the preceding paragraph which many people tend to miss: sequence. In .NET, strings are treated as a sequence…in fact, they are treated as an enumerable sequence. This can be verified if you look at the class declaration for System.String, as seen below: // Summary:// Represents text as a series of Unicode characters.public sealed class String : IEnumerable, IComparable, IComparable<string>, IEquatable<string> The first interface that String implements is IEnumerable, which has the following definition: // Summary:// Exposes the enumerator, which supports a simple iteration over a non-generic// collection.public interface IEnumerable{ // Summary: // Returns an enumerator that iterates through a collection. // // Returns: // An System.Collections.IEnumerator object that can be used to iterate through // the collection. IEnumerator GetEnumerator();} As a side note, System.Array also implements IEnumerable. Why is that important to know? Simply put, it means that any operation you can perform on an array can also be performed on a string. This allows you to write code such as the following: string s = "The quick brown fox";foreach (var c in s){ System.Diagnostics.Debug.WriteLine(c);}for (int i = 0; i < s.Length; i++){ System.Diagnostics.Debug.WriteLine(s[i]);} If you executed those lines of code in a running application, you would see the following output in the Visual Studio Output window: In the case of a string, these enumerable or array operations return a char (System.Char) rather than a string. That might lead you to believe that you can get around the string immutability restriction by simply treating strings as an array and assigning a new character to a specific index location inside the string, like this: string s = "The quick brown fox";s[2] = 'a';   However, if you were to write such code, the compiler will promptly tell you that you can’t do it: This preserves the notion that strings are immutable and cannot be changed once they are created. (Incidentally, there is no built in way to replace a single character like this. It can be done but it would require converting the string to a character array, changing the appropriate indexed location, and then creating a new string.)

    Read the article

  • asp.net mvc2 - controller for master page?

    - by ile
    I've just finished my first ASP.NET MVC (2) CMS. Next step is to build website that will show data from CMS's database. This is website design: #1 (Red box) - displays article categories. ViewModel: public class CategoriesDisplay { public CategoriesDisplay() { } public int CategoryID { set; get; } public string CategoryTitle { set; get; } } #2 (Brown box) - displays last x articles; skips those from green box #3. Viewmodel: public class ArticleDisplay { public ArticleDisplay() { } public int CategoryID { set; get; } public string CategoryTitle { set; get; } public int ArticleID { set; get; } public string ArticleTitle { set; get; } public string URLArticleTitle { set; get; } public DateTime ArticleDate; public string ArticleContent { set; get; } } #3 (green box) - Displays last x articles. Uses the same ViewModel as brown box #2 #4 (blue box) - Displays list of upcoming events. Uses dataContext.Model.Event as ViewModel Boxes #1, #2 and #4 will repeat all over the site and they are part of Master Page. So, my question is: what is the best way to transfer this data from Model to Controller and finally to View pages? Should I make a controller for master page and ViewModel class that will wrap all this classes together OR Should I create partial Views for every of these boxes and make each of them inherit appropriate class (if it is even possible that it works this way?) OR Should I put this repeated code in all controllers and all additional data transfer via ViewData, which would be probably the worse way :) OR There is maybe a better and more simple way but I don't know/see it? Thanks in advance, Ile

    Read the article

  • DateFormat conversion problem in java?

    - by androidbase Praveen
    my input String is : 2010-03-24T17:28:50.000Z output pattern is like: DateFormat formatter1 = new SimpleDateFormat("EEE. MMM. d. yyyy"); i convert this like this: formatter1.format(new Date("2010-03-24T17:28:50.000Z"));//illegalArgumentException here the string "2010-03-24T17:28:50.000Z" ouput should be like this: Thu. Mar. 24. 2010 idea but i get a illegalArgumentException. Dont know why? any idea?? stacktrace message is: 04-08 19:50:28.326: WARN/System.err(306): java.lang.IllegalArgumentException 04-08 19:50:28.345: WARN/System.err(306): at java.util.Date.parse(Date.java:447) 04-08 19:50:28.355: WARN/System.err(306): at java.util.Date.<init>(Date.java:157) 04-08 19:50:28.366: WARN/System.err(306): at com.example.brown.Bru_Tube$SelectDataTask.doInBackground(Bru_Tube.java:222) 04-08 19:50:28.366: WARN/System.err(306): at com.example.brown.Bru_Tube$SelectDataTask.doInBackground(Bru_Tube.java:1) 04-08 19:50:28.405: WARN/System.err(306): at android.os.AsyncTask$2.call(AsyncTask.java:185) 04-08 19:50:28.415: WARN/System.err(306): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 04-08 19:50:28.415: WARN/System.err(306): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 04-08 19:50:28.446: WARN/System.err(306): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) 04-08 19:50:28.456: WARN/System.err(306): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) 04-08 19:50:28.466: WARN/System.err(306): at java.lang.Thread.run(Thread.java:1096)

    Read the article

  • Flex textarea control not updating properly.

    - by ielashi
    I am writing a flex application that involves modifying a textarea very frequently. I have encountered issues with the textarea sometimes not displaying my modifications. The following actionscript code illustrates my problem: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> <mx:TextArea x="82" y="36" width="354" height="291" id="textArea" creationComplete="initApp()"/> <mx:Script> <![CDATA[ private var testSentence:String = "The big brown fox jumps over the lazy dog."; private var testCounter:int = 0; private function initApp():void { var timer:Timer = new Timer(10); timer.addEventListener(TimerEvent.TIMER, playSentence); timer.start(); } private function playSentence(event:TimerEvent):void { textArea.editable = false; if (testCounter == testSentence.length) { testCounter = 0; textArea.text += "\n"; } else { textArea.text += testSentence.charAt(testCounter++); } textArea.editable = true; } ]]> </mx:Script> </mx:Application> When you run the above code in a flex project, it should repeatedly print, character by character, the sentence "The big brown fox jumps over the lazy dog.". But, if you are typing into the textarea at the same time, you will notice the text the timer prints is distorted. I am really curious as to why this happens. The single-threaded nature of flex and disabling user input for the textarea when I make modifications should prevent this from happening, but for some reason this doesn't seem to be working. I must note too that, when running the timer at larger intervals (around 100ms) it seems to work perfectly, so I am tempted to think it's some kind of synchronization issue in the internals of the flex framework. Any ideas on what could be causing the problem?

    Read the article

  • ActivityThread exception in Android?

    - by Praveen Chandrasekaran
    My Log CAT Value: 05-17 15:16:30.572: ERROR/ActivityThread(17448): Activity com.example.brown.Bru_Maps has leaked IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@432e6360 that was originally registered here. Are you missing a call to unregisterReceiver()? 05-17 15:16:30.572: ERROR/ActivityThread(17448): android.app.IntentReceiverLeaked: Activity com.example.brown.Bru_Maps has leaked IntentReceiver android.net.NetworkConnectivityListener$ConnectivityBroadcastReceiver@432e6360 that was originally registered here. Are you missing a call to unregisterReceiver()? 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:748) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:576) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiverInternal(ApplicationContext.java:770) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiver(ApplicationContext.java:757) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ApplicationContext.registerReceiver(ApplicationContext.java:751) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:290) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.net.NetworkConnectivityListener.startListening(NetworkConnectivityListener.java:138) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.google.android.maps.MapActivity.onResume(MapActivity.java:232) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1225) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.Activity.performResume(Activity.java:3559) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2838) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2866) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1819) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.os.Handler.dispatchMessage(Handler.java:99) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.os.Looper.loop(Looper.java:123) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at android.app.ActivityThread.main(ActivityThread.java:4203) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at java.lang.reflect.Method.invokeNative(Native Method) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at java.lang.reflect.Method.invoke(Method.java:521) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 05-17 15:16:30.572: ERROR/ActivityThread(17448): at dalvik.system.NativeStart.main(Native Method) What is the Activity Thread Exception in Android? Please Help.

    Read the article

  • Merging two Regular Expressions to Truncate Words in Strings

    - by Alix Axel
    I'm trying to come up with the following function that truncates string to whole words (if possible, otherwise it should truncate to chars): function Text_Truncate($string, $limit, $more = '...') { $string = trim(html_entity_decode($string, ENT_QUOTES, 'UTF-8')); if (strlen(utf8_decode($string)) > $limit) { $string = preg_replace('~^(.{1,' . intval($limit) . '})(?:\s.*|$)~su', '$1', $string); if (strlen(utf8_decode($string)) > $limit) { $string = preg_replace('~^(.{' . intval($limit) . '}).*~su', '$1', $string); } $string .= $more; } return trim(htmlentities($string, ENT_QUOTES, 'UTF-8', true)); } Here are some tests: // Iñtërnâtiônàlizætiøn and then the quick brown fox... (49 + 3 chars) echo dyd_Text_Truncate('Iñtërnâtiônàlizætiøn and then the quick brown fox jumped overly the lazy dog and one day the lazy dog humped the poor fox down until she died.', 50, '...'); // Iñtërnâtiônàlizætiøn_and_then_the_quick_brown_fox_... (50 + 3 chars) echo dyd_Text_Truncate('Iñtërnâtiônàlizætiøn_and_then_the_quick_brown_fox_jumped_overly_the_lazy_dog and one day the lazy dog humped the poor fox down until she died.', 50, '...'); They both work as it is, however if I drop the second preg_replace() I get the following: Iñtërnâtiônàlizætiøn_and_then_the_quick_brown_fox_jumped_overly_the_lazy_dog and one day the lazy dog humped the poor fox down until she died.... I can't use substr() because it only works on byte level and I don't have access to mb_substr() ATM, I've made several attempts to join the second regex with the first one but without success. Please help S.M.S., I've been struggling with this for almost an hour. EDIT: I'm sorry, I've been awake for 40 hours and I shamelessly missed this: $string = preg_replace('~^(.{1,' . intval($limit) . '})(?:\s.*|$)?~su', '$1', $string); Still, if someone has a more optimized regex (or one that ignores the trailing space) please share: "Iñtërnâtiônàlizætiøn and then " "Iñtërnâtiônàlizætiøn_and_then_" EDIT 2: I still can't get rid of the trailing whitespace, can someone help me out?

    Read the article

  • Letter placement error with GD2, TTF and PHP

    - by Javier Parra
    Some time ago I made a script that takes some text and returns it as an image, and worked flawlessly. But I'm not sure since when a weird bug started to happen. The letters that have a (my apologies to the font geeks) "glyph" on the left get pushed to the right so the letter starts on it, but leaves space only for the main letter, hehe, I think an example should do it. The expected result is: The "bad" one was generated, obviously, by my script, located here: http://www.esbasura.com/images/text.php?txt=The%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog.&fnt=1&size=23&bg=lightgrey And the good one was generated by dafont here: http://img.dafont.com/preview.php?text=The%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog.&ttf=bleeding_cowboys0&ext=1&size=23&psize=m&y=46 I'm not doing anything fancy in the script, here is the relevant part: imagefilledrectangle($im, 0, 0, $width, $height, $$bg); imagettftext($im, $size, 0, (-1*$textsize[6]), (-1*$textsize[7]), $$color, $font, $text); // imagefttext($im, $size, 0, (-1*$textsize[6]), (-1*$textsize[7]), $$color, $font, $text); same results using imagefttext imagecolortransparent($im, $$bg); header("Cache-Control: public"); // HTTP/1.1 header("Content-type: image/png"); imagepng($im); imagedestroy($im); } I'm kind of surprised, because, as I said, it used to work flawlessly. Maybe my host changed my machine. (here's my phpinfo: http://www.work4bandwidth.com/info.php) Relevant bit: gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled

    Read the article

  • Javascript: prototypeal inheritance and the prototype proprity

    - by JanD
    Hi, I have a simple code fragment in JS working with prototype inheritance. function object(o) { function F() {} F.prototype = o; return new F(); } //the following code block has a alternate version var mammal={ color: "brown", getColor: function(){ return this.color; } } var myCat = object(mammal); myCat.meow = function(){return "meow";} that worked fine but adding this: mammal.prototype.kindOf = "predator"; does not. ("mammal.prototype is undefined") Since I guessed that object maybe have no prototype I rewrote it, replacing the var mammal={... block with: function mammal(){ this.color="brown"; this.getColor = function(){return this.color;} } which gave me a bunch of other errors: "Function.prototype.toString called on incompatible object" and if I try to call _myCat.getColor() "myCat.getColor is not a function" Now I am totally confused. After reading Crockford, and Flanagan I did not get the solution for the errors. So it would be great if somebody knows... - why is the prototype undefined in the first example (which is foremost concern; I thought the prototype of explicitly set in the object() function) - why get I these strange errors trying to use the mammal function as prototype object in the object() function?

    Read the article

  • Javascript: prototypal inheritance and the prototype property

    - by JanD
    Hi, I have a simple code fragment in JS working with prototype inheritance. function object(o) { function F() {} F.prototype = o; return new F(); } //the following code block has a alternate version var mammal = { color: "brown", getColor: function() { return this.color; } } var myCat = object(mammal); myCat.meow = function(){return "meow";} that worked fine but adding this: mammal.prototype.kindOf = "predator"; does not. ("mammal.prototype is undefined") Since I guessed that object maybe have no prototype I rewrote it, replacing the var mammal={... block with: function mammal() { this.color = "brown"; this.getColor = function() { return this.color; } } which gave me a bunch of other errors: "Function.prototype.toString called on incompatible object" and if I try to call _myCat.getColor() "myCat.getColor is not a function" Now I am totally confused. After reading Crockford, and Flanagan I did not get the solution for the errors. So it would be great if somebody knows... - why is the prototype undefined in the first example (which is foremost concern; I thought the prototype of explicitly set in the object() function) - why get I these strange errors trying to use the mammal function as prototype object in the object() function? Edit by the Creator of the Question: These two links helped a lot too: Prototypes_in_JavaScript on the spheredev wiki explains the way the prototype property works relativily simple. What it lacks is some try-out code examples. Some good examples are provided by Morris John's Article. I personally find the explanations are not that easy as in the first link, but still very good. The most difficult part even after I actually got it is really not to confuse the .prototype propery with the internal [[Prototype]] of an object.

    Read the article

  • Table cell doesn't obey vertical-align CSS declaration when it contains a floated element

    - by mikez302
    I am trying to create a table, where each cell contains a big floated h1 on the left side, and a larger amount of small text to the right of the big text, vertically centered. However, the small text is showing up at the top of each cell, despite that it has a "vertical-align: middle" declaration. When I remove the big floated element, everything looks fine. I tested it in recent versions of IE, Firefox, and Safari, and this happened in every case. Why is this happening? Does anyone know of a way around it? Here is an example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'> <title>vertical-align test</title> <style type="text/css"> td { border: solid black 1px; vertical-align: middle; font-size: 12px} h1 { font-size: 40px; float: left} </style> </head> <body> <table> <tr> <td><h1>1</h1>The quick brown fox jumps over the lazy dog.</td> <td>The quick brown fox jumps over the lazy dog.</td> </tr> </table> </body></html> Notice that the small text in the first cell is at the top for some reason, but the text in the 2nd cell is vertically centered.

    Read the article

  • Javascript: prototypeal inheritance and the prototype property

    - by JanD
    Hi, I have a simple code fragment in JS working with prototype inheritance. function object(o) { function F() {} F.prototype = o; return new F(); } //the following code block has a alternate version var mammal = { color: "brown", getColor: function() { return this.color; } } var myCat = object(mammal); myCat.meow = function(){return "meow";} that worked fine but adding this: mammal.prototype.kindOf = "predator"; does not. ("mammal.prototype is undefined") Since I guessed that object maybe have no prototype I rewrote it, replacing the var mammal={... block with: function mammal() { this.color = "brown"; this.getColor = function() { return this.color; } } which gave me a bunch of other errors: "Function.prototype.toString called on incompatible object" and if I try to call _myCat.getColor() "myCat.getColor is not a function" Now I am totally confused. After reading Crockford, and Flanagan I did not get the solution for the errors. So it would be great if somebody knows... - why is the prototype undefined in the first example (which is foremost concern; I thought the prototype of explicitly set in the object() function) - why get I these strange errors trying to use the mammal function as prototype object in the object() function?

    Read the article

  • Find Shortest element in Array

    - by Ani
    I have a Array string[] names = { "Jim Rand", "Barry Williams", "Nicole Dyne", "Peter Levitt", "Jane Jones", "Cathy Hortings"}; Is there any way to find which is the shortest(Length wise) element in this array and then store rest of elements in a different array. Thanks, Ani

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >