вторник, 26 сентября 2023 г.

GTP 4 without of GPT Plus subscription

Do you know that not only GPT Plus users may access the Open AI's GPT 4 model? If you want to try the upper level than GPT 3.5 and you are not ready to pay 20$ a month to access the GPT 4 it's possible to do this with help of any client working via the GPT API such as GPT4All. You need to register your account on OpenAI and define an API Key to access it. This key you will need to install the GPT 4 model in the GPT4All client.
Now if you try to access the chat it will return you error saying that GPT 4 access is available for pre-paid users only and provide this link https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4 to review what's necessary for this. And WOW... it is no need to have Plus accounnt for this :) But you need to charge your account for at least either 0.50$ or 1$ depending on when you had created your OpenAI account but switching to the billing page it will want you to put minimum 5$ :) But taking into consideration that per the pricing GPT content costs just 0.03$ for the input and 0.06$ per 1k tokens for the output it still can be much less than 20$ per month if you don't use it too much. For example around 5 experiments which outputted code samples (not so small ones) costed to me around 0.09$, you can watch for your billing history and usage in the cabinet. So now at least you may decide by yourself when it worth switching to 20$/month subscription.

суббота, 28 августа 2021 г.

Мальчик с феноменальной памятью

Team lead'ам о "мальчике с феноменальной памятью" (кто помнит этот анекдот, посмейтесь), занимающимися подбором персонала на работу - осторожно, крутой развод! Прочим будет весьма забавно прочитать сей пост, не пожалеете 🙂 Получил урок на собственном опыте. Навеяло написать после разговора с нашим HR которая давече уговаривала меня рассмотреть кандидатуру, который напрочь отказывался от live coding (кто не в теме - просьба продемонстрировать способность программировать вживую для решения заданных задач) на интервью. Довелось столкнуться с кандидатом, который теоретически просто "отстреливал" всё что у него не спросишь с весьма убедительной манерой общения. Немного насторожило то, что он сидел по стойке... т.е. сидке "смирно" (рассказывал что служил долго, но дело не в этом), и (особенно) на вопрос о том, насколько он готов заниматься (если что) вопросами, которые "чуть в стороне" от девелопмента (кто в теме, поймут насколько это бывает "больно" разработчикам, что может их отпугнуть), а именно (например) "потестировать перед релизом если тестировщики не успевают" или подобное, кандидат "отрапортовал" что "ну, я человек подневольный, что скажут, то и буду делать"... у меня в мозгах чуть "подвисло"... опять таки, кто в теме, сразу почуют неладное - ни один программист такое не скажет, ну не свойственно совершенно это нашему брату, тем более на рынке, где пять мест на одного толкового кандидата... Но ладно, я "схавал", может особенный человек, может много лет армии таки мозги подмыла, такое... Так вот, кроме того, что он "оттараторивал" любые теоретические вопросы, у него (!!!) был канал на youtube где он рассматривал сложные задачи по программированию (а-ля LeetCode и подобные) - в общем фарш по полной, на скрининге вы подумаете "ох нифигасе какой крутой кандидат мне попался, надо брать по-любому". А вот теперь самое интересное - когда мы дошли до live coding он оказывается... оперный театр... ЛЫКА НЕ ВЯЖЕТ! Пытался присобачить (не могу сказать по-другому) некий "крутой" алгоритм сортировки где-то из того же литкода (сказав о нём теоретически только) туда где он вообще ни к селу ни к городу... Оправдывается "я сегодня не спал, проблемы были", "на вашем сайте контраст плохой, я не вижу ничего", "да у меня тут знаете сколько мониторов, я теряюсь что шарить...", "да вы гляньте мой ютюб канал, я там и не такое лабаю", и т.д. Ну мы предложили организовать вторую сессию интервью, что бы он перед ней точно выспался, на которую он вначале согласился, а позже отменил...... Вот такое бывает, ребята 🙂 Походу человек с отличной памятью и контактами в IT сфере узнал что нужно теоретически для прохождения интервью, вызубрил вообще всё назубок, нашёл решения крутых задач, скопировал в свой канал на YouTube с очень умным лицом (и стойкой, т.е. сидкой "смирно") и задурманивает айтишные конторы... А ведь существую такие, и много, некоторые даже рекламируют (для привлечения) то, что интервью у них без лайв кодинга - так можно шикарно попасть на такого разводчика... учитывая то, что процедура on-boarding (ввода в курс дела, когда от кандидата ничего не требуется, кроме усвоения информации о разработке и разрабатываемом продукте по началу) длится до месяца, потом месяц-два когда можно постепенно допетрить что ... король-то голый... плюс время, за которое по контракту нужно предупредить человека об увольнении... разводчик может на ровном месте поднять 10-15 а то и больше штук баксов ))) и вперёд дальше по интервью, а айтишных контор-то на наш час доуя... А кстати можно и намного больше поднимать, понимая, что ты ничего на самом деле не сделаешь всё равно, продолжать собеседоваться не останавливаясь, запараллеливая процесс., устраиваясь в несколько контор одновременно, а ещё и фриланс подключить... Вот такое дело, ребятки 🙂 Так что дорогие кандидаты, которые действительно отказываются от лайв кодинга по причине проблемы "стойки за спиной", из-за чего многие впадают в ступор (в чём частично кстати и моя проблема) - простите и поймите, но я без лайв кодинга отныне "зась", предупреждайте о вашей проблеме, я пойму и буду делать большую на это скидку, но я обязан увидеть от кандидата "поток его мыслей" в процессе программирования, никак по-другому.

понедельник, 30 ноября 2020 г.

WSDL optimization tool

Some WSDLs are huge but are necessary to use for testing. For example SforceService.wsdl is huge and takes almost a minute to load in some tools and also it will cause unnecessaary delays on each call in runtime (e.g. I needed to wait about 10-15 minutes to complete a test which had many service calls in the application I develop). Here is the wsdl-optim WSDL optimization tool written on Java allowing to cut out everything else besides particular operations used including all related definitions. Also it can be used to cut off forgotten unused in any operation definitions. Known issues: when actual type can be successor of some other type (contains "base" attribute link to the parent) it can be cut by the tool as it cuts out all unreferenced directly types thus all childs too if there is no explicit link to them

пятница, 24 мая 2019 г.

Map value lazy initialization

Tired of the following pattern?


value = map.get(key);
if (value == null) {
    // Map value lazy initialization in act
    value = /* Init value */;
    map.put(key, value);
}
// Use value
Java2html


Here is the elegant solution from the Java 8:


import java.util.HashMap;
import java.util.Map;

public class MapInit {

  public static void main(String[] args) {
    Map<String, String> map = new HashMap<>();
    String ret;
    // Lambda function is called here as there is no value with "theKey" in the map
    // The same newly added value returned by the lambda function is returned 
    ret = map.computeIfAbsent("theKey", key -> "theValue");
    System.out.println(ret);
    System.out.println(map);
    // Lambda function isn't called here as there is the value with "theKey" in the map
    // Instead, the value with "theKey" is acquired from the map and returned
    ret = map.computeIfAbsent("theKey", key -> "theValue");
    System.out.println(ret);
    System.out.println(map);
    // The "mapping function" is called here as there is no value with "theInitiatedKey" in the map
    // The same newly allocated by the mapping function value is returned 
    ret = map.computeIfAbsent("theInitiatedKey", MapInit::valueInitiator);
    System.out.println(ret);
    System.out.println(map);
    // The "mapping function" isn't called here as there is the value with "theInitiatedKey" in the map
    // Instead, the value with "theInitiatedKey" is acquired from the map and returned
    ret = map.computeIfAbsent("theInitiatedKey", MapInit::valueInitiator);
    System.out.println(ret);
    System.out.println(map);
  }
  
  private static String valueInitiator(String key) {
    // The function is called if only the value with this key is absent from the map
    System.out.println("Initiating 'theInitiatedValue'");
    return "theInitiatedValue";
  }
}
Java2html

The output:

theValue
{theKey=theValue}
theValue
{theKey=theValue}
Initiating 'theInitiatedValue'
theInitiatedValue
{theKey=theValue, theInitiatedKey=theInitiatedValue}
theInitiatedValue
{theKey=theValue, theInitiatedKey=theInitiatedValue}


Inspired by the StackOverflow's question Java map.get(key) - automatically do put(key) and return if key doesn't exist?. Thanks for the solution to Roger Lindsjö.

вторник, 12 марта 2019 г.

HTTP replay tool

I searched through the internet but was not able to find anything around this and it was strange to me. I had an idea to resend full HTTP requests captured by e.g. Fiddler, TcpMon or even designed manually to the same or other host:port destination which is suitable e.g. running configured tasks on Jenkins, provide research to your code deployed on an Java Server such as Tomcat or JBoss, etc...

So I've created such tool and it is a part of the Simple Scheduler - you can download its binary and use couple of jars for this purpose, check the httpReplay.bat for instructions. The HTTP Replay tool description on the original site.
Beside simple single request the tool is able to perform batch simultaneous requests for e.g. load or DoS attack steadiness tests.

среда, 7 ноября 2018 г.

Restoring project's sources from Google Code

Thanks to the article How to recover a Google Code SVN Project and migrate to Github I found the way to download the SVN repository dump of my project J-Sche and was able to get the sources from there. Here are steps how I did it on Windows:

1. Download the SVN dump of the necessary project from the Google Code archive specifying the name of the project as red text in this link: https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/j-sche/repo.svndump.gz - just put this link into web browser address bar, click "enter" and the "repo.svndump.gz" dump file should be downloaded.
2. Un-gzip the file using any convenient application. I used Far Manager for this - locate desired location where to put decompressed file in one panel, locate the in the "repo.svndump.gz" in the opposite panel, click "ctrl + page down" to enter the archive, click F5 to copy the only "repo.svndump" file in it to the opposite panel's location - this is the easiest way to decompress it from the archive to the specified location.
3. Install Visual SVN Server, run it, add a user via right click on "Users", specifying "Create User...".
4. Right-click on "Repositories", select "Import Existing Repository", specify "Load repository from a dump file" and point the decompressed "repo.svndump", give a name to this repository. Now it should be appeared under the "Repositories". Open it, right click on the repository you've just created, specify "Copy URL to Clipboard".
5. Install the Tortoise SVN, go to a location you'd like to download project sources to using Explorer, right click here and choose "SVN Checkout". Tortoise' "Checkout" window should appear and the link, copied in the step 4 should appear in "URL of repository" automatically. Just click "OK" and the project sources from the repository content should be downloaded here.

понедельник, 11 сентября 2017 г.

Simple scheduler on Java

Let me introduce my project

The scheduler running as Windows Service isn't built on Quartz, with it's own easy-ro-read simple user-friendly configuration.