Preskočiť na hlavný obsah

Príspevky

What the hell is this? #:~:

  Have you ever seen (as a part of a URL) something like this? #:~: Well, that's something! This part of url is called URL Text Fragments. And it is very useful! How It Works? You certainly already know that, the # symbol (called a hash or fragment identifier) separates the main URL from a fragment that references a specific section of the page. Traditionally, # links to an element with a matching id attribute. URL Text Fragments syntax starts with the fragment directive :~: followed by text= and the text you want to highlight. The #:~:text=MyText syntax enables you to link directly to specific text on a web page without requiring the page author to add an ID. When someone clicks your link, the modern browsers automatically scroll to and highlight the target MyText, making it instantly visible. The basic format looks like this: https://example.com/article#:~:text=Your%20Target%20Text For text ranges, you can specify start and end points: https://example.com/article#:~:text=start t...

Revit - problém so zamŕzaním aplikácie (Windows 11 + SSD 1TB)

Ste čerstvý študent na stavebnej fakulte, kúpite si nový nadupaný notebook (AMD Ryzen 9 8940HX, 32 GB RAM, SSD 1TB), veď potrebujete rýchle zviera, beštiu! Nainštalujete si Autodesk Revit a spustíte ho. Idete otvoriť prvý súbor - template od cvičiaceho a... nič! Vymrzol! Tak kill aplikácie a spúšťate znovu, otvoríte si nejaký projekt alebo template z inštalácie - tie idú všetky v pohode. Stiahnete nejaké projekty z internetu - tiež v pohode.  Tak opäť... Skúsite vytvoriť projekt na základe inkriminovanej šablóny cvičiaceho, ale opäť nič. Freezing! Revit zamrzne a musíte ho opäť "natvrdo" zastaviť. V čom je problém? V Revite sa dá v pohode modelovať, otvárať existujúce projekty, vytvárať nové, len ten jeden #@^$#@'''!!! Tak idete intuitívne do logov Revitu... SQLLocalDB start failure! Oukej, oukej. Hmmm? Idete hlbšie, niečo pogúglite. Nič, nič a nič. Nejaký nový problém? Kde môže byť pes zakopaný? Čo do čerta má Microsoft SQL Server Local DB s Revitom? Pogúglite.....

Java 24 Experimental Features: Three Key Innovations

Java 24, released on March 18, 2025, introduces several experimental features that represent significant advancements in JVM technology. Among the 24 Java Enhancement Proposals (JEPs) included in this release, two are designated as experimental features. Here are the three most interesting experimental innovations in Java 24. 1. Compact Object Headers (JEP 450) The Compact Object Headers feature represents a fundamental optimization in memory management for the HotSpot JVM . This experimental feature reduces the size of object headers from between 96 and 128 bits down to 64 bits on 64-bit architectures. Technical Impact The implementation demonstrates measurable benefits in real-world applications. Early adopters of Project Lilliput , which inspired this feature, report that live data is typically reduced by 10-20%. This reduction translates directly into improved heap utilization, better deployment density, and increased data locality. Activation and Usage Since this is an experimenta...

Java 24 Release - March 2025

Java 24 Release - March 2025 Oracle released Java 24 on March 18, 2025, as the latest version of the Java SE Platform. This release represents the Reference Implementation of Java SE Platform version 24 as specified by JSR 399 in the Java Community Process. Key Features: Stream Gatherers : A new enhancement that gives developers fine-grained control over how elements are grouped and processed within streams, making complex data transformations more expressive and efficient The final feature set includes 24 JEPs (Java Enhancement Proposals), with two being Generational Shen ( Java 24 New Experimental features ) Enhancements to the platform's performance, stability, and security to help organizations accelerate their business growth ( Oracle Releases Java 24 ) Java Release Schedule Updates - Java 25 LTS Oracle has confirmed that Java SE 8, 11, 17 and 21 are LTS (Long Term Support) releases, with Oracle intending to make future LTS releases every two years, meaning the next planned ...

Did you know that methods in Java have a size limit?

The JVM's method size limit of 64kB of bytecode is an important constraint for Java developers to understand. Here's more information about this limitation: JVM Method Size Limit The 65,535 (64K-1) byte limit on method bytecode is a fundamental constraint in the Java Virtual Machine (JVM) specification. This isn't about the number of lines of source code, but rather the compiled bytecode size of a single method. Why This Limit Exists This limit results from the JVM's internal design, specifically - how Java represents method code. The JVM uses a 16-bit unsigned index (u2) in the class file format to represent code length (2^16 = 65 536), but since indexing starts at 0, the maximum size is 65,535 bytes Common Causes of Large Methods Methods can grow unexpectedly large in bytecode due to, eg. complex logic with many branches and conditions. Methods can grow due to large switch statements, inlined code (especially from lambdas), string concatenation operations. Method refe...

Customizable HTML tag: select/option

Ó, HTML bože, wwwládca webapp neba, vďaka! Na toto som čakal roky (desiatky rokov).  Kto pracuje s web technológiami, kde sa používa HTML, isto neraz zaklial, keď musel použiť klasický, hmm, nazvyme ho ”combobox”. HTML tag <select> s jeho položkami <option> je štýlovateľný asi tak, ako chcieť urobiť z trabanta mercedes. O jeho funkcionalite ani nehovoriac. Preto bolo vždy potrebné použiť nejaký komponent (JS). Ale tomu je teraz koniec. Je to tu! Tag <select> má veľmi blízko k takmer dokonalosti. Síce to ešte trochu potrvá (aktuálne v Stage 2/ WHATWG https://developer.chrome.com/blog/rfc-customizable-select ), ale verzia na vyskúšanie je už na ceste k vám. Vyskúšajte si to Ak máte minimálne Chrome Canary 130, cez chrome://flags si zapnite príznak #experimental-web-platform-features a môžete sa pohrať s Codepen ukážkami https://codepen.io/collection/BNZjPe alebo skúsiť nakódovať niečo vlastné. Nové tagy/selectory V rámci CSS teraz viete „masírovať” vzhľad celého ...

My, ľudia, sme veľmi namyslení.

Myslíme si, že sme ktovieako inteligentní. Nedokážeme jednoducho a rýchlo zrátať z hlavy ani dve trojciferné čísla. Nerozoznáme margarétku od sedmokrásky. Nevieme sa dohovoriť s človekom hovoriacim iným jazykom, dokonca niekedy ani cez plot s vlastným susedom. AI väčšinu z toho dnes zvláda ľavou zadnou (ak by ju mala) a dosiahla to iba za niekoľko rokov. Stačilo len trochu viac výpočtového výkonu. Pamätám si na feike predmet Základy umelej inteligencie, kedy bol tento vtedy vedný odbor ešte len v plienkach, no bola to jedna z mála prednášok, na ktorú sme sa (radi) prinútili ráno vstať. A kde sa v IT nachádzame teraz? Weby a apky štátu a samospráv sú nepoužiteľné. Povyšujeme dizajn nad funkciou. Každý softvér má v viac bugov ako riadkov kódu. Takmer každý týždeň vznikne nový model AI a ona sa pri tom všetkom učí na našich vedomostiach a chybách - a aj s našimi chybami. Už nás začala prevýšovať aj v kreatívnom, abstraktnom myslení, údajne aj v empatii a emočnej inteligencii. No nezabúdaj...

What is the minimum app in Java (21)?

Who doesn't know "Hello, World!"? When you start writing a code in a new language, you usually write this simple program. What does it look like in Java code? class App { public static void main(String[] args) { System.out.println("Hello, World!"); } } But, explain to a beginner what "public static void" and strange args are. What would you say if the program could be simplified. class App { void main() { System.out.println("Hello, World!"); } } Let's make it even simpler, without class declaration. void main() { System.out.println("Hello, World!"); } Yes, this is simplest Java code in Java 21 release. Try it yourself. In a Java 21 preview feature (JEP 445) it needs to be enabled by with the --enable-preview flag. Just compile your application by command javac --release 21 --enable-preview App.java and run it as simple as java --enable-preview App This simplification i...

Will this Java code run?

Will this Java code run? The Test instance variable via the value() method returns null.  What about NullPointerException? Is it possible to access the pi member through null?

JavaOne is back!

In 2018 and 2019, the famous Java developer conference used the name Code One. For 2022, the name JavaOne is back again! The world's leading developer conference is scheduled to take place in Las Vegas at Oracle CloudWorld in October 2022. Oracle CloudWorld promises to keep you up-to-date on Java innovations in 2022. News on development tools, resources and best practices to accelerate the development and deployment of modern applications in cloud, mobile, local or hybrid environments.  JavaOne participants can choose from hundreds of profi seminars, labs, tutorials and other sessions. Sure, we’ll learn a lot about Java 18 and Java 19, which will be released in September 2022, and definitely we will learn more about the future of the Java platform. JavaOne will be within Oracle CloudWorld in Las Vegas, Nevada, f rom October 16 to October 22, 2022 .

Text Blocks

Od Java 15 sú textové bloky k dispozícii ako štandard. V Java 13 a 14 je potrebné túto feature povoliť (preview). Zatiaľ posledná verzia platformy Java je ver. 15, alebo keď chcete presnejšie JDK 15 rel. 2020-09-16. Posledná LTS (verzia dlhodobej podpory) bola JDK 11 zo septembra 2018. Text Blocks Aj vy máte problém s tým, keď máte dlhý String a potrebujete ho dať do premennej priamo v kóde? Samozrejme, riadok je potom dlhý a pretečie...  Vlastnosť Text Blocks umožňuje zápis textov (string reťazcov) na viac riadkov bez toho, aby ste ich museli spájať operátorom "+". Ide to veľmi jednoducho. Poďme sa na to pozrieť prakticky. Text Blocks  sú na začiatku a konci bloku označené trojitými úvodzovkami (""""). V takejto forme môžu obsahovať text rozdelený do viacerých riadkov bez potreby zadávať znak nového riadku \n. Java kompilátor je pri tejto novej funkcii tak trochu "smart" a snaží sa automaticky odstraňovať prebytočné biele znaky (medzery, tabulá...

Java block as a class member

Do you know code block? Of course you know! Block of code defines the scope of variables and puts more statemets together. But what about non-static blocks as a class member? You can put them as other class members such as static blocks, class variables and methods. E.g. static block is executed after class is loaded. This example is clasic block of code... { // block of statements: Fibonacci series int s, f1 = 0, f2 = 1; while (f1 < 100) { System.out.println(f1); s = (f1 + f2); f1 = f2; f2 = s; } } And now, try to find non-static block inside BlockTest class... public class BlockTest { // field without explicit initialization private int id; // field with ininitialization private String value = "UNDEF"; static { System.out.println("static code: executed onece when the class is loaded\n"); } { System.out.println(debug("executed before constructor, but after members initialization...

Java 8 / did U know?

JavaScript engine Engine Nashorn replaces old one (Rhino) as the new default JavaScript engine for the Oracle jvm. Nashorn is faster. It uses the invokedynamic feature of the jvm. "jjs" is Nashorn command line tool. Optional 8 comes with the Optional class (java.util.Optional) for avoiding nulls (NullPointerException). It is very similar to Google’s Optional, which is similar to Nat Pryce’s Maybe or Scala’s Option class. Streams What is a Stream? Stream is a interface (java.util.stream.Stream) and represents a sequence of some objects. However, unlike the Iterator, it supports parallel execution. The Stream supports the map/filter/reduce design pattern and executes lazily, forming the basis (along with lambdas) for functional-style programming in Java 8. Example: // finding a maximum max = list.stream().reduce(0.0, Math::max);

Get Enum constant of an Enum by String

Method cast(Class, String) builds the enum value constant of the specified Enum. The name must match exactly (case) an identifier used to declare an enum constant in the given Enum. @SuppressWarnings({ "rawtypes", "unchecked" }) public static <E extends Enum<E>> E cast(String name, Class&lt;E> clazz) { if (clazz == null || name == null || name.isEmpty()) { return null; } try { return (E) Enum.valueOf((Class<Enum>) clazz, name); } catch (Throwable e) { throw new RuntimeException("Enum cast error: '" + name + "' in not valid value of '" + clazz.getName() + "'"); } }

Antix SMTP

Antix SMTP is awsome smtp server for developers. This allows you to configure and test the way SMTP servers work. You can create multiple hosts and ports. This fake SMTP server do not send emails actually, it's only for testing. Main features: Fake - will not actually send e-mails, no risk of accidentally e-mailing to a client  Testable - you can create the server in code, then test your e-mailing functions and check the server to confirm they have been sent Configurable - you can add multiple hosts as on different ports Extendable - you can write you own message storage, e.g. into the database