Skip to content

Instantly share code, notes, and snippets.

View teohaik's full-sized avatar

Theodore Chaikalis teohaik

View GitHub Profile
package gr.teohaik.async.service;
import gr.teohaik.async.rest.config.RequestForWorkEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.enterprise.event.ObservesAsync;
/**
*
* @author Theodore Chaikalis
import gr.teohaik.async.rest.config.RequestForWorkEvent;
import javax.enterprise.concurrent.ManagedExecutorService;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@teohaik
teohaik / gist:cba764b54d17f6dd560e76d97af53aa7
Created December 16, 2018 21:49
doInBackground code for Lesson 11 2018-19
@Override
protected List<NewsEntry> doInBackground(String... params) {
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
String baseUrl = "https://newsapi.org/v2/top-headlines";
try {
Uri builtUri = Uri.parse(baseUrl).buildUpon()
import android.net.Uri;
import android.os.AsyncTask;
import android.text.format.Time;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
....
....
.......
<7-41-18 3:41:28> <Info> <Deployer> <BEA-149060> <Module ssp.sandbox.war of application ssp.sandbox successfully transitioned from STATE_PREPARED to STATE_ADMIN on server AdminServer.>
<7-41-18 3:41:29> <Info> <ServletContext-/ssp.sandbox> <BEA-000000> <Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.>
<7-41-18 3:41:29> <Info> <ServletContext-/ssp.sandbox> <BEA-000000> <No Log4j context configuration provided. This is very unusual.>
<7-41-18 3:41:29> <Info> <javax.enterprise.resource.webcontainer.jsf.config> <jsf.config.listener.version> <Initializing Mojarra 2.2.8-21 ( 20170411-1128 e6720eddab4eac4ae47623d55ad1dc9d11494fe0) for context '/ssp.sandbox'>
╙ίΏ 07, 2018 3:41:31 ╠╠ org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 6.1
<7-41-18 3:41:31> <Info> <org.primefaces.webapp.PostConstructApplicationEventListener> <BEA-000000> <Running on PrimeFaces 6.1>
@teohaik
teohaik / gist:bbab649d327a81e28b2cdb06b1ee7b6c
Created September 1, 2018 20:21
Help for Exams Sept 2018
public class Article {
private String x;
//...
public Article(String sourceName, String title, String description, String url) {
}
@teohaik
teohaik / AndroidExamsSept2017
Last active January 12, 2018 17:35
Τμήματα κώδικα για το project των εξατάσεων Σεπτεμβρίου 2017
API CALL
https://newsapi.org/v1/articles?source=mashable&sortBy=top&apiKey=0c41975ad9374d79a904203a7d4dd66f
public class Article {
//.....
}
//--------------------------------------------------------------------------------
package com.example.android.sunshine.app.data;
import android.annotation.TargetApi;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
@teohaik
teohaik / Utility.java
Created January 6, 2017 23:05 — forked from udacityandroid/Utility.java
5.03 Forecast Adapter Quiz
// Format used for storing dates in the database. ALso used for converting those strings
// back into date objects for comparison/processing.
public static final String DATE_FORMAT = "yyyyMMdd";
/**
* Helper method to convert the database representation of the date into something to display
* to users. As classy and polished a user experience as "20140102" is, we can do better.
*
* @param context Context to use for resource localization
* @param dateInMillis The date in milliseconds
@teohaik
teohaik / ForecastAdapter.java
Created January 6, 2017 23:04 — forked from udacityandroid/ForecastAdapter.java
5.03 Hint for bindView
/*
This is where we fill-in the views with the contents of the cursor.
*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
// our view is pretty simple here --- just a text view
// we'll keep the UI functional with a simple (and slow!) binding.
// Read weather icon ID from cursor
int weatherId = cursor.getInt(ForecastFragment.COL_WEATHER_ID);