This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in windows | |
| String username = new com.sun.security.auth.module.NTSystem().getName(); | |
| // in Unix: | |
| String username = new com.sun.security.auth.module.UnixSystem().getUsername(); | |
| // in Solaris: | |
| String username = new com.sun.security.auth.module.SolarisSystem().getUsername(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if not exists(select * from sys.columns where Name = N'$COLUMN_NAME$' and Object_ID = Object_ID(N'$TABLE_NAME$')) | |
| begin | |
| alter table $TABLE_NAME$ | |
| ADD $COLUMN_NAME$ int DEFAULT(1) | |
| end | |
| go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*@name=$name dependsOn={}*/ | |
| /*@start*/ | |
| if exists (select * from sysobjects o where o.id = OBJECT_ID(N'$name') and type in (N'PC',N'P')) | |
| drop procedure $name | |
| go | |
| create procedure $name | |
| as | |
| begin | |
| //code here.. | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Synchronous: | |
| var fs = require('fs'); | |
| var array = fs.readFileSync('file.txt').toString().split("\n").forEach(function(line){ | |
| console.log(line); | |
| }); | |
| //Asynchronous: | |
| var fs = require('fs'); | |
| fs.readFile('file.txt', function(err, data) { | |
| if(err) throw err; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with cte as ( | |
| select row_number() over ( | |
| partition by | |
| $column_names$ | |
| order by $orderby_column$ as rn | |
| from $table_name$) | |
| delete from cte | |
| where rn > 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select CONVERT(DATE,getdate(), 101) -- returns YYYY-MM-DD | |
| /*OR...*/ | |
| select CAST(GETDATE() as Date) -- returns YYYY-MM-DD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyWorker extends Thread { | |
| private static int instance = 0; | |
| private final Queue<String> queue; | |
| public MyWorker(Queue queue) { | |
| this.queue = queue; | |
| setName("MyWorker:" + (instance++)); | |
| } | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BlockingQueue implements Queue { | |
| private java.util.Queue queue = new java.util.LinkedList(); | |
| /** | |
| * Make a blocking Dequeue call so that we'll only return when the queue has | |
| * something on it, otherwise we'll wait until something is put on it. | |
| * | |
| * @returns This will return null if the thread wait() call is interrupted. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-antrun-plugin</artifactId> | |
| <executions> | |
| <execution> | |
| <phase>generate-resources</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <assembly> | |
| <id>dist</id> | |
| <formats> | |
| <format>zip</format> | |
| </formats> | |
| <includeBaseDirectory>true</includeBaseDirectory> | |
| <dependencySets> | |
| <dependencySet> |
OlderNewer