Member of the EVE Tweet Fleet
Mar 01

How-To: Fix a Dead Razer Product

By Xeross How-To's No Comments

So tonight was a bit hectic, I was trying to figure out how to prevent the side buttons of the mouse performing the previous/next button actions in my browser. The first thought was to update my drivers/firmware but the firmware update failed and my Razer DeathAdder died.

After searching a lot on google (I enabled keyboard mouse controls) I found out you are able to restore the functioning of the product through the following steps.

  1. Unplug the Razer product
  2. Shutdown your PC
  3. Plug the product into another USB port
  4. Reboot your PC
  5. Drivers should be automatically reinstalled again
  6. If not manually install them, they can be found in the folder the drivers software is installed in
  7. Perform the firmware update again if you want

~Xeross

Tagged with: deathadderfixrazer
Oct 12

GIT: Change revision author’s email/name

By Xeross How-To's, Revision Control (GIT/SVN) Comments (7)

So recently I dived a little deeper into GIT, the best version control system in my opinion. however after making a few commits to a repository I created (For some modification to a program’s source code) I noticed it didn’t have my name on it as the author, and after 1 failed attempt of setting the name/email the their values of commits after that were even worse.

So I needed a way to change the author’s name and email on the commits, after searching a little using google I encountered this page on GitHub, however I’ve decided to write a tutorial on it anyways, we’ll use the code from GitHub though.

Ok to do this we are going to use a bash script (which is basically a  list of commands to execute) they’re work on linux and also on windows if you have msysgit. here’s the code.

git filter-branch --env-filter '

an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"

if [ "$GIT_COMMITTER_EMAIL" = "EMAIL_OF_COMMITER_HERE" ]
then
    cn="NEW_NAME_COMMITER"
    cm="NEW_EMAIL_COMMITER"
fi
if [ "$GIT_AUTHOR_EMAIL" = "EMAIL_OF_AUTHOR_HERE" ]
then
    an="NEW_NAME_AUTHOR"
    am="NEW_EMAIL_AUTHOR"
fi

export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'

As you can see this code uses the git filter-branch command, and everything on line 2-22 is basically the filter code. Now to replace a certain commiter or author just replace EMAIL_OF_AUTHOR/COMMITER_HERE with the email of that committer/author, and replace NEW_NAME_COMMITER/AUTHOR and NEW_EMAIL_COMMITER/AUTHOR with the new email and name you want him/her to have. You can replace multiple commiters/authors by copy-pasting the if blocks (See below for that part)

if [ "$GIT_COMMITTER_EMAIL" = "EMAIL_OF_COMMITER_HERE" ]
then
    cn="NEW_NAME_COMMITER"
    cm="NEW_EMAIL_COMMITER"
fi
if [ "$GIT_AUTHOR_EMAIL" = "EMAIL_OF_AUTHOR_HERE" ]
then
    an="NEW_NAME_AUTHOR"
    am="NEW_EMAIL_AUTHOR"
fi

You can duplicate these for as many authors/commiters you want to replace. now after you finished this document save it somewhere you can access it easily (From the command line/console), and after that go inside your git repository’s folder (Ofcourse also on the command line aka console), when in there type the following.

sh /path/to/previous/saved/script.ext

When you’ve done that a progress counter will start to run, this is the git filter-branch scanning through all your commits. After this process finishes your repo will be updated with the new name/email (use “git log” to check), now to push it to a remote repository push like normal but instead of “git push” use “git push -f”, after this is done your remote repo is also updated.

Well that’s it, hope it was useful and if you have any questions or remarks don’t hesitate to post a comment ;)

Regards, Xeross

Tagged with: authorchangeemailgitnamerevision
Aug 30

Decreasing bandwidth usage of my blog

By Xeross How-To's No Comments

So I recently installed a syntax highlighter and by coincidence the author of that plugin also had a post about decreasing wordpress bandwidth usage. So I’ve read it and I thought let’s check how big the frontpage of my blog is when downloaded by a new visitor (The FireFox extension FireBug works great for this). A whopping 1.05MB! as my website is hosted on my server at home and my upload speed is at max 150KB total that would mean to load the pages take about 7 seconds to load.

So I went back to this persons blog post (You can find it here btw) and started reading through it again. First I tried wp-minify but as he stated this doesn’t work properly in Internet Explorer and your images wont load if your css contains relative urls, so this wasn’t going to work.

He also mentioned that his syntax highlighting plugin uses a lot of bandwidth to load all languages it supports so I made it only load the languages it needed. Dunno how did affect the bandwidth usage but it decreased page load times.

After that there was 1 last thing I had to test, enabling GZip compressed output. So after a little searching I found a WordPress plugin to enable it. I tested it, No changes at all. So I checked my apache installation and noticed mod_deflate wasn’t enabled (This is needed to enable the compression). So after enabling this I checked the size again, but it only decreased by 0.03 MB (That’s about 30kb).

So leaving that enabled I decided to check if the compression was indeed enabled(I used this page to test it). Firstly I checked the frontpage, It said compression enabled, and compressed to 23% of the original size, But this wouldn’t explain why the size still was 1.02MB. So I decided to check an image on my blog to see if that was being compressed, filled in the url hit check, and the results, not compressed. This meant that the compression was only enabled on WordPress pages.

So I decided to search on google how I could enable GZip compression for all files through a .htaccess file and found this. Though this person said don’t enable it on images and also not on flash as that might make flash stop working I ignored it and tried anyway by just adding the following code to my .htaccess file.

SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4\.0[678] no-gzip\
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

After adding this I hit ctrl+f5 in my firefox (Clears cache before loading page) and checked the size again, now it was down to 163KB! that means it would load in around a second instead of 7 seconds. I’m now trying to find out how to fix WP-Minify because that would bring it down even more, and I might also try to decrease the size of the images used in the sites layout/design. I’ll report how that went after I’ve done it.

Hope this was helpful, If you have any questions or feedback don’t hesitate to comment.

Regards, Xeross

Tagged with: bandwidthblogconsumptiondecreasehowtousagewebsite
Aug 30

Passing additional arguments to a callback function in Javascript

By Xeross Developing, How-To's Comments (1)

jQuery PNG LogoI was working on my CMS (Just took a brake to write this), and I tried to figure out how to pass additional arguments to a javascript callback. After some searching I found what I was looking for, I told the people in the jQuery IRC channel and someone gave me shorter and cleaner code that does the same. So let me run you through the code (Note: This is jquery but the same method would also work with normal Javascript) .

In this example I will use an argument that defines where to load the data got from an AJAX request in.

//Custom function that's used instead of the long jQuery Syntax
function loadUrl(url, destination)
{
    // Use a get request to get the page at URL
    $.get(url, function(html, status) { loadedPage(html, status, destination) });
}

// The callback function
function loadedPage(html, status, destination)
{
    // If the AJAX call failed stop the function
    if(status != "success")
        return;

    // Set the html of destination (Which is in this case a jQuery Selector) to the jquery repsonse
    $(destination).html(html);
}

If you haven’t figured out how to pass the additional arguments from the above example I’ll explain in detail, Let’s take a closer look at line 5(Formatted for readability).

$.get(url,
    function(html, status)
    {
        loadedPage(html, status, destination)
    }
);

As you can see we are using a custom defined function for the callback, What we do is make a function that has the arguments that get passed to the callback.

function(html, status)
{

}

And in that function we call our real callback function but with the additional arguments we passed to loadUrl()

function(html, status)
{
    loadedPage(html, status, destination)
}

And that’s it, this can be done with as many additional parameters as you like just add them to the call of the real callback function.

Leave a comment if you have any questions or feedback.

Regards, Xeross

Tagged with: addadditionalargumentsextrahowtoJavascriptjqueryparameters
Aug 15

How-to Solve Lag/High Latency on Vista in 4 Easy Steps

By Xeross Gaming, How-To's Comments (2)

My pc has been running at low latency for a while without a problem until suddenly it lagged the hell out of everything, when this started i had a latency/ping of around 300-400ms  on average, sometimes even 1000ms. Now I’m back down to 30-60ms and lowest I had was like 13ms. Here’s what I did.

Step 1.

Ok first thing I did was (This can be skipped btw) is I installed cFosSpeed (Click here for the Trial), This prioritizes gaming, normal browsing etc. and gives downloading etc. a lower priority. After installation it asks to reboot, Let it reboot.

Now the fastest way to get it to work optimally is to upload a big file somewhere or something similiar (Send yourself a big file through email.)  more info about that here. If you don’t do this it might take a few days before it’s calibrated. Once again this is optional, And I’m not going into detail how to work with this.

Step 2

Ok now we need to do some registry tweaking, and some command line stuff. However we don’t need to do it ourselves. There’s a website called speedguide.net that has a script called SG Vista TCP/IP Patch. If you don’t trust it you can find the manual instructions here (And a guide to how the registry works here) and if you do trust it the script is here (Right click->Save As) after downloading open/run the script and once it opens you have 4 choices:

  • “Y” To optimize Vista TCP/IP settings
  • “Q” To disable QoS reserved bandwidth
  • “D” To revert to Vista default values
  • “N” To cancel patch and exit

Now just hit Y and it will optimize the settings. Now after this run it again but this time press Q, After this is done again reboot.

Now if the problem got worse just run the thing again but press D, and if your lag isn’t high anymore or lower then it was, good, that was our goal.

Step 3

Now we need to uncheck some stuff on the network connection, It’s simple to do but it does have some impact (Well it did for me).

Ok let’s start first thing to do is launch the control panel, Open the start menu and click Control panel on the right. Now the control panel will appear. Now if your control panel is set at classic open Network and Sharing center. If it’s set at normal view click Network and Internet and then open Network and Sharing center. Now in the left bar click “Manage network connections”. Now a window will open with 1 or more network adapters (Icons) there should be one that sais Wireless Network Connection or something similiar, and it should have the name of your wireless network below the that.

Now right-click it and click properties. Now a new window comes up with in the middle a box with checkboxes on the left and some text next to them. What you now need to do is uncheck “QoS Packet Scheduler” and also uncheck “Internet Protocol Version 6 (TCP/IPv6)”, You can uncheck them by clicking on the checkboxes. See image below (It’s in dutch but well the names are pretty much the same):

Now after that just click OK and wait for the window to disappear.

Step 4

Now, First test out if the lag is gone, If so, Good we solved it, If you have lagspikes every 30-60 seconds and you have a wireless connection continue reading. And if you still have normal lag try asking at one of the windows help forums.

Now the reason this lag occurs is because windows vista scans for wireless networks every 60 seconds. We are going to use Vista Anti-Lag. You can download the setup here and the rarred version without installer here.

Now install or extract the program and launch it(If you’ve downloaded the rarred version open val.exe). A window similiar to the following will pop-up:

Now just hit the Activate VAL button and it will disable the automatic scan for as long as it’s running. Now for me this step wasn’t needed so I didn’t do it, But it might do the trick for you. Now go test if this fixed it if it did, Make sure you start Vista Anti-Lag every time you start your computer (Or when you play a game whatever you like), And the lag should be gone.

Now if you have any questions, comments don’t hesitate to leave a comment and I’ll reply as soon as possible.

Regards, Xeross

Tagged with: fixGaminghighHow-To'sinternetlaglatencypingslowsolutionvalvista
Jul 14

How-To: phpED upload file to server on save

By Xeross How-To's Comments (3)

I just started using NuSphere phpED because it’s better suited for working with PHP then Dreamweaver. But one problem I had was that I couldn’t find an option that would make it upload a file to the server (Through FTP/etc.) whenever I saved it.

So I asked around a little and it seems there’s a keyboard shortcut that does this (Shift+Ctrl+S), But I can imagine you want this behaviour to be default on Ctrl+S (Well I do.).

First go to Tools -> Settings

HowTo: phpED upload file to server on save – Step 1

Then in the options menu go to IDE -> IDE Shortcuts

HowTo: phpED upload file to server on save - Step 2

Then scroll down till you find Upload File(s)

HowTo: phpED upload file to server on save - Step 3

Then change the shortcut to Ctrl+S

HowTo: phpED upload file to server on save - Step 4

It will ask to cancel because there’s already a shortcut assigned to it, Just click no.

HowTo: phpED upload file to server on save – Step 5

Now do the same for the shortcut File -> Save and assign it to Ctrl+Shift+S

Regards, Xeross

Tagged with: DevelopingHow-To'sNuSpherephpED

WP SlimStat