Skip to content

Instantly share code, notes, and snippets.

@rnewman
rnewman / gist:2305471
Created April 4, 2012 20:46
Start of a query
PSEUDOCODE! Need to join the subquery to get the values available for the update.
UPDATE history SET visits = total
modified = latest
deleted = (modified <> latest)
WHERE uri IN (
SELECT uri, count(uri), SUM(visits) AS total, MAX(modified) AS latest
GROUP BY uri
HAVING count(uri) > 1
04-12 10:19:27.010: I/DEBUG(222): pid: 2441, tid: 2446 >>> org.mozilla.gecko.PasswordsProvider <<<
04-12 10:19:32.440: W/SynchronizerSession(2388): at org.mozilla.gecko.sync.repositories.android.PasswordsRepositorySession.insert(PasswordsRepositorySession.java:448)
04-12 10:19:32.440: W/SynchronizerSession(2388): at org.mozilla.gecko.sync.repositories.android.PasswordsRepositorySession$5.run(PasswordsRepositorySession.java:342)
04-12 10:19:32.440: I/ActivityManager(289): Process org.mozilla.gecko.PasswordsProvider (pid 2441) has died.
04-12 10:19:32.440: I/ActivityManager(289): Kill org.mozilla.fennec (pid 2388): provider org.mozilla.fennec.db.PasswordsProvider in dying process org.mozilla.gecko.PasswordsProvider
04-12 10:20:27.470: I/GlobalSession(2471): Running next stage syncPasswords (org.mozilla.gecko.sync.stage.PasswordsServerSyncStage@4083b9a0)...
04-12 10:20:27.490: I/ActivityManager(289): Start proc org.mozilla.gecko.PasswordsProvider for content provider org.mozilla.fennec/.db.Passwor
@rnewman
rnewman / gist:2502283
Created April 26, 2012 19:24
debug log
1335468157493 Sync.Engine.Tabs INFO Uploading all of 1 records
1335468157493 Sync.Collection DEBUG POST Length: 26980
1335468157630 Sync.Collection DEBUG mesg: POST fail 400 https://phx-sync542.services.mozilla.com/1.1/holygoat/storage/tabs
1335468157630 Sync.Collection DEBUG POST fail 400 https://phx-sync542.services.mozilla.com/1.1/holygoat/storage/tabs
1335468157630 Sync.Engine.Tabs DEBUG Uploading records failed: <h2>Client sent a bad request.</h2>
1335468157630 Sync.SyncScheduler TRACE Handling weave:engine:sync:error
1335468157630 Sync.ErrorHandler TRACE Handling weave:engine:sync:error
1335468157631 Sync.Status DEBUG Status for engine tabs: error.engine.reason.record_upload_fail
1335468157631 Sync.Status DEBUG Status.service: success.status_ok => error.sync.failed_partial
@rnewman
rnewman / each-commit
Created June 14, 2013 19:58
Dump an individual git commit.
REPO=~/moz/hg/mozilla-inbound
COMMIT=$1
echo "Processing commit $COMMIT into repo $REPO..."
SUMMARY=$(git show --format="%s" $COMMIT | head -n 1)
FILENAME=$(echo "$SUMMARY" | cut -c 1-24 | sed 's/[^_A-Za-z0-9]/-/g' | tr [A-Z] [a-z])
echo "Summary is \"$SUMMARY\"..."
echo "Filename is \"$FILENAME\"..."
git hgshow $COMMIT | sed 's,src/main/java/org/mozilla/gecko/sync/,mobile/android/base/sync/,g' | sed 's,twinql\.com,mozilla.com,' | hg -R $REPO qimport -g -P -n $FILENAME -
@rnewman
rnewman / coast
Created September 25, 2013 03:56
Notes on Coast
* Swipe vs tap on home screen doesn't work well. Took three tries to tap Reddit.
* No feedback on loading speed. Sluggish.
* Minimal feedback. In the seven tries tapping on the link I wanted, it registered a click on the item above. I didn't know until that page loaded. You do get a grey outline when you successfully tap a link, but not when you fail. *Something* is different versus other browsers...
* Swipe-for-back kinda collides with pinch-to-zoom-out if you have a light touch. This is really annoying.
* It covers the previous page with pinstripes when loading 'back'. It's really annoying. In fact, the whole browsing experience feels like a clunky browser trying to be smooth.
* imgur captures swipes! That sucks a lot when your only controls are swipes. You can only 'escape' by accidentally opening the "Back stack" view. I still don't know how this works.
* You can view URLs, safety, info, etc by swiping down from a page in the "Back stack".
* Coast really suffers from lack of intents.
@rnewman
rnewman / gist:11016925
Created April 17, 2014 23:24
locales.sh
pushd objdir-droid/mobile/android/locales && \
for loc in $(cat ../../../../mobile/android/locales/maemo-locales); do LOCALE_MERGEDIR=$PWD/merge-$loc make merge-$loc LOCALE_MERGEDIR=$PWD/merge-$loc; make LOCALE_MERGEDIR=$PWD/merge-$loc chrome-$loc LOCALE_MERGEDIR=$PWD/merge-$loc; done && \
popd
@rnewman
rnewman / gist:11016959
Created April 17, 2014 23:24
.mozconfig
ac_add_options --with-android-ndk="/Users/rnewman/moz/android/android-ndk-r8e"
# Android options
ac_add_options --enable-application=mobile/android
ac_add_options --with-android-ndk="/Users/rnewman/moz/android/android-ndk-r8e"
ac_add_options --with-android-sdk="/Users/rnewman/moz/android/android-sdk-macosx/platforms/android-17"
ac_add_options --with-android-version=9
ac_add_options --with-android-tools="/Users/rnewman/moz/android/android-sdk-macosx/tools"
# ARM
private void expectNoPermits(String method) {
final int availablePermits = writeLock.availablePermits();
if (availablePermits != 0) {
throw new RuntimeException(method + " has " + availablePermits + " permits. Expected 0.");
}
}
private boolean setMostRecentlyUsedWithinRead(FaviconCacheElement element) {
expectNoPermits("setMostRecentlyUsedWithinRead");
04-24 18:17:02.890 I/FaviconCache( 3960): Starting read.
04-24 18:17:02.890 I/FaviconCache( 3960): Read: after turn semaphore.
04-24 18:17:02.890 I/FaviconCache( 3960): Acquiring write lock.
04-24 18:17:02.890 W/FaviconCache( 3960): Cannot compute dominant color of non-cached favicon. Cache fullness 83968/524288
04-24 18:17:02.890 I/FaviconCache( 3960): finishRead.
04-24 18:17:02.890 I/FaviconCache( 3960): finishRead... releasing.
04-24 18:17:02.900 I/FaviconCache( 3960): releasing.
04-24 18:17:02.900 I/FaviconCache( 3960): java.lang.RuntimeException: stack
04-24 18:17:02.900 I/FaviconCache( 3960): at org.mozilla.gecko.favicons.cache.FaviconCache.releaseWriteLock(FaviconCache.java:482)
04-24 18:17:02.900 I/FaviconCache( 3960): at org.mozilla.gecko.favicons.cache.FaviconCache.finishRead(FaviconCache.java:173)
@rnewman
rnewman / gist:11298776
Created April 25, 2014 18:26
Spot the bug
public int getDominantColor(String key) {
startRead();
try {
FaviconsForURL element = permanentBackingMap.get(key);
if (element == null) {
element = backingMap.get(key);
}
if (element == null) {