Last month, 200 Android Development Video Tutorials by TheNewBoston had been uploaded to ChangingTheUnknown Youtube channel. They have now prepared another playlist with 200 C# programming video tutorials for beginners in C#. To give you an idea of what you would learn, here are the titles of the first 10 tutorials: Introduction and Installing C# 2010 Changing Forms Properties Showing MessageBoxes Variables Changing Properties With Code If Statements More on If Statements If Statements pt 3 Switch Statements Mathematical Operators You can watch the first tutorial: “C# Beginners Tutorial – 1 – Introduction and Installing C# 2010” below. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com
Top 5 Most Influential Programming Books Ever
The following question was raised on StackOverflow back in 2008: What is the single most influential book every programmer should read? If you could go back in time and tell yourself to read a specific book at the beginning of your career as a developer, which book would it be. The question has become one of the most popular question on Stackoverflow and the users have voted for their favorites books. Here are the results: Code Complete: A Practical Handbook of Software Construction Widely considered one of the best practical guides to programming, Steve McConnell’s original CODE COMPLETE has been helping developers write better software for more than a decade. Now this classic book has been fully updated and revised with leading-edge practices—and hundreds of new code samples—illustrating the art and science of software construction. Capturing the body of knowledge available from research, academia, and everyday commercial practice, McConnell synthesizes […]
Drawing Charts in Android with AChartEngine Library
AChartEngine is a charting library for Android applications that currently supports the following chart types: line chart area chart scatter chart time chart bar chart pie chart bubble chart doughnut chart range (high-low) bar chart dial chart / gauge combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart cubic line chart They announced that new chart types would be added in future release (Current version is 0.7.0). You can follow the updates for the library on Google Code or Facebook at http://www.facebook.com/achartengine. You can download the aChartEngine library on Google Code. You can also download some demo code such as TemperatureChart.java which display the following chart with just 100 lines of code including comments. Here’s the code (TemperatureChart.java) to display the Chart above:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
** * Copyright (C) 2009, 2010 SC 4ViewSoft SRL * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.achartengine.chartdemo.demo.chart; import org.achartengine.ChartFactory; import org.achartengine.chart.BarChart.Type; import org.achartengine.model.RangeCategorySeries; import org.achartengine.model.XYMultipleSeriesDataset; import org.achartengine.renderer.SimpleSeriesRenderer; import org.achartengine.renderer.XYMultipleSeriesRenderer; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Paint.Align; /** * Temperature demo range chart. */ public class TemperatureChart extends AbstractDemoChart { /** * Returns the chart name. * * @return the chart name */ public String getName() { return "Temperature range chart"; } /** * Returns the chart description. * * @return the chart description */ public String getDesc() { return "The monthly temperature (vertical range chart)"; } /** * Executes the chart demo. * * @param context the context * @return the built intent */ public Intent execute(Context context) { double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 }; double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 }; XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); RangeCategorySeries series = new RangeCategorySeries("Temperature"); int length = minValues.length; for (int k = 0; k < length; k++) { series.add(minValues[k], maxValues[k]); } dataset.addSeries(series.toXYSeries()); int[] colors = new int[] { Color.CYAN }; XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5, -30, 45, Color.GRAY, Color.LTGRAY); renderer.setBarSpacing(0.5); renderer.setXLabels(0); renderer.setYLabels(10); renderer.addXTextLabel(1, "Jan"); renderer.addXTextLabel(3, "Mar"); renderer.addXTextLabel(5, "May"); renderer.addXTextLabel(7, "Jul"); renderer.addXTextLabel(10, "Oct"); renderer.addXTextLabel(12, "Dec"); renderer.addYTextLabel(-25, "Very cold"); renderer.addYTextLabel(-15, "Cold"); renderer.addYTextLabel(-5, "Quite cold"); renderer.addYTextLabel(5, "OK"); renderer.addYTextLabel(15, "Decent"); renderer.addYTextLabel(25, "Warm"); renderer.setMargins(new int[] {30, 70, 10, 0}); renderer.setYLabelsAlign(Align.RIGHT); SimpleSeriesRenderer r = renderer.getSeriesRendererAt(0); r.setDisplayChartValues(true); r.setChartValuesTextSize(12); r.setChartValuesSpacing(3); r.setGradientEnabled(true); r.setGradientStart(-20, Color.BLUE); r.setGradientStop(20, Color.GREEN); return ChartFactory.getRangeBarChartIntent(context, dataset, renderer, Type.DEFAULT, "Temperature range"); } } |
Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and […]
LinuxCon 2011 Presentation: Introduction to Python Programming Language
The third LinuxCon 2011 presentation is “Intro to Python” by Peter Krenesky, Lead Software Engineer at OSU Open Source Lab. Abstract: This presentation is a Python programming language tutorial with basics of Python including none, strings, formatting, data structures (tuple, list, dict, slices, etc…), classes (methods, inheritance, initializers, etc…), if statements, iterations and more. If you want to download the presentation slides, please go to Intro to Python and use the download button on top of the Slideshare presentation. If it does not work, you may also download a copy here or here. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com
ARM TechCon 2011: Software & System Design Schedule
ARM Technology Conference (TechCon) 2011 will be hosted in Santa Clara on the 25-27 October 2011. There will be many events and classes related to Chip Design and Software & System Design. The Software & System Design events will take place on the 26th and 27th October 2011. Here’s the schedule for Software & System Design events for the 26th of October: Time Class Track 11 am The 2012 Compute Subsystem Creating Smarter Systems 11 am Practical Cortex Debugging: Serial Wire Viewer and ETM Tracing Developing/Debugging 11 am Integrating a CMOS Imaging Sensor into an ARM-Based Embedded Application Human Interface Design 11 am Embedded IPv6 – Now is the time Networking & Connectivity 11 am RSA & AES Libraries protected against side-channel attacks Safety & Security 11 am Introduction to the ARM Architecture The Fundamentals of ARM 12 pm Optimizing SoC development through a common design foundation Creating Smarter Systems […]
New Revision of C++ Programming Language: C++11
The Final International Draft standard (FCD) was unanimously approved on August 12th, 2011. The standard should be published this year. The draft name of the standard is C++0x, but since it will be published this year, it should probably renamed C++11, and if there are delays in its publication it could well be renamed to C++12. You can download the 1334 pages “Working Draft, Standard for Programming Language C++” to get the full details. If you don’t feel like going thru that massive document, but still want to learn about C++0x, I recommend you check the C++0x FAQ on Bjarne Stroustrup (The creator of C++) homepage. Here are some the new features and improvements: initializer-lists – Initializer lists are not just for arrays any more uniform initialization syntax and semantics template aliases (previously know as template typedef) rvalue references defaulted and deleted functions variadic templates auto – deduction of a type from […]
Compile with ARM Thumb2 to Reduce Memory Footprint and Improve Performance
ARM claims that Thumb-2 instructions (for ARM Cortex cores and all ARMv7 processors) provides performance improvements and code size optimization: Thumb-2 technology is the instruction set underlying the ARM Cortex architecture which provides enhanced levels of performance, energy efficiency, and code density for a wide range of embedded applications. For performance optimized code Thumb-2 technology uses 31 percent less memory to reduce system cost, while providing up to 38 percent higher performance than existing high density code, which can be used to prolong battery-life or to enrich the product feature set. Thumb-2 technology is featured in the processor, and in all ARMv7 architecture-based processors. Dave Martin (Linaro) has recently posted a message entitled “ARM/Thumb-2 kernel size comparison” on Linaro mailing list:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
The question of the size impact of building the kernel in Thumb-2 came up to day, so I extracted some quick numbers: $ size vmlinux-* text data bss dec hex filename 8420507 463356 826928 9710791 942cc7 vmlinux-arm 6715539 463260 826928 8005727 7a285f vmlinux-thumb2 This is for a recent mainline kernel built with the linaro omap config. In this case we save about 20% for code and read-only data (i.e., text) and 17.5% overall -- which accounts for a little under 2MB saved in this example. This doesn't take loadable modules into account; we can probably expect to see a similar size ratio there. |
The results provided by Linaro at not as high as those claimed by ARM, but a 20% code size reduction is still impressive. If you want to use Thumb2 to compile […]
C Code to get MAC Address and IP Address
Function in C to return the MAC Address:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
/* Returns the MAC Address Params: int iNetType - 0: ethernet, 1: Wifi char chMAC[6] - MAC Address in binary format Returns: 0: success -1: Failure */ int getMACAddress(int iNetType, char chMAC[6]) { struct ifreq ifr; int sock; char *ifname=NULL; if (!iNetType) { ifname="eth0"; /* Ethernet */ } else { ifname="wlan0"; /* Wifi */ } sock=socket(AF_INET,SOCK_DGRAM,0); strcpy( ifr.ifr_name, ifname ); ifr.ifr_addr.sa_family = AF_INET; if (ioctl( sock, SIOCGIFHWADDR, &ifr ) < 0) { return -1; } memcpy(chMAC, ifr.ifr_hwaddr.sa_data, 6) close(sock); return 0; } |
Function in C to return the IP Address:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
/* Returns the interface IP Address Params: int iNetType - 0: ethernet, 1: Wifi char *chIP - IP Address string Return: 0: success / -1: Failure */ int getIpAddress(int iNetType, char chIP[16]) { struct ifreq ifr; int sock = 0; sock = socket(AF_INET, SOCK_DGRAM, 0); if(iNetType == 0) { strcpy(ifr.ifr_name, "eth0"); } else { strcpy(ifr.ifr_name, "wlan0"); } if (ioctl(sock, SIOCGIFADDR, &ifr) < 0) { strcpy(chIP, "0.0.0.0"); return -1; } sprintf(chIP, "%s", inet_ntoa(((struct sockaddr_in *) &(ifr.ifr_addr))->sin_addr)); close(sock); return 0; } |
Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com