software-center keeps on crashing on fresh ubuntu install

I bought a new ssd and decided to do a fresh install of ubuntu raring (13.04) … After I was done setting everything up, I ran software-center and it crashed! So here’s a quick fix that worked for me, might not work for you but you never know…

Open up Terminal and enter this command:
software-center –force-rtl

This will force it to be right-to-left, then close software-center and re-open it without the –force-rtl and it should work.

Posted in ubuntu | Tagged , , | Leave a comment

Eclipse whole word search in Workspace

Although not very obvious, it is actually possible to perform a whole word search in your eclipse workspace.

To do so, click on “Search” (from the menu) and then “File” from the sub-menu.

Make sure to select “Regular expression” and then you can use any regex expression you can come up with, for the whole word it’s \byourword\b so for example to search for johny you will write \bjohny\b

There’s lots of info about regular expression on the internet , you can perform anything with these expressions and they can get pretty complicated!

Enjoy :)

Posted in eclipse, Programming, Project, Tutorials | 1 Comment

Toshiba laptop – System and BIOS does not boot

This is a problem that is happening with Toshiba laptop owners:

When I start up my laptop won’t boot to Windows.
When I tried to get to BIOS, won’t let me do this as well. I can see only the Toshiba logo. When I press F2 or F12 I got message:

Entering setup. Please Wait or
Entering MultiBoot Selection Menu. Please Wait

I tried ESC + Power Buton and after that F1 key. I can see all information:
Phoenix Bios 4.0 Release 6.1
Cpu=1 processor Detected, Cores per processor =2
Intel Core 2duo T5800 @ 2.00GHz
3070M System RAM Passed
2048 KB L2 Cache
System Bios Shadowed
Video Bios Shadowed
Fixed Disk 0 : Toshiba MK2552GSK
ATAPICD ;Rom DVDRom….
Mouse Initialized
Press F2 to enter Setup or Press F12 to Enter MultiBoot Selection Menu

but after that the laptop just freeze but processor is still running.

I removed the HDD and tried put different one (from working laptop) – still not working
I removed the memory and tried put different one (from working laptop) – still no working

I’ve got no idea what is it causing the trouble.
I’ve got this laptop about a 2 months.

Thanks.

This is due to the bios locking up, to fix this you have to unplug the cmos battery for around a minute, this will reset the bios and your laptop will come back to life!

The cmos battery looks something like the picture above and is usually around the ram or the wifi card, in order to access it you will have to take out a couple of screws but it’s not as hard as you think. Just google your laptop model and add “cmos” and you will find plenty of tutorials on how to get to it!

Posted in Help, microsoft, Repair, Tutorials | Tagged , , , | 8 Comments

Visual Studio 2010 C++ Service Template

So you install Visual Studio 2010, all excited, want to code your first C++ Service and notice that there is no more template for Windows Service under C++, then you check under C# and it exists there… so what the hell happened, I don’t know… This is what I was able to find…

Unfortunately, the C++/CLI Windows Service template was removed from Visual Studio 2010. If you would like to make-use of the .Net Framework support for Windows Services, the C# version of the wizard still exists. If you would like to develop a Native windows service, you can use the ATL Project wizard and select the ‘Service (EXE)’ application type.

Vinny Romano
Visual C++ Team

On a side note, what do you think of F#?

Posted in microsoft, Programming, Tutorials | Leave a comment

Asterisk Setup – 404 Not Found

If you’re getting a 404 Page Not Found error when you’re trying to access your Asterisk web gui on http://localhost:8088 (by default), it’s because you need to create a symbolic link to /usr/share/asterisk/static-http, do the following and all should be working fine:

rm -rf /usr/share/asterisk/static-http/
ln -s /var/lib/asterisk/static-http/ /usr/share/asterisk/
/etc/init.d/asterisk restart

Enjoy!

Posted in Apache, Hosting, linux, Programming, Tutorials | Leave a comment

Upload using C++ as Client and PHP as Server

Level: Beginner (coder)

This is a small tutorial which will teach you how to upload files using a C++ client application to a server running PHP.

I had previously posted a version for C# that can be found here: http://www.johny.org/2007/08/upload-using-c-as-client-and-php-as-server/

We’ll call the PHP script “upload.php”, this is what it should contain:

<?php
$uploaddir = 'upload/'; // Relative Upload Location of data file

if (is_uploaded_file($_FILES['file']['tmp_name'])) {
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo "File ". $_FILES['file']['name'] ." uploaded successfully. ";
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully moved. ";
}

else
print_r($_FILES);
}

else {
echo "Upload Failed!!!";
print_r($_FILES);
}
?>

and this is the C++ code:
static void UploadFileCallback(Object^ sender, UploadFileCompletedEventArgs^ e)
{
array^ response = e->Result;
Globals::uploadResult = System::Text::Encoding::UTF8->GetString(response);
Globals::isUploading = false;
Globals::isUploadComplete = true;
}
static void UploadProgressCallback(Object^ sender, UploadProgressChangedEventArgs^ e)
{
Globals::uploadPercent = (int)(100*e->BytesSent/e->TotalBytesToSend);
}

void UploadFileHTTPAsync(String^ fileName)
{
Net::WebClient^ client = gcnew Net::WebClient();
Uri^ uri = gcnew Uri("http://myserver.com/upload.php");
client->Headers->Add("Content-Type","binary/octet-stream");

client->UploadFileCompleted +=
gcnew UploadFileCompletedEventHandler (UploadFileCallback);

// Specify a progress notification handler.
client->UploadProgressChanged +=
gcnew UploadProgressChangedEventHandler( UploadProgressCallback );
client->UploadFileAsync( uri , "POST", fileName );
Globals::isUploading = true;
Globals::isUploadComplete = false;
}

In the C++ part, replace “your_server.com” with your server, also notice that this is a test code, im using the header “binary/octet-stream” as it works with all files (image, txt, etc)…

Hope this helps someone out there as I couldn’t find any tutorials about this specific matter on google! Let me know if you got any questions,

Happy Coding :)

Posted in Apache, C#, Client-Server, PHP, Programming, Tutorials | 4 Comments

Apache2 .htaccess RewriteEngine error

To enable .htaccess files on your server, edit “/etc/apache2/sites-available/default” file, change AllowOverride to All

NameVirtualHost *
<VirtualHost *>
        ServerAdmin admin@site.com

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

Then restart apache by doing “/etc/init.d/apache2 restart to restart apache”

Try to see if everything is working fine, if not, check your apache logs in /var/log/apache2, if you have the following error “/var/www/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration”

simply do “sudo a2enmod rewrite” and restart apache again and all should work fine!

Posted in Apache, Help, Hosting, linux, PHP, Programming, Tutorials, Web | Tagged | 6 Comments

Blog Comments and Spam – SEO

Merry Christmas everyone :)

Here’s the tip of the year for bloggers who want to get extra traffic to their blogs.

COMMENTS ARE ESSENTIAL!!!

Make sure you don’t block commenting on your blog, do the extra effort to keep the comments clean and purposeful. I have a page on one of my sites that has over 100 comments, they are the most random questions regarding my post (not spams) and therefore they are relevant keywords to the subject, words that I never used in my post but thanks to the comments, I get visitors from google that search something similar to the posted comments!

Therefore make sure you work on your comments! They are essential :)

Posted in Blogroll, SEO, Tutorials | Leave a comment

Windows Vista endless reboot after update FIX

Is your vista powered computer / laptop rebooting by itself constantly

on startup? Well mine was! This is what happens exactly,

  1. Power ON
  2. Starting Windows
  3. Windows updating… reaches 100%… reboots!
  4. Back to step 1!

So I googled for a fix and noticed that most people are recommending a full reinstall of Vista, well there’s actually a fix for it, the problem is a bad update that microsoft released therefore to fix this we have to tell windows not to run the update when windows starts. To stop windows from updating, we have to remove or rename the ”

c:\windows\winsxs\pending.xml” file, there are multiple ways you can do that, one way would be:

  • Insert DVD and begin the Vista setup.
  • Select language and currency format etc.. then click next.
  • Select repair my computer (or something like that) on the bottom left of the screen.
  • Select your Vista installation click next.
  • Click command prompt from the list of options.
  • Type ‘ren c:\windows\winsxs\pending.xml pending.bak’ press enter.
  • Type ‘ren c:\windows\winsxs\cleanup.xml cleanup.bak’ press enter.
  • Type ‘exit’ press enter.
  • Click restart.

Another way would be to remove the hard disk from the laptop and put it in an external usb drive and then simply go and rename the mentioned files above.

A third way, which is the way I fixed mine would be to download the latest release of Ubuntu, pop the cd in, boot into ubuntu, and rename those files.

Good luck!

Posted in Help, microsoft, Tutorials | Leave a comment

Some interesting web traffic

wordpress logoHello dear readers, fellow webmasters, fellow bloggers…

Something very interesting happened to this blog today, my visitors got ten times larger than yesterday! The only change that I did was to update from wordpress 2.x to 3.x, got rid of my custom theme (using the default wordpress theme) and magically today I got tons of new visitors from my best friend google :) I never imagined that an upgrade would rate me better on google, actually I don’t even know what happened but I’m not complaining!

There are tons of other reasons to update, one thing I found nice is that I can now blog from my iphone, that didn’t work for me when I had wordpress 2.x, another simple reason is that everything somehow works by itself, with wordpress 2.x I was never capable of displaying source code in a normal way, it was a real hassle! now all that is fixed, along with some other bugs… Point being, just update, it takes 10 minutes max, use the Import and Export utilities in the Tools section, thats what I did anyway.

I just thought I’ll share this little info with you guys and see if it’s just me or google likes 3.0 more somehow…

Now time to go update the websites that bring me some adsense revenue ;)

Posted in Analytics, SEO, Tutorials, update, Wordpress | Leave a comment