Skip to content

Redirect the HTTP Requests to HTTPS in Apache Webserver

02-Mar-16

The best way to do a redirect from HTTP to HTTPS site is to use the Redirect directive in the Apache virtual host configuration. If you have a site configured at https://sample.com and if you want to redirect the http://sample.com requests to the https site it can be achieved as follows:

References:

[1] https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
[2] https://wiki.apache.org/httpd/RedirectSSL

Sound card issue on Fedora 23 with Intel HDA

02-Mar-16

I recently installed Fedora 23 in my Desktop and everything was working great except the sound.

I did the ldconfig and it didn’t solve it.

Hardware detail fetched by

$ alsa-info.sh --no-upload

[Extracted]
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 04)

$ lspci -nn | grep -i audio

00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 04)

And then used the speaker-test utility to test the speakers

$ speaker-test

speaker-test 1.0.29

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
/usr/bin/pulseaudio: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Playback open error: -111,Connection refused

So I installed the libgomp library with dnf and sound started working

$ sudo dnf install libgomp

Previously I tried uninstalling the alsa-plugins-pulseaudio as described in the reference below and it removed the proprietary media plugins, skype etc all that was installed. So it’s better to avoid following as described in reference[1]

Reference:
[1] https://fedoraproject.org/wiki/How_to_debug_sound_problems

RESTful vs SOAP Web Service

06-Jan-14

Many people encounter this as a popular interview question. I’ve written the following piece for anyone looking for a little summary.

REST = REpresentational State Transfer

  • An architectural pattern
  • Most common security mechanism is Transport level security (TLS) and http basic/digest authentication
  • Stateless
  • Permits different data formats (JSON, XML)
  • Reads can be cached (HTTP GET)
  • Lower bandwidth usage (JSON)
  • Provides Transcations but not ACID compliant
  • API is defined using a wiki most of the time
  • Exposes resources

 

SOAP = Simple Object Access Protocol

  • A protocol
  • WS-Security WS-AtomicTransaction WS-ReliableMessaging
  • Easy to implement message level security/encryption
  • Ensures message delivery
  • Permits only XML
  • SOAP based reads can’t be cached (All POST requests)
  • Rest doesn’t have a standard messaging system and expects clients to deal with communication failures by retrying. SOAP has successful/retry logic built in and provides end-to-end reliability even through SOAP intermediaries.
  • Provides ACID compliant Transactions
  • API is self-explanatory
  • Exposes methods

 

Interesting Reads:

REST Vs SOAP, The Difference Between Soap And Rest

Enable Permalinks for WordPress in Apache web server

07-Nov-13

Permalinks are `permanent links` that would point to blog posts, categories and tags etc. The permalink mechanism WordPress enabled by default
is not very SEO friendly – it just give an indentifier to each post and refer to them with single parameter.

Default permalink setting:
http://example.com/?p=1

When the search engines crawl the website it gives considerable score for the keywords in the permalink that relates to the page content. Therefore it is advantageous to change the default permalink setting so that you can include meaningful keywords in the permalink structure.

Preferable setting:
http://example.com/sample-post/

However if you’re deploying wordpress on your VPS and using Apache as webserver you’ll have to do some extra configuration to get the permalinks working. Otherwise when you’re accessing each post it would throw 404 errors.

First enable the Apache rewrite module

sudo a2enmod rewrite

Then go ahead and edit the apache configuration file located in /etc/apache2/apache2.conf

Here you’ll have to change the instances of 'AllowOverride None' to 'AllowOverride All'

Changed configuration file entries should look like this:

<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>


<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

after making all these changes restart Apache and you’re good to go.

Ramanan Sharma

MacBook Battery Maintenance

17-Aug-13

I was looking for some advice on getting the most out of my MacBook’s battery. Here is the summary of what I compiled and the corresponding references.

Lithium-based batteries function best when used fairly frequently but lightly.

 

For proper maintenance of a lithium-based battery, it’s important to keep the electrons in it moving occasionally. Apple does not recommend leaving your portable plugged in all the time. An ideal use would be a commuter who uses her notebook on the train, then plugs it in at the office to charge. This keeps the battery juices flowing.

 

Ideally we shouldn’t heavily use the MacBook on battery power, instead we should have a balance – and maintain at least 1-2 charge cycles per week (minimum one charge cycle per month)

 

Long-Term Storage
If you don’t plan on using your notebook for more than six months, Apple recommends that you store the battery with a 50% charge. If you store a battery when it’s fully discharged, it could fall into a deep discharge state, which renders it incapable of holding any charge. Conversely, if you store it fully charged for an extended period of time, the battery may experience some loss of battery capacity, meaning it will have a shorter life.

Apple Notebooks

Additional useful information can be found in the following links:

Mac notebooks: Tips for maximizing your battery charge

Apple notebook batteries – maintenance and troubleshooting

 

Ramanan Sharma