Posts by admin

.PFX certificate installation on Apache

- by admin

I have got a PFX made with Windows Certificate Services to be installed on Apache. So, using OpenSSL the file (source.pfx) has been converted to Apache compatible format:
openssl pkcs12 -in source.pfx -clcerts -nokeys -out dest.cer

openssl pkcs12 -in source.pfx -nocerts -nodes -out dest.key

The first command extracts public key to dest.cer, the second one extracts private key to dest.key.

The last but not the least is to update Apache configuration file:
<VirtualHost 192.168.0.1:443> 
...
SSLEngine on
SSLCertificateFile /path/to/dest.cer
SSLCertificateKeyFile /path/to/dest.key
...

and to restart Apache :-)

Apache Solr non-ASCII characters

- by admin

This day I had a problem while indexing French and Russian content with Apache Solr: French and Russian characters where corrupted.

The solution was very simple: I added
URIEncoding="UTF-8"

attribute to the Connector tag which runs Solr in Tomcat's server.xml. Something like
<Connector port="8080" protocol="HTTP/1.1" 
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />

Then Tomcat has to be restarted :-)

Samba start / restart error: smbd_open_once_socket: open_socket_in: Addr

- by admin

Once I have got this problem with samba in Oracle Linux 6 (the same I could reproduce in RedHat 6 as well):

On start or restart of smb service var/log/samba/log.smbd reports:
smbd/server.c:501(smbd_open_one_socket) smbd_open_once_socket: open_socket_in: Address already in use

The solution was:
sysctl net.ipv6.bindv6only=1

as it looks like the problem happens on systems which IPv6 support where :: also listens for IPv4 connections. So the bind to 0.0.0.0 fails.

Your branch is ahead of 'origin/master' by 3 commits or dangling commits

- by admin

Once upon a time, namely today, I run
# git status

and to my big surprise I have got:
# On branch master
# Your branch is ahead of 'origin/master' by 3 commits.
#
nothing to commit (working directory clean)

Actually I have not done any commits in this local master branch - only pulls from remote. So, next I did
git fsck --no-reflogs

which helped me to get so called ‘dangling commits’ - commits that are under no particular branch:
git fsck --no-reflogs
dangling commit be6b64ba93d9e292b2aeec0a9d3c5209ee83c96f
dangling commit 3229271230d1315924ddd99c5962247d3c3f103b
dangling commit 95c0a7b1611ad0c4c101ff1fa1504d622fa1d2c3

What is exactly in the dangling commit? To get it I run:
git show be6b64ba93d9e292b2aeec0a9d3c5209ee83c96f

Next question: how to delete these dangling commits?

The answer is: wait :-)

Once your reflog entries are expired, those objects will then also be cleaned up by
git gc

Expiry settings are in gc.pruneexpire, gc.reflogexpire and gc.reflogexpireunreachable.

Print-screen (screenshots) in Mac OS X

- by admin

Keyboard shortcuts



  • Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop

  • Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop

  • Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop

  • Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard

  • Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard

  • Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard


In Leopard and later, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):

  • Space, to lock the size of the selected region and instead move it when the mouse moves

  • Shift, to resize only one edge of the selected region

  • Option, to resize the selected region with its center as the anchor point


Formats


Different versions of Mac OS X have different formats for screenshots.

  • Mac OS X 10.2 (Jaguar): jpg

  • Mac OS X 10.3 (Panther): pdf

  • Mac OS X 10.4 (Tiger) and later: png


In Mac OS X 10.4 and later, the default screenshot format can be changed, by opening Terminal (located at /Applications/Utilities/Terminal) and typing in:
defaults write com.apple.screencapture type image_format
killall SystemUIServer

Where image_format is one of jpg, tiff, pdf, png, bmp or pict (among others). If you omit the second line, you will need to log out and in again for the change to take effect.

Grab and Preview


Instead of using the keyboard shortcuts above, screenshots can be taken by using the Grab application included with Mac OS X. It is located at /Applications/Utilities/Grab.

In Mac OS X 10.4, the Preview application can also be used to take screenshots, by using the Grab submenu in the File menu.

From the Terminal


The screencapture command in the Terminal can also be used to capture screenshots, and is useful for scripts. Here is an example.
screencapture -iW ~/Desktop/screen.jpg

How to Disable iOS 6 Users Tracking

- by admin

Here is an article I just read, o-la-la - what a scandal...

The most funny thing it how a simple setting is hidden in the menus :-)

Apple Has Quietly Started Tracking iPhone Users Again, And It's Tricky To Opt Out


Apple's launch of the iPhone 5 in September came with a bunch of new commercials to promote the device.

But Apple didn't shout quite so loud about an enhancement to its new mobile operating system, iOS 6, which also occurred in September: The company has started tracking users so that advertisers can target them again, through a new tracking technology called IFA or IDFA.

Previously, Apple had all but disabled tracking of iPhone users by advertisers when it stopped app developers from utilizing Apple mobile device data via UDID, the unique, permanent, non-deletable serial number that previously identified every Apple device.

For the last few months, iPhone users have enjoyed an unusual environment in which advertisers have been largely unable to track and target them in any meaningful way.

In iOS 6, however, tracking is most definitely back on, and it's more effective than ever, multiple mobile advertising executives familiar with IFA tell us. (Note that Apple doesn't mention IFA in its iOS 6 launch page).

Users can switch off that targeting, but it's tricky, as we discovered a couple of days ago. Although at least iOS 6 users are able to turn off tracking, which they weren't before.

Here's how it works.

IFA or IDFA stands for "identifier for advertisers." It's a random, anonymous number that is assigned to a user and their device. It is temporary and can be blocked, like a cookie.

When you look at an app, or browse the web, your presence generates a call for an ad. The publisher's site that you're looking at then passes the IFA to the ad server. The advertiser is then able to know that a specific iPhone user is looking at a specific publication and can serve an ad targeting that user. IFA becomes particularly useful, for instance, if an ad server notices that a particular IFA is looking at a lot of different car sites. Perhaps that user is interested in buying a new car. They'll likely start seeing a lot of car ads on their iPhone.

More importantly, IFA will allow advertisers to track the user all the way to "conversion" — which for most advertisers consists of an app download. Previously, advertisers had no idea whether their ads actually drove people to download apps or buy things. Now IFA will tell them.

The IFA does not identify you personally — it merely provides a bunch of aggregate audience data that advertisers can target with ads.

iOS 6 Settings menu

Tracking is on by default

The new iPhone operating system comes with three things that make tracking easier for advertisers and reduce the likelihood that you'll opt out.

  • iOS 6 comes in a default "tracking on" position. You have to affirmatively switch it off if you do not want advertisers to see what you're up to.

  • The tracking control in iPhone's settings is NOT contained where you might expect it, under the "Privacy" menu. Instead, it's found under "General," then "About," and then the "Advertising" section of the Settings menu.

  • The tracking control is titled "Limit Ad Tracking," and must be turned to ON, not OFF, in order to work. That's slightly confusing — "ON" means ads are off! — so a large number of people will likely get this wrong.


Those three factors combined mean that a huge proportion of iPhone users are unlikely to ever opt out of tracking.

"It's a really pretty elegant, simple solution," says Mobile Theory CEO Scott Swanson. "The biggest thing we're excited about is that it's on by default, so we expect most people will leave it on."

(His take on IFA's capabilities was confirmed by two other mobile ad execs at rival companies.)

Again, IFA doesn't identify you as a person to advertisers. What it does do, however, is provide advertisers with "a really meaningful inference of behavior," Swanson says. "We haven't had access to that information before."

Author: Jim Edwards, http://www.businessinsider.com/ifa-apples-iphone-tracking-in-ios-6-2012-10

Postfix restart in Mac OS X 10.8 Mountain Lion

- by admin

Actually it is no so easy to restart Postfix in Mac OS X 10.8 Mountain Lion like in Linux :-)

However you can restart Postfix by plist unload / reload:
sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist
sudo launchctl load System/Library/LaunchDaemons/org.postfix.master.plist

By the way, if you have a problem with Postfix, look at this article: Cannot send mail in Mac OS X 10.8 Mountain Lion

How to Flush DNS Cache in Mac OS X

- by admin

After upgrading to 10.8.2 I have got a problem with adding a new entry into hosts file: the update was recognised only after system restart. But a more easy solution was just to flash DNS cache! So,

... flushing your DNS cache in Mac OS X is actually really easy, and there are two different commands to use, one for Leopard and for Tiger. Depending on your version of OS X, open your Terminal and follow the appropriate directions below:

Flushing DNS Cache in OS X Lion (10.7) and OS X Mountain Lion (10.8)


Launch Terminal and enter the following command, you will need to enter an administrative password:
sudo killall -HUP mDNSResponder

Note the dscacheutil still exists in 10.7 and 10.8, but the official method to clear out DNS caches is through killing mDNSResponder. You can also find that process running in Activity Monitor.

Flush DNS Cache in Mac OS X 10.5, Mac OS X 10.6


Launch Terminal and issue the following command:
dscacheutil -flushcache

All done, your DNS has been flushed. On a side note, the dscacheutil is interesting in general and worth taking a look at, try the -statistics flag instead for some stats.

Flush your DNS Cache in Mac OS X 10.4 Tiger


Type the following command in the Terminal:
lookupd -flushcache

That’s it - now your DNS settings should be as you intended them to be :-)

Find duplicate records in MySQL

- by admin

So, the task is to get duplicate records from a MySQL database.

The easy way:
SELECT COUNT(*), column1, column2 FROM tablename
GROUP BY column1, column2
HAVING COUNT(*)>1;

More complex case: shows each duplicated row:

It can be done using subquery:
SELECT firstname, lastname, list.address FROM list
INNER JOIN (SELECT address FROM list
GROUP BY address HAVING count(id) > 1) dup ON list.address = dup.address

or with INNER JOIN:
SELECT a.firstname, a.lastname, a.address
FROM list a
INNER JOIN list b ON a.address = b.address
WHERE a.id <> b.id

If the same 'address' exist more than two times, then DISTINCT is needed.

Cannot send mail in Mac OS X 10.8 Mountain Lion

- by admin

There is an error while sending mail in Mac OS X Mountain Lion 10.8:

send-mail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory

To fix just run in terminal:
sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start

The solution also fixes an error in 10.8 where the fax service has stopped sending emails after the 10.8 upgrade.

Another Postfix Mac OS X issue solution can be found here: Mac OS, MySQL: No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

« Newer posts

Older posts »