Friday, July 29, 2011
USB Sniffing
This page details how to sniff usb data in Linux. Under Ubuntu some things have changed. You can use lsusb to see the USB information for your devices, and the folder under /sys has changed to /sys/kernel/debug/usb/usbmon
Monday, July 11, 2011
Transparent backgrounds with CSS
Simple method:
#lightbox {
background: white;
border: 20px solid rgba(0,0,0,0.3);
}
There may be more to it depending on what you want to accomplish
(where does the transparency begin and end?):
http://css-tricks.com/7423-transparent-borders-with-background-clip/
Friday, July 8, 2011
Disable broken scrollbars in Ubuntu 11.04
The code below willsupposedlystart applications that don't work
with the new Ubuntu 11.04 overlay scrollbar (such as eclipse),
without the scrollbar.
LIBOVERLAY_SCROLLBAR=0 /usr/bin/program_to_run
Thursday, July 7, 2011
Monitor the light sensor in Android
Haven't tried it yet, but
From this post
Only two files:
Code:
And layout:
From this post
Only two files:
Code:
package com.exercise.AndroidLightSensor;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
public class AndroidLightSensor extends Activity {
SensorManager mySensorManager;
Sensor myLightSensor;
TextView textLightSensorData;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textLightSensor = (TextView)findViewById(R.id.lightsensor);
textLightSensorData = (TextView)findViewById(R.id.lightsensordata);
mySensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
myLightSensor = mySensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
if (myLightSensor == null){
textLightSensor.setText("No Light Sensor!");
}else{
textLightSensor.setText(myLightSensor.getName());
mySensorManager.registerListener(lightSensorEventListener,
myLightSensor,
SensorManager.SENSOR_DELAY_NORMAL);
}
}
SensorEventListener lightSensorEventListener
= new SensorEventListener(){
@Override
public void onAccuracyChanged(Sensor arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
public void onSensorChanged(SensorEvent arg0) {
// TODO Auto-generated method stub
if(arg0.sensor.getType()==Sensor.TYPE_LIGHT){
textLightSensorData.setText("Light Sensor Date:"
+ String.valueOf(arg0.values[0]));
}
}};
}
And layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:id="@+id/lightsensor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/lightsensordata"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
Monday, July 4, 2011
Satisfying depdencies when building from source
If a source package has a Make file with "make install" functionality, running the command "check install" will generate a pseudo package for you that will install all required dependencies and after building the package can be used to remove all dependencies. What a find!
Handy tips
I just realized that a good way to remember the tips and things I come across that I have no place to put them, yet I realize I will never remember them when I actually need to use them, is to create a blog. So here we are. (I am thinking of Linux stuff, but anything will work).
Subscribe to:
Posts (Atom)