Search Results

Search found 139 results on 6 pages for 'yo l'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Do you write unit tests for all the time in TDD?

    - by mcaaltuntas
    I have been designing and developing code with TDD style for a long time. What disturbs me about TDD is writing tests for code that does not contain any business logic or interesting behaviour. I know TDD is a design activity more than testing but sometimes I feel it's useless to write tests in these scenarios. For example I have a simple scenario like "When user clicks check button, it should check file's validity". For this scenario I usually start writing tests for presenter/controller class like the one below. @Test public void when_user_clicks_check_it_should_check_selected_file_validity(){ MediaService service =mock(MediaService); View view =mock(View); when(view.getSelectedFile).thenReturns("c:\\Dir\\file.avi"); MediaController controller =new MediaController(service,view); controller.check(); verify(service).check("c:\\Dir\\file.avi"); } As you can see there is no design decision or interesting code to verify behaviour. I am testing values from view passed to MediaService. I usually write but don't like these kind of tests. What do yo do about these situations ? Do you write tests for all the time ? UPDATE : I have changed the test name and code after complaints. Some users said that you should write tests for the trivial cases like this so in the future someone might add interesting behaviour. But what about “Code for today, design for tomorrow.” ? If someone, including myself, adds more interesting code in the future the test can be created for it then. Why should I do it now for the trivial cases ?

    Read the article

  • Can't boot after compiling 3.1 kernel, can only get to terminal

    - by olssy
    Long story short: I tried compiling kernel 3.1 on Ubuntu 11.10 at the same time I had an update waiting for a reboot. Computer would boot to a black screen and would hang there. Ended up installing 11.10 on top of old install with a Live CD. Now I had a purple screen on bootup but it would end up booting. Realized Grub was the problem and tried some stuff but nothing worked. I ended up trying to install propriety ATI video drivers and since that nothing has worked, no grub menu(purple screen) and when it boots into the kernel it ends up hanging, I can sometimes get a terminal up with alt-fx. I have tried removing the ati drivers with the ati script, purging my fglrx driver, reconfiguring my xconf.org and following any tutorial I can find about fixing a broken graphics driver, but to no avail. I've gotten to a point were it seems that the ati propriety drivers are correctly loaded but it still has no grub boot menu and won't boot into Ubuntu. I've chased down my logs and this line is from kern.log: unity-greeter[3269]: segfault at 0 ip b7245cbbsp bf9d3900 error 4 in libgio-2.0.so.0.3000.0[b71ad000+142000] That line leads me to believe I don'T have the correct libgio-2 librairy on my system but have no idea how to find out what package has the correct version... My xorg.conf has no errors and seems to imply the fglrxdrm module got loaded correctly. Would be a bit complicated pasting the whole file here but if it would help I'll post it. LAstly, running fglrxinfo give me: Error: Unable yo open display (null) Any help or link to another tutorial would be appreciated. Thanks.

    Read the article

  • CodePlex Daily Summary for Wednesday, April 04, 2012

    CodePlex Daily Summary for Wednesday, April 04, 2012Popular ReleasesExtAspNet: ExtAspNet v3.1.2: ExtAspNet - ?? ExtJS ??? ASP.NET 2.0 ???,????? AJAX ?????????? ExtAspNet ????? ExtJS ??? ASP.NET 2.0 ???,????? AJAX ??????????。 ExtAspNet ??????? JavaScript,?? CSS,?? UpdatePanel,?? ViewState,?? WebServices ???????。 ??????: IE 7.0, Firefox 3.6, Chrome 3.0, Opera 10.5, Safari 3.0+ ????:Apache License 2.0 (Apache) ??:http://extasp.net/ ??:http://bbs.extasp.net/ ??:http://extaspnet.codeplex.com/ ??:http://sanshi.cnblogs.com/ ????: +2012-04-04 v3.1.2 -??IE?????????????BUG(??"about:blank"?...totalem: version 2012.04.04.1: devel releaseNShape - .Net Diagramming Framework for Industrial Applications: NShape 2.0.0: Changes in 2.0.0:New / Changed / Extended Interfaces: public interface ISecurityManager public interface ISecurityDomainObject public interface IModelObject : ISecurityDomainObject public interface ILayerCollection : ICollection<Layer> public interface IRepository public interface ICommand public interface IModelMapping For details on interface changes, see documentation. For more changes on namespaces and base classes, see ReadMe.txt (installation folder) or Changes.txt in the s...ClosedXML - The easy way to OpenXML: ClosedXML 0.65.1: Aside from many bug fixes we now have Conditional Formatting The conditional formatting was sponsored by http://www.bewing.nl (big thanks) New on v0.65.1 Fixed issue when loading conditional formatting with default values for icon setsnopCommerce. Open source shopping cart (ASP.NET MVC): nopcommerce 2.50: Highlight features & improvements: • Significant performance optimization. • Allow store owners to create several shipments per order. Added a new shipping status: “Partially shipped”. • Pre-order support added. Enables your customers to place a Pre-Order and pay for the item in advance. Displays “Pre-order” button instead of “Buy Now” on the appropriate pages. Makes it possible for customer to buy available goods and Pre-Order items during one session. It can be managed on a product variant ...SkyDrive Connector for SharePoint: SkyDriveConnector for SharePoint: SkyDriveConnector for SharePointWiX Toolset: WiX v3.6 RC0: WiX v3.6 RC0 (3.6.2803.0) provides support for VS11 and a more stable Burn engine. For more information see Rob's blog post about the release: http://robmensching.com/blog/posts/2012/4/3/WiX-v3.6-Release-Candidate-Zero-availableSageFrame: SageFrame 2.0: Sageframe is an open source ASP.NET web development framework developed using ASP.NET 3.5 with service pack 1 (sp1) technology. It is designed specifically to help developers build dynamic website by providing core functionality common to most web applications.Lightbox Gallery Module for DotNetNuke: 01.11.00: This version of the Lightbox Gallery Module adds the following features/bug fixes: Feature: Read image EXIF information Bug Fix: URL parsing bug for any folder provider Minimum System Requirements Please ensure that your environment meets or exceeds the following system requirements: DotNetNuke® Version 06.00.00 or higher SQL Server 2005 or later .Net Framework 3.5 SP1 or lateriTuner - The iTunes Companion: iTuner 1.5.4475: Fix to parse empty playlists in iTunes LibraryGoogleMap Control: Google Geocoder 1.3: Geo types changes to string type and GeoAddressType enum changes to static class with some known types as constants in order to resolve the problems with new and not defined geo types.Document.Editor: 2012.2: Whats New for Document.Editor 2012.2: New Save Copy support New Page Setup support Minor Bug Fix's, improvements and speed upsVidCoder: 1.3.2: Added option for the minimum title length to scan. Added support to enable or disable LibDVDNav. Added option to prompt to delete source files after clearing successful completed items. Added option to disable remembering recent files and folders. Tweaked number box to only select all on a quick click.MJP's DirectX 11 Samples: Light Indexed Deferred Rendering: Implements light indexed deferred using per-tile light lists calculated in a compute shader, as well as a traditional deferred renderer that uses a compute shader for per-tile light culling and per-pixel shading.Pcap.Net: Pcap.Net 0.9.0 (66492): Pcap.Net - March 2012 Release Pcap.Net is a .NET wrapper for WinPcap written in C++/CLI and C#. It Features almost all WinPcap features and includes a packet interpretation framework. Version 0.9.0 (Change Set 66492)March 31, 2012 release of the Pcap.Net framework. Follow Pcap.Net on Google+Follow Pcap.Net on Google+ Files Pcap.Net.DevelopersPack.0.9.0.66492.zip - Includes all the tutorial example projects source files, the binaries in a 3rdParty directory and the documentation. It include...Extended WPF Toolkit: Extended WPF Toolkit - 1.6.0: Want an easier way to install the Extended WPF Toolkit?The Extended WPF Toolkit is available on Nuget. What's in the 1.6.0 Release?BusyIndicator ButtonSpinner Calculator CalculatorUpDown CheckListBox - Breaking Changes CheckComboBox - New Control ChildWindow CollectionEditor CollectionEditorDialog ColorCanvas ColorPicker DateTimePicker DateTimeUpDown DecimalUpDown DoubleUpDown DropDownButton IntegerUpDown Magnifier MaskedTextBox MessageBox MultiLineTex...Media Companion: MC 3.434b Release: General This release should be the last beta for 3.4xx. If there are no major problems, by the end of the week it will upgraded to 3.500 Stable! The latest mc_com.exe should be included too! TV Bug fix - crash when using XBMC scraper for TV episodes. Bug fix - episode count update when adding new episodes. Bug fix - crash when actors name was missing. Enhanced TV scrape progress text. Enhancements made to missing episodes display. Movies Bug fix - hide "Play Trailer" when multisaev...Better Explorer: Better Explorer 2.0.0.831 Alpha: - A new release with: - many bugfixes - changed icon - added code for more failsafe registry usage on x64 systems - not needed regfix anymore - added ribbon shortcut keys - Other fixes Note: If you have problems opening system libraries, a suggestion was given to copy all of these libraries and then delete the originals. Thanks to Gaugamela for that! (see discussion here: 349015 ) Note2: I was upload again the setup due to missing file!MonoGame - Write Once, Play Everywhere: MonoGame 2.5: The MonoGame team are pleased to announce that MonoGame v2.5 has been released. This release contains important bug fixes, implements optimisations and adds key features. MonoGame now has the capability to use OpenGLES 2.0 on Android and iOS devices, meaning it now supports custom shaders across mobile and desktop platforms. Also included in this release are native orientation animations on iOS devices and better Orientation support for Android. There have also been a lot of bug fixes since t...Circuit Diagram: Circuit Diagram 2.0 Alpha 3: New in this release: Added components: Microcontroller Demultiplexer Flip & rotate components Open XML files from older versions of Circuit Diagram Text formatting for components New CDDX syntax Other fixesNew ProjectsASP.Net MVC Composite Application Framework: ASP.NET MVC Composite Application FrameworkaTimer : Take a break timer: This timer will help programmers and other people who work on computer for long periods, users will be able to set their time period for work and break, whether you want to enforce the break by hibernating or making your computer sleep. Will be good for eyes, a lot! Still under development and will be monthly revised.Avilander Maven: Projeto Disciplina Branquinho.Banner from Databases: make a banner from database informationCrmXpress OptionSet Manager For Microsoft Dynamics CRM 2011: CrmXpress OptionSet Manager For Microsoft Dynamics CRM 2011CSharpCodeLineCounter: Count code lines as Code Metrics do.Decatec Sharepoint code: Various Decatec Sharepoint codeDevWebServer: DevWebServer is a simple, lightweight web server which can be used for unit testing HTTP client applications. It is developed in C#, has minimal dependencies and is provided as a single assembly.Effect Architect: A real-time effect editor (currently) aimed at Direct3D9. The idea is to bring features that popular IDEs provide to HLSL coding, as well as features that are specific to graphical coding.Gpu Hough: Demo project performing Hough transformation on GPUHappyHourWin8: This project contains several Metro-App development approaches. There will be an RSS-Reader, a task list and a game. Home Media Center: Home Media Center is a server application for UPnP / DLNA compatible devices. It supports streaming and transcoding media files, Windows desktop and video from webcams. This project is developed in C#, C++ and uses DirectShow, Media Foundation.INSTEON Mayhem Module: INSTEON module for Mayhem application.ISService: ISServiceKEITH: Kinect for hospitalsKnowledge Exchange: KnowledgeExchangeLightweight Test Automation Framework: The Lightweight Test Automation Framework for ASP.NET was developed and is currently used by the ASP.NET QA Team to automate regression tests for the product. It is designed to run within an ASP.NET application. Tests can be written in any .NET Framework language. They use an APlinewatchdk: linewatchdkLuaForMono: c#?lua?????,??LuaInterface??luaSharp???,?????????(luaInterface)??lua??c#?????????(luasharp),??mono?linux????????lua??.Metro App Toolkit: The Metro App Toolkit provides the developer community with key components and functionality that are commonly used in Metro Apps for WindowsPhone, Windows8 and the web, including Networking! Toolkit releases include samples & docs. From the community, for the community. My IE Accelerators: 1. dict.cn ie accelaratorofm: ofmOrchard Clippy module: Orchard Clippy moduleOrchard Twitter module: Orchard Twitter modulePersian Subtitle For Programming Courses: This project is created for collecting all programming course's PERSIAN SUBTITLE and help Persian language student to learn programming and every thing related to their major, by Meysam Hooshmandpicking: pickingPomodoro Timer for Visual Studio: Keep track of your Pomodoro Technique (from the Pomodoro Technique® official website – www.pomodorotechnique.com) sessions in Visual Studio.ScriptSafe: A simple powershell wrapper around source control aimed at admins to enable simple source control for their scripts.SkyDrive Connector for SharePoint: SkyDrive Connector for SharePoint is a sandbox web part that can help manage documents stored on skydrive on sharepoint by adding additional metadata. This helps the document to be discoverable on SharePoint. Also SkyDrive provides 25GB for free space for live users.SkypeTranslator: Help users to translate incoming message from Skype and Outlook applications to specified language. In core was use Elysium , log4net , and WPF frameworks, WPF Toolkit Extended,TPL,WCFTalking Heads: The TalkingHeads is a simple social network written in ASP .NET 4.0. It is intended for demonstrating and exploring application monitoring features of AVIcode technology. It works great with AVIcode 5.7, as well as with APM feature in System Center 2012. Unik Project: Unik is a Unified Framework makes easier to create enterprise .NET applications based on architecture best practice.WV-CU950 System Controller .NET Library.: WV-CU950 System Controller .NET library for Panasonic WV-CU950 System Controller. This library contains data processing method.YO JACK!: <Project name>Yo Jack!</Project name> Gather evidence to track down a physical theft of your computer, and turn over to the police. Free to the public.???????: ????????

    Read the article

  • ASPNET WebAPI REST Guidance

    - by JoshReuben
    ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework. While I may be more partial to NodeJS these days, there is no denying that WebAPI is a well engineered framework. What follows is my investigation of how to leverage WebAPI to construct a RESTful frontend API.   The Advantages of REST Methodology over SOAP Simpler API for CRUD ops Standardize Development methodology - consistent and intuitive Standards based à client interop Wide industry adoption, Ease of use à easy to add new devs Avoid service method signature blowout Smaller payloads than SOAP Stateless à no session data means multi-tenant scalability Cache-ability Testability   General RESTful API Design Overview · utilize HTTP Protocol - Usage of HTTP methods for CRUD, standard HTTP response codes, common HTTP headers and Mime Types · Resources are mapped to URLs, actions are mapped to verbs and the rest goes in the headers. · keep the API semantic, resource-centric – A RESTful, resource-oriented service exposes a URI for every piece of data the client might want to operate on. A REST-RPC Hybrid exposes a URI for every operation the client might perform: one URI to fetch a piece of data, a different URI to delete that same data. utilize Uri to specify CRUD op, version, language, output format: http://api.MyApp.com/{ver}/{lang}/{resource_type}/{resource_id}.{output_format}?{key&filters} · entity CRUD operations are matched to HTTP methods: · Create - POST / PUT · Read – GET - cacheable · Update – PUT · Delete - DELETE · Use Uris to represent a hierarchies - Resources in RESTful URLs are often chained · Statelessness allows for idempotency – apply an op multiple times without changing the result. POST is non-idempotent, the rest are idempotent (if DELETE flags records instead of deleting them). · Cache indication - Leverage HTTP headers to label cacheable content and indicate the permitted duration of cache · PUT vs POST - The client uses PUT when it determines which URI (Id key) the new resource should have. The client uses POST when the server determines they key. PUT takes a second param – the id. POST creates a new resource. The server assigns the URI for the new object and returns this URI as part of the response message. Note: The PUT method replaces the entire entity. That is, the client is expected to send a complete representation of the updated product. If you want to support partial updates, the PATCH method is preferred DELETE deletes a resource at a specified URI – typically takes an id param · Leverage Common HTTP Response Codes in response headers 200 OK: Success 201 Created - Used on POST request when creating a new resource. 304 Not Modified: no new data to return. 400 Bad Request: Invalid Request. 401 Unauthorized: Authentication. 403 Forbidden: Authorization 404 Not Found – entity does not exist. 406 Not Acceptable – bad params. 409 Conflict - For POST / PUT requests if the resource already exists. 500 Internal Server Error 503 Service Unavailable · Leverage uncommon HTTP Verbs to reduce payload sizes HEAD - retrieves just the resource meta-information. OPTIONS returns the actions supported for the specified resource. PATCH - partial modification of a resource. · When using PUT, POST or PATCH, send the data as a document in the body of the request. Don't use query parameters to alter state. · Utilize Headers for content negotiation, caching, authorization, throttling o Content Negotiation – choose representation (e.g. JSON or XML and version), language & compression. Signal via RequestHeader.Accept & ResponseHeader.Content-Type Accept: application/json;version=1.0 Accept-Language: en-US Accept-Charset: UTF-8 Accept-Encoding: gzip o Caching - ResponseHeader: Expires (absolute expiry time) or Cache-Control (relative expiry time) o Authorization - basic HTTP authentication uses the RequestHeader.Authorization to specify a base64 encoded string "username:password". can be used in combination with SSL/TLS (HTTPS) and leverage OAuth2 3rd party token-claims authorization. Authorization: Basic sQJlaTp5ZWFslylnaNZ= o Rate Limiting - Not currently part of HTTP so specify non-standard headers prefixed with X- in the ResponseHeader. X-RateLimit-Limit: 10000 X-RateLimit-Remaining: 9990 · HATEOAS Methodology - Hypermedia As The Engine Of Application State – leverage API as a state machine where resources are states and the transitions between states are links between resources and are included in their representation (hypermedia) – get API metadata signatures from the response Link header - in a truly REST based architecture any URL, except the initial URL, can be changed, even to other servers, without worrying about the client. · error responses - Do not just send back a 200 OK with every response. Response should consist of HTTP error status code (JQuery has automated support for this), A human readable message , A Link to a meaningful state transition , & the original data payload that was problematic. · the URIs will typically map to a server-side controller and a method name specified by the type of request method. Stuff all your calls into just four methods is not as crazy as it sounds. · Scoping - Path variables look like you’re traversing a hierarchy, and query variables look like you’re passing arguments into an algorithm · Mapping URIs to Controllers - have one controller for each resource is not a rule – can consolidate - route requests to the appropriate controller and action method · Keep URls Consistent - Sometimes it’s tempting to just shorten our URIs. not recommend this as this can cause confusion · Join Naming – for m-m entity relations there may be multiple hierarchy traversal paths · Routing – useful level of indirection for versioning, server backend mocking in development ASPNET WebAPI Considerations ASPNET WebAPI implements a lot (but not all) RESTful API design considerations as part of its infrastructure and via its coding convention. Overview When developing an API there are basically three main steps: 1. Plan out your URIs 2. Setup return values and response codes for your URIs 3. Implement a framework for your API.   Design · Leverage Models MVC folder · Repositories – support IoC for tests, abstraction · Create DTO classes – a level of indirection decouples & allows swap out · Self links can be generated using the UrlHelper · Use IQueryable to support projections across the wire · Models can support restful navigation properties – ICollection<T> · async mechanism for long running ops - return a response with a ticket – the client can then poll or be pushed the final result later. · Design for testability - Test using HttpClient , JQuery ( $.getJSON , $.each) , fiddler, browser debug. Leverage IDependencyResolver – IoC wrapper for mocking · Easy debugging - IE F12 developer tools: Network tab, Request Headers tab     Routing · HTTP request method is matched to the method name. (This rule applies only to GET, POST, PUT, and DELETE requests.) · {id}, if present, is matched to a method parameter named id. · Query parameters are matched to parameter names when possible · Done in config via Routes.MapHttpRoute – similar to MVC routing · Can alternatively: o decorate controller action methods with HttpDelete, HttpGet, HttpHead,HttpOptions, HttpPatch, HttpPost, or HttpPut., + the ActionAttribute o use AcceptVerbsAttribute to support other HTTP verbs: e.g. PATCH, HEAD o use NonActionAttribute to prevent a method from getting invoked as an action · route table Uris can support placeholders (via curly braces{}) – these can support default values and constraints, and optional values · The framework selects the first route in the route table that matches the URI. Response customization · Response code: By default, the Web API framework sets the response status code to 200 (OK). But according to the HTTP/1.1 protocol, when a POST request results in the creation of a resource, the server should reply with status 201 (Created). Non Get methods should return HttpResponseMessage · Location: When the server creates a resource, it should include the URI of the new resource in the Location header of the response. public HttpResponseMessage PostProduct(Product item) {     item = repository.Add(item);     var response = Request.CreateResponse<Product>(HttpStatusCode.Created, item);     string uri = Url.Link("DefaultApi", new { id = item.Id });     response.Headers.Location = new Uri(uri);     return response; } Validation · Decorate Models / DTOs with System.ComponentModel.DataAnnotations properties RequiredAttribute, RangeAttribute. · Check payloads using ModelState.IsValid · Under posting – leave out values in JSON payload à JSON formatter assigns a default value. Use with RequiredAttribute · Over-posting - if model has RO properties à use DTO instead of model · Can hook into pipeline by deriving from ActionFilterAttribute & overriding OnActionExecuting Config · Done in App_Start folder > WebApiConfig.cs – static Register method: HttpConfiguration param: The HttpConfiguration object contains the following members. Member Description DependencyResolver Enables dependency injection for controllers. Filters Action filters – e.g. exception filters. Formatters Media-type formatters. by default contains JsonFormatter, XmlFormatter IncludeErrorDetailPolicy Specifies whether the server should include error details, such as exception messages and stack traces, in HTTP response messages. Initializer A function that performs final initialization of the HttpConfiguration. MessageHandlers HTTP message handlers - plug into pipeline ParameterBindingRules A collection of rules for binding parameters on controller actions. Properties A generic property bag. Routes The collection of routes. Services The collection of services. · Configure JsonFormatter for circular references to support links: PreserveReferencesHandling.Objects Documentation generation · create a help page for a web API, by using the ApiExplorer class. · The ApiExplorer class provides descriptive information about the APIs exposed by a web API as an ApiDescription collection · create the help page as an MVC view public ILookup<string, ApiDescription> GetApis()         {             return _explorer.ApiDescriptions.ToLookup(                 api => api.ActionDescriptor.ControllerDescriptor.ControllerName); · provide documentation for your APIs by implementing the IDocumentationProvider interface. Documentation strings can come from any source that you like – e.g. extract XML comments or define custom attributes to apply to the controller [ApiDoc("Gets a product by ID.")] [ApiParameterDoc("id", "The ID of the product.")] public HttpResponseMessage Get(int id) · GlobalConfiguration.Configuration.Services – add the documentation Provider · To hide an API from the ApiExplorer, add the ApiExplorerSettingsAttribute Plugging into the Message Handler pipeline · Plug into request / response pipeline – derive from DelegatingHandler and override theSendAsync method – e.g. for logging error codes, adding a custom response header · Can be applied globally or to a specific route Exception Handling · Throw HttpResponseException on method failures – specify HttpStatusCode enum value – examine this enum, as its values map well to typical op problems · Exception filters – derive from ExceptionFilterAttribute & override OnException. Apply on Controller or action methods, or add to global HttpConfiguration.Filters collection · HttpError object provides a consistent way to return error information in the HttpResponseException response body. · For model validation, you can pass the model state to CreateErrorResponse, to include the validation errors in the response public HttpResponseMessage PostProduct(Product item) {     if (!ModelState.IsValid)     {         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); Cookie Management · Cookie header in request and Set-Cookie headers in a response - Collection of CookieState objects · Specify Expiry, max-age resp.Headers.AddCookies(new CookieHeaderValue[] { cookie }); Internet Media Types, formatters and serialization · Defaults to application/json · Request Accept header and response Content-Type header · determines how Web API serializes and deserializes the HTTP message body. There is built-in support for XML, JSON, and form-urlencoded data · customizable formatters can be inserted into the pipeline · POCO serialization is opt out via JsonIgnoreAttribute, or use DataMemberAttribute for optin · JSON serializer leverages NewtonSoft Json.NET · loosely structured JSON objects are serialzed as JObject which derives from Dynamic · to handle circular references in json: json.SerializerSettings.PreserveReferencesHandling =    PreserveReferencesHandling.All à {"$ref":"1"}. · To preserve object references in XML [DataContract(IsReference=true)] · Content negotiation Accept: Which media types are acceptable for the response, such as “application/json,” “application/xml,” or a custom media type such as "application/vnd.example+xml" Accept-Charset: Which character sets are acceptable, such as UTF-8 or ISO 8859-1. Accept-Encoding: Which content encodings are acceptable, such as gzip. Accept-Language: The preferred natural language, such as “en-us”. o Web API uses the Accept and Accept-Charset headers. (At this time, there is no built-in support for Accept-Encoding or Accept-Language.) · Controller methods can take JSON representations of DTOs as params – auto-deserialization · Typical JQuery GET request: function find() {     var id = $('#prodId').val();     $.getJSON("api/products/" + id,         function (data) {             var str = data.Name + ': $' + data.Price;             $('#product').text(str);         })     .fail(         function (jqXHR, textStatus, err) {             $('#product').text('Error: ' + err);         }); }            · Typical GET response: HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Mon, 18 Jun 2012 04:30:33 GMT X-AspNet-Version: 4.0.30319 Cache-Control: no-cache Pragma: no-cache Expires: -1 Content-Type: application/json; charset=utf-8 Content-Length: 175 Connection: Close [{"Id":1,"Name":"TomatoSoup","Price":1.39,"ActualCost":0.99},{"Id":2,"Name":"Hammer", "Price":16.99,"ActualCost":10.00},{"Id":3,"Name":"Yo yo","Price":6.99,"ActualCost": 2.05}] True OData support · Leverage Query Options $filter, $orderby, $top and $skip to shape the results of controller actions annotated with the [Queryable]attribute. [Queryable]  public IQueryable<Supplier> GetSuppliers()  · Query: ~/Suppliers?$filter=Name eq ‘Microsoft’ · Applies the following selection filter on the server: GetSuppliers().Where(s => s.Name == “Microsoft”)  · Will pass the result to the formatter. · true support for the OData format is still limited - no support for creates, updates, deletes, $metadata and code generation etc · vnext: ability to configure how EditLinks, SelfLinks and Ids are generated Self Hosting no dependency on ASPNET or IIS: using (var server = new HttpSelfHostServer(config)) {     server.OpenAsync().Wait(); Tracing · tracability tools, metrics – e.g. send to nagios · use your choice of tracing/logging library, whether that is ETW,NLog, log4net, or simply System.Diagnostics.Trace. · To collect traces, implement the ITraceWriter interface public class SimpleTracer : ITraceWriter {     public void Trace(HttpRequestMessage request, string category, TraceLevel level,         Action<TraceRecord> traceAction)     {         TraceRecord rec = new TraceRecord(request, category, level);         traceAction(rec);         WriteTrace(rec); · register the service with config · programmatically trace – has helper extension methods: Configuration.Services.GetTraceWriter().Info( · Performance tracing - pipeline writes traces at the beginning and end of an operation - TraceRecord class includes aTimeStamp property, Kind property set to TraceKind.Begin / End Security · Roles class methods: RoleExists, AddUserToRole · WebSecurity class methods: UserExists, .CreateUserAndAccount · Request.IsAuthenticated · Leverage HTTP 401 (Unauthorized) response · [AuthorizeAttribute(Roles="Administrator")] – can be applied to Controller or its action methods · See section in WebApi document on "Claim-based-security for ASP.NET Web APIs using DotNetOpenAuth" – adapt this to STS.--> Web API Host exposes secured Web APIs which can only be accessed by presenting a valid token issued by the trusted issuer. http://zamd.net/2012/05/04/claim-based-security-for-asp-net-web-apis-using-dotnetopenauth/ · Use MVC membership provider infrastructure and add a DelegatingHandler child class to the WebAPI pipeline - http://stackoverflow.com/questions/11535075/asp-net-mvc-4-web-api-authentication-with-membership-provider - this will perform the login actions · Then use AuthorizeAttribute on controllers and methods for role mapping- http://sixgun.wordpress.com/2012/02/29/asp-net-web-api-basic-authentication/ · Alternate option here is to rely on MVC App : http://forums.asp.net/t/1831767.aspx/1

    Read the article

  • How do I force ode45 to take steps of exactly 0.01 on the T axis?

    - by Gravitas
    I'm using Matlab to solve a differential equation. I want to force ode45 to take constant steps, so it always increments 0.01 on the T axis while solving the equation. How do I do this? ode45 is consistently taking optimized, random steps, and I can't seem to work out how to make it take consistent, small steps of 0.01. Here is the code: options= odeset('Reltol',0.001,'Stats','on'); %figure(1); %clf; init=[xo yo zo]'; tspan=[to tf]; %tspan = t0:0.01:tf; [T,Y]=ode45(name,tspan,init,options);

    Read the article

  • Change present working directory of a calling shell from a ruby script

    - by Erik Kastman
    I'm writing a simple ruby sandbox command-line utility to copy and unzip directories from a remote filesystem to a local scratch directory in order to unzip them and let users edit the files. I'm using Dir.mktmpdir as the default scratch directory, which gives a really ugly path (for example: /var/folders/zz/zzzivhrRnAmviuee+++1vE+++yo/-Tmp-/d20100311-70034-abz5zj) I'd like the last action of the copy-and-unzip script to cd the calling shell into the new scratch directory so people can access it easily, but I can't figure out how to change the PWD of the calling shell. One possibility is to have the utility print out the new path to stdout and then run the script as part of a subshell (i.e. cd $(sandbox my_dir) ), but I want to print out progress on the copy-and-unzipping since it can take up to 10 minutes, so this won't work. Should I just have it go to a pre-determined, easy-to-find scratch directory? Does anyone have a better suggestion? Thanks in advance for your help. -Erik

    Read the article

  • having a test debug app and a released debug app side by side

    - by Tristan
    Yo! When I download my app from the iStore, the latest test version installed to my phone gets over written. Does anyone know how to have two versions of the same app side by side? On a test project, I edited the build settings so that "realease" and "debug" have different product names. This seemed to solve my problem, however when I try this same trick on my actual project, the two overwrite each other again. Does anyone have a recommendation? I don't mind how it's done. Thanks! Tristan

    Read the article

  • JPA persistence.xml share same jar file

    - by user213855
    Hi! I'm wondering if I can share the same jar file for several persistence units.. I mean: I have two persistence units described in my persistence.xml file and the entities are not in the same JAR. Entities are in a separated JAR file but, in that one, there are entites for both persistence units. I think I red somewhere that I coould use tag something like this: externalEntities.jar#com.mycompany.EntityA so I could separate them. I tried this solution and it doesn't work. Now I guess that it couldn't be done to package all entities (for two different persistence units) in the same JAR file. What do yo think?

    Read the article

  • Matlab: how do I force ode45 to take steps of exactly 0.01 on the T axis?

    - by Gravitas
    I'm using Matlab to solve a differential equation. I want to force ode45 to take constant steps, so it always increments 0.01 on the T axis while solving the equation. How do I do this? ode45 is consistently taking optimized, random steps, and I can't seem to work out how to make it take consistent, small steps of 0.01. Here is the code: options= odeset('Reltol',0.001,'Stats','on'); %figure(1); %clf; init=[xo yo zo]'; tspan=[to tf]; %tspan = t0:0.01:tf; [T,Y]=ode45(name,tspan,init,options);

    Read the article

  • Strip tags (with tags inside attributes and nested tags) using javascript

    - by Kokizzu
    What the fastest (in performance) way to strip strings from tags, most solution i've tried that uses regexp not resulting correct values for tags inside attributes (yes, i know it's wrong), example test case: var str = "<div data-content='yo! press this: <br/> <button type=\"button\"><i class=\"glyphicon glyphicon-disk\"></i> Save</button>' data-title='<div>this one for tooltips <div>seriously</div></div>'> this is the real content<div> with another nested</div></div>" that should resulting: this is the real content with another nested

    Read the article

  • How to subclass a specific jqueryui widget method ?

    - by SBUJOLD
    Since I updated jQueryUI to 1.8 I found a couple of issues in our implementations and I could fix it myself without waiting for a fix on their end if I could find out how to subclass a specific method of the datepicker widget so I call the parent code and then execute my code. I was reading on $.widget but I just can't wrap my head around how that is suppose to work. I tried something like this: $.widget("ui.datepicker", { _showDatepicker: function(input) { alert('Yo'); $.datepicker.prototype._showDatepicker.apply(this,arguments); alert('Hey!'); } }); And all sorts of other variations and beging to think I just don't understand the 'extendability' of jQueryUI or it just can't be done. Anybody knows how I can achieve this ? Thx

    Read the article

  • How to extract valid email from larger string in Scala

    - by luigi-prog
    My scala version 2.7.7 Im trying to extract an email adress from a larger string. the string itself follows no format. the code i've got: import scala.util.matching.Regex import scala.util.matching._ val Reg = """\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b""".r "yo my name is joe : [email protected]" match { case Reg(e) => println("match: " + e) case _ => println("fail") } the Regex passes in RegExBuilder but does not pass for scala. Also if there is another way to do this without regex that would be fine also. Thanks!

    Read the article

  • Smalltalk web development software

    - by Friedrich
    I try to be very cautious with this question. There are at least three different web-development frameworks available in Smalltalk. The most prominent seems to be Seaside but there is also AIDA/Web and Iliad. They seems to be very similiar, but this impresson may be wrong. I wonder who has tried the different tools and can share the pros/cons of the different packages. A more concrete question would be, do yo know of let's say any software in the bookkeeing area which has choosen to use either of the three (or other) web development frameworks.

    Read the article

  • HTML/CSS Div placing

    - by Andreas Carlbom
    Yo. There's a tendency in placing divs to follow each other vertically, but what i'm trying to accomplish right now is to is basically to place a number of divs (two) inside a parent div like so: <div id='parent'><div id='onediv'></div> <div id='anotherone'></div> </div> And i'd like to place 'anotherone' just to the right of 'onediv'. Sadly, float:right is pretty much ruining the layout with the divs popping out of their parent divs and whatnot. Any suggestions are welcome. Edit: It might be worth noting that the parent div and 'anotherone' has no height elements at all, with 'onediv' planned to be thought as the "height support" div, allowing the contents of 'anotherone' to make the parent div larger at will.

    Read the article

  • CakePHP - radio button not showing error message

    - by teepusink
    Hi, I'm unable to get the error message to show up when creating a radio form using the CakePHP form helper. This is what I have now. $options=array('active'=>'Active','inactive'=>'Inactive'); echo $form->input('Status', array( 'type' => 'radio', 'id' => 'EntryStatus', 'name' => 'data[Entry][status]', 'options' => $options )); What am I missing? I'm using CakePHP 1.2.7 and this is what I have in the validation 'status' = array( 'notempty' = array( 'rule' = 'notempty', 'required' = true, 'message' = 'yo' ) ) Tried the answer from http://stackoverflow.com/questions/1388823/form-helper-for-creating-radio-button-in-cakephp and it's giving me a select option form instead. Thanks, Tee

    Read the article

  • Printing from a Windows Service

    - by Andre
    Ok, I am trying to print a page from a windows service that I installed using a Visual Studio setup project. At first I set the Account property yo Local System, but it will tell me that there are no printers installed (and there are). So I changed it to user and now it just doesn't print (no error or anything). I did some Googleing and basically it said that "Interact with Desktop" should be enabled. To programatically do this you need to edit the registry settings for this service (which really is second prize). I tried to manually set it on the properties dialog under Services, but then I need to change the Account back to Local System, which brings me back to the "No Printers Installed" problem. Any ideas?

    Read the article

  • how do i insert spaces into a string using the range function?

    - by user1319219
    If I have a string, for example which reads: 'Hello how are you today Joe' How am I able to insert spaces into it at regular intervals? So for example I want to insert spaces into it using the range function in these steps: range(0,27,2). So it will look like this: 'He lo ho w ar e yo u to da y Jo e' It now has a space at every 2nd index going up to it's end. How do I do this does anyone know? thanks.

    Read the article

  • What would be the best schema to store the 'address' for different entities?

    - by Cesar
    Suppose we're making a system where we have to store the addrees for buildings, persons, cars, etc. The address 'format' should be something like: State (From a State list) County (From a County List) Street (free text, like '5th Avenue') Number (free text, like 'Chrysler Building, Floor 10, Office No. 10') (Yes I don't live in U.S.A) What would be the best way to store that info: Should I have a Person_Address, Car_Address, ... Or the address info should be in columns on each entity, Could we have just one address table and try to link each row to a different entity? Or are there another 'better' way to handle this type of scenario? How would yo do it?

    Read the article

  • Stop jQuery animations stacking

    - by Chris
    I have an Options box that hovers in the top right of the webpage. It's opacity is set to 10% so as not to be obstructive to users. When they hover over (mouseenter) it I use jQuery to fade it in and slidedown the content (and the reverse on mouseout). If they do this repeatedly though the animation stacks up and you can sometimes be left in a situation where your mouse is stood still but the box is yo-yoing around. How can I get around this situation? Here is how I currently setup the animations $("#dropdown").mouseenter(function() { $(this).fadeTo('fast',1); $("#options").slideDown(); }); $("#dropdown").mouseleave(function() { $(this).fadeTo('fast',0.1); $("#options").slideUp(); }); Note I am using jQuery only and not any other plugins.

    Read the article

  • Click a button in another application

    - by sam
    I want yo use SendMessage or PostMessage to press a button in another app i have a sample code to do this but by getting Window Handle, but don't work also i used "WinDowse" to get required info. here is the code private const uint BM_CLICK = 0x00F5; private const uint WM_LBUTTONDOWN = 0x0201; private const uint WM_LBUTTONUP = 0x0202; private void PushOKButton(IntPtr ptrWindow) { WindowHandle = FindWindow(null, "Form1"); if (ptrWindow == IntPtr.Zero) return; IntPtr ptrOKButton = FindWindowEx(ptrWindow, IntPtr.Zero, "Button", "&Yes"); if (ptrOKButton == IntPtr.Zero) return; SendMessage(ptrOKButton, WM_LBUTTONDOWN, 0, 0); SendMessage(ptrOKButton, WM_LBUTTONUP, 0, 0); SendMessage(ptrOKButton, BM_CLICK, 0, 0); } is There a Compelete Suloution in c# ?

    Read the article

  • Insert Statment with Case for avoid duplicate record insertion

    - by rama
    I have written the below SP for Precheck for Duplicate records before insert into Table . but it is not allow me yo write insert staement inside the CASE . how can I write Stored Procedure for fist Check the value @Ordername into table After that if it is not present then it should inserted into Database . CREATE PROCEDURE [Test Procedure ] ( @section varchar(70), @mark varchar(70), @qty decimal(18,2), @Weight decimal(18,2), @dateupdateremark int, @OrderName varchar(70) ) AS BEGIN SET NOCOUNT ON; select case(@OrderName) when (select OrderName from dbo.tbl_insertxmldetails where(@OrderName) not in (select OrderName from tbl_insertxmldetails)) then insert into dbo.tbl_insertxmldetails (Section, Mark, QTY,Weight,Dateupdateremark ,OrderName,SystemDate) values (@Section, @Mark, @QTY,@Weight, @Dateupdateremark,@OrderName,GETDATE()) else 'File already Exists' end

    Read the article

  • Getting Null value with JSON from MySQL, how to retrive data from MySQL to JSON correctly?

    - by sky
    I'm using following code but cannot return data from MySQL. This is the output: <script type="text/javascript"> var somethings= [null,null,null]; </script> It does have three post, but I couldn't get the title(message) output. EDIT: this is the code I'm using: <?php $session = mysql_connect('localhost','name','pass'); mysql_select_db('dbname', $session); $result= mysql_query('SELECT * FROM posts', $session); $somethings= array(); while ($row= mysql_fetch_assoc($result)) { $somethings[]= $row['something']; } ?> <script type="text/javascript"> var somethings= <?php echo json_encode($somethings); ?>; </script> This is the table: message Try iPhone post! Welcome to Yo~ :) ??!

    Read the article

  • JMX Based Monitoring - Part Two - JVM Monitoring

    - by Anthony Shorten
    This the second article in the series focussing on the JMX based monitoring capabilities possible with the Oracle Utilities Application Framework. In all versions of the Oracle utilities Application Framework, it is possible to use the basic JMX based monitoring available with the Java Virtual Machine to provide basic statistics ablut the JVM. In Java 5 and above, the JVM automatically allowed local monitoring of the JVM statistics from an approporiate console. When I say local I mean the monitoring tool must be executed from the same machine (and in some cases the same user that is running the JVM) to connect to the JVM directly. If you are using jconsole, for example, then you must have access to a GUI (X-Windows or Windows) to display the jconsole output. This is the easist way of monitoring without doing too much configration but is not always practical. Java offers a remote monitorig capability to allow yo to connect to a remotely executing JVM from a console (like jconsole). To use this facility additional JVM options must be added to the command line that started the JVM. Details of the additional options for the version of the Java you are running is located at the JMX information site. Typically to remotely connect to a running JVM that JVM must be configured with the following categories of options: JMX Port - The JVM must allow connections on a listening port specified on the command line Connection security - The connection to the JVM can be secured. This is recommended as JMX is not just a monitoring protocol it is a managemet protocol. It is possible to change values in a running JVM using JMX and there are NO "Are you sure?" safeguards. For a Oracle Utilities Application Framework based application there are a few guidelines when configuring and using this JMX based remote monitoring of the JVM's: Online JVM - The JVM used to run the online system is embedded within the J2EE Web Application Server. To enable JMX monitoring on this JVM you can either change the startup script that starts the Web Application Server or check whether your J2EE Web Application natively supports JVM statistics collection. Child JVM's (COBOL only) - The Child JVM's should not be monitored using this method as they are recycled regularly by the configuration and therefore statistics collected are of little value. Batch Threadpoools - Batch already has a JMX interface (which will be covered in another article). Additional monitoring can be enabled but the base supported monitoring is sufficient for most needs. If you are an Oracle Utilities Application Framework site, then you can specify the additional options for JMX Java monitoring on the OPTS paramaters supported for each component of the architecture. Just ensure the port numbers used are unique for each JVM running on any machine.

    Read the article

  • Puppet: Getting Started On Windows

    - by Robz / Fervent Coder
    Originally posted on: http://geekswithblogs.net/robz/archive/2014/08/07/puppet-getting-started-on-windows.aspxNow that we’ve talked a little about Puppet. Let’s see how easy it is to get started. Install Puppet Let’s get Puppet Installed. There are two ways to do that: With Chocolatey: Open an administrative/elevated command shell and type: choco install puppet Download and install Puppet manually - http://puppetlabs.com/misc/download-options Run Puppet Let’s make pasting into a console window work with Control + V (like it should): choco install wincommandpaste If you have a cmd.exe command shell open, (and chocolatey installed) type: RefreshEnv The previous command will refresh your environment variables, ala Chocolatey v0.9.8.24+. If you were running PowerShell, there isn’t yet a refreshenv for you (one is coming though!). If you have to restart your CLI (command line interface) session or you installed Puppet manually open an administrative/elevated command shell and type: puppet resource user Output should look similar to a few of these: user { 'Administrator': ensure => 'present', comment => 'Built-in account for administering the computer/domain', groups => ['Administrators'], uid => 'S-1-5-21-some-numbers-yo-500', } Let's create a user: puppet apply -e "user {'bobbytables_123': ensure => present, groups => ['Users'], }" Relevant output should look like: Notice: /Stage[main]/Main/User[bobbytables_123]/ensure: created Run the 'puppet resource user' command again. Note the user we created is there! Let’s clean up after ourselves and remove that user we just created: puppet apply -e "user {'bobbytables_123': ensure => absent, }" Relevant output should look like: Notice: /Stage[main]/Main/User[bobbytables_123]/ensure: removed Run the 'puppet resource user' command one last time. Note we just removed a user! Conclusion You just did some configuration management /system administration. Welcome to the new world of awesome! Puppet is super easy to get started with. This is a taste so you can start seeing the power of automation and where you can go with it. We haven’t talked about resources, manifests (scripts), best practices and all of that yet. Next we are going to start to get into more extensive things with Puppet. Next time we’ll walk through getting a Vagrant environment up and running. That way we can do some crazier stuff and when we are done, we can just clean it up quickly.

    Read the article

  • How do I configure permissions for a cluster share using Powershell on 2008?

    - by Andrew J. Brehm
    I have a cluster resource of type "file share" but when I try to configure the "security" parameter I get the following error (excerpt): Set-ClusterParameter : Parameter 'security' does not exist on the cluster object Using cluster.exe I get a better result, namely the usual nothing when the command worked. But when I check in Failover Cluster Manager the permissions have not changed. In Server 2003 the cluster.exe method worked. Any ideas? Update: Entire command and error. PS C:\> $resource=get-clusterresource testshare PS C:\> $resource Name State Group ResourceType ---- ----- ----- ------------ testshare Offline Test File Share PS C:\> $resource|set-clusterparameter security "domain\account,grant,f" Set-ClusterParameter : Parameter 'security' does not exist on the cluster object 'testshare'. If you are trying to upda te an existing parameter, please make sure the parameter name is specified correctly. You can check for the current par ameters by passing the .NET object received from the appropriate Get-Cluster* cmdlet to "| Get-ClusterParameter". If yo u are trying to update a common property on the cluster object, you should set the property directly on the .NET object received by the appropriate Get-Cluster* cmdlet. You can check for the current common properties by passing the .NET o bject received from the appropriate Get-Cluster* cmdlet to "| fl *". If you are trying to create a new unknown paramete r, please use -Create with this Set-ClusterParameter cmdlet. At line:1 char:31 + $resource|set-clusterparameter <<<< security "domain\account,grant,f" + CategoryInfo : NotSpecified: (:) [Set-ClusterParameter], ClusterCmdletException + FullyQualifiedErrorId : Set-ClusterParameter,Microsoft.FailoverClusters.PowerShell.SetClusterParameterCommand

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >