Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
@loretoparisi
loretoparisi / gist:2924227
Created June 13, 2012 13:57
Android - BrightRoll Crash
java.lang.NullPointerException
at com.brightroll.androidsdk.AdActivity$3$1.run(AdActivity.java:102)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
@loretoparisi
loretoparisi / gist:2924309
Created June 13, 2012 14:10
Android - Gracenote Crash
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019) Caused by: java.lang.RuntimeException: table does not contain key "clientıd"
at com.gracenote.mmid.MobileSDK.GNAssert.Assert(GNAssert.java:14)
@loretoparisi
loretoparisi / gist:2924535
Created June 13, 2012 14:47
Android - Gracenote Implementation
package com.designfuture.music.ui.fragment;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@loretoparisi
loretoparisi / gist:2998309
Created June 26, 2012 19:37
MoPub Android Interstitial
package com.designfuture.music.util;
import java.util.HashMap;
import java.util.Map;
import android.app.Activity;
import android.widget.FrameLayout;
import com.beintoo.main.Beintoo;
import com.beintoo.main.Beintoo.BGetVgoodListener;
@loretoparisi
loretoparisi / gist:2998316
Created June 26, 2012 19:37
Android MoPub Implementation
package com.designfuture.music.util;
import java.util.HashMap;
import java.util.Map;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@loretoparisi
loretoparisi / gist:4247490
Created December 9, 2012 23:28
Objective-C Unicode Escaping + JSON
/**
* LP: Escape Unicode for json string object
*/
-(NSString*)escapeUnicodeWithString:(NSString*)stringToEscape {
NSError *error;
NSString *escapedString;
escapedString = [stringToEscape JSONStringWithOptions:JKSerializeOptionEscapeUnicode includeQuotes:YES error:&error];
if(error) {
@loretoparisi
loretoparisi / qm-vamp-plugins-ios
Last active December 25, 2015 20:19
Error compiling qm-vamp-plugins for iOS7
macbookproloreto:qm-vamp-plugins loreto$ make -f build/osx/Makefile.osx
c++ -o qm-vamp-plugins.a g2cstubs.o plugins/AdaptiveSpectrogram.o plugins/BarBeatTrack.o plugins/BeatTrack.o plugins/DWT.o plugins/OnsetDetect.o plugins/ChromagramPlugin.o plugins/ConstantQSpectrogram.o plugins/KeyDetect.o plugins/MFCCPlugin.o plugins/SegmenterPlugin.o plugins/SimilarityPlugin.o plugins/TonalChangeDetect.o plugins/Transcription.o libmain.o -L../qm-dsp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch armv7 -lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a -framework Accelerate -lpthread
Undefined symbols for architecture armv7:
"std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:
_VampPlugin::Vamp::RealTime::toString() const in libvamp-sdk.a(RealTime.o)
_VampPlugin::Vamp::RealTime::toText(bool) const in libvamp-sdk.a(RealTime.o)
"std::basic_ios<char, std::char_traits<char> >::widen(char) const"
@loretoparisi
loretoparisi / gist:7092814
Created October 21, 2013 23:47
tnt_array1d_utils.h
/*
*
* Template Numerical Toolkit (TNT)
*
* Mathematical and Computational Sciences Division
* National Institute of Technology,
* Gaithersburg, MD USA
*
*
* This software was developed at the National Institute of Standards and
#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end
@loretoparisi
loretoparisi / gist:c147ca437ab9d5e163b7
Created October 23, 2015 22:01
Using JavaScript and k-means to find the dominant colors in images
<html>
<head>
<!-- adapted from http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/ -->
<script type="text/javascript">
function euclidean(p1, p2) {
var s = 0;
for (var i = 0, l = p1.length; i < l; i++) {
s += Math.pow(p1[i] - p2[i], 2)
}