w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
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

How to share a member between policies?
Here's a way to do CRTP without having policies inherit from hosts template <typename DerivedT> struct p1 { DerivedT& derived() { return *static_cast<DerivedT*>(this); } const DerivedT& derived() const { return *static_cast<const DerivedT*>(this); } void f1() { derived().member += 1; } }; template <typename DerivedT> struct p2 { DerivedT& derived() { return *static_cast<DerivedT*>(this); } const DerivedT& derived() const { return *static_cast<const DerivedT*>(this); } void f2() { derived().member *= 2; } }; struct host : public p1<host>, public p2<host> { double member; };

Categories : C++

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

Categories : Amazon

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

Configuring SNS Delivery Retry Policies
AWS CloudFormation sometimes doesn't cover all (new) API actions available within other AWS Products & Services, though they usually get introduced within a few month later on. Unfortunately, despite SNS Delivery Retry Policies for HTTP/HTTPS Endpoints being introduced in December 2011 already, this feature is still not supported as of today. Workaround You might be able to implement a workaround with CloudFormation still by means of the dedicated CustomResource type, which are special AWS CloudFormation resources that provide a way for a template developer to include resources in an AWS CloudFormation stack that are provided by a source other than Amazon Web Services. - the AWS CloudFormation Custom Resource Walkthrough provides a good overview of what this is all about, how it wor

Categories : Amazon

UIImageView Cache policies - AFNewtorking
You can access the + (AFImageCache *)af_sharedImageCache method, most easily by copying it into the interface file UIImageView+AFNetworking.h. This will expose the singleton NSCache subclass. Then you can call – removeObjectForKey: or – removeAllObjects to remove the image or all images, respectively. If you don't want to do this, consider that the image is cached using the NSHTTPURLResponse object as the key. You could create a different key by appending some random value to the URL (for example, you could append ?garbage=4H5G789H35G89H). However, this would basically waste memory as you'd be caching images that would never be retrieved. Finally, you may want to submit an enhancement request (or code one yourself) to expose the cache or make caching optional.

Categories : IOS

ClaimsAuthorizationManager pull policies from database
I also ran into the same problem. Hopefully these links will help you. What I did was implemented my own ClaimsAuthorizationManager to get the claims for the current user and used Thinktecture.IdentityModel for claims checks. http://www.codeproject.com/Claims-Based-Authentication-and-Authorization http://evolvingtechie.wordpress.com/misc/identity-and-access-management/claims-authorization-in-geneva-beta-2-%E2%80%93-introduction/ http://www.contentmaster.com/windows-communication-foundation/implementing-customizable-claims-based-authorization-with-windows-identity-foundation/ This has some snippets you can use. https://github.com/maniserowicz/claims-talk/tree/master/Claims.WG.NET/_snippets

Categories : Asp Net Mvc

“.htaccess” and “.htpasswd" access policies
You can do: <Files A1.htm> require user Nancy Bob </Files> <Files A2.htm> require user Nancy Bob </Files> <Files A3.htm> require user Nancy Randy </Files>

Categories : HTML

Mixing Authentication Policies in Pyramid
You didn't mention anywhere in here how you're using permissions? Proper usage of permissions and ACLs on your views should prevent you from needing to run that boilerplate at the start of your function. For the simple paste you showed, you simply need a permission='logged_in' and an ACE mapping (Allow, Authenticated, 'logged_in'), but of course you can get more complex if necessary. It is not possible to specify different authentication policies for different views in a simple way because authentication policies in pyramid are intended to be global. You can do it globally via the pyramid_multiauth. Or you may write your own policy that wraps multiple policies and dispatches to one or another depending on request properties.

Categories : Python

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

Oracle SOA Suite WS-Policies and Bound Properties
You have two options to do this Assign the policy to the partnerlink, right click on the partnerlink and chose Configure WS Policies, choose the policy you wish to configure. For information on how to configure a policy during development Enabling Security with Policies Conversely you can configure your policy using OWSM on the administration console. For information on how to configure a OWSM policy Managing Web Service Policies Refer to Chapter 7 and 8

Categories : Oracle

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

Generating Certificate Policies Extension In C# Using Mono Security API
After scouring multiple sources I was able to solve this problem by switching from Mono to Microsoft's certenroll.dll. My code for generating a self signed certificate with Policy Extensions is below. Hope this helps anyone having similar problems. Code based off of the following reference: http://technet.microsoft.com/en-us/library/ff182332(v=ws.10).aspx. public X509Certificate2 CreateSelfSignedCert(string subject,string password,DateTime expDate) { // create DN for subject and issuer var dn = new CX500DistinguishedName(); // dn.Encode("CN=" + subject, X500NameFlags.XCN_CERT_NAME_STR_NONE); dn.Encode(subject, X500NameFlags.XCN_CERT_NAME_STR_NONE); // create a new private key for the certificate CX509PrivateKey privateKey = new C

Categories : C#

Can I create new S3 users and add IAM policies from the Linux command line?
I have no experience of using it myself, but I found a tool for interacting with Amazon IAM, the access control service for AWS, in a manner that might work for you: IAM Command Line Toolkit (note: last updated September 2010) There may be more usable stuff under the IAM Resources section. If you are unfamiliar with IAM, the documentation is one place to start. Although, knowing the general style of AWS documentation, there may be better resources and tutorials to be found elsewhere.

Categories : Amazon

System.Net.CertificatePolicy to ServerCertificateValidationCallback Accept all certificate policies
Include the following class in your code public static class SSLValidator { private static bool OnValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } public static void OverrideValidation() { ServicePointManager.ServerCertificateValidationCallback = OnValidateCertificate; ServicePointManager.Expect100Continue = true; } } Then call the following before you make service call but be careful to remove this code on the production when you have real certs SSLValidator.OverrideValidation(); Or you can d

Categories : C#

GWT: how to add column specific sorting policies for a client.visualizations Table
Using Andy King's Approach, came up with this. The dataTable is originally populated in order of the first column's entries. public final Table getTable() { final Table table = new Table(dataTableObject, TableView.createTableOptions(dataTableObject)); SortHandler sortHandler = new SortHandler() { @Override public void onSort(SortEvent event) { if (event.getColumn() == 0) { if (dataTableObject.getColumnLabel(event.getColumn()).contains("Time") || dataTableObject.getColumnLabel(event.getColumn()).contains( "Frequency")) { reverseRowOrder(); //reverses the order of the rows in dataTableObject table.draw(dataTableObject, TableView.cr

Categories : Java

Generating subnet CIDR blocks programmatically in CloudFormation templates (or adding integers together)
My solution for these kinds of issues was to use a legitimate programming language to compile a template into a CloudFormation JSON document. I used PHP 5.4, Twig and Symfony Console, but YMMV. Essentially, you do the math ahead of time in the programming language, then use that data as you write-out your JSON document.

Categories : Amazon

how to construct a string of physical subnet ids to create db subnet group on the fly in a cloudformation script?
I run into the same issue, after working with AWS support I understood that List of String does not mean what we initially thought. Also, if you want to place the DB inside a VPC you must not use AWS::RDS::DBSecurityGroup objects. Here is a full sample, it took me a while to get it working: "dbSubnetGroup" : { "Type" : "AWS::RDS::DBSubnetGroup", "Properties" : { "DBSubnetGroupDescription" : "Availability Zones for RDS DB", "SubnetIds" : [ { "Ref" : "subnetPrivate1" }, { "Ref" : "subnetPrivate2" } ] } }, "dbInstance" : { "Type" : "AWS::RDS::DBInstance", "Properties" : { "DBInstanceIdentifier" : { "Fn::Join" : [ "", [ { "Ref" : "AWS::St

Categories : Amazon

Can List.Distinct() apply to the list type of List>?
That's because List<T> has no Equals and GetHashCode implemented, so standard reference comparison is being performed. And it returns false, because you have two separated lists. You can write your own IEqualityComparer<List<string>> implementation and provide it as Distinct method parameter. Within the comparer you can use Enumerable.SequenceEqual) method to check if lists has the same content.

Categories : C#

iterating list of array-list and assigning each list to single dynamically created div in jsp
Try this, <c:forEach var="user" items="${userList}" varStatus="count"> <div id="col${count}"> <c:out value="${user.name}"/> </div> </c:forEach>

Categories : Java

In a responsive site design, how do i put a list below other list that contains a sub-list without overlap the main lists
Pretty simple : remove the fixed height of your li.menulinks, add a "header" (green rounded rectangle with 35px height) div as first child of the li and...you're set ! Look at this fiddle : http://jsfiddle.net/32pga/ <div class="sitemap"> <div class="row-fluid"> <ul> <li class="menulinks"> <div class="menulinks-header"></div> <ul> <li class="submenulinks"> <div>Test 1</div> </li> <li class="submenulinks"> <div>Test 2</div> </li> <li class="submenulinks"> <div>Test

Categories : HTML

Python: given a list of lists, create a list ordered by the number of occurrences in inner list
You can use collections.Counter to keep a counter for each element inside each sublist. Something like this, >>> from collections import Counter >>> lst = [['a','b','c'], ['a'], ['a','b']] >>> counts = Counter() >>> for sublst in lst: ... for ele in sublst: ... counts[ele] += 1 ... >>> [ele for ele, _ in counts.most_common()] ['a', 'b', 'c']

Categories : Python

Why does Haskell let me return an empty list where a list inside a list is expected?
Because [] is of type [[a]] in this case: it is a list containing exactly 0 alpha lists. In general, the empty list can match any list type because every element (all zero of them) is of the correct type.

Categories : Haskell

How to modify the style in list(ordered list and unordered list) in HTML?
Here you go. WORKING DEMO The HTML: <ul style="list-style-type:decimal;"> <li>First</li> <li>Second</li> <li>Third</li> </ul> The CSS: li{ position: relative; } li:before{ position: absolute; left: -13px; content: ')'; background:white;} Hope this helps.

Categories : HTML

In python, what happens, will the length of a list decrease if I add part of the list to another list?
The string "hi" will be split into chars and assigned to example when you do example+=python[0] So example in this case will contain ['h','i']. Also, the list python will not lose an element.

Categories : Python

create a list from another list and remove elements from copied list
Yes your understanding is correct. List newList = new ArrayList(collection); will do a shallow copy. You can modify the newList without affecting the original collection, but they will each reference the same elements so if you modify an element in one list, the other list's element will also get the change. This is called a Shallow Copy. Here's a visual representation of what I've described: The things at the bottom are the objects in your array.

Categories : Java

What kind of List is List list = Database.getAllData();?
You don't have to know; that's the point. The interface is what matters to you, not the implementation. You can't know without looking at the source of that method. But even if you do, it's immaterial to your client. All you call are List methods.

Categories : Java

Appending to create a list instead of creating a list inside a list
Use extend: for item in items: forename = re.findall(pattern2, item) surname = re.findall(pattern3, item) mainlist.extend(surname) myList.extend(L) adds the individual elements of L onto myList. It's similar to: for element in L: myList.append(element)

Categories : Python

Why does adding a list to another list, using add range, remove the elements from the first list?
It's because of the IEnumerable. When you set groupsToAdd to the result of groups1.Where(g => false == groups2.Contains(g)) there is deferred execution, which means that the query is not run until AddRange() and then again at Dump(). Because the list, groups2, now contains the elements they no longer are a result of the original query.

Categories : C#

Unmarshall xml list of objects to java list without class list
You could use JAXB with StAX to do the following: import java.util.*; import javax.xml.bind.*; import javax.xml.stream.*; import javax.xml.transform.stream.StreamSource; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(User.class); XMLInputFactory xif = XMLInputFactory.newFactory(); StreamSource xml = new StreamSource("src/forum17047306/input.xml"); XMLStreamReader xsr = xif.createXMLStreamReader(xml); List<User> users = new ArrayList<User>(); Unmarshaller unmarshaller = jc.createUnmarshaller(); while(xsr.getEventType() != XMLStreamReader.END_DOCUMENT) { if(xsr.isStartElement() && "User".equals(xsr.getLocalName())) {

Categories : Java

How to assign List or List to List
I don't think there's an easy way to do that using only strongly typed collections1, since there is no covariant collection interface that exposes a Remove method... I see 2 possible solutions: use the non-generic ICollection interface, that is implemented by List<T>: var collection = (ICollection) CouldBeBearsOrGoats; collection.Remove(whatever); The drawback is that a collection that implements ICollection<T> might not implement ICollection... use dynamic: dynamic collection = CouldBeBearsOrGoats collection.Remove(whatever); But it's probably slower than the previous approach. 1 assuming you don't want to change the actual type of the collections by casting items to IAnimal

Categories : C#

Create larger list from an existing list using a list comprehension or map()
How about: >>> atom_indices = [0, 4, 5, 8] >>> coords = [3*a+k for a in atom_indices for k in range(3)] >>> coords [0, 1, 2, 12, 13, 14, 15, 16, 17, 24, 25, 26] We can nest loops in list comprehensions in the same order we'd write the loops, i.e. this is basically coords = [] for a in atom_indices: for k in range(3): coords.append(3*a+k) Don't be afraid of for loops, though, if they're clearer in the situation. For reasons I've never fully understood, some people feel like they're being more clever when they write code horizontally instead of vertically, even though it makes it harder to debug.

Categories : Python

Getting a list of values from a list of dict in python: Without using list comprehension
You could use map() here. map() applies the lambda to every item of testList and returns it as a list. >>> testList = [{'id': 1L, 'name': u'Library'}, {'id': 2L, 'name': u'Arts'}, {'id': 3L, 'name': u'Sports'}] >>> map(lambda x: x['name'], testList) [u'Library', u'Arts', u'Sports']

Categories : Python

when appending a list with math using another list, how do i make the second list the same length as the first ?
You need to iterate over each elements in start_list: for item in start_list: # for each element in `start_list` square_list.append(item ** 2) # add square of `item` in `square_list` square_list.sort(); # finally sort the list or you can use sorted() function over generator expression: >>> sorted(item ** 2 for item in start_list)

Categories : Python

List within a List - How to put new line with LinQ after List within List is over?
Console.Write( String.Join(Environment.NewLine, f.Select(flight => { var segments = flight.Segments.Where(x => x.DepartureDate > DateTime.Now); return String.Join(" ", segments.Select(segment => { return String.Format("Departure: {0}, Arrival: {1};", segment.DepartureDate, segment.ArrivalDate)); }); }); ); I personally prefer to have a Joined extension method on IEnumerable<T> which wraps String.Join (taking a delimiter and an optional transformation delegate), and a Formatted extension method on String which wraps String.Format: var output = f.Joined(Environment.NewLine, flight => flight.Segments .Where(s => s.DepartureDate > DateTime.Now) .Joined(" ", s => "Departure:

Categories : C#

TSQL - Faster to use IN (list) or use NOT IN (list) for a small list?
NOT IN ('val4') is basically equivalent to WHERE NOT (column = 'val4') /* or column <> 'val4' */ whereas IN ('val1', 'val2', 'val3') is basically equivalent to WHERE ( column = 'val1' OR column = 'val2' OR column = 'val3' ) I would hope that the first option is faster, if only negligibly. The SQL engine might optimize IN differently depending on how many values you specify in the IN function and what indexes are available on your table. What behavior are you seeing that you're questioning the method to use?

Categories : SQL

How to get the list elements using list inside another list in java
You can try this ,Let say you have variables like double dtime; Timestamp tp; And listofresults is coming from query results. listofresults = results.getResultList(); If list is coming from query then put it in the loop this way in the condition of for loop for(int i=0;i< listofresults.size() ;i=i+2) { dtime=(double) listofresults.get(i); //cast because the value is of object type tp=(TimeStamp) listofresults.get(i+1); //cast because the value is of object type //do something with these variables }

Categories : Java

Using a list as "list of indexes" to address elements of another list
You could use reduce(operator.getitem, index, mylist) Here is a complete example: import operator mylist = [[1,2,3],[4,5,6],[7,8,9]] index = [1,2] val = reduce(operator.getitem, index, mylist) print(val) For NumPy arrays, there is a simpler method: import numpy as np ... myarr = np.array(mylist) val = myarr[tuple(index)] print(val)

Categories : Python

How to show inner content in list item outside of that list item without being covered up by descending list items
You must set the z-index of the clicked 'li' higher and in return the former clicked 'li' back. Here is the example: fiddle And here the script: var oldli; $('li').click( function(){ $(oldli).toggleClass('displayNone displayBlock'); $(oldli).css("z-index","1"); $(this).toggleClass('displayBlock displayNone'); $(this).css("z-index","5"); oldli=$(this); } );

Categories : Javascript

Write list of list to file and then retrieve it from the file as a list of list
>>> import pickle >>> banana, beans = ['Banana' , .54 , 'No' , 'Food'], ['Beans' , 1.39, 'Yes', 'Food'] >>> food = [banana, beans] >>> with open('data', 'wb') as f: pickle.dump(food, f) >>> with open('data', 'rb') as f: print pickle.load(f) [['Banana', 0.54, 'No', 'Food'], ['Beans', 1.39, 'Yes', 'Food']]

Categories : Python



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