Permalink
Browse files

adde temfile example and updated giti

  • Loading branch information...
1 parent e869fe0 commit 26fdf42ecad02a5d5b8d2e9eb2c0946d34fb41fb @mitemitreski committed Nov 26, 2012
Showing with 70 additions and 1 deletion.
  1. +4 −0 .gitignore
  2. +19 −0 basics/pom.xml
  3. +41 −0 basics/src/com/mitemitreski/blog/example/tempfile/TempFile.java
  4. +6 −1 libnotify/basic.c
View
@@ -4,3 +4,7 @@
*.jar
*.war
*.ear
+
+# cfiles
+
+*.o
View
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.mitemitreski.blog</groupId>
+ <artifactId>basics</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,41 @@
+package com.mitemitreski.blog.example.tempfile;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+public class TempFile {
+
+ public static void main(String[] args) {
+
+ try {
+ // create a temp file
+ File tempFile = File.createTempFile("old-file", ".tmp");
+ tempFile.deleteOnExit();
+ System.out.println("Temp file : " + tempFile.getAbsolutePath());
+ // nio style
+ final Path path = Files.createTempFile("nio-temp", ".tmp");
+ System.out.println("Temp file : " + path);
+ //call the same delete on exit
+ path.toFile().deleteOnExit();
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
+ try {
+ Files.delete(path);
+ System.out.println("deleted file at "+path);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ } catch (IOException e) {
+ e.printStackTrace();
+
+ }
+
+ }
+
+}
View
@@ -1,6 +1,11 @@
#include <libnotify/notify.h>
+
void main () {
notify_init ("Hello world!");
- NotifyNotification * Hello = notify_notification_new ("Hello world", "This is an example notification.", "dialog-information");
+ NotifyNotification * Hello = notify_notification_new (
+ "Hello world", "This is an example notification.", "dialog-information");
notify_notification_show (Hello, NULL);
+ notify_notification_update (Hello,"novo","nov tekst","dialog-information");
+ notify_notification_show (Hello, NULL);
+
}

0 comments on commit 26fdf42

Please sign in to comment.