Tag: Programming

And if you prefer to manually program your Baofeng GT-3, A52, B580T…

It’s really simple. First put the radio into Frequency mode. It’s different among all models but on the B580T it’s the orange button with a black circle inside it. If your have the speech activated the radio will say “Frequency Mode”. 

To setup a repeater you’ll need three pieces of information; the output frequency, input frequency and type of squelch (CTCSS, DCS). If you’re in the New England area use the New England Repeater Directory online. 

Now to offsets – the offsets for the 2m band is +/- 600kHz:

Here’s a handy table to figure it out based on the frequency:

2-Meter Repeater Output Frequency Standard Input Frequency Offset
145.1 MHz – 145.5 MHz -600 kHz
146.0 MHz – 146.4 MHz +600 kHz
146.6 MHz – 147.0 MHz -600 kHz
147.0 MHz – 147.4 MHz +600 kHz
147.6 MHz – 148.0 MHz

-600 kHz

Now on the 70cm band it’d 5mHz offsets. So let’s do an example:

Let’s say I want to setup 146.835MHz – while in Frequency Mode on the radio key in 1 4 6 8 3 5

Then hit the Menu key, then 27 (MEM-CH). Then hit menu again to choose the memory channel. An easy way to do this is to scroll until it’s just digits not CH-###. That way you know it’s an empty memory. 

Once you’ve selected the memory location hit the Menu key again. You’ll hear the radio say “Receiving Memory”. Make a note of what channel you assigned. 

Now key in the repeater input channel. For 146.835 the input is 146.235 and the CTCSS code is 192.8

On the radio and in Frequency mode hit 1 4 6 2 3 5

Now press menu key again and then 13 (T-CTCS). The nice part about this radio is you don’t have to scroll through all the CTCSS codes – you simply type it in. 1 9 2 8, then hit menu again to save it. 

Now press Menu and then 27. Make sure you’re on the same memory location you stored the receive frequency. Hit menu and you’ll hear the radio say “Transmitting Frequency”. 

Now go into channel mode by hitting the orange button at the top left of the radio and presto – the memory channel is there. 

 

So Once again with Microsoft Visual Studio

This time it’s Visual Studio 2012. Comes with C++, C# and VisualBASIC. Hmm – I had picked up a cheap learn C# book. I already have more than a passing familiarity with C++ and C and C# (Pronounced C Sharp) isn’t that much different except it’s Microsoft’s version of C++.

As such it has limitations. One of the best features of C++ is object oriented programming. Inherent in that is the fact that the object you create can have what is called polymorphism and inheritance and attendant overloading of methods.

In C++ you’re pretty much unlimited to overloaded methods. But in Microsoft’s fucking wisdom, you get by one in C#. One. Are they serious?

I can sort of understand why they’d do this, as overloading methods can get to be a little hairy with memory management but that’s always been the trade-off in higher level programming languages.

I should mention, most of the code base of Window 7 and Windows 8 are written in, you guessed it, C#.

But I do find it interesting that Microsoft still bundles C++ in there. As a reference point I believe Windows XP was written in C++ which may account for some of the limitations of the operating system and the lack of the new Windows filesystem. But there’s still a hell of a lot of XP machines out there. Particularly in government settings.

Why I still say we should teach kids how to program computers

I just watched an interview of Steve Wozniak of Apple fame.

Now I’ve related before that I once did a program review at a public high school in Rhode Island. We got to evaluate two classes at each school.

I happened to get the class where they were teaching the kids the MS Office suite, and that day they were doing a payroll spreadsheet in Excel. The teacher had given them all cheat sheets for the tax calculation.

So I asked the teacher – why not do a formula to CALCULATE the tax. You can do it in any cell by entered =({cellID}*3.1415)*.02499, or you can say =VLOOKUP(item,source). Or you could have a Visual BASIC routine that calculates the tax in column D.

The teachers answer was that it was computer programming to to that, and to program a computer you need a lot of math.

I thanked the teacher. But what I wrote in my report was that the most math you need to program a computer is MAYBE the first few weeks of Algebra I. But more to the point, you need to understand different numbering systems. There’s binary of course, either 1 or 0 and none more.

Then there’s octal – 0 through 7 it’s base 8. So how would you write 9 in octal? It’s 11 or 1 in the 8’s column, plus  1.  Let’s do 0 through 10:

Decimal    Octal

0               0

1               1

2               2

3               3

4               4

5               5

6               6

7               7

8               10

9               11

10             12

 

You see where it’s going, right? Instead of the maximum being 10, the maximum is 8 per column. And the columns go 1, 8, 16, 32… 

This leads us to hexadecimal. This is base 16. Symbols run 0 through 9, plus A through F, where A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

For this example I’m going to go form 1 to 20 in decimal and show the hex (short form) value.

Decimal     Hexadecimal

0               0

1               1

2               2

3               3 

4               4

5               5

6               6

7               7

8               8

9               9

10             A

11             B

12            C

13            D

14            E

15            F

16           10

17           11

18           12

19           13

20           14

 

And so on.

 

It’s really quite easy. So let’s teach the kids how to program. You do not need advanced math for that.

RaspberryPi Founder says programming makes you a better doctor

Go read for yourself.

Now for my comments. He’s right – but I’d clarify a bit as I did on the report I wrote when I was doing program reviews in schools around Rhode Island.

You do not need advanced math to program a computer. You need to know the four basic functions, addition, subtraction, multiplication and division and perhaps the modulo function.

If you’re not sure what modulo is I’ll explain. It is a function that when given a numerator and denominator will return a remainder.

E.g.

10 mod 1 = 0

10 mod 2 = 0

10 mod 3 = 1

10 mod 4 = 2

10 mod 5 = 0

10 mod 6 = 4

10 mod 7 = 3

10 mod 8 = 2

10 mod 9 = 1

10 mod 10 = 0

You see the pattern there don’t you.

So knowing the four basics and modulo are all you need.

Then there are a few functions available in several languages that help you out. In BASIC there’s the INT function. It returns the integer value of a variable. E.g. INT(3.14159) will get you 3.

But start programming and you’ll learn about arrays, lists, string manipulation, etc. Go and take the Udacity Intro to Programming course. It’s a seven week program but at the end of it you’ll get a view of how programming works using Python, one of the up and coming languages out there.

And now for some snark:

By 2005, when Upton had completed his studies and was himself interviewing undergraduates at Cambridge, this was no longer the case. If applicants had experience “coding,” this typically amounted to writing some HTML for the web (which isn’t programming), perhaps with a touch of back-end development in a few cases. Upton complained that, since that time, a chunk of the limited 60 weeks total term-time available for an entire undergraduate degree has to go on teaching the basics. Cambridge University, you’ll have realized, has notably short terms.

Now my snarkiness – yep, I’m not a webbie and in fact I consider those who only know HTML and maybe CSS not to be programmers too. I can program in several languages including PERL, Python, PHP, Visual BASIC, and even COBOL! I also understand MySQL and MS-SQL pretty well – enough to tie them to web services etc.

And to this day people are impressed by my mathematical ability. All because I’ve been programming computers since I was 13 years old, which makes it 35 years.

Programming the KST V6

It’s pretty simple once you get the hang. First of all you have to set the I/O to 1.6MHz for the 222MHz band. This is done by doing the following:

– Press the orange F key and then the 9 key to get into settings

– Scroll to option 4 with the up and down keys – until the frequency differential reads 01.60

– Press the F key to save it.

Now the repeater offsets will work. The radio has a split personality – it originally started out as a radio for 2m and 70cm so now that it’s on 1.25m it retains the 10MHz offset which doesn’t work so doing the above gets you set to go!

So now key in your frequency – for my example I just programmed in the 224.060 repeater with negative offset and CTCSS of 103.5.

1) Enter the frequency into the radio, in this case 224.060.

2) To set the offset hold down the orange F key and press 5 and it cycles between none, positive and negative offset. Another relic of 2m and 70cm here.

3) To set the CTCSS press the orange F key and then the 8 button. Then use the navigation buttons to scroll to item 14 which is the 103.5Hz CTCSS tone to access the repeater.

4) To save the repeater in memory press the orange F key and then the * key. Use the direction buttons to choose a memory slot to store the memory. The radio does not automatically go to next empty slot btw, so try to remember where you started.

5) Once you’ve programmed it in the radio will be in channel mode. To switch back to Frequency mode hit the # (VM) key. You can continue to add repeaters following the steps above.

** Special Note ***

To change the power level on a channel simply hit the orange F key and the # key. It toggles between lighting the little L indicators in the display and turning it off. When the indicator is off it’s in high power mode. Save the channel again (F+*).

I hope this helps folks out. It’s a whole lot more clear this way than in the Chinese to English manual.

What does it take to become a computer programmer

So this thread on Slashdot got me to thinking.

A few years back I was doing program reviews for the State Department of Education. It was an eye opening experience I’ll tell you that. By and large most of the teachers I had interacted with were on the ball, but there were a couple that had I the ability, I would have terminated immediately.

One was a class in which they were learning about the Microsoft Office suite. A laudable goal I suppose. But me being the never happy with the minimum type had a sour taste on this review.

Why? Because on the day we were there the class was working on a payroll spreadsheet. But what really caught my attention was the fact they were using a tax lookup sheet, a physical piece of paper that showed the tax for a given amount.

So I asked the teacher if she had anything planned to use VBA or Visual BASIC for Applications.

The teachers answer was that you needed all sort of math to program a computer and my response was “If you have a semester of Algebra I you can get by.”

In fact I’ll clarify, all you need to do is understand Boolean logic.

There are several constructs in Boolean:

AND
OR
XOR
NOT

Believe it or not, you learned about this in Algebra I. Yes you did, because Boolean math aka Logic is part of it.

I’ll take it one by one. But first know that for an evaluation to be true the conditions particular to the operation need to be met.

In the case of AND, both inputs need to be true in order for the output to be true.

In the case of OR, only one or both of the inputs need to be true for the output to be true.

In the case of XOR (Exclusive OR), only one of the inputs can be true, not both, for the output to be true.

In the case of NOT, the input is inverted. If a true condition is the input the output is false.

As for mathematics themselves, if you know about integer operations such as modulus, absolute value, and a few other tricks you have the skill set to learn a programming language.

All you have to do is learn the syntax of a programming language. The BASIC language is fairly forgiving. But PHP, Python, and a whole slew of languages, even the overly verbose COBOL use plain English in most cases.

Sure, in some there are constructs like:


if(a && b = 1)

Which translates to do something “if both a and b are true”.

Yeah that simple.

A loop:
for(a=0,a<=10,a++)

Translated that means execute a loop using variable a as the index. Continue to run the loop while a is less than or equal to 10. The final part that ‘a++’ says to increment a.

Simple.

That’s C style above.

BASIC is even easier.

if x=y then

Whatever follows the ‘then’ keyword is executed if the test x=y evaluates as true.

So let’s say x=1 and y=1 – that would evaluate to true because X=Y.

The for loop:

for i = 1 to 100

Use variable i as your index variable. Loop through until 100 loops.

Hope that demystifies programming just a little bit for you.

Mea Culpa on Udacity

I had posted before where Udacity wasn’t working at all. I couldn’t drop courses, see the videos, etc. despite trying via multiple different browsers.

If you read my post about Problem Solved then you know I replaced my WiFi card on my computer.

I’m happy to report that Udacity now works. So I’ve re-registered for CS101 – Building a search engine. They’ve also added a number of new courses such as those marked with an ‘*’ are ones I wish to attend, a ‘**’ is one for which I have registered:

CS101 – Building a Search Engine(**)
CS212 – Design of Computer Programs
CS253 – Web Application Engineering (*)
CS262 – Programming Languages (JavaScript and HTML) (*)
CS373 – Programming a Robotic Car(*)
CS387 – Applied Cryptography(*)

It’s definitely going somewhere. I love it. The new CS101 starts tomorrow. This time I’ll be able to do it because I don’t have a network card stuttering along.

So my apologies to the team at Udacity. I look forward to the class!