w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Symfony2 Using Amazon Load Balancers and SSL: Error on isSecure() Check
You're right the X_FORWARDED_PROTO header is hardcoded into HttpFoundationRequest while - as far as i know - overriding the request class in symfony is currently not possible. There has been a discussion/RFC about this topic here and there is an open pull-request that solves this issue using a RequestFactory.

Categories : Symfony2

Elastic Beanstalk's Elastic Load Balancer name
Unfortunately the answer is no to the first 2. The last one, you are able to do it, but it more or less goes against the flow of Elastic beanstalk. You would need to create your own ELB with whatever name you like and then put it in front ot the instance that is created by beanstalk. You would need need to delete the ELB that beanstalk created so that it's not sitting there costing you money. I can't remember if beanstalk boots its environments via an AutoScaling group, but if it does, you'll need to associate that AutoScaling group with your new ELB. After creating and syncing all of that up, you need to point your CNAME to your new custom made ELB. That should work.

Categories : Amazon

aws elastic load balancer not distributing
You need to have the route53 domain direct traffic to the ELB. If you have example.com and are trying to route that to the load balancer you need to associate the apex with the load balancer. To do this, go to the route53 tab. Click your hosted zone and go to record sets. then create a new zone and click yes for alias You then need to associate the hosted zone with your ELB. Now to get the traffic to fail over correctly you need to be running both instances behind the load balancer (preferably in multiple availability zones) and the ELB will take care of the failover. To do this, go to the elb section of ec2. Click your load balancer and add instances to it.

Categories : Amazon

Why am I getting a 502 bad gateway when sending a redirect from behind amazon elastic load balancer?
It turns out that ELB is very picky about what it considers a 'valid' response and will return 502 Bad Gateway if it isn't happy. I fixed it by making sure the response from my server had the following headers: eg. if I was listening at http://example.com I send back the following response: HTTP/1.1 301 Moved Permanently Content-Type: */*; charset="UTF-8" Location: https://example.com/ Content-Length: 0 This makes ELB happy and everything works. For interest, here's the code (Java, using Simpleframework): private static void startHttpsRedirector() throws IOException { org.simpleframework.http.core.Container container = new org.simpleframework.http.core.Container() { @Override public void handle(Request request, Response response) { Path path = reques

Categories : Http

Amazon Elastic Load Balancer (ELB) url not resolved by instance attached to it
This is normal, if I correctly understand your testing framework. The way that ELB is scaling, it starts out running on a very small machine, and as traffic increases, it's directed to even larger and larger machines. However, ELB is not configured to handle flash traffic, especially from a small number of hosts, as is the case with a load testing scenario. This is because the DNS record is changed whenever ELB scales, and it sometimes takes a while to propagate. Load testing frameworks sometimes cache the DNS lookup, making things even slower. The official ELB documentation (http://aws.amazon.com/articles/1636185810492479) states that traffic should not be increased by more than 50% every 5 minutes. I found that scaling takes even longer if you're looking to get over 150-200k RPM.

Categories : Wcf

Secure a specific page by client IP behind AWS Elastic Load Balancer
The client IP is actually being passed via header (X-Forwarded-For). This header may include other load balancer IPs in addition to the client IP. If you can configure filtering based on headers, you should be able to do what you are attempting to do.

Categories : Asp Net

What method(s) do I use to configure/update an Elastic Load Balancer via Java?
My bad. Forgot to execute the requests against the ELB variable. The code below creates the health check and assigns the instances associated with the ELB. Hope this helps the next person asking this question. ConfigureHealthCheckResult healthResult = myELB.configureHealthCheck(healthCheckReq); RegisterInstancesWithLoadBalancerResult registerResult = myELB.registerInstancesWithLoadBalancer(regInst);

Categories : Java

Running nginx infront of a unicorn or gunicorn under Elastic Load Balancer
In a word: yes. Amazon's ELB service is wonderful, but it is solely a load balancer. Running nginx on your own server gives you a locus of control and a place to do rewrites, redirects, compression, header munging, caching, and more. Furthermore it allows you to serve static files in the fastest possible way, rather than using a slot on your more heavyweight appserver.

Categories : Nginx

how to configure Elastic Beanstalk to deploy code to an instance but not add it to the load balancer
For the most part, though not straight forward, you could provide a .config file in .ebextensions to run your script files. This example of speeding up a deploy shows running some scripts and moving data back and forth. Better yet, the author describes the sequence and deployment process. I'm just embarking on this type of container customization. I have read of others dropping files in the /opt/elasticbeanstalk/hooks/appdeploy/pre and /opt/elasticbeanstalk/hooks/appdeploy/post directories, much of which can be derived by reading the post linked above. Also note that you can include the content of a script in the yaml .config file such as this which I found yesterday: files: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh": mode: "000755" owner: root

Categories : Ruby On Rails

How to simulate Amazon's 60 sec timeout on Elastic Load Balancer (ELB) on a local xAMP environment?
This timeout has to do with a request taking more than 60 seconds, without sending any data as a response. Long HTTP requests like this should really be avoided. Even browsers may give up if they dont receive any response within a timeout period. If you can't get rid of long HTTP requests and you need to simulate it. You can use an fcgi/php-fpm configuration of php and provide a timeout of 60 seconds for which the fcgi process will wait for PHP to respond.

Categories : Apache

Scaling only with AWS EC2 with Elastic Load Balancing and Auto-Scaling
ELB will pass through TCP and HTTP, you just need to set the ports you want. Autoscaling will scale the servers based on a set of parameters. So yes - you can - provided that your server can handle multiple instances of itself.

Categories : Amazon

How does one setup two non-load-balanced VM web servers in Azure, capable of communicating on private ports?
A single cloud service is a security boundary and the only way into it is through a public (input) endpoint on the unique public VIP of the service. A Virtual Network (VNET) can be used to host multiple cloud services and allow private visibility among them without going through a public endpoint. A typical model would be to put an IIS website in a PaaS cloud service with a public VIP and the backend SQL Server in an IaaS cloud service with a public VIP but NO public endpoints declared on it. Both these cloud services would be hosted in the same VNET. This allows the front end web role instances access to the backend SQL Server instance over the private VNET. There is a hands-on lab in the Windows Azure Training Kit that describes precisely how to implement this. In this case I would rec

Categories : Azure

SQL Foreign Key Redundancy
The key would technically be redundant if you assume that the supplier for a person is always the supplier represented by the part. Remember, that things can change over time. Presumably, suppliers could merge, persons could change the supplier they are associated with, and the supplier associated with a part could change. The data structure, however, does not look properly normalized. I would think that you would want a person table with information only about the person. I don't get the relationship between parts and persons. So, I think you should rework your data structure. I would suggest that you start with the entities you have identified -- suppliers, persons, and parts. Then create association tables for them, if necessary. It is quite possible that each person should jus

Categories : SQL

defface with less redundancy
How about a macro and a loop that operates on a mapping of suffixes <-> colors: (defmacro brian-def-char-face (letter backgrnd foregrnd) `(defface ,(intern (concat "brian-char-face-" letter)) '((((type tty) (class color)) (:background ,backgrnd :foreground ,foregrnd)) (((type tty) (class color)) (:inverse-video t)) (((class color) (background dark)) (:foreground ,foregrnd :background ,backgrnd)) (((class color) (background light)) (:foreground ,foregrnd :background ,backgrnd)) (t (:background "gray"))) ,(concat "Face for marking up " (upcase letter) "'s"))) (let ((letcol-alist '((s . (white black)) (t . (black yellow)) (u . (green pink))))

Categories : Emacs

Avoiding layout redundancy
Solution below doesn't show possibly useless warning :) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_toLeftOf="@+id/layRight" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/button4" android:text=

Categories : Android

meaning of (/?) in regex / is (w+)([^>]*?) a redundancy?
(/?) matches, and catches any closing tag, such as </i> maybe, or </strong> if you're familiar with them? Another thing to note is that w is really the character class [a-zA-Z_d], so that other characters like =, ", etc are not matched, and will however be matched by [^>]. And yes, you are correct about that bit.

Categories : Javascript

Query where redundancy and optimization
Since there won't be a real answer I'll respond to my own question to provide feedback on this. (I'm still happy if someone is willing to contribute to this!) The original question implied a table which contains data and a collection of criteria which is applied to that. In further analysis I faced the fact that the whole concept behind this idea is so complex that we can't rely on saving this criteria in a separate table (reasons: dynamic API and pure chaos when you try to handle that without a clear programming library). So it ends up in dynamic SQL (instead of joins, stored procedures, etc). Fortunately I can reduce the queried data by previous restrictions which will reduce a great amount of data which will remain to be queried with the criteria. I don't even see a problem in applyin

Categories : Database

How to check the redundancy of this statement?
Your problem is that you're using quoted array keys within a double-quoted string. This is not permitted in PHP, though it will "politely" do the correct thing but issue a warning. e.g. $arr['foo'] = 'bar'; echo "This is wrong: $arr['foo']"; // wrong echo "This is correct: $arr[foo]"; // right echo "This is correct: {$arr['foo']}"; // also right In all three cases, PHP will properly output 'bar' where the array reference is, the first line will cause a warning.

Categories : PHP

Avoiding Redundancy using LINQ Enumerable All
You can't avoid predicate in All operator. It is part of signature, and it is not optional: public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) What you can do is create your own All (or better AllTrue) extension specific to collection of booleans: public static bool AllTrue(this IEnumerable<bool> source) { return source.All(b => b); } public static bool AllFalse(this IEnumerable<bool> source) { return source.All(b => !b); } Usage: bool isOrdered = firstList .Zip(secondList, (first,second) => first == second) .AllTrue();

Categories : C#

Redundancy of Function Parse Trees in R
Apparently this component is a source reference: it's not easily located in the R language definition, but its purpose is precisely for retaining the structure of the original source, especially comments; for example s <- substitute(function(x=1){ ## a comment x^2}) str(s[[4]]) ## Class 'srcref' atomic [1:8] 1 21 2 15 21 15 1 2 ## ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x8a87634> shows that it's a srcref object. The mysterious numbers (1, 21, 2, 15, ...) represent indices into a lower-level object representing the source code, as described in the ?srcfile page (i.e. c(first_line, first_byte, last_line, last_byte, first_column, last_column, first_parsed, last_parsed)). As @SimonO101 points out, there's an R Journal article by Dunc

Categories : R

The redundancy of package in intent class
Those two package names are technically different. When creating a new Android project in Eclipse, or Android Studio, the new project wizard makes it like there is only one package name, but in actuality, it takes the package name you give it and makes two identical package names out of it, one package name for the application and one package for the class. In other words, enter the package name com.example.myapplication into the new project wizard, and the resulting class will be located at /com/example/myapplication/com/example/myapplication/MainActivity.class (knowing that will make it easier for you call it as an explicit intent from a different application) And of course, nothing says you can't change the class package name, or add new class package names, while keeping the or

Categories : Android

Generate all combinations of pairs without redundancy
Answer to my question : public void generate (int n) { int[] covered = new int[n]; int[] list = new int[n]; for (int i = 0; i < n; i++) { covered[i] = 0; } this.generate(n, covered, 0, list); } private void generate (int n, int[] covered, int i, int[] list) { int j = 0; while ((j < n) && (covered[j] == 1)) { j++; } if (j == n) { System.out.println(Arrays.toString(list)); return; } covered[j] = 1; for (int k = 0; k < n; k++) { if (covered[k] == 0) { covered[k] = 1; list[i++] = j; list[i++] = k; this.generate(n, covered, i, list); i -= 2; covered[k] = 0; } } covered[j] = 0; } Found here.

Categories : Java

Hibernate JPA entity save redundancy
Why do you need to save the entity ID in two fields? Can't you calculate that field while selecting data from the table instead? One alternative solution would be to take manual control of sequence generation, and implement your own sequence number cache. That'll allow you to remove that second UPDATE. I.e if you're using Oracle: class SequenceNumberCache { void init() { increment = jdbcTemplate.queryForInt("select increment_by from user_sequences where name = ..."); } int getNextSequence() { if(availableValues > 0) { availableValues--; return nextValue++; } availableValues = increment - 1; nextValue = jdbcTemplate.queryForInt("select seq.nextval from dual"); return nextValue++; } }

Categories : Hibernate

highchart minimize code redundancy
I assume, that all your arrays have the same length, so it is safe to loop any of them. This should work for you: var data = []; for (var i = 0; i < pageViews.length; i++) { data.push({ y: pageViews[i], color: colors[i], drilldown: { name: date[i], categories: ['a','b','c'], data: [photosR[i], ratingsR[i], searchesR[i], socialR[i]], color: colors[i] } }); }

Categories : Javascript

Is there any way to remove redundancy with types in this function?
Yes, simply remove the redundant argument. The return type of getAnimal determines the instance that will be used. data Cat = Cat data Dog = Dog class Eatable animal where getAnimal :: animal instance Eatable Dog where getAnimal = Dog instance Eatable Cat where getAnimal = Cat

Categories : Haskell

SQL Query to remove cyclic redundancy
DELETE FROM yourTable where [Column A]='C' given that these are all your rows EDIT I would recommend that you clean up your source data if you can, i.e. delete the rows that you call backwards, if those rows are incorrect as you state in your comments.

Categories : SQL

Fixing redundancy in Slim if else statement
When duplicating code in a view, you should use a partial to hold that duplicated code and render the partial where ever you want it to appear. I know your simplified code is just to show your intent but if it was more real I could provide even further suggestions. You can also inline that logic: div = x == 0 ? 'Some Cool Title' : 'Some Other Title' div Ditto Better than that though would be to move that logic into somewhere more suitable like use a gem like Draper to create a presenter object. div = @my_presenter_object.title div ditto

Categories : HTML

Database Design - Is redundancy better than adding more relationship?
In this case it's really NOT the same information. It's category_name, category_description, brand_name and brand_description. Creating a table to keep generic information about many things is a bad idea. When it comes to the discussion about (de)normalisation it's generally considered a better design to normalise data and I would start with such a design. As your data evolves and grows it might be necessary to de-normalise some tables as the data retrieval can be faster at the cost of storage space and risk of loosing data consistency.

Categories : Mysql

How can I implement solr redundancy on the haystack side?
Well it should work. But I don't see need for redundant haystack.routers.DefaultRouter and apps.search.routers.SlaveRouter (all your logic in MasterRouter). As for check_connection() then more straightforward version is def check_connection(type): url = settings.HAYSTACK_CONNECTIONS[type]['URL'] try: urllib2.urlopen(url,timeout=1) return True except urllib2.URLError as err: return False If you want further to improve it you can send some real query and check for results, eg. def check_connection(type): url = "{}?{}".format(settings.HAYSTACK_CONNECTIONS[type]['URL'], 'q=test') try: res = urllib2.urlopen(url, timeout=1) # TODO: parse Solr output and decide what to return return True except urllib2.URLError as err: return False Refere to Solr do

Categories : Python

How to avoid constructor code redundancy in Java?
As a rule, constructors with fewer arguments should call those with more. public Pair() {} public Pair(String car) { this(car, null); } public Pair(Integer cdr) { this(null, cdr); } public Pair(String car, Integer cdr) { this.car = car; this.cdr = cdr; }

Categories : Java

Android: Redundancy probelm in datahelper class
Try this: public List<String> getSymptomsByDiseaseId(long diseaseId) { List<String> symptomsList = new ArrayList<String>(); String selection = "diseaseid=?"; String[] selectionArgs = { String.valueOf(diseaseId) }; Cursor cursor = db.query(false, SYMPTOM_TABLE_NAME, null, selection, selectionArgs, null, null, null, null); if (cursor.moveToFirst()) { do { symptomsList.add(cursor.getString(0)); } while (cursor.moveToNext()); } cursor.close(); return symptomsList; }

Categories : Android

Azure Mobile Services: Failover and Redundancy
Availability SLAs are only guaranteed on the Standard and Premium tiers, see Support and SLA in: http://www.windowsazure.com/en-us/pricing/details/mobile-services/

Categories : Azure

Whats a Strong Argument against Variable Redundancy in c code
I think a little more context would be helpful perhaps. You could argue that the value of Block1Var is not guaranteed to stay the same across concurrent access/modification. This is only valid if Block1Var ever changes (ie is not only read). I don't know if you are concerned with multi-threaded applications or not. Readability is an important issue as well. Future code maintainers don't want to have to trace around a bunch of trivial assignments.

Categories : C

Reduce redundancy codes of overload function(const& vs &)
If C++11 is an option for you then perfect forwarding works here: template <typename T, typename TriFunc> TriFunc wrapper(cv::Mat && input, TriFunc func) { return process_three_continuous_channels_impl<T>( std::forward(input), func); }

Categories : C++

JavaDoc: Reduce redundancy for Repeated Method Descriptions within the Same Class
How's about @see tag? It's not quite importing, but rather placing a reference: /** * action 1 description */ public void action1(){} /** * @see MyClass#action1 */ public void action2(){}

Categories : Java

How to add option that User to select a location to install in .Net Setup Project while installing setup?
Case of Winforms deplyment: Right click on the deployment project in the Solution window and select View, File System. Click on the Application Folder. Notice in the Properties window, change the Default location to whatever you want Case of Web: You can implement this by overriding the “Install” method, check this for an example Allow user to set physical directory path during Web Project deployment

Categories : Asp Net

How to setup a HTTP Source for testing Flume setup?
Hopefully this helps you get started. I'm having some problems testing this on my machine and don't have time to fully troubleshoot it right now, but I'll get to that... Assuming you have Flume up and running right now, this should be what your flume.conf file needs to look like to use an HTTP POST source and local file sink (note: this goes to a local file, not HDFS) ########## NEW AGENT ########## # flume-ng agent -f /etc/flume/conf/flume.httptest.conf -n httpagent # # slagent = SysLogAgent ############################### httpagent.sources = http-source httpagent.sinks = local-file-sink httpagent.channels = ch3 # Define / Configure Source (multiport seems to support newer "stuff") ############################### httpagent.sources.http-source.type = org.apache.flume.source.http.HTTP

Categories : Java

How to close setup window after installation by Inno Setup?
You need to add the nowait flag to that [Run] section entry. So modify your script like this: [Run] Filename: {app}myexe.exe; Description: Launch my app; Flags: postinstall skipifsilent nowait

Categories : Windows

Is it possible to setup environment variables within noses setup.cfg
No nose does not have any current ability to set environment variables from a config file: def _configTuples(self, cfg, filename): config = [] if self._config_section in cfg.sections(): for name, value in cfg.items(self._config_section): config.append((name, value, filename)) return config def _readFromFilenames(self, filenames): config = [] for filename in filenames: cfg = ConfigParser.RawConfigParser() try: cfg.read(filename) except ConfigParser.Error, exc: raise ConfigError("Error reading config file %r: %s" % (filename, str(exc))) config.extend(self._configTuples(cfg, filename)) return config Any configuration options specified from a configuration file

Categories : Python

pyinstaller setup failed with "setup.py is not yet supposed to work. Please Use PyInstaller without installation."
As it says "it is not yet supposed to work" - if you read the documents you will find that you just unzip/unpack it into a local directory and run it from there. You are not supposed to run setup.py in pyinstaller at all - see here for how to set up pyinstaller. Once installed and on your path you run by typing pyinstaller your_main.py in your project directory. You may have to generate a specification file and edit it for things to work correctly - See the documentation!

Categories : Python



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