Basically, when you are developing a project either in open source or in a company, you often need to add at the top of your source files a license to protect your work. I didn’t find any maven plugin on Internet to help you maintain these license headers. By maintaining, i mean checking if the header is here or not, generating a report and of course having the possibility to update / reformat missing license headers.
variable replacement: You can add some variable in your header, such as ${year}, ${owner} and they will be replaced by the corresponding values taken from the pom or system properties.
WARNING: there is good chances the latest version is greater than latest documentation, if nothing has changed concerning the plugin configurations.
license:check: verify if some files miss license header. This goal is attached to the verify phase if declared in your pom.xml like above.
All plugin configuration options are described in the Detailed Maven documentation but here are some details.
The plugin has been designed so that it is very easy to add new supports for new sorts of comment. The plugin currently support these types of comment:
XML_STYLE (XML-like comments): *.pom, *.xml, *.xhtml, *.mxml, *.dtd, *.xsd, *.jspx, *.fml, *.xsl, *.html, *.htm, *.kml, *.gsp, *.tld
The plugin enables you to add any other mapping you want.* I.e., if you are developing a Tapestry web application, you may need to add license header in .jwc files and .application files. since these files are xml files, you only need to add in your project pom the following mapping for the license-maven-plugin:
You can use composed-extensions like *.apt.vm and redefine them, but you will have to nake sure that the mapping of apt.vm is before the mapping of the vm extension. The order in the mapping section is important: extensions seen first take precedence.
In license-maven-plugin, each header style is defined by patterns to detect it and also strings to insert it correctly in files. If we take for example the Javadoc style header definition. It is defined as follow:
With the headerDefinitions option, you can redefine existing header styles and also add some if we do not support the styles you want yet. You just have to provide a list of headerDefinition containing a resource name. Like the header, the resource is searched on the file system, in the classpath of the project, the plugin and also as a URL.
The EOL string will be replaced with the proper end of line depending the file format your are processing.
You now have to add this new header definition file to the plugin configuration. It is done as the following in your pom:
You now have to add the new mapping for *.cs files to use this new header definition. It is done as the following in your pom:
When you learn that a company web server compromised because of a small programming mistake in PHP and it was possible to stop the attack by calling a function, you will want to learn more about all those "function calls".
I think it's most common vulnerability in dynamic web applications. Actually preventing SQL injection is not really hard. SQL injection happens when a web application doesn't check parameters received from browser and directly execute them in database server. So just by checking and sanitizing parameters, you can stop all type of SQL injections.
If hacker enter "1049 OR 1=1" as id, mysql_real_escape_string wouldn't help much, because there is nothing to escape from in "1049 OR 1=1". So for additional layer of security, it's always safer to use some additional security layers based on your application design.
When you use a file uploader, you are opening your server doors to foreign files. You need to take necessary precautions to stop hackers:
2-a) If it's possible, encode filename and never store filenames as it is into disk. For example, if user uploads Test.jpg, generate a name like:
* Never show link to location you save uploaded files. For example don't show "Thank you for uploading your file, you can see your file here yourwebsite.com/uploadedfiles/Test.jpg"
* Never have execute permission on file upload folder, you can do achieve it using .htaccess in Apache and using IIS configuration in IIS.
* Alternatively, you can simply store files in DB (if possible), but again do not serve them back to user in anyway.
As far as I've seen, PHP is most vulnerable to this attack. This happens when a code tries to include a page using dynamic variables. For example:
This is actually really dangerous. Even hackers can execute a code in your server, simply by injecting PHP codes into apache errors log file by generating errors with PHP codes as error string, then simply including your error_log file using code above will result in direct code execution. Same happens with remote file inclusions. So basically, my advise would be totally stay away from dynamic page inclusion, if you are designing an application with this style, I think it's better to stay away from it and change your design.
I would still suggest staying away from this approach. This is not a good design at all, simply a hacker can read your /etc/passwd file just by entering ../../../../../../../../etc/passwd as filename parameter. Instead you can:
1) For each file, have an address and an ID in database, so generate links like: downloadfile.php?ID=49 and in your code simply query database for filename with ID=49, read it and serve it.
You can also check for existance of ".." "/" "http" "ftp" "https" etc. But still, as I said above, this approach is not good at all, try to change it.
Techniques explained above is an intoduction toward secure web programming, but most of web application hacks are really this easy to prevent.
strip_tags() is *not* designed for security. Try it with "<p onclick=alert('xss'>this is a paragraph</p>".
As of PHP 5.5, the mysql_* functions are deprecated and no longer maintained. Just use prepared statements, that's enough.
Windward Building Consultants & Inspectors is a Home Inspection, Building Inspection and Building Code Consulting firm specializing in the inspection of existing and newly constructed single-family homes, condominium and commercial properties. The company services all of Sarasota and Manatee counties, and is a recognized leader in property inspections in the area.
For more information on our commercial inspection and consulting services, please visit our commercial site.
Several factors including the age of home, size, number of stories, location, optional equipment and additional services required (lawn irrigation, swimming pool, etc.) are all factored into the equation prior to quoting a firm fee. Typical fees are calculated on a per square foot basis. Many inspectors prices range from 8¢ to 10¢ per ft² which is generally reflected in the time spent on the inspection. In comparison, WBC&I’s minimum per square foot fee starts at 16¢ per ft², in addition to any supplementary services that are needed. New construction inspections are quoted based on the number of phases and the level of service requested. Many clients have found that our fees are, in most cases, equal to or only a slight premium above the other qualified inspectors in the area. Compare the overall credentials of an inspector before you decide. You have a choice: to hire a newer inspector or a highly experienced code-certified inspector.
Find All reachable squares for a knight on chessboard in K moves when opponent has another knight. - Codeforces
Given an NxM chessboard, you have a knight at some position and your opponent also has a knight, Find number of squares reachable to your knight in exactly K moves without being captured by opponent.There is no other piece other than 2 knights mentioned. You move first. Both players play optimally. Obvious solution would be to recursively try out each possibility for both knights but that would be too slow. Is there deterministic polynomial time solution ?
You can store, for each number of moves, all squares your knight can occupy and all squares for the other one as well.