Monday, February 3, 2025
An eye opening article on optimising C compilers.
I am still not sure of what to make of everything in this article, but I can say that it is well written, and definitely thought provoking.
Saturday, February 1, 2025
Fun C Code Challenge
I haven't done any programming in a good long while. I started dabbling with some C over the past week, and happened across Dan Gookin's C For Dummies blog, where he posted a neat little multi-dimensional array manipulation challenge. I found the subscript notation to be trivial compared to getting the initial pointer notation correct. You can see Dan's post here.
// Code challenge:
// Output the string, "I am an excellent C programmer"
// From Dan Gookin's "C For Dummies" blog
// https://c-for-dummies.com/blog/?p=6791
#include <stdio.h>
int main(void)
{
char *a[] = { "I", "good", "language" };
char *b[] = { "am", "C", "excellent", "an" };
char *c[] = { "a", "programmer", "very" };
char **z[] = { a, b, c };
// Easier way:
printf("%s %s %s %s %s %s.\n",
z[0][0],
z[1][0],
z[1][3],
z[1][2],
z[1][1],
z[2][1]
);
// A bit trickier for this rusty old mind. :)
printf("%s %s %s %s %s %s.\n",
*(*(z + 0) + 0),
*(*(z + 1) + 0),
*(*(z + 1) + 3),
*(*(z + 1) + 2),
*(*(z + 1) + 1),
*(*(z + 2) + 1)
);
return 0;
}
Monday, December 26, 2016
Unlocking a Virgin Mobile (Canada) Prepaid Phone
If you want to use a Virgin Mobile prepaid phone on a different network, then you are going to need to have the handset unlocked. You can either have Virgin do it — for $75+ — or you can pay cellunlocker.net to do it for you. It cost me $11.11 for five unlock codes for an LG K4. After you get the unlock codes, carefully read their instructions. As it turns out, I was able to unlock my phone before I even went to my new carrier, after I followed the instructions in this video. Instructions are in the video description.
Monday, February 2, 2015
I done give up on Internet Explorer 11
I have been using Internet Explorer 11 exclusively for a little over a month. I have tried doing this before but, as always, it never lasts.
I am not an IE basher.
I don't hate IE, or Microsoft.
So why not use their browser? It is missing a few features I have gotten used to with Opera:
That is all.
I am not an IE basher.
I don't hate IE, or Microsoft.
So why not use their browser? It is missing a few features I have gotten used to with Opera:
- Close tabs to the right
- User defined "speed dial"
- A chronolgical history as oppsed to a "grouped by site" history
- Smarter actions with forms
There are other things I have probably not thought of, but those are the ones that keep cropping up.
That is all.
Monday, August 4, 2014
Where are the Opteron X Series C/APUs?
On May 29, 2013 AMD announced the launch of the Opteron X-Series family of processors, namely the Opteron X1150, and the Opteron X2150. At the time of this writing, it looks like only the latter survived.
For those of you searching for these chips, and boards to run them on, I hate to disappoint you, but:
I was in contact with someone at AMD, and was told that these chips are currently being sold to partners only, and are not in the consumer channels at this time. Whether they will become available to consumers later is not known. Bummer Fisherman.
This means you can technically buy them, but only as part of an HP ProLiant m700 Moonshot server cartridge. Of course that is going to cost a wee bit more than the $99 MSRP given for the X2150 chip. How much more? Rougly $37,000. That cost reflects the minimum purchase of "15 identically configured Moonshot m700 server cartridges." (source). Double Bummer Fisherman.
So for now, I won't be building my NAS server with Opteron parts. Instead, I will probably start with an HP ProLiant N54L, and do a few upgrades.
For those of you searching for these chips, and boards to run them on, I hate to disappoint you, but:
I was in contact with someone at AMD, and was told that these chips are currently being sold to partners only, and are not in the consumer channels at this time. Whether they will become available to consumers later is not known. Bummer Fisherman.
This means you can technically buy them, but only as part of an HP ProLiant m700 Moonshot server cartridge. Of course that is going to cost a wee bit more than the $99 MSRP given for the X2150 chip. How much more? Rougly $37,000. That cost reflects the minimum purchase of "15 identically configured Moonshot m700 server cartridges." (source). Double Bummer Fisherman.
So for now, I won't be building my NAS server with Opteron parts. Instead, I will probably start with an HP ProLiant N54L, and do a few upgrades.
Tuesday, January 7, 2014
CES 2014: AMD Kaveri Tidbits
"It's the most wonderful time of the year..." OK, aside from the Polar Vortex as of late, for all us tech junkies it's a special time of year because CES is upon us! This year AMD has unveiled their new chip, Kaveri, and though there was not a lot of new info (no benchmarks publicly available yet), there are a few particularly interesting details.
A while back AMD joined The Document Foundation, offering to help refactor the code for LibreOffice Calc. Essentially what the folks at LibreOffice have accomplished since then is to leverage the hardware found in AMD systems (in particular, the GPU, or in the case of Kaveri, the APU) to do some very heavy lifting. Exactly how much the new hardware and code improved performance was revealed at CES:
A while back AMD joined The Document Foundation, offering to help refactor the code for LibreOffice Calc. Essentially what the folks at LibreOffice have accomplished since then is to leverage the hardware found in AMD systems (in particular, the GPU, or in the case of Kaveri, the APU) to do some very heavy lifting. Exactly how much the new hardware and code improved performance was revealed at CES:
Labels:
AMD,
CES,
Dragon Naturally Speaking,
Kaveri,
LibreOffice,
TrueAudio
Tuesday, December 24, 2013
Dual boot FreeBSD 10 with Windows 7
If you have installed FreeBSD 10 (this applies to 9.x as well), on top of a pre-existing Windows 7 install, you have noticed that there is no option (at least not by default) to dual boot. To enable dual booting open a shell in FreeBSD, su to root, and enter the following:
Reboot. Now when the system begins to boot, you should have options for booting into Windows 7 or FreeBSD.
HT: Edubuddy - Dual boot Windows 7 and FreeBSD 9.0
boot0cfg -B ada0Reboot. Now when the system begins to boot, you should have options for booting into Windows 7 or FreeBSD.
HT: Edubuddy - Dual boot Windows 7 and FreeBSD 9.0
Tuesday, May 3, 2011
Change GDM login background image on OpenSUSE 11.4
First, let me start off by saying I truly dislike Gnome, and the attitude by the Gnome devs that somehow giving people options is a bad thing. Why is it that I cannot easily change the background image of the Gnome login screen? Why do I have to use hacks like this one? Why do the hacks always have to change? Anyway, for Gnome 2.32.1 which shipped with OpenSUSE 11.4 the way to change the login background image is like this:
As root:
mv your_new_image.jpg /usr/share/pixmaps/backgrounds/gnome/background-default.jpg
Where your_new_image.jpg is the image you want to be the new background image.
As root:
mv your_new_image.jpg /usr/share/pixmaps/backgrounds/gnome/background-default.jpg
Where your_new_image.jpg is the image you want to be the new background image.
Saturday, April 16, 2011
Cygwin top
If you want to use top in Cygwin, you will need to install the procps package. I have spoken.
Friday, April 15, 2011
W3 CSS3 validation
I was fiddling around with some text-shadow stuff (which is part of the CSS3 draft) on the gdb tutorial. When I validated the CSS at W3C, I noticed that the validator, by default, chooses CSS level 2.1 instead of CSS level 3. You can manually select CSS3 in the drop down menu here, but I want to be able to click on the link from each of my pages. After all, the reason I have the valid HTML5 and CSS images on every page is to have a handy way to validate each one quickly and easily. Anyway, the fix is pretty simple, which I found in this post. Change the link for the CSS validator to this:
http://jigsaw.w3.org/css-validator/check/referer?profile=css3
The part you need to add is in red.
http://jigsaw.w3.org/css-validator/check/referer?profile=css3
The part you need to add is in red.
Saturday, February 5, 2011
Getting TweetDeck (Adobe Air) to use your default browser in Gnome
This has been a bit of an issue in the past. See this lifehacker article, which was inspired by Roy Tanck's blog post. Currently, I am using Adobe Air 2.5.1 on OpenSUSE 11.3 - i386 (Yes, I have a crappy Atom powered net book). Every time I would open a link in TweetDeck, it would open in Firefox rather than Chromium. To make matters worse, the place in Chromium where I could set it as the default browser, the button is grayed out, and it says "Chromium cannot determine or set the default browser." Bummer. But fear not, as the solution is somewhat simple. If you have the "custom menu bar" (not the default one which ships with OpenSUSE) you can do System->System->Preferred Applications, and change the default browser there. Alternatively, you could run "gnome-default-applications-properties" in your shell to get the dialogue box opened up. Once I got it open, on the "Internet" tab, I dropped down the menu under "Web Browser" and selected "Custom". Then I put in /usr/bin/Chromium. You would obviously replace that command with the browser you want to use. And that's it! I didn't even have to restart TweetDeck. It just worked from there on out.
Sunday, January 2, 2011
How to change Epiphany default search from Google to DuckDuckGo (Gnome)
I have been playing around with two new toys lately: The Epiphany web browser, and DuckDuckGo search. I might write more on these another time, but for now I want to show you how you can change the default setting for search (in Epiphany) from Google to DuckDuckGo, by using gconf-editor in Gnome:
Fire up a shell, and enter:
gconf-editor
A dialogue box will pop up. Click on apps -> epiphany -> general
You will see a list of things on the right. Scroll down until you see 'url_search'. Click that, then right click, and select 'edit key'. In the new dialogue box that comes up, paste the following into the 'Value' field:
http://duckduckgo.com/?q=%s&ie=UTF-8&oe=UTF-8
Click, 'OK', and then close gconf-editor. Now when you open up Epiphany and do a search, you should be looking at a result page from DDG, instead of Google.
Happy DDG'ing!
Fire up a shell, and enter:
gconf-editor
A dialogue box will pop up. Click on apps -> epiphany -> general
You will see a list of things on the right. Scroll down until you see 'url_search'. Click that, then right click, and select 'edit key'. In the new dialogue box that comes up, paste the following into the 'Value' field:
http://duckduckgo.com/?q=%s&ie=UTF-8&oe=UTF-8
Click, 'OK', and then close gconf-editor. Now when you open up Epiphany and do a search, you should be looking at a result page from DDG, instead of Google.
Happy DDG'ing!
Humorous AMD Video
With CES looming, and news of AMD winning the International CES Innovations 2011 Design and Engineering Award for its Fusion APU, I have to say I am pretty excited to see Fusion finally coming to fruition. Anyway, since Fusion is upon us, here is a funny new promotional video from AMD about fusion; watch for AMD President & CEO Dirk Meyer at the end:
Saturday, December 18, 2010
How to build Dillo on OpenSUSE 11.3
Dillo is a small, fast, and light browser. In order to build it on OpenSUSE, you will need some pre-requisites. This article will cover how to get the source code for Dillo (and associated libraries), as well as the software build tools you will use to compile the Dillo browser.
Sunday, November 28, 2010
How to change Gnome login background image.
Update: For OpenSUSE 11.4, see this post.
As root, enter the following into your shell:
Of course you will need to change the bit in red, "some_picture_filename.png" to the one that you want as your background image on the login screen.
It seems that the method for doing this has been evolving. What worked even six months ago does not appear to work now. As of this writing, I am using Gnome 2.30.0 with OpenSUSE. I found the information here.
As root, enter the following into your shell:
gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
--type string \
--set /desktop/gnome/background/picture_filename some_picture_filename.png
Of course you will need to change the bit in red, "some_picture_filename.png" to the one that you want as your background image on the login screen.
It seems that the method for doing this has been evolving. What worked even six months ago does not appear to work now. As of this writing, I am using Gnome 2.30.0 with OpenSUSE. I found the information here.
Saturday, November 6, 2010
Excellent AMD Bulldozer Blog
Many of us have been patiently waiting for the release of the AMD Bulldozer processor. As the date draws nearer, more details about the chip are starting to emerge. Today I came across this interesting blog, Patent based research regarding AMD's future MPUs. The title gives a little idea of what the blog is about, but keep in mind that there is more there than patent research. Indeed, there is a lot of info there. The author also comments on the AMD Llano and Bobcat processors. Check it out for yourself!
Tuesday, September 14, 2010
Misconceptions
Last night I was fiddling around with some really simple code; the object of my program was to test a positive integer, to see if it was odd or even, and then print the result. There is more than one way to do this, some being more expensive than others. I thought I would run some tests to see what sort of differences, with regard to program execution time, I could come up with. I had three methods of checking for whether a number was odd or even.
Sunday, August 22, 2010
encrypt(3) example usage
A while back I had someone ask about how to use the encrypt() function under Linux. He had tried the man page, encrypt(3), which even contains an example usage. Unfortunately for him, the example given was terribly broken. I managed to find a post by Jens Thoms Törring which contained a working sample (though there was an off-by-one error which Mr. Törring later brought to my attention). Since the current man page at the time had a broken example, I thought I would send a patch in to have it fixed. That was a little over a year ago, but guess what? Still the same broken code! I don't know why the patch was not applied. Perhaps it was a crappy patch (I don't normally do patches, so I might have done it wrong). Or maybe the maintainer of the man pages was too busy. I don't really know what happened. Since speculation is pretty much useless, I thought I might post the code here, for anyone else searching for a useful example of encrypt usage.
Saturday, August 21, 2010
The easy way out
I was just reading an article by Andrei Alexandrescu called, The Case for D. In it he compares the traditional C "hello world" program to its D counterpart. Consider the following example:
#include <stdio.h> main() { printf("Hello, world\n"); }If I compile this with gcc -o hello hello.c, I get an executable (without any warnings from the compiler). It runs, and the return value is 13. Wha-what? Return value? I didn't return anything. But printf() did.
Google Go, or Digital Mars D?
Recently I learned of the Go programming language. It is, according to the header on the main golang web page, an expressive, concurrent, garbage-collected, systems programming language. It looks kind of cool. There is a compiler (6g) which works on my system. I would prefer to use the gcc front-end (gccgo), but at this point I cannot get it running.
Then there is the D programming language. It is, according to the D main page, also a systems programming language. It looks appealing as well. D comes with its own compiler, dmd, and a front end for gcc (gdc).
Apparently, it kind of seems that these two languages have some overlap in their audience/goals. This thread has some discussion about that from a primarily pro D perspective. This is another thread, but more from a pro Go perspective.
My dilemma is that I want to learn a new language. I am a hobby programmer, with a pretty good handle on C. I have made stabs at C++ before, and while I think it is a wonderful language (string handling and memory management are so much easier than C) it is also a lot more to learn than C. I am wondering if D or Go might be more suitable. Ultimately, I might have to dive into both to make my decision. I am hoping not to have to do that though. One thing that will help make my decision is the documentation available. I cannot learn a new language without some help. So I will have to look into that aspect as well. If you are a Go programmer, or a D programmer, (or both) and you feel like offering any suggestions as to what path I should take, please leave a comment. I would appreciate any sound advice.
Subscribe to:
Posts (Atom)