tag:blogger.com,1999:blog-41378067884653337742024-03-18T20:26:28.462-07:00Hus to Know?Written by Roger HuUnknownnoreply@blogger.comBlogger425125tag:blogger.com,1999:blog-4137806788465333774.post-73201235953894960902020-12-07T22:41:00.005-08:002020-12-07T22:41:41.190-08:00L2TP with Raspberry PI<p><span style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;">Make sure the debug dump option is not used -- otherwise it will crash pppd.</span></p><p><span style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;">/etc/ppp/options.l2tpd.client:</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;"><br /></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">ipcp-accept-local</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">ipcp-accept-remote</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">refuse-eap</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">require-mschap-v2</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-variant-ligatures: no-common-ligatures;">noauth</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">mtu 1200</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">mru 1200</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">noipdefault</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">debug</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">defaultroute</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">usepeerdns</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">connect-delay 5000</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">name <username></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">password <password></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;"><br /></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;">/etc/ipsec.conf:</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;"><br /></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"># ipsec.conf - strongSwan IPsec configuration file</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"># basic configuration</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">config setup</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span># strictcrlpolicy=yes</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span># uniqueids = no</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"># Add connections here.</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"># Sample VPN connections</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">conn %default</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>ikelifetime=60m</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>keylife=20m</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>rekeymargin=3m</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>keyingtries=1</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>keyexchange=ikev1</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>authby=secret</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>ike=3des-sha1-modp1024!</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>esp=3des-sha1!</span></p><p class="p2" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">conn myvpn</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>keyexchange=ikev1</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>left=%defaultroute</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>auto=add</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>authby=secret</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>type=transport</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>leftprotoport=17/1701</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>rightprotoport=17/1701</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s2" style="font-variant-ligatures: no-common-ligatures;"></span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>right=<IP address></span></p>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-4137806788465333774.post-7492000447654964212020-03-26T18:58:00.001-07:002020-03-26T19:03:35.810-07:00Overscan monitor issues on HP 2509mIf you're noticing that you can't see the title bar and the bottom status bar, it's because the overscan settings need to be changed.<br />
<br />
The instructions at the bottom of this blog post (<a href="https://ishan.co/external-monitor-underscan">https://ishan.co/external-monitor-underscan</a>) worked for me:<br />
<br />
1. Make a backup of the current file:<br />
2. cp /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup<br />
3. With the “troubled” monitor connected, open Display Preferences, and change its settings. For example, I changed the rotation.<br />
4. Run the “diff” command to see what had changed in that file after you made the changes:
<br />
<pre>
</pre>
<pre>56a57,58
> <key>framebuffer-rotation</key>
> <integer>0</integer>
58c60
< <integer>10000</integer>
---
> <integer>9000</integer>
</pre>
<br />
5. I derived 9000 from -10% less overscan, which works great!<br />
<br />
The process is automated in this Bashmatic script! (<a href="https://github.com/pioneerworks/lib-bash/blob/master/lib/osx.sh#L41-L53">https://github.com/pioneerworks/lib-bash/blob/master/lib/osx.sh#L41-L53</a>)Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-4137806788465333774.post-5777589278374534112019-02-03T23:40:00.003-08:002019-02-06T23:54:36.372-08:00How I fixed a 17-year old HP scanner...Fixed! I've had this HP LaserJet 3330 multi-function printer (3300mfp) since 2002, but one day it started making a clicking/grinding noise, which is a common issue in this printer. The key to fixing is taking apart the entire unit and cleaning the mirrors and lens on the scanner unit (see YouTube <a href="https://www.youtube.com/watch?v=lqG_nmi3vC4&list=PLx28f0cjp9YWHQcvro5j3GQNZaw91q86q">video</a>)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-YxKkefNBkZY/XFfp2B3xPFI/AAAAAAAADLc/nD1o-RhYs_suWJtIZZ7QIsWgEs_4SvpRwCLcBGAs/s1600/2019-02-01%2B00.08.40.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://2.bp.blogspot.com/-YxKkefNBkZY/XFfp2B3xPFI/AAAAAAAADLc/nD1o-RhYs_suWJtIZZ7QIsWgEs_4SvpRwCLcBGAs/s320/2019-02-01%2B00.08.40.jpg" width="240" /></a></div>
<br />
What exactly is the issue? It turns out that the scanner during startup tries to find its home position at the edge. When the scanner lid is closed, the light will reflect down onto mirrors. There are 5 of these mirrors that eventually bounce the light towards a CCD sensor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-b48pYont9hk/XFfl6KQzN2I/AAAAAAAADLI/B_NyF25RGyotVvGMNyQ2CRgmhHNrfjAjQCPcBGAYYCw/s1600/Screen%2BShot%2B2019-02-03%2Bat%2B11.12.18%2BPM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1421" height="640" src="https://4.bp.blogspot.com/-b48pYont9hk/XFfl6KQzN2I/AAAAAAAADLI/B_NyF25RGyotVvGMNyQ2CRgmhHNrfjAjQCPcBGAYYCw/s640/Screen%2BShot%2B2019-02-03%2Bat%2B11.12.18%2BPM.png" width="568" /></a></div>
I had done this mirror cleaning a few years ago and it worked miraculously. However, this time around the problem started happening again but the mirrors seemed fairly clean. What I didn't realize and what the repair videos don't mention is that I also had to clean the lens. You can clean the front easily but to get to the back of the lens, the board on the back of the scanner unit has to be removed. This <a href="https://statusq.org/archives/2008/01/21/1745/">article</a> seems to suggest you can get access to the scanner unit without taking the entire printer apart, but if you need access to the board, there are really no shortcuts.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-u0yOG1DLobE/XFfiEcFRDoI/AAAAAAAADKQ/pSoLW6yNsegbZjpY6MxMqFupKntslzFEQCLcBGAs/s1600/2019-02-02%2B22.15.04.jpg" imageanchor="1"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://3.bp.blogspot.com/-u0yOG1DLobE/XFfiEcFRDoI/AAAAAAAADKQ/pSoLW6yNsegbZjpY6MxMqFupKntslzFEQCLcBGAs/s320/2019-02-02%2B22.15.04.jpg" width="240" /></a></div>
<br />
There were small glue residue on the screws, so I had to use a power screwdriver to remove them. You can see in the pictures how the lens is fogged up:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-e2uz0r0n0aQ/XFfiSpdPZwI/AAAAAAAADKU/rTFAoMunzZgj71DPBXQbchQkGkYuuPOogCLcBGAs/s1600/2019-02-02%2B15.49.12.jpg" imageanchor="1"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://4.bp.blogspot.com/-e2uz0r0n0aQ/XFfiSpdPZwI/AAAAAAAADKU/rTFAoMunzZgj71DPBXQbchQkGkYuuPOogCLcBGAs/s320/2019-02-02%2B15.49.12.jpg" width="240" /></a></div>
<br />
After cleaning with a Q-Tip and alcohol, this lens starts to become cleaner:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-zPoCiFdnYPI/XFfiT3OjX_I/AAAAAAAADKY/T5cccZE1h1oFtR2zVGFXBoTBrqXULwxRACLcBGAs/s1600/2019-02-02%2B15.49.44.jpg" imageanchor="1"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://4.bp.blogspot.com/-zPoCiFdnYPI/XFfiT3OjX_I/AAAAAAAADKY/T5cccZE1h1oFtR2zVGFXBoTBrqXULwxRACLcBGAs/s320/2019-02-02%2B15.49.44.jpg" width="240" /></a></div>
<br />
Upon putting everything back, I noticed the printer continued to show "warming up bulb" on startup. I think the problem could be traced to some of the residue from the glue when I removed the board causing issues on the board. I managed to scrape away the residue and use painter's tape to lift it off the board. <br />
<br />
To verify whether the circuit board that I had just removed was at issue, I also started using a voltmeter and testing the ground and power (Vcc) pins of each of the integrated chips on the board while the board was plugged in while leaving the gray scanner lid off. There are a few commodity parts, which includes the CCD sensor (UPD8861), an inverter (74vhc04), a Schmitt trigger, and a voltage regulator that outputs 12 volts.<br />
<br />
It suddenly worked! And I didn't have to buy a new unit (51000104-0000 on Ebay).<br />
<br />
Note: I did try to reset the printer's memory by holding down "*" and # on power-up. But I stopped doing it after it didn't seem to help.<br />
<br />
Other notes from the HP forum <a href="https://www.fixyourownprinter.com/forums/laser/28576">here</a>.Anonymousnoreply@blogger.com49tag:blogger.com,1999:blog-4137806788465333774.post-86951261763037099042018-11-21T06:35:00.001-08:002018-11-21T06:36:18.037-08:00Seeing ints instead of booleans from your memcache? The latest PyLibMc has changed the way in which booleans are stored from strings to integers to avoid conflicts in which python-memcached manages them. The end result? If you were noticing that your cache is returning ints instead of True/False, this change in PyLibMC cached this issue!<br />
<br />
<a href="https://github.com/lericson/pylibmc/issues/242">https://github.com/lericson/pylibmc/issues/242</a><br />
<br />
If you have API responses that are returning invalid values, you'll need to wrap the value in bool() to fix the issue!Anonymousnoreply@blogger.com10tag:blogger.com,1999:blog-4137806788465333774.post-78309309760069403032017-11-24T23:47:00.004-08:002017-11-24T23:47:49.181-08:00Testing SSL on Erlangssl:start().<br />
{ok, ListenSocket} = ssl:listen(8443, [{certfile, "server.pem"}, {keyfile, "server.key"}, {cacertfile, "server.chain"}, {reuseaddr, true}]).<br />
{ok, Socket} = ssl:transport_accept(ListenSocket). <br />
ok = ssl:ssl_accept(Socket).<br />
Anonymousnoreply@blogger.com18tag:blogger.com,1999:blog-4137806788465333774.post-10976113472156894872016-03-09T23:39:00.001-08:002016-03-10T09:47:26.259-08:00Project Fi and B010 error codes<br />
<ul>
<li>If you purchase a Google phone, make sure to buy it under the @gmail.com account that will activate the Fi service. Otherwise, you will end up seeing B010 error codes when trying to activate!<br /><br />Otherwise, you will have to call Project Fi specialists and have the "asset id" transferred to the account owner that intends to activate service. You need to have both parties on the phone to have this info transferred. This lesson took 3 weeks to resolve after calling multiple times to their 24x7 support line!<br /></li>
<li>Google Fi leverages the Google Voice infrastructure. You have to decide upfront whether to port your existing Google Voice line or port your cell phone. If you decide to test out Project Fi and wish to bring your own phone line over later, you must cancel the service and then order another SIM card. Google currently has no way of letting you to try before committing. </li>
</ul>
<br />
<br />Anonymousnoreply@blogger.com18tag:blogger.com,1999:blog-4137806788465333774.post-81253025167609980302015-04-23T22:57:00.001-07:002015-04-23T23:06:35.451-07:00Redcarpet<a href="https://github.com/vmg/redcarpet">Redcarpet</a> is a Ruby library for rendering markup language. When updating <a href="http://guides.codepath.com/android/Automating-Publishing-to-the-Play-Store">a CodePath Wiki guide</a> entry, which hosts these documents outside of GitHub, I noticed that the list items not to be including the image tags that I used in a separate line:<br />
<br />
1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:<br />
<br />
<img src="http://imgur.com/0n7ihzM.png"/><br />
<br />
I would see:<br />
<br />
<pre class="prettyprint"><ol>
<li>Inside the Google Play Store for your project, navigate to...
</ol>
<p><img src='http://imgur.com/0n7ihzM.png'/&amp></p&amp>
</pre>
<br />
But if I added 4 spaces to the image tag, the problem went away:<br />
<br />
1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:<br />
<br />
<img src="http://imgur.com/0n7ihzM.png"/><br />
<br />
Turns out that a change was made in Redcarpet v3.1.0 that changes the parsing behavior so that at least 4 spaces are needed for the line to be considered part of the list item. It also is very likely that GitHub must be using an older version of this library, since this problem doesn't appear on native GitHub Wiki pages. If GitHub should ever decide to upgrade to this new library, they're likely to cause their Wiki collection to experience similar problems!<br />
<br />
<a href="https://github.com/vmg/redcarpet/commit/b7d5e017385a8ae35a594ff9535d31bd081ce973">https://github.com/vmg/redcarpet/commit/b7d5e017385a8ae35a594ff9535d31bd081ce973</a>Anonymousnoreply@blogger.com7tag:blogger.com,1999:blog-4137806788465333774.post-90461414975862588292015-03-30T23:59:00.001-07:002015-03-31T00:20:26.630-07:00Brain surgery on a Nexus 5A few days ago, my Nexus 5's display started turning colors. A few minutes later, it stopped showing.<br />
<br />
Rather than buying a new phone, I decided to see if it could be repaired with some surgery. I bought a $70 replacement <a href="http://www.ebay.com/itm/190964828803">frame and digitizer</a> and $5 in <a href="http://www.ebay.com/itm/Front-Outer-Screen-Glass-Lens-Part-For-LG-Google-Nexus-5-D820-D821-Black-/390933397837?ssPageName=ADME:X:AAQ:US:1123">tools</a>. The <a href="https://www.youtube.com/watch?v=Q0AoVcoRxjs">video walkthrough</a> seemed pretty straightforward right?<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/Q0AoVcoRxjs" width="560"></iframe><br />
<br />
Little did I realize that I would have to move everything from the old unit to the new frame, including the two power buttons, the battery (the video warns about puncturing and inhaling the toxic chemicals), the front and back camera, antenna board, and the main CPU. Not to mention the microphone pieces (watch very carefully the video about the additional part you must bring over too!)<br />
<br />
You don't really need a dryer gun since the adhesive is pretty easy to remove. The tricky part is getting the shell of the phone off -- they are connected with small snap-ins that can break if you're not careful. Once I managed to get a few of these snap-ins loose, I could use a flathead screwdriver to remove the rest around the edge. The video also shows what you need to do if you don't have a replacement digitizer like the part that I ordered -- I skipped over that step.<br />
<br />
3 hours later, after making sure every single part was moved over (again, check the microphone and the part that sits below it!) it's working great. At first I thought I had failed because only the screen turned on. The battery had apparently drained so upon plugging in, I was able to see the Android Lollipop screen. My only major issue is that I may have damaged on of the two antenna ports on the board, but the phone operates fine with just a single one plugged into it. I plan to solder the other cable onto the socket just in case.<br />
<br />
Nonetheless, I hope I just saved myself $400 on a new Nexus phone!<br />
<br />
<br />Anonymousnoreply@blogger.com16tag:blogger.com,1999:blog-4137806788465333774.post-1462113191575502422015-02-18T00:02:00.001-08:002015-02-18T00:02:54.225-08:00Why does an extra FrameLayout get generated for fragments?<a href="https://code.google.com/p/android/issues/detail?id=68057&thanks=68057&ts=1396459349">https://code.google.com/p/android/issues/detail?id=68057&thanks=68057&ts=1396459349</a><br />
<br />
<a href="http://stackoverflow.com/questions/16774781/why-is-an-extra-framelayout-created-for-fragments">http://stackoverflow.com/questions/16774781/why-is-an-extra-framelayout-created-for-fragments</a>Anonymousnoreply@blogger.com5tag:blogger.com,1999:blog-4137806788465333774.post-23790786275694441982015-02-11T08:01:00.002-08:002015-02-11T08:26:45.876-08:00Want to verify your W2 submission form?A few weeks ago, I got a letter from the SSA notifying me that my electronic employer W2 submission was wrong. I knew it was related to the electronic file format generated by <a href="http://www.waveapps.com/">Wave</a>, but wasn't sure what was happening. After waiting 2 weeks for a response from their support team, I decided to write a small script to figure out what was happening...<br />
<br />
<a href="https://gist.github.com/rogerhu/bef3c9cba4005f346002">https://gist.github.com/rogerhu/bef3c9cba4005f346002</a><br />
<br />
It confirmed to me that their generation was off by a factor of 10. It was fixed later by the company without notifying customers about the issue. <br />
<br />
Also, it turns out that the SSA provides a Java applet called <a href="http://www.ssa.gov/employer/accuwage/index.html">AccuWage</a> that allows third-party companies to verify that their file format generation is correct...Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-6208853811104988422015-02-07T10:53:00.001-08:002015-02-07T10:53:56.414-08:00How to get IntelliJ to recompile Android resource filesIf you want to use IntelliJ to build your Android projects, make sure that the SDK versions in your Project SDK matches that in your Preferences->Module SDK. Otherwise, you may find that you have to click Rebuild Project each time you make changes to the XML version! Anonymousnoreply@blogger.com3tag:blogger.com,1999:blog-4137806788465333774.post-17882160794175414012015-01-16T22:37:00.000-08:002015-01-22T22:37:06.524-08:00Troubleshooting a Facebook IE8 last week...<a href="http://engineering.hearsaysocial.com/2015/01/16/how-facebook-fixed-their-ie8-issues-this-past-week/">http://engineering.hearsaysocial.com/2015/01/16/how-facebook-fixed-their-ie8-issues-this-past-week/</a>Anonymousnoreply@blogger.com2tag:blogger.com,1999:blog-4137806788465333774.post-38478898238874993172014-12-29T22:15:00.000-08:002014-12-29T22:15:16.659-08:00User location API's in AndroidWith the new framework with Google Play, you have to update your code now to use this unified GoogleApiClient.Builder() approach:<br />
<br />
<a href="http://android-developers.blogspot.com/2014/02/new-client-api-model-in-google-play.html">http://android-developers.blogspot.com/2014/02/new-client-api-model-in-google-play.html</a><br />
<br />
There are now actually two ways to get location from Android. The 2nd way attempts to unify the various LocationProviders (GPS, network, other applications, etc.) into one API:<br />
<br />
<a href="http://www.rahuljiresal.com/2014/02/user-location-on-android/">http://www.rahuljiresal.com/2014/02/user-location-on-android/</a><br />
Anonymousnoreply@blogger.com5tag:blogger.com,1999:blog-4137806788465333774.post-63973222591504250652014-12-20T16:49:00.001-08:002014-12-20T16:57:09.815-08:00An old but useful article about avoiding memory leaks on Android...<a href="http://www.curious-creature.com/2008/12/18/avoid-memory-leaks-on-android/comment-page-1/">http://www.curious-creature.com/2008/12/18/avoid-memory-leaks-on-android/comment-page-1/</a><br />
<br />
and a great link on mastering Android drawables:<br />
<br />
<a href="https://skillsmatter.com/skillscasts/4619-mastering-android-drawables">https://skillsmatter.com/skillscasts/4619-mastering-android-drawables</a><br />
<br />
<a href="https://speakerdeck.com/cyrilmottier/mastering-android-drawables">https://speakerdeck.com/cyrilmottier/mastering-android-drawables</a>Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-7964793495229457452014-12-12T21:05:00.000-08:002014-12-12T21:05:18.470-08:00How to map multiple keyboards to the same OSX mappings If you're trying to use Karabiner to support key remappings for multiple devices, you can take advantage of the templating syntax:<br />
<br />
You can have your product and vendor ID definitions here:<br />
<br />
<script src="https://gist.github.com/rogerhu/262c73a8fde6674f088e.js"></script><br />
<br />
You define your main key remappings here:<br />
<br />
<script src="https://gist.github.com/rogerhu/6bf13f9bd9e2f2724b52.js"></script>Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-41841302969340100852014-12-10T23:08:00.000-08:002014-12-11T01:06:16.963-08:00Using padding in ListViewsDon't forget to use scrollbarStyle and clipToPadding according to this post!<br />
<br />
https://plus.google.com/+AndroidDevelopers/posts/LpAA7q4jw9M<br />
<br />
The difference between gravity and layout_gravity -- one deals with the parent (layout_), the other deals with the child.<br />
<br />
http://stackoverflow.com/questions/13965883/what-is-exact-difference-between-gravity-and-layout-gravityAnonymousnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-32541926768003546932014-11-24T23:01:00.001-08:002014-11-24T23:02:54.037-08:00How Nginx computes the ETag header for files.Curious how the ETag: header is generated in Nginx?<br />
<br />
Turns out it's a combination of the last modified time and the content length:<br />
<pre class="prettyprint">etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
r->headers_out.last_modified_time,
r->headers_out.content_length_n)
- etag->value.data;
</pre><br />
You can determine the last modified time in hex by using this Unix line:<br />
<pre class="prettyprint">printf "%x" $(stat -c%Y <file>)
</pre><br />
The content length is determined here:<br />
<pre class="prettyprint">stat --format="%s" <file>
</pre>Anonymousnoreply@blogger.com2tag:blogger.com,1999:blog-4137806788465333774.post-46445928713792273642014-11-09T15:17:00.002-08:002014-11-09T15:27:52.054-08:00Implementing Splunk SSO with Google AppsTrying to setup Splunk with Google Apps authentication? <br />
<br />
1. You can download a reverse proxy module for Nginx released by Bit.ly's engineering team. It requires installing Go (apt-get install go). You can compile it by typing go build, and the binary should be built. The download link is listed below:<br />
<br />
<a href="https://github.com/bitly/google_auth_proxy">https://github.com/bitly/google_auth_proxy</a><br />
<br />
The instructions in the <a href="https://github.com/bitly/google_auth_proxy/blob/master/README.md">README</a> walk you through what you need to do to setup with Google's API console. Since Google is <a href="https://developers.google.com/accounts/docs/OpenID">phasing out OpenID support</a>, using Google Oauth is now the expected way to authenticate. <br />
<br />
To start running the proxy, you'll need the accepted Google Apps domain, the callback URL (should end with /oauth2/callback), client ID, and client secret from the Google API console.<br />
<br />
<pre class="prettyprint">./google_auth_proxy -cookie-domain=mydomain.com -cookie-secret=abcd -google-apps-domain=googleappsdomain.com -http-address=127.0.0.1:4180 -redirect-url=http://myhost.com/oauth2/callback -upstream=http://www.cnn.com --client-id=1234.apps.googleusercontent.com --client-secret=1234
</pre>
<br />
2. Setup your Nginx configuration to reverse proxy to 4180:<br />
<br />
<pre class="prettyprint">server {
listen 80;
location / {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 30;
}
}
</pre>
<br />
3. Next, you'll have to setup your configuration in etc/system/local/web.conf with this config. The goal is to use the email address used during login, which gets passed as X-Forwarded-Email, to Splunk. SSOMode set to strict will require all logins to depend on this header. The tools.proxy.on seems to be used for older Apache reverse proxy setups, but doesn't need to be used for this setup.<br />
<br />
<pre class="prettyprint">SSOMode = strict
trustedIP = 127.0.0.1
remoteUser = X-Forwarded-Email
tools.proxy.on = False
</pre>
<br />
4. Before you restart Splunk, make sure to create your usernames as the email address. If you need to rename your existing ones, you'll need to edit the Splunk etc/passwd entries manually. <br />
<br />
5. Once you restart, Splunk provides a /debug/sso endpoint, which lets you verify that the X-Forwarded-Email is being set correctly. If you have any issues, turn off SSOMode = permissive until your are confident that the reverse proxy is setup correctly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.imgur.com/MuTEM4a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://i.imgur.com/MuTEM4a.png" height="56" width="320" /></a></div>
<br />Anonymousnoreply@blogger.com1tag:blogger.com,1999:blog-4137806788465333774.post-38601985292650951772014-10-21T23:49:00.003-07:002014-10-21T23:49:44.120-07:00Why do you need colons for gesture recognizersApparently stuff that interacts with Objective C API's needs them..<br />
<br />
<a href="http://stackoverflow.com/questions/24007650/selector-in-swift">http://stackoverflow.com/questions/24007650/selector-in-swift</a><br />
<br />
<a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-XID_26">https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-XID_26</a><br />
<br />Anonymousnoreply@blogger.com1tag:blogger.com,1999:blog-4137806788465333774.post-60000311393714779592014-10-21T23:45:00.002-07:002014-10-21T23:45:54.671-07:00What does the parenthesis in Swift does..<a href="http://stackoverflow.com/questions/24071334/blocks-on-swift-animatewithdurationanimationscompletion">http://stackoverflow.com/questions/24071334/blocks-on-swift-animatewithdurationanimationscompletion</a><br />
<br />
<div style="background: rgb(255, 255, 255); border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The completion parameter in animateWithDuration takes a block which takes one boolean parameter. In swift, like in Obj C blocks, you must specify the parameters that a closure takes:</div>
<pre class="default prettyprint prettyprinted" style="background: rgb(238, 238, 238); border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="typ" style="background: transparent; border: 0px; color: #2b91af; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">UIView</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">animateWithDuration</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="lit" style="background: transparent; border: 0px; color: maroon; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">0.2</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> animations</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">self</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">blurBg</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">alpha </span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="lit" style="background: transparent; border: 0px; color: maroon; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">1</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">},</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> completion</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">value</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background: transparent; border: 0px; color: #2b91af; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">Bool</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">in</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">self</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">blurBg</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">hidden </span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">true</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">})</span></code></pre>
<div style="background: rgb(255, 255, 255); border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The important part here is the <code style="background: rgb(238, 238, 238); border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;">(value: Bool) in</code>. That tells the compiler that this closure takes a Bool labeled 'value' and returns void.</div>
<div style="background: rgb(255, 255, 255); border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
For reference, if you wanted to write a closure that returned a bool the syntax would be</div>
<pre class="default prettyprint prettyprinted" style="background: rgb(238, 238, 238); border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">{(</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">value</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background: transparent; border: 0px; color: #2b91af; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">Bool</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">-></span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">bool</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background: transparent; border: 0px; color: darkblue; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">in</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background: transparent; border: 0px; color: grey; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">//your stuff</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span></code></pre>
Anonymousnoreply@blogger.com1tag:blogger.com,1999:blog-4137806788465333774.post-8222438382687430992014-10-16T15:16:00.002-07:002014-10-16T15:16:34.795-07:00pip lxml failsNot sure when these errors started showing up for lxml, but pip install lxml started failing without disabling these CLANG options:
<pre class="lang-py prettyprint prettyprinted" style="background: rgb(238, 238, 238); border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.8048000335693px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">export CFLAGS</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">=-</span><span class="typ" style="background: transparent; border: 0px; color: #2b91af; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">Qunused</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">-</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">arguments
export CPPFLAGS</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">=-</span><span class="typ" style="background: transparent; border: 0px; color: #2b91af; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">Qunused</span><span class="pun" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">-</span><span class="pln" style="background: transparent; border: 0px; font-size: 14px; margin: 0px; padding: 0px; vertical-align: baseline;">arguments</span></code></pre>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4137806788465333774.post-34084086201797433532014-10-03T11:15:00.000-07:002014-10-03T12:19:03.470-07:00Internet Explorer 10's new compatibility view listLinkedIn is listed as Emulate-IE9, which explains why anyone logging in via LinkedIn authentication has a User-Agent string that denotes IE9 even though they may have a later IE version.<br />
<br />
<a href="https://community.mcafee.com/thread/58177?start=0&tstart=0">https://community.mcafee.com/thread/58177?start=0&tstart=0</a><br />
<br />
<a href="http://iecvlist.microsoft.com/IE10/1152921505002013023/iecompatviewlist.xml">http://iecvlist.microsoft.com/IE10/1152921505002013023/iecompatviewlist.xml</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-5189205369861501682014-09-21T20:57:00.003-07:002014-09-23T14:04:30.142-07:00Why themes are not taken into account when using custom ArrayAdapters..While trying to implement basic extensions of ArrayAdapter with a ListView (see<br />
<a href="https://github.com/thecodepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView">https://github.com/thecodepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView</a>), I noticed none of the themes that I used was being followed by the adapter:<br />
<pre class="prettyprint"> if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_user, parent, false);
}
</pre>
<br />
It turns out that the use of getContext() matters a lot. I found that if I used parent.getContext(), the styles do get applied.<br />
<pre class="prettyprint"> if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_user, parent, false);
}
</pre>
<br />
Here is more background of why getContext() use matters..<br />
<br />
<a href="http://www.doubleencore.com/2013/06/context/">http://www.doubleencore.com/2013/06/context/</a><br />
<br />
The less obvious issue is inflating layouts. If you read my last piece on layout inflation, you already know that it can be a slightly mysterious process with some hidden behaviors; using the right Context is linked to another one of those behaviors. While the framework will not complain and will return a perfectly good view hierarchy from a LayoutInflater created with the application context, the themes and styles from your app will not be considered in the process. This is because Activity is the only Context on which the themes defined in your manifest are actually attached. Any other instance will use the system default theme to inflate your views, leading to a display output you probably didn’t expect.<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4137806788465333774.post-55879909724164343022014-08-28T08:25:00.002-07:002014-09-17T13:55:34.353-07:00Patching OpenSSL in PythonUbuntu 14.04 comes with a newer version of OpenSSL 1.0.1, which can cause TLS Client Hello messages on some web servers to break (<a href="https://github.com/ssllabs/research/wiki/Long-Handshake-Intolerance">https://github.com/ssllabs/research/wiki/Long-Handshake-Intolerance</a>), especially when sending a handshake of more than 255 bytes. With additional cipher suites and extensions, this number can easily exceed the expected amount. By doing a tshark capture on port 443, we can see that the actual payload is 267 bytes:<br />
<pre class="prettyprint">tshark port 443
SSL Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 267
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 263
Version: TLS 1.2 (0x0303)
Random
gmt_unix_time: Aug 26, 1973 10:35:41.000000000 UTC
random_bytes: 46f445e55a639f227706f911bac2c2b312e64fa6f95dd630...
Session ID Length: 0
Cipher Suites Length: 86
Cipher Suites (43 suites)
</pre>
How to avoid this issue? If you're using the Python requests library, one way is to take advantage of the PyOpenSSL extensions that will patch the underlying SSL implementation (<a href="https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py">https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py</a>). This way, you don't need to get into the nitty/gritty details of patching the code yourself. <br />
<br />
In order to do so, you must first install the libffi-dev package before doing a pip install:<br />
<pre class="prettyprint">pip install pyopenssl ndg-httpsclient pyasn1</pre>
The requests library automatically tries to import this library (see <a href="https://github.com/kennethreitz/requests/blob/master/requests/__init__.py#L51-56">https://github.com/kennethreitz/requests/blob/master/requests/__init__.py#L51-56</a>), but in order to fix the above issue, you may have to set the DEFAULT_SSL_CIPHER_LIST to MEDIUM instead of DEFAULT. Note: do not make this change unless you understand the implications to reduce the cipher strength. For more options, see <a href="https://www.openssl.org/docs/apps/ciphers.html">https://www.openssl.org/docs/apps/ciphers.html</a>.<br />
<pre class="prettyprint"># Attempt to enable urllib3's SNI support, if possible
from requests.packages.urllib3.contrib import pyopenssl
pyopenssl.inject_into_urllib3()
pyopenssl.DEFAULT_SSL_CIPHER_LIST = "MEDIUM"
</pre>
One other issue to note: pip installs also rely on the requests library, so adding this change will also enable certificate validation. Be sure to be using pip v1.5.6 since older pip installs have <a href="https://github.com/kennethreitz/requests/issues/1887">301/302 redirect issues</a> when using this package.
<br />
<br />
Addendum: you can download <a href="https://github.com/iSECPartners/sslyze/releases">https://github.com/iSECPartners/sslyze/releases</a> and use sslyze.py to probe the supported ciphers (i.e. python sslyze.py --sslv3 www.google.com). AES-128 and AES-256 based encryption may need to be added to your cipher list.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4137806788465333774.post-91558010024868033662014-08-23T09:26:00.003-07:002014-08-23T09:31:33.128-07:00Fixing the Jenkins scm-sync-configuration pluginI've often found that anytime you upgrade <a href="http://jenkins-ci.org/">Jenkins</a> versions, the plug-ins that accompany it often break. The other day, the <a href="https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin">scm-sync-configuration plugin</a> that helps manage and store the XML-based configuration files stopped working after upgrading to Ubuntu 14.04 and the Jenkins package included with it. The plugin appeared to copy files to the scm-sync-configuration/ directory but never seemed to commit the changes to the Git repo. What was wrong?<br />
<br />
It turns out that the <a href="https://issues.jenkins-ci.org/browse/JENKINS-22820">issue</a> was already reported since April 2014. The workaround for most people was to downgrade from Git 1.9, which comes with the Ubuntu 14.04 installs, to Git 1.8 versions. It so happens that the maven-scm-provider-git plugin on which this Jenkins plugin depends attempts to parse the output of the "git status". When the formatting change, it broke the ability to ascertain what changes had been made. The related ticket is here:<br />
<br />
<a href="https://jira.codehaus.org/browse/SCM-738">https://jira.codehaus.org/browse/SCM-738</a><br />
<br />
The issue for this Maven project was fixed subsequently, but the dependent packages that the scm-sync-configuration plugin had to be updated. Furthermore, you had to check that the maven-scm-api that has this fix actually got updated to 1.9.1, since missing one upgrade dependency meant that it would stay at an older version.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://imgur.com/yLamYvD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://imgur.com/yLamYvD.png" height="45" width="320" /></a></div>
<br />
The changes for this fix are here:<br />
<br />
<a href="https://github.com/jenkinsci/scm-sync-configuration-plugin/pull/21">https://github.com/jenkinsci/scm-sync-configuration-plugin/pull/21</a><br />
<br />
The other issue, which was much less obvious, was that there's a related XML file that determines what source code control systems are supported. For some reason, only Subversion (SVN) was declared, which broke tests for the Git-related ones. It wasn't so obvious until several hours of tracing through the source code and noticing that the ScmManager class only had one ScmProvider declared. Apparently this plugin uses a package called Plexus to load this information, which relies on XML configurations such as this file.Unknownnoreply@blogger.com0