Jeff Cogswell is Comparing C++ Compilers

6 11 2013

Jeff Cogswell wrote an article in Slashdot “Speed Test: Comparing Intel C++, GNU C++, and LLVM Clang Compilers”.

He concluded:

It’s interesting that the code built with the g++ compiler performed the best in most cases, although the clang compiler proved to be the fastest in terms of compilation time. But I wasn’t able to test much regarding the parallel processing with clang, since its Cilk Plus extension aren’t quite ready, and the Threading Building Blocks team hasn’t ported it yet.

Read the full article here:

http://slashdot.org/topic/bi/speed-test-comparing-intel-c-gnu-c-and-llvm-clang-compilers/

my other side: ivo.blogspot.com





Float and Double: 1/3 + 2/3 = 0.99999999….

31 07 2013

Rob Eamon wrote about why 1/3 + 2/3 = 0.99999999….

Some excerpts:

Roedy Green’s Java Glossary (http://mindprod.com/jglossfloatingpoint.html) discusses floating point in Java at some length. He offers insight on why developers should not be surprised at the inaccuracy of floating point:

[0.1 is a repeater fraction in binary.] It is like the repeater fraction 1/3 = 0.33333 in base 10. When you add 0.333333… to 0.666666… why are you not astonished to get 0.999999… rather than 1.0, even though you just added 1/3 + 2/3 to get 1? Yet, with Java floating point you are astonished when you add 0.1 + 0.1 and get something other than 0.2.

It is clear that when using float and double types in Java, some care must be taken to ensure proper behavior for the task at hand. For financial applications, where accuracy is paramount, float and double may need to be avoided altogether.

Here’s the full article :

http://www.wmusers.com/ezine/2002oct1_reamon_1.shtml

my other side: ivo.blogspot.com





My fizzbuzz in C

11 04 2013

This is my version of the fizzbuzz test, written in C:

char *arr[] = {"%d\n", "fizz\n", "buzz\n", "fizzbuzz\n"}; 
for (int i=1; i<=100; i++) printf(arr[!(i%3)+2*!(i%5)], i);

or rephrased in a more readable format:

char *arr[] = {"%d\n", "fizz\n", "buzz\n", "fizzbuzz\n"}; 

int i, index;

for (i=1; i<=100; i++)
{
	index = !(i%3) + 2 * !(i%5);
	printf( arr[index], i);
}

my other side: ivo.blogspot.com





DroidDevelop

23 12 2011

DroidDevelop
https://market.android.com/details?id=com.assoft.DroidDevelop

Description
This is a tool for onboard android programming. For this tool works you should install JavaIDEDroid program for compile your Java program and OI FileManager for choose program files.
JavaIDEDroid use bsh scripts for programs compilation. On the DroidDevelop you can choose bsh script for compilation by “Open Project…” command. For compile you should press compile button.
You also can install and your run programm without exit from DroidDevelop. For this purpose you can press “Run…” button.
You also can edit your java or another project files without exit from DroidDevelop.

my other side: ivo.blogspot.com





JavaIDEDroid

23 12 2011

JavaIDEDroid
https://market.android.com/details?id=com.t_arn.JavaIDEdroid

Description
JavaIDEdroid is an integrated development environment which runs on Android and allows to create native Android applications without the need to use the Android SDK on Windows or Linux.

Following development tools are integrated in JavaIDEdroid:

* aapt tool
* Eclipse compiler for Java
* dx tool
* ApkBuilder (only unsigned APKs)
* zipsigner-lib (this library also does the zipalign)
* BeanShell Interpreter

You can write your own BeanShell scripts, store them on your SDCard and automate the build process with them.

Aapt is integrated as native shared library (arm). It uses external libraries which require Android 2.3 or later and therefore, the aapt shared library has been built for Android 2.3. Despite this fact, it also seems to work an older Android versions (it ran ok on my Android 2.2.1).

The software is free under the GNU GPL v2 license.
Check the project web site for more information and support:
http://code.google.com/p/java-ide-droid/
In the Wiki you’ll find a HowToGetStarted tutorial.

Please check the support forum before rating this app badly – it might need some configuration changes to fit your environment.

History: http://code.google.com/p/java-ide-droid/wiki/History

If you like this app, please check also JavaIDEdroidPRO!

my other side: ivo.blogspot.com





Qt for Android

23 02 2011

http://www.h-online.com/open/news/item/Qt-implementation-for-Android-introduced-1194815.html

my other side: ivo.blogspot.com





Microsoft All-In-One Code Framework

22 02 2011

Check it here:
http://1code.codeplex.com/

my other side: ivo.blogspot.com





VB6 ScaleLeft ScaleTop to VB.NET conversion

20 05 2010

Whenever you find .Scale(x) dimensions

TextBox1.ScaleTop
TextBox1.ScaleLeft
TextBox1.ScaleHeight
TextBox1.ScaleWidth

simply change it into .ClientRectangle.(x) form

TextBox1.ClientRectangle.Top
TextBox1.ClientRectangle.Left
TextBox1.ClientRectangle.Height
TextBox1.ClientRectangle.Width

Hope it helps.

my other side: ivo.blogspot.com





VB6 Format(Now) for milliseconds

7 04 2010
Option Explicit     
   
Private Type SYSTEMTIME '16 Bytes  
  wYear         As Integer  
  wMonth        As Integer  
  wDayOfWeek    As Integer  
  wDay          As Integer  
  wHour         As Integer  
  wMinute       As Integer  
  wSecond       As Integer  
  wMilliseconds As Integer  
End Type  
   
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)  

Usage:

Dim NowTime As SYSTEMTIME  
Dim sYear, sMonth, sDayOfWeek, sDay, sHour, sMinute, sSecond, sMilliseconds As String   

GetSystemTime NowTime  

sYear         = Format(NowTime.wYear, "0000")  
sMonth        = Format(NowTime.wMonth, "00")  
sDay          = Format(NowTime.wDay, "00")  
sHour         = Format(NowTime.wHour, "00")  'wHour - or + X depends local timezone
sMinute       = Format(NowTime.wMinute, "00")  
sSecond       = Format(NowTime.wSecond, "00")  
sMilliseconds =  Format(NowTime.wMilliseconds, "000")   

my other side: ivo.blogspot.com





A simple Modeless AfxMessageBox

10 12 2008

There were times when AfxMessageBox freezes my background process thread (socket communication, etc.) Here’s what I wrote as a quick and dirty solution. Put it in your StdAfx.h

You can refine it if you like.

//////////////////////////////////////////////////////////////////////////
// ivo setyadi [12/10/2008 Development]
// a simple (or semi) modeless AfxMessageBox using MFC thread
// usage: 
// CMy my; 
// my.ModelessBox("your message");
class CMy
{
public:	
	void ModelessBox( CString str) 
	{
		char *buffer=new char[256]; 
		lstrcpy(buffer,str);		 				
 		AfxBeginThread(showMessage, (LPVOID *) buffer,   THREAD_PRIORITY_NORMAL) ;
	}	
	
	static UINT showMessage(LPVOID lParam)  
	{  
		if(lParam == NULL)
			AfxEndThread(NULL);
		
		char *pStr = (char *) lParam;
		AfxMessageBox(pStr);  		
		delete pStr; // don't forget
		
		return TRUE;
	}  
};

There.

my other side: ivo.blogspot.com