alvinalexander.com: Android 5 Preferences tutorial (PreferenceScreen, PreferenceActivity, and PreferenceFragment)

alvinalexander.com: Android 5 Preferences tutorial (PreferenceScreen, PreferenceActivity, and PreferenceFragment)

The code here has been updated from iRomani’s tutorial, and contains the necessary corrections to work with Android 5, specifically using a PreferenceFragment along with the PreferenceActivity:

package com.alvinalexander.preferencestestapp;

import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;

public class MyPreferencesActivity extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getFragmentManager().beginTransaction().replace(android.R.id.content, new MyPreferenceFragment()).commit();
    }

    public static class MyPreferenceFragment extends PreferenceFragment
    {
        @Override
        public void onCreate(final Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            addPreferencesFromResource(R.xml.preferences);
        }
    }

}
Advertisements

javadude.com: Java is Pass-by-Value, Dammit!

javadude.com: Java is Pass-by-Value, Dammit!

I’m a compiler guy at heart. The terms “pass-by-value” semantics and “pass-by-reference” semantics have very precise definitions, and they’re often horribly abused when folks talk about Java. I want to correct that… The following is how I’d describe these

Pass-by-value
The actual parameter (or argument expression) is fully evaluated and the resulting value is copied into a location being used to hold the formal parameter’s value during method/function execution. That location is typically a chunk of memory on the runtime stack for the application (which is how Java handles it), but other languages could choose parameter storage differently.

Pass-by-reference
The formal parameter merely acts as an alias for the actual parameter. Anytime the method/function uses the formal parameter (for reading or writing), it is actually using the actual parameter.

Java is strictly pass-by-value, exactly as in C. Read the Java Language Specification (JLS). It’s spelled out, and it’s correct.

In Java,

Dog d;

is exactly like C++’s

Dog *d;

And using

d.setName("Fifi");

is exactly like C++’s

d->setName("Fifi");

TinkerForge

TinkerForge

Building blocks with a wide range of modules
The well matched Tinkerforge modules allow experienced programmers to concentrate on the software, thus projects can be completed faster. A programming novice on the other hand has the possibility to learn programming with exciting applications by using the Tinkerforge building blocks.

No detailed knowledge in electronics necessary
The realization of a project with Tinkerforge is possible without troubles. You simply pick the required modules and connect them together with each other. There is no other electronics knowledge and no soldering needed.
For example: If the project is to control a motor dependent on a measured temperature, you just have to choose a temperature sensor and an appropriate motor controller out of the available Tinkerforge building blocks.

Intuitive API
The Tinkerforge API offers intuitive functions, that simplify the programming. For example: It is possible to set the velocity of a motor in meters per second with a call of setVelocity() or to read out a temperature in degree Celsius (°C) with getTemperature().

envisage-project.eu: Proving that Android’s, Java’s and Python’s sorting algorithm is broken (and showing how to fix it)

envisage-project.eu: Python’s and Java’s Sort broken

Tim Peters developed the Timsort hybrid sorting algorithm in 2002. It is a clever combination of ideas from merge sort and insertion sort, and designed to perform well on real world data. TimSort was first developed for Python, but later ported to Java (where it appears as java.util.Collections.sort and java.util.Arrays.sort) by Joshua Bloch (the designer of Java Collections who also pointed out that most binary search algorithms were broken). TimSort is today used as the default sorting algorithm for Android SDK, Sun’s JDK and OpenJDK. Given the popularity of these platforms this means that the number of computers, cloud services and mobile phones that use TimSort for sorting is well into the billions.

Fast forward to 2015. After we had successfully verified Counting and Radix sort implementations in Java (J. Autom. Reasoning 53(2), 129-139) with a formal verification tool called KeY, we were looking for a new challenge. TimSort seemed to fit the bill, as it is rather complex and widely used. Unfortunately, we weren’t able to prove its correctness. A closer analysis showed that this was, quite simply, because TimSort was broken and our theoretical considerations finally led us to a path towards finding the bug (interestingly, that bug appears already in the Python implementation). This blog post shows how we did it.

FTP directory: /pub/dick/similarity_tester/

FTP directory: /pub/dick/similarity_tester/
This is SIM, Software and text similarity tester, most recent revision (2.26, 20080923) by Dick Grune, Vrije Universiteit, Amsterdam, the Netherlands (dick@cs.vu.nl). SIM tests lexical similarity in texts in C, Java, Pascal, Modula-2, Lisp, Miranda and natural language. It can be used – to detect potentially duplicated code fragments in large software projects, – to detect plagiarism in software and text-based projects, educational and otherwise. The program is fast: the UNIX version on a Sun ULTRA does about 50000 tokens/sec, the DOS version on a Pentium 166 does about 25000 tokens/sec. SIM is available for UNIX (in source code) and MSDOS (32-bit executables). UNIX: To obtain the files, unpack sim_2_*.zip This yields the sources, the Makefile, sim.pdf and READ_ME. For installation notes and other info then see READ_ME.

tangiblesoftwaresolutions.com: Source Code Converters

tangiblesoftwaresolutions.com: Source Code Converters
Instant C# converts VB code to C# Instant VB converts C# code to VB C++ to C# Converter converts C++ code to C# C++ to VB Converter converts C++ code to VB C++ to Java Converter converts C++ code to Java Java to C# Converter converts Java code to C# Java to VB Converter converts Java code to VB C# to Java Converter converts C# code to Java VB to Java Converter converts VB code to Java C# to C++ Converter converts C# code to C++ VB to C++ Converter converts VB code to C++ Java to C++ Converter converts Java code to C++

gulp.de: GULP IT-Projektmarktindex: Der Gradmesser für die Angebots- und Nachfragesituation am IT-Projektmarkt

gulp.de: GULP IT-Projektmarktindex: Der Gradmesser für die Angebots- und Nachfragesituation am IT-Projektmarkt
Die monatlichen Projektanfragen sind im Mai 2014 lediglich um 0,3 Prozent gesunken: von 13.694 im April 2014 auf 13.656 Anfragen. Im Vorjahresvergleich aber schneidet der Mai 2014 gut ab: Im Mai 2013 konnten 12.573 Anfragen verzeichnet werden. Somit liefen im Mai dieses Jahres über 1.000 Projektanfragen über http://www.gulp.de und http://www.gulp.ch, also rund 8,6 Prozent mehr als im Vorjahr.