HOME - WEBDESIGN / IPHONE APP - ALL IN VAIN - PICTURES - FORUM - DEVELOPEMENT - MYSPACE - TWITTER - YOUTUBE - CATEGORIES - Login/Registration - RSS

Countdown bis zum Greenfield 2011:


PL/SQL script which removes all data from all tables of a database


in Development,Scripts @ 16:00 am 9. September 2011
Comments: 0

I spent quite a bit of time today, because I needed something that removes all data from my oracle 11.0 database. I didn’t want to perform a drop command, as the tables should stay there. I tried it with the truncate command which failed because of the constraints.

This script disables all constraints, performs truncate commands on each table and re-enables the constraints. It’s generic and should work out of the box, that means you don’t have to change anything. Make sure that you run it as database user and not as sys user, otherwise it will fuck up the content of your tables :)

/******************************************************************************
   NAME:        
                clean_stm_database.sql
   PURPOSE:    
                This script first disables all constraints on all tables. In
                the second step, all data is being truncated on all tables.
                Last but not least, all constraints are re-enabled
   INSTRUCTIONS:
                Run this script as database user (e.g. STM_T)
   REVISIONS:
   Ver          Date          Author            Description
   ———    ———-    —————   ——————————-
   1.0.0        09.09.2011    Patrick Breiter   draft version
******************************************************************************/

rem DROP procedure clean_database;
SET serveroutput ON;

CREATE OR REPLACE procedure clean_database
AS
  table_name            varchar2(255);
  enabled_constraint    varchar2(255);
  disabled_constraint   varchar2(255);

BEGIN

  dbms_output.enable(1000000);
 
  – this loop disables all constraints in every table
  FOR c IN
  (SELECT c.owner, c.table_name, c.constraint_name
   FROM user_constraints c, user_tables t
   WHERE c.table_name = t.table_name
   AND c.STATUS = ‘ENABLED’
   ORDER BY c.constraint_type DESC)
  LOOP
    disabled_constraint:=c.constraint_name;
    dbms_utility.exec_ddl_statement(‘alter table ‘ || c.owner || ‘.’ || c.table_name || ‘ disable constraint ‘ || c.constraint_name);
    dbms_output.put_line(‘disabled: ‘ || disabled_constraint);
  END LOOP;

  – this loop truncates all data from every table
  FOR tab IN (SELECT table_name FROM user_tables ORDER BY table_name DESC)
  loop
    table_name:=tab.table_name;
    execute immediate ‘truncate table ‘|| table_name;
    dbms_output.put_line(‘truncated: ‘ || table_name);
  end loop;
 
  – this loop re-enables all constraints on all tables
  FOR c IN
  (SELECT c.owner, c.table_name, c.constraint_name
   FROM user_constraints c, user_tables t
   WHERE c.table_name = t.table_name
   AND c.STATUS = ‘DISABLED’
   ORDER BY c.constraint_type)
  LOOP
    enabled_constraint:=c.constraint_name;
    dbms_utility.exec_ddl_statement(‘alter table ‘ || c.owner || ‘.’ || c.table_name || ‘ enable constraint ‘ || c.constraint_name);
    dbms_output.put_line(‘re-enabled: ‘ || disabled_constraint);
  END LOOP;

END;
/

execute clean_database;

An Twitter senden, Geposted von Pädde


Änderungen seit facts 1.0.0


in Apps,Development,iPhone @ 14:43 am 3. Juni 2011
Comments: 0

Facts 1.3.1:
- Fehlerbehebung: “Next”-Button funktionierte nach Update nicht mehr.

Facts 1.3.0:
+ Zufallsgenerator –> via Einstellungen aktivieren.
+ Wenn Facts wegen ihrer Länge nicht auf Facebook gepostet werden können, wird es angezeigt.
+ Neue Animation, wenn Gerät geschüttelt wird und neuen Fact lädt.

Facts 1.2.0:
+ Suchfunktion für Favoriten
+ Alle Facts können nun in einer eigenen Tabelle gelesen werden. Suche in allen Facts
+ Andere Benachrichtigung, wenn ein Fact entfavorisiert wird in der Detail Ansicht
+ Weitere kleinere Fehlerbehebungen (Angepasste Schriftart beim lesen von Favoriten)
+ 85 neue Facts
+ Drastische Performance Verbesserung
+ Verbessertes Memory Management

Facts 1.1.0:
+ Facebook Integration!
+ Neue Icons!
+ Schüttle dein Gerät, um den nächsten Fact zu laden
+ Volle Retina Display Unterstützung
+ Verkleinertes Installationspacket
+ Neues Start Bild
+ Einige Fehler Behebungen
+ Dialog wird nun länger angezeigt, wenn ein Favorit hinzugefügt oder entfernt wird.
+ Neue Icons, wenn Favoriten hinzugefügt oder entfernt werden.

An Twitter senden, Geposted von Pädde


facts iPhone app


in Allgemeines,Apple,Apps,Bekanntgabe,Code,Development,Review,XCode @ 21:53 am 6. Mai 2011
Comments: 0

So, ich habe eine neue iPhone Applikation am start mit dem Namen “Facts”.

Als ich mit dem iPhone Programmieren begonnen habe, wollte ich eine Applikation erstellen, mit der man Zugriff auf Tausende von Fakten rund ums Leben hat. Ich habe begonnen überall im Internet solche Facts zu suchen und habe bis heute über 2900 zusammen.

Ich werde nun einige Screenshots zeigen und die App kurz erklären:

Der Willkommensscreen sieht wie folgt aus. Die interne Facts Datenbank wird überprüft.

Der Hauptscreen der App sieht so aus. Hier kann man den Fact lesen und mit den Vor- und Zurückknöpfen navigieren. Desweiteren gibt es eine Favoriten Funktion, welche den jetztigen Fact zu den Favoriten legt. Dafür muss man auf den Stern klicken. Wenn der Fact in der Vergangenheit schon einmal gelesen wurde, dann wird das angezeigt. Somit weisst du immer, ob du alte Facts liest, die du schon kennst. Schüttle dein Gerät um zum nächsten Fact zu gelangen.


Klicke hier, um die ganze Review zu lesen.
(weiterlesen…)

An Twitter senden, Geposted von Pädde


how to dismiss keyboard in uitextview


in Allgemeines,Anleitung,Development,How-To,iPhone,Tutorial @ 16:02 am 15. März 2011
Comments: 0

In my iPhone application I had a UITextView and I wanted to allow the user to insert text and submit it. The problem was that the keyboard didn’t disappear when you clicked on return or done. I searched quite a bit and found this working solution:

In your controller .h file:

@interface YourController : UIViewController  {
IBOutlet UITextView *textView;
}

In your controller.m file:

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
NSLog(@"called");
if([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
return NO;
}
return YES;
}

This function gets called every time you insert a character. If you click on Return/Finish/Whatever, the keyboard will be dismissed.
If it doesnt work, open Interface Builder and map your UITextView with the Files owner and assign delegate. Put your comments into the comment section.


An Twitter senden, Geposted von Pädde


sqlite3 umlauts/special character problem


in Anleitung,Computer,Development,How-To,iPhone,Weblog,XCode @ 14:42 am 8. März 2011
Comments: 1

When you are developing an iPhone application, you will most likely have to use an internal database to store your data. I also needed a database for my Facts iPhone application. As the app contains german words, it also contains umlauts and special characters like äöü and all this stuff that is not present in the english language. However, I was not able to support these special characters although I used UTF8 encryption in my application.

To create the database, I used the following commands in terminal:

cd Desktop
mkdir FactsDatabase
cd FactsDatabase
sqlite3 facts.sqlite

Now you will see the sqlite command prompt which only accepts sql commands from now on. This is where I have created my database, and inserted some facts:

// create table
create table facts(id integer primary key, fact text, isFavorite varchar(5), alreadyRead varchar(5));

// fill database with facts
sqlite3 facts.sqlite “INSERT INTO facts(fact, isFavorite, alreadyRead) values(‘Täglich werden 12 Neugeborene den falschen Eltern gegeben.’, ‘no’,'no’);”

Now if you do it like this, the special characters won’t show up in your application. After some hours of trying I tried to use run my sqlite commands in a shell script. I had to rearrange the commands to fit like this:

# drop exising table
sqlite3 facts.sqlite “drop table facts;”

# create database
sqlite3 facts.sqlite “create table facts(id integer primary key, fact text, isFavorite varchar(5), alreadyRead varchar(5));”

# fill database with facts
sqlite3 facts.sqlite “INSERT INTO facts(fact, isFavorite, alreadyRead) values(‘Täglich werden 12 Neugeborene den falschen Eltern gegeben.’, ‘no’,'no’);”

Save it as database.sh and in terminal, give it the rights to execute: chmod+x database.sh, and then run it with ./database.sh
If you do it like this, the special characters are finally in the database and will show up in your application. To be honest, I have no idea why it only works with this workaround. It costed me quite a bit of time. Anyway, hope that helps anyone. If you have questions, use the comment section. Cheers.


An Twitter senden, Geposted von Pädde


all in vain iphone applikation


in Apple,Apps,Bekanntgabe,Code,Computer,Design,Development,iPhone,iPod Touch,XCode @ 13:42 am 26. Februar 2011
Comments: 0

Heute wurde meine 2. iPhone Applikation von Apple frei gegeben. Die Applikation beschäftigt sich mit meiner Band All in Vain. Hier ein kurzer Einblick, was Ihr mit der App so anstellen könnt:

All in Vain ist eine junge, aufstrebende Punkrock/Alternative Band von Luzern (Schweiz). Diese Applikation bietet Zugriff auf alle wichtigen Daten rund um die Band.

Einige der Features im Überblick:

- Alles über All in Vain
- Bandmembers einzeln vorgestellt (Details, Fotos, Equipment, Hobbies, etc).
- Eine Media-Rubrik mit unveröffentlichen Demo Aufnahmen, welche nur mit dieser iPhone App gehört werden können!
- Schau dir Bilder der Band und Ihren Projekten an (inkl. All in Vain Groupie Pics, Demo Session, Rock Night Sursee). Sobald neue Bilder verfügbar sind, werden sie automatisch uf deinem iPhone geladen.
- Normal Display und iPhone 4 Retina Display Support.
- RSS Feed, welcher dir alle Beiträge von www.allinvain.ch auf einen Blick präsentiert. Schüttle dein iPhone oder zieh mit dem Finger über die Tabelle um die Feeds zu aktualisieren.
- Tour/Konzert Übersicht –> somit weisst du immer, wo die nächsten Konzerte stattfinden werden. Nebst Konzertdaten siehst du auf einer Maps Karte direkt, wo sich die Location befindet.
- Direkten Zugriff auf “All in Vain”-Channels wie Facebook, Twitter und Youtube!
- All in Vain Sponsoring Übersicht.
- Ordne die Tab Icons an wie’s dir am Besten passt. Sie können im ‘Mehr’-Menu verändert werden.
- Dank Apples Push Notifications bist du immer auf dem neusten Stand. (Neue Websiten Einträge, neue Tourdaten, Allgemeine Informationen).

Funktionen, die bald kommen werden:
- Werde ein Groupie von der Band oder von einzelnen Mitgliedern.
- Songtexte.

Für diese Applikation braucht es eine Internetverbindung (Bilder, RSS Feeds, Tourdaten, Songs, Verschiedene Channels).

Zum Schluss noch einige Bilder und der Link zur Applikation im iTunes Store:

An Twitter senden, Geposted von Pädde


Xcode Debugger has exited with error code 45


in Anleitung,Computer,Cydia,Development,iPhone,Macbook Pro,XCode @ 16:16 am 14. Februar 2011
Comments: 0

I jailbroke my iPhone some days ago with the GreenPois0n Tool and installed all my stuff. When I was using my iPhone for Developing I found out that the debugger always exited with error status code 45. First I thought it was a problem with my app but then I tried with a non-jailbroken iPhone 3GS and it worked without errors. I debugged the output code and found out that the “PhotoAlbums+” application which gives you the ability to create photo folders crashed all the time. I uninstalled this app from Cydia and now I can continue with development. Just as information if someone has the same problem :)


An Twitter senden, Geposted von Pädde


Adium Soundboard for Cydia


in Allgemeines,Apps,Cydia,Development,iPhone,iPod Touch,News,Repository @ 14:11 am 14. Dezember 2009
Comments: 0

I was searching an Adium Soundboard for my iPhone this weekend but unfortutately I didn’t find one. So I decided to make my own. I just uploaded it to www.modmyi.com

You will find it if you have the source: apt.modmyrepo.com added in Cydia.

logo


An Twitter senden, Geposted von Pädde


PL/SQL: How to convert MD5 from Hex to Base64


in Application Server,Code,Computer,Development @ 13:51 am 16. November 2009
Comments: 0

I was working with JBoss 5.1.0GA and I wanted to activate the JBoss MD5 Authentication. The passwords were stored as HEX 16Byte long (32 Hex Characters). When you have a look at the official JBoss User Manual (Chapter 9) you will see that they are using Base64-Encoding. So we had to come up with a short PL/SQL-script to convert the passwords to Base64!

Simply create a PL-SQL Script and add the following code:

[codesyntax lang="plsql"]

set sqlblanklines on;

set serveroutput on;

DECLARE

BEGIN

//read password field as hex-encoded raw data and convert data using base64 encoding

update users set password=utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(utl_raw.cast_to_varchar2(password))));

END;

[/codesyntax]

Additionally, if you have a unix or linux machine, you can check it in command line:

$ echo -n “j2ee” | openssl dgst -md5 -binary | openssl base64 glcikLhvxq1BwPBZN0EGMQ==

An Twitter senden, Geposted von Pädde


Java: How to get MD5 hash from password string


in Application Server,Code,Development @ 09:31 am
Comments: 0

Recently I had the problem that I had to convert a normal password string to a MD5 Password String which is Base64-Encoded. I found a lot of results but they just worked on JBoss 4.2, so I changed it and now it will also run on JBoss 5.1.0GA::

[codesyntax lang="java" strict="yes"]
package com.sicap.ssis2.servlets;
import java.security.MessageDigest;

/**
* @author doonot
*
*/
public class MD5HashGenerator {

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String password = “testpassword”;
MessageDigest md = null;
try
{
md = MessageDigest.getInstance(“MD5″);
}
catch(Exception e)
{
e.printStackTrace();
}

byte[] passwordBytes = password.getBytes();
byte[] hash = md.digest(passwordBytes);
System.out.println(getHexString(hash));
String passwordHash = org.jboss.security.Base64Encoder.encode(hash);

System.out.println(“password hash: “+ passwordHash);
}

/**
* This method returns the hex string from the password byte array
* @param b Byte[]
* @return string hex password string
* @throws Exception
*/
public static String getHexString(byte[] b) throws Exception {
String result = “”;
for (int i=0; i < b.length; i++) {
result +=
Integer.toString( ( b[i] & 0xff ) + 0×100, 16).substring( 1 );
}
return result;
}
}

[/codesyntax]

Leave a short comment if you think that was usefull! Best regards!

An Twitter senden, Geposted von Pädde


Nächste Seite »