This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
.... | |
....... | |
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Article { | |
private String x; | |
//... | |
public Article(String sourceName, String title, String description, String url) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API CALL | |
https://newsapi.org/v1/articles?source=mashable&sortBy=top&apiKey=0c41975ad9374d79a904203a7d4dd66f | |
public class Article { | |
//..... | |
} | |
//-------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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); |
NewerOlder