<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2882101181039237625</id><updated>2026-10-02T15:06:52.976-06:00</updated><category term="c"/><category term="c++"/><category term="emacs"/><category term="howto"/><category term="FileChooserDialog"/><category term="argument"/><category term="bsod"/><category term="cheat sheet"/><category term="fake bsod"/><category term="function pointer"/><category term="gcc cpp macro"/><category term="gtk"/><category term="gtk python pygtk liststore treestore treeview mvc cellrenderer treeviewcolumn howto"/><category term="kernel threads"/><category term="keys"/><category term="parameter"/><category term="pygtk"/><category term="python"/><category term="ransomware"/><category term="return"/><category term="typedef"/><category term="visual studio"/><category term="windows"/><title type='text'>Emacs Junkie</title><subtitle type='html'>Archive of thoughts, ideas, and knowledge.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-7443350459186156470</id><published>2020-03-29T10:13:00.000-06:00</published><updated>2020-03-29T11:08:17.668-06:00</updated><title type='text'>13 Pin Accessory Connector CAT for IC-706 Rig</title><content type='html'>I am an amateur radio operator (extra class, call sign: N7DSP) and I made a rig control interface cable for my Icom 706 many years ago.  I&#39;ve been working from home during this COVID-19 quarantine and have had a little time to get it back up and running with the hope of getting email via Winlink 2000 up and running.&lt;br /&gt;
&lt;br /&gt;
To my surprise, I couldn&#39;t remember how to get the dang thing working with fldigi (http://www.w1hkj.com/) so I&#39;m trying to capture that information here.&lt;br /&gt;
&lt;br /&gt;
The interface cable I made apparently used the USB to RS232&#39;s RTS line to signal the radio to transmit (or virtually to push the PTT or push-to-talk button) so that was the first mystery.  The second mystery was that I needed to use a &quot;separate serial port&quot; under the &quot;hardware ptt&quot; tab even though both USB devices turned out to be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Cables&lt;/h4&gt;&lt;br /&gt;
The green 8mm stereo jack line is my transmit audio cable and should be hooked up to the headphones or line out jack, a second separate 8mm stereo cable (not connected to the USB, green audio, or 13-pin accessory cable) needs to attach to the phones line on my front panel and it should hook up to the line in or microphone jack on my computer.&lt;br /&gt;
&lt;br /&gt;
The black cable attached to the 13-pin accessory jack connector with an 8mm stereo connector is for the CV-I interface (multi-drop serial port that Icom uses to control radios) and hooks up in the back of the 706. It connects to the 8mm jack that is closest to the 8p8c (colloquially known as the RJ45 jack) used for the HM-103 mic.&lt;br /&gt;
&lt;br /&gt;
The remaining black cable is the USB cable which is an RS232 serial emulator chip and cable and needs to be plugged into a free USB port, I&#39;m assuming above that it&#39;s the only USB serial port you&#39;ve plugged in otherwise the &quot;device&quot; might be /dev/ttyUSB1 or /dev/ttyUSB2 or something.&lt;br /&gt;
&lt;br /&gt;
With the below fldigi settings, if you run fldigi and the radio isn&#39;t powered and the USB control cable isn&#39;t plugged into your computer, fldigi will not start!  Once you plug in the USB cable and power the radio it will run.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Settings&lt;/h4&gt;&lt;br /&gt;
Here is a summary of the settings I need for my interface cable:&lt;br /&gt;
Rig Control:&lt;br /&gt;
Use Hamlib: checked&lt;br /&gt;
Rig: Icom IC-706&lt;br /&gt;
Device: /dev/ttyUSB0  (add yourself to the dialout group on Ubuntu to get permissions correct, else chmod 777 /dev/ttyUSB0 everytime you want to use it)&lt;br /&gt;
Baud rate: 19200&lt;br /&gt;
Stopbits: 1&lt;br /&gt;
All other settings at defaults which are:&lt;br /&gt;
Retries: 3&lt;br /&gt;
Retry interval: 1000&lt;br /&gt;
Write delay: 0&lt;br /&gt;
Post write delay: 0&lt;br /&gt;
PTT via hamlib command: unchecked&lt;br /&gt;
Audio on Auxiliary port: unchecked&lt;br /&gt;
DTR +12: unchecked&lt;br /&gt;
RTS +12: unchecked&lt;br /&gt;
RTS/CTS flow control: unchecked&lt;br /&gt;
XON/XOFF flow control: unchecked&lt;br /&gt;
CW is LSB mode: unchecked&lt;br /&gt;
RTTY is USB mode: unchecked&lt;br /&gt;
Sideband: Rig mode&lt;br /&gt;
Mode delay: 200&lt;br /&gt;
Polling Interval: 250&lt;br /&gt;
Advanced configuration: &lt;empty&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl9r6v0Q8VvQ6i21d7v9ueWpvQP3iryOct0O_Y9VJWHgM9n7kDIR78Epk6U3BstwA2tnjJl9EjljXvKuUfdYAt_2xHmVi3BnfIowDUvVxKbHqbb-knyRNsARMQpAAzJIGpeqMBLO_xrfA/s1600/hamlib.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl9r6v0Q8VvQ6i21d7v9ueWpvQP3iryOct0O_Y9VJWHgM9n7kDIR78Epk6U3BstwA2tnjJl9EjljXvKuUfdYAt_2xHmVi3BnfIowDUvVxKbHqbb-knyRNsARMQpAAzJIGpeqMBLO_xrfA/s320/hamlib.png&quot; width=&quot;320&quot; height=&quot;243&quot; data-original-width=&quot;600&quot; data-original-height=&quot;455&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware PTT:&lt;br /&gt;
PTT tone on right audio channel: unchecked&lt;br /&gt;
h/w ptt device-pin&lt;br /&gt;
Use separate serial port PTT: checked&lt;br /&gt;
Use RTS: checked&lt;br /&gt;
RTS = +V: unchecked&lt;br /&gt;
Use DTR: unchecked&lt;br /&gt;
DTR = +V: unchecked&lt;br /&gt;
Device: /dev/ttyUSB0&lt;br /&gt;
Use parallel port PTT: unchecked&lt;br /&gt;
PTT delays valid for all CAT/PTT types&lt;br /&gt;
Start of trasmit PTT delay: 0&lt;br /&gt;
PTT end of transmit delay: 0&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifAhsI8G1wmgIh8OmZjt_0zez_bGdXj2PsTPWePmHNOcky7TIuLpHeE967PGM5ch9FKiOBpQzMouiOEV8RTH76tzMsO59A19GoUHJhSJCFeVYKq0p66nds0zMkoY2Rhw0nAJOApmUsfHA/s1600/hardwareptt.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifAhsI8G1wmgIh8OmZjt_0zez_bGdXj2PsTPWePmHNOcky7TIuLpHeE967PGM5ch9FKiOBpQzMouiOEV8RTH76tzMsO59A19GoUHJhSJCFeVYKq0p66nds0zMkoY2Rhw0nAJOApmUsfHA/s320/hardwareptt.png&quot; width=&quot;320&quot; height=&quot;243&quot; data-original-width=&quot;600&quot; data-original-height=&quot;455&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
While debugging all of this, occasionally the PTT button would get stuck &quot;on&quot; so I wrote this python script to force it back off:&lt;br /&gt;
&lt;pre&gt;#!/usr/bin/python3
import serial

ser = serial.Serial()
ser.baud = 19200
ser.port = &amp;apos;/dev/ttyUSB0&amp;apos;
ser.setRTS(0)
ser.setDTR(0)
ser.open()
ser.close()
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/7443350459186156470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/7443350459186156470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7443350459186156470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7443350459186156470'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2020/03/13-pin-accessory-connector-cat-for-ic.html' title='13 Pin Accessory Connector CAT for IC-706 Rig'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl9r6v0Q8VvQ6i21d7v9ueWpvQP3iryOct0O_Y9VJWHgM9n7kDIR78Epk6U3BstwA2tnjJl9EjljXvKuUfdYAt_2xHmVi3BnfIowDUvVxKbHqbb-knyRNsARMQpAAzJIGpeqMBLO_xrfA/s72-c/hamlib.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-2686078598906055097</id><published>2015-07-22T23:27:00.001-06:00</published><updated>2015-07-22T23:28:37.515-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bsod"/><category scheme="http://www.blogger.com/atom/ns#" term="fake bsod"/><category scheme="http://www.blogger.com/atom/ns#" term="howto"/><category scheme="http://www.blogger.com/atom/ns#" term="ransomware"/><title type='text'>Fake BSOD Ransomware</title><content type='html'>&lt;h2&gt;Background&lt;/h2&gt;&lt;br /&gt;
Tonight a loved one&#39;s computer was hit by ransomware.  I rarely have to deal with viruses and malware because I run only Linux and OS X at home.  That&#39;s not to say that neither of those platforms are without security issues--they&#39;re not.  It comes down to numbers.  OS X has maybe 10% of the desktop market share and Linux has may 1%.  In a ransomware scheme it&#39;s all about getting it in front of as many people as you can.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;The problem&lt;/h2&gt;&lt;br /&gt;
A very unconvincing &quot;blue screen of death&quot; was displayed with a customer support number to call.  Surely if I called a friendly customer support rep. would have fixed my problem for a small fortune.  The going rate seems to be around $150 if my googling is accurate.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;The Solution (sort of)&lt;/h2&gt;Anyway, most online resources instruct you to do the following to remove this ransomeware:&lt;br /&gt;
(quoting from &lt;a href=&quot;http://sdpcfix.com/computer-security/ransomlock-fake-blue-screen-tech-support-scam/&quot;&gt;http://sdpcfix.com/computer-security/ransomlock-fake-blue-screen-tech-support-scam/&lt;/a&gt;)&lt;br /&gt;
&lt;blockquote&gt;1. Press Ctrl+Alt+Del&lt;br /&gt;
2. Open Task Manager&lt;br /&gt;
3. Look for the ransomware entry on the Processes tab, which should be ‘diagnostics.exe’, and end the process.&lt;br /&gt;
4. Go to the registry editor by clicking on Start -&amp;gt; Run -&amp;gt; Typing ‘regedit’ and pressing enter.&lt;br /&gt;
5. Delete the following registry entry: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\”Diagnostics” = “[PATH TO MALWARE]”&lt;br /&gt;
6. Delete the file folder from the directory.&lt;/blockquote&gt;&lt;br /&gt;
Ok, sounds reasonable.  Unfortunately for me, this particular version had a few tricks up its sleave.  First, I couldn&#39;t move the mouse away from the top lefthand corner of the screen.  Second, the BSOD drew itself on top of all other windows so starting task manager or cmd.exe or anything else useful was, well, kind of useless.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;The Solution (for real)&lt;/h2&gt;Over time I realized that at least the keyboard focus was still going to the current window, so using Alt-tab I could navigate from the BSOD to cmd.exe and task manager and anything else I needed.  I also found that when I held Alt-tab down I could see the selected window briefly, but the Alt-tab menu itself often occluded important information.  After letting go, however, the BSOD would draw over it again.  Ugh.  The last discovery that I needed to lick this one was that hitting Ctrl+Alt+Del then selecting task manager let me use the mouse for a second and then if I hovered the mouse over the task manager icon or the cmd.exe icon on the start menu bar then I could see selected window in its entirety!&lt;br /&gt;
&lt;br /&gt;
Being a Linux guy I&#39;m still appalled at how crappy Microsoft&#39;s command line utilities are.  I finally googled enough to find:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;dir /b /s &lt;glob&gt;&lt;/blockquote&gt;That lets you list files recursively.&lt;br /&gt;
&lt;blockquote&gt;tasklist /v&lt;/blockquote&gt;Shows running tasks and their run times.&lt;br /&gt;
&lt;blockquote&gt;taskkill /f /im &amp;lt;glob&amp;gt;.exe&lt;/blockquote&gt;Kills a task matching the glob expression.&lt;br /&gt;
&lt;br /&gt;
Using those commands and with the Ctrl+Alt+Del and Alt-Tab tricks above I was finally able to find the offending process.  Final trick up this ransomware&#39;s sleave: the process was called &quot;windows.exe&quot;, not &quot;diagnostics.exe&quot; like above.  It was pretty satisfying to kill that nasty with taskkill.  A quick search then yielded its location: c:\Users\Public\windows.exe (or close to that, I didn&#39;t write it down).&lt;br /&gt;
&lt;br /&gt;
So kids if you&#39;re hit with a nasty fake BSOD that doesn&#39;t let you use your mouse, don&#39;t give up just be on the lookout for &quot;windows.exe&quot;.&lt;br /&gt;
&lt;br /&gt;
(I wish I&#39;d written down the tech. support phone number.)&lt;br /&gt;
&lt;br /&gt;
As recommended above, delete &quot;windows.exe&quot; and remove the corresponding &quot;Run&quot; key from the registery.&lt;br /&gt;
&lt;br /&gt;
(BTW, I was able to run regedit in safe mode, but for some reason I missed the c:\Users\Public\windows.exe &quot;Run&quot; key when I looked for it.  Finding it there would have been a much faster way to resolve this.)&lt;br /&gt;
(Also BTW, this was Windows 8 if that matters.)&lt;br /&gt;
&lt;br /&gt;
&lt;/glob&gt;&lt;/glob&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/2686078598906055097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/2686078598906055097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2686078598906055097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2686078598906055097'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2015/07/fake-bsod-ransomware.html' title='Fake BSOD Ransomware'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-1368705356858899402</id><published>2012-04-10T23:02:00.001-06:00</published><updated>2012-04-10T23:02:24.888-06:00</updated><title type='text'>GNU Global in vim (and emacs!)</title><content type='html'>I know, I know, this blog is for emacs, but Wade&#39;s post on getting GNU global to work with vim was too good to pass up.&amp;nbsp; (Thanks for the shout out, Wade.) I&#39;ve been meaning to write a similar post for emacs for years.&amp;nbsp; Enjoy...&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://wadeberrier.blogspot.com/2012/04/source-code-navigation-with-vim.html&quot;&gt;http://wadeberrier.blogspot.com/2012/04/source-code-navigation-with-vim.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/1368705356858899402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/1368705356858899402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/1368705356858899402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/1368705356858899402'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2012/04/gnu-global-in-vim-and-emacs.html' title='GNU Global in vim (and emacs!)'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-7349144493664279873</id><published>2012-01-02T12:30:00.000-07:00</published><updated>2012-01-02T16:34:32.056-07:00</updated><title type='text'>Binding or Setting Function Keys in GNU Emacs</title><content type='html'>After learning the basics of emacs, you&#39;ll want to start customising your keys.&amp;nbsp; Function keys are a great place to start since few have default bindings in the stock emacs.&lt;br /&gt;
&lt;br /&gt;
For instance.&amp;nbsp; If you&#39;re a C, C++, or Java developer you&#39;ll likely want to compile from within emacs so that you can easily jump to compiler errors.&lt;br /&gt;
&lt;br /&gt;
Last I checked, there is no default key binding for doing this besides &lt;br /&gt;
&lt;pre&gt;M-x compile&lt;/pre&gt;
(to set the compile command) and &lt;br /&gt;
&lt;pre&gt;M-x recompile&lt;/pre&gt;
(to instantly compile after the compile command has been set.)&lt;br /&gt;
&lt;br /&gt;
I like to compile with F9 (force of habit from an old tool), debug with F10, and set my compile string with F11.&lt;br /&gt;
&lt;br /&gt;
For the above key bindings, add this to the end of your .emacs file:&lt;br /&gt;
&lt;pre&gt;(global-set-key [f9] &#39;recompile)
(global-set-key [f10] &#39;gdb)
(global-set-key [f11] &#39;compile)
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/7349144493664279873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/7349144493664279873' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7349144493664279873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7349144493664279873'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2012/01/binding-or-setting-function-keys-in-gnu.html' title='Binding or Setting Function Keys in GNU Emacs'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-2879653227580587216</id><published>2011-12-07T22:40:00.001-07:00</published><updated>2011-12-18T22:36:42.321-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="argument"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="c++"/><category scheme="http://www.blogger.com/atom/ns#" term="function pointer"/><category scheme="http://www.blogger.com/atom/ns#" term="howto"/><category scheme="http://www.blogger.com/atom/ns#" term="parameter"/><category scheme="http://www.blogger.com/atom/ns#" term="return"/><category scheme="http://www.blogger.com/atom/ns#" term="typedef"/><title type='text'>How to return a function pointer without a typedef in C/C++</title><content type='html'>The intertubes are full of examples on how to use function pointers in C/C++.  Most try to simplify things by typedef&#39;ing the function signature.  What if you&#39;re a glutton for punishment like me and want to do it the &quot;hard&quot; way?&lt;br /&gt;
&lt;br /&gt;
Ok, here&#39;s the background.  Let&#39;s say you want to be able to find the cosine of an array of doubles, but you also want to be able to find the sine, tangent, etc.&lt;br /&gt;
&lt;br /&gt;
You could do this:&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_sin&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] = &lt;span style=&quot;color: #2040a0;&quot;&gt;sin&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_cos&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] = &lt;span style=&quot;color: #2040a0;&quot;&gt;cos&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_tan&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] = &lt;span style=&quot;color: #2040a0;&quot;&gt;tan&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] *= &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;];
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
But this leaves a lot to be desired.  Each operation requires a new function that is nearly identical to all the rest.  Can&#39;t we factor out the commonality?&lt;br /&gt;
&lt;br /&gt;
Ok, how about this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;return&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt; * &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt;;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] = &lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: green;&quot;&gt;&quot;%g &quot;&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: green;&quot;&gt;&quot;&lt;span style=&quot;color: #77dd77;&quot;&gt;\n&lt;/span&gt;&quot;&lt;/span&gt;);
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;call_it&lt;/span&gt;(&lt;b&gt;void&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[] = &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;2&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;3&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;sin&lt;/span&gt;);

    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;cos&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;tan&lt;/span&gt;);

    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;square&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;main&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;argc&lt;/span&gt;, &lt;b&gt;char&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;argv&lt;/span&gt;[])
&lt;b&gt;{&lt;/b&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;call_it&lt;/span&gt;();
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
So that&#39;s a bit better.  Only one implementation of the loop code, simple implementations for each operation, only the overhead of an additional pointer dereference per element.  How did we pull this off?&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))

&lt;/pre&gt;
&lt;br /&gt;
apply_operation() takes a function pointer as a parameter (the last argument).  This makes it so that apply_operation() can take any function that takes a single double as input and returns a single double as output. Slick.&lt;br /&gt;
&lt;br /&gt;
Now, the next step: returning a function pointer (without typedefing the signature).  Let&#39;s say we have a table of operations and we associate each operation type with a function pointer so that we can do a simple lookup to get a pointer to the desired operation function.  So, in other words, we&#39;re returning a function pointer.  Here&#39;s how to do it &lt;i&gt;without&lt;/i&gt; a typedefed function signature.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;enum&lt;/b&gt;
&lt;b&gt;{&lt;/b&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SIN&lt;/span&gt;,
    &lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_COS&lt;/span&gt;,
    &lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_TAN&lt;/span&gt;,
    &lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SQUARE&lt;/span&gt;
&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;struct&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;;
    &lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;);
&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;return&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt; * &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt;;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;struct&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper_lut&lt;/span&gt;[] =
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SIN&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;sin&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_COS&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;cos&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_TAN&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;tan&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SQUARE&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;square&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,

&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper_type&lt;/span&gt;))(&lt;b&gt;double&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;&amp;lt;(&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;oper_lut&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;oper_lut&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));&lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;b&gt;if&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;oper_type&lt;/span&gt; == &lt;span style=&quot;color: #2040a0;&quot;&gt;oper_lut&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;].&lt;span style=&quot;color: #2040a0;&quot;&gt;type&lt;/span&gt;)
        &lt;b&gt;{&lt;/b&gt;
            &lt;b&gt;return&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper_lut&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;n&lt;/span&gt;].&lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;;
        &lt;b&gt;}&lt;/b&gt;
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;] = &lt;span style=&quot;color: #2040a0;&quot;&gt;oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2040a0;&quot;&gt;length&lt;/span&gt;;&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style=&quot;color: #2040a0;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: green;&quot;&gt;&quot;%g &quot;&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;dat&lt;/span&gt;[&lt;span style=&quot;color: #2040a0;&quot;&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: green;&quot;&gt;&quot;&lt;span style=&quot;color: #77dd77;&quot;&gt;\n&lt;/span&gt;&quot;&lt;/span&gt;);
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;call_it&lt;/span&gt;(&lt;b&gt;void&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;double&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[] = &lt;b&gt;{&lt;/b&gt;&lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;2&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;3&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;;
    &lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt; = &lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SIN&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt; = &lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_COS&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt; = &lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_TAN&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
    &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt; = &lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;OPER_SQUARE&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;apply_operation&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]), &lt;span style=&quot;color: #2040a0;&quot;&gt;func&lt;/span&gt;);
    &lt;span style=&quot;color: #2040a0;&quot;&gt;print_vector&lt;/span&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style=&quot;color: #2040a0;&quot;&gt;vals&lt;/span&gt;[&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;]));
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;main&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;argc&lt;/span&gt;, &lt;b&gt;char&lt;/b&gt; *&lt;span style=&quot;color: #2040a0;&quot;&gt;argv&lt;/span&gt;[])
&lt;b&gt;{&lt;/b&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;call_it&lt;/span&gt;();
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
The magic is in get_oper().  Did you catch it?&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;double&lt;/b&gt; (*&lt;span style=&quot;color: #2040a0;&quot;&gt;get_oper&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;oper_type&lt;/span&gt;))(&lt;b&gt;double&lt;/b&gt;)

&lt;/pre&gt;
&lt;br /&gt;
This means that get_oper() is a function that takes a single int as a parameter and returns a function pointer to a function that returns a double and takes a single double as its only argument.  Simple, right?  There it is--returning a function pointer from a function without typedefing the signature (the &quot;hard&quot; way).&lt;br /&gt;
&lt;br /&gt;
This is the best reference I&#39;ve seen so far on function pointers &lt;a href=&quot;http://www.newty.de/fpt/fpt.html&quot;&gt;http://www.newty.de/fpt/fpt.html&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/2879653227580587216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/2879653227580587216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2879653227580587216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2879653227580587216'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2011/12/how-to-return-function-pointer-without.html' title='How to return a function pointer without a typedef in C/C++'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-7170489409492046013</id><published>2010-03-03T20:41:00.002-07:00</published><updated>2011-12-08T02:11:03.399-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="c++"/><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Surviving Visual Studio</title><content type='html'>I love emacs.  I can&#39;t describe how much I miss it when I have to do development in Windows.  Yes, I know there&#39;s a version of emacs for Windows, but it seems like if you&#39;re developing for Windows it&#39;s easier to give into the borg than to fight them.
&lt;br /&gt;
My tip for the day:&lt;br /&gt;
C-k C-f indents a region similar to C-M-\ in emacs.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/7170489409492046013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/7170489409492046013' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7170489409492046013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7170489409492046013'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2010/03/surviving-visual-studio.html' title='Surviving Visual Studio'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-1354999631030599954</id><published>2008-10-19T20:59:00.004-06:00</published><updated>2008-10-19T21:04:14.818-06:00</updated><title type='text'>Now the Economic Crisis is Personal ... Mother&#39;s Cookie Company Goes Out of Business</title><content type='html'>The economic crisis hasn&#39;t really made a big difference in my life until today.  I just heard that Mother&#39;s Cookie Company is going under.  I bought one last bag of pink and white &quot;Circus Animals&quot;.  Apparently it will have to last me for ETERNITY.  Where&#39;s the 700 billion dollar bailout for cookie companies?  Forget the whales, SAVE THE COOKIES!
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtl5e_V-w7qYy6FXRhO0LmRIX3MFvvxfjwxeiLVfqGeEsAtH3WSChT-f6fjcMQhAeXsiE20kEXEbcVGFbHaWkLQ6o2W4sEoE5PpajJZdI0v9cMvIaJd7ARAoBAahT5A22P8lOQMSonsYA/s1600-h/circus_animals.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtl5e_V-w7qYy6FXRhO0LmRIX3MFvvxfjwxeiLVfqGeEsAtH3WSChT-f6fjcMQhAeXsiE20kEXEbcVGFbHaWkLQ6o2W4sEoE5PpajJZdI0v9cMvIaJd7ARAoBAahT5A22P8lOQMSonsYA/s400/circus_animals.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5259065797291733650&quot; /&gt;&lt;/a&gt;

Check out the &lt;a href=&quot;http://www.boston.com/news/local/connecticut/articles/2008/10/10/mothers_cookie_company_closes_amid_bankruptcy/&quot;&gt;AP story.&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/1354999631030599954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/1354999631030599954' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/1354999631030599954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/1354999631030599954'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/10/now-economic-crisis-is-personal-mothers.html' title='Now the Economic Crisis is Personal ... Mother&#39;s Cookie Company Goes Out of Business'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtl5e_V-w7qYy6FXRhO0LmRIX3MFvvxfjwxeiLVfqGeEsAtH3WSChT-f6fjcMQhAeXsiE20kEXEbcVGFbHaWkLQ6o2W4sEoE5PpajJZdI0v9cMvIaJd7ARAoBAahT5A22P8lOQMSonsYA/s72-c/circus_animals.gif" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-7775189322219285525</id><published>2008-08-14T22:53:00.007-06:00</published><updated>2011-12-08T02:12:02.563-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="FileChooserDialog"/><category scheme="http://www.blogger.com/atom/ns#" term="gtk"/><category scheme="http://www.blogger.com/atom/ns#" term="pygtk"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>gtk.FileChooserDialog() mini-HOWTO</title><content type='html'>Enough is enough!  It seems like every time I write a pygtk app I end up needing a file chooser dialog yet every time I can&#39;t remember the details.  The &lt;a href=&quot;http://www.pygtk.org/docs/pygtk/class-gtkfilechooserdialog.html&quot;&gt;reference page&lt;/a&gt; for gtk.FileChooserDialog() is excellent--&lt;i&gt;for reference&lt;/i&gt;.  I need a gtk.FileChooserDialog() mini-HOWTO.  Here it is:

&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
fc = gtk.FileChooserDialog(title=&#39;Open File...&#39;,
                                   parent=None,
                                   action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                   buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
        fc.set_current_folder(g_directory)
        fc.set_default_response(gtk.RESPONSE_OK)
        filter = gtk.FileFilter()
        filter.set_name(&#39;Audio Files&#39;)
        filter.add_pattern(&#39;*.wav&#39;)
        filter.add_pattern(&#39;*.mp3&#39;)
        filter.add_pattern(&#39;*.flac&#39;)
        fc.add_filter(filter)
        response = fc.run()
        if response == gtk.RESPONSE_OK:
            print &#39;ok&#39;
            print fc.get_filename()
            self.entry.set_text(fc.get_filename())
            g_directory = fc.get_current_folder()
        else:
            print &#39;not ok&#39;
        fc.destroy()
&lt;/code&gt;&lt;/pre&gt;
There, done!  &lt;a href=&quot;http://www.pygtk.org/pygtk2tutorial/sec-FileChoosers.html&quot;&gt;This page&lt;/a&gt; is also an excellent, more complete, example.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/7775189322219285525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/7775189322219285525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7775189322219285525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/7775189322219285525'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/08/gtkfilechooserdialog-mini-howto.html' title='gtk.FileChooserDialog() mini-HOWTO'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-4885298215402507204</id><published>2008-06-25T22:48:00.002-06:00</published><updated>2008-06-25T22:49:48.934-06:00</updated><title type='text'>I knew I Could Do Better</title><content type='html'>After brushing up on the periodic table, and embellishing my education a little ...

&lt;a href=&quot;http://www.nerdtests.com/nq_ref.html&quot;&gt;
&lt;img src=&quot;http://www.nerdtests.com/images/badge/42fe8c3ff59dbe52.gif&quot; alt=&quot;I am nerdier than 100% of all people. Are you a nerd? Click here to find out!&quot;&gt;&lt;/a&gt;

Beat that!</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/4885298215402507204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/4885298215402507204' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4885298215402507204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4885298215402507204'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/06/i-knew-i-could-do-better.html' title='I knew I Could Do Better'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-616217943347416819</id><published>2008-06-25T22:27:00.002-06:00</published><updated>2008-06-25T22:29:25.611-06:00</updated><title type='text'>Mindless Drivel, but Entertaining Nonetheless</title><content type='html'>&lt;a href=&quot;http://www.nerdtests.com/nq_ref.html&quot;&gt;
&lt;img src=&quot;http://www.nerdtests.com/images/badge/88b83b32debeebda.gif&quot; alt=&quot;I am nerdier than 94% of all people. Are you a nerd? Click here to find out!&quot;&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/616217943347416819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/616217943347416819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/616217943347416819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/616217943347416819'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/06/mindless-drivel-but-entertaining.html' title='Mindless Drivel, but Entertaining Nonetheless'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-9099865873102842572</id><published>2008-04-12T15:31:00.009-06:00</published><updated>2008-07-20T00:22:32.322-06:00</updated><title type='text'>Review of &quot;King of Kong: A Fist Full of Quarters&quot;</title><content type='html'>Over the last three days (&lt;em&gt;it&#39;s been several months ago now&lt;/em&gt;) I&#39;ve had the extreme pleasure of watching &lt;a href=&quot;http://www.billyvssteve.com/&quot;&gt;&quot;King Kong: A Fist Full or Quarters&quot;&lt;/a&gt;.  You &lt;i&gt;
must&lt;/i&gt; see this movie.
&lt;p/&gt;
It is, in my opinion, the quintessential American underdog story set to the music of Donkey Kong.  On one side you have Billy Mitchell, a superstar in his own world.  Arguably the best gamer of all time, but certainly the best classic gamer of all time.  Billy is amazing--He&#39;s truly gifted.  Unfortunately, like a lot of us in this world, his head is much bigger than it aught to be. (In Billy&#39;s case, his hair is longer than it aught to be too.)
&lt;p/&gt;
On the other side you have Steve Wiebe, an apparent &quot;screw up&quot; (and I mean that in the nicest way possible).  Of his own admission, he hasn&#39;t lived up to his true potential throughout his live.  Highly athletic yet subject to &quot;the chokes&quot;, gifted musically but prohibitively shy, highly intelligent yet awkward and sheepish.

&lt;p/&gt;
&quot;King of Kong: A Fist Full of Quarters&quot; is their story.
&lt;p/&gt;
I won&#39;t spoil the rest, but I will say this: be prepared for the subculture of classic gaming&#39;s superstars, groupies, officials, desperate wannabees, outsiders, insiders, family members, winners, and losers.  It&#39;s a strange world, beyond description, even for a geek like me.

&lt;i&gt;&lt;b&gt;After&lt;/b&gt;&lt;/i&gt; you&#39;ve watched the movie, go check out the current record at
&lt;a href=&quot;http://www.twingalaxies.com/index.aspx?c=22&amp;pi=2&amp;gi=3852&amp;vi=22&quot;&gt;Twin Galaxies&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/9099865873102842572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/9099865873102842572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/9099865873102842572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/9099865873102842572'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/04/review-of-king-of-kong-fist-full-of.html' title='Review of &quot;King of Kong: A Fist Full of Quarters&quot;'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-8256959794829011567</id><published>2008-02-16T17:52:00.007-07:00</published><updated>2008-02-16T18:03:43.344-07:00</updated><title type='text'>Rock it out with Heart</title><content type='html'>Though I consider myself mostly an 80&#39;s-synth-pop-new-wave-2-tone kind of person, I still have a great love for classic rock.  I think it was Homer Simpson who once said &quot;rock peaked in &#39;74, everyone knows that!&quot;  Amen, Homer, Amen.&lt;br/&gt;
&lt;br/&gt;
I&#39;ve been trying to play this song for +10 years now, oh well, someday I&#39;ll get it. Enjoy...&lt;br/&gt;
&lt;br/&gt;
&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/o5PKULglde8&amp;rel=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/o5PKULglde8&amp;rel=1&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/8256959794829011567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/8256959794829011567' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/8256959794829011567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/8256959794829011567'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2008/02/rock-it-out-with-heart.html' title='Rock it out with Heart'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-6264388984937840049</id><published>2007-10-27T19:40:00.000-06:00</published><updated>2007-10-27T22:13:25.131-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gtk python pygtk liststore treestore treeview mvc cellrenderer treeviewcolumn howto"/><title type='text'>PyGTK Treeview digest</title><content type='html'>I&#39;m always forgetting how to use the TreeView widget to display columnar data.  In PyGTK (well, GTK+ in general) a TreeView is used to display trees (TreeStores) and columnar data (ListStores) like in the screenshot below.  In this mini HOWTO I&#39;m restricting the post to ListStores, however, many of the concepts below apply to TreeStores.)&lt;br/&gt;
&lt;br/&gt;
A ListStore keeps track of the values you want to display in your TreeView.  You create one like this: &lt;br&gt;&lt;code&gt;liststore = gtk.ListStore(type1, type2, type3, ...)&lt;/code&gt;&lt;br/&gt;
&lt;br/&gt;
Where &lt;code&gt;type&lt;i&gt;n&lt;/i&gt;&lt;/code&gt; can be a Python type &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;str&lt;/code&gt;, a PyGTK type &lt;code&gt;gtk.Button&lt;/code&gt;..., or a gobject type like &lt;code&gt;gobject.TYPE_CHAR&lt;/code&gt; or &lt;code&gt;&#39;gchar&#39;&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;
Once your ListStore or &quot;model&quot; is created, you&#39;ll want to put things in it and take things out.
To add a row you use append or prepend like so &lt;br/&gt;&lt;code&gt;iter=liststore.append([1,2,3,&#39;a&#39;,&#39;b&#39;,&#39;c&#39;]) iter=liststore.prepend([1,2,3,&#39;a&#39;,&#39;b&#39;,&#39;c&#39;])&lt;/code&gt;&lt;br/&gt;  The iterator &lt;code&gt;iter&lt;/code&gt; can be used by other calls like &lt;br/&gt;&lt;code&gt;new_iter=liststore.insert_before(iter, [1,2,3,&#39;a&#39;,&#39;b&#39;,&#39;c&#39;]) new_iter=liststore.insert_after(iter, row=[...])&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

So what about accessing/changing things after the fact?
&lt;br/&gt;&lt;code&gt;value=liststore.get_value(iter, column)&lt;/code&gt;&lt;br/&gt; will get a single column from a single row at &lt;code&gt;iter&lt;/code&gt;.
&lt;br/&gt;&lt;code&gt;values=liststore.get(iter,col1,col2,col3,...)&lt;/code&gt;&lt;br/&gt; gets multiple rows from &lt;code&gt;iter&lt;/code&gt; just as &lt;br/&gt;&lt;code&gt;vala, valb=liststore.get(iter, 0, 2)&lt;/code&gt;&lt;br/&gt; does.&lt;br/&gt;
&lt;br/&gt;

Conversly, &lt;br/&gt;&lt;code&gt;liststore.set(iter,col,val)&lt;/code&gt;&lt;br/&gt; sets a single column in &lt;code&gt;iter&lt;/code&gt; to value.  As does &lt;br/&gt;&lt;code&gt;liststore.set(iter,col,val,col,val,...,...)&lt;/code&gt;&lt;br/&gt; for multiple columns and values. To remove a single row do &lt;br/&gt;&lt;code&gt;liststore.remove(iter)&lt;/code&gt;&lt;br/&gt;, and &lt;br/&gt;&lt;code&gt;liststore.clear()&lt;/code&gt;&lt;br/&gt; to remove them all.&lt;br/&gt;
&lt;br/&gt;

The model (ListStore) is essentially a database.  To actually see the contents of it in a widget you&#39;ll need a TreeView, TreeViewColumns, and CellRenderers.  &lt;br/&gt;&lt;code&gt;view=gtk.TreeView(model=None)&lt;/code&gt;&lt;br/&gt; does the job of creating a TreeView, optionally setting the model off of which it&#39;s based.  Otherwise it can be set and retrieved with &lt;br/&gt;&lt;code&gt;view.set_model(model) model=view.get_model()&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

TreeViewColumns hold the CellRenderers and are managed by the TreeView.  You add a TreeViewColumn to a TreeView like this: &lt;br/&gt;&lt;code&gt;view.append_column(column)&lt;/code&gt;.&lt;br/&gt; You make one thus &lt;br/&gt;&lt;code&gt;col=gtk.TreeViewColumn(&#39;Heading&#39;)&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

CellRenderers do the work of displaying a particular column in the store.  CellRenderers get packed into the TreeViewColumns (which manage the column headers), therefore you can have multiple CellRenderers under one column heading.  It is a common practice to put an image and text together under the same column heading.  Different Cellrenderers exist for different types namely pixmaps, text, and toggle buttons. (And, of course, you can always make your own.)  It is easy to create a Cellrenderer: &lt;br/&gt;&lt;code&gt;cell=gtk.CellRendererText() cell=gtk.CellRendererPixbuf() cell=gtk.CellRendererToggle()&lt;/code&gt;&lt;br/&gt;. You can then pack it into the the desired TreeViewColumn with &lt;br/&gt;&lt;code&gt;column.pack_start(cell,expand=True)&lt;/code&gt;&lt;br/&gt; and &lt;br/&gt;&lt;code&gt;column.pack_end(cell,expand=False)&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

Here is the part I have the hardest time remembering... How do you associate data in the store with what gets displayed in the CellRenderers?  The answer is &lt;i&gt;column&lt;/i&gt; attributes.  So, to associate the text of column 0 in the &lt;i&gt;model&lt;/i&gt; with the text in a particular CellRenderer &lt;code&gt;cell&lt;/code&gt; you do &lt;br/&gt;&lt;code&gt;col.add_attribute(cell, &#39;text&#39;, 0)&lt;/code&gt;&lt;br/&gt; or equivalently &lt;br/&gt;&lt;code&gt;col.set_attributes(cell, text=0, prop1=modelcol1, prop2=modelcol2, ...)&lt;/code&gt;&lt;br/&gt;.  There are many other attributes besides &#39;text&#39; that can be tied to your data model. Some include &#39;markup&#39; (simple HTML), &#39;font&#39;, &#39;background&#39; (color), &#39;foreground&#39; (color).&lt;br/&gt;
&lt;br/&gt;

Here is a minimalist example that ties it all together:&lt;br/&gt;
&lt;pre&gt;&lt;code&gt;
import gtk

store = gtk.ListStore(int,str,str,str)
view = gtk.TreeView(model=store) # Associate the store with the view

column_int = gtk.TreeViewColumn(&#39;Integer&#39;) # These will be our column
column_str = gtk.TreeViewColumn(&#39;String&#39;)  #  headings in the TreeView widget

view.append_column(column_int) # Associate the columns with the TreeView
view.append_column(column_str) #

cell_int = gtk.CellRendererText()
cell_hex = gtk.CellRendererText()
cell_dec = gtk.CellRendererText()

column_int.pack_start(cell_int) # This column only has one CellRenderer

column_str.pack_start(cell_hex) # This column has two
column_str.pack_start(cell_dec) #

column_int.add_attribute(cell_int, &#39;text&#39;, 0)       # Associate col 0 of model with text of cell_int
column_int.add_attribute(cell_int, &#39;background&#39;, 3) # Associate col 3 of model with the cell background

column_str.add_attribute(cell_hex, &#39;text&#39;, 1)       # Associate col 1 of model with text of cell_hex
column_str.add_attribute(cell_dec, &#39;text&#39;, 2)       #    ditto for cell_dec
column_str.add_attribute(cell_hex, &#39;background&#39;, 3) # Associate col 3 of model with the cell background
column_str.add_attribute(cell_dec, &#39;background&#39;, 3) # Associate col 3 of model with the cell background

store.append([1,&#39;0x01&#39;,&#39;1&#39;,&#39;red&#39;])   # Add items to the store
store.append([2,&#39;0x02&#39;,&#39;2&#39;,&#39;green&#39;]) #
store.append([3,&#39;0x03&#39;,&#39;3&#39;,&#39;blue&#39;])  #
store.append([4,&#39;0x04&#39;,&#39;4&#39;,&#39;wheat&#39;]) #
store.append([5,&#39;0x05&#39;,&#39;5&#39;,&#39;gray&#39;])  #
store.append([0,&#39;&#39;,&#39;&#39;,&#39;&#39;])           #

window = gtk.Window()
window.add(view)

window.show_all()
window.connect(&#39;delete_event&#39;, gtk.main_quit)
gtk.main()
&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;
I&#39;ve written it to be as simple as possible, (hence no classes, functions, etc.), so that the associations between the ListStore, TreeView, TreeViewColumns, and CellRenderers are obvious.  The result is ugly (both the code and the screenshot!), but effective at achieving the desired result.  Note that the hex and dec CellRenderers are both under the &#39;Strings&#39; heading and how you can associate the model with more than just the text, in this case the background color of the cell.&lt;br/&gt;
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDaC7eXgdGaQGlJMAnwtQRiORTwWNMxWcbwygD4umY_jVUMTmRCX9xsl9mmFT-55cYrzNFDNE1wL1scuIrIpptSNhB87NQlxYXoEwMYY2gOKLQB5lYyaHaR8FkaE9ow1w7tgxjmUMYPsM/s1600-h/flick.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDaC7eXgdGaQGlJMAnwtQRiORTwWNMxWcbwygD4umY_jVUMTmRCX9xsl9mmFT-55cYrzNFDNE1wL1scuIrIpptSNhB87NQlxYXoEwMYY2gOKLQB5lYyaHaR8FkaE9ow1w7tgxjmUMYPsM/s320/flick.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5126222948622817506&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;


&lt;br/&gt;
For more details including sorting, additional attributes, and signals see chapter 14 of the PyGTK tutorial &lt;a href=&quot;http://www.pygtk.org/pygtk2tutorial/sec-TreeModelInterface.html&quot;&gt;http://www.pygtk.org/pygtk2tutorial/sec-TreeModelInterface.html&lt;/a&gt;  upon which this post is heavily based.&lt;br/&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/6264388984937840049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/6264388984937840049' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/6264388984937840049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/6264388984937840049'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2007/10/pygtk-treeview-digest.html' title='PyGTK Treeview digest'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDaC7eXgdGaQGlJMAnwtQRiORTwWNMxWcbwygD4umY_jVUMTmRCX9xsl9mmFT-55cYrzNFDNE1wL1scuIrIpptSNhB87NQlxYXoEwMYY2gOKLQB5lYyaHaR8FkaE9ow1w7tgxjmUMYPsM/s72-c/flick.jpg" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-3398874935900165348</id><published>2007-07-25T16:14:00.000-06:00</published><updated>2007-07-25T16:36:28.495-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gcc cpp macro"/><title type='text'>Predefined Macros in gcc</title><content type='html'>gcc (well cpp, the preprocessor) provides several predefined macros.  Many of these are platform independent, for instance &lt;code&gt;__FILE__&lt;/code&gt; and &lt;code&gt;__LINE__&lt;/code&gt;.  Others are platform dependent (or &quot;system-specific&quot; as the gcc manual puts it).  So how do you know what your particular platform defines?  Try this: &lt;br /&gt;
&lt;code style=&quot;background-color: rgb(200, 200, 200);&quot;&gt;cpp -dM /dev/null&lt;/code&gt;

I stumbled across this trick the other day on &lt;a href=&quot;http://lists.apple.com/archives/Unix-porting/2005/Apr/msg00003.html&quot;&gt;Apple&#39;s mailing lists archives&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/3398874935900165348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/3398874935900165348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/3398874935900165348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/3398874935900165348'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2007/07/predefined-macros-in-gcc.html' title='Predefined Macros in gcc'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-2734744740929620584</id><published>2007-07-25T10:16:00.000-06:00</published><updated>2007-07-26T16:04:01.147-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="kernel threads"/><title type='text'>Linux Kernel Threads Can Have Priorities and Can Dereference current</title><content type='html'>My memory failed me on some points of kernel threads today so hopefully this post will solidify my knowledge.  
&lt;ul&gt;
&lt;li&gt;Kernel threads &lt;i&gt;can&lt;/i&gt; have a priority via the &quot;nice&quot; mechanism.  It is set using &lt;code&gt;set_user_nice(tsk, nice_level)&lt;/code&gt;, just as for userspace processes/threads.&lt;/li&gt;
&lt;li&gt;As a consequence of the above point, kernel threads have a task structure and it may be referred to by the &lt;code&gt;current&lt;/code&gt; pointer, again, the same as is the case with userspace processes/threads.&lt;/li&gt;
&lt;/ul&gt;
&lt;code&gt;set_user_nice()&lt;/code&gt; should be called from within the task callback function supplied to &lt;code&gt;kthread_create()&lt;/code&gt;.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/2734744740929620584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/2734744740929620584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2734744740929620584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/2734744740929620584'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2007/07/linux-kernel-threads-can-have.html' title='Linux Kernel Threads Can Have Priorities and Can Dereference &lt;code&gt;current&lt;/code&gt;'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-4345535197704642272</id><published>2007-07-20T08:38:00.000-06:00</published><updated>2007-07-25T16:40:01.479-06:00</updated><title type='text'>&quot;Real HTML&quot; in blogger</title><content type='html'>Ok, first things first...  If you&#39;re a control freak like I am and want to actually use &quot;real&quot; HTML (tables, div, etc.) in your posts to blogger, the first thing you should do is disable the automatic conversion of line breaks to the &lt;nobr&gt;&amp;lt;br /&amp;gt;&lt;/nobr&gt; tag.&lt;br /&gt; &lt;br /&gt;  Of course, then you&#39;ll have to explicitly add &amp;lt;br /&amp;gt; tags to format your posts, but at least then you won&#39;t waste an hour trying to figure out why your tables look atrocious. (Not that I did that or anything ;) &lt;br /&gt; &lt;br /&gt;
To do this, log in, hit the &quot;Settings&quot; tab, then the &quot;Formatting&quot; tab, then set &quot;Convert Line Breaks&quot; to &quot;No&quot;. &lt;br /&gt; &lt;br /&gt;

In other words &quot;Settings&quot;-&gt;&quot;Formatting&quot;-&gt;&quot;Convert Line Breaks&quot; = &quot;No&quot;.</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/4345535197704642272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/4345535197704642272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4345535197704642272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4345535197704642272'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2007/07/real-html-in-blogger.html' title='&quot;Real HTML&quot; in blogger'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2882101181039237625.post-4447315616767782905</id><published>2007-07-19T08:29:00.000-06:00</published><updated>2015-01-14T10:39:51.672-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cheat sheet"/><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><category scheme="http://www.blogger.com/atom/ns#" term="keys"/><title type='text'>Emacs Notes</title><content type='html'>This is my general emacs knowledge base.  Some of these keys/features I use everyday others I always forget about, hence the existence of these notes. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
//           When opening (visiting) a file (C-x C-f), disregards everything before //
M-\          Kills whitespace pointed to by point
M-^          Merge the current line with previous line (taking away whitespace)
C-x C-x      swap mark and point
C-space      set new mark
C-u C-space  goto next mark in ring
C-M-space    mark to end of paren
C-t          transpose two chars
M-t          transpose two words
C-M-t        transpose two balanced expressions
C-M-f        move forward one balanced expression
C-M-b        move backward one balanced expression
C-M-k        kill balanced expression forward
C-M-&amp;lt;del&amp;gt;    kill balanced expression backward
C-x C-t      transpose two lines
M-m          move to first non-whitespace on line
C-c C-e      in C-mode expands macros into new buffer
C-M-q        toggle-read-only
C-x w h      highlight a regexp
C-x w r      unhighlight a regexp
M-x find-file-at-point Opens file at point
M-x apropos  Find an emacs command based on regexp
M-x woman    Advanced manual page browser
C-x &amp;gt;        scroll right
C-x &amp;lt;        scroll left
C-x C-+      Increase font size
C-X C--      Decrease font size

Narrowing
C-x n d      Narrow to defun  (one C-function)
C-x n n      Narrow to region
C-x n w      widen

Minibuffer
M-s          Search minibuffer history forward
M-r          Search minibuffer history backward

Kill Ring
C-h v kill-ring    View contents of kill ring
C-u C-y            Yank, but leave point at beginning of yanked text

TAGS (old tags)
M-. TAG            Find a TAG
C-u M-.            Find next TAG
C-M-. PATTERN      Find a TAG using regexp PATTERN
C-x 4 . TAG        Find a tag but put in another window
M-*                Pop back to where you invoked a TAG search
M-x tags-search    Search multiple files for regexp
M-,                Continue tags search
M-x list-tags FILE Lists all tags in a file
M-x tags-apropos   Lists all tags matching a regexp

GTAGS
M-. TAG                find TAG
M-? TAG                find all references to TAG
[f3] TAG               create TAG completion list &quot;global -c TAG&quot;
M-x gtags-symbol-find  find a symbol (similar to [f6])

M-x ps-spool-region-with-faces
M-x desktop-read
M-x desktop-save

&quot;C-mode&quot;
M-a  backward statement
M-e  forward statement
C-M-u  up conditional (block)
C-M-d  down conditional (block)
C-M-n  next conditional (block)
C-M-p  prev conditional (block)
C-c C-a  Toggle Autonewline minor mode
C-c C-d  Toggle Hungry Delete minor mode
C-c C-t  Toggle both Autnewline and Hungry Delete minor modes
C-c C-\  Add \&#39;s to a region for multi-lined macros
C-u C-c C-\  Remove \&#39;s from multi-line macros
M-q  In a C comment, wrap text appropriately.
M-j  Add a line break in a comment.
C-x `  go to next compilation error

DIRED
(to enter)
C-x d                Enter dired mode
C-x f [tab] [enter]  Enter dired mode while visiting file
(once in)
i                    Show contents of directory at point
g                    Update buffer (reread directory from disk)
d                    Mark file at point for deletion (&#39;D&#39; not &#39;*&#39;)
u                    Ummark file at point
x                    Delete (expunge) files marked for deletion
% d &amp;lt;regexp&amp;gt;         Mark files for deletion matching regexp
% m &amp;lt;regexp&amp;gt;         Mark files matching regexp
% g &amp;lt;regexp&amp;gt;         Mark all files which contain regexp (like grep)
[del]                Unmark move point up one line
[enter]              Visit file at point
f                    Visit file at point (Same as [enter])
e                    Visit file at point (Same as [enter])
o                    Visit file at point in other window
C-o                  Visit file at point in other window, but stay in dired window
v                    View file at point (read only, q to quit)
^                    Move up to parent directory (..)
m                    Mark a file (with &#39;*&#39; not &#39;D&#39;)
* s                  Mark all files in current dired window
* t                  Toggle marked files (unmark all marked, mark all unmarked)
* %                  Same as  % m &amp;lt;regexp&amp;gt;  above
* !                  Unmark all marked
* /                  Mark all directories except . and ..
C &amp;lt;name&amp;gt;             Copy current file, see manual for multiple files (marked files)
R &amp;lt;name&amp;gt;             Rename current file, see manual for multiple files
M &amp;lt;mode&amp;gt;             Change mode of file(s) (uses chmod modes)
G &amp;lt;newgroup&amp;gt;         Like chgrp
O &amp;lt;newowner&amp;gt;         Like chown
S &amp;lt;name&amp;gt;             Make symbolic link
Z                    Compress marked files (or uncompress if compressed)
! &amp;lt;cmd&amp;gt;              Run shell command &amp;lt;cmd&amp;gt; on all marked files.  If &amp;lt;cmd&amp;gt; contains &#39;*&#39;, &#39;*&#39; expands to all marked files
X &amp;lt;cmd&amp;gt;              Same as ! &amp;lt;cmd&amp;gt;
% R &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to rename file ^.*$ to x-^.*$ adds &quot;x-&quot; to all marked files
% C &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to copy file ^.*$ to x-^.*$ makes new files with &quot;x-&quot;
% S &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to symlinks files ^.*$ to x-^.*$ adds &quot;x-&quot; to all symlinks
q                    Quit (kill dired buffer)
=                    diff files at point and mark (uses dired-diff as command)
M-=                  diff file at point with it latest backup (.*~)
C-x u                (undo, unmark all marked, restore names of renamed files)
M-x find-dired       Use the &#39;find&#39; command to fill dired buffer
M-x find-name-dired  Use the &#39;find&#39; command employing -name to fill dired buffer
M-x find-grep-dired  Use the &#39;find&#39; command with grep to fill dired buffer
M-x locate           Similar to &#39;locate&#39; command

VC (clearcase.el)
C-x C-q              Toggle read-only on non-version controlled element
                   Checkout or checkin (whatever makes sense) version controlled element
C-x v v              Checkout or checkin (whatever makes sense) version controlled element
C-x v ~ &amp;lt;version&amp;gt;    View a specific version of a file (dired mode kicks in on tab)
C-x v i              Runs mkelem on current buffer (NOT TESTED!)
C-x v l              Display history on current buffer
C-x v u              Revert element (uncheckout current buffer)
C-x v e              Edit config spec
C-c C-c              Finishes a comment session (on checkin or checkout)
v v                  (In dired mode) Checkout or checkin all marked files (whatever makes sense for each file)

Emacs server/client
(server-start)       Starts emacs server. Clients connect with emacsclient command.
C-x #                Unblock emacsclient and kill emacsclient buffer
EDITOR               (Environment variable, set this to emacsclient)
ALTERNATE_EDITOR     (Environment variable, set to a different editor if emacs server not running)

International input mode
C-\                  Enter\Get out of international input mode.
_a                   1ª (feminine ordinal)
_o                   1º (masculine oridinal)
~c                   ç (ce com cedilha)
~a                   ã,õ - nasals
^a                   â,ô,ê - circumflex (hat)
&#39;a                   á,é,í,ó,ú, - accent (acento agudo)
`a                   à - grave accent (acento grave)

Environment Variables
M-x getenv
M-x setenv

GDB mode
C-x space            Set breakpoint at point
M-s                  step
M-n                  next
M-i                  stepi
M-c                  continue

Filtering/Searching
M-x occur &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;        Lists in a buffer all lines matching REGEXP
M-x how-many &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;     Shows how many lines match REGEXP
M-x flush-lines &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;  Filter out lines matching REGEXP
M-x keep-line &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;    Filter out all lines not matching REGEXP&amp;nbsp;

Rectangles
C-x r k              Kill a rectangle
C-x r y              Yank a rectangle
C-x r d              Delete contents of a rectangle
C-x r o              &quot;open&quot; a rectangle, inserts spaces the same size as the rectangle
C-x r t string       Replace contents of a rectangle with string
C-x r c              Clears a rectangle (replaces with spaces)
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacsjunkie.blogspot.com/feeds/4447315616767782905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2882101181039237625/4447315616767782905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4447315616767782905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2882101181039237625/posts/default/4447315616767782905'/><link rel='alternate' type='text/html' href='http://emacsjunkie.blogspot.com/2007/07/when-opening-visiting-file-c-x-c-f.html' title='Emacs Notes'/><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>