λ :: deglavs77

deglavs77 has been busy self-studying all kinds of things in his free time, including programming and scripting languages, such as basic, turbo pascal, mirc scripts, html, php, mysql, css, c, ms access visual basic, c++, perl, python, javascript, marie, java, objective-c, haskell, during the past 20 years. Until one day he realised that should be his profession, not just a hobby. So he gave up everything he has done until then and went back to university in pursuit for a computer science degree. Better later than never, right?


deglavs77 at Project Euler
Recent Tweets @deglavs
Posts I Like
Who I Follow

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)
	{
		
	}
}

heartvine:

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.