tag:blogger.com,1999:blog-91706984940731038272024-03-14T02:15:16.395-04:00Not Quite Zerotechnology, software development, stuff that i own, and an occasional political rant ... java, c, linux, random processes, control theory, netbeans, lenovo x60, freedomSeth Lytlehttp://www.blogger.com/profile/11703082246910662055noreply@blogger.comBlogger77125tag:blogger.com,1999:blog-9170698494073103827.post-9342603780824374292023-05-12T17:43:00.000-04:002023-05-12T17:43:01.897-04:00light mode bookmarklet
<blockquote>javascript:{ c = document.querySelectorAll("*"); for (var ii=0; ii < c.length; ii++) { var s = c[ii].style; s.background = "ivory"; s.setProperty('color', "black", 'important'); } console.log(); }</blockquote>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-73953903309142365112020-03-13T23:49:00.002-04:002020-03-13T23:49:59.961-04:00Deleting GNOME's hidden keyboard shortcutshttps://gitlab.gnome.org/GNOME/gnome-shell/issues/1250
<p>
tl;dr - gnome has shortcuts that are installed by default and not visible in the control center. if setting a shortcut doesn't produce the desired result, it's likely that a hidden shortcut already exists and gnome is ignoring your "redundant" one. which is terrible UI design, but that's another story
<p>
to fix the problem, do something like:
<code>
gsettings list-recursively | grep "\['<Super>6'\]" |
while read schema key line; do gsettings set $schema $key "[]"; done
</code>
leaving this here mostly as a note to myself for the next time i run into this
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-86670134909909178262019-04-01T23:01:00.000-04:002019-04-01T23:01:11.572-04:00LibreOffice unable to select "English (USA)" - spellcheck not workingi was unable to use the spell checker in libreoffice 5.1.6.2 (and the problem appears intermittently with many versions). i'm using ubuntu 16.04, but the issue appears to be common on fedora and other ubuntu versions as well<br />
<br />
not sure how common this bug is, but it's tough to track down so documenting it here<br />
<br />
symptom:<br />
<br />
<ul>
<li>spell check fails to find any problems</li>
<li>"Text Language" shows as "None"</li>
<li>sometimes other options can be selected, but they don't work and it falls back to "None"</li>
<li>clicking Style -> Edit Style -> Font -> Language, "English (USA)" is shown as an option, but it doesn't have an "ABC check" icon to the left</li>
</ul>
<br />
the fix:<br />
<br />
<ul>
<li>make sure hunspell-en-us is installed (that's the ubuntu package name)</li>
<li>Settings -> Options -> Language Settings -> Writing Aids</li>
<li>"Hunspell SpellChecker" shows up as ticked</li>
<li>click Edit</li>
<li>"Hunspell SpellChecker" shows as not ticked</li>
<li>tick it</li>
<li>spelling works</li>
</ul>
<br />
<br />
<br />
in short, the UI appears to get confused and believes a tool is activated, but clicking edit forces it to reload the true state and you can actually activate it<br />
<br />
good luck<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-15230335391233277282018-06-23T19:08:00.003-04:002018-06-23T19:08:50.957-04:00SimpleSSHD with android in 2018i used <a href="https://play.google.com/store/apps/details?id=org.galexander.sshd&hl=en_US">SimpleSSHD</a> for a couple of years to ssh from my desktop to my phone and copy pics and such back and forth
it stopped working at some point (maybe last year), presumably due to an android update, and i finally tracked the issue down<br />
<br />
find the IP and MAC addresses for the phone, and on the desktop run:<br />
<br />
<ul>
<li>arp -s 192.168.xx.xx yy:yy:yy:yy</li>
</ul>
<div>
after that, ping and ssh should work again. <a href="https://superuser.com/questions/1097944/cant-ping-my-android-device-in-the-same-network">my understanding </a>is that an android update started blocking arp requests, so when the desktop tries to connect to the phone, it can't convert the ip address to a mac address and gives up</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-75023281039304564092018-03-05T11:33:00.000-05:002018-03-05T11:45:27.970-05:00list locally installed maven dependenciesi posted the following question to <a href="https://stackoverflow.com/questions/48997624/list-locally-installed-maven-dependencies">stack overflow</a>, but the <a href="https://news.ycombinator.com/item?id=9062758">Close-Vote-Ring</a> tends to delete "niche" questions like this so i'm posting it here as well:
<blockquote>
on my development machine i'm actively working on perhaps 20 inter-dependent maven projects, most of which get published to ossrh from time to time, and i also depend on many other projects from maven central
i'd like to list the dependencies that have been installed locally as opposed to those that have been downloaded from a repository. i'm aware that mvn -U will check remote repositories for snapshot dependencies, but in many cases my versions aren't -SNAPSHOT
is there a way to tell which dependencies have been installed locally ?
</blockquote>
user <a href="https://stackoverflow.com/users/927493/jf-meier">JF Meier</a> made the critical observation in a <a href="https://stackoverflow.com/questions/48997624/list-locally-installed-maven-dependencies?noredirect=1#comment85020893_48997624">comment</a> that there's a <b>_remote.repositories</b> file in the local repository. based on this, i came up with the following:
<blockquote>versions=$(mvn dependency:list -DoutputAbsoluteArtifactFilename -DoutputFile=/dev/fd/2 2>&1 1>/dev/null | grep -o "/.*/" | xargs -Ixxx grep -L "jar>central=$" xxx_remote.repositories) | grep -o ".*/"
</blockquote>
and then i use that to copy the local artifacts to a remote machine for testing:
<code>
rsync -aRvO $versions example.com:/
</code>
caveat emptor - the file format isn't a public api and includes the following
<blockquote>#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
</blockquote>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-74148015495767665102018-01-30T15:54:00.001-05:002018-01-30T15:54:22.412-05:00load a java class with a different parent classloaderin the process of debugging issues with an incorrect classpath for the compiler api when run inside maven, i wanted to be able to create a duplicate instance of an existing object (that had been produced by a factory) by loading the class using a custom classloader with a different parent. it didn't fix the classpath problem, so i also tried loading directly by the path that i found, to no greater success
my solution is somewhere between kludgy and elegant, so i wanted to publish it in case some other sucker goes down a similar road less traveled (and it doesn't deserve it's own repository), so here it is:
<code>
public static void demoJailbreak() throws Exception {
ClassLoader parent = Thread.currentThread().getContextClassLoader();
String jre = System.getProperty("java.home");
String jdk = jre.endsWith("/jre") ? jre.substring(0,jre.length()-3) : jre;
JavaCompiler broken, byPath=null, compiler;
try {
byPath = (JavaCompiler) loadByPath(
"com.sun.tools.javac.api.JavacTool",
"file:" + jdk + "lib/tools.jar",
parent
);
}
catch (Exception ex) {}
compiler = ToolProvider.getSystemJavaCompiler();
broken = (JavaCompiler) jailbreak(compiler.getClass(),parent);
System.out.println("jailbreak : " + broken);
System.out.println("loadByPath: " + byPath);
}
/**
* create a new instance of a class
* using a new url classloader with a specified parent
* and the same resource path as the original class instance
*/
public static Object jailbreak(Class klass,ClassLoader parent) throws Exception {
String cname = klass.getName();
String path = getPathForClass(cname,klass.getClassLoader());
Object dup = loadByPath(cname,path,parent);
return dup;
}
/** return the path at which an original classloader finds a class at */
public static String getPathForClass(String cname,ClassLoader orig)
throws Exception {
String rname = cname.replace(".","/") + ".class";
java.net.URL url = orig.getResource(rname);
String full = url.getPath();
// need to split the jar url on an exclamation mark per:
// https://docs.oracle.com/javase/7/docs/api/java/net/JarURLConnection.html
String path = full.split("!",0)[0];
return path;
}
/**
* create a new instance of a class by name
* from a new classloader using a file:/path/to/jar style path
* and the designated parent
*/
public static Object loadByPath(String cname,String path,ClassLoader parent)
throws Exception {
java.net.URL url2 = new java.net.URL(path);
java.net.URL [] urls = new java.net.URL [] {url2};
ClassLoader cl = new java.net.URLClassLoader(urls,parent);
Class klass = cl.loadClass(cname);
return klass.newInstance();
}
</code>
all static methods, no maven dependencies and shouldn't require importing anything, so cut and paste should work. note: this example will only work if you have a jdk installed (the compiler isn't in the jre), and the byPath version will only work if the jre path is "jdk_path/jre". that said, the jailbreak and loadByPath will work fine anywhere
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-72011882636087487492018-01-25T18:10:00.000-05:002018-01-25T18:10:44.683-05:00Integrating Spring with a legacy appSpring is a behemoth and doesn't play well with others, preferring to take over all aspects of an application - inversion of control gone wild. The best bet is to avoid it entirely, but if you're stuck with Spring for whatever reason, and want to implement something non-trivial, you're likely to need to integrate it with non-spring POJO objects - what the Spring fan-persons call "Legacy Applications"<br />
<br />
To inject a non-spring POJO into a Spring Boot application:<br />
<br />
<ul>
<li>create an <b>ApplicationListener</b></li>
<li>in the listener call <b>registerSingleton</b> with the non-spring object</li>
<li>register the listener with the app</li>
</ul>
<br />
this allows the field to be initialized early during the application lifecycle
<br />
<code>
@RestController
@SpringBootApplication
public class SpringLegacy {
public SpringLegacy() {}
@Lazy
@Autowired
@Qualifier("legacyBean")
Object myBean;
@RequestMapping("/dir")
public Object dir() {
return "hello world " + myBean;
}
static class LegacyObject {}
public static void main(final String[] args) throws Exception {
Object obj = new LegacyObject();
SpringApplication app = new SpringApplication(SpringLegacy.class);
ApplicationListener<ApplicationContextEvent> lis = new ApplicationListener() {
boolean first = true;
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (first & event instanceof ContextRefreshedEvent) {
((GenericApplicationContext) (((ContextRefreshedEvent) event).getApplicationContext())).
getBeanFactory().registerSingleton("legacyBean", obj);
first = false;
}
}
};
app.setListeners(Arrays.asList(lis));
app.run(args);
}
}
</code>
<br />
full source is <a href="https://github.com/nqzero/spring-legacy">https://github.com/nqzero/spring-legacy</a>
<br />
run the maven project, and then browse to <a href="http://localhost:8080/dir">localhost:8080/dir</a> - you should see "LegacyObject" in the output
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-9170698494073103827.post-78602980158611943852017-11-16T14:48:00.003-05:002017-11-16T14:48:45.300-05:00java reverse proxy for websocketsthis is easy to do with node:<br />
https://github.com/nodejitsu/node-http-proxy<br />
<br />
but with java it's proven much more difficult to find. just found this:<br />
https://github.com/barrett-rob/java-websocket-reverse-proxy<br />
<br />
<br />
haven't tried it, but looks like it will work<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-49169402203716084332016-02-13T00:40:00.000-05:002016-02-13T18:48:14.233-05:00save bash history remotely by sending a signal to all interactive bashmy bash history is an important resource and the primary way i record how i've solved problems. i use a unique file for each machine and store them in version control periodically<br />
<br />
a problem that i run into every few months is i've solved a problem on one machine, but haven't yet exited from the shell so the solution is not stored in the history file yet. and i'm at a remote location, so i can't run "history -a"<br />
<br />
<h3>
solution</h3>
<br />
add the following to .bashrc<br />
<br />
<br />
<code>
# safely append the bash history
function .save_hist {
exec 200<${HISTFILE}
if flock -w 5 200; then
history -a
flock -u 200
echo "SIGHUP received, history file saved"
else
echo "SIGHUP received, but lock failed, history not saved"
fi
exec 200<&-
}
trap '.save_hist' HUP
# signal all bashes
function save_hist {
# not no tty and user and bash
(ps h -o pid -Nt - | sed "s/ //g"; pgrep -u "$USER" bash) | sort | uniq -d | xargs kill -HUP
}
</code>
<br />
to use it, ssh into the machine and run "save_hist"
<br />
Note: this is semi untested and has the potential to kill background process (the ps arguments aren't documented perfectly). but it appears to work
<br />
Note: *all* shells to have been started since the bashrc change to work
<h3>how it works</h3>
i wanted to use SIGUSR1, but bash doesn't appear to trap that signal until the user presses enter. which defeats the purpose. SIGHUP isn't really intuitive, but it is used by some daemons to reload their config file, which is somewhat along the same lines. and afaict, interactive bash doesn't use SIGHUP for anything. i'm open to other suggestions
<p>
trap is used to catch the HUP signal and then run "history -a". i use flock since it's not clear that bash handles simultaneous saves safely, and i routinely have dozens of bash tabs open.
</p>
<p>
you can use kill directly to send the signal, but i wanted to be able to save all the active interactive shells. i couldn't find an easy way to list them, so i came up with listing everything with a tty, combining that list with the users bash instances, filtering for only duplicates, and passing those PIDs to kill. it seems to work
</p>
good luck, and let me know if you have any problems
<h3>alternatives</h3>
i posted this on [/r/bash](https://www.reddit.com/r/bash/) and got downvoted as usual. but [lihaarp](https://www.reddit.com/user/lihaarp) pointed out that you can set PROMPT_COMMAND. this saves the history after every command. i prefer my approach as it saves each bash instance in order, but it does mean you risk losing history if the computer crashes. ymmv
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-49944020106790615232016-01-31T15:10:00.002-05:002016-02-17T17:37:10.637-05:00vertical inches matter - 16:10 or better (3:2, 4:3) laptops, ie "real laptops" or "business laptops"<div class="separator" style="clear: both; text-align: center;">
<img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA5Lvqkf37OfaYVmKZve3l62L3I41g9ynKJI4uotGTG7vbs3tmo4FrP3uIU2wfZUePq-wG4zCxZdvp54MG9bgJSLthpw_t5sSRZbU-XAxkGyMAnm76GpUuYGE7U9389yqG6imzHzrZeYc/s320/vertical.png" width="261" /><span id="goog_1421097883"></span><span id="goog_1421097884"></span><a href="https://www.blogger.com/"></a></div>
<br />
<br />
business laptops are generally pretty solid - tons of options for cpu, pixel density, memory, storage, graphics. but there's very little choice when it comes to aspect ratio - the vast majority of laptops for sale today (jan 2016) are 16:9. this translates to very short screens that are great for watching movies, but just aren't useful for doing real work. in the hopes of encouraging sales, and hence production, of real business laptops, i'm going to maintain a list
<br />
<br />
<br />
<ul>
<li><a href="http://store.hp.com/us/en/ContentView?storeId=10151&langId=-1&catalogId=10051&eSpotName=new-detachable">HP spectre x2</a> - windows 10 convertible, 3:2, 12", core m, $800 (m5 6y54, 8gb, $950)</li>
<li><a href="http://www.techradar.com/us/reviews/pc-mac/laptops-portable-pcs/lenovo-ideapad-miix-700-1303141/review">Lenovo miix 700</a> - $750, m3-6y30, 4GB ram, 64GB ssd, 12", 3:2</li>
<li>ipad pro - 4:3, 12.9", A9X cpu, 32GB, $800</li>
<li>macbook pro 13 retina - $1300, 13.3", 16:10, i5, 8GB ram, 128GB ssd ($1100 non-retina)</li>
<li>macbook air 13 - $1000</li>
<li>surface pro 4 - $900, 12", 3:2 aspect ratio</li>
<li>surface book - 13.5", 3:2, $1500</li>
<li><a href="https://www.google.com/chromebook/pixel/">chromebook pixel</a> - 3:2, 13", i5, 8GB ram, 32GB SSD, $1000 (i7/16/64/$1300)</li>
<li>samsung ATIV book 9 - 12.2", 16:10, 4GB ram, 128GB ssd, core m 5y31, $1300</li>
<li>panasonic CF-SZ5 - 12.1", 16:10, core i5, 8GB ram, 128GB ssd, $1400 (in japanese, so i'm guessing)</li>
<li>panasonic toughbook - more of a bulldozer replacement than a desktop replacement</li>
<li><a href="http://store.hp.com/us/en/mdp/Laptops/pavilion-x2-12">Hp Pavilion X2 12</a> - 12" 3:2 1920x1280, Core M 4GB, convertible, $600</li>
<li><a href="http://shop.lenovo.com/us/en/tablets/thinkpad/x1-tablet/">Thinkpad X1 Tablet</a> - 12" FHD+ 2K (2160 x 1440) IPS, 3:2 - Core M - up to 16GB Ram - $999+(?) not yet released</li>
</ul>
<div>
<br />
edit: <a href="https://www.reddit.com/r/SuggestALaptop/comments/43l0ww/max_vertical_inches_1610_32_or_43_business_laptop/">posted on reddit</a>. thanks to SaneBRZ for the samsung and panasonic info<br />
<br /></div>
<div>
all of these machines have at least one major flaw. the macs are macs, the pixel lacks storage, most of them have touchscreens (pretty much useless) which are expensive, many of them aren't user serviceable (maybe the spectre and miix), the SZ5 doesn't appear available in the states, and overall they're all expensive. 16:9 business laptops are available for $250 with better specs. a better aspect ratio translates to more surface area for the display, hence higher cost, but only marginally so</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
vertical inches ... the surface book is 7.5", pixel is 7.2", macbooks are 7.05", my old lenovo x60 (4:3, 12") is 7.2", and a nominal business laptop (lenovo 14", 16:9, $250) is 6.86"</div>
<div>
<br /></div>
<div>
so the macbook air is $750 extra for .19" and the surface book is $1250 for .64". that's something on the order of $2000 an inch ... outrageous</div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-9170698494073103827.post-76292609362502837222016-01-19T19:10:00.000-05:002016-01-19T19:10:10.469-05:00accessing the command line in java<br />
would be convenient to be able to define a main() in an abstract superclass and have it automatically "run" the subclass that java was invoked with. there's nothing builtin, but at least on linux this info is easy to get. here's a simple demo<br />
<br />
<br />
<code>
import java.nio.file.Files;
import java.nio.file.Paths;
public static void main(String[] args) throws Exception {
// linux only, might work on windows
// https://cygwin.com/ml/cygwin/2007-04/msg00817.html
byte [] bytes = Files.readAllBytes(Paths.get("/proc/self/cmdline"));
String [] text = new String(bytes).split("\0");
String klassname = text[text.length-1-args.length];
System.out.println(klassname);
}
</code>
if anyone tries this on windows, leave a comment if it works
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-46854986284732061102016-01-13T17:46:00.000-05:002016-01-14T12:19:49.686-05:00Asynchronous Java webserver "Hello World" baselinethe <a href="https://www.techempower.com/benchmarks/#section=data-r11&hw=peak&test=plaintext">TechEmpower plaintext benchmark</a> (TEBM) attempts to give some rough measure of how a server (or framework) responds to the simplest of requests, and as such provides some guidance when configuring a server. however, most of the implementations are blocking (ie, use one thread per connection). i'm working on a demo for a database that i've written, and want to choose an appropriate server. the database:<br />
<ul>
<li>is implemented in java and uses java methods (and lambdas) as the query language</li>
<li>uses <a href="https://github.com/kilim/kilim">the Kilim fiber library</a> for high concurrency, ie imperative code is transformed into coroutines</li>
<li>is initially targeting low-end boxes, eg a VPS with limited cpu and memory resources, rentable for approximately $5 a month</li>
<li>is targeted at java developers that don't want the complexity of an enterprise environment</li>
</ul>
so i've reproduced something vaguely resembling the TEBM for a few asynchronous java servers, and a couple blocking implementations as a baseline, with a focus on simplicity and high concurrency, <a href="https://github.com/nqzero/jempower">each implemented as an embedded server</a>:<br />
<ul>
<li>Jetty blocking</li>
<li>Undertow blocking</li>
<li>Jetty Async (servlet)</li>
<li>Kilim Async - a simple http server that's part of the library</li>
<li>Comsat Async - a <a href="https://github.com/puniverse/quasar">Quasar</a> (another fiber library) shim that integrates with a Jetty servlet</li>
<li>Undertow Async (native)</li>
</ul>
<div>
i also looked at spark-java, but the performance wasn't comparable so i haven't included it here</div>
<div>
<br /></div>
my test machine is a i3 at 3100Mhz with 16GB. memory didn't appear to be an issue. the test client is ApacheBench. the servers and client are run with "ulimit -n 102400", and i've used sysctl to get 64000-ish available ports. i would run each server and sweep the AB concurrency from 1000 to 20000, each AB test running for approximately 10 seconds, for a total of 40 million requests for each server (half timed, half warmup). i then waited for 60 seconds to account for any delayed effects. throughout, i crudely monitored cpu usage. keep-alive was used (without it, the connection time dominated the performance). the tests were run many times to eliminate problems and develop an understanding of the performance, but in the end only 3 sweeps for each server were needed to get "good" data<br />
<br />
source code for the embedded servers and some scripts used for testing:<br />
<a href="https://github.com/nqzero/jempower">https://github.com/nqzero/jempower</a><br />
<h4>
Async:</h4>
<div>
the async servers are truly async, not solely using the async APIs. for Undertow and Jetty, the request stores the request in a queue, and a worker thread (or 3) services the queue periodically and sends the response (during extensive searching i did not find an example of this behavior online). for Comsat Jetty, Comsat provides a shim that does the equivalent of the queuing, and the userspace handler runs as a fiber, ie it yields when a blocking operation is performed. Kilim Http is entirely fiber-based, ie even the network code is non-blocking. both Comsat (Quasar) and Kilim transform imperative code into fibers / coroutines by weaving the bytecode</div>
<div>
<br /></div>
<div>
in all cases, the async server handlers are sleeping before responding, and a single thread is responding to 1000s of connections</div>
<h4>
Results:</h4>
the chart below shows the concurrency sweep. the left axis is median requests per second, the right is max (over 3 sweeps) failures. at 20000, undertow-async is all over the place, so don't read too much into the specific number (see the discussion below). <a href="https://docs.google.com/spreadsheets/d/1B64EpyyMSwF8LODhLL5mOjMPDSLq0ptfsUeBljo0jj8/pubchart?oid=1406999059&format=interactive">here's an interactive version of the chart</a><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi_YWhxbEilxFPI_kSa_FbrKYpJFZVLxsLg8-jrx_hfRZxkeuSkieiQJZ-XOKgfPySKgvI7zEjkGdtrVKRleNqX9QpcPBMOn2Wi51wW9YBtK29jn4uzWQ7NV_iOmIo4iAxkUcqVec0SJ0/s1600/jempower.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="457" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjril8WzMHBhA7gMs5DV8L-1a1vKIBq66ir2_UFPgMWYfWfJIvLU-1Kgj24xl1rqVj48FJq35cjfTQaIHrGx-uW0NIKvmZ1W0m2jC2MCpu5QwUCVyov9Qg-CmFlamQ_eESvGBbKbpUGmhE/s640/jempower2.png" width="640" /></a></div>
<br />
<h4>
Discussion</h4>
<div class="separator" style="clear: both; text-align: center;">
</div>
Undertow, both blocking and async, excelled at absolute throughput at low concurrency (consistent with the TEBM). At higher concurrencies (both sync and async), undertow exhibited 2 issues - "receive failures" and long periods (10-20 seconds) of max-cpu when the sweep finished. neither of these is mentioned in the TEBM. In addition to these problems, the documentation for undertow was limited (i'm waiting on some more feedback from the mailing list) so i'm not planning on going further with this server<br />
<br />
Jetty performance, for both blocking and async, was a very nice middle ground - decent low-concurrency performance and a graceful falloff at higher levels. the cost of using async was about 15% across the range (at lower concurrency my async implementation sleeps a little too long to saturate the connection, but that's an artifact of the highly artificial use of async)<br />
<br />
Comsat added a substantial overhead on top of async Jetty, and exhibited some failures at high concurrency. i've tried several different implementations based on the documentation and code from TEBM, and all performed about the same<br />
<br />
kilim performance was competitive with Jetty, especially at high concurrency and kilim has some nice properties - true fibers (like comsat) so handlers are simple to write, the server itself is fiber-based (unlike Comsat) so blocking IO isn't a problem (<a href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DataRateLimitedServlet.java">async IO can be used in Jetty, but is a pain</a>). however, the server is fairly primitive feature-wise, so at the least another server would be needed to proxy it. i have a working integration with my database that's very elegant, and i'll keep that, but want to add a more versatile server as well<br />
<h4 style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
Conclusions</h4>
<div>
<ul>
<li>Kilim offers competitive performance and the advantages of a true fiber-based server</li>
<li>Jetty Async offers a good mix of features, performance, and ease of use</li>
<li>Comsat performance was underwhelming, but the ability to shim fibers with servlets isn't (i haven't looked at the source, but my understanding is that it's a pretty simple and elegant hack) and i may investigate using Quasar in my database</li>
<li>undertow seems very capable, but isn't accessible to non-experts (or at least, not to me)</li>
</ul>
<div>
i'll be using Kilim and Jetty for my demo</div>
</div>
<h4>
Caveats</h4>
<ul>
<li>i'm not an expert</li>
<li>ApacheBench doesn't rate-limit connections, so the results aren't necessarily apples-to-apples (ie, faster servers get worked "harder")</li>
<li>at least the undertow handlers could saturate ApacheBench at low concurrencies, and running a second instance of AB increased throughput (120000 requests per second). not the focus of this study, so the results above use only a single AB</li>
<li>pull requests are welcome (though part of my need is for my demo to be easy for potential users to understand, so i probably won't integrate solutions that greatly increase complexity)</li>
</ul>
<br />
<br />
<br />Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-9170698494073103827.post-31825607429699449702016-01-08T00:13:00.000-05:002016-01-08T00:13:16.533-05:00sudo absolute path within script - bash, linux, ubuntuinside a script, sudo does something weird with the path used to execute it's command argument. this is on a default install of ubuntu - not sure if the sudoers file affects it. i'm not talking about the path that the command sees in its environment, but the path used to find the command to run<br />
<br />
<br />
<ul>
<li></li>
<li>sudo: cmd_on_my_path: command not found</li>
</ul>
<br />
<br />
this is counter-intuitive, but i guess makes sense if i think about it enough - sudo only sees the command name, not the full path, and presumably for security they don't want to respect $PATH<br />
<br />
but in the case in which the user has full sudo rights, i don't see how this helps anything. so in my script i've replaced "sudo myCommand" with:<br />
<br />
<ul>
<li>sudo "$(which myCommand)"</li>
</ul>
<div>
not enough of a guru to know if this is perfect or really safe, so buyer beware. but wanted to post something - doesn't appear to be a good answer available via google</div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-26554425055316215072015-12-29T13:58:00.001-05:002015-12-29T14:00:31.321-05:00caffeine, theobromine and theophylline content of coffee, tea and chocolate<br />
<br />
http://www.caffeineinformer.com/caffeine-content/coffee-beans<br />
<br />
hershey's cocoa powder, per T (5g powder): 8.4 mg caffeine, 106 mg theobromine<br />
espresso, 1.5oz shot (7g beans)<br />
starbucks drip coffee, 8oz: 165 mg caffeine<br />
coffee beans: 6 mg per bean (300-330 mg, from wp)<br />
<br />
<br />
used coffee grinds: 41mg per 7g of beans used, 4-8 mg per g (depending on method)<br />
8oz brewed coffee (amount of bean unspecified): 145 mg drip, 108 mg french press<br />
<br />
black tea, 8oz liquid (1 tea bag): 42 mg, 55mg for lipton, 4g theobromine (WP:tea)<br />
<br />
yerba mate, 8oz: 85mg<br />
<br />
<br />
<br />
<br />
<br />
wikipedia:<br />
<br />
caffeine metabolites:<br />
<br />
<br />
<ul>
<li>Paraxanthine (84%): Increases lipolysis, leading to elevated glycerol and free fatty acid levels in blood plasma.</li>
<li>Theobromine (12%): Dilates blood vessels and increases urine volume</li>
<li>Theophylline (4%): Relaxes smooth muscles of the bronchi, and is used to treat asthma. The therapeutic dose of theophylline, however, is many times greater than the levels attained from caffeine metabolism</li>
</ul>
<div>
<br /></div>
<div>
43g of 45% hershey's cacao --> 31 mg caffeine (guessing 8-10g cocoa)</div>
<div>
<ul>
<li>this is twice what CI says for cocoa</li>
</ul>
</div>
<div>
Tea contains small amounts of theobromine and slightly higher levels of theophylline than coffee</div>
<div>
tea also contains ... https://en.wikipedia.org/wiki/Theanine</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
theophylline: Amounts as high as 3.7 mg/g have been reported in Criollo cocoa beans</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
http://helios.hampshire.edu/~nlNS/mompdfs/TeaTheoph.pdf</div>
<div>
<br /></div>
<div>
tea: 1mg theophylline per 5oz cup black tea</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
http://www.ncbi.nlm.nih.gov/pubmed/6396642</div>
<div>
cocoa: .21% caffeine, 1.9% theobromine</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
http://chromsci.oxfordjournals.org/content/45/5/273.full.pdf</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Powder from roasted ground paste: 6.0% theobromine, .2% thoephylline, .8% caffeine</div>
<div>
assuming that this includes the butter, as the caffeine number matches cocoa powder 2:1</div>
<div>
<br /></div>
<div>
so cocoa: 12% theobromine, .4% theophylline</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-9170698494073103827.post-77226086273769798632015-12-24T12:14:00.002-05:002016-02-08T18:13:13.859-05:00at&t mvno "pay as you go" data planslooking for a GSM plan for USA<br />
<br />
<ul>
<li>data on a per MB basis</li>
<li>low monthly costs</li>
<li>AT&T network</li>
<li>willing to buy in $100 increments</li>
<li>byod</li>
<li>plan info available in english</li>
</ul>
<br />
<br />
<a href="https://en.wikipedia.org/wiki/List_of_United_States_mobile_virtual_network_operators">wikipedia maintains a list</a> and i went thru each entry for AT&T, and also googled a bit - ignoring plans with high per month minimums (ie if an operator didn't offer a plan under $30 per month they're not listed here). plans / prices as of <a href="https://en.wikipedia.org/w/index.php?title=List_of_United_States_mobile_virtual_network_operators&oldid=694592792">december 24, 2015</a>:<br />
<br />
<ul>
<li><a href="https://www.h2owirelessnow.com/mainControl.php?page=planMin">h2o</a> - $100, 1 year service, 5¢ per min or sms, 10¢ per MB or mms</li>
<li><a href="https://www.blackwireless.com/PayAsYouGoPlans.aspx">black</a> - $100, 1 year service, 5¢ per min or sms, 10¢ per MB or mms</li>
<li><a href="https://www.tracfone.com/direct/Purchase?payGo=true&app=TRACFONE&lang=en&smartPhone=true">tracfone</a> - $140 per year for service/voice, plus 1.5¢ per MB, terms are somewhat confusing</li>
<li><a href="https://www.consumercellular.com/Info/Services">consumercell</a> - $10 per month service, plus $10 per month for 500 MB, additional data at 25¢ per MB, means that effectively you need to pre-purchase data (uses T-mobile too)</li>
<li><a href="https://www.airvoicewireless.com/PlansB.aspx">airvoice</a> - $30 per 5 months, $1 per month, 10¢ per min/sms/mms, 6.66¢ per MB</li>
<li>at&t - go phone, $2 per day but claims (unconfirmed) only charged if voice/sms is used, $1 per 100 MB</li>
<li><a href="https://www.joltmobile.com/index.aspx">jolt</a> - $15 per month for service/30MB, additional data at 50¢ per MB</li>
</ul>
<br />
<br />
<br />
<br />
<br />
and for t-mobile:<br />
<ul>
<li><a href="https://ting.com/rates">ting</a> - billing is confusing (buckets), could do data-only for $6 per month service, plus $12 for 500 MB (next bucket is $19 for 1 GB)</li>
<li><a href="https://www.campussims.com/#plans">campus</a> - sketchy, $25/month includes 500 min, unlimited sms, 500 MB. details lacking</li>
<li><a href="http://www.mytempo.com/Plans/Plans-(1).aspx">tempo</a> - $70, 1 year service, 7¢ per min or MMS, 2¢ per sms, 14¢ per MB</li>
<li><a href="http://www.lycamobile.us/en/national-plans">lyca</a> - $19 per month, unlim voice/sms, 100 MB data, not clear if you can buy more data</li>
<li><a href="http://www.net10wireless.com/#/plans">net10</a> - not clear that any "cheap" plans include data</li>
<li><a href="http://www.provenwireless.com/plans.php">proven</a> - confusing, $25 per month includes 750 min, 250 sms, 100 MB</li>
<li><strike><a href="https://www.ptel.com/plans">ptel</a> - $60 per year service, 5¢ per min, 2¢ per sms/mms, 10¢ per MB</strike> out of business</li>
<li><a href="https://www.simplemobile.com/wps/portal/home/shop/serviceplans/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOJdDLx8jQMdPYyCPMxNDTwDPJyD3c39DEwcjfULsh0VAR6rtQ8!/#!#data-plans">simple</a> - $20 per month data-only, includes 1.5 GB</li>
<li><a href="http://ultra.me/">ultra</a> - $19 per month, unlimited talk/text, 100 MB (not clear if you can buy more)</li>
<li><a href="https://www.usmobile.com/plans">usmobile</a> - $16 per month, including 1 GB (talk+text is extra, but reasonable)</li>
</ul>
<br />
<br />
<br />
took a look at verizon:<br />
<br />
<ul>
<li><a href="http://www.callmr.com/#set">callmr</a> - $17 per month including 500 MB, plus 5¢ per min/sms/MB (or $20 for 1 GB)</li>
<li><a href="https://www.pagepluscellular.com/plans/50-standard-pin/">pageplus</a> - 50¢ per month, plus 5¢ per min/sms, 10¢ per MB (cannot activate 4g device)</li>
<li><a href="https://envie.h2owirelessnow.com/mainControl.php?page=planDetail&p_code=envp25">envie</a> - $25 per month, includes 500 min, unlim sms, 1 GB (lte)</li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-34516252901193935372015-09-04T11:29:00.003-04:002018-01-24T13:34:46.156-05:00dynamic DNS on DD-WRT won't update after power up / bootmy setup is a dsl modem with a DD-WRT based buffalo router, configured to use DDNS to connect to dyndns.org. i've tried the modem in both bridge mode and router mode. after a cold start, ie after both the modem and router have been powered down and the phone line disconnected, the IP address doesn't always get updated and the "DDNS Status" log shows:<br />
<blockquote class="tr_bq">
<span id="ddns_status" style="background-color: white; font-family: "tahoma" , "arial" , "helvetica" , sans-serif; font-size: 11px; line-height: 21.923px;">Thu Jan 1 00:00:50 1970: INADYN: Started 'INADYN Advanced version 1.96-ADV' - dynamic DNS updater.<br />Thu Jan 1 00:00:50 1970: INADYN: IP read from cache file is 'xx.xx.xxx.xx'. No update required. </span></blockquote>
<div>
<br /></div>
<div>
the problem appears to be a race condition between the new IP address being assigned and the DDNS check (the "thu jan 1" date suggesting the time of day hasn't updated either). a fix is suggested by:</div>
<div>
<br /></div>
<div>
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=886044</div>
<blockquote class="tr_bq">
<span style="background-color: #ede2d1; font-family: "lucida grande" , "verdana" , "arial" , sans-serif; font-size: 11px;">Go to: Administation-> Management </span><br />
<span style="background-color: #ede2d1; font-family: "lucida grande" , "verdana" , "arial" , sans-serif; font-size: 11px;">In Additional Cron Jobs write: </span><br />
<span style="background-color: #ede2d1; font-family: "lucida grande" , "verdana" , "arial" , sans-serif; font-size: 11px;">*/10 * * * * root /usr/sbin/inadyn /tmp/ddns/inadyn.conf > /dev/null 2>&1 </span></blockquote>
<br />
<div>
which runs the inadyn command every 10 minutes using cron. i've just applied/saved this setting. the DDNS updated immediately after applying this. since the problem was intermittent, i can't know if it's solved. if the problem reoccurs, i'll update this post</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
edit 2018.01.24:<br />
<br />
i ended up disabling the cron job years ago, i believe because i was worried about the logs filling up memory. or perhaps because it resulted in multiple inadyn processes running. at this point, i'm still not sure if it ever really (since the problem is so intermittent) worked<br />
<br />
i just disabled the external ip check<br />
<br />
but i understand the fundamental issue better now than i have. inadyn is running, but failing to recognize that the cached value differs from current value. there's a verbose option for the config file, but i don't currently have it enabled (the UI doesn't have an option for it). i believe that there's a way to use the nvram tool to manually fix it, ie without the UI, but i haven't delved into it yet<br />
<br />
good description of how to force inadyn to restart shortly after booting (to allow it to pick up the correct ip address):<br />
https://www.dd-wrt.com/phpBB2/viewtopic.php?p=70161<br />
<br />
<br />
<br />
an unrelated issue is that the sshd running on the router only supports a no-longer-current encryption method and ssh by default refuses to connect, so need to use a workaround<br />
<br />
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.11.1<br />
<br />
<br /></div>
<div>
(i provided a public key, but it's likely that this would work for password-based login too)<br />
<br />
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-9170698494073103827.post-45657118777173712872015-04-20T00:03:00.000-04:002015-04-21T15:38:08.757-04:00a tale of two tunnels, in which iptables proxies a bridgepoor man's VPN for android emulator<br />
<ul>
<li>genymotion</li>
<li>running on virtualbox</li>
<li>running on an ubuntu linux host</li>
<li>redirected thru a transparent proxy on the host</li>
<li>routed thru an ssh tunnel to a remote server (nqzero.com in the examples)</li>
<li>iptables based masquerade for NAT</li>
</ul>
i thought this should be pretty simple, but it ended up being a couple days of work, so documenting it here. i'm not a networking guy, so most of this was trial and error based on google searches<br />
<br />
on both the host and the remote machines:<br />
<ul>
<li>sudo cp ~/.ssh/authorized_keys /root/.ssh</li>
<li>set in /etc/ssh/sshd_config</li>
<ul>
<li>PermitTunnel yes</li>
<li>PermitRootLogin without-password</li>
</ul>
</ul>
on the remote machine (venet0 is my connection to the LAN):<br />
<ul>
<li>echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward</li>
<li>sudo iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE</li>
<li>sudo iptables -A FORWARD -i venet0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT</li>
<li>sudo iptables -A FORWARD -i tap0 -o venet0 -j ACCEPT</li>
<li>sudo ifconfig tap0 192.168.0.1 netmask 255.255.255.0 up</li>
</ul>
<br />
on the host:<br />
<ul>
<li>ssh -C2qTnN -D 8082 nqzero.com</li>
<li>sudo ssh -i ~/.ssh/id_rsa -o Tunnel=ethernet -f -N -w 1:0 root@nqzero.com</li>
<li>sudo ssh -i ~/.ssh/id_rsa -o Tunnel=ethernet -f -N -w 0:2 root@localhost</li>
<li><br /></li>
<li>sudo brctl addbr br0</li>
<li>sudo brctl addif br0 tap2</li>
<li>sudo brctl addif br0 tap1</li>
<li>sudo iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j REDIRECT --to-port 8888</li>
<li>sudo iptables -t nat -A PREROUTING -i br0 -p tcp --dport 443 -j REDIRECT --to-port 8888</li>
<li><br /></li>
<li>proxychains mitmproxy -p 8887</li>
<li>proxychains mitmproxy -T --host -p 8888</li>
<li><br /></li>
<li>sudo ifconfig tap0 0.0.0.0 up</li>
<li>sudo ifconfig tap1 0.0.0.0 up promisc</li>
<li>sudo ifconfig tap2 0.0.0.0 up</li>
<li>sudo ifconfig br0 192.168.0.5 netmask 255.255.255.0 up</li>
</ul>
virtualbox:<br />
<ul>
<li>adapter 1: unchanged (host-only, vboxnet0)</li>
<li>adapter 2: bridged adapter, tap0</li>
</ul>
~/.proxychains/proxychains.conf: socks5 127.0.0.1 8082<br />
<br />
genymotion.android.settings.wireless.proxy: 192.168.56.1, 8887<br />
<br />
my intuition was i could have virtualbox bridge directly to br0 (and omit the local tunnel entirely). packets got sent to the remote tunnel correctly, but i couldn't get iptables to redirect them, so i added the local tunnel. at that point, iptables was pulling the packets from the bridge, but not routing them anywhere, they just silently disappeared. to fix that, i added the bridge IP and zeroed out the tunnel endpoint IPs, and everything worked (i read this advice several places, but don't understand why it works)<br />
<br />
i use 2 proxies, both of which pass data over the ssh connection to port 8082<br />
<ul>
<li>8887 port uses the proxy mechanism provided by android</li>
<li>8888 is a transparent proxy to catch anything else (i'm trying to document an api)</li>
</ul>
non-http/https stuff is passed thru the tap1 tunnel<br />
<ul>
<li>monitor with: sudo tcpdump -vvvnni tap1</li>
<li>nothing should leak out thru the local network</li>
</ul>
<div>
Notes:<br />
<ul>
<li>must be 1 (ubuntu default): /proc/sys/net/bridge/bridge-nf-call-*</li>
</ul>
<blockquote class="tr_bq">
over the bridge and through the two tunnels<br />
to genymotion's house we go<br />
iptables knows the way to proxy the packets<br />
thru the virtual and private network</blockquote>
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-70632895017824568362014-06-08T16:58:00.000-04:002014-06-08T17:43:36.595-04:00java apidocs for websocketsworking thru the websocket examples in tomcat 8, and realize that i don't have javadocs for the javax.websocket stuff. this is a chronic annoyance with java - you're using interfaces that are pretty "standard", and they turn out to live in javaEE. and the apidocs are licensed in a way that platforms that implement the standard can't include the apidocs. so you're left with a lobotomized IDE with zero javadocs. it's dumb<br />
<br />
for tomcat 8, netbeans 8 and the websocket and servlet stuff:<br />
<ul>
<li>download the websocket apidocs from</li>
<ul>
<li><a href="http://download.oracle.com/otndocs/jcp/websocket-1_0-fr-spec/index.html">http://download.oracle.com/otndocs/jcp/websocket-1_0-fr-spec/index.html</a></li>
<li>currently called <a href="http://download.oracle.com/otndocs/jcp/websocket-1_0-fr-spec/index.html" id="uuid_file_2" name="uuid_file_2" style="background-color: white; color: #5382a1; font-family: Arial, Helvetica, sans-serif; font-size: 11px; text-decoration: none;">javax.websocket-api-1.0-apidoc.zip</a></li>
</ul>
<li>download the servlet apidocs from</li>
<ul>
<li><a href="http://download.oracle.com/otndocs/jcp/servlet-3_1-fr-spec/index.html">http://download.oracle.com/otndocs/jcp/servlet-3_1-fr-spec/index.html</a></li>
<li>currently called <a class="boldbodylink" href="http://download.oracle.com/otn-pub/jcp/servlet-3_1-fr-spec/javax.servlet-api-3.1-final-javadoc.jar" id="uuid_file_2" name="uuid_file_2" style="background-color: white; color: #5382a1; font-family: Arial, Helvetica, sans-serif; font-size: 11px; text-decoration: none;">javax.servlet-api-3.1-final-javadoc.jar</a></li>
</ul>
<li>in netbeans -> tools -> servers -> tomcat 8 -> javadocs, add the apidocs.zip (or jar) files</li>
</ul>
<div>
<br /></div>
<div>
oracle is evil ...</div>
<div>
<ul>
<li>apidocs for standards should be liberally licensed</li>
<ul>
<li>this is "embrace, extend and extinguish" in all it's glory</li>
</ul>
<li>websockets and servlets don't belong in javaEE, they're standard web technologies</li>
</ul>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-35953714317166581252014-06-04T17:05:00.000-04:002014-06-04T17:05:01.801-04:00netbeans "package does not exist" error -- maven considered harmfulupgraded to netbeans 8 and found a bunch of cryptic errors in my projects:<br />
<blockquote class="tr_bq">
package XXXXX does not exist</blockquote>
in this case XXXXX was a package provided by another netbeans project. it does indeed exist, the jar is being built properly and compiling the "broken" project succeeds and the application runs. so this is purely a problem with netbeans parser / indexer. i tried removing the dependency and re-adding it, cleaning and rebuilding, and exiting netbeans, removing the cache and restarting. nothing helped<br />
<br />
looking thru messages.log, i see<br />
<blockquote class="tr_bq">
WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: /home/YYYYY/working/nq0/XXXXX/XXXXX.git/src</blockquote>
didn't find much mention of that warning on the interwebs. looking at the "project properties" page for the project i realized i'd seen this problem before and started fiddling<br />
<br />
the problem is that buried in the XXXXX directory, there's a pom.xml. netbeans detects this and somehow modifies how the project is managed. it's a "project with existing sources", not a maven project. but somehow netbeans fails to honor that when it finds a pom.xml<br />
<br />
my solution was to deactivate the maven plugin (why that gets installed in the first place is beyond me). which eliminates the issue (i reactivated it temporarily to verify that that was actually the problem). this happened when i upgraded to netbeans 7, and i'm sure this will happen again when i upgrade to 8<br />
<br />
maven is terrible, and the plugin makes it worse. it's the wrong metaphor for managing dependencies<br />
<br />Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-9170698494073103827.post-17178922386840364532014-06-04T16:10:00.001-04:002014-06-04T16:16:43.406-04:00Ivy Bridge integrated graphics corruption, small groups of braille-like dots, giving a snow-like appearancefor the last 10 years i've used AMD-based computers that i "built" myself, replacing the mb/processor/mem a bunch of times. for my last upgrade, i switched to intel. i've got 2 similar systems, both with core i3s, one 2105 and the other 3220, both using the integrated "Intel HD Graphics". i run ubuntu linux. after 6 months, the 3220 system started to display a visual glitch. i described it first <a href="http://blog.nqzero.com/2013/04/ubuntu-1210-unity-ivy-bridge-visual.html">here</a>: i'd get a shifting pattern of dots overlayed on top of the windows. the dots show up in a screenshot, suggesting that the problem is with the cpu/mb/mem<br />
<br />
at first, the problem was manageable - the dots rarely obscured what i was reading and the machine never crashed. i wasn't sure if the problem was hardware or something that ubuntu was doing, so i lived with it and in some ways even liked it, in a "ghost in the machine" sort of way. but over the next year the problem got somewhat worse and at this point the problem had persisted thru several ubuntu versions (including a clean reinstall that i'd done for the sake of seeing if some configuration change i'd made was part of the problem), so i was forced to track down the cause<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGUGO55nspmdLH8h7KB4hnEtIKFz-5YPAZPKor_KI9Vy_18gnc-3KVz5uQt4PcdUdr_bUo3kQmKY_kDuHxLn8QsMFdIUUDbP4rLVKykTTbB5BpdMTwHe0I4OZMM9dwO0WKkqIMQaYgsIw/s1600/snow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGUGO55nspmdLH8h7KB4hnEtIKFz-5YPAZPKor_KI9Vy_18gnc-3KVz5uQt4PcdUdr_bUo3kQmKY_kDuHxLn8QsMFdIUUDbP4rLVKykTTbB5BpdMTwHe0I4OZMM9dwO0WKkqIMQaYgsIw/s1600/snow.png" height="197" width="320" /></a></div>
<br />
i "live chatted" with intel support and they told me to run the <a href="https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=19792">intel processor diagnostic tool</a>. the standard tool is windows-only, but they include a link to a <a href="http://www.tcsscreening.com/files/users/IPDT_LiveUSB/index.html">fedora15-based liveUSB version</a>. the instructions seemed cryptic to me, the utilities were ".exe"s, possibly directed to windows users (though why they wouldn't just use the standard tool ???) and the intel support team stated:<br />
<blockquote class="tr_bq">
Alberto: the thing is that we are not that familiar with Linux</blockquote>
<br />
so they were useless. tl;dr - it took me (much) longer than it should have to run the tool. but eventually i got it running, the "snow" still appeared (ie, the fedora15 system exhibited the glitch), but the tool reported that all tests passed, ie the tool was useless (it didn't verify that the generated images matched the desired values). fwiw, here's the easiest way i found to use the tool:<br />
<div>
<ul>
<li>download the iso (eg, <a href="http://www.tcsscreening.com/files/users/IPDT_LiveUSB/LiveUSB/Fedora15/f15_64-xfce-1.22.1.0-ipdt64.iso">this one</a>)</li>
<ul>
<li>i'll call it ipdt.iso for simplicity</li>
</ul>
<li>insert a usb drive (i'll call this /dev/sdX)</li>
<ul>
<li>we're going to overwrite the drive, so *all data* on it will be lost</li>
<li>if it automounts, unmount it</li>
<li>in my case, it was recognized as /dev/sdd</li>
</ul>
<li>dd bs=4M if=ipdt.iso of=/dev/sdX</li>
<li>insert the usb drive into the target computer and boot from it</li>
<ul>
<li>most modern systems support boot-from-usb. if yours doesn't, maybe you could burn a cdrom ???</li>
</ul>
<li>fedora should boot up</li>
<li>open up a terminal and type (for a 64bit system)</li>
<ul>
<li>install64</li>
<li>click the "ipdt" icon on the desktop</li>
</ul>
</ul>
</div>
<div>
next, intel suggested i swap CPUs between the 2 systems. i did this and the problem (ie the "snow") followed the 3220. the 2105 CPU showed zero symptoms in either machine. at this point, intel agreed that the CPU was probably faulty and they've presented me with two warranty options</div>
<div>
<br /></div>
<div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
</div>
<ul>
<li>Standard Warranty Replacement: This is when you send the processor first to us, and then once we receive it, it takes 5-8 business days for you to receive the replacement processor.</li>
<li>Advance Warranty Replacement: This is when we send you the processor first, and then, once you receive it you just need to send your defective processor back to us. There is a fee on this option, $25, not refundable, that covers the overnight shipment of the processor to you, and also it covers the shipping for you to send the defective processor back to us. And also for security reasons, we are going to charge the price of the processor to your credit card, just in the meantime, as soon as we get your defective processor we will do a refund for that amount.</li>
</ul>
</div>
<div>
those are both pretty horrible options. this is *intel's* poor workmanship resulting in me living with a minor annoyance for over a year, ultimately forcing me to spend 2 work days tracking down the problem, their diagnostic tool failed to detect *any problem*, and now they want me to pay $25 to replace it or else live without a working computer for on the order of 2 weeks. pretty ridiculous</div>
<div>
<br /></div>
<div>
grrr intel. but whatever. they're a monopoly and i don't have much choice. maybe next upgrade cycle i'll go back to AMD (if intel hasn't driven them to bankruptcy yet). i submitted the serial number they requested and am waiting on shipping info</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-57321881235131569652014-03-14T22:40:00.001-04:002014-03-14T22:40:29.593-04:00books to read next 2014 editionnote to self ... keep a list of books to read (or reread) here
the bell jar
frankenstein
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-11772178093112630682014-03-03T23:35:00.001-05:002014-03-03T23:35:04.532-05:00ubuntu 13.10 + unity + libreoffice mnemonics == FAIL<div class="tr_bq">
ever since ubuntu switched to unity, mnemonics (eg, alt-f to open the File menu) have been a disaster. 13.10 and LibreOffice are perhaps the worst offenders ... mnemonics don't work *at all*</div>
<br />
<a href="https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/739184">This ubuntu bug report</a> has been open for 3 years with no progress. At various times, mnemonics have worked briefly with some magic ever changing invocation, perhaps installing lo-menubar or some specific version of LO not in the repository. The bug report is labeled "High Priority", but is Unassigned (does that mean "high priority to no-one"). With 13.10 i don't believe that there is any way to make the unity integrated menus work correctly. There is some chatter online that 14.04 will bring menu bar sanity, but i haven't seen anything explicitly mentioning mnemonics<br />
<br />
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=57104">The LibreOffice bug report</a> is closed as NOTOUTBUG, because someone once heard that someone else thought it was <a href="https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/739184/comments/60">a generic Gnome problem</a>. no link to another bug report, roadmap to a fix, no comment from the 2nd hand source, nothing. way to take responsibility. though in general, i'm all for blaming Gnome because *fuck those guys* for forcing gnome-shell on us and it probably is their fault<br />
<br />
The workarounds that are proposed are<br />
<br />
<ul>
<li>uninstall unity</li>
<li><i><a href="https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/739184/comments/80">apt-get purge libreoffice-gtk</a></i>, which leaves a horrid 1995-style interface with broken window manager support (ie, you can't maximize the windows), menu bars that don't render correctly, and a propensity <a href="https://bugs.freedesktop.org/show_bug.cgi?id=57492">to lose access to the keyboard requiring a restart</a></li>
</ul>
<br />
<br />
I haven't tried the first option - it seems pretty drastic since unity is the *recommended* way to use Ubuntu. I'm more inclined to switch to Mint, but that too seems pretty drastic. The second option is completely unusable (and i've tried multiple versions and sources of LO). My current approach is to purge libreoffice and <a href="http://www.openoffice.org/download/other.html">install openoffice</a> (untar and dpkg -i *.deb). OpenOffice seems usable<br />
<br />
Evince and some other apps have shown similar issues, but so far i've managed to live with them. Maybe one of them will eventually force me to Mint or to uninstall Unity<br />
<br />
tl;dr<br />
As shipped, Ubuntu 13.10 doesn't have a usable office suite, which <a href="http://www.ubuntu.com/desktop/features/office-applications">is one of their key features</a>. I can understand Free Software being buggy, but the false advertisement of claiming things are working is bullshit<br />
<br />
<div style="margin-left: 50px;">
<h3 style="border: 0px; color: #333333; font-family: Ubuntu, Arial, 'libra sans', sans-serif; font-size: 1em; font-weight: normal; line-height: 1.3; margin: 0px 0px 0.75em; padding: 0px; vertical-align: baseline;">
Get things done</h3>
<div class="four-col" style="border: 0px; box-sizing: border-box; clear: none; color: #333333; display: inline-block; float: left; font-family: Ubuntu, Arial, 'libra sans', sans-serif; font-size: 16px; line-height: 1.6; margin-bottom: 20px; margin-right: 18.59375px; padding: 0px; position: relative; vertical-align: baseline; width: 267.8125px;">
We understand how important your computer is for day-to-day tasks. Whether it's finding information online, sending emails to colleagues and friends, or creating and sharing documents, Ubuntu has everything you need to get things done. Fast.</div>
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
I guess they don't mention "use a keyboard". Assholes<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9170698494073103827.post-68064396935673191522014-01-31T14:59:00.001-05:002014-01-31T14:59:50.046-05:00ubuntu 13.10 libreoffice menubar lossageit's 2014 and ubuntu still doesn't have a usable libreoffice package - out of the box, the menubar shortcuts (or mnemonics) don't work. pressing "alt-f" has no effect, the file menu fails to activate, nothing. this is *the* office suite on linux, the most critical package for a business user, lacking perhaps the oldest and most-used metaphor for interacting with a gui<br />
<br />
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=61461">freedesktop</a> calls it "NOTABUG", <a href="https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/739184/">ubuntu</a> doesn't seem interested in fixing it (no-one is assigned after almost 3 years), and anyone that posts on <a href="http://askubuntu.com/questions/204769/libreoffice-menu-bar-doesnt-function">askubuntu</a> gets <a href="http://askubuntu.com/questions/190061/why-cant-i-use-the-hud-with-libreoffice-in-ubuntu-12-10?rq=1">closed</a> as "offtopic" with a snarky comment. for now, the options available are:<br />
<ul>
<li>uninstall libreoffice-gnome, leaving an ugly interface that doesn't maximize correctly<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8aJSAEFpC64S0GCioHQqQLsGp1SqmQUMO955bY-epon-AljpY4gSuRJ3bEGBdPl3FZpKiYlKhnZEHVWEvC8rH4K4kP6wtYJDXms_XqDGueuCtzEjV0n2IHnmEFk02-0CtkfcCbc7_n60/s1600/lo-menubar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8aJSAEFpC64S0GCioHQqQLsGp1SqmQUMO955bY-epon-AljpY4gSuRJ3bEGBdPl3FZpKiYlKhnZEHVWEvC8rH4K4kP6wtYJDXms_XqDGueuCtzEjV0n2IHnmEFk02-0CtkfcCbc7_n60/s1600/lo-menubar.png" height="153" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</li>
<li>uninstall libreoffice entirely using apt and install the package from freedesktop.org (or maybe from a ppa) ... i haven't verified that this works, but there are some <a href="https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/739184/comments/79">reports</a> that it does</li>
</ul>
in 2010 when ubuntu introduced <a href="http://en.wikipedia.org/wiki/Unity_(user_interface)">unity</a> i understood that it was a new endeavor and expected some rough edges. but even then, this bug seemed egregious ...
we're now up to ubuntu 13.10, unity is no longer new, and we still don't have usable shortcuts for libreoffice menusUnknownnoreply@blogger.com1tag:blogger.com,1999:blog-9170698494073103827.post-42512747553403758312014-01-14T22:30:00.003-05:002014-01-14T22:30:55.079-05:00books to readjust keeping a running list here for my own sake
wharton
watershed down
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-9170698494073103827.post-4867628283574115982013-10-21T16:58:00.000-04:002013-10-21T16:58:01.868-04:00lightdm invalid session - screen blanks and greeter restarts<p>
in the process of reinstalling ubuntu raring 13.04 (or possibly during the initial upgrade to 13.04 from 12.10) lightdm got confused. it would display the greeter, i'd provide my password and then it would attempt to start my session, ie the screen would go momentarily black. but instead of starting unity, it would fail and restart the greeter. i don't have any of the old logs, but i believe the message was to the effect of "invalid session: xterm". (i believe that i set this session fucking around with settings, but it could also have been an valid session that has since been deleted - when i reinstalled i omitted many packages)
</p>
<p>
the greeter didn't give an option to choose a session, so i had to talk to <a href="http://afrantzis.wordpress.com/2012/06/11/changing-gdmlightdm-user-login-settings-programmatically/">dbus directly</a> (which may very well be how i got in trouble in the first place:)
</p>
<code>
# list the sessions (ignore the .desktop suffix)
# note: they might not all be valid, eg because the software hasn't been installed
ls /usr/share/xsessions
# get the dbus name for the current user
user=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts.FindUserById int64:$(id -u))
# set the session (replace ubuntu with another valid session if desired)
sudo dbus-send --print-reply --system --dest=org.freedesktop.Accounts $user org.freedesktop.Accounts.User.SetXSession string:'ubuntu'
</code>
lightdm should really provide a means to select your profile. by default, it doesn't if there's only one valid session. however, the session that it uses is the "current session", ie the one that it gets from dbus, which might not be the valid session. little bit of catch-22. in theory, i should submit a bug report. in reality, <a href="https://bugs.launchpad.net/ubuntu/+source/x11-xserver-utils/+bug/60040">canonical will sit on it for 7 years regardless</a>, so fuck emUnknownnoreply@blogger.com0