Skip to content

Instantly share code, notes, and snippets.

@inog
inog / delete_local_branches.sh
Last active May 14, 2021 11:42
delete local branches
//garbage collector
git gc
// alle remotes die keinen verbindung mehr zum server haben
git remote prune origin -n
// alle branches die nicht gemergt sind und nicht master|develop|\* heißen löschen
git branch | egrep -v "(master|develop|\*)"| xargs git branch -d
@inog
inog / replaceLineFeedCharacter.sql
Created May 2, 2018 08:04
find and replace linefeed character in DB2 Database
-- find all Line Feed Characters \u000A, chr(10), chr(13)
select * from verkauf.faserbc
where fbaun1=5620
and
( instr(FBTEXT, chr(10)) > 0
or
instr(FBTEXT, chr(13)) > 0
)
;
@inog
inog / roundUp.java
Created April 10, 2018 07:17
divide 2 ints and always round up the result
public static int roundUp(int dividend, int divisor) {
return (dividend + divisor - 1) / divisor;
}
@inog
inog / FiberBarcodePDF.java
Created March 29, 2018 15:04
Play with pdfbox
package com.mathai.pdf;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.pdmodel.PDDocument;
@inog
inog / nextField.js
Last active March 22, 2018 09:18
focus next input when maxlength is reached
var a = document.getElementById('form:tabView:kan1'),
b = document.getElementById('form:tabView:kan2'),
c = document.getElementById('form:tabView:jahr');
a.onkeyup = function() {
if (this.value.length === parseInt(this.attributes["maxlength"].value)) {
b.focus();
}
}
@inog
inog / JavaTimeToDate.java
Last active February 16, 2018 09:23
Date to LocalDateTime and vise versa
package date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
public class JavaTimeToDate {
public static void main(String[] args) {
@inog
inog / JavaTimeToDate.java
Created February 16, 2018 09:21
Date to LocalDateTime
package date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
public class JavaTimeToDate { public static void main(String[] args)
{
@inog
inog / selectcreated_plus_6_month.sql
Last active December 7, 2017 13:47
select year and month from an datefield added 6 month
SELECT kakan1,kakan2, kavjah, kavmon, kaerft, add_months(kaerft,6) addMonth,
YEAR(kaerft) created_Y, Month(kaerft) created_M ,
YEAR(add_months(kaerft,6)) newYear, Month(add_months(kaerft,6)) newMonth
FROM verkauf.kalkN
order by kaerft DESC;
package streams;
import java.util.Arrays;
import java.util.List;
public class Java8Filter {
private static List<kabnr> kabnrs = Arrays.asList(
new kabnr(1234,0,2017, "1234"),
new kabnr(1234,0,2017, "1590"),
@inog
inog / requiredMessage.xhtml
Last active March 23, 2017 08:15
Primeface requiredMessage in a Dialog. Keep in Mind the own <h:form> Tag
<h:form>
<p:commandButton value="open dialog" id="btncallWidget" process="@this" oncomplete="PF('editDlg').show()"/>
</h:form>
<p:dialog id="editDialog" header="Dialog" widgetVar="editDlg" modal="true" appendToBody="true">
<p:tooltip />
<h:form>
<p:growl id="growl" showDetail="true" sticky="false" />
<h:panelGrid id="grid" cellpadding="5" columns="3" style="margin-bottom:10px">
<f:facet name="header">