Sophomore Dev
The Dev You Say

Archive for the ‘Tech’ Category

How to Deepfake Grimes’ Voice and Not Get Blocked

Monday, May 8th, 2023

Are you tired of singing on your own songs? Do you dream of collaborating with Grimes, but don’t know how to reach out to her? Well, worry not my friend, for Grimes has just released Elf.Tech – an AI voice software that deepfakes her voice for your use!

But before you start making an AI anthem about anything extreme or offensive (and get blocked by the queen herself), let’s take a look at how you can use this new tool wisely and humorously.

First of all, go to Elf.Tech website and download the demo. It comes with a collaboratively remade Richie Hawtin’s Plastikman track “Passage (Out)”. Listen to it and get inspired! Then, access stems to train your own Grimes AI. Play with them until you feel like a musical genius.

Now that you have created something beautiful (or at least decent), it’s time for release. You’re going to split the royalties 50/50 with Grimes herself! So be tasteful in your choice of lyrics and tune. Follow Grimes’ advice and stay away from “Nazi anthems” or “baby murder songs”. Instead, why not make an AI love song about Elon Musk?

Once your song is out there in the world (or at least on SoundCloud), sit back and wait for the royalties to come in. And who knows? Maybe one day you’ll be able to quit your day job and collaborate with Grimes in person.

In conclusion, Elf.Tech is a fun tool for music creators who want to experiment with AI generated vocals. Just remember to play nice and avoid anything too extreme or offensive. After all, nobody wants their dreams crushed by a blocking spree from Grimes herself.

Handling Multiple Requests Concurrently: A Guide to Improving PHP’s Built-in Server Performance

Wednesday, May 3rd, 2023

This is actually the post I originally wanted to make. The reason was simple. I didn’t find a lot of info about the topic, and this is what the official PHP docs have to say:

You can configure the built-in webserver to fork multiple workers in order to test code that requires multiple concurrent requests to the built-in webserver. Set the PHP_CLI_SERVER_WORKERS environment variable to the number of desired workers before starting the server. This is not supported on Windows.

If you have ever used PHP’s built-in server for more than, let’s say testing your site’s code locally you have probably run into concurrency issues. Servers are responsible for handling a vast amount of requests concurrently. In a single-process synchronous mode, requests are dealt with individually and can block the server from executing until they complete. This can lead to delays in processing and reduce overall server performance.

To tackle this issue, PHP 7.4 introduced support for handling multiple requests concurrently. This feature relies on fork() availability and doesn’t work on Windows. The server forks new workers to serve each incoming request in this mode.

Enabling Concurrent Request Handling

You can activate concurrent request handling by setting the PHP_CLI_SERVER_WORKERS environment variable to the number of workers you want:

PHP_CLI_SERVER_WORKERS=8 php -S localhost:8080

Of you can do the same in code. For example using a wrapper script to enabled the number of workers, like so:

putenv("PHP_CLI_SERVER_WORKERS=8");

This command spawns eight concurrent worker processes capable of handling simultaneous requests.

Things to Keep in Mind When Using Multiple Workers

While using multiple workers can significantly improve server performance, there are some things you need to keep in mind when using them:

  1. Memory Usage – Each worker process requires an independent copy of memory, which means that enabling too many workers could lead to high memory usage and slow down your system’s performance.
  2. Database Connection Limitations – If you’re using multiple database connections, make sure that your connection pool supports concurrent access without encountering deadlocks or other synchronization issues.
  3. Shared Resources Management – When working with shared resources such as files or disk space, ensure that multiple workers do not interfere with each other while accessing these resources at the same time.

Concurrent request handling is an excellent way of improving server performance by allowing the server to handle multiple requests simultaneously. However, it’s important to keep some things in mind while using multiple workers, such as memory usage, database connection limitations, and shared resource management.

Handling concurrent requests is still marked as experimental in PHP 8.1; however, it promises better stability and performance enhancements in the future.

Exploring the Benefits of PHP Built-In Web Server

Tuesday, May 2nd, 2023

And Now for a Public Service Announcement

Well, well, well, look who’s back! It’s me, your favorite forgetful former Sophomore Dev Andrew who disappeared off the face of the internet for a couple of years (not really). Remember me? No? Yeah, I don’t blame you. Even I forgot about my blog until recently when I stumbled upon it by accident while trying to find a recipe for vegan lasagna (not really). Oopsie! So here we are, back at it again with the mediocre content and occasional spelling errors. But hey, a lot has changed in the past few years – like seriously, have you seen what’s going on in the world right now? So buckle up and let’s see if I can still string together some coherent sentences and make you laugh (or mostly – cringe) along the way.

Why am I writing about the built-in PHP web server today? Well, because I actually wanted to write about something else entirely, something that could be summed up in two sentences, and that seemed like a bad start to rebooting the site.

PHP is one of the most popular web development languages used in the world today. It provides developers with a robust set of tools to create feature-rich and dynamic web applications. One such tool that PHP offers is its built-in web server – a handy way to test applications and share local files on your network quickly.

We’ll dive deeper into what the PHP built-in web server is, how it works, and why it’s useful for developers.

What is the PHP Built-In Web Server?

The PHP built-in web server is precisely what it sounds like – a lightweight server that comes bundled with PHP installations. It allows developers to serve their web applications locally without requiring external software like Apache or Nginx.

The built-in server supports execution of PHP scripts, catch-all routing, and static files with common MIME types. It provides an integrated solution for testing and development purposes, allowing developers to work efficiently in a familiar environment.

Why Use The Built-In Web Server?

There are several benefits to using the PHP built-in web server:

  1. Simplicity: The built-in web server is easy to set up and requires no additional configuration or installation processes beyond installing PHP itself.
  2. Lightweight: Since it’s designed only for development purposes and not production use, it’s lightweight in nature, making it faster than other servers like Apache or Nginx.
  3. Security: The built-in web server has limited features compared to dedicated servers; this makes it less prone to vulnerabilities and hacking attempts.
  4. Cross-Platform Compatibility: The built-in server runs on all major operating systems; Windows, Mac OS X, Linux/Unix-based systems as well as different versions of PHP (5.x – 8.x).
  5. Integrated Debugging: Developers can take advantage of integrated debugging tools since both the application code and the webserver run on the same machine.

How to Use the PHP Built-In Web Server

Using the built-in web server is straightforward. First, ensure PHP is installed on your computer. Then open a terminal or command prompt and navigate to your project’s root directory. Finally, start the web server with the following command:

php -S localhost:8000

This command will start the built-in webserver at port 8000 of your local machine. Visit http://localhost:8000 in your browser to see your application running.

You can also specify a different port like this:

php -S localhost:8080

The PHP Built-In Web Server is a great tool for developers who want an easy-to-use, lightweight solution for testing and developing their applications locally. It provides all the necessary features required for development purposes without compromising on performance or security. If you’re looking for a convenient way to test your applications without relying on external servers, then give the built-in web server a try today!

The Lost City of Melbourne

Sunday, August 28th, 2016

It appears like there is a new lost city. Melbourne.

Though they’re trying to minimise it, the recent relocation of Melbourne Australia to the ocean east of Japan in Microsoft’s flagship mapping application is blamed on someone having flipped a sign in the latitude given for the city’s Wikipedia page.

This statement may or may not be the actual cause of the issue. One thing is certain though, it does produce a question about accuracy on other areas of the map.

As unfortunate as this is it won’t deter me from using the service in the future.

Floating Solar Device Boils Water Without Mirrors

Saturday, August 27th, 2016

The search for better/cheaper methods of distilling water or generating steam has been ever on going. Now researchers from MIT and the Masdar Institute of Science and Technology, led by George Ni, describe a prototype design that boils water under ambient sunlight.

Central to their floating solar device is a “selective absorber”—a material that both absorbs the solar portion of the electromagnetic spectrum well and emits little back as infrared heat energy. For this, the researchers turn to a blue-black commercial coating commonly used in solar photovoltaic panels. The rest of the puzzle involves further minimizing heat loss from that absorber, either through convection of the air above it or conduction of heat into the water below the floating prototype.

But it’s probably not a last. The researchers used computer modeling to look for factors they could optimize, and they calculated that the device should make steam even at about half of direct sunlight’s full intensity. With that much wiggle room, they say that a cheaper, less effective absorber material could bring the cost down even more. The current design should only cost about $6 per square meter to make, and the researchers think they could reduce that to $2 per square meter. At that price, they estimate you could produce steam for about five percent of the cost of a system that has to concentrate sunlight.

You can read the article in its entirety on arstechnica.com.

HAARP Under New Management and You’re Invited to an Open House

Saturday, August 27th, 2016

There have been rumors about HAARP since news broke about a year of two ago that people thought it was used in some sort of mind control array or whatever. Well it s now under new management.

The University of Alaska Fairbanks now owns and operates the High-Frequency Active Auroral Research Program and invites the public to an open house Saturday. This is interested visitors’ chance to learn about the scientific mission and research at the Gakona facility, which was transferred last year from the U.S. Air Force to UAF.

HAARP’s original purpose was to analyze the ionosphere and investigate the potential for developing ionospheric enhancement technology for radio communications and surveillance. But now that the University of Alaska Fairbanks has taken control of the station they intend to make the facilities available for researchers on a pay-per-use basis.

If I actually lived in Alaska (yeah, I know it’s big, let’s say Gakona) I would have considered spending my day there. The reason? They are holding an open to the public to an open house. This is gives interested visitors’ a chance to learn about the Gakona facility.

For nerdy Gakona residents this your chance to see the station for yourself. A chance I am betting doesn’t happen all that often.

“We hope that people will be able to see the actual science of it,” said Sue Mitchell, spokesperson for UAF’s Geophysical Institute, which operates the facility. “We hope to show people that it is not capable of mind control and not capable of weather control and all the other things it’s been accused of.”

And if you’re uncertain about attending, well let’s just say that the station isn’t capable of mind control else you wouldn’t have had a choice when it came to attending the open house.

25-Core Processor and it’s Open Source

Saturday, August 27th, 2016

Researchers at Princeton announced at Hot Chips this week their 25-core Piton Processor. The processor was designed specifically to increase data center efficiency with novel architecture features enabling over 8,000 of these processors to be connected together to build a system with over 200,000 cores. Fabricated on IBM’s 32nm process and with over 460 million transistors, Piton is one of the largest and most complex academic processors every built. The Princeton team has opened their design up and released all of the chip source code, tests, and infrastructure as open source in the OpenPiton project, enabling others to build scalable, manycore processors with potentially thousands of cores.

See it for yourself.