tag:blogger.com,1999:blog-70470648298628405472024-03-13T19:18:48.329+01:00Matthias Kraaz' blogSoftware Developer. Judoka training at <a href="https://www.stefanbuben.org">Villa Vital</a>.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.comBlogger60125tag:blogger.com,1999:blog-7047064829862840547.post-54968426110259245832021-08-30T20:37:00.007+02:002021-09-01T08:15:44.552+02:00AWS EC2: price of maxed out burstable instance in unlimited mode<p>The T instance families, namely T2, T3, T3a, and T4g are burstable. They are designed for low to moderate CPU utilization with intermittent heavy spikes. At times of low CPU utilization below a AWS-defined baseline, your instance collects credits that later can be spent on times of high CU utilization.
<p>A credit gives you one minute of 100% CPU. The credits earned per hour are specified here: <a href="https://aws.amazon.com/ec2/instance-types/t2/">T2</a>, <a href="https://aws.amazon.com/ec2/instance-types/t3/">T3 and T3a</a>, <a href="https://aws.amazon.com/ec2/instance-types/t4/">T4g</a>.
<p>A burstable instance has a setting called "Credit specification" with the two options "standard" and "unlimited". This setting decides what happens if your instance runs out of credits: in standard mode, the CPU is gradually throttled to the baseline; in unlimited mode, the missing credits cost you surplus charges. See also the description of the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-standard-mode.html">standard mode</a> and <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode.html">unlimited mode</a> and the <a href="https://aws.amazon.com/ec2/pricing/on-demand/">EC2 pricing page</a>.
<p>The surplus charge is 0.05 $ per hour and vCPU. So, a maxed out instance costs you (vCPUs - (credits earned per hour / 60)) * 0.05 per hour.
<p>At the time of writing (2021-08-30), this gives for Linux (L) and Windows (W):
<table>
<tr><th>Type</th><th>Base $/hr (L)</th><th>Base $/hr (W)</th><th>Max $/hr (L)</th><th>Max $/hr (W)</th></tr>
<tr><td>t2.nano</td><td>0.00670</td><td>0.00900</td><td>0.05420</td><td>0.05650</td></tr>
<tr><td>t2.micro</td><td>0.01340</td><td>0.01800</td><td>0.05840</td><td>0.06300</td></tr>
<tr><td>t2.small</td><td>0.02680</td><td>0.03600</td><td>0.06680</td><td>0.07600</td></tr>
<tr><td>t2.medium</td><td>0.05360</td><td>0.07160</td><td>0.13360</td><td>0.15160</td></tr>
<tr><td>t2.large</td><td>0.10720</td><td>0.13520</td><td>0.17720</td><td>0.20520</td></tr>
<tr><td>t2.xlarge</td><td>0.21440</td><td>0.25540</td><td>0.36940</td><td>0.41040</td></tr>
<tr><td>t2.2xlarge</td><td>0.42880</td><td>0.49080</td><td>0.76130</td><td>0.82330</td></tr>
<tr><td>t3.nano</td><td>0.00600</td><td>0.01060</td><td>0.10100</td><td>0.10560</td></tr>
<tr><td>t3.micro</td><td>0.01200</td><td>0.02120</td><td>0.10200</td><td>0.11120</td></tr>
<tr><td>t3.small</td><td>0.02400</td><td>0.04240</td><td>0.10400</td><td>0.12240</td></tr>
<tr><td>t3.medium</td><td>0.04800</td><td>0.06640</td><td>0.12800</td><td>0.14640</td></tr>
<tr><td>t3.large</td><td>0.09600</td><td>0.12360</td><td>0.16600</td><td>0.19360</td></tr>
<tr><td>t3.xlarge</td><td>0.19200</td><td>0.26560</td><td>0.31200</td><td>0.38560</td></tr>
<tr><td>t3.2xlarge</td><td>0.38400</td><td>0.53120</td><td>0.62400</td><td>0.77120</td></tr>
<tr><td>t3a.nano</td><td>0.00540</td><td>0.01000</td><td>0.10040</td><td>0.10500</td></tr>
<tr><td>t3a.micro</td><td>0.01080</td><td>0.02000</td><td>0.10080</td><td>0.11000</td></tr>
<tr><td>t3a.small</td><td>0.02160</td><td>0.04000</td><td>0.10160</td><td>0.12000</td></tr>
<tr><td>t3a.medium</td><td>0.04320</td><td>0.06160</td><td>0.12320</td><td>0.14160</td></tr>
<tr><td>t3a.large</td><td>0.08640</td><td>0.11400</td><td>0.15640</td><td>0.18400</td></tr>
<tr><td>t3a.xlarge</td><td>0.17280</td><td>0.24640</td><td>0.29280</td><td>0.36640</td></tr>
<tr><td>t3a.2xlarge</td><td>0.34560</td><td>0.49280</td><td>0.58560</td><td>0.73280</td></tr>
<tr><td>t4g.nano</td><td>0.00480</td><td></td><td>0.07480</td><td></td></tr>
<tr><td>t4g.micro</td><td>0.00960</td><td></td><td>0.08960</td><td></td></tr>
<tr><td>t4g.small</td><td>0.01920</td><td></td><td>0.03920</td><td></td></tr>
<tr><td>t4g.medium</td><td>0.03840</td><td></td><td>0.11840</td><td></td></tr>
<tr><td>t4g.large</td><td>0.07680</td><td></td><td>0.16680</td><td></td></tr>
<tr><td>t4g.xlarge</td><td>0.15360</td><td></td><td>0.19360</td><td></td></tr>
<tr><td>t4g.2xlarge</td><td>0.30720</td><td></td><td>0.70220</td><td></td></tr>
</table>
<p>
As you can see, especially small instances cost you multiple times the base price if maxed out, while bigger instances get a little more expensive than their C5a counterparts. However, C5a instances give you 3.3 GHz per CPU, while T3a for example gives you only 2.2 GHz.
<p>
TL;DR: If you need a lot of CPU continuously, don't use burstable instances. Use one of the C families instead!Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-15382125894104842242021-02-27T08:16:00.003+01:002021-02-27T08:19:59.334+01:00Replace battery of Samsung CLX 6220 FX printerThe Samsung CLX 6220 FX printer needs a CR2032 to keep settings like date and time.
To replace it, remove the plastic cover at the back (2 screws at the top, 1 screw at the bottom). Result:
<div class="separator" style="clear: both;"><a href="https://1.bp.blogspot.com/-2Fd7CWliKfw/YDnxSJVqxKI/AAAAAAAANuc/Aq3ww8Z50LUNiZn5KrUu-nuOhal91uWZQCPcBGAsYHg/s2778/IMG_20210227_075512922_HDR.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" height="320" data-original-height="2778" data-original-width="2235" src="https://1.bp.blogspot.com/-2Fd7CWliKfw/YDnxSJVqxKI/AAAAAAAANuc/Aq3ww8Z50LUNiZn5KrUu-nuOhal91uWZQCPcBGAsYHg/s320/IMG_20210227_075512922_HDR.jpg"/></a></div>
Remove the metal cover (2 screws at the top). Result:
<div class="separator" style="clear: both;"><a href="https://1.bp.blogspot.com/-y4-uzNKm5lE/YDnxSA9nAOI/AAAAAAAANuc/abCfip70rr8GqyimYNW2QNFcsL_kx-1uwCPcBGAsYHg/s3111/IMG_20210227_075113000_HDR.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" height="320" data-original-height="3111" data-original-width="2140" src="https://1.bp.blogspot.com/-y4-uzNKm5lE/YDnxSA9nAOI/AAAAAAAANuc/abCfip70rr8GqyimYNW2QNFcsL_kx-1uwCPcBGAsYHg/s320/IMG_20210227_075113000_HDR.jpg"/></a></div>Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-25866374258657955052019-07-11T09:12:00.001+02:002019-07-11T09:12:23.540+02:00java.security.NoSuchAlgorithmExceptionExceptions with
<pre>java.security.NoSuchAlgorithmException: ... not available</pre>
in the stacktrace may be caused by overriding the system property java.ext.dirs.
Setting java.ext.dirs has been a popular but dangerous way for adding all jars within a directory to the classpath.
Java 9 finally removed the feature (https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-2C896CA8-927C-4381-A737-B1D81D964B7B).
Versions before Java 9 used the extension directories to find essential jars like sunjce_provider.jar, which contains a lot of algorithms required for SSL/TLS for example.
So if you set java.ext.dirs, you may experience exceptions as described above. Solutions:
a) include %JRE_HOME%/lib/ext respectively $JRE_HOME/lib/ext into the list of directories you set and hope that the environment variable JRE_HOME is set correctly or
b) (much better) use -classpath instead. java and javac accept wildcards in -classpath. JNI does not so you have to write some code to make the expansion yourself.
Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-12055668473358281372015-12-24T07:29:00.002+01:002015-12-24T07:29:54.820+01:00PC-Lint: using -estring to suppress MISRA-C warnings in the global wrap-upNeither the PC-Lint manual nor the Gimpel forum - at least at the time of writing - gives a good recommendation how to suppress MISRA-C warnings in the global wrap-up.
This issue pertains for example to the message "Note 960: Violates MISRA 2004 Required Rule 8.9, undefined symbol", which is followed by the name of the undefined symbol. You might have defined this symbol in Assembler, therefore a suppression of this message for this specific symbol is adequate. However:
<ul>
<li>All suppressions that pertain to a specific location in the source code are useless, as this message is raised during global wrap-up, where none of these suppressions apply.
<li>-estring(960, "symbol name") is not specific enough: it suppresses most MISRA-C warning about that symbol, not only the violation of rule 8.9. That's only because most MISRA-C warning have message code 960 or 961. Otherwise this is just the right option to suppress message in the global wrap-up.
<li>-esym(960, 8.9) disables rules 8.9 for ALL symbols.
<li>-estring(960, "undefined symbol*symbol name") doesn't work either: it seems like the whole message text is not matched against the expression, only all parts of the message.
</ul>
Only through some experimentation I finally found the solution:
<code>
-estring(960, "undefined symbol", "symbol name")
</code>
Opposite to other options like -esym, the arguments of the -estring option seem to be AND-ed for the match, not OR-ed. Therefore the above -estring option suppresses the MISRA-C warning about undefined symbols just for "symbol name" and nothing else.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com3tag:blogger.com,1999:blog-7047064829862840547.post-3000920982525179312015-12-09T10:03:00.000+01:002015-12-09T10:03:19.013+01:00PC-Lint: Beware of +libclass defaultAfter using PC-Lint for several years in lots of projects, this one got me nevertheless today. Again.
<p>
It started as it had started in various projects before: a developer asking why this earns a warning in that file, but not in some header file. I checked with -vf and sure, the quiet header showed up as a library header. I searched the configuration for any +libdir directive or similiar when the familiarity of this problem struck me like thunder. So here this old but still current article goes:
<p>
Say you are using some libraries in your project and have disabled warnings from the headers of the libraries using the -wlib, -elib, or -elibsym options. Some of the platform configuration files created by Gimpel have a lot of -elib options, for example the ones for MS Windows.
<p>
To specify which header files are library header files, you use the +libclass, +libdir, +libh, and -library options.
<p>
Now here is the catch: the default setting for the +libclass option might classify most of your own header files as library headers and thus apply the relaxed rules for library code to your own code. If warnings appear or vanish when you shift code from one header to another without any apparent reason, it might got you too.
<p>
You can easily check if there is a problem with the classification of library headers using the -vf option: PC-Lint outputs for every header file whether it thinks it's a library header or not. You might be in for a surprise!
<p>
The default setting for +libclass is (foreign,angle), which means that all headers found via include path and all headers included with angles instead of quotes are library header files (if the -libh and -libdir options don't say otherwise).
<p>
This default setting is unfortunate, because I have seen a lot of projects where header files were put into separate directories named "inc" or "public" or something similar and were found via include path. If this holds for your project too, you'll want to change the configuration to +libclass(angle) or +libclass().Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com2tag:blogger.com,1999:blog-7047064829862840547.post-2378524318358271052014-12-21T18:14:00.002+01:002016-10-31T04:24:00.055+01:00Softwarearchitektur: Checkliste für Wartbarkeit-Szenarien<p>
Szenarien sind ein weit verbreitetes Mittel, um die Qualitätsanforderungen an eine Software zu konkretisieren. Beigetragen hat dazu sicherlich das Software Engineering Institute der Carnegie Mellon University mit seiner szenariobasierten Methode zur Bewertung von Architekturen, genannt <a href="http://www.sei.cmu.edu/architecture/tools/evaluate/atam.cfm">ATAM</a> (Architecture Tradeoff Analysis Method).
<p>
Szenarien kommen also in zwei Situationen zum Einsatz: bei der Anforderungsklärung, um eine passende Software Architektur zu definieren, sowie bei der Bewertung einer Software Architektur, ob die Qualtitätsanforderungen ausreichend adressiert werden.
<p>
Ein Szenario hat vor allem folgende Attribute:
<ul>
<li>
Stimulus: ein Ereignis, auf das die Software reagieren muss. Je nachdem, welches Qualitätsattribut durch das Szenario präzisiert wird (Wartbarkeit, Verläßlichkeit, Effizienz, etc), können das ganz unterschiedliche Dinge sein: die Installation der Software, eine Benutzereingabe, eine Nachricht von einem Fremdsystem, die Knappheit oder der Ausfall einer Resource, eine Änderungsanfrage vom Produktmanager oder noch was ganz anderes.
<li>
Response: die erwartete Reaktion der Software auf den Stimulus. Das kann die Beantwortung der Benutzereingabe, die Aufrechterhaltung des Betriebs trotz Teilausfalls oder die durchzuführenden Änderungen an der Software sein. Stimulus und Response sollten so konkret formuliert sein, dass tatsächlich eine Umsetzbarkeit durch den Architekten beziehungsweise eine Bewertung der Architektur möglich ist. Idealerweise ist die Metrik und der Zielwert für die Response exakt angegeben.
</ul>
<p>
Weitere Attribute können sein:
<ul>
<li> ein Name für das Szenario
<li> Quelle des Stimulus
<li> Umgebung, in der das Szenario abläuft: beim Endnutzer, beim Entwickler, während der Installation, im degradierten Betrieb etc.
<li> der Zielwert für die Repsonse
<li> die Metrik für die Messung des Zielwerts
<li> der Autor oder Ansprechpartner für Rückfragen
<li> eine ID
</ul>
<p>
Außerdem werden im Zuge einer Architekturbewertung natürlich alle Architekturentscheidungen, die eine Relevanz für das Szenario haben, diesem zugeordnet.
<p>
Bei der Arbeit mit Szenarien helfen Checklisten, alle wichtigen Details von Stimulus und Response zu erfassen und relevante Architekturentscheidungen zu identifizieren. Meine aktuelle Checkliste für Szenarien bezüglich Wartbarkeit sieht wie folgt aus:
<a href="http://1.bp.blogspot.com/-F51WSFTHYo0/VJb-w3epQ3I/AAAAAAAAAxs/8r38iTLnYIc/s1600/Modifiablity%2BScenario%2BCharacterization.png" imageanchor="1" ><img border="0" src="https://1.bp.blogspot.com/-F51WSFTHYo0/VJb-w3epQ3I/AAAAAAAAAxs/8r38iTLnYIc/s320/Modifiablity%2BScenario%2BCharacterization.png"></a>
<p>
Diese Checkliste basiert auf eigener Erfahrung und:
<ul>
<li> Appendix A Attribute Characteristics in ATAM: Method for Architecture Evaluation von Rick Kazman, Mark Klein, Paul Clements http://resources.sei.cmu.edu/library/asset-view.cfm?assetid=5177 und
<li> Applicability of General Scenarios to the Architecture Tradeoff Analysis Method von Len Bass, Mark Klein, Gabriel Moreno http://resources.sei.cmu.edu/library/asset-view.cfm?assetid=5637
</ul>
<p>
Feedback willkommen: Hilft Dir das so? Was würdest Du ergänzen?Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-58159990276738576812014-06-20T08:21:00.001+02:002014-06-20T08:24:28.116+02:00PC-Lint: -e??? and -elib(???) have not the effect you might expectSometimes I see -elib(???) in my clients' PC-Lint configuration. The intention is to suppress all but syntax errors from library headers. This doesn't work for two reasons. The first one: most syntax errors have a two digit error code, but not all. The reserved range for syntax errors is 1 - 199. This is documented in the PC-Lint manual.
<p>
The second reason really took me by surprise as I found out that -elib(???) also suppresses error code 10. I tested this with PC-Lint 9.00k and also the current beta version 9.00k2 and also with -e???. I was informed by the Gimpel support that <i>for historical reasons, a pattern consisting entirely of question marks is treated as a star (*). This is something we recently reviewed and intend to change in the near future as the current behavior is not documented and, as you demonstrate, not intuitive.</i>
<p>
So -e??? and -elib(???) have the same effect as -e* and -elib(*) but won't give you the very deserved warning 686: <i>Option '-e*' is suspicious because of 'the likelihood of causing meaningless output'; receiving a syntax error inside a library file most likely means something is wrong with your Lint confinguration</i>. This warning also explains why you should never suppress syntax errors even from library headers. Except for the very rare causes where library headers raise syntax error even with a perfect PC-Lint configuration. You can find a few examples in the co-... files supplied by Gimpel.
And then you should only suppress that single syntax error, not all.
<p>
Instead of -elib(???) you should use -wlib(1). This actually suppresses all library messages except syntactic errors.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-89667479799801349342014-02-21T09:57:00.003+01:002014-07-15T20:18:02.715+02:00Fixing Outlook synchronization issue 0x000710D2 (no instances) when synchronizing Google CalendarI got annoyed with the following warning whenever Outlook synchronized my Google Calendar:
<code>
Task 'Internet Calendar Subscriptions' reported error (0x000710D2) : 'The VEVENT, "...", defined near line ..., contains a recurrence pattern that has no instances.'
</code>
<p>
So I downloaded the ICS (via the URL you had to enter when configuring the synchronization between Outlook and Google Calendar) and looked at the VEVENT at the specified line. There I found the name of the event and went to Google Calender to delete the problematic event. Alas, bummer: the search did not show up the event. Nor did scrolling through the calendar within the date range of the VEVENT.
<p>
So instead I made friends with the Google API explorer:
<ol>
<li>Go into Outlook account settings, find your internet calendar, and copy the URL address of the calendar.
<li>Paste that URL into a browser and go. Choose "save" When asked to save or open the file.
<li>Open the downloaded text file with some application that shows line numbers. Most text editors will do. You might as well use MS Excel.
<li>Scroll down to the vicinity of the line number cited in the offending error message. Verify that this is the troublemaker, and then find the line starting “UID: “. This is the iCalUID that you will need later.
<li>Go to the <a href="https://developers.google.com/apis-explorer/#p/calendar/v3/">Google Calendar API</a>
<li>Enable authentication with the OAuth slider on the right. A dialog "Select OAuth 2.0 scopes" pops up. Check both options and click Authorize
<li>Click calendar.calendarList.list and then Execute on the following page. Below the Execute button, two headlines Request and Response. If the Response is 401 Unauthorized, the previous step has failed. Try again. Otherwise you get a list of your calendars with each entry starting like this:
<code>
{
"kind": "calendar#calendarListEntry",
"etag": ...
"id": "THIS IS THE ID OF THE CALENDAR",
"summary": "THIS IS THE NAME OF THE CALENDAR",
</code>
Put down the ID of the calendar. The ID of your main calendar seems to be identical with your email address.
<li>Use calendar.events.list with the calendar ID and the iCalUID from the ICS. You should get only a single entry like this:
<code>
{
"kind": "calendar#event",
"etag": ...
"id": "THE ID THAT WE NEED",
"status": "confirmed",
...
"summary": "THIS IS THE NAME OF THE EVENT",
...
</code>
Put down the ID of the event. This ID seems to be just the same as the one in the ICS without @google.com at the. Just specifying the calendar ID should show up ALL events, but the problematic event showed up only if you specified its iCalUID.
<li>Use calendar.events.delete with the calendar ID and event ID to delete the event. Problem solved!
</ol>
<p>
In hindsight, you may as well go directly to calendar.events.delete and use your email address for calendarId and the ID from the ICS without @google.com for eventId. But no guarantee.
<p>
Now this was really fun. Felt a little like debugging sendmail via telnet on 25.
<p>
Update on May 28th 2014 because authorizaton changed and more explicit steps were requested.
<p>
Update on July 15th 2014: more details how to get the iCalUID. Thanks to Linda Stoutenburgh!Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com97tag:blogger.com,1999:blog-7047064829862840547.post-4947892620458552042014-02-20T09:40:00.001+01:002014-02-20T10:01:47.881+01:00Logging best practices and binary loggerThe splunk website offers some <a href="http://dev.splunk.com/view/logging-best-practices/SP-CAAADP6">logging best practices</a> that I'd like to compare with <a href="https://github.com/matthiaskraaz/binary-logger">binary logger</a>, a small library I wrote to reduce the load caused by logging on small embedded devices.
<p>
Here are the best practices and how binary logger relates to them:
<ul>
<li><b>Use clear key-value pairs.</b> This is also called structured logging and is one of the techniques recommended to try by the latest <a href="http://www.thoughtworks.com/radar/">ThoughtWorks technology radar</a>. With binary logger this is possible without ANY additional load on the embedded device (not ROM, not RAM, not CPU, not bandwidth).
<li><b>Create events that humans can read.</b> Obviously, binary logger can't offer this. You need a script (provided with the library) and the originally source code to decipher the binary log stream. On the other hand you can be really verbose in the decrypted log and strive for maximum readability without any load on the embedded device.
<li><b>Use timestamps for every event.</b> Do it! It doesn't cost you much with binary logger.
<li><b>Use unique identifiers (IDs).</b> See last point.
<li><b>Log in text format.</b> Again, this is where binary logger has its weakness.
<li><b>Use developer-friendly formats.</b> See first point: you are rather free in the format because it doesn't cost you any load on the embedded device.
<li><b>Log more than just debugging events.</b> Because logging with binary logger is very cheap on resources like stack, you might add logging messages where you couldn't with a standard logging facility.
<li><b>Use categories.</b> Adding categories to log messages costs you nothing on the embedded device with binary logger if you add them as static text.
<li><b>Identify the source.</b> The binary log stream format automatically contains the source of any log event, because it's needed for deciphering the binary log stream.
<li><b>Keep multi-line events to a minimum.</b> Do as you like with binary logger.
</ul>
<p>
I think the above best practices are really good advice. Binary logger might help you to follow them when the constraints of your embedded device would normally let you refrain from it. I'd love your feedback on this post and binary logger!Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-38372359371662824102014-01-13T08:31:00.001+01:002014-01-13T08:31:14.671+01:00Highly configurable source code formatting / indentation for Visual StudioThe latest release of <a href="http://clang.llvm.org/">Clang</a> incorporates a new tool: <a href="http://clang.llvm.org/docs/ClangFormat.html">clang-format</a>. clang-format is a highly configurable source code formatting tool for C, C++ and Objective-C code.
<p>
clang-format is available as a plugin for Visual Studio 2010 and later from the bottom of <a href="http://llvm.org/builds/">this page</a>. Just download and install, mark the source code to be formatted (Ctrl-A) and either select TOOLS|ClangFormat from the menu or simply press Ctrl-R Ctrl-F. This formats the selected code using the standard configuration. It also inserts and removes line breaks as seen fit.
<p>
There are multiple options how to give a different configuration to clang-format. Select TOOLS|Options from the menu and have a look:
<a href="http://2.bp.blogspot.com/-k6RdB4cwpPY/UtOSbvjFVBI/AAAAAAAAAmk/_kpfEk3qd_g/s1600/Screenshot+2014-01-13+08.11.26.png" imageanchor="1" ><img border="0" src="http://2.bp.blogspot.com/-k6RdB4cwpPY/UtOSbvjFVBI/AAAAAAAAAmk/_kpfEk3qd_g/s320/Screenshot+2014-01-13+08.11.26.png" /></a>
<p>
Comment if you like this or have a better tool at hand!Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-24258266572441644922013-11-16T12:34:00.001+01:002013-11-16T12:34:40.186+01:00Proof of concept: unload formatting of log messages from embedded deviceElecia White explains in <a href="http://www.amazon.de/Making-Embedded-Systems-Patterns-Software/dp/1449302149">Making Embedded Systems: Design Patterns for Great Software</a> how you should unload tasks from the device to the host to save precious processing power for things that must run on the device. This inspired me to show how you can offload the formatting of log messages from the device.
The result is a very simple C logging library for the device and a few nifty Ruby scripts for the host. The C library uses some processor magic to mark the logging messages for the Ruby scripts and create a shorthand syntax for outputting log messages.
There are still some things to do to turn it into production ready code like decoupling the logging library call and the actual output on the periphery. But hey, it's just a proof of concept!
You can find it at <a href="https://github.com/matthiaskraaz/binary-logger">https://github.com/matthiaskraaz/binary-logger</a>. There is also a job running on Travis-CI (<a href="https://travis-ci.org/matthiaskraaz/binary-logger">https://travis-ci.org/matthiaskraaz/binary-logger</a>) showing you the output of the latest version.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-71250116328359829042013-08-21T13:29:00.001+02:002013-08-21T13:29:05.611+02:00Disable dialog asking to debug or close programThis dialog is quite pesky if your unit tests run automatically and one of them crashes. Instead of the test executor being notified about the crash, the unit test sits there forever waiting for the user to react.
Of course the test executor could implement a timeout and shoot the process down. Another option is to disable the dialog. Just add the following to your registry:
<code>
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Debugger"="drwtsn32 -p %ld -e %ld -g"
"Auto"="1"
</code>
This activates Dr. Watson as the automatically selected debugger. Dr. Watson will create a crash dump for post-mortem debugging. Alternatively you can select some other debugger or tool, but you can't leave it empty for the solution to work.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-15580897180640572862013-04-09T21:07:00.000+02:002013-04-09T21:15:45.287+02:00How to debug an unexpected UAC promptRecently a self created executable showed the UAC prompt and it wasn't clear why. It sure didn't need administrative privileges. So how to debug this?
<p>
<a href="http://en.wikipedia.org/wiki/User_Account_Control">Wikipedia</a> tells the UAC prompt can be triggered by:
<ul>
<li>the "Run the program as an administrator" compatibility option. Just check the file properties
<li>the executable's manifest: if <tt>requestedExecutionLevel</tt> is present and is not <tt>asInvoker</tt>, the UAC prompt is triggered. An external manifest can be just opened with a text viewer. Also check for an embedded manifest: open the executable file in Visual Studio and check the RT_MANIFEST resource. If Visual Studio displays an error message that there are no resources, you are fine. Without resources there is no embedded manifest
<li>the <a href="http://blogs.msdn.com/b/uac/archive/2006/01/13/512776.aspx">UAC heuristic</a>: it checks the file name, the string resources, the manifest for keywords that indicate an installer
</ul>
<p>
In my case it was the UAC heuristic. To be specific, the UAC prompt was triggered by the long and cryptic (and automatically generated) file name. Some sequence in it told UAC that this must be an installer. So renaming the file fixed the problem - no UAC prompt any more.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com2tag:blogger.com,1999:blog-7047064829862840547.post-86028648051777095242013-04-05T14:40:00.004+02:002013-04-05T14:40:45.731+02:00Why backups if you have a NAS?I recently bought a Synology DS212j and set up a SHR (RAID1 with extra features). Then - after some <strike>toying</strike>thorough feature evaluation - I configured backup tasks using the Time Backup extension.
<p>
Why, you might ask, do you really think two hard disks are going to crash at the same moment?
<p>
No, I don't. But mirroring doesn't protect us against files being corrupted by faulty applications. Or accidentally deleted. Thanks to <a href="http://jefferai.org/2013/03/29/distillation/">Jeff Mitchell</a> for the reminder.
<p>
BTW: What IS the probability of two hard disks in a RAID array failing? Two hard disks from the same lot? With the exact same load through all their lifetime? Within the time frame that it takes to rebuild the RAID?Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-18090636714338694362013-04-05T14:07:00.001+02:002013-12-13T18:32:30.065+01:00Synology: Time Backup on DiskStation has failed. Please check the package log for further information.<p>
Today my new Synology DS212j notified me via email about: Time Backup on DiskStation has failed. Please check the package log for further information.
<p>
Aside from the email notification and missing versions in the timeline, I could not find any indication of the error nor its reason in the general web interface nor the Time Backup web interface.
<p>
Google told me that the Time Backup package log could be found at /var/log/timebkp.log.
<p>
So I logged in via <a href="http://forum.synology.com/wiki/index.php/Enabling_the_Command_Line_Interface">ssh</a> and found:
<code>
{WARN}{1365130850}{...}{Task [matthias] has failed to backup shared folder
[matthias] due to [error occurred while copying files].}
{ERR}{1365130850}{matthias}{Task [matthias] has failed to backup version
[20130405-0500] due to [error occurred while copying files].}
</code>
<p>
Not very informative. However, in the sibling /var/log/timebkp.debug I found:
<code>
Apr 05 00:00:54 [14260]BK_ERR:rsync return with error, return code = 41
</code>
<p>
Which led me to notify the file /var/log/rsync.error which hold the solution:
<code>
Apr 05 00:00:53 (14436) [ERROR] log.c (350): rsync: recv_generator:
mkdir "/volumeUSB1/usbshare/TimeBackup/..." failed: No space left on device (28)
</code>
<p>
I was first confused because the device had plenty of space left, but then realized that the ext4 file system had run out of inodes. I had originally provisioned the file system for another purpose and therefore reduced the inode count by factor 256. This and the habit of Time Backup to use lots of hard links which consume an inode per hard link had created the inode shortage.
<p>
As ext4 doesn't allow to increase the inode count I had to re-create the file system.
<p>
I plugged the hard disk back into the Synology and issued "Back Up Now" for all backup tasks. I had expected the version count to be reset to 1, but instead it retained the version count. Uneasy with this obvious difference between Time Backup and the content of the hard disk I resorted to deleting and re-creating all backup tasks. This seems to have done it.
<p>
Update 2013-12-13: The file system has run out of inodes again. Seems like you should use an above standard ratio of inodes to size for Time Backup.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com1tag:blogger.com,1999:blog-7047064829862840547.post-75339373514869057882013-02-16T07:53:00.000+01:002013-02-16T07:53:23.686+01:00I really like SnagIt the screen loggerRecently I was searching for a screen logger that would save my actions while trying to reproduce a hard to find bug. I found SnagIt, the <a href="http://www.drdobbs.com/joltawards/jolt-awards-utilities/240004295?pgno=4">award winning</a> software. And I really liked it.
First of all I was up and running with SnagIt in an instant. Getting the evaluation key, download, installation, firing it up - a matter of minutes.
The system under test was a PC simulation of a two channel medical device. Meaning: there are two processes monitoring each other with quite sharp timeouts. Meaning: any CPU intensive task might make the simulation go into safe state, because one of the channels doesn't get enough CPU time. SnagIt is light enough on the CPU to not disturb this quite sensitive application.
The third thing I noticed was the very nice end result: a quite small video file that exactly captured the application and my interaction with it. Perfect to be attached to a bug report.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-43305961017155950702012-12-08T13:04:00.001+01:002012-12-08T13:04:47.168+01:00PC-Lint might include wrong system header filesPC-Lint uses by default the environment variable INCLUDE to find system header files. This environment variable might not be set suitably, especially if you have multiple toolchains installed.
<p>
In my case I ended up with PC-Lint including Visual Studio header files when checking a Renesas HEW compiled code base. The worst: I got plausible results, so I found it out only accidentally when I switched on the -vf option.
<p>
Running PC-Lint with the -vf option from time to time is a good idea anyway to check which files are considered library headers or library modules, which files are actually processed and - which headers are included.
<p>
To fix the behavior of PC-Lint I suggest:
<code>
-incvar(PLEASE_IGNORE_INCLUDE)
</code>
This tells PC-Lint to use the environment variable PLEASE_IGNORE_INCLUDE instead of INCLUDE. I found no way to just tell PC-Lint not to use any environment variable, just how to change the name of the used environment variable.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-18738635649753065422012-11-12T17:29:00.000+01:002012-11-12T17:29:52.878+01:00Neuer Artikel: Technische Schulden in der UnternehmensarchitekturDie iX 10/2012 enthält einen neuen Artikel von Dr. Georg Molter über technische Schulden in Unternehmensarchitekturen, bei dem ich als Co-Autor mitwirken durfte, auch nachzulesen auf <a href="http://www.slideshare.net/Zuehlke_Engineering/ix-10-2012technische-schulden-in-der-unternehmensarchitekturgeorgmoltermatthiaskraaz">SlideShare</a>. Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-14418299635723411802012-09-07T12:09:00.000+02:002012-09-07T12:09:01.561+02:00Neuer Artikel über Softwarequalität und technische SchuldenDie aktuelle iX 9/2012 enthält einen neuen Artikel von mir über Softwarequalität und technische Schulden, auch nachzulesen auf <a href="http://www.slideshare.net/Zuehlke_Engineering/ix-9-2012vorsichtzinsenkraaz">slideshare</a>.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-53857503372625119992012-09-07T12:05:00.003+02:002012-09-07T12:06:21.726+02:00Wirtschaftlich testenEin neuer Artikel von mir in der aktuellen MED engineering 09-10/2012 über das wirtschaftliche Testen von Software (in Medizinprodukten), auch bei <a href="http://www.slideshare.net/Zuehlke_Engineering/wirtschaftlich-testen-softwaretests-in-der-medizintechnik-matthias-kraaz">slideshare</a> nachzulesen. Über das Thema werde ich auch auf der <a href="http://www.electronics-goes-medical.de/">Electronics goes medical</a> sprechen.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-47678410413996195862012-09-03T11:12:00.000+02:002012-09-03T11:12:42.709+02:00German article about software quality and technical debtThe iX current issue 9/2012 contains an article by me about software quality and technical debt. You can also read it on <a href="http://www.slideshare.net/Zuehlke_Engineering/ix-9-2012vorsichtzinsenkraaz">slideshare</a>.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-50757780874524199162012-04-11T16:34:00.002+02:002012-04-11T16:38:27.908+02:00BfR: Nickel und Duftstoffen in SpielzeugSind die Kleinen erst einmal sensibilisiert durch zuviel Nickel und Duftstoffen in Spielzeug und Kleidung, bleibt die Allergie ein Leben lang bestehen. Jeder Kontakt führt dann zu einer allergischen Reaktion. Leider sind die Grenzwerte viel zu hoch. Teilweise ist sogar unklar, ob die Grenzwerte nur für Kleidung oder auch Spielzeug gelten. Deswegen muss jeder selbst aufpassen, was er seinen Kindern kauft:
<a href="http://www.bfr.bund.de/cm/343/kontaktallergene-in-spielzeug-gesundheitliche-bewertung-von-nickel-und-duftstoffen.pdf">Kontaktallergene in Spielzeug</a>Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com1tag:blogger.com,1999:blog-7047064829862840547.post-2201476957840819682012-03-30T11:46:00.004+02:002012-04-10T10:27:01.536+02:00Things you should have in your rakefilesEnsure that stdout and stderr output is properly ordered and not neatly separated:
<code>
$stdout.sync=true
$stderr.sync=true
</code>
<p>
Always print stack trace on error instead of only if --trace option was given:
<code>
Rake.application.options.trace = true
</code>
<p>
Update 2012-04-10: More intrusive variant - enable stack trace on error but not progress messages:
<code>
module Rake
class Application
def standard_exception_handling
begin
yield
rescue SystemExit => ex
# Exit silently with current status
raise
rescue OptionParser::InvalidOption => ex
# Exit silently
exit(false)
rescue Exception => ex
# Exit with error message
$stderr.puts "Exception: #{ex.message}"
$stderr.puts ex.backtrace.join("\n")
exit(false)
end
end
end
end
</code>
<p>
Don't truncate rake -T output. Alternative to fiddling with environment variables:
<code>
Rake.application.terminal_columns = 999
</code>Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-73797801021018717982012-03-16T13:46:00.003+01:002012-03-16T19:48:19.932+01:00LNK2023: bad DLL or entry point 'msobj80.dll'Just kill the mspdbsrv.exe process, then build again.
<p>
Worked at least in my case. I had the inspiration for this approach after reading this <a href="http://connect.microsoft.com/VisualStudio/feedback/details/119683/32-bit-msobj80-dll-missing">post</a>.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0tag:blogger.com,1999:blog-7047064829862840547.post-71340762939584784532012-03-01T04:21:00.003+01:002012-03-01T04:27:55.066+01:00Vermeidung von KinderunfällenNeue Merkblätter zu Kinderunfällen können jetzt bei der Kassenärztlichen Bundesvereinigung heruntergeladen werden: <a href="http://www.kbv.de/presse/40919.html">http://www.kbv.de/presse/40919.html</a>
<p>Die Merkblätter beziehen sich jeweils auf ein bestimmtes Kindesalter, da sich die relevanten Unfallgefahren durch die Entwicklung des Kindes verändern. Pro Vorsorgeuntersuchung U1 bis U9 gibt es ein Merkblatt, das zu der jeweiligen Vorsorgeuntersuchung vom Arzt ausgegeben werden sollte, sowie ein allgemeines Merkblatt "A".
<p>Die Merkblätter sind eine Gemeinschaftsproduktion der Kassenärztlichen Bundesvereinigung (KBV), dem Berufsverband der Kinder- und Jugendärzte (bvkj) und den gesetzlichen Krankenkassen.Matthias Kraazhttp://www.blogger.com/profile/05817248726471959204noreply@blogger.com0