w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Shiro 1.2.2: How to catch permissions of role
What you are describing is something that is specific to your application logic. Shiro sees Roles and Permissions as two different entities. There is no ownership relationship, so there is no such method. Moreover, why would you check if a Role has a Permission? The way I see it, if the subject has that permission, then he must have that role, so just check the permission.

Categories : Java

Web Deploy Command Line Logs in Event Logs (Updated / Inserted / Deleted Files) in event logs
I don't believe you can log the activities to the event log, but what you can do is use the -xml parameter to output the changes in XML format. You could then use this to log to the event log via a Powershell script, for example.

Categories : Iis

How to conveniently store common logs and client specific logs
I would have an xml file that contain the appenders to specify what packages go into what log file. You can then load the xml file in your application entry point. Below is an example I have used in my current project <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <!-- appenders --> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out" /> <param name="threshold" value="error" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%t] %p %c - %m%n" /> </layout> </appender> <appender name="codebaseXAppender" class="org.apache.log4j.RollingFileAppender"> <

Categories : Java

Ruby AWS SDK CloudWatch
Your :dimensions option hash needs to be formatted like this: metric = AWS::CloudWatch::Metric.new( 'AWS/RDS', 'CPUUtilization', :dimensions => [{ :name => 'DBInstanceIdentifier', :value => 'my_db_instance' }] ) Amazon's SDK doc tries to explain this as "An array of hashes". Quite uncommon in Ruby and hard to figure out, at least for me.

Categories : Ruby

How to set intellij to show logs in the logs tab and not the output tab
In the application server Run/Debug configuration open the Logs tab and specify the full log file path there. You can just search your disk for algo_js.log file and specify its location.

Categories : Spring

How to deploy a Node.js web role along with a .NET web role in azure cloud service project?
The development experience probably will be smoother if the Node.js component of the application is deployed as a separate cloud service instance. But it is possible to automate the deployment using startup taks as described in Run Startup Tasks in Windows Azure. You can create a command batch file to download anything you need and install it on the instance. You can run it with administrative privilege. You can listen to a port and have it set up as a cloud service endpoint. You can even deploy the files as part of your cloud service project and just configure and run them through the startup task. Use RDS to debug this script via logging and system events.

Categories : Dotnet

Dynamic Role from database to show content to user based on their role
Maybe you want to store the different ROLES in a Properties file and get them in the code, like: @PreAuthorize("hasRole(" + PropertyManager.getProperty("role.admin") + "')" + '"') Or when you configure the GRANT permissions to the different users you are possibility to select different columns for each role. So in the Controller of the app redirect to the specific method

Categories : Java

CloudWatch custom metrics using for what?
The idea of CloudWatch is to collect metrics from running cloud resources (servers, applications, databases, etc.) and share this information among other resources, in order to let them make decisions. For example, your application may produce the following metrics: size of in-memory queue memory available for JVM disk space available for cache users currently active transactions per minute $ sales per hour In an extreme case you can even reproduce Google Analytics with CloudWatch. It's a convenient instrument to collect statistics and distribute it.

Categories : Amazon

What does the AWS CloudWatch metric RequestCount mean?
It will report a sum of all requests over the reporting period selected. If 1 min is selected, then you will get requests per minute. This is selectable. Between 1 min and 1 day.

Categories : Amazon

Connect Web Role to Web Site Role in the same windows azure solution
https://connect.microsoft.com/VisualStudio/feedback/details/790187/vs2012-add-service-reference-discover-services-in-solution-feature-creates-empty-proxy The types in the WCFRole and WebsiteRole are colliding. Right click and the Service Reference -> Configure service reference -> Uncheck the "Reuse reference Types" working like a charm now :)

Categories : Wcf

terminate instance; Amazon cloudwatch
you have to add these two lines PutMetricAlarmRequest alarmreq=new PutMetricAlarmRequest() .withActionsEnabled(true) .withAlarmActions("arn:aws:automate:us-east-1:ec2:stop"); //This stops the instance in the requests

Categories : C#

Price for CloudWatch custom metrics
Its $0.50 per month per metric. I don't think you have the choice of detailed or not with custom metrics. That is only applicable to basic EC2 metrics. Current prices are available at the Amazon Cloudwatch website.

Categories : Amazon

Whats the difference between role and name in symfony2 role class?
The security.yml role_hierarchy is to do with role's inheritance. It allows you to create many roles and then state that some roles inherit other roles. http://symfony.com/doc/current/book/security.html#hierarchical-roles ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] The above means that if as a user I have the role "ROLE_SUPER_ADMIN" (which comes from the role field in your group entity) then I also inherit the roles "ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH". so: ROLE_TO_INHERIT: [ROLES_TO_INHERIT_FROM] So your name field has no meaning in security.yml only your role field. Role hierarchy is separate to where you store your roles. It is an extra level of configuration so that, for example, you don't need to add 3 roles to every super admin user but rather

Categories : PHP

Web Role vs Worker Role in Cloud Services / Node.js
The difference is that Node Web Role will runs through IIS. But Node Web Worker is VM and runs through node.exe it self as clustered worker. Main difference here is that your virtual hosts and web platform setup will depend on the option you choose. As you aware setting up IIS is very different from node.exe it self. So with Web Role it will proxy all traffic through IIS rather than directly through node master process. Cons/Pros: Main advantage of Web Worker as it does not relies on any stack and you have full control over what runs there and how it affects your app. As well if you already have something ready, you can reuse it without big problems. In mean time you will need to manage your stack your self, by implementing master node process and then forking workers your self. While u

Categories : Node Js

Deploying WCF Service on Azure : Web Role or Worker Role?
A web role assumes that the application will be hosted in IIS. If your service does not require any of the benefits provided by IIS or its HTTP stack, then hosting it in a worker role may do you perfectly fine and also provide you a lower resource utilization for that service (since there's no "overhead" for the IIS server).

Categories : Wcf

Role of data-role attribute in html markup
In summary: "The value of the role data attribute is the name of the widget in lower case e.g. "autocomplete", "dropdownlist" etc." You can find info here: http://docs.kendoui.com/getting-started/data-attribute-initialization#example---initialize-a-kendo-ui-widget-using-a-data-attributes

Categories : Javascript

FBSession.activeSession.permissions does not appear to accurately depict the valid granted permissions
If you were using iOS SDK 3.0, then this was due to a bug in the SDK. See the bug report for more details. Symptom summary: After authorizing user with openActiveSessionWithPermissions method, the sessions variable in callback method contains extended permissions that were not allowed by a user.

Categories : IOS

Can I monitor the usage of individual directories with AWS CloudWatch?
You should be able to use cloudwatch to do this, however, it might not be the most efficient place to put this information if you are going to bill or report on it. I think you are better off computing the data and then storing it in a database of your own. This way you have easy access to the data and you can do things with data that may not work well in the context of cloudwatch.

Categories : Amazon

Stopping an AWS EC2 Instance with a Cloudwatch Alarm in Java
Found the answer through asking in the Amazon forums. Basically, I was wrong in the assumption that withAlarmActions only accepts SNS or SQS actions. It can also accept stop or terminate actions in the form of "arn:aws:automate:us-west-2:ec2:stop". The final line of code edited to be fixed would look like: .withAlarmActions("arn:aws:sns:us-west-2:xxxxxxxxx:NotifyMe", "arn:aws:automate:us-west-2:ec2:stop"); Here is the full answer if anyone who is curious. https://forums.aws.amazon.com/thread.jspa?messageID=466061&#466061

Categories : Java

Get iPhone Logs(not crash logs)
Got a breakthrough!!. We need to re-direct NSLog to a file like this and then access the file. - (void)redirectNSLogToDocumentFolder{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *fileName =[NSString stringWithFormat:@"%@.log",[NSDate date]]; NSString *logFilePath = [documentsDirectory stringByAppendingPathComponent:fileName]; freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr); } http://objcolumnist.com/2009/12/19/redirecting-nslog-to-a-log-file/

Categories : IOS

Posting from web role to another web role Windows Azure
It is better to make the API call from server side such as MVC controller in your web app. You can include security key and other things that you don't want to expose to others. When you make API call directly from javascript for another subdomain or url, you are creating cross-domain ajax request. In your javascript, you will make an ajax call to your controller action in your web app. Web app will make the call to whatever service it is talking to. You can also test your API from fiddler with POSt/GEt/PUt/DELETE requests. If you want to directly call from javascript and host web roles under different subdomains, you need to make CORS request: http://www.html5rocks.com/en/tutorials/cors/. You can also look at this related question: Running WebApi alongside MVC project in Azure

Categories : Azure

How to add an user to sysadmin role using ALTER ROLE?
alter role is for database roles, but sysadmin is server role. Try alter server role instead: ALTER SERVER ROLE server_role_name ADD MEMBER p_sys

Categories : Sql Server

What is the role for a controller and what is the role for $scope in AngularJS?
The $scope is an object that both the view and the controllers know... It's not actually the controller itself, but through it you can pass in references to data and methods and use them inside of the view. The controller in angular is more like a presentation model, which holds up an object which is a "mutual friend" of both the view and the controller... that's how I like to think of it at least :)

Categories : Javascript

CloudWatch Amazon Aws - Create Alarm in LB to monitorize if Apache Solr is down?
You could use the PingRequestHandler of Solr to keep a watch on the Health of your Solr instance. This answer talks about how to use a HealthCheck file to return back the status of your instance.

Categories : Solr

How to deny a user in a role unless they are in another role in .NET c#
Isn't it enough to allow Admin specifically before your deny rule? The authorization rules are checked from top to bottom until a match is found. <authorization> <allow roles="Admin"/> <deny users="?" roles="ROLE1"/> </authorization>

Categories : C#

Azure Web Role can't see VM's internal IP (but VM can see web role)
For completeness, moving my comment to an answer: While the virtual network is allowing traffic in both directions, you'll need to enable ICMP via the firewall, which will then let your pings work properly.

Categories : Azure

How to set world permissions to be the same as group permissions?
From the chmod(1) man page (relevant parts extracted): -R Change the modes of the file hierarchies rooted in the files instead of just the files themselves. And: The symbolic mode is described by the following grammar: who ::= a | u | g | o op ::= + | - | = perm ::= r | s | t | w | x | X | u | g | o The who symbols "u", "g", and "o" specify the user, group, and other parts of the mode bits, respectively. The who symbol a is equivalent to ugo. The perm symbols represent the portions of the mode bits as follows: g The group permission bits in the original mode of the file. So for you: chmod -R o=g * Example: $ ls -l total 0 drwxr-x--- 2 carl staff 68 Jun 28 10:25 example.d -rw-r----- 1 carl staff 0 Jun 28 10

Categories : Bash

Connecting an Azure worker role to a dedicated cache worker role
Hello maybe you should try to set the connection between them using Inter Role Communication, you can find an answer for how to make the inter role communication in the following stackoverflow website: How to do inter-role communication with Azure? you can also find more details in the following link: http://blogs.msdn.com/b/avkashchauhan/archive/2011/10/30/communication-between-windows-azure-roles.aspx I hope this helps you solve your problem please let me know if you need anything else.

Categories : Caching

Instantiating a worker role from a worker role
If your worker roles are different applications, you could make use of Service Management API to create a new deployment for WR-2 from WR-1. What you would do is put the package and configuration files of WR-2 in blob storage and when WR-1 has done putting all the messages in the queue, you create a new deployment of WR-2. To create a deployment programmatically using Service Management API, please see here: http://msdn.microsoft.com/en-us/library/windowsazure/ee460813.aspx. However you would need to ensure that once WR-2 has done all the data, it is destroyed by WR-1 so that you don't keep on incurring charges. Other possibility is to run your worker role instances to run in Master/Slave configuration. Let's say there are 2 instances of your worker role running. One of the instance would

Categories : C#

SLF 4j Logs are not written to log
I believe you should be using a single shared log 4J configuration and instance for all your adapters if you want to use the the same log file. As is, Log 4j instances are probably competing for the control of the file.

Categories : Java

IIS logs questions
Question 1 IIS log mystery. what you see as one page access is actually several accesses try and use Fiddler it will show you the connection steps. EX: I want page A -> no you need to authenticate -> no sessionID how can I authenticate -> you need to do this -> no sessionID here is my authentication -> here is page A. -> sessionID is present. Question 2 find out the time spent on page. there is no reliable way of finding this you can approximate by sending some start message on page load and one adder on page leave (but you are depending on client code and you never trust on client code).

Categories : C#

Customizing Apache Logs
If you are using HTTP Basic or Digest authentication, then the user name is derived from an HTTP header and can be inserted into the log by using %u in a LogFormat directive in your apache config. If you have a login system that does not include the username in a header (likely), then the only other option I know of would be to somehow set an environment variable which Apache could then write out with %{FOOBAR}e. See http://httpd.apache.org/docs/2.2/logs.html Otherwise, you're probably better off writing out your own log file from your application code (or use an application level logging library - Log4j, or whatever.)

Categories : Apache

Grouping logs that occurred on the same day
This is a job for your database. With a combination of SUM and GROUP BY you don't have to mess with your application code. ActiveRecord has methods to do this, see sum and group. http://guides.rubyonrails.org/active_record_querying.html Updated This answer Multiple sum()s in ActiveRecord in Rails have some great code you can start with using group and sum.

Categories : Ruby On Rails

accessing logs using Powershell
Does this help? Get-Content 'directory oyourlog.txt' | Select-Object -last 1000 Get-Content loads all the info from log.txt into memory, this is then passed to Select-Object which will return you the last 1000 items, in this case it will return the last 1000 lines of text. Hope this helps.

Categories : Powershell

azure - operation logs api
The SubscriptionId is a GUID that identifies a specific subscription. It is visible in several places in the Windows Azure Portal including the Dashboard tabs (bottom right) for Cloud Services and Storage Accounts. Each Windows Azure subscription is uniquely identified by the SubscriptionId, which is a GUID. The Subscription Name is descriptive and is not necessarily unique. Knowledge of the SubscriptionId by itself is not particularly insecure since any operations against the Windows Azure Service Management REST API requires the use of an X.509 Certificate for authentication - and that does need to be secured since it (with the SubscriptionId) provides access to all Service Management operations. I did a post recently describing the use of Burp to invoke Service Management operations -

Categories : C#

Removing Logs when releasing iOS app
It's an interesting request, but feasible if you're willing to accept a bit of function-call overhead for each log that gets skipped. There is a nice feature inside of the EtPanKit framework that checks if the files that are trying to call the log function match an array of pre-defined classes in your Info.plist file. In addition to being a great debug filter, all you'd have to do at Release time is remove all the keys from the plist or specify a different one in your Release build with no values associated with the LEPLogEnabledFilenames key. In the interest of preventing link-rot, here's the function itself and the associated macros that make it a bit prettier to call: #define LEPLogStack(...) LEPLogInternal(__FILE__, __LINE__, 1, __VA_ARGS__) #define LEPLog(...) LEPLogInternal(__FIL

Categories : IOS

see the parametrized value in hibernate logs instead of?
In my log4j.properties I have : # Logs the JDBC parameters passed to a query log4j.logger.org.hibernate.type=TRACE # logs the SQL statements log4j.logger.org.hibernate.SQL=DEBUG They enable hibernate log sql statements as well as data (instead of ?)

Categories : Hibernate

Storing my Logs to REDIS
a key can only get one type, here you define key as hash, set and zset try construct the key name using your filter data as you need get records in date range, using a single list key by day and host could be pertinent var entry = { date:req.body.date, title:req.body.title, details:req.body.details, sl:req.params.sl, source:req.params.source, host:req.params.host } var key = 'mylog:'+req.params.host+':'+currentDay; redis_client.rpush(key,entry); redis_client.expire(key,30*24*60*60); // expire in one month for catch all entry of a particular day for any host just use lrange command function getLog(host,day,callback){ redis_client.lrange('mylog:'+host+':'+day,0,-1,callback); } and you can use keys command to filter keys using wildcards (not do that in pr

Categories : Node Js

deleting few of the git commits so that they do not appear in the logs
Given that the commits you don’t want to appear are on separate branches, it is enough if you just remove those branches: git branch -D styleChange git branch -D master

Categories : GIT

Reading logs with fabric
I've found correct solution for this problem. I need to use env.remote_interrupt = True: env.remote_interrupt = True env.LOG = '<path to log>' @task def log(): assert(env.remote_interrupt == True) with settings(warn_only=True): sudo("tail -n 50 -f " + env.LOG) Example on Github My blog post (in Russian)

Categories : Python



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