w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I prevent EC2 instance termination by Auto Scaling?
This functionality is currently not available for Auto Scaling of Amazon EC2 instances - while you are indeed able to Configure [an] Instance Termination Policy for Your Auto Scaling Group, the available policies do not include such a (fairly advanced) concept: Auto Scaling provides the following termination policy options for you to choose from. You can specify one or more of these options in your termination policy. OldestInstance — Specify this if you want the oldest instance in your Auto Scaling group to be terminated. [...] NewestInstance — Specify this if you want the last launched instance to be terminated. [...] OldestLaunchConfiguration — Specify this if you want the instance launched using the oldest launch configuration to be terminated. [...] Close

Categories : Amazon

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

Auto-scaling images in a grid
I don't think we can achieve auto scaling in GridLayout using XMl. we can fix it pro-grammatically by calculating the Screen size and width. Read this answer here . Hope it will help you.

Categories : Android

amazon web services auto scaling across the availability zones
You can't setup Autoscaling to scale instances that already exist. You basically need to recreate them inside a launch configuration and then have Autoscaling utilize that launch configuration. Here's a cloudformation template: { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "AWS CloudFormation Template to configure chef on an EC2 Instance", "Parameters" : { "KeyName" : { "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", "Type" : "String" } }, "Mappings" : { "RegionMap" : { "us-east-1" : { "AMI" : "ami-7f418316" }, "us-west-1" : { "AMI" : "ami-951945d0" }, "us-west-2" : { "AMI" : "ami-16fd7026" }, "eu-west-1" : { "AMI" : "ami-24506250" }, "sa-east-1"

Categories : Amazon

Elastic Beanstalk - auto scaling - grace-period
well - I have found the 'Auto Scaling group name'. If you install awscli(http://aws.amazon.com/cli/) and do: aws ec2 --region 'your-region' describe-instances you get a load of json that includes the Auto Scaling group name help to set up awscli(http://www.dowdandassociates.com/content/howto-install-aws-cli-security-credentials/)

Categories : Wordpress

When is WSO2 ELB going to support CPU-based auto scaling algorithm
Implementing a load balancing algorithm which balance load based on server load is on the road map for WSO2 ELB but unable to provide an exact time frame as of now. This will be developed and released with future ELB versions.

Categories : Wso2

How to setup ElasticSearch cluster with auto-scaling on Amazon EC2?
Auto scaling doesn't make a lot of sense with ElasticSearch. Shard moving and re-allocation is not a light process, especially if you have a lot of data. It stresses IO and network, and can degrade the performance of ElasticSearch badly. (If you want to limit the effect you should throttle cluster recovery using settings like cluster.routing.allocation.cluster_concurrent_rebalance, indices.recovery.concurrent_streams, indices.recovery.max_size_per_sec . This will limit the impact but will also slow the re-balancing and recovery). Also, if you care about your data you don't want to have only 1 node ever. You need your data to be replicated, so you will need at least 2 nodes (or more if you feel safer with a higher replication level). Another thing to remember is that while you can chang

Categories : Elasticsearch

Azure Auto Scaling works but load doesn´t get distributed
The problem is because of TCP connection keep-alive - when the clients first connect the connection is established to existing instances and then it persists to those instances. So when the service scales out the clients won't reconnect unless the connection is broken. New clients will connect to both existing and new instances. Here's another question for a very similar scenario. For testing purposes you can just disable keep-alive to ensure that load is indeed distributed between instances.

Categories : Azure

Google Cloud Messaging Server key whitelist IP addresses with auto scaling
You don't have to fill in the set of whitelist server IPs. It's optional. If you know all the potential IP addresses your server may run on, you can specify a list of IP addresses or subnets (such as 192.168.12.0/23). Otherwise, keep it empty.

Categories : Android

svg inside a scaling div
I think you need to use the viewbox attribute: http://www.w3.org/TR/SVG/coords.html#ExampleViewBox Check this, it scales now: http://jsfiddle.net/NKRPe/60/ <svg viewBox="0 0 1500 1000" preserveAspectRatio="none" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="100" height="50" stroke="black" fill="red" stroke-width="5"/> </svg>

Categories : HTML

How to use Angular.js service instance inside module config and keep the same instance
From the doc - Services as singletons All Angular services are application singletons. This means that there is only one instance of a given service per injector. Since Angular is lethally allergic to global state, it is possible to create multiple injectors, each with its own instance of a given service, but that is rarely needed, except in tests where this property is crucially important. It mean if you do injector.get for a single injector, it will always returns the singleton like this var injector = angular.injector(['app.services']); var singletonService1 = injector.get('singletonService'); var singletonService2 = injector.get('singletonService'); console.log(singletonService1 === singletonService2) // prints true However if you inject it to another the controller

Categories : Javascript

How do I scale a linked image inside an SVG from top (currently scaling from center oddly)
This is a webkit bug. See Using a svg with width=100 and height=100 I got extra space in safari e chrome for some possible solutions.

Categories : HTML

Matching numbers inside nested numbered groups
You can combine a positive lookahead with a negative lookahead to get your desired results. (d+)(?=(?:.(?!())*)) Regular expression: ( group and capture to 1: d+ digits (0-9) (1 or more times) ) end of 1 (?= look ahead to see if there is: (?: group, but do not capture (0 or more times) . any character except (?! look ahead to see if there is not: ( '(' ) end of look-ahead )* end of grouping ) ')' ) end of look-ahead See a demo

Categories : Regex

Detecting current scaling of page, then resizing to same scaling later?
I have a solution that is good enough for now. It is not pretty. It works in WP8 with IE10, but I doubt it works for WP7 with the earlier version of IE. When the user zooms the screen (by pinch guesture) window.outer{Width,Height} are reduced by the zoom factor. If the window was originally 1024 wide and user zoomed X2, then window.outerWidth is now 512. And window.page{X,Y}Offset are likewise reduced by the same factor. However element sizes (such as document.body.clientWidth) are not changed. So the browser appears to have made the window smaller but left the page alone. (Come to think of it, that's kind of the definition of zoom...) But you cannot set window.outer{Width,Height} to cause the browser to zoom. But you can set document.body.style.zoom. When you do CSS scaling, wi

Categories : Windows Phone 8

Can one call an instance's method inside a class without recreating the instance within class' scope?
You have to import the global $errorhandler variable into your local scope: class AnotherClass { function __construct() { global $errorhandler; try { $not_possible = 1/0; } catch (Exception $e) { $errorhandler->log($e); # Doesn't work } } } P.S. 1/0 is not an exception, it's a runtime error. You can't catch those with a try/catch block.

Categories : PHP

In C# can I create a delegate instance to an auto-implemented property accessor?
As some comments hint, this will do the job: class Foo { public delegate void Setter(float value); public float Mass { get; set; } public Foo() { Setter massSetter = x => Mass = x; // massSetter would be stored somewhere and used later } } IE, use an action as a delegate. In this case though, it seems a bit superfluous, why do you need this functionality? var f = new Foo(); f.Mass = 1.0d; // What you do with the property theSetter(1.0d); // What you can do now Isn't the property clearer in it's purpose?

Categories : C#

What is the most Pythonic way of implementing classes with auto-incrementing instance attributes?
I might use a simple class decorator ... import itertools def countable(cls): cls.counter = itertools.count() return cls @countable class Foo(object): def __init__(self): self.ID = next(self.__class__.counter) @countable class Bar(Foo): pass f = Foo() print f.ID b = Bar() print b.ID If you really want to do this the "fancy" way, you could use a metaclass: import itertools class Countable(type): def __new__(cls,name,bases,dct): dct['counter'] = itertools.count() return super(Countable,cls).__new__(cls,name,bases,dct) class Foo(object): __metaclass__ = Countable def __init__(self): self.ID = next(self.__class__.counter) class Bar(Foo): pass f = Foo() print f.ID b = Bar() print b.ID

Categories : C++

Programming a recursive method to calculate number of groups with n elements and k groups
You write: I see no way to break it down into smaller subproblems because once you do you start counting possibilities twice. This is not true. Once you create the first group, the items in the first group are no longer in the set of candidate items, and the subproblem becomes counting all possible groupings of the remaining items - which, by no coincidence, is the same as the original problem (count all possible groupings of a set of items). So, then, your problem boils down to having to count all possible permutations of items in a single group (e.g. a, ab, ac, bc, abc), then for each of those, proceeding similarly with the remaining items. Once you are able to determine the number of permutations for a single group with N available objects, the end result is that number plus, fo

Categories : Java

R: repeat series of numbers within groups a number of times that differs among groups
You can use data.table, and library(data.table) # create df1 and df2 as data.tables keyed by tank DT1 <- data.table(df1, key = 'tank') DT2 <- data.table(df2, key = 'tank') # you can now join on tank, and repeat all columns in # .SD (the subset of the data.table) DT1[DT2, lapply(.SD, rep, times = rpeat)] # 1: 1 2.1 6.5 # 2: 1 3.5 5.5 # 3: 1 2.1 6.5 # 4: 1 3.5 5.5 # 5: 1 2.1 6.5 # 6: 1 3.5 5.5 # 7: 2 2.3 5.9 # 8: 3 4.0 7.2 # 9: 3 3.3 4.9 # 10: 3 2.2 8.0 # 11: 3 4.0 7.2 # 12: 3 3.3 4.9 # 13: 3 2.2 8.0 # 14: 4 1.9 9.1 # 15: 4 3.0 6.3 # 16: 4 1.9 9.1 # 17: 4 3.0 6.3 Read the vignettes associated with data.table to get a full understanding of what is going on. What we are doing is called by-without-by with

Categories : R

Why won't CloudFormation execute my command?
Your commands block should be nested inside the config block, at the moment it is at the same level in the hierarchy. "AWS::CloudFormation::Init" : { "config" : { "files" : { "c:\Packages\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } }, "commands" : { "1-installwebdeploy" : { "command" : "msiexec.exe /i c:\Packages\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } } }, }

Categories : Amazon

users in groups, groups have privileges, does EJB 3 support this model with annotations?
The EJB perspective/view/interface/specification only consists of users and roles. EJB does not define the way this data is maintained. Roles are used to enforce authorization. So you can setup whatever model you like to maintain authentication/authorization data. For example users are group members, and permissions are attached to groups. For example, using JBoss, it's the task of a LoginModule to return the roles of a given user. In case of the DatabaseServerLoginModule you can use a SQL statment to join together users, their groups, and the group/roles assignments. The result is always just a plain list of roles. As for WebSphere, they use the name "Custom user registry" instead of "Login module". There are some options to build the back end: As the user is frequently part of a dat

Categories : Java

EC2: "Groups belonging to other users may not be granted permissions to VPC security groups."
Since your Security Groups already have a default security group, you won't be able to change it from rubber nor will you be able to sync changes to it. This happened to me because after I set up a new account on AWS, I manually (without the help of rubber) created an EC2 instance. After doing that, a default security group was automatically created for me and I was unable to get rubber to make changes to it from then on. So - through the aws security groups console, add SSH to the rules for incoming and outgoing to the default security group. Next, in rubber.yml, comment out the default security group: security_groups: # default: # description: The default security group # rules: # - source_group_name: default # source_group_account: "#{cloud_providers.aws.account}" #

Categories : Amazon

JSF: auto conversion when backing a view item with an instance of a subclass of a generic class with resolved type parameter
I've done something similar a couple months ago addressing a different problem. I have an abstract class for many of my JPA entity classes. Every entity converter of that type had almost the same logic and I wanted to use a single converter for that. After a little research I was able to find a solution for an abstract converter for my entities where I could place the common logic. The only problem is that now I need to reference-it by its name (converter="entity"). This solution was found somewhere else (I can't remember where) so I can't take any credits here. The abstract converter: import java.util.HashMap; import java.util.Map; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; public abstract class AbstractCo

Categories : Java

Why won't my CloudFormation script download a file?
Jonathon, I tried your template and the file downloaded successfully for me. You can check the cfn logs on the instance. They are in c:cfnlog. My cfn-init.log shows: 2013-07-19 21:30:18,269 [DEBUG] Parent directory c: est does not exist, creating 2013-07-19 21:30:18,269 [DEBUG] Writing content to c: estgoogle-logo.png 2013-07-19 21:30:18,269 [DEBUG] Retrieving contents from http://www.google.com/images/srpr/logo4w.png 2013-07-19 21:30:18,316 [DEBUG] No mode specified for c: estgoogle-logo.png 2013-07-19 21:30:18,316 [WARNING] Unsupported OS for setting owner/group: nt And my cfn-wire.log shows: 2013-07-19 21:30:18,269 [DEBUG] Request: GET http://www.google.com/images/srpr/logo4w.png [headers: {'Accept-Encoding': 'identity, deflate, compress, gzip', 'Accept': '*/*', 'User-Agent': 'pyth

Categories : Amazon

AWS - Automatic deployment (.NET) to CloudFormation stack
cloud-init is used with windows too. See the documentation for bootstrapping Windows stacks.

Categories : Amazon

div auto responsive to text inside
It's illegal to use plain text inside a div tag. I suggest you add a "p" tag around those texes. Regarding your question, I'm not sure I got it right but you might be asking for .selector { display: inline-block width: auto; max-width: 400px; }

Categories : HTML

Focus a
  • inside
  • The scrolling down comes from the browser default behavior of interpreting the down arrow as a command to scroll down. To fix this, you just need to prevent the default behavior. You have already prevented the default behavior in the keydown handler for the lis, which is just what we need. You used return false, but e.preventDefault() is slightly safer. $('#searchInput').keydown(function(e) { if (e.keyCode==40) { e.preventDefault(); // add this $('li:first').focus(); } }); jsFiddle

    Categories : Jquery

    Is it possible to create a SNS subscription with CloudFormation without creating a topic?
    As you already discovered, AWS CloudFormation doesn't provide the expected AWS::SNS::Subscription resource (yet) and I'm not aware of this being possible by any other means, unfortunately - guess the rationale is that both are either managed within a template or externally, but your use case is sound and I can see no fundamental reason why this shouldn't be available (maybe they'll add it at some point, AWS is usually expanding their APIs over time to address such inconsistencies/missings).

    Categories : Amazon

    Alarms in Android: need to be stored in the DB?
    Alarms do not survive reboot, so you need to register your Application to start on boot and re-register your alarms from what you stored in the database. This has been discussed for example here Clarification of AlarmManager behavior in Android.

    Categories : Android

    Overflow auto for div with inline-blocks inside
    I think you want to use in outer div the style white-space: nowrap; <div style="border: 1px solid black; width: 200px; height: 60px; overflow-x: auto; white-space: nowrap;"> <img src="/images/thumbs/doc.png" width="100" height="60" style="display: inline-block; vertical-align:middle;"> <div style="display: inline-block; vertical-align: middle;">test</div> </div>

    Categories : HTML

    Local Groups and Users in Administors groups
    Something like this might do: $hostname = $(hostname) $isLocal = @{ $true = "local"; $false = "domain"; } $type = @{ "Win32_UserAccount" = "User"; "Win32_Group" = "Group"; } gwmi -Query "ASSOCIATORS OF {Win32_Group.Domain='$hostname',Name='Administrators'} WHERE assocClass=Win32_GroupUser" | select @{n="Server Name";e={$hostname}}, @{n="Local or Domain";e={$isLocal[$($_.Domain -eq $hostname)]}}, Domain, Name, @{n="Account/Group";e={$type[$_.__CLASS]}} | ConvertTo-Csv -NoTypeInformation Untested, though, since I don't have an AD at hand. Local user information can be retrieved like this: $sys = [ADSI]"WinNT://$env:COMPUTERNAME" $sys.Children | ? { $_.SchemaClassName -eq 'user'} | select @{n="USER ID";e={$_.Name.Value}}, @{n="Account Disabled";e={[

    Categories : Powershell

    Instance of the class inside itself
    To call non-static method you must have instance of class, which instance method you want to call. Also thus you can't change class aaa, then you are able only to extend it with extension methods or inherit from that class. Here is extension method sample: public static class MyExtensions { public static void x(this aaa myClass) { // use public methods of class you are extending string str = myclass.a(5); } } You can execute x method like a normal method of myClass instance: aaa myclass = new aaa(); myClass.x(); // you extension BTW in C# we use PascalNames for classes and methods.

    Categories : C#

    Installing Windows applications/extensions with Amazon CloudFormation
    For your example of WebDeploy, you could add this: "C:\Webdeploy\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } as a element of this section of the template "WindowsServer": { "Type" : "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "files" : { You could then add this command: "1-installwebdeploy" : { "command" : "msiexec.exe /i C:\Webdeploy\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } to the list of commands.

    Categories : Amazon

    Multiple Questions about Alarms and Notifications?
    As far as I can see you are using an Activity to create the Notification - better would be to use a BroadcastReciever and start a broadcast with your pending intent with AlarmManager. See here for more details on BroadcastReceiver

    Categories : Android

    How to receive tomcat critical alarms
    It depends: What do you consider a critical event? Answering time above 2 sec/page? Out of Memory crash database not available ... You should look for generic monitoring tools, nagios is a good starting point and there are lots of equally good alternatives, open source as well as commercial. Then monitor your tomcat installation, e.g. through standard http, on jmx, on process/OS level. Include your infrastructure: Database, Apache, others.

    Categories : Apache

    Saving multiple instances of alarms
    You can always use SQLlite database for storing the values in tables. On the other hand if you insist on saving it in Shared Preference, you can use save an array in SharedPreference and Load an array from it as follows: public String[] loadArray(String arrayName) { SharedPreferences prefs = getSharedPreferences("preferencename", 0); int size = prefs.getInt(arrayName + "_size", 0); String array[] = new String[size]; for(int i=0;i<size;i++) array[i] = prefs.getString(arrayName + "_" + i, null); return array; } public boolean saveArray(String[] array, String arrayName) { SharedPreferences prefs = getSharedPreferences("preferencename", 0); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(arrayName +"_size", array

    Categories : Java

    implementing monthly repeating alarms
    In the calendar setter area you getting the instance with actual date, then changing it's value, but not with add or substracting some piece of time. It's value is totally differs from the expected, because you setting absolute values not relatives. I've just extracted the calendar changes from your code and executed to demonstrate: Calendar calendar = Calendar.getInstance(); System.out.println(calendar.getTime()); calendar.set(Calendar.DAY_OF_WEEK, 0); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 1); calendar.set(Calendar.SECOND, 0); System.out.println(calendar.getTime()); calendar.add(Calendar.HOUR, 1); System.out.println(calendar.getTime()); the result is: Mon Jun 17 18:00:56 CEST 2013 Sat Jun 22 00:01:00 CEST 2013 Sat Jun 22 01:01:00 CEST 2013

    Categories : Java

    Android AlarmManager: is there a way to cancell ALL the alarms set?
    I think you could get an eye on : AlarmManager.Cancel And on that Question/Answer: Android: Get all PendingIntents set with AlarmManager As stated in there you can't ask to the AlarmManager to tell you what PendingIntent are in it. But I think you can make some PendingIntent similar to the one you want to cancel ;).

    Categories : Android

    Auto SVN update inside server for website management
    You could put in place on your server a cron job that just runs an update every hour or every midnight but better would be either to change your workflow so as to use a batch file or script to perform your commits or best of all yet put a post commit hook in place that does a checkout on your server whenever there is a new commit, or even a new commit from a specific user, e.g. You or a Release Manager. You could also set up a full blown SVN web sever - this is probably more work than you need unless you are letting a lot of people have SVN access to your working environment via the web. See here for some examples of hooks. So your options are: Automatically get any updates every x time - easy to do but the web site will be out of date until up to x time has elapsed. Use a different c

    Categories : Svn

    auto mapper mapping with a struct inside the class
    You have not instructed AutoMapper how to do the conversion between your types. You can fix this by adding Mapper.CreateMap<AResult, BResult>(); to your code: Mapper.CreateMap<AResult, BResult>(); var temp = Mapper.Map<AResult, BResult>(result);

    Categories : C#



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