How to add unknown mime types to IIS

Sometimes you may need an extention without knowing the correct mime-type or just may not exist yet or may not be defined.

You can use the following

.yourExtension application/octet-stream

This basically tells to download the file without try to opening by any software.

Some people saying that this comply with RFC and some not.

The recommended action for an implementation that receives an
“application/octet-stream” entity is to simply offer to put the data
in a file, with any Content-Transfer-Encoding undone, or perhaps to
use it as input to a user-specified process.

It is expected that many other subtypes of “application” will be
defined in the future. MIME implementations must at a minimum treat
any unrecognized subtypes as being equivalent to “application/octet-

You decide.

I have also see people adding application/unknown for mime type but I would still recommend putting octet-stream as at least it is defined in the RFC otherwise you can also put applicatoion/I_dont_know and it would be the same as ‘unknown’ in my opinion.

Other resources:

MIME Types in IIS –

Many Thanks



Finding binary gap highest number in php

This is just for training purpose

// you can write to stdout for debugging purposes, e.g. // print “this is a debug message\n”; function solution($n){

if(is_int($n) AND $n < 2147483647){ // write your code in PHP7.0

$binaryString = decbin($n);

$gap = 0;

$max = 0;

$lenght = strlen($binaryString);

$bin = str_split($binaryString);

for($x=0; $x < $lenght; $x++){

// if 1 then reset gap as it starts again

if($bin[$x] == 1){

if($gap > $max){

$max = $gap;




$gap++; // increase the gap



return $max;


return 0;



How to setup sendmail to relay outgoing emails

If you don’t use postfix and just sendmail to sendmail may want to relay your emails to your relay server.

Navigate to /etc/mail/

then add define(`SMART_HOST’, `’)dnl

sudo service sendmail restart

You can then check your logs on /var/log/mail.err to see if it’s all working.

How to fix Iphone stuck in headphones mode – set of fixes.

have to say it’s amazing how many different fixes can fix this problem!!! Apple go back to work!

List of things that I have already tried:

  1. Replaced the headphone/charging port.
  2. Replaced ear speaker
  3. Reset the iPhone. Press and hold Sleep/Wake button and Home button together until Apple logo appears.
  4. Factory Full Reset and setup as new iphone
  5. Play a song (lengthy duration) and allow iPhone to completely lock.Now insert iPhone compatible headset jack.Unlock iPhone. Stop audio and unplug jack.
  6. Plug in headset when phone is locked.Hold down power button. It will bring “slide to power off” bar.Now remove the headphones.

    Press the “cancel” button at the bottom of the screen.

    Now check the sound.

  7. Signing up for Beta and Updating to the latest software.
  8. Turned off/flicked keyboard clicks in Sounds option.
  9. Checked for  LCI Liquid Contact Indicator ( All good)
  10. Cleanup headphone jack before replacing the board (there are little metal balls which can get stuck)
  11. Go to Sound and Try to play some ringtones (you can hear ringtones but it did not switched back)
  12. Turning on “Airplane” mode then adjusting the volume up and down.
  13. set an alarm, let that go off, and the headphone mode turned off!
  14. Play with the ringtones in the settings keep flipping the mute switch and volume keys. And rebooting the phone it worked for me
  15. plugged the apple headphones in and out it
  16. 5/10 minutes of hairdryer on the cold setting
  17. Restore Phone using DFU method and Itunes
  18. Clean logic board connector which connect headphones/thunderbird using 99 isoprop
  19. plugged in my headphones, opened my Control Center, and then pulled them out
  20. Try to use Isopropyl alhocal to clean the speaker/microphone Thunderbird connector.


Installing Mediawiki with Vision Editor, parsoid active directory as private wiki notes/fixes

My Notes:

Setup: Mediawiki 1.27

AD: Windows 2012

Web Server: Linux Debian

Installing missing libraries first:

  • php5-curl
  • stunnel4
  • curl


  • Make sure that the correct spacing is set in parsoid.conf

  • Make sure that it has started by checking the /var/log/parsoid.log

  • Mare sure that you enables stunnel after in etc/default/stunnel4

Change to one to enable stunnel automatic startup

Add to Wiki config: LocalSettings.php

\\ Make Wiki Private

$wgGroupPermissions[‘*’][‘read’] = false;
$wgGroupPermissions[‘*’][‘edit’] = false;

\\Enable API for VisionEditor //Parsoid


\\ Configure LDAP

require_once( “$IP/extensions/LdapAuthentication/LdapAuthentication.php” );
$wgAuth = new LdapAuthenticationPlugin();
$wgDebugLogGroups[‘ldap’] = ‘/tmp/mediawikiADDebug.log’;
$wgShowExceptionDetails = true; //for debugging MediaWiki

\\LDAP AD config

$wgLDAPDomainNames = array(

$wgLDAPServerNames = array(
 ‘’ => ‘’,

$wgLDAPEncryptionType = array(
 ‘’ => ‘tls’,

$wgLDAPSearchStrings = array(
 ‘’ => “domain\\USER-NAME”,

//Enable Visual Editor

wfLoadExtension( ‘VisualEditor’ );
// Enable by default for everybody

$wgDefaultUserOptions[‘visualeditor-enable’] = 1;
$wgVirtualRestConfig[‘modules’][‘parsoid’] = array(
// Use port 8142 if you use the Debian package or 8143 if running parsoid under https
 ‘url’ => ‘;, // or use 8142 if you don’t use stunnel4
 ‘domain’ => ‘’,

Linking with Parsoid in private wikis

Forwarding Cookies to Parsoid
// This feature requires a non-locking session store. The default session store will not work and
// will cause deadlocks (connection timeouts from Parsoid) when trying to use this feature.
$wgSessionsInObjectCache = true;

// Forward users' Cookie: headers to Parsoid. Required for private wikis (login required to read).
// If the wiki is not private (i.e. $wgGroupPermissions['*']['read'] is true) this configuration
// variable will be ignored.
// WARNING: ONLY enable this on private wikis and ONLY IF you understand the SECURITY IMPLICATIONS
// of sending Cookie headers to Parsoid over HTTP. For security reasons, it is strongly recommended
// that $wgVirtualRestConfig['modules']['parsoid']['url'] be pointed to localhost if this setting is enabled.
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

Parsoid over HTTPS

By default, Parsoid only supports HTTP connections. However, it’s easy to provide HTTPS Parsoid by using Stunnel, a utility which offers SSL wrapping for arbitrary sockets. Most Unix distributions have ‘stunnel’ or ‘stunnel4’ package available from the repository. The following config file shard (e.g. /etc/stunnel/parsoid.conf) should do the trick:

cert = /etc/ssl/my_certs/parsoid.crt
key = /etc/ssl/my_keys/mykey.key
CAfile = /etc/ssl/my_ca/ca.crt

accept  = 8143
connect = 8142