w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Cannot add System.Net.Http reference to Xamarin.iOS Library project
WOW !! What a work around. Ok, here's the solution. Looks like the Visual Studio pluggin does NOT get updated when you update Xamarin Studio on your windows box. HOWEVER, when you go to your mac build server and update Xamarin to the Alpha version, then open a Xamarin Project in Visual Studio, it will prompt you that the build server and Pluggin are different versions and will allow you to upgrade. When you upgrade, after closing visual studio, then open visual studio again, VOILA!!! The System.Net.Http reference is now available under Assemblies when adding a reference. So, the solution is to update your MAC Xamarin Studio to the Alpha version and then Visual Studio will prompt you for an update. Update it and you're golden !! Seems like there should be an easier way, but this on

Categories : IOS

Instantiate new System.Web.Http.OData.Query.ODataQueryOptions in nunit test of ASP.NET Web API controller
Looks like someone else already answered this in the comments here, but it's not a complete solution for my use-case (see comment below): ODataModelBuilder modelBuilder = new ODataConventionModelBuilder(); modelBuilder.EntitySet<Customer>("Customers"); var opts = new ODataQueryOptions<Customer>(new ODataQueryContext(modelBuilder.GetEdmModel(),typeof(Customer)), request);

Categories : Asp Net Web Api

Scala play http filters: how to find the request body
In the controller method that routes to the action, simply call Map<String, String[]> params = request().queryString(); This will get you a map of parameters, where you can then call params.get("someParam")[0] to get the param (if it is a single value). If the param is a list, ignore the indexing andthat will return an array.

Categories : Scala

Filters in a VS2010 project lost after a restart
In VS2010, they aren't folders, they're filters. They are logical groupings that are managed in your .vcxproj.filters file, which is XML-based (make a new C++ project and take a look at the file in a simple text editor, if you're curious). Most likely, that file got corrupted or wasn't saved properly when you had the sudden restart, and you'll have to reorganize them again.

Categories : C++

Chaining Angular filters in controller while making them variable
An approach is to use a function to return the filtered data: function MainCtrl($scope, $filter) { $scope.numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; $scope.filteredNumbers = function() { var result = $scope.numbers; if ($scope.oddListEnabled) { result = $filter('oddList')(result); } if ($scope.luckyListEnabled) { result = $filter('luckyList')(result); } return result; }; } And the template: <ul> <li ng-repeat="number in filteredNumbers()"> {{number}} </li> </ul> Here is a plunkr: http://plnkr.co/edit/4ectDA?p=preview

Categories : Angularjs

Rails Testing controller methods with instance variables set in before filters
Filters and callbacks are hard to test and debug. Avoid them when possible. In this case I don't think your before_filter is necessary, thus no need to test it. The better home for the methods is model. Check my refacoring: class User < ActiveRecord::Base delegate :inbox, :sentbox, :trash, to: :mailbox end class ConversationsController < ::ApplicationController def index @conversations = current_user.send get_box end private def get_box # your code end end That's all. Should be enough. You can then test regularly.

Categories : Ruby On Rails

Good project layout for a ruby system project?
This is a pretty standard structure. Drawn from RubyGem Tutorial . bin/ # Executables here data/ # Assets here doc/ # RDOC for the lib directory lib/ # Code for the project project_module.rb # Contains project module project_module/ # Classes for project module # Either spec/ # RSpec Tests test/ # Test::Unit Tests

Categories : Ruby

ABTesting by using an ActionFilterAttribute
This does seem like a reasonable solution. I know this because I have used this same concept to develop an A/B testing framework (http://www.nuget.org/packages/AbTestMaster). It's freely available on nuget and is open source as well. That might make your life slightly simpler.

Categories : Asp Net Mvc

ActionFilterAttribute not redirecting
+1 for Wouter's result. Given the code you've shown, it shouldn't be possible to achieve the results you describe. Perhaps the // magic logic here is returning a null _filterContext.Result?

Categories : Dotnet

Rackspace - php-opencloud filters - Documentation for valid ObjectList filters?
Unfortunately, the underlying API doesn't support filtering for objects in Swift/Cloud Files containers (cf. http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Objects-d1e1284.html). The $filter parameter is supported as part of the shared code, but it doesn't actually do anything with Cloud Files here. I'll see if I can get the docs updated to reflect that.

Categories : PHP

how to pass a parameter from action to ActionFilterAttribute code
Use HttpContext.Items HttpContext.Items["something"] = 1; In ActionFilter, you can access it as: var something = (int)filterContext.HttpContext.Items["something"]; However, your example of action filter is OnActionExecuting; this will execute before any of your Index/About actions executes. So you should initialize 'something' somewhere else as per your needs (for example, inside controller's OnActionExecuting method).

Categories : Asp Net Mvc

How to reference System.Net.Http in WP8?
The System.Net.Http package you're trying to use has been deprecated but you can use Microsoft.Net.Http instead.

Categories : C#

Is it possible to use persistent connections with System.Net.Http.HttpClient?
I'm not sure what exactly you are trying to solve but have you looked at SignalR ? They have pretty fancy websocket api's that might do the job you are looking for. If you are not using .NET 4.5 then they do have alternate mechanisms. One I'v seen being used is something like a server/event-stream.

Categories : C#

net/http ignoring system proxy settings
You can get proxy info using ProxyFromEnvironment function. Then you create http client using transport (represented by RoundTripper interface) that has info about your proxy settings: var PTransport RoundTripper = &http.Transport{Proxy: http.ProxyFromEnvironment} client := http.Client{Transport: PTransport} Then you just do http request using the info transport gets from passed function to Proxy struct field. Proxy info will be taken from $HTTP_PROXY environment variable.

Categories : Go

Order property in System.Web.Http.AuthorizeAttribute
I can answer one of your questions. Also, does the attribute at the class level always take precedence over the attribute that decorates the action? ApiController.ExecuteAsync() runs the list of filters gotten from HttpActionDescriptor.GetFilterPipeline(). Here is the comment given for GetFilterPipeline(). ///Returns the filters for the given configuration and action. The filter ///collection is ordered according to the FilterScope (in order from ///least specific to most specific: First, Global, Controller, Action) So, the gloabl filters run first, followed by controller level and then action level filters. As far as your other question on how to order, I don't have a clear answer though. I understand the filters (attributes) are retrieved using Type.GetCustomAttributes(). Thi

Categories : Asp Net Mvc

How to use System.Net.Http.HttpClient to GET after POST with AllowAutoRedirect = true
From the log trace you added, it looks like the response from the POST is a 201 (Created); there is no redirect. The response does contain a URL (either in a header or the body, hard to tell) but it will not mean anything special. Your client will need to parse the URL itself and issue the subsequent GET request explicitly.

Categories : C#

Google Drive SDK System.Net.Http.Primitives Version 1.5.0.0 instead of 2.1.10.0
Please follow our instructions in the Build wiki page. I recommend you to use NuGet to get the 3rd party packages (including Microsoft.Net.Http package)

Categories : C#

Google Analytics API v3 / C# - System.Net.Http.Primitives Error
Follow the instructions on the build page for the .NET api (copied here as per community suggestions): Install the specific Google API you want to use (e.g. Google.Apis.Calendar.v3) Install Google.Apis.Authentication

Categories : C#

Wrong version of System.Net.Http on build server
It is now fixed. I have done the following things - 1 - Specify the version in the assemblies. <system.web> <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </assemblies> </compilation> 2 - Set 'copy local' to true for System.Net.Http 3 - Copy the System.Net.Http.dll v4 into the project directory - thanks Aevitas. Very sorry if this does not help anyone with seemingly the same issue. I had to made a lot of little changes and may not have remembered them all. Thanks

Categories : C#

WPF looks different for a .net 3.5 project after installing .net 4.5 on my system
.Net 4.5 is not side-by-side with .Net 4.0 . It will actually replace 4.0. On channel 9 I have listened to an interview from the BCL team where they promise that it would do so without any side effects (or at least no bad side effects) But for WPF there obviously is some Changes. In Your case it is for the better - at least when somebody is installing .Net 4.5 it will be better. I have a case where it is good in .Net 4 and looks bad in .Net 4.5 - so I hope my clients don't update before I find a solution ... But I understand that Your problem for the moment has more priority ... Below link to: .NET 4.5: BCL Team - Improvements and Evolution http://channel9.msdn.com/posts/NET-45-Conversation-with-the-BCL-Team-Improvements-Evolution-and-More

Categories : Wpf

Connection keep-alive not working with System.Net.Http.HttpClient on certain hosts
Some proxy servers will ignore the keep-alive when doing their authentication. If I recall correctly it's when the proxy server uses NTLM authentication. In the past, I've had to add a partial class to "help" some web service proxy classes. I overrode the GetWebRequest(Uri uri) method with System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri); webRequest.ProtocolVersion = HttpVersion.Veraion10; // I know this is strange, but it works webRequest.ServicePoint.Expect100Continue = false; // This is where the magic lives return webRequest;

Categories : Dotnet

BreezeControllerAttribute exception: Could not load file or assembly 'System.Net.Http
This is most definitely a binding redirect issue. I advice you copy the entire <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> content from a fresh ASP.NET MVC 4 project to your web.config file. This happens to me occasionally and refreshing the messed up bindings fixes the issue.

Categories : Asp Net Web Api

MiniProfiler.Current is null when called from System.Net.Http.DelegatingHandler
MiniProfiler Timings are stored in HttpContext.Current by default (as you discovered). Thus if you are calling MiniProfiler from a place where HttpContxt.Current is null, the results cannot be saved. The solution is to save (and retrieve) the results from somewhere else. MiniProfiler offers the option of the option of changing the location where all results should be stored and retrieved from (using MiniProfiler.Settings.Storage). The new v3 MiniProfiler (beta nuget here) offers the option of configuring different IStorage for each request, and for using a MultiStorageProvider to designate multiple locations into which results can be stored and retrieved. You can see an example of this in the Sample.Mvc project on github. In your case, the best approach might be to set a MultiStoragePro

Categories : Asp Net Web Api

HTTP POST request to C# Controller
You're missing processData: false in your ajax call. Without that, ajax is going to try to pack the data into the URL query string. (See here: http://api.jquery.com/jQuery.ajax/) If data is { 'animal': 'elephant', 'count': 5 } and processData is true (the default), ajax will do the POST to the URL /Weather1/Weather_post?animal=elephant&count=5 with an empty HTTP request body. This is why you want processData: false.

Categories : C#

Does System.Net.Http.HttpClient support sending a GET request with an entity body?
I know it's a while since you asked this but here goes anyway. While sending a payload in the body of a GET request may not violate the RFC's client-side, it does go against common practice. What the RFC's do say is that a server fielding such a request is in no way obliged to look at anything other than the request URI and the Host: header in order to determine what its response should be. Quoting from the HTTP 1.1 specification in RFC2616, section 5.2 says: "The exact resource identified by an Internet request is determined by examining both the Request-URI and the Host header field." It says nothing about a request body. This means that, even if what you're attempting to do is not in violation of any RFC, the web service consumed by your WP8 app is. If you have no option but to use i

Categories : C#

Randomly seeing System.NotSupportedException: http in WebRequest.GetCreator(string prefix)
I saw this in some of the earlier versions of Mono 2.10 (a couple of years ago actually), and helped tracking it down (but I haven't seen it for some time now). If my memory doesn't fail me it was a race condition in either ASP.Net's startup path or a bug in the synchronization primitives ASP.Net was using. It was fairly tricky to track it down, it only happened on the production server (of course) and only sporadically. In my case it only happened after an ASP.Net restart. I had bots connecting periodically to a server, and if the server had been down for some time there would be many bots anxiously pounding the server once it got back, apparently making the race condition easier to trigger. In order to narrow it down I built Mono from source and added Console.WriteLine statements. Af

Categories : C#

Returning HTTP 403 substatus from Asp.Net WebApi controller
That's because sub-statuses are not part of the HTTP spec and should not be used. If you want to send more details about the problem you encountered, take a look at Json-problem

Categories : Asp Net Web Api

share http.get data between factory and controller
When injecting factories into Angular controllers, the injected factory reference contains those members that you've returned from the factory: myApp.factory("mainData", function($http) { var mData = {}; $http.get('gethome.php').success(function(data) { mData.data = data; }); return mData; }); myApp.controller("HomeCtrl", function($scope, mainData) { $scope.home = mainData.data; // Here mainData equals mData object literal from the mainData factory }); But, the problem with your code is that mainData.data will always be undefined, because factory will return before the async $http request is completed. So instead, your factory should be returning a promise: myApp.factory("mainData", function($http) { return $http.get('gethome.php'); }); myApp.controller("HomeCtrl",

Categories : Http

Attach Controller to $http html data?
It appears that your scenario would be a good place to apply ng-include. For example, given this markup: <div ng-controller="MainCtrl"> <div ng-include="template"/> </div> and this code in MainCtrl: function MainCtrl($scope) { // some logic that would determine the template you want to load $scope.template = 'templates/myTemplate.html'; } and this code in templates/myTemplate.html: <div ng-controller="TemplateCtrl"> <!-- Template Content --> </div> angular will automatically download templates/myTemplate.html and apply TemplateCtrl to the template. (Of course you'd also need to have TemplateCtrl defined.) When you want to switch templates, in MainCtrl you'll need to change the value of $scope.template to another template url; th

Categories : Angularjs

Hiding http file extension without using MVC controller
This sounds like a job for Url Routing Url Routing allows you to intercept a request and then determine how to service it. It is how MVC does it and has many other useful benefits. If the router isn't able to service it, it falls back to the default ASP.NET pipeline processing, and then IIS.

Categories : Asp Net

Injecting $http and $scope into function within controller
With the help of Brandon Tilley's comment & article I solved the problem as follows. However, I'm going to keep the question open until someone else answers or until I understand enough to write an accompanying explanation. controller('ImagesCtrl', ['$scope', '$http', '$injector', function ($scope, $http, $injector) { $scope.didSelectLanguage=function() { $http.jsonp('http://localhost:3000/image?quantity=1&language='+this.language+'&Flag=&callback=JSON_CALLBACK') .success(function(data){ $scope.$parent.image = data; }); } }])

Categories : Angularjs

Unit Testing Controller for HTTP and HTTPS in MVC
you can write a test that make it runs trying to use https protocol, and some that use other protocols (http,ftp...). check that https works and other are refused. Please give more details if you can.

Categories : Asp Net Mvc

android export eclipse project from 32 bit to 64 bit system
there is no issue for x86 or x64 win os step1 File->Import->Android->Existing Android code into Workspace, Next step2 Select root directory: browse the existing project folder in the computer step3: Projects->Select All click-> Finish

Categories : Java

Adapting Windows project to Linux System
If you are trying to port a Windows device driver to Linux, you may as well throw out the code. The Linux kernel works very differently to the Windows kernel. Since you have basically no abstraction in kernel programming, there is no real way to make cross-platform drivers, even if you use a Linux toolchain on Windows. Linux and Windows have completely different kernel designs, meaning the code you write for one simply won't work on the other. It is difficult enough to try and compile Linux userspace programs on Windows, let alone trying to entirely port Windows drivers to Linux.

Categories : Windows

Own Node.js project installed globally on own system
You have to add some code into package.json and hash.js, then you can run this command to install the package from local folder. npm install -g ./node-hash package.json { "name": "hash", "version": "1.0.0", "author": "Kiel V.", "engines": [ "node >= 0.8.0" ], "bin": { "hash": "hash.js" }, "main": "hash.js", "dependencies": { "commander" : "1.2.0" }, "scripts": { "start": "node hash.js" } } hash.js #!/usr/bin/env node var crypto = require('crypto'), commander = require('commander'); /* For use as a library */ function hash(algorithm, str) { return crypto.createHash(algorithm).update(str).digest('hex'); } exports.hash = hash; /* For use as a stand-alone app */ commander .version('1.0.0')

Categories : Javascript

Async read methods in System.Net.Http.HttpContent missing CancellationToken overload
It's not part of the API, however, you could register a Dispose against the token: CancellationToken ct; //passed in ct.Register(() => myHttpContent.Dispose()); string content; try { content = await myHttpContent.ReadAsStringAsync(); } catch(Exception) //suspect an ObjectDisposedException, but worth checking { if(ct.IsCancellationRequested) { //cancellation was requested //underlying stream is already closed by the Dispose call above } }

Categories : C#

How to set routes for a controller in MVC. Always returns "HTTP Error 404.0 - Not Found"
I'm not sure your route is working beyond the default, as you're explicitly providing the parameters. Try registering your route in RouteConfig.cs http://www.jondavis.net/techblog/post/2012/06/23/ASPNET-MVC-4-Where-Have-All-The-Globalasax-Routes-Gone.aspx

Categories : Asp Net Mvc

AngularJS calls HTTP multiple times in controller
I don't think it is getting called twice, i just created a plunk for you to see this. var app = angular.module('projectsApp', []); app.controller('filtersController', ['$scope', '$http', function ($scope, $http) { $scope.status = 'Page loading'; var count = 0; $scope.init = function () { $scope.status = 'API called'; $http({ method: 'GET', url: '/json-tags-test', cache: true }).success(function (data, status, headers, config) { // this callback will be called asynchronously // when the response is available console.log('success'); count++; $scope.status = 'successful: '+ count; }).error(function (data, status, headers, config) { // calle

Categories : Json

Creating Visual Studio project system with MEF and VSIX
Unfortunately, Visual Studio API is really ugly. If you’ll make a deep integration with internal mechanisms of Visual Studio, you’ll have to use “hideous COM”. Directly or through managed wrappers (Interop Assemblies). To avoid confusion I try to explain concepts of Visual Studio Extensibility and post useful links to documentation. Hope it will help you. You can extend Visual Studio by using macros, add-ins, VSPackages, and Managed Extensibility Framework (MEF) extensions. Starting with Visual Studio 2012, Visual Studio Extensions no longer supports macros! However, use VSPackages provide more opportunities. For more details see MSDN: Walkthrough: Creating a VSPackage MSDN: Creating Add-ins and Wizards MSDN: Get Started with Extending Visual Studio MSDN: Inside the Visual Stud

Categories : C#

Heroku django project read-only file system
This is by design. Your app is compiled into a slug for fast distribution by the dyno manager. The filesystem for the slug is read-only, which means you cannot dynamically write to the filesystem for semi-permanent storage. The following types of behaviors are not supported: Caching pages in the public directory Saving uploaded assets to local disk (e.g. with attachment_fu or paperclip) Writing full-text indexes with Ferret Writing to a filesystem database like SQLite or GDBM Accessing a git repo for an app like git-wiki https://devcenter.heroku.com/articles/read-only-filesystem If you want to upload files, you need to do so to S3 or any of the other storage backends supported by django-storages.

Categories : Django



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.