This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QApplication> | |
#ifdef _WIN32 | |
#include <Windows.h> | |
#endif | |
int main(int argc, char *argv[]) | |
{ | |
#ifdef _WIN32 | |
if (AttachConsole(ATTACH_PARENT_PROCESS)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef STREAMTUPLE_H | |
#define STREAMTUPLE_H | |
#include <iostream> | |
#include <tuple> | |
namespace aux{ | |
template<std::size_t...> struct seq{}; | |
template<std::size_t N, std::size_t... Is> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PARSEKV_H | |
#define PARSEKV_H | |
#include <tuple> | |
#include <string> | |
#include <boost/regex.hpp> | |
// link against boost_regex (-lboost_regex) | |
std::tuple<std::string,std::string> parseKeyValue(std::string arg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), | |
ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); | |
// ... | |
QSettings settings; | |
restoreGeometry(settings.value("geometry").toByteArray()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Making an adapter discoverable (check that rfkill is enabled, otherwise /org/bluez/hci0 will not be available) | |
dbus-send --system --dest=org.bluez --print-reply /org/bluez/hci0 \ | |
org.freedesktop.DBus.Properties.Set \ | |
string:org.bluez.Adapter1 string:Discoverable variant:boolean:true | |
* Changing the discoverable timeout. Default is 180s. | |
dbus-send --system --dest=org.bluez --print-reply /org/bluez/hci0 \ | |
org.freedesktop.DBus.Properties.Set \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cxxabi.h> | |
int main() | |
{ | |
MyClass *m = new SomeClass(); | |
char *demangled = abi::__cxa_demangle(typeid(*m).name(), 0, 0, 0); | |
std::cout << demangled << std::endl; | |
free(demangled); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
SERVICE_NAME = "org.bluez" | |
ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter1" | |
DEVICE_INTERFACE = SERVICE_NAME + ".Device1" | |
def get_managed_objects(): | |
bus = dbus.SystemBus() | |
manager = dbus.Interface(bus.get_object("org.bluez", "/"), | |
"org.freedesktop.DBus.ObjectManager") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date mDate = new Date(); | |
String s = DateUtils.formatDateTime(this, mDate.getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void shodDateDialog() { | |
final View dialogView = View.inflate(this, R.layout.date_time_picker, null); | |
final AlertDialog alertDialog = new AlertDialog.Builder(this).create(); | |
/* This will set up the default values */ | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTime(mDate); | |
DatePicker datePicker = (DatePicker) dialogView.findViewById(R.id.date_picker); | |
TimePicker timePicker = (TimePicker) dialogView.findViewById(R.id.time_picker); |