Skip to content

Instantly share code, notes, and snippets.

View veb's full-sized avatar
👋

Mike Mackenzie veb

👋
View GitHub Profile
@veb
veb / HashTagEnry.java
Created June 29, 2014 02:36
tagggin'
import com.orm.SugarRecord;
/**
* Created by mike on 29/06/14.
*/
public class HashTagEnry extends SugarRecord<JournalEntry> {
String tag;
JournalEntry entry;
public HashTagEnry() {
package com.omnibuttie.therable.model;
import com.orm.SugarRecord;
/**
* Created by mike on 29/06/14.
*/
public class HashTagEntry extends SugarRecord<JournalEntry> {
String tag;
JournalEntry entry;
public void doPost() {
Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b");
Matcher m = tagMatcher.matcher(sourcetext);
List<String> tokens = new ArrayList<String>();
while(m.find()) {
String token = m.group();
tokens.add(token);
}
public void doPost() {
// get hashtags and return into tokens
Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b");
Matcher m = tagMatcher.matcher(statusText.getText().toString());
List<String> tokens = new ArrayList<String>();
while(m.find()) {
String token = m.group();
tokens.add(token);
}
06-29 17:22:08.069 19637-19653/com.omnibuttie.therable D/SQL Log﹕ SQLiteQuery: SELECT * FROM JOURNAL_ENTRY WHERE is_archived = ? ORDER BY date_modified desc
06-29 17:22:09.439 19637-19637/com.omnibuttie.therable W/Bundle﹕ Key JournalID expected Long but value was a java.lang.Integer. The default value -1 was returned.
06-29 17:22:09.439 19637-19637/com.omnibuttie.therable W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at android.os.Bundle.getLong(Bundle.java:1034)
at android.content.Intent.getLongExtra(Intent.java:4575)
at com.omnibuttie.therable.views.Composer.onCreate(Composer.java:59)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
for (int i = 0; i < tokens.size(); i++) {
HashTagEntry hashtagEntry = new HashTagEntry();
hashtagEntry.setTag(tokens.get(i));
hashtagEntry.setEntry(journalEntry);
hashtagEntry.save();
}
06-29 18:25:14.149 21815-21815/com.omnibuttie.therable W/Bundle﹕ Key JournalID expected Long but value was a java.lang.Integer. The default value -1 was returned.
06-29 18:25:14.159 21815-21815/com.omnibuttie.therable W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at android.os.Bundle.getLong(Bundle.java:1034)
at android.content.Intent.getLongExtra(Intent.java:4575)
at com.omnibuttie.therable.views.Composer.onCreate(Composer.java:59)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
07-02 20:11:20.701 12412-12462/com.omnibuttie.therable E/CursorWindow﹕ Failed to read row 0, column -1 from a CursorWindow which has 2 rows, 7 columns.
07-02 20:11:20.711 12412-12462/com.omnibuttie.therable E/CursorWindow﹕ Failed to read row 1, column -1 from a CursorWindow which has 2 rows, 7 columns.
07-02 20:11:25.441 12412-12412/com.omnibuttie.therable D/SQL Log﹕ SQLiteQuery: SELECT * FROM JOURNAL_ENTRY WHERE id=? LIMIT 1
07-02 20:11:25.451 12412-12412/com.omnibuttie.therable E/CursorWindow﹕ Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 7 columns.
07-02 20:11:25.491 12412-12412/com.omnibuttie.therable D/dalvikvm﹕ GC_FOR_ALLOC freed 32K, 1% free 22713K/22780K, paused 13ms, total 14ms
07-02 20:11:25.491 12412-12412/com.omnibuttie.therable I/dalvikvm-heap﹕ Grow heap (frag case) to 24.699MB for 2609296-byte allocation
07-02 20:11:25.511 12412-12421/com.omnibuttie.therable D/dalvikvm﹕ GC_FOR_ALLOC freed 2K, 1% free 25259K/25332K, paused 21ms, total 21ms
07-02 20:11:25.641 12412-
@veb
veb / CustomViewPager.java
Created July 2, 2014 09:31
lie detect0r?!
private View.OnTouchListener mGestureListener;
private GestureDetector mGestureDetector;
public CustomViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
mGestureDetector = new GestureDetector(context, new Detector());
}
@veb
veb / vhosts.php
Created August 22, 2014 09:56
apache vhost php
<?php
$path = $_SERVER['SCRIPT_FILENAME'];
$path = explode('/', $path);
$path = "/{$path[1]}/{$path[2]}/{$path[3]}/{$path[4]}/{$path[5]}";
$_SERVER['DOCUMENT_ROOT'] = $path;
?>