Problem with Qt application on MacOS Retina display

Standard Qt application on retina display looks ugly. Fuzzy fonts and images. This is how ORM Designer originaly looks on Retina:

ORM Designer on Retina before optimizations

Improve font autoscaling

First step how to improve Qt application on retina is by adding following definise to Info.plist

NSPrincipalClass
NSApplication
How to update Info.plist

If you’re updating existing application, it’s necessary to copy application to different location after Info.plist update. MacOS cache all .plist files and without that update will not be apply.

After applying this fix, this is how application looks:

How ORM Designer looks after fix

External sources

How to add new drive to ubuntu

Step one: install drive

It’s easy…. 😉

Step two, check if drive is connected

sudo fdisk -l

Create partitions

sudo fdisk /dev/sdb

#Create partition
#----------------
#press u (units to sectors)
#press n (create new partition)
#press p (primary partition)
#press 1 (first partition)
#press enter (default start at begin)
#press enter (default end at end)

#Format partition
#----------------
#press L (list of formats)
#?? need tye 83, don't know how to enter ;-)

#press W (write changes to hdd and quit)

#update kernel with changes we have made
sudo partproble /dev/sdb

#format drive
sudo mkfs /dev/sdb1 -t ext4

#create directory mount point
sudo mkdir /home/dev/dev
sudo chmod 777 /home/dev/dev

#mount it
sudo mount /dev/sdb1 /home/dev/dev -t ext4

#try to write something
touch /home/dev/dev/test.txt
ls /home/dev/dev

#setup auto-mounting point
sudo nano /etc/fstab

#add line
/dev/sdb1 /home/dev/dev ext4 defaults 0 0

External ref:

How to solve problem “version `GLIBC_2.14′ not found”

Simpliest solution

There is a several ways how you can deal with this problem. I think the easiest (and solution I choose) is compile application on the most oldest version of OS you want support. Here is the reason:


For dynamic linking, Linux (and most other UNIXes) support backward compatibility: an old binary continues to work on newer systems. But they don’t support forward compatibility (a binary built on a newer system will generally not run on an older one).

External links:

Another solutions

Here is a nice list how can be this issue solved (source here):

  • You could copy ld-2.14.so (the target of /lib/ld-linux symlink) to the target system, and invoke it explicitly: /path/to/ld-2.14.so –library-path /path/to/your/executable. This generally works, but can confuse an application that looks at argv[0], and breaks for applications that re-exec themselves.
  • You could build on an older system.
  • You could use appgcc.
  • You could set up a chroot environment matching the target system, and build inside that chroot.
  • You could build yourself a Linux-to-olderLinux crosscompiler

One more solution

You can also try following way, but I don’t test it

#include <limits.h>
#include <stdlib.h>
#include <stdio.h>

__asm__(".symver realpath,[email protected]_2.2.5");
int main()
{
   char* unresolved = "/lib64";
   char  resolved[PATH_MAX+1];

   if(!realpath(unresolved, resolved))
      { return 1; }

   printf("%s\n", resolved);

   return 0;
}

Qt QtDBus compilation

To add DBUS to Qt compilation, add following switch

./configure -opensource -dbus ....

If you get following error:

The QtDBus module cannot be enabled because libdbus-1 version 0.93 was not found.
Turn on verbose messaging (-v) to ./configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to ./configure to continue.

It’s necessary to install libsbus:

sudo apt-get install libdbus-1-3
Reading package lists... Done
Building dependency tree
Reading state information... Done
libdbus-1-3 is already the newest version.

and also developer package:

sudo apt-get install libdbus-1-dev

Now everything should work correctly.

Find out what wakes up your Windows 7/Vista from its sleep

@rem Get info about last wake
powercfg -lastwake

@rem Which device caused the wake up
powercfg -devicequery wake_armed

@rem More detailed info including time of sleep and wake
cmd /k wevtutil qe System /q:"*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter']]]" /rd:true /c:1 /f:text

External Links

Q2A markdown editor with file upload

Note: After first excitement I find out that service returns only thumbnails without possibility to get link to full image ;-(. Right now I’m searching another way.

Note:I figured out how to show image together with point to original image as link. Only drawback of this solution is that inserted image is only thumbnail.

This is a short tutorial how to configure your Q2A site to use markdown editor together with file upload feature.

function add_code()
{
  var text = unescape(document.location.search.substring(0));
  var imgStart = text.indexOf("[img]")+5;
  var imgEnd = text.indexOf("[/img]");
  var refStart = text.indexOf("[url=")+5;
  var refEnd = text.indexOf("]");
  var urlImg = text.substr(imgStart ,imgEnd-imgStart );
  var urlRef = text.substr(refStart ,refEnd-refStart );
  var area_ignore_name = /username_list|search/i;
  var area=opener.document.getElementById('wmd-input-content');
  if ( area==null )
   area=opener.document.getElementById('wmd-input-a_content');
  if ( area==null )
    area=opener.document.getElementById('wmd-input-q_content');
  area.value = area.value + "[![Image caption](" + urlImg + ")](" + urlRef + ")\n";
  opener.focus();
  area.focus();

  //refresh preview area
  var evt = document.createEvent("KeyboardEvent");
  evt.initKeyboardEvent("keypress", true, true, null, false, false, false, false, 0, 0);
  area.dispatchEvent(evt);

  window.close();
}
  • Now upload updated file addform.html to the root of your q2a site.
  • Now it’s need to update qa-markdown-editor.php file located in qa-plugin/q2a-markdown-editor-master. Insert [a style=”….”] line after [div id=”wmd-button-bar-“] line.
$html .= '</pre>
<div id="wmd-button-bar-'.$fieldname.'" class="wmd-button-bar">';
$html .= '<a style="float: right; display: block; background: #CCC; color: #444; padding: .2em 1em; font-weight: bold;" onclick="window.open(\'http://www.postimage.org/index.php?mode=phpbb&lang=english&forumurl=\' + escape(document.location.href), \'_imagehost\', \'resizable=yes,width=500,height=400\');return false;" href="javascript:void(0);">Upload image to post</a>';
$html .= '</div>
<pre>';
  • And finally, insert following fragment of css (it’s slightly updated) to your theme file. In my case it’s qa-theme/Snow/qa-styles.css
/* Markdown editor plugin */

.wmd-button-bar {
	width: 604px  !important ;
	padding: 5px 0;
}
.wmd-input {
	/* 604 */
	width: 598px;
	height: 250px;
	margin: 0 0 10px;
	padding: 2px;
	border: 1px solid #ccc;
}
.wmd-preview {
	/* 604 */
	width: 584px;
	margin: 10px 0;
	padding: 8px;
	border: 2px dashed #ccc;
}
.wmd-preview pre,
.qa-a-item-content pre {
	width: 100%;
	max-height: 400px;
	overflow: auto;
}

.wmd-button-row {
	position: relative;
	margin: 0;
	padding: 0;
	height: 20px;
}
#wmd-button-row-content.wmd-button-row { width: 70% !important }
#wmd-button-row-q_content.wmd-button-row { width: 70% !important }
#wmd-button-row-a_content.wmd-button-row { width: 70% !important }

.wmd-spacer {
	width: 1px;
	height: 20px;
	margin-left: 14px;
	position: absolute;
	background-color: Silver;
	display: inline-block;
	list-style: none;
}

.wmd-button {
    width: 20px;
    height: 20px;
    padding-left: 2px;
    padding-right: 3px;
    position: absolute;
    display: inline-block;
    list-style: none;
    cursor: pointer;
}

.wmd-button > span {
	/* note: background-image is set in plugin script */
    background-repeat: no-repeat;
    background-position: 0px 0px;
    width: 20px;
    height: 20px;
    display: inline-block;
}

.wmd-spacer1 {
    left: 50px;
}
.wmd-spacer2 {
    left: 175px;
}
.wmd-spacer3 {
    left: 300px;
}

.wmd-prompt-background {
	background-color: #000;
}
.wmd-prompt-dialog {
	border: 1px solid #999;
	background-color: #f5f5f5;
}
.wmd-prompt-dialog > div {
	font-size: 0.8em;
}
.wmd-prompt-dialog > form > input[type="text"] {
	border: 1px solid #999;
	color: black;
}
.wmd-prompt-dialog > form > input[type="button"] {
	border: 1px solid #888;
	font-size: 11px;
	font-weight: bold;
}

/* highlight.js styles */

pre code {
  display: block;
  padding: 0.5em;
  background: #f6f6f6;
}

pre code,
pre .ruby .subst,
pre .tag .title,
pre .lisp .title,
pre .nginx .title {
  color: black;
}

pre .string,
pre .title,
pre .constant,
pre .parent,
pre .tag .value,
pre .rules .value,
pre .rules .value .number,
pre .preprocessor,
pre .ruby .symbol,
pre .ruby .symbol .string,
pre .ruby .symbol .keyword,
pre .ruby .symbol .keymethods,
pre .instancevar,
pre .aggregate,
pre .template_tag,
pre .django .variable,
pre .smalltalk .class,
pre .addition,
pre .flow,
pre .stream,
pre .bash .variable,
pre .apache .tag,
pre .apache .cbracket,
pre .tex .command,
pre .tex .special,
pre .erlang_repl .function_or_atom,
pre .markdown .header {
  color: #800;
}

pre .comment,
pre .annotation,
pre .template_comment,
pre .diff .header,
pre .chunk,
pre .markdown .blockquote {
  color: #888;
}

pre .number,
pre .date,
pre .regexp,
pre .literal,
pre .smalltalk .symbol,
pre .smalltalk .char,
pre .go .constant,
pre .change,
pre .markdown .bullet,
pre .markdown .link_url {
  color: #080;
}

pre .label,
pre .javadoc,
pre .ruby .string,
pre .decorator,
pre .filter .argument,
pre .localvars,
pre .array,
pre .attr_selector,
pre .important,
pre .pseudo,
pre .pi,
pre .doctype,
pre .deletion,
pre .envvar,
pre .shebang,
pre .apache .sqbracket,
pre .nginx .built_in,
pre .tex .formula,
pre .erlang_repl .reserved,
pre .input_number,
pre .markdown .link_label,
pre .vhdl .attribute {
  color: #88f;
}

pre .keyword,
pre .id,
pre .phpdoc,
pre .title,
pre .built_in,
pre .aggregate,
pre .css .tag,
pre .javadoctag,
pre .phpdoc,
pre .yardoctag,
pre .smalltalk .class,
pre .winutils,
pre .bash .variable,
pre .apache .tag,
pre .go .typename,
pre .tex .command,
pre .markdown .strong,
pre .request,
pre .status {
  font-weight: bold;
}

pre .markdown .emphasis {
  font-style: italic;
}

pre .nginx .built_in {
  font-weight: normal;
}

pre .coffeescript .javascript,
pre .xml .css,
pre .xml .javascript,
pre .xml .vbscript,
pre .tex .formula {
  opacity: 0.5;

And that’s all. If you want to see it in action, take a look to this site: http://q2a.orm-designer.com/

List of C++ profilers for windows (commercial and non-commercial)

Commercial

Free

System performance tools

Linux test tools (not tested yet)

External resources

 

How to fix “The device, \Device\Ide\iaStor0, did not respond within the timeout period.”

Link with detailed description of this problem.

Short how to fix:

regedit
open HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\iaStor\Parameters\Port[0-n]\
set LPM=0, LPMDSTATE=0, and DIPM = 0

if your registry doesn’t contain this key, you have to add them.

Add new key "Port0".
Add new "DWORD" value named "LPM" and value leave 0.
Add next two "DWORD" values named "LPMDSTATE" and "DIPM".

Another advise how to fix this error

This method is originally referred in MS Technet forum:

Also the issue may be the result of Aggressive Link State Power Management (ALPM) on the PCI-Express bus negotiating a lower power state for the link between the controller and disk when there is no activity. When ALPM works, disk requests are queued, the serial link revived, and the queued requests are sent to the relevant disk; this requires a disk that supports ALPM.

1.       Click Start button, choose Control Panel.
2.       Move to Control Panel\All Control Panel Items\Power Options. Click Change plan setting in your current power plan.
3.       Click “Change advanced power settings”, move to PCI Express-> Link State Power Management, turn off the option.

External links

MacOS open file hander, app icon and other PLIST features

How to configure PLIST

This is how look ORM Designer plist file to correct setup file handler and application icon:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
<dict>
  <key>CFBundleVersion</key>        <string>1.0</string>
  <key>CFBundlePackageType</key>    <string>APPL</string>
  <key>CFBundleExecutable</key>     <string>@[email protected]</string>
  <key>CFBundleIdentifier</key>     <string>com.orm-designer.OrmDesigner2</string>
  <key>CFBundleSignature</key>      <string>????</string>
  <key>CFBundleGetInfoString</key>  <string>ORM Designer2, Copyright 2012 Inventic s.r.o.</string>
  <key>CFBundleIconFile</key>       <string>@[email protected]</string>
  <key>NOTE</key>                   <string>ORM Designer2 by Inventic Corporation</string>

  <key>CFBundleDocumentTypes</key>
  <array>
    <dict>
      <key>CFBundleTypeName</key>         <string>ORM Designer project file</string>
      <key>CFBundleTypeRole</key>         <string>Editor</string>
      <key>CFBundleTypeIconFile</key>     <string>@[email protected]</string>
      <key>LSHandlerRank</key>            <string>Owner</string>
      <key>LSIsAppleDefaultForType</key>  <true/>

      <key>CFBundleTypeExtensions</key>
      <array>
        <string>ormdesigner</string>
        <string>ormdes</string>
        <string>ormdesigner2</string>
        <string>ormdes2</string>
      </array>
    </dict>
  </array>
</dict>
</plist>

Qt links:

Apple developer links:

Icon converting online tools