<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[ParallaxTec - Medium]]></title>
        <description><![CDATA[Discovering the world of Binary - Medium]]></description>
        <link>https://medium.com/parallaxtec?source=rss----b9af466d304e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>ParallaxTec - Medium</title>
            <link>https://medium.com/parallaxtec?source=rss----b9af466d304e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:52:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/parallaxtec" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cloning Fetch Request — Cheating the Browser]]></title>
            <link>https://medium.com/parallaxtec/cloning-fetch-request-cheating-the-browser-a786fcecd802?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/a786fcecd802</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[request-cloning]]></category>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 23:18:12 GMT</pubDate>
            <atom:updated>2023-01-13T23:30:54.602Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cloning Fetch Request — Cheating the Browser</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*OmeJ6gv9rv9cicjTEHn0Dw.png" /></figure><p>Well cloning the Fetch Request is easy, isn’t it? Fetch provides an out-of-the-box solution for that right? Well Yes and No.</p><p><em>Request.clone()</em> does the job for the exact clone. But most of the time we don’t need it. What we need is to send the same request to a different resource (URL). So why don’t use the obvious solution? Use the constructor.</p><pre>async function implicitClone(){<br>    const request = new Request(api_url_old, {method:&#39;POST&#39;, body:JSON.stringify({&#39;test&#39;:&#39;test&#39;}), headers: new Headers({<br>        &#39;Content-Type&#39;: &#39;application/json&#39;<br>    })})<br>    const clonedRequest =  new Request(api_url,request);<br>    await fetch(clonedRequest);<br>}</pre><p>It works perfectly when there is no request body. But when there is a body current browsers are struggling. At least Chrome and Firefox. (Well that is like 80% of usage!). While Firefox silently drops the request body in the cloned request, Chrome complains even before sending the request. (For further information <a href="https://github.com/whatwg/fetch/issues/1486">https://github.com/whatwg/fetch/issues/1486</a>)</p><pre>support.js:85 Uncaught (in promise) TypeError: Failed to construct &#39;Request&#39;: The `duplex` member must be specified for a request with a streaming body<br>    at implicitClone (support.js:85:28)<br>    at HTMLButtonElement.onclick (index.html:12:36)</pre><p>So let’s try cloning the request explicitly.</p><pre>async function explicitClone(){<br>    const request = new Request(api_url_old, {method:&#39;POST&#39;, body:JSON.stringify({&#39;test&#39;:&#39;test&#39;}), headers: new Headers({<br>        &#39;Content-Type&#39;: &#39;application/json&#39;<br>    })})<br>    const clonedRequest =  new Request(api_url, {<br>        method: request.method,<br>        headers: request.headers,<br>        body: request.body,<br>        referrer: request.referrer,<br>        referrerPolicy: request.referrerPolicy,<br>        mode: request.mode,<br>        credentials: request.credentials,<br>        cache: request.cache,<br>        redirect: request.redirect,<br>        integrity: request.integrity,<br>      });<br>     await fetch(clonedRequest);<br>}</pre><p>Too Bad! Still, we have the same problem. Even though the fetch specification clearly describes the request cloning web browsers aren’t there yet.</p><p>The request body in Fetch is made of <em>ReadableStream&lt;Uint8Array&gt;. </em>We can explore Readable Stream to make a clone of it. Let’s bring the big guns.</p><pre>async function getContentOfReadableStream(requestBody: ReadableStream&lt;Uint8Array&gt; | null):  Promise&lt;Uint8Array | null&gt;{<br><br>        if(requestBody){<br>            let isPending = true;<br>            let arrayLegnth = 0;<br>            const unit8Arrays = []<br>            const reader = requestBody.getReader();<br>            do{<br>                const readableResults =  await reader.read();<br><br>                if(readableResults.value){<br>                    arrayLegnth +=  readableResults.value.length <br>                    unit8Arrays.push(readableResults.value)<br>                }<br>               <br>                isPending = !readableResults.done<br>            }while(isPending)<br>            const mergedArray = new Uint8Array(arrayLegnth);<br>            unit8Arrays.forEach(array=&gt; mergedArray.set(array))<br>            return mergedArray;<br>    <br>        }<br>        return null;<br>    }<br><br>async function explicitCloneEnhanced() {<br><br>    const request = new Request(api_url_old, {method:&#39;POST&#39;, body:JSON.stringify({&#39;test&#39;:&#39;test&#39;}), headers: new Headers({<br>        &#39;Content-Type&#39;: &#39;application/json&#39;<br>    })})<br>    const requestBody = await getContentOfReadableStream(request.clone().body)<br>    const clonedRequest =  new Request(api_url, {<br>        method: request.method,<br>        headers: request.headers,<br>        body: requestBody,<br>        referrer: request.referrer,<br>        referrerPolicy: request.referrerPolicy,<br>        mode: request.mode,<br>        credentials: request.credentials,<br>        cache: request.cache,<br>        redirect: request.redirect,<br>        integrity: request.integrity,<br>      });<br>     await fetch(clonedRequest);<br><br>}</pre><p>Yey! Firefox and Chrome don’t complain anymore. Well, there is nothing to complain about. Finally, we made everyone happy. The solution has been tested on multiple browsers across multiple versions with different types of request bodies and it works perfectly. Theoretically, it’s a bit slower than out-of-box solutions but it gets the job done.</p><p>Happy coding folks! ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a786fcecd802" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/cloning-fetch-request-cheating-the-browser-a786fcecd802">Cloning Fetch Request — Cheating the Browser</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Heavy-HTTP]]></title>
            <link>https://medium.com/parallaxtec/heavy-http-61182261502c?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/61182261502c</guid>
            <category><![CDATA[client-server-connection]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[requests-library]]></category>
            <category><![CDATA[rest]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Mon, 19 Dec 2022 12:34:56 GMT</pubDate>
            <atom:updated>2022-12-19T12:40:57.212Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Breaking the barriers of payload limits with HTTP</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*fliPj1n-s9AAeEgJLlw2Hw.png" /><figcaption>(source: <a href="https://www.toastmasters.org/magazine/magazine-issues/2021/june/breaking-language-barriers">https://www.toastmasters.org/magazine/magazine-issues/2021/june/breaking-language-barriers</a>)</figcaption></figure><p>The Rest and HTTP request-response pattern has almost conquered Client-Server communication. Even though the combination of Rest and HTTP provides an illusion of a universal methodology for communication there are many practical limitations in this approach. By introducing Heavy HTTP, we solve one of the key practical limitations of this communication pattern and extend its capabilities.</p><p>The size of the payload of requests/responses is one of the most significant practical limitations in this pattern. With the latest trends, modern web applications more often exchange large amounts of data back and forth with HTTP and Rest. But with a single HTTP request/response, the process is highly inefficient. Not just that most of the server implementations can’t handle large requests/responses. As an example, these are the payload size limits of the Request/Response handling interfaces of the world’s largest cloud service providers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*Z1wyh0ft4n2fxxV-n8DEfg.png" /></figure><p>This payload size limitation literally ties our hands because,</p><ol><li><strong>You never know when the payload will go beyond the threshold<br></strong>In client applications, it’s hard to predict the client inputs. They may send a little amount of information or a very big chunk of data. The same would happen on the server end as well. With complex relationship models, even with pagination, the payload size can vary in a vast range. That means either some of the client inputs or server responses will be ignored (crashed!) because no one can predict the size of the data.</li><li><strong>Implementation of alternative methods requires a lot of effort</strong><em> </em><br>Providing an alternative communication would require additional boilerplate code and logic on both client and server ends. And the problem becomes much worse when it is required to measure the payload size depending on the payload type.</li></ol><p>When you deal with large payload sizes the next inherent issue is connection time limitations. When the request is heavy it most likely takes a longer time to process and that could lead to connection timeouts. Wouldn’t it be cool if it’s possible to handle heavy requests asynchronously while handling other requests synchronously?</p><p>Well Heavy HTTP is there to save you from all the trouble. Heavy HTTP is a utility framework that automatically handles the payload limitations in client-server Rest HTTP communication with very minimal configurations. It utilizes signed URLs as an alternative communication pattern to overcome the payload size limitation and provides transporters to control the request data on the server side. Most importantly, it doesn’t interrupt the existing communication patterns. So only by performing very few modifications, any existing application can be retrofitted to work with Heavy HTTP.</p><p>Heavy HTTP consists of three main components</p><ol><li>Heavy HTTP Client Connector</li><li>Heavy HTTP Server Connector</li><li>Heavy HTTP Transporter</li></ol><h3>Heavy HTTP Client Connector</h3><p>Heavy HTTP Client Connector is an extension of the default HTTP Client that is used in the application. If the application is a browser, Heavy HTTP Client Connector extends the XMLHttpRequest and Fetch API. And if the application is written in Node JS then Heavy HTTP Client Connector extends the Node HTTP Client. For all the HTTP communication the extended Heavy HTTP Client is exposed via the same interface. Because of this pattern, regardless of the HTTP client wrapper library (Axios, Node HTTP etc) that is used in the application, Heavy HTTP can perform its magic.</p><h4>Looking under the hood</h4><p>At the initialization of the request Heavy HTTP Client Connector performs the following operations</p><ol><li>Identify the type of the payload and estimate the size of the payload.</li><li>If the size of the payload is beyond the configured threshold shift to the Heavy HTTP Transporter to continue the communication. If not proceed with the existing communication pattern.</li><li>Provide the seamless experience of HTTP client to the HTTP Client wrapper library.</li></ol><p>When receiving the response Heavy HTTP Client Connector performs the following operations</p><ol><li>Check whether the response is a Heavy Response or not.</li><li>If it’s a Heavy Response then shift to the Heavy Http Transporter to fetch the data. Otherwise, proceed with the existing communication pattern.</li><li>Provide the seamless experience of HTTP client to the HTTP Client wrapper library.</li></ol><h3>Heavy HTTP Server Connector</h3><p>This is a runtime-specific library that is responsible for the server end of communication with the Heavy HTTP Client that makes the request. Since the library is runtime-specific it needs to be attached to the runtime as an HTTP interceptor. Since the library is attached as an interceptor whatever the APIs provided by the runtime can be used without an issue with the library. Similar to the Heavy HTTP Client, Heavy HTTP Server also can perform its magic regardless of which API is used for the communication.</p><h4>Looking under the hood</h4><p>When receiving the request from HTTP Client, Heavy HTTP Server Connector performs the following operations</p><ol><li>Identify whether the request is a Heavy Request or not (Based on request headers).</li><li>If it’s a Heavy Request shift to the Heavy Http Transporter to fetch the request data. Otherwise, proceed with the existing communication pattern.</li><li>Provide the seamless experience of the HTTP request to the runtime APIs.</li></ol><p>When sending the response to HTTP Client, Heavy HTTP Server Connector performs the following operations</p><ol><li>Identify the type of the payload and estimate the size of the payload.</li><li>If the size of the payload is beyond the configured threshold shift to the Heavy HTTP Transporter to continue the communication. If not proceed with the existing communication pattern.</li><li>Provide the seamless experience of HTTP response to the HTTP Client. (If the response is a heavy response, then the HTTP Client must be a Heavy HTTP Client to understand the protocol).</li></ol><h3>Heavy HTTP Transporter</h3><p>Any temporary/permanent storage mechanism that provides signed URLs for upload and download purposes can be a transporter. The transporter is attached to the Heavy HTTP Server so that it is fully decoupled from the Heavy HTTP client. The Transporter gives you the control of handling the request and response as you like. If you want to process the request in a lazy manner (given that request is heavy) that also can be achieved as well.</p><h3>Heavy HTTP Communication Protocol</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X3y4NpY1UsR-PueW" /></figure><h3>Have an interest in the concept?</h3><p>Well if you are interested we suggest you to go through our full GitHub documentation <a href="https://github.com/Heavy-HTTP">Heavy-HTTP</a>.<br> <br>Then if you are willing to help with coding, ideologies, testing or documentation, share your interest with us by dropping a message to <a href="/service/mailto:heavyhttp@gmail.com">heavyhttp@gmail.com</a>.</p><p>Happy Coding! ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61182261502c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/heavy-http-61182261502c">Heavy-HTTP</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dangling with Time Ranges]]></title>
            <link>https://medium.com/parallaxtec/dangling-with-time-ranges-ca3f6087cad9?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/ca3f6087cad9</guid>
            <category><![CDATA[datetime]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[time-complexity]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Wed, 28 Sep 2022 04:30:25 GMT</pubDate>
            <atom:updated>2022-09-28T04:29:52.078Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*IJj7HQoRc88S0fF7" /><figcaption><a href="https://images.unsplash.com/photo-1501139083538-0139583c060f?ixlib=rb-1.2.1&amp;ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;auto=format&amp;fit=crop&amp;w=2070&amp;q=80">https://images.unsplash.com/photo-1501139083538-0139583c060f</a></figcaption></figure><p>Usually, in our day-to-day programming, we work with time ranges or date ranges a lot. Iterating them, and finding specific facts related to them can be quite cumbersome and to be frank, most of the time people tend to write suboptimal algorithms for these types of tasks.</p><p>After dangling with time ranges for a while, I realized that 99% of the tasks related to time or date ranges can be completed with the complexity of O(nlogn<em>). </em>And most importantly, most of these problems can be solved using a simple single pattern.</p><p>When we talk about Time/Date ranges we are talking about a collection of the following types of objects. In this object, <em>startTime </em>is always equal or less than<em> endTime.</em></p><p><em>{startTime: yyyy-mm-dd hh-mm-ss, endTime: yyyy-mm-dd hh-mm-ss }</em></p><p>Let’s learn the pattern and then see about the use cases. As I have repeatedly said the pattern is so simple and it has only three steps!</p><p>Step 1: Create a list of Time/Date elements from the Time/Date ranges collection<br>Step 2: Sort the Time/Date elements<br>Step 3: Iterate the Time/Date ranges while working with your conditions using flags</p><p>In step 1 we create a new collection from the Time/Date ranges collection as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*nN0tXfl7JwRULpHAYBe8RQ.png" /></figure><p>With the above transformation, a new collection would be created as follows. <br><em>[{time: yyyy-mm-dd hh-mm-ss, direction:”End”}]</em></p><p>Well, there is nothing to explain in step 2 right? Use whatever sorting algorithms you know and perform an ascending sort. Use startTime as the primary key for sorting and use endTime for tie breaking. If you ask me I would prefer Tim Sort as it gives the fastest results in most cases [O(n) or O(nlogn)].</p><p>With this sorted collection, we can do limitless things by just iterating them. And that’s step 3.</p><p><strong>1. Combine Overlapping Time/Date ranges</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKB7OPhbNEdd99-jH3Faog.png" /></figure><p>With the sorted Time Elements list we can keep a flag for the number of overlaps while we are iterating the list. So we get the startTime of the first element and we keep counting the overlaps. The <em>overlaps </em>variable can be increased but eventually it would decreased. When the <em>overlaps </em>variable becomes 0 we get the endTime as the end of the combined period. After that continue the iterating and repeat the same. As I mentioned previously, the pattern is <em>iterating a sorted list while keeping flags</em>.</p><p><strong>2. Identify Time/Date Periods with N overlappings</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYs_wa4WAFdHPZO8KaZerA.png" /></figure><p>This time it’s bit more complex. But the pattern remains same. In here we mark the collapseStartTime at the moment that we see N overlaps. Then we mark the endTime of the collapsedTimeInterval at the moment we see the number of overlaps are changed. Keep in mind that it can be either N+1 or N-1. Regardless of whatever it is we marked that time as the end of the collapsedTimeInterval. Then we keep repeating the same process untill we reach the end of the list. (+1 / -1 must be from the smallest time entity (seconds, mili-seconds, days etc) of the timeElement that is considered.)</p><p><strong>3. Get the non Overlapping Time/Date Periods</strong></p><p>This one is a special case of the pervious one. The only thing that we have to do is make N=0 and vola! we get the non overlapping date ranges. I leave it to you to think about how that happens.</p><p>This is nothing but the power of sorted item iterations. The key thing to remember is almost all the Time/Date ranges problems can be solved much more effectively by adhering to this simple pattern.</p><p>What do you think? Have you ever found a problem that would break this pattern? I dare you to comment it! <br>(ps. I purposefully used images so that a lazy person can’t copy and paste :D. Always use code with understanding)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca3f6087cad9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/dangling-with-time-ranges-ca3f6087cad9">Dangling with Time Ranges</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot, Java 16+, JUnit4, JUnit5 & PowerMockito Salad]]></title>
            <link>https://medium.com/parallaxtec/spring-boot-java-16-junit4-junit5-powermockito-salad-3c1c3ec7c97b?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/3c1c3ec7c97b</guid>
            <category><![CDATA[powermockito]]></category>
            <category><![CDATA[junit]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[jacoco]]></category>
            <category><![CDATA[java17]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 10:40:38 GMT</pubDate>
            <atom:updated>2022-06-21T10:39:57.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwjd_fwXhPkMCJPGfL-FbQ.jpeg" /><figcaption>Food top view photo created by timolina — <a href="http://www.freepik.com/">www.freepik.com</a></figcaption></figure><p>Java is evolving and it’s evolving fast. It’s not just evolving but it’s becoming better faster and more secure. But the million-dollar question is what’s the status of the Java Eco-System? Is it evolving as fast as Java? Unfortunately not. This slow-moving Eco-System has become a massive problem for developers when working with the latest versions of Java and I’m going to make your life easy by solving one of those problems.</p><p>As the topic suggests with fast-evolving Java and slow-moving libraries and packages we are actually in Salad. If your application using Powermockito for testing and trying to move to Java 17 with Junit5, my friend you are asking for trouble. But don’t worry with a couple of workarounds we can still make this work.</p><p>First things first let’s see what are the main blockers we are facing.</p><p><strong>1. Java Strong Encapsulation of JDK Internals</strong></p><p>This is the latest change that is added to the Java 17 spec and it breaks most of the reflection capabilities. When reflection is broke Powermockito becomes helpless. So it’s required to manually open java internals for Powermockito. How can we do that? let’s see that in a couple of minutes.</p><p><strong>2. Mockito API deprecation and removal</strong></p><p>Powermockito is pretty old and it uses Mockito APIs internally. In order to support JUnit5 Mockito has been updated (version 4.x) and on its journey, it has removed multiple old methods. So if your Powermock version, Mockito Version and JUnit5 are not compatible with each other you wouldn’t be able to execute a single test.</p><p><strong>3. Powermockito Runner is not Compatible with JUnit5</strong></p><p>When the library isn’t updated to support the main functionality do you think it would support for extensions?! So JUnit5 and Powermockito are a big NO-NO. In that case, we have to stick with JUnit4.</p><h3>Enough with problems! let’s see what the solution is</h3><p>First of all, let’s separate the concerns</p><ol><li>Unit tests without Powermockito can be extended with JUnit5 runner and can be written as follows.</li><li>Unit tests with Powermockito would require the legacy JUnit4 runner and can be written as follows.</li></ol><p>Now it’s time to set the maven environment to run both JUnit 4 and 5. Maven SureFire is the key to that. Even though the document says just adding maven surefire would do the trick it won’t. The platform is need to be set and individual executors need to be provided with the maven surefire plugin as follows.</p><pre>&lt;plugin&gt;<br>   &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br>   &lt;version&gt;2.22.2&lt;/version&gt;<br>   &lt;configuration&gt;<br>      &lt;argLine&gt;<br>         @{argLine}<br>         --add-opens java.base/java.lang=ALL-UNNAMED<br>         --add-opens java.base/java.util=ALL-UNNAMED<br>         --add-opens java.base/java.time=ALL-UNNAMED<br>      &lt;/argLine&gt;<br>   &lt;/configuration&gt;<br>   &lt;dependencies&gt;<br>      &lt;dependency&gt;<br>         &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;<br>         &lt;artifactId&gt;junit-platform-surefire-provider&lt;/artifactId&gt;<br>         &lt;version&gt;1.3.2&lt;/version&gt;<br>      &lt;/dependency&gt;<br>      &lt;dependency&gt;<br>         &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;<br>         &lt;artifactId&gt;junit-jupiter-engine&lt;/artifactId&gt;<br>         &lt;version&gt;5.0.1&lt;/version&gt;<br>      &lt;/dependency&gt;<br>      &lt;dependency&gt;<br>         &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt;<br>         &lt;artifactId&gt;surefire-junit4&lt;/artifactId&gt;<br>         &lt;version&gt;2.22.2&lt;/version&gt;<br>      &lt;/dependency&gt;<br>   &lt;/dependencies&gt;<br>&lt;/plugin&gt;</pre><p>While <em>junit-platform-surefire-provider </em>provides the platform for the execution <em>junit-jupiter-engine is </em>responsible for the JUnit5 execution and surefire-junit4 is responsible for the JUnit4 execution.</p><p>Now we have configured the key areas. If you look at the above maven pom carefully you would see a &lt;argLine&gt; with multiple commands.</p><pre>&lt;argLine&gt;<br>   @{argLine}<br>   --add-opens java.base/java.lang=ALL-UNNAMED<br>   --add-opens java.base/java.util=ALL-UNNAMED<br>   --add-opens java.base/java.time=ALL-UNNAMED<br>&lt;/argLine&gt;</pre><p>Let’s keep the @{argLine} aside for a bit. All other 3 command-line arguments are there to open up JDK internals. Please keep in mind opening up internals is not recommended for application usage but acceptable for unit tests. Even with unit tests make sure to open the Internals only if it’s absolutely required. All the possible Java openings are listed <a href="https://bugzillaattachments.eclipsecontent.org/bugs/attachment.cgi?id=287053">here</a>.</p><p>With all the above configurations we have solved most of our problems except the Mockito version mismatch. In order to solve that issue we have to downgrade Mockito from version 4.x to 3.x (the latest versions of version 3) as follows.</p><pre>&lt;dependency&gt;<br>   &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>   &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;<br>   &lt;scope&gt;test&lt;/scope&gt;<br>   &lt;exclusions&gt;<br>      &lt;exclusion&gt;<br>         &lt;groupId&gt;org.mockito&lt;/groupId&gt;<br>         &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;<br>      &lt;/exclusion&gt;<br>   &lt;/exclusions&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>   &lt;groupId&gt;org.mockito&lt;/groupId&gt;<br>   &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;<br>   &lt;version&gt;3.12.4&lt;/version&gt;<br>   &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><p>Since we use Spring Boot, <em>spring-boot-starter-test</em> dependency contains <em>mockito-core 4.x</em>. So we don’t have an option other than removing the internal dependency and injecting our own <em>mockito-core 3.12.4</em>.</p><p>All right, are we good? Yes but one small problem remains. That’s the unit test coverage. With all these plugins and versions will the coverage works? Well, Jacoco is a very powerful tool but it requires a little modification to perform its magic. And that modification is the @{argLine} keyword in the &lt;argLine&gt; command. So what’s going on there? When the coverage reports are generated behind the scenes Jacoco adds a couple of arguments to the maven surface plugin. When we don’t provide any custom arguments Jacoco is perfectly capable of doing it on his own. But when we add custom arguments with &lt;argLine&gt; Jacoco needs our help. By adding @{argLine} keyword we simply help Jacoco to insert those arguments to get the coverage reports. For the sake of completion, I have added the Jacoco library and plugin versions as well.</p><pre>&lt;dependency&gt;<br>   &lt;groupId&gt;org.jacoco&lt;/groupId&gt;<br>   &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;<br>   &lt;version&gt;0.8.8&lt;/version&gt;<br>&lt;/dependency&gt;</pre><pre>----------------------------------------------------------</pre><pre>&lt;plugin&gt;<br>   &lt;groupId&gt;org.jacoco&lt;/groupId&gt;<br>   &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;<br>   &lt;version&gt;0.8.8&lt;/version&gt;<br>   &lt;configuration&gt;<br>      &lt;excludes&gt;<br>         &lt;exclude&gt;**/AppStartupRunner.java&lt;/exclude&gt;<br>         &lt;exclude&gt;*&lt;/exclude&gt;<br>      &lt;/excludes&gt;<br>   &lt;/configuration&gt;<br>   &lt;executions&gt;<br>      &lt;execution&gt;<br>         &lt;id&gt;default-instrument&lt;/id&gt;<br>         &lt;goals&gt;<br>            &lt;goal&gt;instrument&lt;/goal&gt;<br>         &lt;/goals&gt;<br>      &lt;/execution&gt;<br>      &lt;execution&gt;<br>         &lt;id&gt;default-restore-instrumented-classes&lt;/id&gt;<br>         &lt;goals&gt;<br>            &lt;goal&gt;restore-instrumented-classes&lt;/goal&gt;<br>         &lt;/goals&gt;<br>      &lt;/execution&gt;<br>      &lt;execution&gt;<br>         &lt;id&gt;default-prepare-agent&lt;/id&gt;<br>         &lt;goals&gt;<br>            &lt;goal&gt;prepare-agent&lt;/goal&gt;<br>         &lt;/goals&gt;<br>      &lt;/execution&gt;<br>      &lt;execution&gt;<br>         &lt;id&gt;default-report&lt;/id&gt;<br>         &lt;phase&gt;prepare-package&lt;/phase&gt;<br>         &lt;goals&gt;<br>            &lt;goal&gt;report&lt;/goal&gt;<br>         &lt;/goals&gt;<br>      &lt;/execution&gt;<br>   &lt;/executions&gt;<br>&lt;/plugin&gt;</pre><p>Keep in mind <em>mockito-inline</em> can’t work with the above setup. There is no version of <em>mockito-inline</em> that can work with both PowerMockito and JUnit5. So unfortunately we can’t move forward with that combination. But luckily if you are using PowerMockito there is no need for <em>mockito-inline</em> because everything we do with <em>mockito-inline</em> can be done with PowerMockito as herewell.</p><p>That’s it about the salad of JUnit testing friends. You can find the full repository <a href="https://github.com/PasinduSenanayake/java-salad">here</a>.</p><p>Keep coding !!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c1c3ec7c97b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/spring-boot-java-16-junit4-junit5-powermockito-salad-3c1c3ec7c97b">Spring Boot, Java 16+, JUnit4, JUnit5 &amp; PowerMockito Salad</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bulk Insert; Auto Increment; Hibernate; YES it’s possible]]></title>
            <link>https://medium.com/parallaxtec/bulk-insert-auto-increment-hibernate-yes-its-possible-d76b5dfec0f7?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/d76b5dfec0f7</guid>
            <category><![CDATA[jpa]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[hibernate]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Wed, 28 Jul 2021 10:48:56 GMT</pubDate>
            <atom:updated>2021-07-28T10:46:46.486Z</atom:updated>
            <content:encoded><![CDATA[<p>When it comes to object relation mapping <em>hibernate</em> is one of the pioneers. According to the creators of <em>hibernate</em>, it is designed to generate the most optimal query that can be derived with static information. Well, I would say not always!!</p><p>When you have a table with an auto-increment primary id like below it is impossible to perform a bulk insert with hibernate and it is frustrating.</p><pre>CREATE TABLE `student` (<br>  `student_id` int(11) NOT NULL AUTO_INCREMENT,<br>  `student_name` varchar(45) NOT NULL,<br>  `student_age` varchar(45) NOT NULL,<br>  PRIMARY KEY (`student_id`)<br>) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;</pre><p>The problem here is we have to use <em>@GeneratedValue(strategy = GenerationType.IDENTITY) </em>in the model and when it is used, here <a href="https://www.baeldung.com/jpa-hibernate-batch-insert-update"><em>baeldung</em></a> says and I quote</p><blockquote>When we want to use batching for inserts/updates, we should be aware of the primary key generation strategy. <strong>If our entities use <em>GenerationType.IDENTITY</em> identifier generator, </strong><a href="http://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#batch-session-batch"><strong>Hibernate will silently disable batch inserts/updates</strong></a>.</blockquote><p>Let’s dig deep into this. First, let’s see what is actually going on. The student entity has 3 attributes and they are mapped as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f7b5c485c4f1e2e5b5d953e4023c37e/href">https://medium.com/media/3f7b5c485c4f1e2e5b5d953e4023c37e/href</a></iframe><p>And the Dao layer is as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/235a2fbaf793917383380d413081e6e5/href">https://medium.com/media/235a2fbaf793917383380d413081e6e5/href</a></iframe><p>The last piece is as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aa7371499d1378e8b5a9acc24e8659c/href">https://medium.com/media/2aa7371499d1378e8b5a9acc24e8659c/href</a></iframe><p>Once this is executed hibernate generates the following queries for us.</p><pre>{&quot;name&quot;:&quot;Debug-Logger&quot;, &quot;time&quot;:1, &quot;success&quot;:true, &quot;type&quot;:&quot;Prepared&quot;, &quot;batch&quot;:false, &quot;querySize&quot;:1, &quot;batchSize&quot;:0, &quot;query&quot;:[&quot;insert into student (student_age, student_name) values (?, ?)&quot;], &quot;params&quot;:[[&quot;20&quot;,&quot;testA&quot;]]}<br>{&quot;name&quot;:&quot;Debug-Logger&quot;, &quot;time&quot;:1, &quot;success&quot;:true, &quot;type&quot;:&quot;Prepared&quot;, &quot;batch&quot;:false, &quot;querySize&quot;:1, &quot;batchSize&quot;:0, &quot;query&quot;:[&quot;insert into student (student_age, student_name) values (?, ?)&quot;], &quot;params&quot;:[[&quot;25&quot;,&quot;testB&quot;]]}</pre><p>All good except that it generates two queries. And if you look carefully you would see <em>batch: false. </em>But the weird fact is when it comes to the database (at least MySQL) a query like the below is perfectly fine.</p><pre>insert into student (student_id,student_name,student_age) values (null, &#39;TestA&#39;, 20), (null, &#39;TestB&#39;, 25)</pre><p>So how can we achieve that? Let’s see. <br>The first option is if this <em>@GeneratedValue(strategy = GenerationType.IDENTITY) </em>is the one who makes our lives miserable let’s remove it and try. So the execution without the above annotation wasn’t smooth.</p><pre>java.lang.I1LlegalStateException: Failed to execute ApplicationRunner<br>Caused by: org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.example.demo.model.Student; nested exception is org.hibernate.id.IdentifierGenerationException:<br>ids for this class must be manually assigned before calling save(): com.example.demo.model.Student</pre><p>Oh, Poor hibernate! It says that the entities can’t be there as unassigned. The reason is under the hood hibernate leverages the uniqueness of the primary id to uniquely identifies the entities in a collection. So here comes the hack-1. Let’s show some id and quickly remove it !!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ec45aab836dc0e0788118241ec161f7/href">https://medium.com/media/4ec45aab836dc0e0788118241ec161f7/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/246677da72f53db7943fce6c5fef69af/href">https://medium.com/media/246677da72f53db7943fce6c5fef69af/href</a></iframe><p>Here, we try to trick hibernate. First, we give a unique primary id using an atomic integer. And we unwrapped the <em>entityManager.persist</em> method as above so that we can clear the primary id after <em>session.persist</em>. The thought process behind that is in order to uniquely identify entities, an entity has a unique id and it is used when the entities are persisted to the session. But, once persisted the id is removed before the data is flushed and committed so that <em>student_id</em>s of the generated query would be always null. Since we didn’t use the <em>Identity</em> annotation hibernate should be able to generate the single batch insert query. But here is the results.</p><pre>java.lang.IllegalStateException: Failed to execute ApplicationRunner<br>Caused by: org.springframework.orm.jpa.JpaSystemException: identifier of an instance of com.example.demo.model.Student was altered from 8 to null; nested exception is org.hibernate.HibernateException: identifier of an instance<br>of com.example.demo.model.Student was altered from 8 to null</pre><p>Hibernate is very politely asking ‘<em>how dare you try to trick me</em>’ !! . So hibernate tracks the changes but the question is how far is it willing to go on that road?</p><p>In that case, we decided to try an alternative approach which made it impossible for hibernate to compute the difference. We wrapped the integer with a wrapper class and wrote the converters to that custom wrapper. (This is the standard way of introducing a custom data type to hibernate)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e8316676388b82dda8eb3ece774a6f0/href">https://medium.com/media/1e8316676388b82dda8eb3ece774a6f0/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbfc3f775faed002b35cd3a640591916/href">https://medium.com/media/fbfc3f775faed002b35cd3a640591916/href</a></iframe><p>And we updated the model with CustomInteger entity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c65aeee6dc59a7dd2e22e67898f68c28/href">https://medium.com/media/c65aeee6dc59a7dd2e22e67898f68c28/href</a></iframe><p>After all these modifications the execution results were as follows.</p><pre>{“name”:”Debug-Logger”, “time”:2, “success”:true, “type”:”Prepared”, “batch”:true, “querySize”:1, “batchSize”:2, “query”:[“insert into student (student_age, student_name, student_id) values (?, ?, ?)”], “params”:[[“20”,”testA”,null],[“25”,”testB”,null]]}</pre><p>Finally, our wrapper class did the trick and made both hibernate and database happy :).</p><p>It’s important to mention that the above implementation is not discussed or presented in any of the hibernate forums or communities. So unless you are confident about the implementation it is advised to stick with individual inserts. With this, we have seen a massive performance improvement with the same accuracy when it comes to larger datasets, but if you aren’t confident enough, remember that most of the time accuracy matters over performance.</p><p>Bulk Insert: <a href="https://github.com/PasinduSenanayake/bulk-insert-demo/tree/bulk-insert">https://github.com/PasinduSenanayake/bulk-insert-demo/tree/bulk-insert</a><br>Individual Insert: <a href="https://github.com/PasinduSenanayake/bulk-insert-demo/tree/individual-insert">https://github.com/PasinduSenanayake/bulk-insert-demo/tree/individual-insert</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d76b5dfec0f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/bulk-insert-auto-increment-hibernate-yes-its-possible-d76b5dfec0f7">Bulk Insert; Auto Increment; Hibernate; YES it’s possible</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complexity in the Simplicity - Part I Riemann Hypothesis]]></title>
            <link>https://medium.com/parallaxtec/complexity-in-the-simplicity-part-i-riemann-hypothesis-e2d655627031?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/e2d655627031</guid>
            <category><![CDATA[mathematician]]></category>
            <category><![CDATA[riemann]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Thu, 05 Oct 2017 14:07:54 GMT</pubDate>
            <atom:updated>2017-10-05T14:07:53.855Z</atom:updated>
            <content:encoded><![CDATA[<p>From the very first day that humans started looking into the secrets of Mother Nature, mathematics became his ultimate companion. Throughout several centuries, being the key tool for revealing most of world’s mysteries, mathematics have become the biggest companions of modern science.</p><p>Mathematics is not something given by god. Mathematics is not something created overnight. It was the ultimate result of the utter dedication and continuous sacrifices of brilliant minds which ever existed. Throughout the history of mathematics there are a lots of remarkable milestones. It is undoubted that every milestone was a game changing point in mathematics as well as in the modern science.</p><p>As it is mentioned, mathematics is shaped up by the people who had the highest IQ as well as genius thinking ability. But there are some unsolved mysteries in mathematics which were able to keep most of those brilliant minds busy throughout these centuries. As a fact some of those mysteries have histories of more than 200 years. Some of those mysteries were solved by people and most of those solutions have opened new paths in the library of mathematics. But still there are some mysteries in mathematics which can lead to an entire transformation of modern science and technologies as we know them. So let’s dig deep into those mysteries in the world of mathematics.</p><p>This will be a series of articles about the most complex problems in mathematics.</p><p><em>“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” — </em><strong><em>Albert Einstein</em></strong></p><p>As Einstein said these articles are for the people who love imagination. Even though we are about to dive deep into some complex areas in mathematics I assure you, this won’t be a high school math class. This will reveal the beauty of unsolved mysteries which is hidden behind the complex equations and Greek letters.</p><h4>Unsolved Mysteries - I - Riemann Hypothesis</h4><p>What is this Riemann Hypothesis and who is this Riemann? First things first. Riemann Hypothesis is one of the most complex mathematical problems that exists today. This was first came to the picture in 1859. Since then world’s genius, brilliant minds have struggled with this more than a century. In 2000 <a href="https://en.wikipedia.org/wiki/Clay_Mathematics_Institute">Clay Mathematics Institute</a> announced this as a million dollar question. If someone is able to provide a valid proof for this mathematical problem, he will be awarded with this million dollar prize.</p><p>What is this question which is worthy million dollars? It’s all about a function. What is a function in mathematics? It is a simple statement which gives a value for a given number. As an example let’s consider f(y) = 2 + y. so when y = 1, f(1) = 2+1 = 3, f(1) = 3; when y=2, f(2) = 2+2 = 4, f(2) = 4; It is simple as it is. So this problem is also connected to a function. That function name is “Zeta” and it is also very much like other functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*d2T-2sJlbXr86UVFT_6LDQ.png" /></figure><p>This is also just a function. Only difference of it is, it will go up to infinity without a finite boundary. When we give a value for “s” it will give us a number. Hence <em>ζ(2) </em>has a value, <em>ζ(3) </em>has a value.</p><p>In 18th Century Leonhard Euler one of the forefathers of modern mathematics found those values and he came up with interesting answers. Those answers were really breathtaking and they led Riemann to a hypothesis which today worth million dollars. (As a person who love mathematics I personally don’t believe assigning bunch of dollars for a priceless mathematical question is a good idea. It ruins the pure values of mathematics.) These are the answers when different numbers were substituted for Zeta function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*G8DxlVDvfETh2nXxtsWMTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*ohf6_8ELWPcUVP1mub5PhA.png" /></figure><p>As we can see these infinite sums (Which is called in mathematics as infinite series) give us a definite value. Isn’t it amazing? Let’s think a bit. If we take a calculator or even a very high powerful computer can we do the addition manually? In our life time? In the entire life time of universe? NO we can’t because there is no end. It will go forever. But mathematics shows us the final answer. Simply that’s the power behind mathematics. Most of the mind blowing inventions and creations that we experience in our day today life are designed thanks to the power of expressions that mathematics has.</p><p>Coming back to the discussion, Even though this Zeta function gives definite values for most of the substitutions it has one weakness. When “s =1” this beautiful function fails to provide a definite answer so when “s =1” the sum becomes infinite. That means the total goes to infinity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*Sri0ianOSAlqxq3AUm2ZNQ.png" /></figure><p>This great work of Euler was investigated by a young brilliant mind and he expanded the domain of this function to a new level. If you carefully look at previous example you would see that always “s” is substituted by positive values only. This young fellow started his investigation to expand the domain of the function. (Domain - Range of values that can be substituted to a function). What is the new Domain? The new domain includes complex numbers. Let’s keep our main discussion bit aside and look at what are these complex numbers.</p><p>This concept of complex numbers can be easily explained using a famous question. The square root of 9 equals to 3, the square root of 1 equals to 1, so what is the square root of -1? This question was the dawn of another branch of mathematics. Mathematicians declare a number called “<em>i</em>” and the value of the “<em>i</em>” is declare as “<em>i² = -1”. </em>Weird isn’t it? But that weird solution made a tremendous change. This changed the number line to a number plane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/0*pfDuTg8eG0MACRCC.png" /></figure><p>This is the number line.All these numbers are called real numbers and from both sides it extends up to infinity. Fractions lie between those numbers. As an example half lie between zero and one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*htMjLTbzuMgDiO4v.gif" /></figure><p>This is the number plane. All these real number are in the real axis. There is another axis shown in this image named “Imaginary Axis”. This Imaginary axis contains imaginary numbers like <em>1i , 2i, 3i</em> etc. In other words it can be explained as 1√-1, 2√-1,3√-1 etc. Since mathematicians declared this notation as Imaginary Axis, the previous number line became a number plane. As shown in the image each point in the plane can be represent by a number. So this weird definition gave a very large playground for our mathematician “Riemann” to test this Zeta function.</p><p>As one of the greatest mathematicians in history of mathematics Bernhard Riemann proved this entire number place has definite values for zeta function except at a specific point. Such kind of points are very special for a function and those are named as singularity points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*hniibhD8qiIPj79zpMIx4Q.png" /></figure><p>As this image shows Riemann was able to show that this Zeta function gives a well defined value in anywhere in the number plane except in 1.</p><p>Here comes the million dollars question. Once Riemann extended Euler’s work he was interested in particular behavior of the function. At which values this function becomes zero? Riemann came up with an awesome answer and that awesome answer finally created a problem which made most of the genius minds clueless. So brace yourselves. Here comes the Riemann Hypothesis.</p><p>After playing with complex analysis and fellow mathematicians’ works Riemann explained that there are only two types of zeros. One type is known as Trivial Zeros. When the “s” in “<em>ζ(s)” </em>becomes<em> -2, -4, -6 </em>or any other negative even integer this “<em>ζ(s)” </em>function becomes zero. So those zeros are explained as Trivial Zeros. All other values for “s” which makes “<em>ζ(s) = 0 ” </em>are know as non-Trivial Zeros.</p><h4>Riemann Hypothesis - The real part of every non-trivial zero of the Riemann zeta function is 1/2.</h4><p>So this is what Riemann predicts. He was able to prove that all non trivial Zeros exist between 0 and 1 in the number plane. That strip is known as the critical strip. But he said actually all the non trivial zeros only lie on the line of 1/2 and no where else. (The critical line)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*lPVm_eyfeLZej31P.jpg" /></figure><p>So there are two ways of winning this million dollars</p><ol><li>You have to prove this Riemann Hypothesis. Have to come up with a valid mathematical proof.</li><li>You have to show any value in this blue strip which is not in the critical line that makes “<em>ζ(s)” </em>zero !!!!</li></ol><p>Second one looks much easy. But trust me, there are millions of attempts that have been made even with the aid of high end mathematical computing devices to find a non trivial zero which doesn’t lie on the critical line. But so far no luck. In the other hand thousands of non trivial zeros have been found on the critical line. Most of the mathematicians believe what Riemann claimed in his Hypothesis is true and currently we don’t have the knowledge to explore that.</p><p>So that’s it. That is the million dollar question. But why this finding non-Trivial Zeros worth million dollars? Why is it that much significant? Because if someone proves this Hypothesis, that may lead to an era where modern security becomes useless. Not just one ,but almost all of them. Because most of our modern security techniques including web security uses key base techniques. The complexity of hacking these key base techniques lies on the complexity of finding the prime numbers in mathematics. In other words if someone comes up with an algorithm which can run within a quarantine time period to find all the primes less than a given number, that will be the end of the key base encryption as well as key base security. Riemann Hypothesis is one of the keys to such kind of algorithm.</p><p>In mathematics the branch which deals with prime numbers and distributions is called Number theory. Riemann Hypothesis can open a new area of number theory only if it’s proved. Now more than 100 years have passed after this question is raised. But no one has come up with even a closer answer for this problem. So why don’t you a give try? May be you will be able to change the destiny of Mathematics as well as yours.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2d655627031" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/complexity-in-the-simplicity-part-i-riemann-hypothesis-e2d655627031">Complexity in the Simplicity - Part I Riemann Hypothesis</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End of the Security as we know it?]]></title>
            <link>https://medium.com/parallaxtec/end-of-the-security-as-we-know-it-bd465c366ce8?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/bd465c366ce8</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[rsa]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Tue, 08 Aug 2017 03:36:37 GMT</pubDate>
            <atom:updated>2017-08-08T03:36:36.725Z</atom:updated>
            <content:encoded><![CDATA[<h4>Quantum Computers — The next gen hacker</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfvG-zgwXa86mRvvCaw6Kw.jpeg" /><figcaption>source <a href="http://www.nist.gov/">www.nist.gov</a></figcaption></figure><p>It is undoubtedly the Quantum Computers — One of the mysterious realities in 21st century, will change the world that we already know. But will it be the destroyer of the giant wall of digital security?. Well the answer is yes and no. Let’s dive deep to find out why.</p><p>First of all quantum computers are one of the best designs of human intelligence. But underlying principles that govern this unique design are still unclear. (More details on this topic : ) Due to the remarkable and mysterious behavior of quantum elements, quantum computers will outrun any existing binary computer or any future binary computer with its processing power. The number of Qbits (Basic fundamental objects of quantum computers) in a Quantum Computer is the key parameter that decide the power of its processing. Amazing thing is, increment of these Qbits will increase the processing power of computer exponentially.</p><p>Even-though this phenomenon seems to be amazing, that is the point where the entire security of digital world becomes highly vulnerable. To understand that, lets look at how today’s digital security works. In today’s binary world, Public-Private key encryption is claimed to be the most powerful tool in web security. Most of the critical areas in web like bank account details, top secret messaging services, even bit coins use this key encryption concept to make their services secured. This key encryption is designed based on the RSA algorithm created by three genius mathematicians at MIT back in 1970s. RSA is a complex algorithm and it is been formulated by advance concepts in Number Theory. Amazing thing is, even though RSA is really complex, basic principle that lies under the hood is a elementary mathematics— The Prime Factorization.</p><p>If you are given a number like 15 and asked to represent it as a multiple of two prime factors, it will just take couple of seconds to tell the answer as 5 and 3. This entire procedure is known as prime factorization. But if you think carefully about that, you will understand that you didn’t follow any algorithm to get that answer. It just came to your mind. This is the place where all the interesting things begin to happen. No algorithm has been found to solve this problem in a limited time. The simplest thing we can do is start from the first prime number (2) and check whether the given number is divisible or not. Since there is no simple way to check whether a given number is a prime or not the task becomes much more complex. Now imagine the given number has 10 or 15 digits, the task becomes a complete nightmare. Actually when the number of digits in the given number becomes really big, this process becomes a nightmare to the digital processors as well. Just as an example if we consider a computer with a 10⁸⁰ CPUs and each of those CPUs could enumerate one modulus per millisecond, to complete a prime factorization of 309 digits number approximately it would take 5.95×10²¹¹ years in the basic method that was discussed. Actually the number of CPUs in this example is nearly equal to the number of atoms in the observable universe. And this operation takes 5.95×10²¹¹ years and the age of our universe is 13.75×10⁹ years!!!</p><p><em>(It is important, in this example it was assumed that, basic brute force method is used. This is just a theoretical demonstration of the power of this little concept. In today’s world there are faster algorithms than this, but the truth which is still unbroken is, those algorithms also provide unrealistic statistics which are more or less similar to this. As a matter of fact, there are no trusted information about a successful attempt of factorizing a number with 309 digits. The largest number that is recorded is 232 digits and a computer cluster empowered by advanced mathematical algorithms with 2.2 x 2000 GHz computation power took nearly two years break that. )</em></p><p>This complexity is the backbone of RSA algorithm. And this complexity is the reason that primary key encryption is still unbreakable. (Even though we used 309 digits number for the example, in real world applications very large numbers (617) are used. With number of digits increased, factorization time is also increases exponentially. ) One day if a genius comes up with a really simple algorithm to perform this prime factorization with in an acceptable time, that will be the end of this security schema. And with the power of quantum computers we are about to enter that era. We are about to experience a world, that the security mechanisms we trusted as the best, are no longer functional. The end of the security at least as we know it !!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*6XfrHQ-wxulQX2v9_ZKNLg.jpeg" /><figcaption>source : <a href="http://pdm.com.co/">pdm.com.co</a></figcaption></figure><p>According to data from D-Wave (a quantum computing company in Canada) their DW-2 quantum computer is 3600 faster than any known existing super computers in the world. Normally the best supercomputers are capable of processing at 93.42 x 10¹⁵ floating point operations per second. Rest is mathematics. It is crystal clear that the dooms day of the powerful guardian, the unbreakable algorithm RSA- 2048 (617 digits RSA key ), is not far away. It is important to remember that DW-2 contains only 439 Qbits, and this number will be increased in near future. So this is the story of farewell of a great invention. But do we really need to worry about that?</p><p>According to <a href="https://www.cis.upenn.edu/~nadiah/">Nadia Heninger</a>, an assistant professor of computer and information science at the University of Pennsylvania, “<em>No we don’t</em>”. According to researches they have conducted, attacking a terabyte-size key using Shor’s algorithm would require around 2¹⁰⁰ operations on a quantum computer (an enormous number comparable to the total number of bacterial cells on Earth). This Shor’s algorithm is considered as one of the miracles in the world of mathematics. In 1994 at MIT this algorithm was formulated by an American professor and mathematician <a href="https://en.wikipedia.org/wiki/Peter_Shor">Peter Shor</a>, as a quantum algorithm (an algorithm that runs on a quantum computer) for integer factorization. Informally it solves the following problem: given an integer <em>N</em>, find its prime factors. According to Nadia, even with that miraculous algorithm still quantum computers are defeated by this simple Prime Factorization.</p><p>Are we safe ? This is the point that we don’t have an answer. According Nadia’s statistics key is a terabyte sized key. Keys which are used in today including RSA — 2048 are few thousand bits. A terabyte is 1 x 10¹² x 8 bits. Using such a giant key is simply unrealistic. Next important thing is the accuracy of these assumptions. Because history teaches us the assumptions in binary world don’t last long. It was never expected that SHA-1 encryption would be broken this much earlier. But it happened, with their unimaginable server power, Google broke it. And due to the mind blowing research findings of D-Wave one of the golden-rule in computer science —“Moore Law” is about to break. These incidents continuously tell us assumptions in bit world are meant to be broken.</p><p>Once the <em>Decoherence </em>phenomenon in quantum nature is properly solved, the era of hand-held quantum computers will not be far beyond. So the million dollar question is, when that day comes will RSA be able to protect us?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd465c366ce8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/end-of-the-security-as-we-know-it-bd465c366ce8">End of the Security as we know it?</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do Computers Dream ?]]></title>
            <link>https://medium.com/parallaxtec/do-computers-dream-47d05280904d?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/47d05280904d</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[deepdream]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Piyumi Rameshka]]></dc:creator>
            <pubDate>Mon, 17 Jul 2017 14:29:05 GMT</pubDate>
            <atom:updated>2017-07-17T14:29:04.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2QmOCgLVbdE0evZWEhN9WA.png" /></figure><p>Images above might seem like outstanding creations of artistry. Trust me, these are outcomes of set of algorithms developed by humans. Sometimes people refer to these images as outcomes from computers dreaming but that’s just out of exaggeration. Much precisely we can interpret these images as an outcome of a computer program which is developed to interpret data.</p><p><em>Deep dreaming </em>is one of the projects launched by google during 2010 for <em>ImageNet Large Scale Visual Recognition Challenge, which is </em>an annual contest for developing more advanced and effective ways to classify and detect objects and scenes. Each event enables programmers to recognize new methods to improve their techniques and to develop much more sophisticated algorithms. Above Images are outcomes of <a href="https://deepdreamgenerator.com/"><em>Google deep dream generator</em></a>.</p><p>The project is publicly available to anyone interested in. Anyone can visit Google dream URL, upload a photo and this non-human painter will alter your ordinary image in to a mind-blowing piece of art. These bizarre drawings have drawn attention of not only techie people, but any aesthete.</p><p>As I mentioned previously, what actually lies underneath is not based on any artistic sense or pure imagination of an artist. Then how does these images are created ?</p><p>The underlying secret is a ANN (Artificial Neural Network) developed by google. An ANN is a computing system which imitates biological neural networks (series of interconnected neurons) similar to our brain. Similar to human beings these systems are able to learn. A child learns new things by gathering information from the surrounding, from the things he sees, hears etc. In similar manner ANN learns by analyzing lots of example. Unlike a child who is able to recognize an animal as a cat or not just by seeing it once or twice, an ANN need to feed thousands of images of cats and adjust network parameters. As an example, thousands of pictures of cats which are tagged as ‘cats’ and also pictures without cat tagged as ‘no cat’ and analyzing data will help an ANN to recognize if there really is a cat in other images.</p><p>Google deep dream is able to recognize objects in an image and also able to recreate them. That is the reason why this artificial brain has become a machine of art.</p><p>When an Image is fed to the <em>Google deep dream ANN, </em>the image passes through set of layers for object recognition. Well each layer recognize different details of an image to recognize the object as a whole. As an example at the beginning it will try to recognize the image based on curves and edges, then colors, shapes in the image etc. Each layer sums up more details of the image so that at the end ANN is able to recognize the content. After object recognition it recreates the identified objects on its own. This process generates spectacular images which will drive you in to new world. A world with dog monsters, cat humans and monster like human images which will give you goosebumps.</p><p>During the recreation process, it emphasize the identified objects. The object identification and object recreation happens on the will of neural network itself. It adds more details of the recognized objects at each layer to enhance the image. During this recreation, as an example, if the dream generator identified a cat like object then it will add canine teeth, fur , eyes each layer. These details are added from the data it currently owns. More like the vast pool of images that it has been trained from. Sometimes Deep dream is not able to identify each and every component of the image precisely. As an example and most of time image of a wrist watch might contains the hand itself. This is an obvious fact. So that the trained images will contain images of wrist watch with hand. So during the image recreation after being identified as a wrist watch, deep dream will add part of hands too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*K6HF854-H7HR2Ty1IGc4yQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*lg7Gvdx76qu0cqukmVrJbQ.jpeg" /><figcaption>credits goes to Jim.T Deep dream User</figcaption></figure><p>Right side image shows transformation of original image in left, after passed through the deep dream generator.</p><p>Today deep dream has become more like a place of entertainment where people upload their images and generate beautiful dreams out of them.(“Dream” is the word used by google to refer images passed through deep dreamer). Whether these images are from a collection of electronic circuitry dreaming or it’s a well defined collection of instructions developed by human to outperform human imagination, you have to try and make your own dream to feel the beauty of <em>Google Deep Dream generator.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47d05280904d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/do-computers-dream-47d05280904d">Do Computers Dream ?</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The universal currency? — Bitcoin]]></title>
            <link>https://medium.com/parallaxtec/the-universal-currency-bitcoin-8c686f15093f?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/8c686f15093f</guid>
            <category><![CDATA[currency-exchange]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Sun, 16 Jul 2017 05:26:24 GMT</pubDate>
            <atom:updated>2017-07-16T05:26:23.849Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*FoF_pJ07UR_VJP0J." /><figcaption>source : www.pinterest.com/ledgerwallet/bitcoin-editorial-cartoons</figcaption></figure><h4><strong>1 Bitcoin = 2188.4 US Dollars !!!</strong></h4><blockquote>“I do think Bitcoin is the first [encrypted money] that has the potential to do something like change the world.” — Peter Thiel, Co-Founder of Paypal</blockquote><p>And I don’t think you need an explanation for what Peter Thiel said. Currency conversion rate is more than enough for that.</p><p>What are these bitcoins, where are they stored? Can we get some? Let’s find answers.</p><p>Bitcoins are considered as the first decentralized digital currency. Simply there is no centralized authority that issues bitcoins. For all most of all the other currencies,they have a central bank or a central control.Bitcoins are the remarkable innovation, that turned world finance upside down with a currency without a central control. And it is worth mentioning here, the underlying architecture of bitcoin guarantees that no one will ever be able to control this digital currency. Who created bitcoin and how does it work?</p><p>Not all great events have great beginnings. Bitcoin is one of them. Beginning of bitcoin is a not something that is crystal clear. Credit of designing bitcoin goes to “<a href="https://en.wikipedia.org/wiki/Satoshi_Nakamoto">Satoshi Nakamoto</a>”. Most technologists believe that Satoshi Nakamoto is a covered name which is used by a group of unknown experts in cryptography and computer science. Some are argued that Satoshi is actually a Japanese guy!</p><p>The most important fact is, the entire power of bitcoin lies in the basic principle that governs this currency. And that is the ultimate reason behind the unbelievable popularity of bitcoin in the binary world regardless of its origin. The powerful concept behind bitcoin lies as you don’t need banks and you can be your own bank. You’re the true owner of your money. There is no single person in this world who can stop a transaction you make. No one can freeze it, no one can seize it. That’s the underlying story that Satoshi Nakamoto shouted out loud. Sending a worldwide email under his name, he invited techies all over the world to join this world of true ownership. Though the idea first sounded crazy, later world realized that this is absolutely stunning.</p><p>How does this entire system work? Even though it is hard to believe for the first time, bitcoins are automatically created by a computer algorithm governed by mathematics. Well the word “creates” is not the most suitable word for the explanation. But for the moment that’s fine. Bitcoin with uppercase “B” is the shared code that creates the global network using any terminal that is connected to the internet, and the place where digital currency bitcoin (with lower case “b”) is created ,shared and stored. It doesn’t matter what the actual terminal is , it can be either your laptop, smartphone or even your smart TV!. This shared code designed by Satoshi is available in open source. Anyone can look into that and get a complete understanding on how mathematics has painted this entire picture. The code was first designed by Satoshi himself. But now with the collaboration of thousands of programmers who believe this revolutionary currency, bitcoin has become much more stabilized and secured than it was.</p><p>Let’s dig deep how this amazing idea came to an reality. In a bitcoin system there are only few basic operations. Those operations involve some beautiful principles in mathematics and cryptography. Let’s reveal them one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*LFyI8m89-MC4N5yK." /><figcaption>Source : www.slideshare.net</figcaption></figure><p>Bitcoin system is nothing but a ledger. It looks very similar to usual ledgers used in a bank. Difference is that, this ledger is global. It is ‘The Ledger” in bitcoins. It contains all the transactions occurred so-far since the bitcoin was born.It is written in a manner that nobody can alter past records. Basically it is nothing but just a document with numerical value and the owner attached together. But remember due to this ledger and since it contains all the transactions from very first one. The exact total amount of bitcoins in the world is visible to anyone in the world. Actually this single point is considered as one of the key influences that leads the world towards this cryptic-currency. With a centralized currency, a task like calculating the net value of all money is something far beyond reality .</p><p>Let’s assume Alice wants to send 2 bitcoins to Bob. What Alice does is send a global message saying that she transfers 2 bitcoins to bob. Via the “Bitcoin” network that message will be broadcasted all over the globe and every copy of the ledger will be updated according to that.</p><p>Here comes next two big problems. First one is, since everybody knows that, this transaction happens, how Alice make sure the money will be transferred to Bob without the vulnerability of getting stolen. Second one, how Bob knows that these two bitcoins are transferred from Alice and no one else. Solution lies in an extraordinary mathematical concept.</p><p>Private and Public key encryption. — This encryption can be considered as one of the wonders in number theory. (An advance part in mathematics.) Even though it was designed using advanced mathematics (Based on RSA algorithm designed at MIT) it can be simply explained like this. There are always a key pair. Let’s call them “A” and “B”. <strong>A message which is encrypted using key “A” can only be decrypted by key “B”. </strong>Rest is simple logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*3TT53JsfWps57Tx8." /><figcaption>Source : redbackcouncil.blogspot.com</figcaption></figure><p>1.1 Scenario 1 — What a person does is he shares his key “A” is publicly. So it becomes the public key. And keeps key “B” only with himself. If any other person in the world need to send a message to this person,he or she has to encrypt the message using key “A” and send it. Since key “B” is a secret, only the person with the private key can decrypt it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*v53X7b_7hKhtXpjc." /><figcaption>Source : oz.stern.nyu.edu</figcaption></figure><p>1.2 Scenario 2 — Person can share key “B” publicly and keep key “A” only to himself. So what he can do is he can encrypt anything that he wants to send using key “A”. Since key “B” is shared publicly anybody can decrypt and read it. The point is since key “A” is only kept with a the relevant person only the that person can send message which can be decrypted using “B”. It verifies the sender’s identity. (This is the basic concept behind the digital signature as well.)</p><p>Now comes the easy part. What Alice does is, she gets Bob’s public key and encrypt the message and then again encrypts the whole thing with her private key. Then she sends the message globally. Everybody can decrypt it using Alice’s public key and they will see a message encrypted in Bob’s public key. From 1.2 Scenario Bob can verify the identity of Alice and since the message is also encrypted in his public key only Bob can claim for the bitcoins and no one else. The whole world knows those bitcoins are transferred. But thanks to the wonderfulness of pure mathematics, nobody can steal it.</p><p>That’s how the basic functionality of currency — “The Exchange” , is designed in cryptic- currency. And remember that’s just one interesting concept in bitcoin world. There are more to come. Exchange is only the beginning. Let’s keep this discussion continued , the wonders in bitcoins are yet to be revealed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c686f15093f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/the-universal-currency-bitcoin-8c686f15093f">The universal currency? — Bitcoin</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark web — is it really dark?]]></title>
            <link>https://medium.com/parallaxtec/dark-web-is-it-really-dark-f519a9e0793b?source=rss----b9af466d304e---4</link>
            <guid isPermaLink="false">https://medium.com/p/f519a9e0793b</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[darkweb]]></category>
            <dc:creator><![CDATA[Pasindu Senanayake]]></dc:creator>
            <pubDate>Wed, 12 Jul 2017 14:29:42 GMT</pubDate>
            <atom:updated>2017-07-12T14:29:42.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*1w61cJwe6PbWoqun9IezGw.jpeg" /><figcaption><em>Source : abc.com</em></figcaption></figure><p>Google is known as the most powerful search engine in today’s world. Completing more than 3.5 billion google searches per day, google-bots / google spiders crawl the world wide web every second, performing massive web searches at super high speed. But regardless of the extreme server power of google or any other search engine existing today, there is an area in the WWW which google spiders or google bots aren’t welcome. Those areas are technically invisible to google spiders and there is no way to access those areas unless you know how to make the call.</p><p><strong>Is dark web a dangerous ghost in World Wide Web?</strong></p><p>Actually most people believe the answer to be yes. But the reality is little bit different. Dark web is actually an area in World Wide Web which is open to anyone. Since it is invisible to search engines, the chance of someone accidentally entering to a dark web address is less than 1%.</p><p>Anonymity can be considered as the most powerful feature in dark web. But it is well known and a globally accepted fact that dark web has become an extremely dangerous place due to this anonymity. It is said that one wrong movement or a simple mistake in dark-web can cause an entire bankrupt or a life time sentence. Due to the feature of anonymity, most of the illegal businesses like black-market weaponry, prostitution, child-pornography, drugs and harmful chemicals etc. are highly functional in dark web. Law enforcement agencies like NSA, FBI, CIA use various tactics and operations continuously to penetrate dark web and hunt down those illegal businesses. But the protocols and designing architectures used in dark-web accessing points aren’t simply hack-able. After the massive attack launched by a famous group of hackers named “Anonymous:” in 2010 against the child pornography web market inside the dark-web, still there is no significant victory in cyber battle against the illegal dark web sites.</p><p>As it was mentioned earlier, accessing dark web is actually a piece of cake if you know the method. Accessing to dark web doesn’t need any special technical abilities. There are web browsers which can be used to access dark web addresses. “Tor” is the most popular browser. The basic necessity to be in the dark web — Anonymity is by default provided by the “Tor” browser. The important fact is even in the tor browser, searching dark web content is impossible to do. This is because contents in the dark web are invisible to all search engines regardless of the browser that is used. So how these sites exist without being detected to google spiders or any other search engine? The simple answer is they are different from normal web sites.</p><p>The difference lies in the web requests. There is a standard way of requesting a web site from a server. Once we type something to search in a search engine, it will request all pages (Not all pages are requested but for the simplicity it is assumed that all are requested) from web servers and search the content that you asked. Since requesting a page from a web server has standard process, search engines follow that and get the web pages from servers. But when it comes to dark web sites the story is different. Those web address are configured to a different requesting manner and search engines have no idea about that. So theoretically those web addresses are invisible to google spiders or any other search engines. (Most dark web addresses use powerful encryption methods and hidden requesting techniques.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*kBo3XxrcOoBvru3CD66f9A.png" /><figcaption>Source : www.makeuseof.com</figcaption></figure><p>But if someone knows how to make the request he/she can directly use it (type the URL) in a dark web accessible browser and access the web address without any trouble. Normally almost all the dark web addresses are onion addresses. An onion address consists of separate layers. Every outer layer wraps inner layers. As the name suggests it is like layers in an onion!</p><p>Set of layers provide the anonymity and also encrypt the content. End users of data is invisible to the outside parties. (But this anonymity is not a guaranteed one. There are incidents that law enforcement agencies were able to track down notorious people who performed illegal activities via dark web.)</p><blockquote>“There are only two ways of telling the complete truth — anonymously and posthumously.” — Thomas Sowell</blockquote><p>Dark web provides the first one. Not all content in dark web can be considered as bad or harmful. As Thomas Sowell said there are a lot of chats and web sites where people can express their ideas freely and anonymously. (ex: Hidden Answers) Normally in dark web there are billions of transactions that happen everyday via bitcoins. Most of them are related to black market businesses. But some very large amount of anonymous donations are also occurred via dark web. Dark web is not a special area in web. It is a part of the same web that we all use everyday and it is an area where you can visit without reveling yourself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f519a9e0793b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/parallaxtec/dark-web-is-it-really-dark-f519a9e0793b">Dark web — is it really dark?</a> was originally published in <a href="https://medium.com/parallaxtec">ParallaxTec</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>