Friday, August 18, 2023

Install Visual Studio Code on Arch Linux

 To install visual studio code on arch linux, go to below link.

https://aur.archlinux.org/packages/visual-studio-code-bin

Clone the mentioned Git Clone URL and download on your system. Once download complete, go to folder and run following command.

makepkg -si




Thursday, November 24, 2022

Openvpn Decoding PKCS12 Failed

Recently I got following error on arch linux while trying to connect openvpn.

Decoding PKCS12 failed. Probably wrong password or unsupported/legacy encryption

The solution is to re-encrypt the key file to non legacy algorithm. e.g.

openssl pkcs12 -in old_key.p12 -out new_key.p12 -aes256 -legacy

Tuesday, January 31, 2017

Compiz bug - ubuntu

There is a bug in compiz that causes crash if you click the application that has multiple windows open. The error message normally is:

“Sorry Ubuntu * has experienced an internal error” /usr/bin/compiz

It's fix is simple. Install compize configuration settings and than follow these steps.

1. open ccsm (from terminal)
2. Go to Preferences
3. Go to Plugin list
4. Disable "Automatic Plugin Sorting"
5. Select scale in the right list
6. Click on "<" button
7. Enable"Automatic Pluging Sorting"
8. Reopen ccsm and enable scale
9. Make sure that scale is not the last in the list
[Source] https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1497163


Monday, January 18, 2016

How to view executed queries in laravel 5

Sometimes we need to view the the queries generated by eloquent either for debugging purpose or to be sure that query generated is correct. To view queries in laravel 5, we have multiple ways.


First enable the query log as it is disabled by default.

DB::enableQueryLog();

Than at the end of your controller action method, you can use

use Illuminate\Support\Facades\DB; //Reference
//
//Execute queries.
//
print_r(DB::getQueryLog());

and the follow up code.

DB::enableQueryLog();
$users = DB::table('users')->get();
$query = DB::getQueryLog();
print_r($query);
  

Beside this, we can use toSql method and also use listen method. If you want to view all queries in a request, than use a listen method. Add following code in service provider boot method.


DB::listen(function($query) {
// $query->sql
// $query->bindings
// $query->time
// 
echo ($query->sql);
});

Wednesday, February 26, 2014

How to install urdu fonts in ubuntu 12.04

Installing Urdu fonts in Linux is simple,  first you need to download urdu fonts and than install it.

Download:

Download urdu fonts


Install:

Jump to your home directory, there is a hidden folder named .fonts.

Extract font files in .fonts directory.

Go to terminal and execute the following command.

sudo fc-cache -vf

Restart the browser, and browse website. If it did not work, please read the following wiki. It describes fonts in general.

https://wiki.ubuntu.com/Fonts







Thursday, January 7, 2010

Using Amazon S3 SDK Pre-signedURL function

Today i was just exploring the amazon sdk. While using the presignedurl function of amazon sdk(C#), i was just curious that what is the server response time , zone. The amazon s3 returns the time in UTC. so simple but i was just curious that if we input time in GMT and it automatically convert it according to requestee IP time zone. i have tried to confirm but first i checked with UTC and it works 100% correctly. The second try i did is that i sent a GMT time and it works too. The amazon convert GMT to UTC according to client location. The sample code look like:


public string GetPreSignedURL(string bucketName, string key)
{
string url = string.Empty;
try
{
AmazonS3 client = Amazon.AWSClientFactory.CreateAmazonS3Client("ur access key", "secret key");

GetPreSignedUrlRequest request = new GetPreSignedUrlRequest().WithProtocol(Protocol.HTTPS).WithBucketName(bucketName).WithKey(key).WithExpires(DateTime.UtcNow.AddMinutes(1));
url = client.GetPreSignedURL(request);
}
catch { }
return url;
}

Tuesday, September 29, 2009

Increase IIS 5 connection limit on windows

On a non server edition of window operating system, we often got the error.
There are too many people accessing the Web site at this time.
OR
HTTP 403.9 - Access Forbidden: Too many users are connected
Internet Information Services


To increase the connection limit, go to :
1 - Go to directory c:\inetpub\AdminScripts
2 - Execute the following command.
adsutil set w3svc/MaxConnections 40