w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Convert site from SP-Initiated SSO Redirect POST to IdP-Initiated SSO POST
I found the answer from someone. The title of the page isn't as obvious as I thought, which would explain my lack of knowing what to search for. http://simplesamlphp.org/docs/stable/simplesamlphp-sp

Categories : PHP

starting elasticsearch instance from java?
Starting an elasticsearch instance is extermely easy. You just have to use the Java API. That means you have to add the elasticsearch dependency to your project and create a node, as mentioned in the reference: // on startup Node node = nodeBuilder().node(); Client client = node.client(); // on shutdown node.close(); Once you created the node it will behave exactly the same as a node started from the command line. You can interact with it using the created client object, but by default it will also open the 9200 and 9300 (or following ones if busy) ports for rest calls and inter-node communication.

Categories : Java

LocalDb - starting a shared instance as other user
Share your instance with Local System account Create batch file (or PowerShell script) with desired commands (sqllocaldb start nameofinstance) Run gpedit.msc, navigate to Computer Configuration->Windows Settings->Scripts (Startup/Shutdown) Add your script

Categories : Sql Server

How to automatically start Tomcat after starting an Amazon EC2 instance
Your best bet (if you want to cut out a lot of trial and error) is probably to reinstall Tomcat with the .exe installer, and explicitly install it to run as a service. (You could certainly accomplish this without reinstalling; I suggest reinstalling merely because when all's said and done, it'll will probably take you less time, unless you have lots of custom Tomcat config.) Once it's installed as a service, go to Services and make sure the Tomcat service's "Startup Type" is "Automatic". (You will probably be able to control the Tomcat service's Startup Type from the Apache Service Monitor in your system tray as well, without opening Services.) Note that running Tomcat as a service may conflict with the way you schedule the starting/stopping Tomcat during business hours, but since it's

Categories : Tomcat

OAuth: Starting a Google Compute Instance from within Google App Engine
You should be able to use the service account associated with your project to authenticate to the Compute Engine API and launch VMs. Documentation on service accounts suggests that the following python code should fetch a service account token. import httplib2 import discovery from oauth2client.appengine import AppAssertionCredentials ... credentials = AppAssertionCredentials( scope='https://www.googleapis.com/auth/compute') auth_http = credentials.authorize(httplib2.Http()) compute_service = discovery.build('compute', 'v1beta15', http=auth_http) I'd thought that the Google I/O demo from this year where they built a video-sharing site was going to be available, but I don't see it on GitHub yet. There are a number of demos that use AppEngine to control GCE, but most of them seem t

Categories : Google App Engine

Scala v 2.10: How to get a new instance of a class (object) starting from the class name
There is a very simple answer: scala> def createInstance(clazzName: String) = Class.forName(clazzName).newInstance createInstance: (clazzName: String)Any scala> createInstance("java.lang.String") res0: Any = "" If it works for you, everything is fine. If it don't, we have to look into your class loader. This is usually the point when things will get dirty. Depending in what you want to do, look into: The cake pattern, if you want to combine your classes during compile time OSGi when you want to build a plugin infrastructure (look here for a very simple example) Google guice, if you really need dependency injection (e.g. when mixing Scala and Java code) and the cake pattern does not work for you

Categories : Scala

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

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

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

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

Where do events in init.rc are initiated?
This is all managed in init.c The property system is a little bit complex. There is a property service resident in init process. Init process maintains several name spaces of the properties. E.g. ro.xx, system.xx, persist.xx. Property setter set the property via notifying the unix socket message. So init process knows every setting action and you can see from the code that there is a callback "property_changed" called every time when a property is set.

Categories : Android

Search and replace line matching first instance of keyword starting from point of another keyword search
Here is one way awk '/text1_to_search/,/text2_to_search/ && !found{ if($0 ~ /text1_to_search/){found=0}; if($0 ~ /text2_to_search/){print "replacement";found=1;next}}; {print}' For two non-overlapping search/replaces awk '/text1_to_search/,/text2_to_search/ && !found{if($0 ~ /text1_to_search/){found=0};if($0 ~ /text2_to_search/){print "replacement";found=1;next}}; /Search_String2/,/Search_String3/ && !found2{if($0 ~ /SearchString2/){found2=0};if($0 ~ /Search_String3/){print "replacement2";found2=1;next}}; {print}'

Categories : Shell

Validate IDP initiated SAML2.0 Response
You need to validate the responce according to the SAML spec. There are some functionaliy for doing this in OpenSAML but i seems the safest bet is to write your own validation code. see. http://marc.info/?t=137354098500007&r=1&w=2 You must also validate signature. As with all signature verification you use the public key. Here is some I wrote on my blog about OpenSAML signatur verification. http://mylifewithjava.blogspot.no/2012/11/verifying-signatures-with-opensaml.html I have more on signing and encryption using OpenSAML in my book, A Guide to OpenSAML

Categories : Java

Best Way to Pass Data to new ViewModel when it is initiated
I will vote for making models able to notify there changes i.e implementing INotifyPropertyChanged in models. Two reasons: There may be multiple places/views you might need to use the same model and you would not like to take care in each ViewModel as which property change should raise which other property changes. Frankly thats messy and buggy. Sometimes, in the VM layer we might need to listen to changes in models, so in that case also self notifying model helps. Thanks

Categories : C#

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

Adding a border and shadow to a nib initiated view
Take a look at using the view's CALayer. To add a border: myView.layer.borderWidth = 1.f; myView.layer.borderColor = [UIColor blackColor].CGColor; There are similar methods for adding a shadow: myView.layer.shadowColor = [UIColor blackColor].CGColor; myView.layer.shadowOffset = CGSizeMake(4.f, 4.f); myView.layer.shadowRadius = 4.f; myView.layer.shadowOpacity = 0.5f; myView.layer.shouldRasterize = YES; You will need to add the Quartz framework to your target, and import the header in your controller's .m file: #import <QuartzCore/QuartzCore.h>

Categories : IOS

PhpStorm how I debug php file when request is initiated from JS?
After you start php debugging, try to right click in the browser window and select Inspect in PhpStorm. This should also activate the JS debugger in storm alongside php debug. Of course you've installed Chrome extension for PhpStorm: https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji Hope this helps. [Later edit] Ah, and deactivate any JavaScript minifying you may have!

Categories : PHP

Object for view not being passed if initiated in UINavigationController
Check that your currentUser property declared like this: @interface ProfileViewController : UIViewController @property (nonatomic, strong) Contact * currentUser; @end

Categories : IOS

Running only one instance of an application,(Quit new instance and Display old instance or give Focus)
What you need to do is to add this to your main class: [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); Then you need to obtain a reference to the process that is already running, and then call the SetForegroundWindow method like this: SetForegroundWindow(SameProcess.MainWindowHandle); You do not need to kill the current process like you are currently doing, just return after focusing the other process' main window as shown above This is a full working example: [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { var currentProcess = Process.GetCurrentProcess(); foreach (Process p in Process.GetP

Categories : C#

Accessing and modifying the models that are initiated in template with angular.js
It is because it is a primitive value. I changed the fiddle a little bit, like this, and it works as you expect: ng-init="deneme = {value: 5}" $timeout(function(){ val.value = 23; ..... It is the same as if you set any javascript variable to a primitive, and then set another variable to that value, and then reset the original variable. var a = 10 var b = a var a = 2 // a = 2, b = 10 I ran into this same issue a couple months ago, so it is still fresh in my mind.

Categories : Javascript

Dialog doesn't properly close when initiated by focus
You can just add $("#id_focus").blur(); to the focus function like so: Working Example $(document).ready(function () { $("#id_focus").focus(function () { $("#id_focus").blur(); // Important bit $("#dialog").dialog("open"); }); $("#id_click").click(function () { $("#dialog").dialog("open"); }); $("#dialog").dialog({ autoOpen: false, modal: true, buttons: [{ text: 'CANCEL', click: function () { $(this).dialog("close"); } }] }); }); From the API Documentation: Focus Upon opening a dialog, focus is automatically moved to the first item that matches the following: The first element within the dialog with the autofocus attribute The firs

Categories : Javascript

How to override system commands in shells initiated by Perl?
Shell aliases only work in the interactive shell. You have other options: Change your PATH so that the newer gnuplot's bin precedes the old one. Make a symbolic link to the new gnuplot from your bin and make sure it comes first in PATH.

Categories : Perl

Kill or stop execution of PHP script initiated by CRON?
You can try system() or exec(), but it might not work (or return permission denied errors) as cron processes are executed by either the current user or root, and the web server user doesn't usually have access to these processes.

Categories : PHP

.NET objects not initiated from VB6 when server get converted to Windows 2008 R2 64-bit
CreateObject can't be returning an empty string. It either returns an object or raises an error. Maybe you're accidentally using an old version of the component? Put in some logging and check the TypeName of the returned object. Are you ignoring errors with On Error Resume Next? You could try explicitly targetting 32 bit when you build the .Net components, as the VB6 will only run as 32 bit.

Categories : Dotnet

tableView:didDeselectRowAtIndexPath: not called until first user-initiated selection and deselection
This is too long for comment so I'm posting this as an answer. Just created test project with tableView. I call [UITableView selectRowAtIndexPath:animated:] on viewDidLoad and I have one cell selected. Then I'm selecting another cell (without deselecting first one). I have this output: [SDTVTViewController tableView:willSelectRowAtIndexPath:] [SDTVTViewController tableView:willDeselectRowAtIndexPath:] [SDTVTViewController tableView:didDeselectRowAtIndexPath:] [SDTVTViewController tableView:didSelectRowAtIndexPath:] And I have first cell deselected and second one selected. I have no idea, why it's not working in your code. When you're calling [UITableView selectRowAtIndexPath:animated:] and can you post code of UITableViewDelegate methods that you've implemented?

Categories : IOS

JavaScript: Calling variable functions of an initiated class (packet-handler)
You can bind the methods to your instance: var PacketMethods = { 4352 : this.ServerList.bind(this), 4351 : this.LoginResponse.bind(this) }

Categories : Javascript

Current version of data in database has changed since user initiated update process
I have experienced similar problem where my detail records set has timestamp fields. By default master detail wizard creates the timestamp fields as date picker type fields. If you set the date format on these, it would resolve the issue.

Categories : Oracle

Transferring $_POST values to jQuery initiated popup window through ajax not working
Of course it doesn't pick any data because you don't pass any(you do in the ajax call, which is a separate request that doesn't know nothing about your next window.open call). You should pass the variables in the $_GET in your case: var url = "preview.php?title=" + $title + '&author=' + $author; var windowName = "popUp"; var windowSize = "width=495,height=680"; window.open(url, windowName, windowSize); Then in preview.php you will pick them up like: $title = isset($_GET['title']) ? $_GET['title'] : null; $author = isset($_GET['author']) ? $_GET['author'] : null; Next, the alternative. You could, however do something like: $.ajax({ type: "POST", url: "preview.php", data: { documentTitle: $title, authorsNameOne: $author } }).done(function( msg ) { $('#someHiddenDiv').html(

Categories : PHP

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

java.lang.LinkageError: loader constraint violation previously initiated loading for a different type with name "javax/xml/soap/SOAPMessage"
LinkageError is JBoss is generally caused by your app packaging its own copies of certain libraries that JBoss considers restricted. These are usually things in the java.* and javax.* packages. Try adding cxf-rt-frontend-jaxws and cxf-bundle-rs as dependencies and mark some exclusions -> jetty-server, gernomino-servlet. Also check the beans.xml is expected to be under the classpath, instead of WEB-INF.

Categories : Java

When accessing the bounds of an Area from an ArrayList outside of the class it was initiated in, the Rectangle received is incorrect
You don't add the amalgamated area, but you take the first area from the arraylist and modify it. It happens exactly here: if (k == 0) { map = area; Later your add the other areas from the list to the map - which is the first area on the list. You may want to create a new area based on the first one from the list instead: if (k == 0) { map = new Area(area);

Categories : Java

Linkage error:Loader Constraint violation: previously initiated loading for a different type with name "org/w3c/dom/Type Info"
This happened to me with the JMX MBeanServer class. Groovy was loading one of them with its classloader and so was the JVM. In your case it sounds like the TypeInfo class exists in rt.jar just fine, but another class loader loads it from that jar (or another jar) again. Running the JRE with "-verbose:class" showed that double load behavior. Then I moved the offending jar out of my classpath and it worked just fine with the one loaded by Groovy. I would recommend moving rt.jar out of your classpath, or if you need other classes inside of rt.jar try unjaring and rejaring it without the Type class. That way the classloaders will be forced to use the ones in xmlbeans-2.5.0.jar or xbean-2.1.0.jar.

Categories : Misc

Detect JavaScript initiated change on a JavaScript created object
If you want full cross-browser support, you will simply have to set up a polling interval and compare the contents each time to what you saw the last time. DOM mutation events aren't going to cut it. Have fun.

Categories : Javascript

Spring java.lang.LinkageError: loader constraint violation: loader previously initiated loading for a different type with name X
Here is what I could gather so far: The error java.lang.LinkageError comes in a situation when there are two classloaders involved in loading a class. A classloader keeps track of the classes loaded by generating a unique identifier which contains the fully qualified class name itself and the classloader loaded it. When a classloader receives a reference of a class loaded by another class which is already loaded by itself, this results into erroneous situation as a class can be loaded only once in a classloading hierarchy. When custom classloaders are involved, for loading a particular class, the practice is that the parent classloaders are queried first if that class is already loaded. In the scenario, when a custom classloader does not query the parent hierarchy and decided to load t

Categories : Java

Get starting date of week(configurable starting day of week)
From the java calendar API http://docs.oracle.com/javase/6/docs/api/java/util/Calendar.html#getFirstDayOfWeek() public int getFirstDayOfWeek() Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France. Returns: the first day of the week. See Also:

Categories : Java

Can a child instance access dynamic parent instance attributes and attribute values?
You're misusing inheritance. Rule doesn't need to inherit from Map to access a Map's attributes, and attaching a Rule to a Map won't make it see the Map's attribute values as its own. Inheriting from Map means a Rule is a Map, not that it's linked to or managed by a Map. If you want a Rule to know about its Map, have it record which Map it's associated with: class Rule(object): def __init__(self, number, map): super(Rule, self).__init__() self.number = number self.map = map def __str__(self): # __str__, not __repr__, because __repr__ should be unambiguous, # have a clear beginning and ending, and obviously indicate the type. return "Map {} rule number {}".format(self.map.mapName, self.number) Rule(1, map) # makes a rule associated

Categories : Python

Pass in an instance variable to a static method -- and modifies another instance variance?
Am I correct in saying that it is impossible for the other HashMap to be modified by foo as a result of just this one method call? Answer is may be. It is true that if you dont pass the reference of a object to method, you can not access it. But Map stores key-value Object pair refernece, it does not store the Objects, if both map share Object as key or value, then it would effect.

Categories : Java

Is there a way to reset a class instance's initialized attribute to the value entered when the instance was created?
There's nothing in Ruby that saves the initial value passed on, so nothing in Ruby that will let you automatically reset it. However, you can certainly save the value in an another instance variable and reset it as you wish, as in: def initialize(..., meat_quality) ... @original_meat_quality = @meat_quality = meat_quality end def reset_meat_quality @meat_quality = @original_meat_quality end

Categories : Ruby

Newly created instance takes the primary id of a deleted instance with same Account name
This is a known behavior of AUTO_INCREMENT fields in MySQL: http://forums.mysql.com/read.php?10,167180 If this is really your problem, you will have to find an other strategy to keep track of deleted user accounts. For more information, see Stop MySQL Reusing AUTO_INCREMENT IDs

Categories : SQL



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