
Last week I jumped to London to watch the Olympics. Being a huge sports fan the experience was amazing, but there was...
Foliage covered green roof in Kirkjubøur, a photo from Faroe Islands. More
With more than 25 photos & 90 likes every second, we store a lot of data here at Instagram. To make sure all of our...
Using a free wifi? Don’t forget to forget it.
Problem 1: Sending sensitive data over an insecure connection
Problem 2: Mixed mode
Problem 3: Sending auth cookies over an insecure connection
Problem 4. Not marking auth cookies as “secure”
Problem 5. Relying on HTTP to load login forms
Icon fonts are a new, modern way to implement icons. They have tons of benefits, such as…
As I tend to reinstall my computers quite frequently and I don’t keep back-ups, I thought I will keep here some code fragments I tend to use from time to time again and again.
Date Picker:
public class DatePickerFragment extends DialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), (InputActivity) getActivity(), year, month, day);
}
}
Time Picker:
public class TimePickerFragment extends DialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), (InputActivity) getActivity(), hour, minute, DateFormat.is24HourFormat(getActivity()));
}
}
Activity that uses the pickers:
public class DateActivity extends FragmentActivity implements DatePickerDialog.OnDateSetListener,
TimePickerDialog.OnTimeSetListener
{
public void showDatePickerDialog(View v)
{
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getSupportFragmentManager(), "datePicker");
}
public void showTimePickerDialog(View v)
{
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getSupportFragmentManager(), "timePicker");
}
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
{
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute)
{
}
}I’m completely new to all this, where should I start?
Honestly you have about a million options. Would you rather learn to program or use a scripting engine? Are you going to use pixel art, 3D models or vector art? Do you want to make your own music? Hopefully this FAQ will answer some basic…
Relatively random and unorganized set of web development tips that was derived from a set of interview questions by a former Digg developer.