Skip to content

Instantly share code, notes, and snippets.

View TheKojuEffect's full-sized avatar

Kapil Koju TheKojuEffect

View GitHub Profile
@TheKojuEffect
TheKojuEffect / ZioDoobieConfig.scala
Last active November 23, 2022 18:28
Configuring Scala 3, ZIO 2, and Doobie
//> using scala "3.2.0"
//> using lib "dev.zio::zio:2.0.2"
//> using lib "dev.zio::zio-interop-cats:3.3.0"
//> using lib "org.tpolecat::doobie-core:1.0.0-RC2"
//> using lib "org.tpolecat::doobie-hikari:1.0.0-RC2"
import zio.*
import zio.interop.catz.*
import doobie.util.transactor.Transactor
@TheKojuEffect
TheKojuEffect / postgresql_base58.sql
Last active January 14, 2016 06:07 — forked from micahwalter/base58.sql
base58.sql
CREATE FUNCTION base58_encode(num INT)
RETURNS VARCHAR(255) AS $encoded$
DECLARE
alphabet VARCHAR(255);
base_count INT DEFAULT 0;
encoded VARCHAR(255);
divisor DECIMAL(10, 4);
mod INT DEFAULT 0;
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@TheKojuEffect
TheKojuEffect / StringToChar.java
Created September 26, 2013 14:56
Convert String array to 2D char array.
public class StringToChar {
public static void main(String[] args) {
String[] strArr = { "HELLO", "WORLD" };
char[][] char2D = new char[strArr.length][];
for (int i = 0; i < strArr.length; i++) {
char2D[i] = strArr[i].toCharArray();
}
for (char[] char1D : char2D) {
@TheKojuEffect
TheKojuEffect / stdbool.h
Last active December 23, 2015 17:29
stdbool.h
/* Copyright (C) 1998, 1999, 2000, 2009 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
@TheKojuEffect
TheKojuEffect / Detached Entity Passed to Persist Exception
Last active December 20, 2015 16:58
Detached entity passed to persist exception
Exception in thread "AWT-EventQueue-0" org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist: devopsdistilled.operp.server.data.entity.items.Brand; nested exception is org.hibernate.PersistentObjectException: detached entity passed to persist: devopsdistilled.operp.server.data.entity.items.Brand
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:668)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvoca
@TheKojuEffect
TheKojuEffect / LazyInitializationException.
Last active December 20, 2015 14:38
Stack Trace when double click on a Product in Product List
Exception in thread "AWT-EventQueue-0" org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: devopsdistilled.operp.server.data.entity.items.Product.categories, could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:566)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:186)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:545)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:124)
at org.hibernate.collection.internal.PersistentBag.toArray(PersistentBag.java:274)
at java.util.Vector.<init>(Vector.java:167)
at devopsdistilled.operp.client.items.panes.details.ProductDetailsPane.show(ProductDetailsPane.java:110)
at devopsdistilled.operp.client.items.panes.Lis
@TheKojuEffect
TheKojuEffect / UpdateCategoryStackTrace
Last active February 15, 2018 16:48
Stacktrace when trying to "Edit >> Update" an existing Category
Exception in thread "AWT-EventQueue-0" org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:522)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveM
@TheKojuEffect
TheKojuEffect / Eclipse Juno Startup error
Created March 14, 2013 05:05
Eclipse Juno can't start after update.
!SESSION 2013-03-14 10:45:43.362 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.7.0_15
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.equinox.ds 4 0 2013-03-14 10:45:44.307
!MESSAGE [SCR] Exception while activating instance org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngineManager@28fed5b1 of component org.eclipse.e4.ui.css.swt.theme
!STACK 0
@TheKojuEffect
TheKojuEffect / eclipseAutoCloseError.log
Last active December 13, 2015 23:59
.log file for eclipse automatic close
!SESSION 2013-02-20 05:08:05.299 -----------------------------------------------
eclipse.buildId=M20120914-1800
java.version=1.7.0_13
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64 -clean
This is a continuation of log file /home/kpl/Public/Workspace/.metadata/.bak_0.log
Created Time: 2013-02-20 05:19:44.007