Skip to content

Instantly share code, notes, and snippets.

View osamasarhan's full-sized avatar
🎣
let's catch gigantic fish

Osama Sarhan osamasarhan

🎣
let's catch gigantic fish
View GitHub Profile
@osamasarhan
osamasarhan / لاب1 تحليل بيانات
Created May 18, 2019 15:31
lab1-1MAC-DATA ANALYSIS TRACK
test1
Q1
The Chinook database contains all invoices from the beginning of 2009 till the end of 2013. The employees at Chinook store are interested in seeing all invoices that happened in 2013 only. Using the Invoice table, write a query that returns all the info of the invoices in 2013.
SL1:
SELECT *
FROM Invoice
WHERE InvoiceDate BETWEEN '2013-01-01' AND '2014-01-01' ;
Q2
@udacityandroid
udacityandroid / onCreate method in MainActivity.java
Created May 13, 2016 18:17
Use OnClickListeners for All Categories - onCreate method in MainActivity.java
// Find the View that shows the numbers category
TextView numbers = (TextView) findViewById(R.id.numbers);
// Set a click listener on that View
numbers.setOnClickListener(new View.OnClickListener() {
// The code in this method will be executed when the numbers View is clicked on.
@Override
public void onClick(View view) {
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);
@sansagara
sansagara / EarthquakeCityMap.java
Created March 20, 2016 23:37
This is to show what i did for my own extension on the Object Oriented Programming in Java Course on Coursera, module 6.
package module6;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.data.Feature;
import de.fhpotsdam.unfolding.data.GeoJSONReader;
import de.fhpotsdam.unfolding.data.PointFeature;
@udacityandroid
udacityandroid / MainActivity.java
Last active December 22, 2023 08:49
Android for Beginners : Add the Chocolate Topping Checkbox Solution Java
package com.example.android.justjava;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
/**
* This app displays an order form to order coffee.
@udacityandroid
udacityandroid / activity_main.xml
Last active May 3, 2023 20:38
Android for Beginners : Add the Chocolate Topping Checkbox Solution XML
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@udacityandroid
udacityandroid / Code snippet in SmoothieActivity.java
Last active February 6, 2023 13:54
Android for Beginners : If/Else Smoothie Quiz
int numberOfSmoothiesTillPrize = 10;
if (numberOfSmoothiesTillPrize > 9) {
Log.v("SmoothieActivity", "Congratulations, you get a free smoothie!");
numberOfSmoothiesTillPrize = numberOfSmoothiesTillPrize - 10;
} else {
Log.v("SmoothieActivity", "No free smoothie this time.");
}
Log.v("SmoothieActivity", "You currently have " + numberOfSmoothiesTillPrize + " out of 10 smoothies needed for your next free smoothie.");
@udacityandroid
udacityandroid / Code snippet in InboxActivity.java
Last active February 6, 2023 13:53
Android for Beginners : If/Else Email Quiz
int numberOfEmailsInInbox = 0;
int numberOfDraftEmails = 2;
String emailMessage = "You have " + numberOfEmailsInInbox + " emails. ";
String draftMessage = "You have " + numberOfDraftEmails + " email drafts.";
if (numberOfEmailsInInbox == 0) {
emailMessage = "You have no new messages. ";
}
if (numberOfDraftEmails == 0) {
draftMessage = "You have no new drafts.";
@udacityandroid
udacityandroid / Code snippet in WeatherActivity.java
Last active February 6, 2023 13:44
Android for Beginners : If/Else Weather Quiz
boolean isRaining = false;
Log.v("WeatherActivity", "Thank you for using the WhetherWeather App.");
if (isRaining) {
Log.v("WeatherActivity", "It's raining, better bring an umbrella.");
} else {
Log.v("WeatherActivity", "It's unlikely to rain.");
}
@udacityandroid
udacityandroid / Method 1
Last active February 3, 2023 09:49
Android Development for Beginners : Define a Method
private String createCalendarEventReminder(String eventName, String location, int minutesAway) {
String reminder = "You have an upcoming event in " + minutesAway + " minutes.";
reminder = reminder + " It is " + eventName + " held at " + location + ".";
return reminder;
}
/**
* This method displays the given text on the screen.
*/
private void displayMessage(String message) {
TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
priceTextView.setText(message);
}