w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
View get requests being made by an iOS app
I use Charles for this purpose. http://www.charlesproxy.com/ You set it up on your computer and then set your iOS device to use it as a proxy. It will show you all network traffic and is easy to use. You can also pass back different information if you want to simulate a server that isn't running yet.

Categories : IOS

Multiple Ajax Requests per MVC 4 View
I redesigned the way I do my context now. I have my context then I implement IDbContextFactory<TContext> called DefaultContextFactory<MyContext> and I inject them. In the Repository I have in the public constructor _context = contextFactory.Create();. Then throughout the repository i just use _context.WhatEver() and its fine. I also did in the ModuleLoader Bind<IRepository>().To<DefaultRepository>().InTransientScope() in order to make every call to it create a new repository! I don't need a repository factory because I only have one repository!

Categories : C#

Django - testing view which works with ajax requests
It looks like your login_required decorator is redirecting your unauthenticated user. Make sure you create a test user and log that user in using test client login method https://docs.djangoproject.com/en/dev/topics/testing/overview/#django.test.client.Client.login

Categories : Django

Devise: how to use another mail view when user requests email change ( instead of the default )
This is not trivial task, actualy you need to overwrite this devise method inside your model: def send_confirmation_instructions if reconfirmation_required? self.confirmation_token = nil if reconfirmation_required? @reconfirmation_required = false ensure_confirmation_token! opts = pending_reconfirmation? ? { :to => unconfirmed_email } : { } send_devise_notification(:reconfirmation_instructions, opts) else super end end Then you need to extend Devise::Mailer to add method reconfirmation_instructions And finally you need to create view app/views/devise/mailer/reconfirmation_instructions.html.erb

Categories : Ruby On Rails

python-requests returning unicode Exception message (or how to set requests locale)
You can try os.strerror, but it would probably return nothing or the same non-English string. This hard-coded English was scraped from here: http://support.microsoft.com/kb/819124 ENGLISH_WINDOWS_SOCKET_MESSAGES = { 10004: "Interrupted function call.", 10013: "Permission denied.", 10014: "Bad address.", 10022: "Invalid argument.", 10024: "Too many open files.", 10035: "Resource temporarily unavailable.", 10036: "Operation now in progress.", 10037: "Operation already in progress.", 10038: "Socket operation on nonsocket.", 10039: "Destination address required.", 10040: "Message too long.", 10041: "Protocol wrong type for socket.", 10042: "Bad protocol option.", 10043: "Protocol not supported.", 10044: "Socket type not supported.",

Categories : Python

How to limit download rate of HTTP requests in requests python library?
There are several approaches to rate limiting; one of them is token bucket, for which you can find a recipe here and another one here. Usually you would want to do throttling or rate limiting on socket.send() and socket.recv(). You could play with socket-throttle and see if it does what you need. This is not to be confused with x-ratelimit rate limiting response headers, which are related to a number of requests rather than a download / transfer rate.

Categories : Python

Apache Camel - aggregator to space out requests, but not queuing requests
I believe you would be interested in seeing the Throttler pattern, which is documented here http://camel.apache.org/throttler.html Hope this helps :) EDIT - If you are wanting to eliminate excess requests, you can also investigate setting a TTL (Time to live) header within JMS and add a concurrent consumer of 1 to your route, which means any excess messages will also be discarded.

Categories : Apache

.htaccess rewrite to add .php to no extension requests, BUT to not accept .php requests by users
I am not a htaccess guru yet, but I hope this helps: RewriteCond %{THE_REQUEST} .php RewriteRule .php$ - [R=404] RewriteCond %{REQUEST_URI} !(.php) RewriteCond %{REQUEST_URI} !(^/error/.*$) RewriteRule ^(.*)$ $1.php [L]

Categories : Apache

Consecutive requests with python Requests.Session() not working
In the lastest version of requests, he sessions object is with Cookie Persistence, look the requests Sessions ojbects docs. So you don't need add the cookie artificialy. Just import requests s=requests.Session() login_data = dict(userName='user', password='pwd') ra=s.post('http://example/checklogin.php', data=login_data) print ra.content print ra.headers ans = dict(answer='5') r=s.post('http://example/level1.php',data=ans) print r.content Just print the cookie to look up wheather you were logged. for cookie in s.cookies: print (cookie.name, cookie.value) And is the example site is yours? If not maybe the site reject the bot/crawler ! And you can change your requests's user-agent as looks likes you are using a browser. For example: import requests s=requests.Session() headers

Categories : Python

Why doesn't requests.get() return? What is the default timeout that requests.get() uses?
What is the default timeout that get uses? I believe the timeout is None, which means it'll wait (hang) until the connection is closed. What happens when you pass in a timeout value? r = requests.get( 'http://www.justdial.com', proxies={'http': '222.255.169.74:8080'}, timeout=5 )

Categories : Python

How to redirect all HTTPS requests to HTTP requests?
In the Global.asax file try something like. protected void Application_BeginRequest() { if (Context.Request.IsSecureConnection) Response.Redirect(Context.Request.Url.ToString().Replace("https:", "http:")); }

Categories : Asp Net Mvc

Configuring Spring MVC to map GET requests to one method in a controller and OPTIONS requests to another method
With the SimpleUrlHandlerMapping it is not possible specify the http method. Probably you have to use other mapping like the MethodUrlHandlerMapping in the Spring MVC REST project (http://spring-mvc-rest.sourceforge.net/). The way to declare the mappings using the MethodUrlHandlerMapping should be something like this: <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="GET /hitmycontroller">MyController</prop> <prop key="OPTIONS /hitmycontroller">MyController</prop> </props> </property> </bean> You can see the example in their page: http://spring-mvc-rest.sourceforge.net/introduction.html Look at the par

Categories : Java

Strongly Attributed Property in Master View Becomes Null After Callback Delegation from Detail View in Split View Controller
Based on the comment conversation under the question one possibility is that inconsistent variable naming might be the problem. It looks like you might have "@synthesize idSearchBar = searchBar;" in your implementation so self.idSearchBar and searchBar are effectively the same thing. The problem with this is a local variable called searchBar somewhere else in your class could overwrite your instance variable. So try this: Change the synthesize line to "@synthesize idSearchBar = _idSearchBar;" or remove the @synthesize line completely and let the compiler auto-generate that exact line for you (if using LLVM compiler 4.0). Change all searchBar usage that show up as an error to "self.idSearchBar" to be consistent throughout your class. Any leftover uses of searchBar will be local variables

Categories : IOS

What would be more efficient to load content on a detail view from a view controller with a table view?
It's not totally clear from your question where the data is coming from. I'm assuming because you mention a JSON call that when you select an item on your table view you need to make a web service call to fetch additional information about that item before displaying your detail view. If that's the case then you should make the web service call and load the data whilst in the detail view controller. Apple's interface guidelines recommend you do it this way to give the appearance of responsiveness. The detail view controller will be displayed immediately after the row in the table view has been tapped. You can use an activity indicator or loading graphic in your detail view to let the user know additional information is being downloaded. This is a considerably better experience than waiti

Categories : Iphone

Create custom UI bar button (to change view from list view, grid view)
It is UISegmentedControl not UIButton UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] init]; [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"0.png"] atIndex:0 animated:NO]; [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"1.png"] atIndex:1 animated:NO]; UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl]; [[[self navigationController] navigationItem] setRightBarButtonItem:barButtonItem];

Categories : IOS

MySql VIEW ERROR 'View 'tablet_001.hisrec' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them'
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'tablet_001' AND TABLE_NAME = 'hisrec'; Check out your view and see what is the problem,if you don't know post it here.

Categories : Mysql

android - can not setvisiblity view.invisible for view with default view.gone
This is probably because in your parent layout you have android:layout_width="wrap_content" either change this to android:layout_width="match_parent" or a fixed width, which I don't recommend. Or change the visibility of the View to invisible instead of gone in your xml. When the layout is first drawn, that space isn't available with the properties you have set. With my recommendations, the space will still be there to be used by another View. You could also change the width of the parent layout programmatically when you want to change the visibility of your ImageView but that would be more work and probably unnecessary in this situation.

Categories : Android

iOS Nested View Controllers view inside UIViewController's view?
No, this is generally good design, it helps keep your view controllers concise. However you should be using the view controller containment pattern, take a look at the following documentation. Implementing a Container View Controller This is incredibly simple to setup using Interface Builder with Storyboards as well, take a look at the Container View in the object library. Here is a contrived example in a Storyboard. In this example you would have 4 view controllers, one that holds the 3 containers, and one for each container. When you present the left most controller that has all of the containers, the Storyboard will automatically initialize and embed the other 3. You can access these child view controllers via the childViewControllers property or there is a method you can override pr

Categories : IOS

How to create a view with a transparent view on it and background view touchable?
Something like this: UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Test Action Sheet" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Home",@"iPhone", nil]; [actionSheet showInView:self.navigationController.view];

Categories : Iphone

RelativeLayout refresh after view.setVisibility(View.GONE) and view.setVisibility(View.VISIBLE)
In your activity, onClick() get the instance of that GONE view to View.VISIBLE so that it reappears between the two view. viewName.setVisibility(View.VISIBLE); For this that in between VIEW should already be present in the xml, just that it is GONE by default!

Categories : Java

How to add child view controller's view over the parent view
A few observations: You should turn off translatesAutoresizingMaskIntoConstraints: childviewcontroller.view.translatesAutoresizingMaskIntoConstraints = NO; You should define vertical constraints, too: [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[cview]-|" options:0 metrics:nil views:viewsDictionary]]; Unrelated to your problem, you don't need to create the [[UIView alloc] init] for cview. You're immediately discarding it. I'm not sure why you're removing the constraints for self.view. (I'm presuming you did that

Categories : IOS

Table View View Controller Show Next View
Do NOT Alloc init your new view controller. Use this code instead: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; WorkoutSetViewController *detailViewController = (WorkoutSetViewController *)[storyboard instantiateViewControllerWithIdentifier:@"coolID"]; [self.navigationController pushViewController:detailViewController animated:YES]; For MainStoryboard write your storyboard name and for coolID write your view controller id name which you set in your storyboard.

Categories : IOS

MVC3 Partial View : Not able to see html in View Source for Partial View render using Json object
Q1) Now I want go through the grid but when I try to inspect it I realize that there is no HTML code created in the browser's View Source. The HTML from your partial view will never appear in the page's source because it is not present in the initial HTTP GET. The View Source command in browsers displays the HTML received before any javascript is executed. Download and install fiddler and inspect the Ajax call in order to see the HTML that is returned from your controller. Q2 (implicit) Why is the partial view never displayed on screen? Your main view needs a div#dvgrid and your partial view needs to hosts the grid's content, like this: Main View : @{ ViewBag.Title = "Assign Price Values"; } @model IList<Bnym.Equinox.Accounting.Web.Portal.Models.Pricing.AssignCalculationsSou

Categories : Json

Add a child view controller's view to a subview of the parent view controller
It don't really matter to which view you are adding the child viewController. If a view of a viewController is added to another viewController you need set it properly. tableViewController.view.frame = self.contentView.bounds; [self.contentView addSubview:tableViewController.view]; /*Calling the addChildViewController: method also calls the child’s willMoveToParentViewController: method automatically */ [self addChildViewController:tableViewController]; [tableViewController didMoveToParentViewController:self]; Source code

Categories : IOS

dfp PHP API - Max requests
I don't think there is an official number for the maximum requests you can make per minute or hour. However reading the docs they do seem to recommend not exceeding more than 2 requests per second: https://developers.google.com/doubleclick-publishers/docs/reference/v201306/NetworkService.QuotaError#reason

Categories : PHP

iOS HTTPS requests 101
not sure if this will actually fix the problem, but it may help. you should be using – connection:willSendRequestForAuthenticationChallenge: since the other methods are deprecated. take a look at the overview of the NSURLConnectionDelegate protocol

Categories : IOS

Getting around asynchronous requests
Underscore comes bundled with a _.after method. _.after takes two arguments. The second is the function you want to execute and the first is the number of times you expect it to be called BEFORE you want it executed. It can be used in the following manner to accomplish what you're attempting to do: IPGeocoding = (data, callback) -> coords = [] finish = _.after(data.length, callback) _.each(data, (datum) -> $.ajax( url: "http://freegeoip.net/json/#{datum}" type: 'GET' async: false success: (result) -> lat = result.latitude lon = result.longitude pair = [lat, lon] coords.push(pair) console.log coords finish(coords)

Categories : Javascript

AJAX GET REQUESTS
Try this var place="Paris%"; var a = $.ajax({ type:"GET", url: '@Url.Action("Weather_get","Weather1")', data: '{ "location":"' + place+ '"}', dataType: 'json', cache: false, success: function (data) { console.log(data); }, //succes error: function (data) { console.log(data); }//error }) //ajax;

Categories : C#

Get and set HTTP requests
Are you looking for something like a browser extension? For example, Tamper Data for Firefox can be used to block every HTTP requests for viewing and modifying before they are sent.

Categories : Javascript

PUT requests and variables for API in PHP
Use the following to create the $_PUT array in PHP: parse_str(file_get_contents('php://input'), $_PUT); Now you can use $_PUT['Name'] to get "Test".

Categories : PHP

Parallelizing many GET requests
What you need to is this: Have a producer thread that reads each line and adds it to a queue. Have a ThreadPoolin which every thread takes a URL and does a GET request It gets the response and adds it to a queue. Have one more consumer thread, which checks the queue and adds it to a file.

Categories : Java

Dropbox iOS SDK - Requests are not sent
what you can do is, first of all replace your that function(the function that you posted) by below function...(in Appdelegate.m file) - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { if ([[DBSession sharedSession] handleOpenURL:url]) { if ([[DBSession sharedSession] isLinked]) { NSLog(@"App linked successfully!"); // At this point you can start making API calls NSArray *tmp=[self.navigationController viewControllers]; for(int i=0;i<[tmp count];i++){ if([[tmp objectAtIndex:i] isKindOfClass:[YourViewController class]]){//YourViewController is a class in which you want to implement dropbox sdk... //[self.navigationController popToViewController:[tmp objectAtIndex:i] animated:YES];

Categories : Iphone

IIS 6.0 requests slowdown
Looks like all the troubles were in appltication itself. We used ASP.NET form with DataGridView on it (pages were formed on server-side). At the time long-running request comes server has to process it and load data into its memory - so that just blocks other activity. We rewrite application using ASP.NET MVC (client-side pages) and the trouble was gone.

Categories : Asp Net

WCF enqueued requests
I modify all the timeouts there are in the HHTP binding: binding.ReceiveTimeout = New TimeSpan(0, 0, 1) binding.OpenTimeout = New TimeSpan(0, 0, 1) binding.CloseTimeout = New TimeSpan(0, 0, 1) binding.SendTimeout = New TimeSpan(0, 0, 1) I have put all timeouts to 1 second. But the behavior is the same. The requests are queued. The changes we have made have been in the Server binding.

Categories : Wcf

Trouble rendering a partial view on the same page as main view using Ajax.ActionLink()
I was able to get it working. The problem was where I added in the script source. This: <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script> Needs to be placed inside your layout file towards the bottom like this: @Scripts.Render("~/bundles/jquery") <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script> @RenderSection("scripts", required: false)

Categories : Ajax

iphone table view two column custom view the second custome not show image
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:secondIdentifier]; if (cell == nil) { cell.selectionStyle = UITableViewCellSelectionStyleNone; } FunBoxView * boxView = [[[FunBoxView alloc]initWithFrame:CGRectMake(0.f, 0.f, cell.frame.size.width * 2 / 3, height)]ah_autorelease]; boxView.tag = HOMETAGBASE ; [boxView addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside]; [cell.contentView addSubview:boxView]; FunBoxView * second = [[FunBoxView alloc]initWithFrame:CGRectMake(cell.frame.size.width * 2 / 3, 0.f, cell.frame.size.width / 3, height)]; second.tag = HOMETAGBASE + 1; [second addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEven

Categories : Iphone

Is there any way to remove a view (by name) from a Prism region when the view was added using the RegionManager.RequestNavigate method?
It stems from how you add your view, not with your removal. Previously asked answered by adding the view fully, aka including the name. _regionManager.Regions["MyRegion"].Add(myView, "MyView"); So now you can do your retrieval and removal: var theView = _regionManager.Regions["MyRegion"].GetView("MyView"); _regionManager.Regions["MyRegion"].Remove(theView); Without defining name during Regions.Add() In your View, define a property that is accessible (public if multi-project, internal if all in one project). Use this property in everything, one example would be a public string ViewTitle { get { return "XYZ"; } }. Then retrieve from the Views the item that has the desired ViewTitle. The Views collection is the collection of views in that region, so you can use dynamic in .NET 4.0+

Categories : C#

Dynamic View not being created in proper place. Overlapping previous view. Android
I'm not sure, but you can try follow code to move any view. I recommend to use RelativeLayout like your main layout. RelativeLayout.LayoutParams bParams1 = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); bParams1.leftMargin = (int) leftMrgn; bParams1.topMargin = (int) topMgrn; bParams1.height = (int) bHeight; bParams1.width = (int) bWidth; anyView.setLayoutParams(bParams1);

Categories : Android

during ng-animate of views, "leaving" view still takes up space while "entering" view is animating in
I had the same issue when I first started. To achieve the smooth effect simply change the timings of the CSS. Go into the animate.css file, look for the one the one you need to delay (in your case it would be fadeInRightBig. Change delay (or add a delay to it of about 1 or 2 seconds). Another alternative is to make the position of the exit animation absolute. Let me know if this helps. It worked for me. I wish that angularjs already handled this for us. Maybe the next version will solve these issues for us.

Categories : Angularjs

how to display data from plist in detail view using segue when map view annotation is pressed
You could pass the particular data object to the Annotation using myAnnotation.annotationData = [anns objectAtIndex:i]; Then in prepareForSegue:sender: you could access the annotation data and pass it to the detail view controller. Edit: Added sample code Declare a property on the Annotation class: @property (nonatomic, strong) NSDictionary *annotationData; Declare a property on the same view controller as your map view: @property (nonatomic, strong) NSDictionary *selectedAnnotationData; And implement the map view delegate method: -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { // Keep a reference to the callout's annotation data self.selectedAnnotationData = [(Annotation *)view.annotatio

Categories : IOS



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