Back to The tech awesomeness
Table of contents
Endeavor chapters
In this imasvaji I try to achieve the minimal same functionality, and with some additional coding and in a more dependent way, depending on the numerous services, and software, so for the functionality to become more serverless. However, at the following code, it is still serving and acting as a server in the timer's and scheduler's code pieces. So it is not fully serverless afterall.
What is "imasvaji"? Imasvaji is Internet Message Access Servelessly by (Siri) Voice Assistant via Java Integration.
What is it doing?
It is checking in intervals an another server (mail server) via Internet Message Access Protocol (IMAP).
If it finds the (email) message, it checks the contents of the email message and then, on occurances of keyphrases, it executes the pre-coded actions.
What does it achieve?
If this code is running once at small single-board computer device and another time at laptop using two different emails for each device, and the emails are available in the contact list of my device, which is sharing its emails with its voice assistant and other possible setting,
then approximately the user(me for example) says for Apple iPhone's Siri or Apple Watch's Siri, "Hey, Siri" to activate Siri, then the user(me for example) says for Siri to
"send an email to (device email details, for example, 'my laptop email') to shutdown device"
or "send an email to (device email details, for example, 'my raspberry email') to restart my device"
or "will you send an email to (device email details, for example, 'my front door email') to check the lock"
or "will you send an email to (device email details, for example, 'my home accessories and devices email') to shutdown device"
and then the user(me for example) Tap Send or say Yes to send your email.
The device will probably shutdown or restarted after awhile.
To add more actions for conditions, basic coding skill (in java) is enough.
The email can be sent probably not only via Apple Siri assistant via Apple devices.
Imasvaji allows the voice control by using mobile device voice assistant for the pre-definion's condition's action set for some devices, that can execute such code, when such code is in the runtime executing cycle. The identity aspect is at the level of the binding the device (and as well group of devices) to the email. The security aspect is at the level of security of the mail server and the access to voice assistant device and mail server account and the device for the executing the code of imasvaji java integration side.
The pre-definion's condition's action set is subject for change by the user of imasvaji at the moment.
The email address addition to mobile devices' contact lists for voice assistants is not in scope of imasvaji at the moment. Imasvaji does not have the access to mobile devices themselves at the moment.
One uncomfortableness is that for usage imasvaji the process is still involving the code for the pre-definion's condition's action set.
Another uncomfortableness is that for usage imasvaji the process is still involving the creation, management and addition of email address and their copies in mobile devices' contact details' lists.
Another uncomfortableness is that for usage imasvaji the process is still involving the startup and shutdown of the code itsalf for the device for its control and the execution of pre-definion's condition's action set.
public class Imasvaji {
public static void main(String[] args) {
Timer timer = new Timer();
long periodBetweenSuccessiveTaskExecutionsInSeconds = 5;
timer.schedule(
new IMAPPollAction(),
0,
periodBetweenSuccessiveTaskExecutionsInSeconds * 1000);
}
public boolean createFolder(String folderName) throws MessagingException {
Session session = Session.getDefaultInstance(System.getProperties(),null);
Store store = session.getStore("imap");
System.out.println("connecting store..");
store.connect("imap.gmail.com", 993, "something@gmail.com", "password");
System.out.println("connected !");
Folder defaultFolder = store.getDefaultFolder();
/*
* Note that in Gmail folder hierarchy is not maintained.
* */
boolean isCreated = true;
try {
Folder newFolder = defaultFolder.getFolder(folderName);
isCreated = newFolder.create(Folder.HOLDS_MESSAGES);
System.out.println("created: " + isCreated);
} catch (Exception e) {
System.out.println("Error creating folder: " + e.getMessage());
e.printStackTrace();
isCreated = false;
}
return isCreated;
}
}
//"Handle shutdown"
//"Handle search"
//"Handle in browser"
//"Handle in notepad"
//"Handle logoff"
class IMAPPollAction extends TimerTask {
private static final String email = "device.email.numbero.yksiodyn@gmail.com";
private static final String secretPassword = "uqa-Fe3-YQQ-Y39";
public void run() {
String imapProvidedServer = "imap.gmail.com";
//set properties
Properties properties = new Properties();
//You can use imap or imaps , *s -Secured
properties.put("mail.store.protocol", "imaps");
//Host Address of Your Mail
properties.put("mail.imaps.host", imapProvidedServer);
//Port number of your Mail Host
properties.put("mail.imaps.port", "993");
//properties.put("mail.imaps.timeout", "10000");
try {
//create a mail session
Session session = Session.getDefaultInstance(properties, null);
//SET the store for IMAPS
Store store = session.getStore("imaps");
System.out.println("Connection initiated..");
//Trying to connect IMAP server
store.connect(email, secretPassword);
System.out.println("Connection is ready..");
//Get inbox folder
Folder folder = store.getFolder("Notes");
//SET readonly format (*You can set read and write)
folder.open(Folder.READ_ONLY);
//Display email Details
//Inbox email count
int messageCount = folder.getMessageCount();
System.out.println("Total Messages in folder: " + messageCount);
if (messageCount == 0) {
System.out.println("No New messages.");
} else {
System.out.println("New messages: " + folder.hasNewMessages());
System.out.println("Mail Subject: " + folder.getMessage(messageCount).getSubject());
System.out.println("Mail From: " + folder.getMessage(messageCount).getFrom()[0]);
String emailContent = folder.getMessage(messageCount).getContent().toString();
System.out.println("Mail Content: " + emailContent);
if (emailContent.contains("shutdown device") || emailContent.contains("shutdown my device")) {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("shutdown -s -t 0");
System.out.println(proc.info());
System.exit(0);
} else if (emailContent.contains("restart device") || emailContent.contains("restart my device")) {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("sudo shutdown -r now");
System.out.println(proc.info());
System.exit(0);
} else {
/* other query */
}
}
folder.close(true);
store.close();
} catch (IOException | MessagingException e) {
e.printStackTrace();
}
}
}
The update as of 2020-09-03.
If to wrap (email) messages into JSON format, to connect somehow JMAP (JSON Meta Application Protocol) both with such email server support(for example Apache James and Cyrus) and email client support along with IMAP(as currently) and finally to sum up and to boost it with HATEOAS (Hypermedia as the Engine of Application State), then there will be some other product with possibility and result which I have not tested yet. imasvajijha. Approximately, as previously emails with some (for example voice as previously) sending and with control functionality(not only with to send and to read, to listen). So if previously it was about to send (email)messages not only by touching and by typing, and also with to pronouncing; and reading and listening to(on the receiving side), then now it is with possiblity(with no implementation) with not only passive reading and listening to (email) message and as well with controlling some resource(for example web resource, physical resource, for exampke device somewhere through internet) with a help of that (email) message in that combination.
So the action set is still there with its boundaries of flexibility. For example Drools, jBPM (Java Business Process Model) and or other business rule management system (BRMS) in the back of the HATEOAS consumer and with a process and a result back to HATEOAS server.
In such combination the advantage is the JSON format with all its advantages throughout the data flow process(in controllable space) and as well the disadvantage is the dependency on only JSON format with all its disadvantages.
The update as of 2020-09-04.
In previous update, where it starts with "If to wrap (email) messages into JSON format", because I assume before that the content of (email) messages are in text/plain text/html formats.
If in that case to wrap (email) messages into XML format(along with JSON format), then that limitation and disadvantage happens no more in cost of more wrapping, more code, and more code for format selection.
What is more, then such solution starts to have many links with AJAX (Asynchronous JavaScript and XML) as a method for doing request and response cycle. The reason is because AJAX is set of web development techniques, and this imasvajijha and now plus optionally XML is a set of various technologies.
For such message I definitely enough should use some notation(for example, JavaScript Object Notation (JSON)) and language(for example, Extensible Markup Language (XML)).
In order to solve this I chose JSON previously, than two ones for a choice.
Technically it is possible to provide both ones in same (email) message, such a mix; to wrap message into JSON and to wrap both ones into XML; to wrap message into XML and to wrap both ones into JSON; and combinations.
If so, then AJAX is now an integral part of imasvajijha in its current respresentation.
While I previously use AJAX for browsers and web sites during development, exploitation and utilisation for request and response cycles, now such AJAX is additionally is out of scope of browsers and in the new scope of email and mobile devices also for request and response cycles.
So in such AJAX as a set of technologies in use for development, exploitation and utilisation for other protocols: email ones.
If so, then AJAX as a set of methods is a subject for consideration for additional growth in scope and other application, for example for file protocols.
But when I return back to the basics and to the earth I recall and reread and copy that:
Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea
Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris
Ajax (play), by the ancient Greek tragedian Sophocles, about Ajax the Great
...
https://en.wikipedia.org/wiki/Ajax
The update as of 2020-12-13.
There are alternative ones among variety of web application domain models in which a long term HTTPS request provides a web server to send data to a browser, without the browser explicitly requesting it.
The update as of 2021-05-04.
It appeared on 2021-04-21 during internetless access to these web pages.
There is a XHR, but there is no JHR. So I sometimes wrap JSON object instead of XML object in XHR. Sorry for that one.
Seems like a technological monopoly situation on that one for some period of time.
However I reassure you, that I wrapped no XML object in JSON object yet.
ІПДМОСГДП. Інтернет Повідомлюючий Доступ Менш Обслуговууюче за допомогою Сірі Siri Голосового Помічника через Джава Java Підключення
Оновлення від 2020-09-03.
Якщо обгорнути (електронні) повідомлення у ДжейСОН JSON формат, з'єднати якось ДжМЕП JMAP (ДжейСОН Мета Додатковий Застосункрвий Протокол JSON Meta Application Protocol) з обома підтримками з подібною електронною поштовою обслуговуюючою підтримкою (наприклад Апач Джеймс Apache James та Кайрус Cyrus) і електронною поштовою споживацькою підтримкою поряд з АйМЕП IMAP(як є в тому коді вище поточно цією сторінкою) і нарешті завершити підсумовуванням і зміцненням його з ХЕйТОАС HATEOAS (зверх зміст як рушій стану додатку і застосунку Hypermedia as the Engine of Application State), тоді буде якійсь інший продукт з можливістю і результатом котрий я ще не перевіряв. ІПДМОСГДПДжХЕ imasvajijha. Приблизно, як попередньо електронні повідомлення з деяким (наприклад голосовим як попередньо) надсиланням і з можливістю керування(не лише надсилати і читати, слухати). Так попередньо було про надсилання (електронних) повідомлень не лише торканням(сенсорних сприймаючих поверхонь) і натисканням(клавіш), і також вимовленням(вмісту (електронного) повідомлення); й споживанням читанням й слуханням (з боку приймання), тоді далі воно є зараз можливим(за відсутності реалізації) з не лише пасивним споживанням: читанням і слуханням (електронних) повідомлень а й також керуванням деяким ресурсом(наприклад ресурсом в інтернеті, фізичним ресурсом, наприклад приладом десь, через інтернет) за допомогою (електронного) повідомлення у такому комбінаційному поєднанні.
Таким чином набір дій є досі там у наявній можливості з його межами гнучкості. Наприклад Друлс Drools, джейБПМ jBPM (Джава Зайнятості Бізнес Процесна Модель Java Business Process Model) й чи інший зайнятості бізнес правил керівна система (BRMS) позаду ХЕйТОАС HATEOAS споживача й процесс з результатом назад до ХЕйТОАС HATEOAS обслуговувача.
У такому комбінаційному поєднанні перевагою є ДжейСОН JSON формат з усіма перевагами протягом процесу переміщення даних(у контрольованому просторі) і також недоліком є залежність від лише ДжейСОН;JSON формату з усіма недоліками.
Оновлення від 2020-12-13.
Існують версії серед різних веб мережево застосункових моделів у яких тривалі ГТТПБ HTTPS запити надають веб мережево обслуговувачам надсилати дані мережевим ППіНТВСуІ, без запитів щодо таких даних від тих мережевих ППіНТВСуІ.
Оновлення від 2021-05-04.
Воно з'явилося 2021-04-21 протягом позамережевого доступу до цих сторінок в інтернет.
Існує іксейчьар XHR, але не існує джейейчьар JHR. Так що іноді я завертаю джейсон JSON об'єкт замість іксемель XML об'єкта в іксейчьар XHR. Перепрошую за це.
Схоже на технологічну монопольну ситуацію згідно цього протягом якогось проміжку часу.
Однак я упевнюю вас, що я загорнув жодного іксемель XML об'єкта у джейсон JSON об'єкт поки що.
The update as of 2021-08-16.
Оновлення від 2021-08-16.
Така табличка:
особливість
безконтактно тобто без дотику але радіоконтактно, що недоступно без додаткового перетворення для тварин
безконтактно тобто без дотику але візуально видимо контактно
безконтактно тобто без дотику але звуково контактно
Більшість безконтактних контактів згідно зі спостереженнями ставалися між мобільним і стаціонарним безконтакними пристроями в околицях, навіть які знаходяться в середині тих, що ззовні є мобільними можливо окрім деяких домашніх пристроїв.
The update as of 2021-09-02.
Оновлення від 2021-09-02.
Не з легкістю знайти схожі проекти в відкрито кодових сховищах коду якщо вони не помічені або помічені різними посиланнями. Особливо в багатохмарних чи в багатьох інтернет послугах.
It is not easy to find similar projects in open source code repositories if they have no marks or tags or labels or links or others or are marked, are tagged, are labeled, are linked or otherwise with differing ones. Especially in multicloud or in many services in internet.
The update as of 2021-11-15.
Оновлення від 2021-11-15.
Те саме для послуг у веб. Немає якихось позначок наскільки послуга намагається змінюти те як ти маєш думати під час її використання перед її використанням якщо вона намагається.
Same for services in web. There are no some marks for how much the service tries to change how you should think during its usage before its usage if it tries to.
The update as of 2022-05-21.
Оновлення від 2022-05-21.
There is 1 format for messages in this imasvaji and 1 item for integration as for Java and 1 resolver such as Siri and inputs as resolvees.
And 1 item for integration as for Java is with mostly with interface approach for emailing.
Those 1 resolver such as Siri and 1 item for integration as for Java is with mostly with interface approach for emailing of course are probably using some server or servers or server in a cloud or servers in a cloud or both ones or a mix, but for developer of imasvaji it is hidden so that is why it is serverlessly.
For 1 item for integration as for Java with emailing to change it it is as of
#in CLI which is not present and not available, though it is editable manually
addInAfterLine('Imasvaji.java', 3, ' if(args[0].equals("imap") )
timer.schedule(
new IMAPPollAction(),
0,
periodBetweenSuccessiveTaskExecutionsInSeconds * 1000);
else {/*...*/}
' )
compile(
#class name
)
#or output(class name)
#launch(class name)
#then startable as java Imasvaji.java imap
For 1 resolver such as Siri it is not that straightforward and is not a vendor lock however requires 1 more class or more classes for launch with a similar substitutes.
With a similar approach with a similar mostly conditional present configurations in a manual style other classes are startable, not only for a preference for one or for several ones of other set among options for web application servers, databases, but also for IoC, logging, data persistence, an others. That is due to mainly an advantage of interface aproaches previously already described in some of these web pages, while composite ones have own advantages.
The update as of 2024-09-12.
If you remember JMAP, now there is MOX.
https://community.hetzner.com/tutorials/install-and-configure-mailserver-mox-on-debian
Also many steps there as there were as in http://thetechawesomeness.ideasmatter.info/project-management-with-jira.html.