<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ShikariSohan</title>
    <description>The latest articles on DEV Community by ShikariSohan (@shikarisohan).</description>
    <link>https://dev.to/shikarisohan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1073531%2Fc134a919-dcce-42d3-8c1e-605b879a6244.jpeg</url>
      <title>DEV Community: ShikariSohan</title>
      <link>https://dev.to/shikarisohan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shikarisohan"/>
    <language>en</language>
    <item>
      <title>How I Discovered Java's Most Famous Inside Joke</title>
      <dc:creator>ShikariSohan</dc:creator>
      <pubDate>Sat, 23 Aug 2025 17:05:08 +0000</pubDate>
      <link>https://dev.to/shikarisohan/how-i-discovered-javas-most-famous-inside-joke-3jfi</link>
      <guid>https://dev.to/shikarisohan/how-i-discovered-javas-most-famous-inside-joke-3jfi</guid>
      <description>&lt;h2&gt;
  
  
  It Started with Boring Technical Stuff
&lt;/h2&gt;

&lt;p&gt;Magic numbers are just the first bytes of a file that identify its type. Pretty straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JPEG files start with &lt;code&gt;FF D8 FF&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;PNG files start with &lt;code&gt;89 50 4E 47&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;ZIP files start with &lt;code&gt;50 4B 03 04&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;PDF files start with &lt;code&gt;25 50 44 46&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's a security thing prevents a PNG from actually being a virus.exe. Technical, useful, but honestly... boring.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I Compiled Some Java Code
&lt;/h2&gt;

&lt;p&gt;I work with Java so got curious about the magic number that identifies a Java class file. To explore this, I decided to compile a simple program and examine its hex dump to learn more:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Hello&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hi"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran &lt;code&gt;javac HelloWorld.java&lt;/code&gt; and then &lt;code&gt;hexdump -C -n 64 Hello.class&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkmbkg54fk38y3cdk3ns.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkmbkg54fk38y3cdk3ns.jpg" alt="cafebabe" width="800" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait, what? The Java compiler knows this is a class file by reading "CAFE BABE"? Now THIS was interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Down the Rabbit Hole I Went
&lt;/h2&gt;

&lt;p&gt;I had to know more. How did &lt;strong&gt;&lt;code&gt;CAFEBABE&lt;/code&gt;&lt;/strong&gt; become Java's magic number? After digging through old comp.lang.java threads and NeXT documentation, here's what I found:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Theories People Had
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tribute to coffee and baristas at Peet's in Palo Alto&lt;/li&gt;
&lt;li&gt;Borrowed from NeXT's Mach-O file format
&lt;/li&gt;
&lt;li&gt;Just engineers being caffeinated and silly in the 90s&lt;/li&gt;
&lt;li&gt;Second choice was apparently &lt;code&gt;0xDEADBABE&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Real Story from Java's Creators
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Patrick Naughton&lt;/strong&gt; (Original Java team):&lt;br&gt;
"We were looking for something fun, unique and easy to remember. &lt;code&gt;0xCAFEBABE&lt;/code&gt; was better than the second runner-up, &lt;code&gt;0xDEADBABE&lt;/code&gt;."&lt;/p&gt;

&lt;p&gt;This was chosen back when Java was still called the "Green" project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;James Gosling&lt;/strong&gt; (Java's inventor):&lt;br&gt;
"I was re-vamping some file format code and needed a couple of magic numbers... I hit on &lt;code&gt;CAFEBABE&lt;/code&gt; and decided to use it."&lt;/p&gt;

&lt;p&gt;He mentioned they also considered &lt;code&gt;CAFED00D&lt;/code&gt; and &lt;code&gt;CAFEDEAD&lt;/code&gt;, inspired by a local café nicknamed "Cafe Dead."&lt;/p&gt;

&lt;h3&gt;
  
  
  The NeXT Connection
&lt;/h3&gt;

&lt;p&gt;Turns out NeXT also used &lt;code&gt;CAFEBABE&lt;/code&gt; in their Mach-O binaries. Conspiracy? Nope. NeXT engineer Mike DeMoney confirmed: "I didn't bring it over to Java they picked it before I arrived."&lt;/p&gt;

&lt;p&gt;Just a coincidence. Apparently there aren't that many cool hex words.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Every single Java class file I've ever worked with starts with those four bytes: &lt;code&gt;CA FE BA BE&lt;/code&gt;. When the JVM sees this, it knows it's looking at valid bytecode. If it sees anything else, it throws a &lt;code&gt;ClassFormatError&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What started as a practical need became one of programming's most famous inside jokes. Billions of Java files carry this signature and making it possibly the most widely distributed programming joke in history.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Fun Hex Numbers I Found
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hex Value&lt;/th&gt;
&lt;th&gt;What It Means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0xDEADBEEF&lt;/td&gt;
&lt;td&gt;Debug marker in various systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0xFEEDFACE&lt;/td&gt;
&lt;td&gt;Mach-O binary marker&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0xBAADF00D&lt;/td&gt;
&lt;td&gt;Windows bad memory marker&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  The Takeaway
&lt;/h2&gt;

&lt;p&gt;What I thought would be a quick look at file formats turned into a fascinating dive into programming history. &lt;code&gt;CAFEBABE&lt;/code&gt; isn't just a magic number and it's proof that even in the most technical corners of software, there's room for creativity and humor.&lt;/p&gt;

&lt;p&gt;Every time I compile Java code now, I remember there are actual humans behind all this technology. Humans who drink too much coffee and like to sneak jokes into the foundation of enterprise software.&lt;/p&gt;

&lt;p&gt;And honestly? That makes coding a lot more fun.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources and References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why CAFEBABE?&lt;/strong&gt; - &lt;a href="https://www.artima.com/insidejvm/whyCAFEBABE.html" rel="noopener noreferrer"&gt;https://www.artima.com/insidejvm/whyCAFEBABE.html&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;bbum's NeXT/Java History&lt;/strong&gt; - &lt;a href="https://radio-weblogs.com/0100490/2003/01/28.html" rel="noopener noreferrer"&gt;https://radio-weblogs.com/0100490/2003/01/28.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>programminghistory</category>
      <category>cafebabe</category>
    </item>
    <item>
      <title>Simple vs. Preflighted Requests in CORS: What Developers Need to Know</title>
      <dc:creator>ShikariSohan</dc:creator>
      <pubDate>Tue, 06 May 2025 05:08:23 +0000</pubDate>
      <link>https://dev.to/shikarisohan/simple-vs-preflighted-requests-in-cors-what-developers-need-to-know-276n</link>
      <guid>https://dev.to/shikarisohan/simple-vs-preflighted-requests-in-cors-what-developers-need-to-know-276n</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Simple requests: sent directly, response blocked if CORS headers are missing.&lt;/li&gt;
&lt;li&gt;Preflighted requests: OPTIONS first, then the real request if allowed.&lt;/li&gt;
&lt;li&gt;HTML forms are why simple requests are still allowed today.&lt;/li&gt;
&lt;li&gt;CORS protects responses, not the requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Let’s Send a PUT Request and Inspect the Network Tab&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Say you’re making a simple fetch call in JavaScript like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns5hv39wczsyacxxj82v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns5hv39wczsyacxxj82v.png" alt="Code for fetch" width="800" height="561"&gt;&lt;/a&gt;&lt;br&gt;
You might expect the browser to just send that &lt;strong&gt;PUT&lt;/strong&gt; request to your server.&lt;br&gt;
But when you check the &lt;strong&gt;Network&lt;/strong&gt; tab in your browser's developer tools...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lw2t06dfdskiwoc58t7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lw2t06dfdskiwoc58t7.png" alt="Screenshot showing the OPTIONS request followed by the PUT request" width="800" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Figure 1: Screenshot showing the OPTIONS request followed by the PUT request&lt;/p&gt;

&lt;p&gt;...you'll notice the browser sends an OPTIONS request first then the PUT. What’s going on?&lt;br&gt;
This is what's called a &lt;strong&gt;preflight request&lt;/strong&gt; — a kind of sanity check that the browser does before making certain types of cross-origin requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  So What Is a Preflight Request?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;preflight&lt;/strong&gt; (or "preflighted") request is when the browser sends an HTTP &lt;strong&gt;OPTIONS&lt;/strong&gt; request before the actual request (like PUT or DELETE) to ask the server:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Hey, I'm about to send a non-standard request. Are you okay with this?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Only if the server responds with the right CORS headers, will the browser then send the real request.&lt;br&gt;
This is a security measure, because certain requests can change server state or carry sensitive data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Refresher: What Is CORS?
&lt;/h2&gt;

&lt;p&gt;Without a deep dive, CORS (Cross-Origin Resource Sharing) is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A browser security feature that controls how web pages can make requests to domains other than the one that served them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What’s a Simple Request?
&lt;/h2&gt;

&lt;p&gt;Not all requests go through this &lt;em&gt;preflight&lt;/em&gt; step. Some are "simple" — a term from the older CORS spec (though the newer Fetch spec no longer uses it explicitly).&lt;br&gt;
A simple request is one that satisfies all of the following:&lt;br&gt;
✅ Allowed Methods: &lt;em&gt;GET, HEAD, POST&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;✅ Allowed Headers:&lt;br&gt;
Only CORS-safelisted headers like:&lt;br&gt;
Accept, Accept-Language, Content-Language&lt;br&gt;
Content-Type — but only with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;application/x-www-form-urlencoded&lt;/li&gt;
&lt;li&gt;multipart/form-data&lt;/li&gt;
&lt;li&gt;text/plain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ Other Rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No custom headers like Authorization or X-Whatever&lt;/li&gt;
&lt;li&gt;No ReadableStream in the body&lt;/li&gt;
&lt;li&gt;No xhr.upload.addEventListener(...) handlers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These constraints are what keep simple requests &lt;strong&gt;“safe enough”&lt;/strong&gt; that the browser doesn’t feel the need to pre-check them with the server.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So Now We Have Two Types of Requests&lt;/em&gt;&lt;br&gt;
Let’s break down how simple requests and preflighted requests interact differently with the server and browser:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;❌ If a CORS Error Happens:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Simple request:&lt;/em&gt;&lt;br&gt;
 ✅ The request is sent to the server. Process and send the response back with headers added.&lt;br&gt;
 🚫 But if the server doesn't return the right Access-Control-Allow-Origin, the browser blocks the response.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Preflighted request:&lt;/em&gt;&lt;br&gt;
 🚫 The browser sends a preflight OPTIONS request.&lt;br&gt;
 ❌ If the server doesn't respond correctly, the actual request is never sent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vzp7dmu7uhxnczaowcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vzp7dmu7uhxnczaowcd.png" alt="Shows the flow when a browser requests a simple request." width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Figure 2: Shows the flow when a browser requests a simple request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8837f5k1ta471raiumjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8837f5k1ta471raiumjz.png" alt="Shows the flow when a browser requests a preflight request." width="800" height="469"&gt;&lt;/a&gt;&lt;br&gt;
Figure 3: Shows the flow when a browser requests a preflight request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Are Simple Requests Even Allowed Now?
&lt;/h2&gt;

&lt;p&gt;It goes back to the HTML&lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag from way back in &lt;code&gt;HTML 4.0&lt;/code&gt;.&lt;br&gt;
Before JavaScript could make HTTP requests using fetch() or &lt;code&gt;XMLHttpRequest&lt;/code&gt;, you could already do this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;form method="POST" action="https://otherdomain.com/submit"&amp;gt;&lt;br&gt;
  ...&lt;br&gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This would submit data across origins, no problem. So servers had to defend against that kind of cross-site behavior — namely, &lt;strong&gt;CSRF (Cross-Site Request Forgery&lt;/strong&gt;).&lt;br&gt;
Because simple requests look like form submissions, they’re &lt;strong&gt;no more dangerous&lt;/strong&gt; than what browsers could already do decades ago. That’s why:&lt;br&gt;
&lt;strong&gt;CORS doesn’t block simple requests. They’re not introducing a new threat.&lt;/strong&gt;&lt;br&gt;
But—and this is key—the response is still blocked unless the server opts in by including the &lt;strong&gt;Access-Control-Allow-Origin header&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, What Protection Still Exists?
&lt;/h2&gt;

&lt;p&gt;Even when the browser allows the request to go out:&lt;br&gt;
The response is blocked unless the server returns:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Access-Control-Allow-Origin: http://your-frontend-domain.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So yes — the request can happen, just like a form could do it...&lt;br&gt;
But JavaScript can’t access the response unless the server explicitly says it can.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do We Need Preflight at All?
&lt;/h2&gt;

&lt;p&gt;Preflight requests were introduced so browsers could:&lt;br&gt;
 ✅ Verify the server is CORS-aware&lt;br&gt;
 ✅ Get explicit permission for potentially dangerous or unusual requests&lt;br&gt;
These are typically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods other than GET, POST, HEAD (like PUT, DELETE)&lt;/li&gt;
&lt;li&gt;Requests with custom headers (e.g. Authorization)&lt;/li&gt;
&lt;li&gt;Requests with bodies like application/json&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s what the original CORS spec said:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“To protect resources against cross-origin requests that could not originate from certain user agents before this specification existed, a preflight request is made to ensure that the resource is aware of this specification.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Translation&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Only let “new” types of cross-origin requests through if the server knows about CORS and says “yes”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🧠 Let’s wrap it up:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Simple requests are like old-school form submissions. They're allowed without preflight — but the browser blocks the response unless the server opts in.&lt;/li&gt;
&lt;li&gt;Preflighted requests are more powerful or unusual. The browser checks with the server first using OPTIONS. If the server doesn't opt in, the actual request never goes out.&lt;/li&gt;
&lt;li&gt;The protection lies in the server's response: unless it sends the right CORS headers, JavaScript can’t read the response.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS" rel="noopener noreferrer"&gt;MDN CORS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/15381105/what-is-the-motivation-behind-the-introduction-of-preflight-cors-requests" rel="noopener noreferrer"&gt;Stackoverflow Discussion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/PNtFSVU-YTI?feature=shared" rel="noopener noreferrer"&gt;Learn CORS In 6 Minutes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/_UvqNK877WI?feature=shared" rel="noopener noreferrer"&gt;What is a PREFLIGHT REQUEST? And how is it relevant to CORS?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>cors</category>
      <category>http</category>
      <category>https</category>
    </item>
    <item>
      <title>Google Chrome Won’t Open After a Hostname Change? Fix It With This One Line Command!</title>
      <dc:creator>ShikariSohan</dc:creator>
      <pubDate>Fri, 28 Mar 2025 16:44:44 +0000</pubDate>
      <link>https://dev.to/shikarisohan/google-chrome-wont-open-after-a-hostname-change-fix-it-with-this-one-line-command-1k4d</link>
      <guid>https://dev.to/shikarisohan/google-chrome-wont-open-after-a-hostname-change-fix-it-with-this-one-line-command-1k4d</guid>
      <description>&lt;h2&gt;
  
  
  The Chrome Crash That Caught Me Off Guard 🚨
&lt;/h2&gt;

&lt;p&gt;I was recently playing with my Linux machine, setting things up just the way I like them. One of the things was updating my hostname simple enough, right? Everything seemed fine until I rebooted and tried to launch &lt;strong&gt;Google Chrome&lt;/strong&gt;. Nothing. No error popped up, no loading spinner. Chrome just refused to open. 😱&lt;br&gt;&lt;br&gt;
As a developer, my first instinct was to fire up the terminal and launch Chrome from there to see what was going on. Sure enough, cryptic error messages popped up. But what exactly?  &lt;/p&gt;

&lt;h2&gt;
  
  
  AI Let Me Down This Time 🤖
&lt;/h2&gt;

&lt;p&gt;Living in the era of AI, I figured I’d ask the experts: ChatGPT-4o and Gemini Advanced. They give list of suggestions to perform for start Chrome, clear the cache, tweak permissions, you name it. I spent way too long trying each one, but Chrome still wouldn’t budge. Frustration level: &lt;strong&gt;rising&lt;/strong&gt;.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Back to Basics: The Power of a Google Search 🔎
&lt;/h2&gt;

&lt;p&gt;With AI failing me, I turned to the tried and true method: a classic Google search. After experimenting with a few keyword combos, I found gold. Tucked away in an &lt;a href="https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname" rel="noopener noreferrer"&gt;Ask Ubuntu thread&lt;/a&gt; was a comment by user &lt;a href="https://askubuntu.com/users/60294/bain" rel="noopener noreferrer"&gt;Bain&lt;/a&gt;, and a related &lt;a href="https://bugs.chromium.org/p/chromium/issues/detail?id=367048" rel="noopener noreferrer"&gt;Chromium bug&lt;/a&gt; report confirmed it: this was a known issue tied to hostname changes messing with Chrome’s internal files.&lt;br&gt;&lt;br&gt;
And the fix? *&lt;em&gt;A single, glorious line of code. 🙌  *&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The One Line Fix That Saved the Day ✅
&lt;/h2&gt;

&lt;p&gt;Here’s the magic command that’ll get Chrome running again:&lt;br&gt;&lt;br&gt;
&lt;em&gt;bash&lt;/em&gt;&lt;br&gt;
&lt;code&gt;rm -rf ~/.config/google-chrome/Singleton* &lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;What Does This Do?&lt;/strong&gt;&lt;br&gt;
Let’s break it down:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;~/.config/google-chrome/&lt;/code&gt; is where Chrome stores its user configuration files on Linux.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside that directory, files like SingletonLock, SingletonSocket, and SingletonCookie are used to ensure only one instance of Chrome runs at a time and to manage session data.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you change your hostname, these files can get confused, tying themselves to the old hostname and blocking Chrome from launching. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The command deletes all those Singleton files (the * wildcard grabs them all). Once they’re gone, Chrome regenerates them on the next launch, syncing them to your new hostname.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running this command, I typed &lt;strong&gt;google-chrome&lt;/strong&gt; in the terminal, hit Enter, and boom Chrome spawned back to life like nothing had ever happened. 🚀  &lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters 🎓
&lt;/h2&gt;

&lt;p&gt;This experience taught me two things:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AI isn’t always the shortcut you hope for. While ChatGPT and Gemini are incredible tools, they couldn’t pinpoint this niche issue. Sometimes, the wisdom of the crowd like a random Ask Ubuntu comment beats fancy algorithms.
&lt;/li&gt;
&lt;li&gt;Simple fixes can hide in plain sight. Hours of troubleshooting boiled down to one terminal command, thanks to Bain’s sharp insight.
Massive props to &lt;a href="https://askubuntu.com/users/60294/bain" rel="noopener noreferrer"&gt;Bain&lt;/a&gt; for dropping this gem in the comments of that Ask Ubuntu post. You’re the real MVP!
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Have you ever faced a similar issue? Let me know in the comments! 👇&lt;/p&gt;

</description>
      <category>linux</category>
      <category>troubleshooting</category>
      <category>devops</category>
      <category>browser</category>
    </item>
    <item>
      <title>How I merged Five Pull Requests, Lose Sanity, and Laugh It Off</title>
      <dc:creator>ShikariSohan</dc:creator>
      <pubDate>Sat, 26 Oct 2024 17:26:24 +0000</pubDate>
      <link>https://dev.to/shikarisohan/how-i-merged-five-pull-requests-lose-sanity-and-laugh-it-off-1edo</link>
      <guid>https://dev.to/shikarisohan/how-i-merged-five-pull-requests-lose-sanity-and-laugh-it-off-1edo</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest"&gt;2024 Hacktoberfest Writing challenge&lt;/a&gt;: Contributor Experience&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I started Hacktoberfest, I thought the real challenge would be the coding. Oh, how wrong I was. Turns out, finding a repository I could work on was the &lt;em&gt;real&lt;/em&gt; adventure. Scrolling through issues and projects, wondering, &lt;em&gt;“Can I even do this?”&lt;/em&gt; was practically a full-time job. Once I did find an issue, coding wasn’t too bad—until I hit the testing phase. Nothing quite like watching a build fail to keep you humble. 😅&lt;/p&gt;

&lt;p&gt;But hey, somehow, I managed to get five PRs merged. 🎉 Maybe not the most groundbreaking work, but from my POV, each contribution added a little something to the repository. Below, I’ve broken down each of these PRs and the unexpected twists that came with them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpaaircqhsewijgrj5v7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpaaircqhsewijgrj5v7.png" alt="Hacktober Fest contribution" width="770" height="253"&gt;&lt;/a&gt;&lt;br&gt;
&lt;u&gt;&lt;em&gt;I can’t even describe how proud I am! 😄🙌&lt;br&gt;
&lt;/em&gt;&lt;/u&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Feature/line clipping algorithms&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PR:&lt;/strong&gt; &lt;a href="https://github.com/TheAlgorithms/Java/pull/5580" rel="noopener noreferrer"&gt;TheAlgorithms/Java#5580&lt;/a&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Contribution Summary:&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;This was my first and biggest contribution, and it’s crazy to think this repo has nearly &lt;strong&gt;60,000 stars!&lt;/strong&gt; ⭐ This repository is a compilation of all algorithms implemented in &lt;strong&gt;Java&lt;/strong&gt;. I quickly realized most algorithms I learned were already implemented, but then I remembered I’d tackled line clipping algorithms in my computer graphics exams. So, I jumped in and &lt;strong&gt;&lt;em&gt;coded up Cohen-Sutherland and Liang-Barsky&lt;/em&gt;&lt;/strong&gt;. Passing the tests, though? That was the real challenge! It took me an entire day (talk about a noob moment) to get everything to pass, but hey, it was a great learning experience—and I survived to tell the tale! 💪&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnomn68ofghfm5o1bzpf.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnomn68ofghfm5o1bzpf.jpeg" alt="Meme about test fail" width="606" height="420"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;u&gt;Every time my pushed code shows a test failed error.&lt;br&gt;
&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Feature/quote-to-image-maker&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PR:&lt;/strong&gt; &lt;a href="https://github.com/JayShukla8/Quotes/pull/140" rel="noopener noreferrer"&gt;JayShukla8/Quotes#140&lt;/a&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Contribution Summary:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I stumbled upon this repository in a Discord server where everyone was busy contributing by adding quotes to the database. 💬 I noticed a demand for a tool to generate shareable quote images for social media. So, I decided to jump in and create a &lt;em&gt;&lt;strong&gt;feature&lt;/strong&gt;&lt;/em&gt; that lets users &lt;strong&gt;convert quotes into images&lt;/strong&gt; for easy sharing. It even auto-adjusts the image for dark or light mode based on the theme—perfect for any time of day! 🌞🌜&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Add tooltips to calculator buttons for improved user understanding&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PR:&lt;/strong&gt; &lt;a href="https://github.com/Alitindrawan24/Binary-Calculator/pull/140" rel="noopener noreferrer"&gt;Alitindrawan24/Binary-Calculator#140&lt;/a&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Contribution Summary:&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;This one was a no-brainer! 🤓 While exploring the project, I struggled to figure out the functionality of each button. So, what did I do? I added &lt;strong&gt;&lt;em&gt;tooltips to all the buttons&lt;/em&gt;&lt;/strong&gt; to clarify their functions. Easy peasy! 🍋&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Implement pause state in Breakout game&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PR:&lt;/strong&gt; &lt;a href="https://github.com/DhanushNehru/breakout-game/pull/53" rel="noopener noreferrer"&gt;DhanushNehru/breakout-game#53&lt;/a&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Contribution Summary:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I discovered this project in a blog, and while the game was a ton of fun, I realized it was missing a crucial feature: a pause state. ⏸️ I mean, who doesn’t need a quick timeout now and then? So, I jumped in and added that &lt;strong&gt;&lt;em&gt;pause functionality&lt;/em&gt;&lt;/strong&gt;. I faced some tricky logic along the way, but in the end, it all came together nicely! 🎮&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Implemented WeatherApp and updated README&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PR:&lt;/strong&gt; &lt;a href="https://github.com/Janani-Balasooriya/Java-Beginner-Projects/pull/28" rel="noopener noreferrer"&gt;Janani-Balasooriya/Java-Beginner-Projects#28&lt;/a&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Contribution Summary:&lt;/strong&gt; This repository is a collection of &lt;em&gt;&lt;strong&gt;simple Java projects&lt;/strong&gt;&lt;/em&gt;, and I decided to tackle a &lt;em&gt;&lt;strong&gt;Weather App&lt;/strong&gt;&lt;/em&gt;. 🌦️ I developed a straightforward console-based application where users can get weather updates for their current location or any location they input. I made some API calls and did a bit of formatting to make it all work. It’s cleanly coded and modular, making it easy for new Java learners to grasp! 👩‍💻&lt;/p&gt;

&lt;p&gt;Wrapping up my Hacktoberfest adventure, I’ve learned that coding can be chaotic but oh-so-rewarding! 🎢 From battling stubborn tests to adding cool features, each pull request was a mini victory. If you’re thinking about joining the open-source fun, do it! You’ll sharpen your skills and have a blast while doing it. Here’s to more bugs, features, and laughter—bring on next year’s Hacktoberfest! 🚀&lt;/p&gt;

&lt;p&gt;A huge thank you to all the maintainers out there—your hard work and dedication make these contributions possible, and we are truly grateful! 🙌&lt;/p&gt;

&lt;h3&gt;
  
  
  Connect with Me!
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/shikarisohan" rel="noopener noreferrer"&gt;shikarisohan&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discord:&lt;/strong&gt; &lt;a class="mentioned-user" href="https://dev.to/shikarisohan"&gt;@shikarisohan&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://linkedin.com/in/moksedur-rahman-sohan-53b514217/" rel="noopener noreferrer"&gt;moksedur-rahman-sohan&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email:&lt;/strong&gt; &lt;a href="mailto:mokesdur.rahman.sohan@gmail.com"&gt;mokesdur.rahman.sohan@gmail.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Cover Image created by Adobe Firefly.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>devchallenge</category>
    </item>
  </channel>
</rss>
