Search Results

Search found 41 results on 2 pages for 'bmw'.

Page 1/2 | 1 2  | Next Page >

  • How to limit speed with BMW JSDK on 116i?

    - by lexicore
    I'm experimenting with the BMW Java SDK on the new BMW 116i Innovation Package. Basic things like turning the lights on and off, starting and stopping the motor work fine. What I'm trying to do now is that to write a carlet which would limit the speed to the maximum configured in the driver profile. Driver identity will be detected as usual via RFID reader. My problem is that though I can read the speed from the tachometer, I can't really limit the speed. Here's what I've got working so far: public class SpeenControllingCarlet extends GenericCarlet { public void start(final VehicleModel model) throws CarletException { RfidReader rfidReader = (RfidReader) model .getDevice(Devices.DRIVER_RFID_READER); Rfid rfid = rfidReader.getRfid(); DriverProfile driverProfile = model.getDriverProfileRegistry() .getDriverProfile(rfid.toString()); if (driverProfile == null) { return; } final Double maxAllowedSpeed = Double.valueOf(driverProfile .getCustomAttribute("maxAllowedSpeed", "190")); Tachometer tachometer = (Tachometer) mode.getDevice(Devices.TACHOMETER); tachometer.addSpeedListener(new SpeedListener() { public void onSpeedChanged(SpeedChangedEvent speedChangedEvent) { if (speedChangedEvent.getCurrentSpeed() > maxAllowedSpeed) { Horn horn = (Horn) mode.getDevice(Devices.HORN); horn.beep(440, 2000); } } }); } } This will just beep for two seconds if the driver goes faster than the driver profile allows. My question is - is there a possibility to actually limit the speed (not just silly beeping)?

    Read the article

  • c++ inheritance

    - by Meloun
    Hi, i am trouble with this.. Is there some solution or i have to keep exactly class types? //header file Class Car { public: Car(); virtual ~Car(); }; class Bmw:Car { public: Bmw(); virtual ~Bmw(); }; void Start(Car& mycar) {}; //cpp file Car::Car(){} Car::~Car() {} Bmw::Bmw() :Car::Car(){} Bmw::~Bmw() {} int main() { Car myCar; Bmw myBmw; Start(myCar); //works Start(myBmw); //!! doesnt work return 0; }

    Read the article

  • How to make a checkbox list that is also explorer tree?

    - by Loclip
    Lets say we have 3 categories Car Airplanes Bikes Each category have other categories for example car have: BMW Toyota Mercedes Each of these categories have cars (no more categories) Car, airplane, bikes will be items in the listbox that can be explored and checked. Now lets say we explore car there will be BMW, Toyota, Mercedes that can be only checked. So if I check car all car will be checked, if i check bmw only the bmw from cars will be checked.. How I can do that?

    Read the article

  • Pattern Matching in Columns

    - by Chronicles
    File 1 A11;F1;BMW A23;F2;BMW B12;F3;BMW H11;F4;JBW File 2 P01;A1;0;0--00 ;123;456;150 P01;A11;0;0--00 ;123;444;208 P01;B12;0;0--00 ;123;111;36 P01;V11;0;0--00 ;123;787;33.9 Output -;-;-;P01;A1;0;0--00 ;123;456;150 A11;F1;BMW;P01;A11;0;0--00 ;123;444;208 B12;F3;BMW;P01;B12;0;0--00 ;123;111;36 -;-;-;P01;V11;0;0--00 ;123;787;33.9 I TRIED awk 'FNR==NR {a[$2] = $0; next }{ if($1 in a) {p=$1;$1="";print a[p],$0}}' File1 File2 But didnt work. Basically I want to get the details from FILE 1 and compare with FILE2 (master list) . Example : A1 in FILE2 was not available in FILE1 , so in output file we have “-“ for 1st three fields and rest from FILE2 . Now, we have A11 and we got the detail in FILE1. So we write details of A11 from both File 1 & 2

    Read the article

  • More details on America's Cup use of Oracle Data Mining

    - by charlie.berger
    BMW Oracle Racing's America's Cup: A Victory for Database Technology BMW Oracle Racing's victory in the 33rd America's Cup yacht race in February showcased the crew's extraordinary sailing expertise. But to hear them talk, the real stars weren't actually human. "The story of this race is in the technology," says Ian Burns, design coordinator for BMW Oracle Racing. Gathering and Mining Sailing DataFrom the drag-resistant hull to its 23-story wing sail, the BMW Oracle USA trimaran is a technological marvel. But to learn to sail it well, the crew needed to review enormous amounts of reliable data every time they took the boat for a test run. Burns and his team collected performance data from 250 sensors throughout the trimaran at the rate of 10 times per second. An hour of sailing alone generates 90 million data points.BMW Oracle Racing turned to Oracle Data Mining in Oracle Database 11g to extract maximum value from the data. Burns and his team reviewed and shared raw data with crew members daily using a Web application built in Oracle Application Express (Oracle APEX). "Someone would say, 'Wouldn't it be great if we could look at some new combination of numbers?' We could quickly build an Oracle Application Express application and share the information during the same meeting," says Burns. Analyzing Wind and Other Environmental ConditionsBurns then streamed the data to the Oracle Austin Data Center, where a dedicated team tackled deeper analysis. Because the data was collected in an Oracle Database, the Data Center team could dive straight into the analytics problems without having to do any extract, transform, and load processes or data conversion. And the many advanced data mining algorithms in Oracle Data Mining allowed the analytics team to build vital performance analytics. For example, the technology team could remove masking elements such as environmental conditions to give accurate data on the best mast rotation for certain wind conditions. Without the data mining, Burns says the boat wouldn't have run as fast. "The design of the boat was important, but once you've got it designed, the whole race is down to how the guys can use it," he says. "With Oracle database technology we could compare the incremental improvements in our performance from the first day of sailing to the very last day. With data mining we could check data against the things we saw, and we could find things that weren't otherwise easily observable and findable."

    Read the article

  • Sqldatareader and rowcount

    - by phenevo
    Hi, I have a query: declare @Code nvarchar(100) select @Code="BMW" select name from NewCars where code=@Code if @@rowcount = 0 Select name from OldCars where code=@Code In Sql managment studio first part give me 0 resuklts, and second 1 one result, and that is ok, but in sqldatareader I use the same query ofcource without: declare @Code nvarchar(100) select @Code="BMW" because I use: cmd.Parameters.AddWithValue("@Code", "BMW"); And using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { Name= reader["Name"].ToString(); } } else { throw new NotSupportedException("Lack of car with this Code"); } } gives me zero result

    Read the article

  • MapReduce for counting parameter values

    - by cnkt
    I have document like this: { "_id": ObjectId("4d17c7963ffcf60c1100002f"), "title": "Text", "params": { "brand": "BMW", "model": "i3" } } { "_id": ObjectId("4d17c7963ffcf60c1100002f"), "title": "Text", "params": { "brand": "BMW", "model": "i5" } } What i need is the count of every params values. like: brand --------- BMW (2) model --------- i3 (1) i5 (1) I think i have to write map/reduce functions. How can i do this? Thanks.

    Read the article

  • PHP 'smart' search engine to search Mysql tables advice

    - by Anonymous12345
    I am creating a search engine for my php based website. I need to search a mysql table. Thing is, the search engine must be pretty 'smart', so that users can easily find their items (it's a classifieds website). I have currently set up a FULLTEXT search with this piece of code: MATCH (headline) AGAINST ($querystring) But this isn't enough... For instance, lets say the field headline contains something like Bmw 330ci. If I search for 330, I wont get any results. The ending ('ci') is just one of many endings in car models which must be taken into account when searching the table. Or what if the headline field is bmw330? Also no results, because it only matches full words. Or also, what if the headline is bmw 330, and I search for bmw 520, still with FULLTEXT I will get the bmw 330 as a result, even though I searched for bmw 520... Not good! How should I solve this problem?

    Read the article

  • How to exclude rows where matching join is in an SQL tree

    - by Greg K
    Sorry for the poor title, I couldn't think how to concisely describe this problem. I have a set of items that should have a 1-to-1 relationship with an attribute. I have a query to return those rows where the data is wrong and this relationship has been broken (1-to-many). I'm gathering these rows to fix them and restore this 1-to-1 relationship. This is a theoretical simplification of my actual problem but I'll post example table schema here as it was requested. item table: +------------+------------+-----------+ | item_id | name | attr_id | +------------+------------+-----------+ | 1 | BMW 320d | 20 | | 1 | BMW 320d | 21 | | 2 | BMW 335i | 23 | | 2 | BMW 335i | 34 | +------------+------------+-----------+ attribute table: +---------+-----------------+------------+ | attr_id | value | parent_id | +---------+-----------------+------------+ | 20 | SE | 21 | | 21 | M Sport | 0 | | 23 | AC | 24 | | 24 | Climate control | 0 | .... | 34 | Leather seats | 0 | +---------+-----------------+------------+ A simple query to return items with more than one attribute. SELECT item_id, COUNT(DISTINCT(attr_id)) AS attributes FROM item GROUP BY item_id HAVING attributes > 1 This gets me a result set like so: +-----------+------------+ | item_id | attributes | +-----------+------------+ | 1 | 2 | | 2 | 2 | | 3 | 2 | -- etc. -- However, there's an exception. The attribute table can hold a tree structure, via parent links in the table. For certain rows, parent_id can hold the ID of another attribute. There's only one level to this tree. Example: +---------+-----------------+------------+ | attr_id | value | parent_id | +---------+-----------------+------------+ | 20 | SE | 21 | | 21 | M Sport | 0 | .... I do not want to retrieve items in my original query where, for a pair of associated attributes, they related like attributes 20 & 21. I do want to retrieve items where: the attributes have no parent for two or more attributes they are not related (e.g. attributes 23 & 34) Example result desired, just the item ID: +------------+ | item_id | +------------+ | 2 | +------------+ How can I join against attributes from items and exclude these rows? Do I use a temporary table or can I achieve this from a single query? Thanks.

    Read the article

  • group by with value of another column

    - by phenevo
    Hi, I've got table Articles ID identity autoincement, IDArticle: nvarchar(100) ,IDCar nvarchar(100), createddate How to convert this: SELECT IDCar , MAX(createddate) FROM Articles GROUP BY IDCar to get IDArticle eg: 1 art1 BWM 5-21-2010 2 art2 BMW 5-24-2010 3 art3 BMW 5-31-2010 4 art4 Porshe 5-31-2010 5 art5 Porshe 6-1-2010 Expecting result is: art3 art5 It's not duplicated with: http://stackoverflow.com/questions/2736769/sql-query-number-of-occurance/2736809#2736809

    Read the article

  • drop down not retaining selected value after post back

    - by Bmw
    I'm using classic asp, I have a drop down list that the user selects and then presses submit. After they press submit the drop down list is going back to the default value instead of what they selected. Is there anyway to keep the state of the drop down between post backs instead of it going back to the default? Can post code sample if needed. Thanks!

    Read the article

  • How to be a better software designer

    - by Bmw
    I feel as if I am a hack programmer. I do things over and over again until they finally work. I copy/paste code. I don't think about why something makes sense, if it works I go with it. I have my undergraduate in computer science, and I've done this the entire time. Somehow I made it through the degree by doing this and now I'm in my second year of programming professionally and I am still able to do this and get away with it. Here's the thing, I don't want to be this way anymore. I am not proud of the work I do, I feel like I'm just a copy/paste programmer. How do I become better? I want to be able to design something on my own without copying code. Have you ever been in this situation, if so how did you move beyond it to become a better programmer? To add some background about myself, I started as an asp.net c# programmer, now I'm doing vbscript (which actually makes my tendency to copy/paste/hack a lot worse I must say!) with classic asp…

    Read the article

  • Could crosslinking using very general anchor texts be a reason for a drop in rankings?

    - by webmasters
    I have crosslinked 20 sites and I thought I have been penalized for this, asked this question and some experienced members told me maybe that crosslinking may not necessarily be the reason. The sites are on same host, different C class IP and every site in linked to each other. Each site targets long tail kewords. Site 1 - BMW Used Cars - and my area Site 2 - WW Used Cars - and my area And so on... When I crosslinked them (in the sidebar), I did it for the users; instead of repeating the terms used cars and my location over and over (since my users are targeted) I just crosslinked them using the brand: BMW, WW. Targeting locally, my niches are not overly competitive, so I did not need to many external links to rank on various positions on the 1st page. I'm thinking that when I chose to link using only the brand, google might have thought I wanted to actually rank for BBW and WW, hence the drop in my targeted local traffic. Could this be? I now have no-followed the links and I am noticing a slight recovery, but if it's not a interlinking penalty it would be a shame not to benefit from my links.

    Read the article

  • Joining two tables (through a link), one which may yield multiple rows, together into one result.

    - by Eikern
    Lets say I've got a table listing car brands or models: Cars: Id | Brand ----------- 1 | BMW 2 | Audi 3 | Volvo And I've also got another table which links features. Link: Id | carid | featureid ----------------------- 1 | 1 | 1 2 | 1 | 2 3 | 2 | 2 4 | 3 | 1 5 | 3 | 2 6 | 3 | 3 And I've got the table listing the features. Features: Id | Feature ----------- 1 | A/C 2 | 4WD 3 | Heated seats I want to list these results on my front page like this: BMW A/C 4WD Audi 4WD Volvo A/C 4WD Heated seats What's the best/most efficient way of doing this (using PHP and MySQL)?

    Read the article

  • Metro: Using Templates

    - by Stephen.Walther
    The goal of this blog post is to describe how templates work in the WinJS library. In particular, you learn how to use a template to display both a single item and an array of items. You also learn how to load a template from an external file. Why use Templates? Imagine that you want to display a list of products in a page. The following code is bad: var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productsHTML = ""; for (var i = 0; i < products.length; i++) { productsHTML += "<h1>Product Details</h1>" + "<div>Product Name: " + products[i].name + "</div>" + "<div>Product Price: " + products[i].price + "</div>"; } document.getElementById("productContainer").innerHTML = productsHTML; In the code above, an array of products is displayed by creating a for..next loop which loops through each element in the array. A string which represents a list of products is built through concatenation. The code above is a designer’s nightmare. You cannot modify the appearance of the list of products without modifying the JavaScript code. A much better approach is to use a template like this: <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> A template is simply a fragment of HTML that contains placeholders. Instead of displaying a list of products by concatenating together a string, you can render a template for each product. Creating a Simple Template Let’s start by using a template to render a single product. The following HTML page contains a template and a placeholder for rendering the template: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> <!-- Place where Product Template is Rendered --> <div id="productContainer"></div> </body> </html> In the page above, the template is defined in a DIV element with the id productTemplate. The contents of the productTemplate are not displayed when the page is opened in the browser. The contents of a template are automatically hidden when you convert the productTemplate into a template in your JavaScript code. Notice that the template uses data-win-bind attributes to display the product name and price properties. You can use both data-win-bind and data-win-bindsource attributes within a template. To learn more about these attributes, see my earlier blog post on WinJS data binding: http://stephenwalther.com/blog/archive/2012/02/26/windows-web-applications-declarative-data-binding.aspx The page above also includes a DIV element named productContainer. The rendered template is added to this element. Here’s the code for the default.js script which creates and renders the template: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var product = { name: "Tesla", price: 80000 }; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); productTemplate.render(product, document.getElementById("productContainer")); } }; app.start(); })(); In the code above, a single product object is created with the following line of code: var product = { name: "Tesla", price: 80000 }; Next, the productTemplate element from the page is converted into an actual WinJS template with the following line of code: var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); The template is rendered to the templateContainer element with the following line of code: productTemplate.render(product, document.getElementById("productContainer")); The result of this work is that the product details are displayed: Notice that you do not need to call WinJS.Binding.processAll(). The Template render() method takes care of the binding for you. Displaying an Array in a Template If you want to display an array of products using a template then you simply need to create a for..next loop and iterate through the array calling the Template render() method for each element. (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); var productContainer = document.getElementById("productContainer"); var i, product; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product, productContainer); } } }; app.start(); })(); After each product in the array is rendered with the template, the result is appended to the productContainer element. No changes need to be made to the HTML page discussed in the previous section to display an array of products instead of a single product. The same product template can be used in both scenarios. Rendering an HTML TABLE with a Template When using the WinJS library, you create a template by creating an HTML element in your page. One drawback to this approach of creating templates is that your templates are part of your HTML page. In order for your HTML page to validate, the HTML within your templates must also validate. This means, for example, that you cannot enclose a single HTML table row within a template. The following HTML is invalid because you cannot place a TR element directly within the body of an HTML document:   <!-- Product Template --> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> This template won’t validate because, in a valid HTML5 document, a TR element must appear within a THEAD or TBODY element. Instead, you must create the entire TABLE element in the template. The following HTML page illustrates how you can create a template which contains a TR element: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Product Template --> <div id="productTemplate"> <table> <tbody> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> </tbody> </table> </div> <!-- Place where Product Template is Rendered --> <table> <thead> <tr> <th>Name</th><th>Price</th> </tr> </thead> <tbody id="productContainer"> </tbody> </table> </body> </html>   In the HTML page above, the product template includes TABLE and TBODY elements: <!-- Product Template --> <div id="productTemplate"> <table> <tbody> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> </tbody> </table> </div> We discard these elements when we render the template. The only reason that we include the TABLE and THEAD elements in the template is to make the HTML page validate as valid HTML5 markup. Notice that the productContainer (the target of the template) in the page above is a TBODY element. We want to add the rows rendered by the template to the TBODY element in the page. The productTemplate is rendered in the default.js file: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); var productContainer = document.getElementById("productContainer"); var i, product, row; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product).then(function (result) { row = WinJS.Utilities.query("tr", result).get(0); productContainer.appendChild(row); }); } } }; app.start(); })(); When the product template is rendered, the TR element is extracted from the rendered template by using the WinJS.Utilities.query() method. Next, only the TR element is added to the productContainer: productTemplate.render(product).then(function (result) { row = WinJS.Utilities.query("tr", result).get(0); productContainer.appendChild(row); }); I discuss the WinJS.Utilities.query() method in depth in a previous blog entry: http://stephenwalther.com/blog/archive/2012/02/23/windows-web-applications-query-selectors.aspx When everything gets rendered, the products are displayed in an HTML table: You can see the actual HTML rendered by looking at the Visual Studio DOM Explorer window:   Loading an External Template Instead of embedding a template in an HTML page, you can place your template in an external HTML file. It makes sense to create a template in an external file when you need to use the same template in multiple pages. For example, you might need to use the same product template in multiple pages in your application. The following HTML page does not contain a template. It only contains a container that will act as a target for the rendered template: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Place where Product Template is Rendered --> <div id="productContainer"></div> </body> </html> The template is contained in a separate file located at the path /templates/productTemplate.html:   Here’s the contents of the productTemplate.html file: <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> Notice that the template file only contains the template and not the standard opening and closing HTML elements. It is an HTML fragment. If you prefer, you can include all of the standard opening and closing HTML elements in your external template – these elements get stripped away automatically: <html> <head><title>product template</title></head> <body> <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> </body> </html> Either approach – using a fragment or using a full HTML document  — works fine. Finally, the following default.js file loads the external template, renders the template for each product, and appends the result to the product container: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(null, { href: "/templates/productTemplate.html" }); var productContainer = document.getElementById("productContainer"); var i, product, row; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product, productContainer); } } }; app.start(); })(); The path to the external template is passed to the constructor for the Template class as one of the options: var productTemplate = new WinJS.Binding.Template(null, {href:"/templates/productTemplate.html"}); When a template is contained in a page then you use the first parameter of the WinJS.Binding.Template constructor to represent the template – instead of null, you pass the element which contains the template. When a template is located in an external file, you pass the href for the file as part of the second parameter for the WinJS.Binding.Template constructor. Summary The goal of this blog entry was to describe how you can use WinJS templates to render either a single item or an array of items to a page. We also explored two advanced topics. You learned how to render an HTML table by extracting the TR element from a template. You also learned how to place a template in an external file.

    Read the article

  • More Than a Map - Ubilabs

    More Than a Map - Ubilabs In Hamburg, Germany we met with certified Google Maps API development partner Ubilabs. Ubilabs founders Michael Pletziger and Martin Kleppe showed us some of the Google Maps API driven projects they have built for Germany's largest brands such as Deutsche Telekom, Blitzer.de, and BMW. Read more on morethanamap.com #morethanamap From: GoogleDevelopers Views: 6 0 ratings Time: 01:48 More in Science & Technology

    Read the article

  • How does one restrict xml with an XML Schema?

    - by John
    Hello, I want to restrict xml with a schema to a specific set. I read this tutorial http://www.w3schools.com/schema/schema_facets.asp This seems to be what I want. So, I'm using Qt to validate this xml <car>BMW</car> Here is the pertinent source code. QXmlSchema schema; schema.load( QUrl("file:///workspace/QtExamples/ValidateXSD/car.xsd") ); if ( schema.isValid() ) { QXmlSchemaValidator validator( schema ); if ( validator.validate( QUrl("file:///workspace/QtExamples/ValidateXSD/car.xml") ) ) { qDebug() << "instance is valid"; } else { qDebug() << "instance is invalid"; } } else { qDebug() << "schema is invalid"; } I expected the xml to match the schema definition. Unexpectedly, QxmlSchemaValidator complains. Error XSDError in file:///workspace/QtExamples/ValidateXSD/car.xml, at line 1, column 5: Content of element car does not match its type definition: String content is not listed in the enumeration facet.. instance is invalid I suspect this is a braino. How does one restrict xml with an XML Schema? Thanks for your time and consideration. Sincerely, -john Here is the xsd from the tutorial. <xs:element name="car"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf"/> <xs:enumeration value="BMW"/> </xs:restriction> </xs:simpleType> </xs:element>

    Read the article

  • Non greedy grep

    - by syker
    I want to grep the shortest match and the pattern should be something like: <car ... model=BMW ...> ... ... ... </car> ... means any character and the input is multiple lines.

    Read the article

  • MVC Razor Engine For Beginners Part 1

    - by Humprey Cogay, C|EH, E|CSA
    I. What is MVC? a. http://www.asp.net/mvc/tutorials/older-versions/overview/asp-net-mvc-overview II. Software Requirements for this tutorial a. Visual Studio 2010/2012. You can get your free copy here Microsoft Visual Studio 2012 b. MVC Framework Option 1 - Install using a standalone installer http://www.microsoft.com/en-us/download/details.aspx?id=30683 Option 2 - Install using Web Platform Installer http://www.microsoft.com/web/handlers/webpi.ashx?command=getinstallerredirect&appid=MVC4VS2010_Loc III. Creating your first MVC4 Application a. On the Visual Studio click file new solution link b. Click Other Project Type>Visual Studio Solutions and on the templates window select blank solution and let us name our solution MVCPrimer. c. Now Click File>New and select Project d. Select Visual C#>Web> and select ASP.NET MVC 4 Web Application and Enter MyWebSite as Name e. Select Empty, Razor as view engine and uncheck Create a Unit test project f. You can now view a basic MVC 4 Application Structure on your solution explorer g. Now we will add our first controller by right clicking on the controllers folder on your solution explorer and select Add>Controller h. Change the name of the controller to HomeController and under the scaffolding options select Empty MVC Controller. i. You will now see a basic controller with an Index method that returns an ActionResult j. We will now add a new View Folder for our Home Controller. Right click on the views folder on your solution explorer and select Add> New Folder> and name this folder Home k. Add a new View by right clicking on Views>Home Folder and select Add View. l. Name the view Index, and select Razor(CSHTML) as View Engine, All checkbox should be unchecked for now and click add. m. Relationship between our HomeController and Home Views Sub Folder n. Add new HTML Contents to our newly created Index View o. Press F5 to run our MVC Application p. We will create our new model, Right click on the models folder of our solution explorer and select Add> Class. q. Let us name our class Customer r. Edit the Customer class with the following code s. Open the HomeController by double clickin HomeController of our Controllers folder and edit the HomeControllerusing System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc;   namespace MyWebSite.Controllers {     public class HomeController : Controller     {         //         // GET: /Home/           public ActionResult Index()         {             return View();         }           public ActionResult ListCustomers()         {             List<Models.Customer> customers = new List<Models.Customer>();               //Add First Customer to Our Collection             customers.Add(new Models.Customer()                     {                         Id = 1,                         CompanyName = "Volvo",                         ContactNo = "123-0123-0001",                         ContactPerson = "Gustav Larson",                         Description = "Volvo Car Corporation, or Volvo Personvagnar AB, is a Scandinavian automobile manufacturer founded in 1927"                     });                 //Add Second Customer to Our Collection             customers.Add(new Models.Customer()                     {                         Id = 2,                         CompanyName = "BMW",                         ContactNo = "999-9876-9898",                         ContactPerson = "Franz Josef Popp",                         Description = "Bayerische Motoren Werke AG,  (BMW; English: Bavarian Motor Works) is a " +                                       "German automobile, motorcycle and engine manufacturing company founded in 1917. "                     });                 //Add Third Customer to Our Collection             customers.Add(new Models.Customer()             {                 Id = 3,                 CompanyName = "Audi",                 ContactNo = "983-2222-1212",                 ContactPerson = "Karl Benz",                 Description = " is a multinational division of the German manufacturer Daimler AG,"             });               return View(customers);         }     } } t. Let us now create a view for this Class, But before continuing Press Ctrl + Shift + B to rebuild the solution, this will make the previously created model on the Model class drop down of the Add View Menu. Right click on the views>Home folder and select Add>View u. Let us name our View as ListCustomers, Select Razor(CSHTML) as View Engine, Put a check mark on Create a strongly-typed view, and select Customer (MyWebSite.Models) as model class. Slect List on the Scaffold Template and Click OK. v. Run the MVC Application by pressing F5, and on the address bar insert Home/ListCustomers, We should now see a web page similar below.   x. You can edit ListCustomers.CSHTML to remove and add HTML codes @model IEnumerable<MyWebSite.Models.Customer>   @{     Layout = null; }   <!DOCTYPE html>   <html> <head>     <meta name="viewport" content="width=device-width" />     <title>ListCustomers</title> </head> <body>     <h2>List of Customers</h2>     <table border="1">         <tr>             <th>                 @Html.DisplayNameFor(model => model.CompanyName)             </th>             <th>                 @Html.DisplayNameFor(model => model.Description)             </th>             <th>                 @Html.DisplayNameFor(model => model.ContactPerson)             </th>             <th>                 @Html.DisplayNameFor(model => model.ContactNo)             </th>         </tr>         @foreach (var item in Model) {         <tr>             <td>                 @Html.DisplayFor(modelItem => item.CompanyName)             </td>             <td>                 @Html.DisplayFor(modelItem => item.Description)             </td>             <td>                 @Html.DisplayFor(modelItem => item.ContactPerson)             </td>             <td>                 @Html.DisplayFor(modelItem => item.ContactNo)             </td>                   </tr>     }         </table> </body> </html> y. Press F5 to run the MVC Application   z. You will notice some @HTML.DisplayFor codes. These are called HTML Helpers you can read more about HTML Helpers on this site http://www.w3schools.com/aspnet/mvc_htmlhelpers.asp   That’s all. You now have your first MVC4 Razor Engine Web Application . . .

    Read the article

1 2  | Next Page >