Search Results

Search found 342 results on 14 pages for 'formatter'.

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

  • Code formatter for SSMS

    - by blakmk
      I was searching recently for a code formatter for T-Sql and I came accross this nice little utility that I wanted to share: http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl I've been dealing with a lot of legacy code latley and there is nothing I find more infuriating than unformatted code. This tool seems to work quite well. Just one click and it formats everything nicely. There is also a free web version.                                           This Web Page Created with PageBreeze Free HTML Editor

    Read the article

  • Creating a JSONP Formatter for ASP.NET Web API

    - by Rick Strahl
    Out of the box ASP.NET WebAPI does not include a JSONP formatter, but it's actually very easy to create a custom formatter that implements this functionality. JSONP is one way to allow Browser based JavaScript client applications to bypass cross-site scripting limitations and serve data from the non-current Web server. AJAX in Web Applications uses the XmlHttp object which by default doesn't allow access to remote domains. There are number of ways around this limitation <script> tag loading and JSONP is one of the easiest and semi-official ways that you can do this. JSONP works by combining JSON data and wrapping it into a function call that is executed when the JSONP data is returned. If you use a tool like jQUery it's extremely easy to access JSONP content. Imagine that you have a URL like this: http://RemoteDomain/aspnetWebApi/albums which on an HTTP GET serves some data - in this case an array of record albums. This URL is always directly accessible from an AJAX request if the URL is on the same domain as the parent request. However, if that URL lives on a separate server it won't be easily accessible to an AJAX request. Now, if  the server can serve up JSONP this data can be accessed cross domain from a browser client. Using jQuery it's really easy to retrieve the same data with JSONP:function getAlbums() { $.getJSON("http://remotedomain/aspnetWebApi/albums?callback=?",null, function (albums) { alert(albums.length); }); } The resulting callback the same as if the call was to a local server when the data is returned. jQuery deserializes the data and feeds it into the method. Here the array is received and I simply echo back the number of items returned. From here your app is ready to use the data as needed. This all works fine - as long as the server can serve the data with JSONP. What does JSONP look like? JSONP is a pretty simple 'protocol'. All it does is wrap a JSON response with a JavaScript function call. The above result from the JSONP call looks like this:Query17103401925975181569_1333408916499( [{"Id":"34043957","AlbumName":"Dirty Deeds Done Dirt Cheap",…},{…}] ) The way JSONP works is that the client (jQuery in this case) sends of the request, receives the response and evals it. The eval basically executes the function and deserializes the JSON inside of the function. It's actually a little more complex for the framework that does this, but that's the gist of what happens. JSONP works by executing the code that gets returned from the JSONP call. JSONP and ASP.NET Web API As mentioned previously, JSONP support is not natively in the box with ASP.NET Web API. But it's pretty easy to create and plug-in a custom formatter that provides this functionality. The following code is based on Christian Weyers example but has been updated to the latest Web API CodePlex bits, which changes the implementation a bit due to the way dependent objects are exposed differently in the latest builds. Here's the code:  using System; using System.IO; using System.Net; using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Web; using System.Net.Http; namespace Westwind.Web.WebApi { /// <summary> /// Handles JsonP requests when requests are fired with /// text/javascript or application/json and contain /// a callback= (configurable) query string parameter /// /// Based on Christian Weyers implementation /// https://github.com/thinktecture/Thinktecture.Web.Http/blob/master/Thinktecture.Web.Http/Formatters/JsonpFormatter.cs /// </summary> public class JsonpFormatter : JsonMediaTypeFormatter { public JsonpFormatter() { SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/javascript")); //MediaTypeMappings.Add(new UriPathExtensionMapping("jsonp", "application/json")); JsonpParameterName = "callback"; } /// <summary> /// Name of the query string parameter to look for /// the jsonp function name /// </summary> public string JsonpParameterName {get; set; } /// <summary> /// Captured name of the Jsonp function that the JSON call /// is wrapped in. Set in GetPerRequestFormatter Instance /// </summary> private string JsonpCallbackFunction; public override bool CanWriteType(Type type) { return true; } /// <summary> /// Override this method to capture the Request object /// and look for the query string parameter and /// create a new instance of this formatter. /// /// This is the only place in a formatter where the /// Request object is available. /// </summary> /// <param name="type"></param> /// <param name="request"></param> /// <param name="mediaType"></param> /// <returns></returns> public override MediaTypeFormatter GetPerRequestFormatterInstance(Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType) { var formatter = new JsonpFormatter() { JsonpCallbackFunction = GetJsonCallbackFunction(request) }; return formatter; } /// <summary> /// Override to wrap existing JSON result with the /// JSONP function call /// </summary> /// <param name="type"></param> /// <param name="value"></param> /// <param name="stream"></param> /// <param name="contentHeaders"></param> /// <param name="transportContext"></param> /// <returns></returns> public override Task WriteToStreamAsync(Type type, object value, Stream stream, HttpContentHeaders contentHeaders, TransportContext transportContext) { if (!string.IsNullOrEmpty(JsonpCallbackFunction)) { return Task.Factory.StartNew(() => { var writer = new StreamWriter(stream); writer.Write( JsonpCallbackFunction + "("); writer.Flush(); base.WriteToStreamAsync(type, value, stream, contentHeaders, transportContext).Wait(); writer.Write(")"); writer.Flush(); }); } else { return base.WriteToStreamAsync(type, value, stream, contentHeaders, transportContext); } } /// <summary> /// Retrieves the Jsonp Callback function /// from the query string /// </summary> /// <returns></returns> private string GetJsonCallbackFunction(HttpRequestMessage request) { if (request.Method != HttpMethod.Get) return null; var query = HttpUtility.ParseQueryString(request.RequestUri.Query); var queryVal = query[this.JsonpParameterName]; if (string.IsNullOrEmpty(queryVal)) return null; return queryVal; } } } Note again that this code will not work with the Beta bits of Web API - it works only with post beta bits from CodePlex and hopefully this will continue to work until RTM :-) This code is a bit different from Christians original code as the API has changed. The biggest change is that the Read/Write functions no longer receive a global context object that gives access to the Request and Response objects as the older bits did. Instead you now have to override the GetPerRequestFormatterInstance() method, which receives the Request as a parameter. You can capture the Request there, or use the request to pick up the values you need and store them on the formatter. Note that I also have to create a new instance of the formatter since I'm storing request specific state on the instance (information whether the callback= querystring is present) so I return a new instance of this formatter. Other than that the code should be straight forward: The code basically writes out the function pre- and post-amble and the defers to the base stream to retrieve the JSON to wrap the function call into. The code uses the Async APIs to write this data out (this will take some getting used to seeing all over the place for me). Hooking up the JsonpFormatter Once you've created a formatter, it has to be added to the request processing sequence by adding it to the formatter collection. Web API is configured via the static GlobalConfiguration object.  protected void Application_Start(object sender, EventArgs e) { // Verb Routing RouteTable.Routes.MapHttpRoute( name: "AlbumsVerbs", routeTemplate: "albums/{title}", defaults: new { title = RouteParameter.Optional, controller = "AlbumApi" } ); GlobalConfiguration .Configuration .Formatters .Insert(0, new Westwind.Web.WebApi.JsonpFormatter()); }   That's all it takes. Note that I added the formatter at the top of the list of formatters, rather than adding it to the end which is required. The JSONP formatter needs to fire before any other JSON formatter since it relies on the JSON formatter to encode the actual JSON data. If you reverse the order the JSONP output never shows up. So, in general when adding new formatters also try to be aware of the order of the formatters as they are added. Resources JsonpFormatter Code on GitHub© Rick Strahl, West Wind Technologies, 2005-2012Posted in Web Api   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Eclipse Java Code Formatter in NetBeans Plugin Manager

    - by Geertjan
    Great news for Eclipse refugees everywhere. Benno Markiewicz forked the Eclipse formatter plugin that I blogged about sometime ago (here and here)... and he fixed many bugs, while also adding new features. It's a handy plugin when you're (a) switching from Eclipse to NetBeans and want to continue using your old formatting rules and (b) working in a polyglot IDE team, i.e., now the formatting rules defined in Eclipse can be imported into NetBeans IDE and everyone will happily be able to conform to the same set of formatting standards. And now you can get it directly from Tools | Plugins in NetBeans IDE 7.4: News from Benno on the plugin, received from him today: The plugin is verified by the NetBeans community and available in the Plugin Manager in NetBeans IDE 7.4 (as shown above) and also at the NetBeans Plugin Portal here, where you can also read quite some info about the plugin:  http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java The issue with empty undo buffer was solved with the help of junichi11: https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues/18 The issue with the lost breakpoints remains unsolved and there was no further feedback. That is the main reason why the save action isn't activated by default. See also the open known issues at https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues?state=open Features are as follows:  Global configuration and project specific configuration.  On save action, which is disabled by default. Show the used formatter as a notification, which is enabled by default.  Finally, Benno testifies to the usefulness, stability, and reliability of the plugin: I use the Eclipse formatter provided by this plugin every day at work. Before I commit, I format the sources. It works and that's it. I am pleased with it. Here's where the Eclipse formatter is defined globally in Tools | Options: And here is per-project configuration, i.e., use the Project Properties dialog of any project to override the global settings:  Interested to hear from anyone who tries the plugin and has any feedback of any kind! 

    Read the article

  • CSS formatter NOT based on CSS Tidy?

    - by Abdu
    I can't find a css formatter (web based or Windows app) which formats the css where it puts the open brace on its own line aligned with its close brace, plus indents the attributes. The web based css formatters out here seem to be based on CSSTidy which doesn't do what I want. I don't like this CSSTidy format: .example { font-size: 3em; } I want: .example { font-size: 3em; }

    Read the article

  • Free SQL formatter tool

    - by Sujee
    Hi, is there any free SQL formatter tool? I am using http://www.sqlinform.com/ for small queries. It is very good. But free version supports only 100 lines. TORA has the feature but it has many issues and I can not customize everything. Any free Eclipse plugins for this?

    Read the article

  • How to disable the Formatter in Delphi 2010

    - by Gad D Lord
    Hello, The formatter in Delphi 2010 is really an annoying thing to me. I prefer formatting my code manually. I believe I do it better. How can I disable it? NOTE: Answers on why I don't use it in the first place will not be accepted. I need it switched OFF. Nothing more, nothing less. Thank you.

    Read the article

  • Objective c string formatter for distances

    - by nevan
    I have a distance as a float and I'm looking for a way to format it nicely for human readers. Ideally, I'd like it to change from m to km as it gets bigger, and to round the number nicely. Converting to miles would be a bonus. I'm sure many people have had a need for one of these and I'm hoping that there's some code floating around somewhere. Here's how I'd like the formats: 0-100m: 47m (as a whole number) 100-1000m: 325m or 320m (round to the nearest 5 or 10 meters) 1000-10000m: 1.2km (round to nearest with one decimal place) 10000m +: 21km If there's no code available, how can I write my own formatter? Thanks

    Read the article

  • Java Formatter specify starting position for text

    - by purecharger
    I'm trying to position a string at a certain starting position on a line, regardless of where the previous text ended. For instance: Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. The explanation of the options begin at position 30 regardless of the text preceding. How do you accomplish this with java.util.Formatter? I have tested with both the width (%30s) and precision (%.30) arguments, and neither provide the desired result.

    Read the article

  • Removing the XML Formatter from ASP.NET Web API Applications

    - by Rick Strahl
    ASP.NET Web API's default output format is supposed to be JSON, but when I access my Web APIs using the browser address bar I'm always seeing an XML result instead. When working on AJAX application I like to test many of my AJAX APIs with the browser while working on them. While I can't debug all requests this way, GET requests are easy to test in the browser especially if you have JSON viewing options set up in your various browsers. If I preview a Web API request in most browsers I get an XML response like this: Why is that? Web API checks the HTTP Accept headers of a request to determine what type of output it should return by looking for content typed that it has formatters registered for. This automatic negotiation is one of the great features of Web API because it makes it easy and transparent to request different kinds of output from the server. In the case of browsers it turns out that most send Accept headers that look like this (Chrome in this case): Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Web API inspects the entire list of headers from left to right (plus the quality/priority flag q=) and tries to find a media type that matches its list of supported media types in the list of formatters registered. In this case it matches application/xml to the Xml formatter and so that's what gets returned and displayed. To verify that Web API indeed defaults to JSON output by default you can open the request in Fiddler and pop it into the Request Composer, remove the application/xml header and see that the output returned comes back in JSON instead. An accept header like this: Accept: text/html,application/xhtml+xml,*/*;q=0.9 or leaving the Accept header out altogether should give you a JSON response. Interestingly enough Internet Explorer 9 also displays JSON because it doesn't include an application/xml Accept header: Accept: text/html, application/xhtml+xml, */* which for once actually seems more sensible. Removing the XML Formatter We can't easily change the browser Accept headers (actually you can by delving into the config but it's a bit of a hassle), so can we change the behavior on the server? When working on AJAX applications I tend to not be interested in XML results and I always want to see JSON results at least during development. Web API uses a collection of formatters and you can go through this list and remove the ones you don't want to use - in this case the XmlMediaTypeFormatter. To do this you can work with the HttpConfiguration object and the static GlobalConfiguration object used to configure it: protected void Application_Start(object sender, EventArgs e) { // Action based routing (used for RPC calls) RouteTable.Routes.MapHttpRoute( name: "StockApi", routeTemplate: "stocks/{action}/{symbol}", defaults: new { symbol = RouteParameter.Optional, controller = "StockApi" } ); // WebApi Configuration to hook up formatters and message handlers RegisterApis(GlobalConfiguration.Configuration); } public static void RegisterApis(HttpConfiguration config) { // remove default Xml handler var matches = config.Formatters .Where(f = f.SupportedMediaTypes .Where(m = m.MediaType.ToString() == "application/xml" || m.MediaType.ToString() == "text/xml") .Count() 0) .ToList() ; foreach (var match in matches) config.Formatters.Remove(match); } } That LINQ code is quite a mouthful of nested collections, but it does the trick to remove the formatter based on the content type. You can also look for the specific formatter (XmlMediatTypeFormatter) by its type name which is simpler, but it's better to search for the supported types as this will work even if there are other custom formatters added. Once removed, now the browser request results in a JSON response: It's a simple solution to a small debugging task that's made my life easier. Maybe you find it useful too…© Rick Strahl, West Wind Technologies, 2005-2012Posted in Web Api  ASP.NET   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Writing custom Message Formatter for SOAP basicHttpBinding

    - by Lijo
    I have a WSDL published by our service development team. It is using SOAP and basicHttpBinding. I can add the service reference to the project using Add Service Reference option in Visual Studio. I need to develop the WCF client. I need to use custom Message Formatter (for mapping between Messages and CLR types). Can you please show how to write the custom Message Formatter (in C# )for the following wsdl? Note: I am planning to use custom Message Formatter due to an issue mentioned in http://stackoverflow.com/questions/12316884/header-namespace-mismatch-issue WSDL <definitions xmlns:import0="urn:thinktecture-com:demos:restaurantservice:data:v1" xmlns:import2="urn:thinktecture-com:demos:restaurantservice:messages:v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import1="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" xmlns:tns="urn:thinktecture-com:demos:restaurantservice:wsdl:v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="RestauarntService" targetNamespace="urn:thinktecture-com:demos:restaurantservice:wsdl:v1" xmlns="http://schemas.xmlsoap.org/wsdl/"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <types> <xsd:schema> <xsd:import schemaLocation="RestaurantData.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:data:v1" /> <xsd:import schemaLocation="RestaurantHeaderData.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" /> <xsd:import schemaLocation="RestaurantMessages.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:messages:v1" /> </xsd:schema> </types> <message name="getRestaurantsIn"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import2:getRestaurants" /> </message> <message name="getRestaurantsOut"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import2:getRestaurantsResponse" /> </message> <message name="lijosCustomFaultMessage"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="fault" element="import2:customFault" /> </message> <message name="userCredentialsIn"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import1:userCredentials" /> </message> <message name="addRestaurantIn"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import2:addRestaurant" /> </message> <message name="addRestaurantInHeader1"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import1:userCredentials" /> </message> <message name="customFaultIn"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <part name="parameters" element="import2:customFault" /> </message> <portType name="RestauarntServiceInterface"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <operation name="getRestaurants"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <input message="tns:getRestaurantsIn" /> <output message="tns:getRestaurantsOut" /> <fault name="lijosCustomFaultMessage" message="tns:lijosCustomFaultMessage" /> </operation> <operation name="userCredentials"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <input message="tns:userCredentialsIn" /> </operation> <operation name="addRestaurant"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <input message="tns:addRestaurantIn" /> </operation> <operation name="customFault"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <input message="tns:customFaultIn" /> </operation> </portType> <binding name="BasicHttpBinding_RestauarntServiceInterface" type="tns:RestauarntServiceInterface"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getRestaurants"> <soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:wsdl:v1:getRestaurantsIn" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> <fault name="lijosCustomFaultMessage"> <soap:fault use="literal" name="lijosCustomFaultMessage" namespace="" /> </fault> </operation> <operation name="userCredentials"> <soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:wsdl:v1:userCredentialsIn" style="document" /> <input> <soap:body use="literal" /> </input> </operation> <operation name="addRestaurant"> <soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:wsdl:v1:addRestaurantIn" style="document" /> <input> <soap:body use="literal" /> <soap:header message="tns:addRestaurantInHeader1" part="parameters" use="literal" /> </input> </operation> <operation name="customFault"> <soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:wsdl:v1:customFaultIn" style="document" /> <input> <soap:body use="literal" /> </input> </operation> </binding> <service name="RestauarntServicePort"> <port name="RestauarntServicePort" binding="tns:BasicHttpBinding_RestauarntServiceInterface"> <soap:address location="http://localhost/RestauarntService" /> </port> </service> </definitions>?? RestaurantData.xsd <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="RestaurantData" targetNamespace="urn:thinktecture-com:demos:restaurantservice:data:v1" elementFormDefault="qualified" xmlns="urn:thinktecture-com:demos:restaurantservice:data:v1" xmlns:mstns="urn:thinktecture-com:demos:restaurantservice:data:v1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="restaurantInfo"> <xs:sequence> <xs:element name="restaurantID" type="xs:int" /> <xs:element name="name" type="xs:string" /> <xs:element name="address" type="xs:string" /> <xs:element name="city" type="xs:string" /> <xs:element name="state" type="xs:string" /> <xs:element name="zip" type="xs:string" /> <xs:element name="openFrom" type="xs:time" /> <xs:element name="openTo" type="xs:time" /> </xs:sequence> </xs:complexType> <xs:complexType name="restaurantsList"> <xs:sequence> <xs:element name="restaurant" type="restaurantInfo" maxOccurs="unbounded" minOccurs="0" /> </xs:sequence> </xs:complexType> <xs:complexType name="customFault"> <xs:sequence> <xs:element name="errorCode" type="xs:string"/> <xs:element name="message" type="xs:string"/> <xs:element maxOccurs="unbounded" minOccurs="0" name="messages" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> RestaurantHeaderData.xsd <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="RestaurantHeaderData" targetNamespace="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" elementFormDefault="qualified" xmlns="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" xmlns:mstns="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="credentials"> <xs:sequence> <xs:element name="username" type="xs:string" /> <xs:element name="password" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:element name="userCredentials" type="credentials"> </xs:element> </xs:schema> ? RestaurantMessages.xsd <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="RestaurantMessages" targetNamespace="urn:thinktecture-com:demos:restaurantservice:messages:v1" elementFormDefault="qualified" xmlns="urn:thinktecture-com:demos:restaurantservice:messages:v1" xmlns:mstns="urn:thinktecture-com:demos:restaurantservice:messages:v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:import="urn:thinktecture-com:demos:restaurantservice:data:v1"> <xs:import id="RestaurantData" schemaLocation="RestaurantData.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:data:v1"> </xs:import> <xs:element name="getRestaurants"> <xs:complexType> <xs:sequence> <xs:element name="zip" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="getRestaurantsResponse"> <xs:complexType> <xs:sequence> <xs:element name="restaurants" type="import:restaurantsList" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addRestaurant"> <xs:complexType> <xs:sequence> <xs:element name="restaurant" type="import:restaurantInfo" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="customFault" type="import:customFault" /> </xs:schema>

    Read the article

  • Stand-alone Java code formatter/beautifier/pretty printer?

    - by Greg Mattes
    I'm interested in learning about the available choices of high-quality, stand-alone source code formatters for Java. The formatter must be stand-alone, that is, it must support a "batch" mode that is decoupled from any particular development environment. Ideally it should be independent of any particular operating system as well. So, a built-in formatter for the IDE du jour is of little interest here (unless that IDE supports batch mode formatter invocation, perhaps from the command line). A formatter written in closed-source C/C++ that only runs on, say, Windows is not ideal, but is somewhat interesting. To be clear, a "formatter" (or "beautifier") is not the same as a "style checker." A formatter accepts source code as input, applies styling rules, and produces styled source code that is semantically equivalent to the original source code. A style checker also applies styling rules, but it simply reports rule violations without producing modified source code as output. So the picture looks like this: Formatter (produces modified source code that conforms to styling rules) Read Source Code → Apply Styling Rules → Write Styled Source Code Style Checker (does not produce modified source code) Read Source Code → Apply Styling Rules → Write Rule Violations Further Clarifications Solutions must be highly configurable. I want to be able to specify my own style, not simply select from a canned list. Also, I'm not looking for a general purpose pretty-printer written in Java that can pretty-print many things. I want to style Java code. I'm also not necessarily interested in a grand-unified formatter for many languages. I suppose it might be nice for a solution to have support for languages other than Java, but that is not a requirement. Furthermore, tools that only perform code highlighting are right out. I'm also not interested in a web service. I want a tool that I can run locally. Finally, solutions need not be restricted to open source, public domain, shareware, free software, commercial, or anything else. All forms of licensing are acceptable.

    Read the article

  • Cool SQL formatter tool

    - by AndyScott
    I have to deal with all types of code that was written by people from different organizations, different countries, using different languages, obviously standards are different across these sources.  One of the biggest headaches that I ahve come across is how people differ in the formatting of their SQL statements, specifically stored procs.  When you regularly get over 500 lines in a sproc, if the code is not formatted correctly, you can get lost trying to figure out where one nested BEGIN begins, and another nested END ends.  One of my co-workers showed me this site today that does a pretty damn good job of making sense of that type of code: http://www.dpriver.com/pp/sqlformat.htm.   This is a free website that offers a box to enter your nasty code, and click "Format SQL" and have it clean it for you.  I am sure that there are situations where this may not work, but given the code that I have been working with recently, it does a really good job.  There is a pay version with more options, including VS add-in, desktop component (with quickkeys to clean text in programs like notepad), the ability to output in HTML, and other stuff.  Heck, I watched a demo where the purchased version will take formatted SQL code and turn it into a generic Stringbuilder object embedded in a formatted. Yes, this seems like a shameless plug, but no, I have no relation/knowledge of anyone involved in the development of this product, it just seems useful.  Either way, I recommend checking out the free version.

    Read the article

  • PHP - Auto Code Formatter?

    - by user1179459
    I am just wonedering is there a tool/software (ideally free) to do a auto code formatting in the PHP for batch of files (not one by one which i can use the IDE for that) Ideally something like this where i can set the settings and it will do the auto formatting for all the files in side that folder ...etc http://beta.phpformatter.com/ this is very useful but issue is i have to do this one by one copy pasting .. thats why i am looking for another tool..

    Read the article

  • jqGrid custom formatter

    - by great_llama
    For one of the columns in my jqGrid, I'm providing a custom formatter function. I'm providing some special cases, but if those conditions aren't met, I'd like to resort to using the built-in date formatter utility method. It doesn't seem that I'm getting the right combination of $.extend() to create the options that method is expecting. My colModel for this column: { name:'expires', index:'7', width:90, align:"right", resizable: false, formatter: expireFormat, formatoptions: {srcformat:"l, F d, Y g:i:s A",newformat:"n/j/Y"} }, And an example of what I'm trying to do function expireFormat(cellValue, opts, rowObject) { if (cellValue == null || cellValue == 1451520000) { // a specific date that should show as blank return ''; } else { // here is where I'd like to just call the $.fmatter.util.DateFormat var dt = new Date(cellValue * 1000); var op = $.extend({},opts.date); if(!isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } return $.fmatter.util.DateFormat(op.srcformat,dt,op.newformat,op); } } (An exception is being thrown in the guts of that DateFormat method, looks like where it's trying to read into a masks property of the options that get passed in) EDIT: The $.extend that put everything in the place it needed was getting it from that global property where the i18n library set it, $.jgrid.formatter.date. var op = $.extend({}, $.jgrid.formatter.date); if(!isUndefined(opts.colModel.formatoptions)) { op = $.extend({}, op, opts.colModel.formatoptions); } return $.fmatter.util.DateFormat(op.srcformat,dt.toLocaleString(),op.newformat,op);

    Read the article

  • how to configure my own formatter in java logging property file

    - by loudiyimo
    For my java project, i am using the java logging api. I want to log everything using a property file. Before using this file (log.properties), I configured my onwn fommater in the java code. (see below) Now I want to configure my own fomater in the propertie file, instead of the java code. does someone know how to do that ? Formatter formatter = new Formatter() { @Override public String format(LogRecord arg0) { StringBuilder b = new StringBuilder(); b.append(new Date()); b.append(" "); b.append(arg0.getSourceClassName()); b.append(" "); b.append(arg0.getSourceMethodName()); b.append(" "); b.append(arg0.getLevel()); b.append(" "); b.append(arg0.getMessage()); b.append(System.getProperty("line.separator")); return b.toString(); } }; fomatter in the java code ..... ..... java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.FileHandler.level=WARNING java.util.logging.??? = how can i configure my own formater in the property files with this information: data, clasename, methodename, level .etc.** formatter in de log.proprties

    Read the article

  • jqGrid formatter and sortable column - doesn't sort

    - by HeavyWave
    I am using a custom formatter for my jqGrid columnModel and I can't get sorting to work with formatter functions. If I remove formatter column sorts normally. colModel: [ { name: 'status', index: 'status', width: 18, sorttype: 'int', align: 'center', formatter: function(cellvalue, options, rowObject) { return cellvalue == 1 ? "<img src='images/agent_green_s.png' alt='Ready' title='Ready' />" : cellvalue == 3 ? "<img src='images/agent_red_s.png' alt='Busy' title='Busy' />" : "<img src='images/agent_orange_s.png' alt='Pending Ready' title='Pending Ready' />"; } How do I get sorting to work properly?

    Read the article

  • Formatting Keywords to UPPERCASE In Oracle SQL Developer

    - by thatjeffsmith
    I received this question from a customer today, and it took me more than a few minutes to remember where this preference was located in SQL Developer. This tells me that the topic is ripe for blogging How do I go FROM: select * from scott.emp where ename like '%JEFF%' TO SELECT * FROM scott.emp WHERE ename LIKE '%JEFF%' It’s all in the formatting You need to access the formatting preferences under the Tools menu. It takes a bit of navigating to get there, so bear with me: Tools Database SQL Formatter Oracle Formatting Click ‘Edit’ on the profile Other Case change: ‘Keywords Uppercase’ It’s easy to find once you know where to look? You can tell it to leave the case alone, upper everything, upper only the keywords, lower everything. Accessing the Formatter Options We allow separate formatting options for different RDBMS. You need to make sure you’re accessing the ‘Oracle Formatting’ page in the preferences. You can then choose to edit the default options OR you can do what I have done – save the defaults as a new set of options. I’ve called my profile ‘JeffCustom.’ I can now switch back and forth now through different sets of formatting options. You need to hit the ‘Edit’ button to get to the formatting options editor. A good number of people seem to miss this. Select your profile, then hit the ‘Edit’ button

    Read the article

  • Cannot find suitable formatter for custom class object

    - by Ganesha87
    I'm writing messages to a Message Queue in C# as follows: ObjectMsg objMsg = new ObjMsg(1,"ascii",20090807); Message m = new Message(); m.Formatter = new BinaryMessageFormatter(); m.body = objMsg; queue.Send(m); and I'm trying to read the messages as follows: Message m = new Message() m.Formatter = new BinaryMessageFormatter(); MessageQueue mq = new MessageQueue("./pqueue"); m = mq.Recieve(); ObjMsg msg = (ObjMsg )m.Body; However I'm getting an error message which says: "Cannot find a formatter capable of reading this message."

    Read the article

  • Drupal, custom formatter module: PHP has encountered an Access Violation

    - by Patrick
    hi, I'm having a problem with custom formatters in Drupal. I'm using a custom formatter on a CCK file file with the following content: but when I select it to use I get an internal server error: PHP has encountered an Access Violation at 16B357F9 Please note: 1) It sometimes worked, but the page becomes soon unavailable after a while 2) I've tried to replace the custom formatter content with a simple Hello and I get the error anyway, so it should not be related to the content. 3) I'm using another custom formatter with another CCK field and it doesn't give any error. Thanks

    Read the article

  • NetBeans Java code formatter: logical operators on new line

    - by mizipzor
    My code looks like this: if (firstCondition() && secondCondition()) { // ... code } The default settings for the code formatter in NetBeans wants to put the && on a new line, like this: if (firstCondition() && secondCondition()) { // ... code } The formatter works well so I would just like to find the setting so it doesnt change the code to the latter. Whats the setting called?

    Read the article

  • Ant XML Custom Result Formatter

    - by Iso
    Hi, Can anyone point me the tutorial for step by step creating my onw XML custom result formatter. I read that we can create our own result formatter by specifying the XSLT in styledir. I want to know what should specify in XSLT, like the xml tag for testsuite name, testcase name and the result. Thanks in advance

    Read the article

  • Code Formatter: cleaning up horribly formatted jsp code

    - by ahiru
    So I am working on a jsp/servlet that came to me and I'm looking at the jsp file and it is just a jungle of jstl tags, java code and html thrown together. At first it looked like someone ran the standard eclipse formatter on it and had the page width set to 40 so alot of stuff is broken up, I tried to format it with a larger page width but that seemed to make it worse to the point of not being able to tell what is going on without formatting parts of it first. Anyone have any luck with any jsp/code formatter?

    Read the article

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