Join this community to post or comment

Lane Williams

General Coding Questions  - 
It was mentioned in the last episode about the Google Protocol Buffer storage option.  This looks really interesting.  Could someone reference the NuGet package used for it along with somewhere to see or download sample C# code usage of it? 

Thanks, Lane
Chris Darrigo's profile photo
Lane, I had the same thought. I downloaded the sample code that Lou demonstrated 2 weeks ago, which I thought used protocol buffers, but found no reference in the visual studio solution.  I've been researching it, and it looks like Protocol Buffers is fairly old technology  (5 yrs).   You might want to check out instead.
Add a comment...

Chris Darrigo

Episode Discussion  - 

I was really interested in the Protocol Buffer persistence solution you discussed on this week's show, but I can't find it in the d/led code.   (I got the code via the DropBox link on the TWIT/Coding web page)

Is there an updated version somewhere?
Chris Darrigo's profile photo
+Louis Maresca - Any updates on this?
Add a comment...

Chris Darrigo

Episode Discussion  - 
I downloaded the TWIT API Solution, but apparently my VS2013 instance is too old to open the solution.

Is it possible to publish a solution from an older version.  Not everyone has (or wants) VS2015 yet.
Omega Nine's profile photoChris Darrigo's profile photo
I have vs2013 ultimate, and I'm not ready to move to 2015 yet. I work on team projects and If I upgrade, the other people on the team won't be able to open the project once its "migrated" to a 2015 project.
Add a comment...

Jeff Brand

Episode Discussion  - 
Regarding the TWiT API...

Thanks to +Patrick Delahanty for fixing a number of little glitches with API requests.

Following an IRC conversation with Leo, I learned that the API is effectively "unsupported" as there are no real human resources available to support the use of the API. (AKA Patrick is very busy!)

I expressed interest in coordinating a forum on this subject but didn't know the preferred way to facilitate this. The wiki is a perfect spot to publish code examples but some sort of forum would be better for actual support and discussion.

I was also looking for a sample of FAQs that Patrick has received but hasn't had time to answer as a way to seed the discussion.
Jeff Brand's profile photoLarry Weiss's profile photo
Patrick Delahanty enabled the Discussion page related to  after a request I made in "chat" after Coding 101 today.  I posted one test post to it.  
Add a comment...

Lee Crocker

Episode Discussion  - 
Random thoughts....

Great episode with Steve. While I greatly admire his talents and accomplishments, I should point out that entropy collection is nothing new. The Linux kernel does this and exposes two interfaces: reading /dev/urandom returns bits from a PRNG fed by this entropy pool. Reading /dev/random is similar, but will actually block until there is enough entropy to ensure the read is completely random. It is quite suitable for cryptographic applications. BSD and OSX use an even better harvester called Yarrow. The best harvester is probably an algorithm called Fortuna by Ferguson & Schneier (yes, that Schneier), but I'm not aware of any OS that uses it.

Linux will also expose a hardware-based RNG as /dev/hwrng of you have one, as many chips today do.

I'm surprised he didn't also mention harvesting entropy on the mobile side... we have a big advantage here that a digital camera using CCDs or CMOS photosensors can generate true quantum randomness just like a reverse-biased diode. If you have none of the above available to you, there are services like that provide true random numbers from things like weather data.

And of course programmers should all be taught the most important thing about cryptographic algorithms and RNGs: Don't "roll your own". Use well-known, tested algorithms, and use them exactly as designed. Any "improvement" you make is very likely to make it worse. Never use "common sense" to reason about higher math; it doesn't work.
Larry Weiss's profile photoLee Crocker's profile photo
Steve is one of the few who is exempted from that rule. :-) Also you may note that nothing above applies to Windows, so yes, he was probably stuck writing his own for Windows.
Add a comment...

Louis Maresca

Episode Discussion  - 
Come Join is Live today at 2:30 PM PST as +Fr. Robert Ballecer, SJ​and I talk tech, code, teaching and influences on +TWiT Coding 101​ with +Scott Hanselman​ . 
mike klaene's profile photoOmega Nine's profile photo
Yay no more iOS.  
Add a comment...

James Coleman

Episode Discussion  - 
Another note on Objective-C. If you want to reference a class in a header file, you can use @class Class, Class2; to just say it exists, then import the header file in the actual code. The reason you do not want to import the header file in the header file is you can cause issues for other classes which import that header file.
Add a comment...

James Hughes

General Coding Questions  - 
I posted this on KH, but I think it really belongs here. I'm trying to build my own filament resetter for my Da Vinci 3d printer. Here's my problem:

 I'm trying to upload the sketch that resets the cartridge to my arduino uno and keep getting an error message that it's not in sync.. I've tried changing out the pin connections and everything else I can think of.

Here is the code that is returned (I'm on a Mac if that makes any difference, and I've already replaced the FTDI drivers.):

Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 28,672 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
/Applications/ -C/Applications/ -v -patmega328p -carduino -P/dev/cu.usbserial-AI02OD5P -b115200 -D -Uflash:w:/var/folders/zt/07g4_7yd3wz5kxt73gtlkzbw0000gp/T/build8381775075535385418.tmp/Blink.cpp.hex:i 

avrdude: Version 6.0.1, compiled on Apr 14 2015 at 16:30:25
         Copyright (c) 2000-2005 Brian Dean,
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/"
         User configuration file is "/Users/teacher/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-AI02OD5P
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xa0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20

avrdude done.  Thank you. 
Lee Crocker's profile photoJames Hughes's profile photo
Thanks +Lee Crocker​, it turns out that I was selecting the wrong board from the list. I have the arduino pro mini and in the list I was picking the mini. 
Add a comment...

Donald Burr

Episode Discussion  - 
Just started watching the most recent iOS segment. I realize it's probably pre-recorded so you guys may not have had the most up-to-date information, so I just wanted to mention a few quick corrections.

* As of June 2015, the Apple developer programs are now united. A single $99/year fee will allow you to develop and sell apps for both iOS AND OS X.
* I mentioned this before in another post, but maybe you didn't catch it. When Xcode 7 comes out later this fall (along with iOS 9) you will no longer need to pay for the Developer Program to test on YOUR OWN DEVICES. So long as a device is signed in to iCloud with YOUR Apple ID, you will be able to load and run code on it without having to join the paid developer program. You WILL still need to join the paid program, however, if you want to distribute apps to beta testers (other than yourself), or to sell it in the  App Store.
Louis Maresca's profile photoDennis A. Deschamps (Drmacintosh)'s profile photo
I would like to find out more about Swift replacing Objective-C and Open Source talked about @ WWDC 2015 
Add a comment...

About this community

Join Father Robert Ballecer and Louis Maresca on Coding 101, a weekly instructional, project-oriented programming show with appeal for beginning to intermediate programmers. Using a combination of classroom-style teaching, guest programmers, and special interest segments, Coding 101 will offer beginner, intermediate and "applied" programming topics within several interchangeable modules. Learn programming languages such as Java, C++, Visual Basic, and more! Records live every Monday at 2:30pm PT / 4:30pm ET.

Chris Darrigo

General Coding Questions  - 
Forget GO, Angular, and all the rest.. here's my next new language.

Going to download it now, but "I'll Be Back!"
IT'S SHOWTIME TALK TO THE HAND "hello world" YOU HAVE BEEN TERMINATED java -jar ArnoldC.jar hello.arnoldc java hello. Stop whining and start coding! Now with Sublime support. Download the markup. Linux folder. ~/.config/sublime-text-v/Packages/ArnoldC. Windows folder ...
Add a comment...

Armand Hendriks

General Coding Questions  - 
Hi all. I have the following challenge and chose Perl to complete it. After going through the Perl module on Coding 101 that gave me my basis I came up with the following solution but still have some challenges and would appreciate some assistance or any guidance on what or how to do it:

Problem: We have a csv file with thousands of records and I need to take the csv and convert them into ldif format for import.

The common way the csv looks like is
--> Fullname

I took this data and converted it to ldif but now there is a full name and I need the surname part of this field for each record so I used split for the initial version of the script and adding this into an array and then using the variables as needed but this does not compensate for people who has more than one name or a surname that has two parts.

My question for your consideration is:

How can I split up the Fullname but at the same time know when a surname starts vs the fullnames... 

I am unavailable to share the file for you but will paste it into this box.

Thank you for any aid or suggestions.

# Version 1.00
# This schript is to take a csv file and convert it to ldif format
# dependant on the requirement please ensure the csv is in the format as shown in code below else output will
# be wrong, current format of csv is:
# - First field: FullName
# - Second field: Mobile number
# - Third field: Email address
# - Fourth field: UserName
# - Fith field: Password
# - Sixth field: Dealer Code
# If the csv is not in the exact same order as shown above the output will be incorrect and code must be adapted
# to accomodate the new format.

use FileHandle; #use the filehandle class to handle external files for processing.

my(@details);#Declare the arrays

# User will be asked for what file to be converted
$csvFile = &promptUser("Name of file to be converted from CSV to LDIF 'Add' File");

$inputfile = new FileHandle($csvFile) ||

die "Can't open the import file!\n";

$outfile = new FileHandle(">$csvFile.ldif") ||

die "Can't create or open the output file!\n";

$logfile = new FileHandle(">AddData.log") ||

die "Can't create or open the log file!\n";

print $outfile "version: 1\n\n"; #First entry will be version 1 of ldif

# Loop to run through the entire file of enteries by line to convert them to ldif format
my $linecount = 0;
while(my $line = <$inputfile>) {

@details= split(',', $line); #Breakup the csv line to store values in an array

# The below is taking the array and storing it in variables to be used as the loop executes
$fullName = $details[0];
$mobile = $details[1];
$email = $details[2];
$userName = $details[3];
$password = $details[4];
$dealerCode = $details[5];
$cn = $userName;
my @sn= split ('_', $fullName);

#The actual format of how the ldif output for each entery will look like in the exported file
print $outfile "dn: cn=$cn,cn=thirdPartyUsers,dc=enterprise,dc=mtn,dc=co,dc=za\n";
print $outfile "objectclass: person\n";
print $outfile "objectclass: top\n";
print $outfile "objectclass: organizationalPerson\n";
print $outfile "objectclass: orclUserV2\n";
print $outfile "objectclass: inetOrgPerson\n";
print $outfile "cn: $cn\n";
print $outfile "sn: $sn[1] $sn[2] $sn[3]\n";
print $outfile "givenname: $sn[0]\n";
print $outfile "mail: $email\n";
print $outfile "mobile: $mobile\n";
print $outfile "uid: $userName\n";
print $outfile "userpassword: $password\n";
print $outfile "\n";

sub promptUser {


   #  two possible input arguments - $promptString, and $defaultValue  #

   #  make the input arguments local variables.                        #


   local($promptString,$defaultValue) =@_;


   #  if there is a default value, use the first print statement; if   #

   #  no default is provided, print the second string.                 #


   if ($defaultValue) {

      print $promptString, "[", $defaultValue, "]: ";

   } else {

      print $promptString, ": ";


   $| = 1;               # force a flush after our print

   $_ = <STDIN>;         # get the input from STDIN (presumably the keyboard)


   # remove the newline character from the end of the input the user  #

   # gave us.                                                         #




   #  if we had a $default value, and the user gave us input, then   #

   #  return the input; if we had a default, and they gave us no     #

   #  no input, return the $defaultValue.                            #

   #                                                                 # 

   #  if we did not have a default value, then just return whatever  #

   #  the user gave us.  if they just hit the <enter> key,           #

   #  the calling routine will have to deal with that.               #


   if ("$defaultValue") {

      return $_ ? $_ : $defaultValue;    # return $_ if it has a value

   } else {

      return $_;


Jeff Brand's profile photoChris Bickhaus's profile photo
Does Perl support string slicing like Python? If so, I would search the string for the right-most space and then set your surname variable to a slice of the full name string beginning after the last space. This should work as most multiple part surnames, I think, are separated by hyphens.

You could split the full name string based on spaces as well and just use the string in your list of split objects with the highest index. In Python this is index -1, so no need to know how many names there are. If Perl does not have that shorthand, could you reverse the list and then just use the first element? Or perhaps, you could use a while loop cutting off the first element of the list until there is only one left. That would be leave you with the last name. Again, it you split based on spaces, I would think that would still allow you to catch multi part last names, assuming hyphenation.

Sorry, I cannot offer any Perl specific advice. Hope this helps.
Add a comment...

Joel J

General Coding Questions  - 
Hey! IS anyone using VS 2015? How does it fare comparing VS 2013?
Omega Nine's profile photo
I have not used VS 2013 with any real frequency before but I use 2015 almost daily.  If you have a pro version of 2013 I would probably stick with it until you found a reason to upgrade.

If you are using express than I would suggest moving to community.  It feels like they moved almost all of the major pro features over to community as long as your using in small scale (first 5 developers in a team are free, can use addons now, can keep track of versioning). 

From a pure UI standpoint thought it is nicer with easier access to the tools most people use all the time. 
Add a comment...

Lionel D

Everything Else!  - 
Lionel D originally shared:
Haven't laughed this hard in a while.

Louis Maresca's profile photoBill Brandt's profile photoFernanda Moreno's profile photobesim abdullai's profile photo
Haha thanks for sharing Lionel!
Add a comment...

James Coleman

Episode Discussion  - 
iOS's text editor can do rich text if you change it from plain to attributed text. You may have to write controls to change bold, font, underline, and all of that... But it exists.
Add a comment...

James Coleman

Episode Discussion  - 
The guest who is teaching Objective-C is teaching methods I don't exactly agree with.

Using macros to store keys.
Using global variables to store notes.
Using NSUserDefaults to store data for the app.

The issue with macros is all they do is tell the compiler, wherever you see this variable, replace with what's here. So basically, every time you use the key, you make another copy of the key in binary. What I would use instead of macros is a constant variable:
NSString * const kMyKey =@"Key";

The issue with using global variables is that they are not contained within a class and the only reason you would ever want to use a global variable is if you need the data to stay across all new instances of a class. Or if you want to make a class so that it can have one instance that can be retrieved via a class method. This is called a singleton

The issue with using NSUserDefaults to store persistent data is that it's made for preferences and not data and you have to do what the guest did making it an NSData object. What I suggest doing for a notes app is just using the NSArray's built in method writeToFile using this will allow you to store to an file within the file system provided to your app. On an iOS device, that would be the Documents folder provided which can be found via [@"~/Documents/" stringByExpandingTildeInPath]. You can place the name of the file after the last / to get the path for the file under the documents folder ready to be written to.

I am a long time Objective-C guy, been using it for years now since Objective-C 1.0 and still write in 1.0 syntax.
Add a comment...

Patrick Delahanty

Episode Discussion  - 
Padre and I talk about robotic algorithms, a Windows 10 password leak via Wi-Fi Sense, and then I gives you a sneak peek of the TWiT API!
Coding 101 74 | TWiT.TV
Patrick Delahanty's profile photoJeff Brand's profile photo
+Patrick Delahanty , I reported this earlier but I imagine you've been swamped with the new website/API.. The link to the docs provided on the 3scale page ( has an invalid link back to the docs. I believe that link is to your own profile on 3scale.

Next, I'm trying to retrieve information by the <endpoint>/<id> format but receive a 404 error. Perhaps it's an error with the proxy url rules. Case in point:

... and yes, the rest of the request is right since it works without the ID at the end.

What am I doing wrong?
Add a comment...

Neil Balch

General Coding Questions  - 
Does anyone know what the benefits of installed apps on windows?  Putty for windows is an app, but it doesn't install.  It runs in realtime.  Are there more permissions allowed when you install a program?
Louis Maresca's profile photoNeil Balch's profile photo
+Louis Maresca I am not really building an app just yet, (Sorry to let you all down) I am mostly just interested in knowing why because I was getting really curious while using a Mac on a trip.

But.  I will ask you, for an app that would query information from the web, some Google and Social Media APIs and store a database of some kind (My SQL maybe?) locally on the machine and interact with a Ruby on Rails Back end, would the "Windows Installer" or the "ClickOnce" approach be more suitable?  Also, would .Net ClickOnce still use C# the same way you demonstrated in the Santa's Little Helper project?
Add a comment...

Neil Balch

Episode Discussion  - 
+Fr. Robert Ballecer, SJ I saw you had a VM on your Windows computer for OSX.  How did you get that and what did you use to obtain the OS?

Macs are quite expensive for me and I would like to tinker with Xcode.
Jeff Brand's profile photoLee Crocker's profile photo
Apple claims that Hackintoshes are illegal, but they really have no legal leg to stand on. Tying agreements are illegal per se under antitrust law, even for non-monopoly companies. That's why Epson can't stop you from using off-brand ink, Gillette can't stop you from using other razor blades. Apple's claim that they can stop you from using OSX on non-Apple hardware is hot air. I really hope someone sues over it who isn't doing other dubious things like Psystar was so we can have a good court ruling.
Add a comment...

Steven Erickson

Episode Discussion  - 
Does anybody have the link to the Medium article that Lou referenced in the last episode?
Louis Maresca's profile photoSteven Erickson's profile photo
Thanks Lou!
Add a comment...