In this tutorial we will parse Flickr JSON
https://api.flickr.com/services/feeds/photos_public.gne?tags=mountains&tagmode=all&format=json#
As an Amazon Associate I earn from qualifying purchases.
Java: read URL to String text
The blog post describes a method for reading data from a URL in Java.
It explains how to establish a stream connection, read data into a buffer, and convert that data into a String format.
The method is particularly useful for developers needing to fetch web data in Java applications.
I was using it here to retrieve a JSON feed from Flickr.
It explains how to establish a stream connection, read data into a buffer, and convert that data into a String format.
The method is particularly useful for developers needing to fetch web data in Java applications.
I was using it here to retrieve a JSON feed from Flickr.
find similar posts:
Flickr.com,
InputStream,
Java,
JSON,
software,
StringBuffer,
URL
0
comments
As an Amazon Associate I earn from qualifying purchases.
“zenzen mondai nai” (全然問題ない)
“zenzen mondai nai” (全然問題ない) sparkles with reassurance: “No problem whatsoever!”
Brushing away worry or stress is a breezy phrase, instantly brightening the mood.
Imagine a friend apologizing for being late, and you reply, “Zenzen mondai nai!”
The meaning is more heartfelt than “No worries.” It’s like a gentle back pat, reminding them you’re okay with it.
Brushing away worry or stress is a breezy phrase, instantly brightening the mood.
Imagine a friend apologizing for being late, and you reply, “Zenzen mondai nai!”
The meaning is more heartfelt than “No worries.” It’s like a gentle back pat, reminding them you’re okay with it.
find similar posts:
AIKO,
culture,
Japan,
Japanese
0
comments
“kotoba” (ことば)
“kotoba” (ことば) means “words” or “language” in Japanese.
It suggests more than just vocabulary; it can embody the soul of one’s thoughts.
In Japanese culture, we treasure how each kotoba carries a certain power (sometimes called kotodama 言霊), a little spirit of expression.
AIKO: When we arrange our kotoba carefully, we craft gentle whispers that soothe hearts or bright ideas that spark curiosity. Isn’t that so subarashii, desu ne? It reminds me of an elegant brushstroke: each line holds more than ink; it has intention, feeling, and sincerity.
In Japanese culture, we treasure how each kotoba carries a certain power (sometimes called kotodama 言霊), a little spirit of expression.
AIKO: When we arrange our kotoba carefully, we craft gentle whispers that soothe hearts or bright ideas that spark curiosity. Isn’t that so subarashii, desu ne? It reminds me of an elegant brushstroke: each line holds more than ink; it has intention, feeling, and sincerity.
find similar posts:
AIKO,
culture,
Japan,
Japanese
0
comments
Android: adb: filtering logcat
Usually I use IDE, but sometimes I have to create a very precise LOGCAT FILTER in terminal window.
Here is how I create a tag:
private static final String TAG = SomeActivity.class.getSimpleName();
Log.d(TAG, "some description");
You could use getCannonicalName
Here I have following TAG filters:
- any (*) View - VERBOSE
- any (*) Activity - VERBOSE
- any tag starting with Xyz(*) - ERROR
- System.out - SILENT (since I am using Log in my own code)
Here what I type in terminal:
$ adb logcat *View:V *Activity:V Xyz*:E System.out:S
please +1 on stockoverflow:
http://stackoverflow.com/a/29307682/3566154
It takes time and effort to create tutorials, please support my efforts with a couple-dollar donation, any amount will be greatly appreciated and highly motivating!
find similar posts:
adb,
Android,
logcat
0
comments
Linux: RPM
Here is couple of functions I use when working with RPM packages:
Show containing "postg"
Show top 20:
Install package:
Uninstall:
Show containing "postg"
rpm -qa | grep postg
Show top 20:
rpm -qa | tail -20
Install package:
rpm -ivh somed-1.0.0.armv7l
Uninstall:
rpm -e somed-1.0.0.armv7l
find similar posts:
Linux/Unix,
RPM
0
comments
Java Map interface
In this tutorial we will discuss various implementations of Java Map interface. Java Map is one of the most commonly used datatypes when you want to store items by key.
HashMap should be only used when the objects we store as KEYS have implemented the method hashCode in such way that it give unique key for a given object.
Let's say we have an object USCitizen
name,
socialSecurityNumber
Map myMap = new HashMap();
HashMap
HashMap should be only used when the objects we store as KEYS have implemented the method hashCode in such way that it give unique key for a given object.
@Override public int hashCode() {
name,
socialSecurityNumber
Map myMap = new HashMap();
find similar posts:
Java
0
comments
Java: RegEx: WebSpider
In this tutorial we will create a basis for a WebSpider program that fetches all links from the given Web page, checks which have extensions of interest and downloads these files.
The result of the app will be a folder with Google Earth map overlays:
The result of the app will be a folder with Google Earth map overlays:
/Users/uki/Desktop/KMZ
├── 1.kmz
├── 10.kmz
├── 11.kmz
├── 12.kmz
├── 13.kmz
├── 14.kmz
├── 15.kmz
├── 16.kmz
├── 17.kmz
├── 18.kmz
We will use basic java networking classes:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
and regular expressions:
ublic class RegExConstants {
/** * @param extensions * @return * ( -- start of main grouping * [^\s]+ -- must contains one, or many strings (but not white space) * ( -- start of extension grouping * \. -- existence of a dot, eg.: .kmz * (?i) -- NOT case sensitive for the next group * (kmz|kml) -- kmz OR kml strings * )$ -- should exist on the end * ) -- end of main grouping */ public static String fileExtensionPattern(String[] extensions) {
StringBuilder sb = new StringBuilder("");
if (extensions.length > 0) {
int n = 0;
for (String extension : extensions) {
if (n > 0) {
sb.append("|"); // append OR }
sb.append(extension);
}
}
String pattern = "([^\\s]+(\\.(?i)(" + sb.toString() + "))$)";
System.out.println("fileExtensionPattern: " + pattern);
return pattern;
}
public static final String anchorTagPattern = "<a *href=\"(.+?)</a>";
public static final String urlPattern = "(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
}
find similar posts:
Java,
Regular Expressions
0
comments
Project Planning
"Planning is a good preparation for an inevitable change of direction that throws out any plans made." ~Uki
find similar posts:
quote
0
comments
Java: running with Maven
Compiling with Maven
note:
- mvn clean install
- location of created jar
uki@ WebSocketClientServer $ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WebSocket-GlassFish 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
.to /Users/uki/.m2/repository/edu/clcillinois/cit137/WebSocket-GlassFish/1.0-SNAPSHOT/WebSocket-GlassFish-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Using variables to store long values
uki@ ~ $ export WEBSOCKET_JAR=~/.m2/repository/edu/clcillinois/cit137/WebSocket-GlassFish/1.0-SNAPSHOT/WebSocket-GlassFish-1.0-SNAPSHOT-jar-with-dependencies.jaruki@ ~ $ echo $WEBSOCKET_JAR/Users/uki/.m2/repository/edu/clcillinois/cit137/WebSocket-GlassFish/1.0-SNAPSHOT/WebSocket-GlassFish-1.0-SNAPSHOT-jar-with-dependencies.jar
Starting SERVER
$ java -cp $WEBSOCKET_JAR edu.clcillinois.websocket.server.WebSocketServer -h localhost -p 8025
Setting homeName to: localhostStarting the server.Mar 03, 2015 3:56:54 PM org.glassfish.tyrus.server.ServerContainerFactory createINFO: Provider class loaded: org.glassfish.tyrus.container.grizzly.GrizzlyEngineMar 03, 2015 3:56:54 PM org.glassfish.grizzly.http.server.NetworkListener startINFO: Started listener bound to [0.0.0.0:8025]Mar 03, 2015 3:56:54 PM org.glassfish.grizzly.http.server.HttpServer startINFO: [HttpServer] Started.Mar 03, 2015 3:56:54 PM org.glassfish.tyrus.server.Server startINFO: WebSocket Registered apps: URLs all start with ws://localhost:8025Mar 03, 2015 3:56:54 PM org.glassfish.tyrus.server.Server startINFO: WebSocket server started.
Type 'q' and Enter to stop server:
Starting Client(s)
uki@ CNH_PROD $ java -cp $WEBSOCKET_JAR edu.clcillinois.websocket.client.WebSocketClient -h localhost -p 8025
[DEBUG] 2015-03-03 16:02:44,354 edu.clcillinois.websocket.client.WebSocketClient main - Starting WebSockets clientSetting homeName to: localhost
Monitoring Java processes and Killing them
$ ps | grep java
30227 ttys001 0:00.00 grep java
30203 ttys002 0:01.37 /usr/bin/java -cp ~/.m2/repository/edu/clcillinois/cit137/xyz.jar edu.clcillinois.websocket.server.WebSocketServer -h localhost -p 8025
$ kill -9 30203 uki@ SimpleWebSocketServer $ ps | grep java30230 ttys001 0:00.00 grep java
Maven pom.xml example
note:
- group id
- artifact id
- version
- start-class
note:

- group id
- artifact id
- version
Maven build
note:
- plugins
- Java version 1.6, 1.7 or 1.8
- TODO change to Java 1.6 and observer what fails
- jar with dependencies

find similar posts:
Java,
mvn
0
comments
Subscribe to:
Posts (Atom)
My favorite quotations..
“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.” by Robert A. Heinlein
"We are but habits and memories we chose to carry along." ~ Uki D. Lucas
Popular Recent Articles
-
In my journey building software and managing technology teams, I've often witnessed the allure and danger of what Melissa Perri aptly na...
-
Introduction: A Language Model of My Own We are surrounded by large language models: systems trained on the vastness of the internet. Models...
-
Prompt: What do you really see in the selfie of myself? AI: I see a volcano about to blow up and I see a lost, scared boy in front of it. ...
-
I found myself wholly emptied, the mental exhaustion where you sit in your parked car and wake up minutes later, unsure how long you’ve been...
-
I have noticed a very unsettling statistic on my blog. This prompted a fascinating question about AI, blogs' future, and maybe even the...
-
I have been training and running DNN on Mac and I believe that they will become a staple of desktop ML world soon.
-
I have written some 2500 blog posts, but the idea of a book is eluding me. Since "plans are worthless, but planning is everything,...
-
Not every day is a great one. Today was particularly rough. I'm adjusting to a 6-hour time zone shift, recalibrating to my keto (sugar-f...
-
I started listening to Josh Kaufman's book, Personal MBA . The book resonates with me because I have always believed in continuous educ...