Fourth Dimension Kreative http://4dk.me a creative web & print fun factory Sat, 19 Oct 2013 22:34:23 +0000 en-US hourly 1 Get current user name in a bash script http://4dk.me/2013/10/get-current-user-name-in-a-bash-script/ http://4dk.me/2013/10/get-current-user-name-in-a-bash-script/#comments Sat, 19 Oct 2013 22:34:23 +0000 http://4dk.me/?p=180 Using /usr/bin/whoami command #!/bin/bash echo "$(whoami)" Using /usr/bin/id command #!/bin/bash echo "$(id -u -n)" Using USER environment variable #!/bin/bash echo "$USER"

The post Get current user name in a bash script appeared first on Fourth Dimension Kreative.

]]>
Using /usr/bin/whoami command
#!/bin/bash
echo "$(whoami)"

Using /usr/bin/id command

#!/bin/bash
echo "$(id -u -n)"

Using USER environment variable

#!/bin/bash
echo "$USER"

The post Get current user name in a bash script appeared first on Fourth Dimension Kreative.

]]>
http://4dk.me/2013/10/get-current-user-name-in-a-bash-script/feed/ 0
Image to Data URI with PHP http://4dk.me/2013/04/image-to-data-uri-with-php/ http://4dk.me/2013/04/image-to-data-uri-with-php/#comments Wed, 17 Apr 2013 00:00:36 +0000 http://4dk.me/?p=142 I often find myself converting images to data URIs in an attempt to reduce network requests. This script is based on the same concept as David Walsh’s article Image Data URIs with PHP but rather than using the depreciated mime_content_type, my script makes use of FileInfo, which “provides the same functionality in a cleaner way” […]

The post Image to Data URI with PHP appeared first on Fourth Dimension Kreative.

]]>
I often find myself converting images to data URIs in an attempt to reduce network requests. This script is based on the same concept as David Walsh’s article Image Data URIs with PHP but rather than using the depreciated mime_content_type, my script makes use of FileInfo, which “provides the same functionality in a cleaner way” as quoted from the PHP docs.

echo '<img src="'.getDataURI('path_to/your_image.png').'">';
function getDataURI($image,$mime='') {
	$finfo = new finfo(FILEINFO_MIME_TYPE);
	$mime = $finfo->buffer(file_get_contents($image));
	return 'data:'.$mime.';base64,'.base64_encode(file_get_contents($image));
}

Please keep in mind if you plan on using data URIs, they are not supported by ie7 and lower.

The post Image to Data URI with PHP appeared first on Fourth Dimension Kreative.

]]>
http://4dk.me/2013/04/image-to-data-uri-with-php/feed/ 0
Enable WordPress Featured Image http://4dk.me/2012/12/enable-wordpress-featured-image/ http://4dk.me/2012/12/enable-wordpress-featured-image/#comments Fri, 28 Dec 2012 22:46:27 +0000 http://4dk.me/?p=74 If your wondering how to enable WordPress featured images, your in the right place. First paste the following code in your functions.php file. add_theme_support('post-thumbnails'); Now in your theme where you’d like the featured image to appear paste the following code. <?php if (has_post_thumbnail()) : ?> <figure class="post-image"> <?php the_post_thumbnail();?> </figure> <?php endif; ?>

The post Enable WordPress Featured Image appeared first on Fourth Dimension Kreative.

]]>
If your wondering how to enable WordPress featured images, your in the right place. First paste the following code in your functions.php file.

add_theme_support('post-thumbnails');

Now in your theme where you’d like the featured image to appear paste the following code.

<?php if (has_post_thumbnail()) : ?>
   <figure class="post-image">
      <?php the_post_thumbnail();?>
   </figure>
<?php endif; ?>

The post Enable WordPress Featured Image appeared first on Fourth Dimension Kreative.

]]>
http://4dk.me/2012/12/enable-wordpress-featured-image/feed/ 0
Steam for Linux – Killing Floor & Red Orchestra – Nvidia Dual Monitor Problem http://4dk.me/2012/12/steam-for-linux-killing-floor-red-orchestra-nvidia-dual-monitor-problem/ http://4dk.me/2012/12/steam-for-linux-killing-floor-red-orchestra-nvidia-dual-monitor-problem/#comments Wed, 19 Dec 2012 00:22:59 +0000 http://4dk.me/?p=63 I ran into some problems running Killing Floor and Red Orchestra on my Nvidia dual monitor setup. The games would run at 800×600 on my secondary monitor, not exactly ideal. Luckily this was an easy fix that will hopefully help out someone that runs into the same problem. First off you’ll need to edit your […]

The post Steam for Linux – Killing Floor & Red Orchestra – Nvidia Dual Monitor Problem appeared first on Fourth Dimension Kreative.

]]>
I ran into some problems running Killing Floor and Red Orchestra on my Nvidia dual monitor setup. The games would run at 800×600 on my secondary monitor, not exactly ideal. Luckily this was an easy fix that will hopefully help out someone that runs into the same problem.

First off you’ll need to edit your xorg config file.

sudo gedit /etc/x11/xorg.conf

I have a primary monitor on the right running @ 1920×1080 and a secondary monitor on the left running at 1680×1050. Here’s what mine looked like.

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "DFP: nvidia-auto-select +1680+0, CRT: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

What I did was add “DFP: 1920×1080 +0+0″ to the metamodes option as seen below. Whats going on here is I’m setting a metamode so that full screen games at a resolution of 1920×1080 will run on my primary (DFP) monitor.

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "DFP: nvidia-auto-select +1680+0, CRT: nvidia-auto-select +0+0; DFP: 1920x1080 +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Once you have that saved, there’s have 1 more step to go. You’ll need to edit your games ini file.

Killing Floor

sudo gedit /home/matt/.killingfloor/System/KillingFloor.ini

Red Orchestra

sudo gedit /home/matt/.redorchestra/System/RedOrchestra.ini

*substitute matt for your username

Scroll down untill you find a section that looks like this and change the resolutions to match what you set in your xorg file.

[SDLDrv.SDLClient]
WindowedViewportX=1920
WindowedViewportY=1080
FullscreenViewportX=1920
FullscreenViewportY=1080
MenuViewportX=1920
MenuViewportY=1080

That’s it. Now reboot and give it a try!

The post Steam for Linux – Killing Floor & Red Orchestra – Nvidia Dual Monitor Problem appeared first on Fourth Dimension Kreative.

]]>
http://4dk.me/2012/12/steam-for-linux-killing-floor-red-orchestra-nvidia-dual-monitor-problem/feed/ 3
Different Types of Clients http://4dk.me/2012/12/different-types-of-clients/ http://4dk.me/2012/12/different-types-of-clients/#comments Thu, 13 Dec 2012 02:00:17 +0000 http://4dk.me/?p=39 One of my favorite websites that I find myself on daily is freelanceswitch.com. I was “Googling” tips and tricks on dealing with certain types of clients when I came across an article that talked about the different breeds of clients. The author went on to talk about how there are 12 different types of clients. […]

The post Different Types of Clients appeared first on Fourth Dimension Kreative.

]]>
One of my favorite websites that I find myself on daily is freelanceswitch.com. I was “Googling” tips and tricks on dealing with certain types of clients when I came across an article that talked about the different breeds of clients. The author went on to talk about how there are 12 different types of clients.

  1. The low-tech client
  2. The disinterested client
  3. The hands on client
  4. The paranoid client
  5. The appreciative client
  6. The get-a-good-deal client
  7. The I’ll-know-it-when-I-See-It client
  8. The always urgent client
  9. The decision by committee client
  10. The dormant client
  11. The budget client
  12. The you-should-be-so-lucky client

This article made me laugh because of how true it actually is, if you’re interested in reading the full article you can head over to freelanceswitch.com, let me know your thoughts!

The post Different Types of Clients appeared first on Fourth Dimension Kreative.

]]>
http://4dk.me/2012/12/different-types-of-clients/feed/ 0