Q:

Degraded areas of some user interfaces, including pixellated or jagged fonts

For me the symptoms were first observed with PC-BSD 11.0-CURRENT. The first of my 2016 screenshots (below) is similar to the 2012 shot in Debian-related Fonts of some applications get confused so, reading the two questions alongside each other:

it seems that the problem/symptoms may affect multiple desktop environments in both Linux and FreeBSD.

From my screenshots:

please, can anyone guess what's wrong?

Hint: to clearly view the symptoms, you may find it necessary to view each shot full-size.
In my case it's certain that symptoms are present for multiple users and multiple desktop environments – and most (maybe all) packages have been reinstalled. So:

I guess that the problem is with a configuration file that is shared (not in any home directory).

I tested a new user account, the problem persisted.
Screenshots
Document Viewer (Evince)
Poorly rendered fonts in the toolbar and sidebar of the application:

Xterm
Poorly rendered font within the terminal window:

Luxi Sans medium and Terminal in xfontsel
The poorly rendered font sample in the lowest part of the application window (although from commentary below, and from glancing at xfontsel on a different computer, it may be that the pixellation is to be expected in this application):

Xfburn

Comparisons
The shot of Xfburn may be most telling; the degraded appearance is not limited to fonts. Compare what's above with a 2010 shot (from Xfburn – A tool the size of the task | Written and Read):

When I choose a PC-BSD 10.2-RELEASE boot environment on the affected machine, there's no problem. In this shot from 10.2, (GNOME) System Monitor appears fine:

Additional notes
When I logged in to MATE, the fonts in its menu bar were pixellated.
Without running X, I ran the following command to force reinstallation (or upgrade) of all packages –
pkg upgrade -f

– then restarted the operating system. That pkg routine did not work around the problem.
As far as I can tell, the poor font rendering is no better when VESA mode applies.
Shortlist of some affected applications

Files (nautilus) 3.18.5
Gnote 3.18.1
HexChat 2.10.2
Pidgin 2.10.12 (libpurple 2.10.12)
System Monitor (gnome-system-monitor) 3.16.0
Web (epiphany) 3.16.3
Xfburn 0.5.4
XTerm 322

Shortlist of some non-affected applications
At a glance:

Firefox 44.0.2
Konsole 2.14.2
Konversation 1.5.1
KSnapshot 0.8.2
System Log (KSystemLog) 0.4
Thunderbird 38.6.0

GTK
Neither /usr/local/etc/gtk-2.0/gtkrc nor /usr/local/etc/gtk-3.0/settings.ini exists –
$ cat /usr/local/etc/gtk-2.0/gtkrc
cat: /usr/local/etc/gtk-2.0/gtkrc: No such file or directory
$ ls -al /usr/local/etc/gtk-2.0/
total 9
drwxr-xr-x   2 root  wheel    3  8 Feb 20:26 .
drwxr-xr-x  67 root  wheel  154 21 Feb 22:25 ..
-rw-r--r--   1 root  wheel  890  5 Feb 13:52 im-multipress.conf
$ cat /usr/local/etc/gtk-3.0/settings.ini
cat: /usr/local/etc/gtk-3.0/settings.ini: No such file or directory
$ ls -al /usr/local/etc/gtk-3.0/
total 9
drwxr-xr-x   2 root  wheel    3 21 Feb 22:16 .
drwxr-xr-x  67 root  wheel  154 21 Feb 22:25 ..
-rw-r--r--   1 root  wheel  890 16 Feb 22:08 im-multipress.conf
$

– from a separate installation of PC-BSD 11.0-CURRENTJAN2016 it seems, that's the norm. From discussion in irc://chat.freenode.net/#pcbsd it's assumed that their nonexistence implies default values.
Selected comments from beyond Stack Exchange
From a developer:

Sorry Graham, I don't really have an idea of what could be causing this. Looks like gtk is going nuts on your system, or some lower-level X issues.
Good luck …

Background
As far as I recall, the problem in my case arose from intentionally aggressive testing of PC-BSD 11.0-CURRENTFEB2016 with portmaster(8). During a run of portmaster, probably –
sudo portmaster -GaD

– I launched a type of application that might cause the hardware (Ergo Vista 621 notebook with Intel GM45 graphics) to blackout with anything more recent than 11.0-CURRENTNOV2015. Sure enough, a blackout occurred with no response to Control-Alt-F2 and so I pressed the power button to shut down the system as gracefully as possible in the midst of works by portmaster.
I have ZFS boot environments for both 11.0-CURRENTNOV2015 and 11.0-CURRENTFEB2016. Since the problem occurred whilst testing the latter, the symptom is present in both environments.

A:

Without identifying the troublesome package
Laziness – without the desired learning.
Instead of performing a change of branch from 10.2-RELEASE to 11.0-CURRENT, I removed from 11.0-CURRENTNOV2015 most of the packages that were not of immediate interest to me.
Now XTerm and various other applications appear good. An example:

xfontsel

… probably not abnormal …

Yes. Now I see that rendering in xfontsel is relatively poor.
Identification of the package that most likely caused the problem
From the details below, someone might recognise a likely culprit.
If an additional answer helps me to identify the offending package, I'll happily:

accept; and then (after I regain sufficient reputation)
award a bounty.

Details of removals
Using pkg(7)
Round one
Focused on removal of some desktop environments.
icewm was remarkable:

preparation for removal suggested that two packages were to be removed
deinstallation counted nothing.

So I used pkg to (re)install icewm –

installation counted nothing

– then remove it:

deinstallation counted one package.

Round two (outline)
I used pkg to set to non-automatic the packages that I wished to keep.
Then the autoremove command of pkg to –

Delete packages which were automatically installed as dependencies and are not required any more.

– then removal of some other stuff (probably relating to MATE), then another autoremove routine.
Finally I attended to a handful of packages that I wanted to reinstall (evince, gnome-characters, gnome-screenshot, gnome-system-monitor, nautilus, xfontsel).
Selected outputs from terminal windows
[root@cces3-gjp4-pc-bsd-ergovista621] /usr/home/gjp4# pkg set -A 0 DTraceToolkit ; pkg set -A 0 ImageMagick ; pkg set -A 0 anacron ; pkg set -A 0 choqok ; pkg set -A 0 chromium ; pkg set -A 0 clementine-player ; pkg set -A 0 epiphany ; pkg set -A 0 eom ; pkg set -A 0 filelight ; pkg set -A 0 filezilla ; pkg set -A 0 firefox ; pkg set -A 0 gedit ; pkg set -A 0 gimp ; pkg set -A 0 gnote ; pkg set -A 0 gwenview ; pkg set -A 0 hexchat ; pkg set -A 0 k3b ; pkg set -A 0 kate ; pkg set -A 0 konversation ; pkg set -A 0 life-preserver ; pkg set -A 0 lumina ; pkg set -A 0 mDNSResponder ; pkg set -A 0 nano ; pkg set -A 0 panicmail ; pkg set -A 0 pcbsd-meta-kde ; pkg set -A 0 pcbsd-meta-virtualbox ; pkg set -A 0 pcbsd-utils ; pkg set -A 0 pcbsd-utils-qt5 ; pkg set -A 0 py27-ranger ; pkg set -A 0 rsync ; pkg set -A 0 screenFetch ; pkg set -A 0 skype4 ; pkg set -A 0 smartmontools ; pkg set -A 0 sudo ; pkg set -A 0 thunderbird ; pkg set -A 0 virtualbox-ose ; pkg set -A 0 virtualbox-ose-kmod ; pkg set -A 0 vlc-qt4 ; pkg set -A 0 wine-devel ; pkg set -A 0 wine-gecko-devel ; pkg set -A 0 wine-mono-devel ; pkg set -A 0 xfburn
Mark ImageMagick-6.9.3.4,1 as not automatically installed? [y/N]: y
Mark anacron-2.3_6 as not automatically installed? [y/N]: y
Mark epiphany-3.16.3 as not automatically installed? [y/N]: y
Mark eom-1.12.1 as not automatically installed? [y/N]: y
Mark filelight-4.14.3 as not automatically installed? [y/N]: y
Mark gedit-3.18.3 as not automatically installed? [y/N]: y
Mark gnote-3.18.1 as not automatically installed? [y/N]: y
Mark gwenview-4.14.3 as not automatically installed? [y/N]: y
Mark kate-4.14.3 as not automatically installed? [y/N]: y
Mark life-preserver-1456005125 as not automatically installed? [y/N]: y
Mark mDNSResponder-576.30.4 as not automatically installed? [y/N]: y
Mark virtualbox-ose-4.3.36 as not automatically installed? [y/N]: y
Mark virtualbox-ose-kmod-4.3.36 as not automatically installed? [y/N]: y
Mark vlc-qt4-2.2.1_7,4 as not automatically installed? [y/N]: y
Mark wine-gecko-devel-2.44 as not automatically installed? [y/N]: y
Mark wine-mono-devel-4.5.6 as not automatically installed? [y/N]: y
[root@cces3-gjp4-pc-bsd-ergovista621] /usr/home/gjp4# exit
exit
[gjp4@cces3-gjp4-pc-bsd-ergovista621] ~% sudo pkg autoremove
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 338 packages:

Installed packages to be REMOVED:
        aisleriot-3.18.2
        gnome-games-3.18.0
        cinnamon-control-center-2.4.2_2
        gegl3-0.3.4
        gnome-photos-3.18.2
        gnome-utils-3.18.0,1
        thunar-archive-plugin-0.3.1_4
        squeeze-0.2.3_10
        xfce4-desktop-4.12.3
        Thunar-1.6.10_1
        foomatic-filters-4.0.17_5
        a2ps-4.13b_8
        accerciser-3.14.0_1
        gdm-3.16.4
        evince-3.18.2
        sushi-3.18.0
        gnome3-lite-3.18.0
        gnome-documents-3.18.2
        cinnamon-desktop-2.4.2_1
        nemo-2.4.5
        cinnamon-settings-daemon-2.4.3
        muffin-2.4.4
        cinnamon-screensaver-2.4.1
        gnome-font-viewer-3.16.2
        gnome-tetravex-3.18.0
        gnome-sudoku-3.18.2
        yelp-3.18.1
        gnome-contacts-3.18.0
        gnome-control-center-3.18.2
        gnome-shell-3.18.3
        gnome-terminal-3.18.1
        gnome-shell-extensions-3.18.3
        evolution-data-server-3.18.4
        gnome-todo-3.18.1
        cheese-3.18.1
        folks-0.11.1
        gnome-maps-3.18.2
        empathy-3.12.11
        gnome-calendar-3.18.2.1
        evolution-3.18.4
        libzapojit-0.0.3_1
        gfbgraph-0.2.3
        eog-plugins-3.16.3
        totem-3.18.1
        grilo-plugins-0.2.17
        brasero-3.12.1_1
        nautilus-3.18.5
        file-roller-3.16.4_1,1
        alacarte-3.11.91_2
        apg-2.3.0b_4
        gnome-settings-daemon-3.18.2
        colord-gtk-0.1.26
        gnome-color-manager-3.18.0
        orca-3.18.2
        py27-atspi-2.18.0
        caribou-0.4.19
        atomix-3.18.0
        vinagre-3.18.2
        avahi-gtk3-0.6.31_3
        avahi-header-0.6.31
        kdepim-4.14.3_3
        kopete-4.14.3_2
        kdenetwork-4.14.3
        baobab-3.18.1
        gcc-4.8.5_2
        lxterminal-0.2.0
        grub2-pcbsd-2.02q_8
        grub2-efi-2.02_15
        binutils-2.25.1,1
        bitstream-vera-1.10_7
        w3m-0.5.3_5
        tracker-1.6.1
        boehm-gc-threaded-7.4.2_4
        guile2-2.0.11_3
        boehm-gc-7.4.2_4
        bogofilter-1.2.4_5
        cabextract-1.6
        caja-extensions-1.12.0
        webkit-gtk3-2.4.9_1
        grilo-0.2.15
        gupnp-0.20.15
        opal-3.10.10_9
        ekiga-4.0.1_8
        cinnamon-menus-2.4.1
        cinnamon-session-2.4.3_1
        cinnamon-translations-2.4.2
        cjs-2.4.1
        clutter-gst-2.0.16
        mutter-3.18.2
        clutter-gtk3-1.6.6
        lightsoff-3.18.0
        libchamplain-0.12.12
        gnome-nibbles-3.18.2
        swell-foop-3.18.1
        quadrapassel-3.18.0
        gnome-2048-3.18.2
        clutter-gst3-3.0.14
        clutter-1.24.2
        cogl-1.22.0
        xfce4-wm-4.12.3
        coreutils-8.23
        libpwquality-1.2.4_1
        cracklib-2.9.6
        cups-pstoraster-8.15.4_8
        libmemcached-1.0.18_2
        dconf-editor-3.18.2
        mate-screensaver-1.12.0
        dmenu-4.6
        kaccessible-4.14.3
        kdeaccessibility-4.14.3
        jovie-4.14.3
        kdemultimedia-4.14.3
        dragon-player-4.14.3
        enca-1.18
        enscript-a4-1.6.6_1
        eog-3.18.1
        ptlib-2.10.11
        py27-papyon-0.5.4_1
        py27-telepathy-butterfly-0.5.15_2
        farsight2-0.0.31_3
        five-or-more-3.18.0
        py34-speech-dispatcher-0.8.3_1
        foomatic-db-hpijs-1.4
        foomatic-db-20150819
        four-in-a-row-3.18.2
        freedesktop-sound-theme-0.8
        krdc-4.14.3
        freerdp-1.2.0_5
        py27-pillow-2.9.0_1
        libass-0.13.1
        galculator-2.1.3
        xfce4-mixer-4.11.0_3
        xfce4-power-manager-1.5.2
        xfce4-battery-plugin-1.0.5_4
        xfce4-panel-4.12.0_1
        orage-4.12.1_1
        xfce4-settings-4.12.0_1
        xfce4-appfinder-4.12.0
        garcon-0.4.0_1
        gcc-ecj-4.5
        gconf-editor-3.0.1,1
        gedit-plugins-3.18.0
        libgweather-3.18.1
        gnome-clocks-3.18.0
        gnome-weather-3.18.1
        geocode-glib-3.18.1
        telepathy-logger-0.8.1
        gnome-characters-3.18.1
        totem-pl-parser-3.10.6
        gmime26-2.6.20
        gnome-backgrounds-3.18.0
        gnome-calculator-3.18.3
        gnome-chess-3.18.0
        gnome-session-3.18.1.2
        gnome-dictionary-3.18.1
        gnome-icon-theme-extras-3.12.0
        gnome-klotski-3.18.2
        gnome-mahjongg-3.18.0
        gnome-menus-3.13.3
        gnome-mines-3.18.2
        gnome-power-manager-3.18.0
        xfce4-terminal-0.6.3_2
        gnome-robots-3.18.1
        gnome-screenshot-3.18.0
        gnome-search-tool-3.6.0
        gnome-system-log-3.9.90
        gnome-system-monitor-3.16.0
        gnome-taquin-3.18.2
        gnome-themes-standard-3.18.0
        gnome-tweak-tool-3.18.1
        gnome-user-docs-3.18.1
        gnome-video-effects-0.4.1
        gnuchess-6.2.2
        seahorse-3.18.0
        libcryptui-3.12.2
        kget-4.14.3_1
        libkolab-0.5.3
        kdepim-runtime-4.14.3
        gpicview-0.2.4_1
        gsl-1.16_2
        gsound-1.0.2
        gssdp-0.14.13
        gstreamer1-plugins-vpx-1.6.3
        gstreamer1-plugins-v4l2-1.6.3
        gstreamer1-plugins-soup-1.6.3
        gstreamer1-plugins-jpeg-1.6.3
        gtk-vnc-0.5.4
        gtk-xfce-engine-3.2.0
        gucharmap-3.18.2
        highlight-3.28,2
        hitori-3.16.2
        i3lock-2.7
        i3status-2.10
        iagno-3.18.2
        zh-ibus-pinyin-1.5.0_1
        zh-ibus-chewing-1.4.14
        ibus-1.5.11
        xfce4-session-4.12.1_2
        libsocialweb-0.25.21_3
        juk-4.14.3
        kdemultimedia-ffmpegthumbs-4.14.3
        kdenetwork-filesharing-4.14.3
        kdenetwork-strigi-analyzers-4.14.3
        kmag-4.14.3
        kmix-4.14.3
        kmousetool-4.14.3
        kmouth-4.14.3
        krfb-4.14.3
        kscd-4.14.3
        leafpad-0.8.18.1_1
        xman-1.1.4
        libXprintUtil-1.0.1_3
        libbluray-0.7.0,1
        libbdplus-0.1.2
        libcanberra-gtk3-0.30_3
        libcheck-0.10.0
        libconfuse-2.7_1
        libcue-1.4.0_2
        libmusicbrainz3-3.0.3_4
        libdiscid-0.6.1
        libev-4.20,1
        pcmanfm-1.2.3
        libfm-1.2.3_3
        menu-cache-1.0.1
        lxpanel-0.6.2_1
        libfm-extra-1.2.3_3
        libgames-support-0.1
        lxsession-0.4.6.1_2
        libgee-0.18.0
        libgit2-glib-0.23.8
        libgit2-0.23.4
        libgnomekbd-3.6.0_1
        libkfbapi-1.0_3
        libkgapi-2.2.0
        libkolabxml-1.1.1
        libktorrent-1.3.1_7
        libmediaart-1.9.0
        libmicrohttpd-0.9.37_1
        libmms-0.6.4
        libmodplug-0.8.8.5_2
        libnfs-1.3.0_1
        libnice-gst010-0.1.13
        telepathy-gabble-0.18.3_2
        libquvi09-0.9.4_2
        libquvi-scripts09-0.9.20131130
        librtmp-2.4.20130923
        libssh2-1.6.0_1,2
        libsysinfo-0.0.2_1
        telepathy-mission-control-5.16.3_1
        libtelepathy-0.3.3_3
        libunistring-0.9.6
        libva-1.6.2
        libwraster-0.95.7_1
        libxdg-basedir-1.2.0_1
        py27-lxml-3.5.0
        linux-c6-devtools-6.7
        linux-c6-libgfortran-4.4.7_2
        lsof-4.90.b,8
        lua51-5.1.5_9
        lua52-lgi-0.9.0
        lxappearance-0.6.1
        lxde-common-0.5.5_5
        lxde-icon-theme-0.5.1
        lxinput-0.3.2_1
        lxmenu-data-0.1.4
        lxtask-0.1.4_2
        m4-1.4.17_1,1
        meanwhile-1.0.2_5
        mesa-demos-8.3.0
        mousepad-0.4.0_2
        mousetweaks-3.12.0
        mozo-1.12.0
        mpage-2.5.6
        mpc-1.0.3
        nanomsg-0.8.b
        nepomuk-widgets-4.14.3
        net-snmp-5.7.3_11
        o3read-0.0.4
        obkey-1.0
        obmenu-1.0_8
        xfce4-tumbler-0.1.31_2
        p5-AnyEvent-I3-0.16_1
        p5-AnyEvent-7.12,1
        p5-IPC-Run-0.94
        p5-IO-Tty-1.12_1
        p5-JSON-XS-3.01_2
        p5-Try-Tiny-0.24
        p5-Types-Serialiser-1.0_1
        p5-Unicode-Map8-0.13_1
        p5-Unicode-String-2.09_1
        p5-common-sense-3.73_1
        xarchiver-0.5.4_1
        pam_helper-1.0
        pl-libgadu-1.12.1,1
        polkit-gnome-0.105
        protobuf-c-1.2.1
        py27-cryptography-1.0.2_3
        py27-openssl-0.15.1
        py27-cffi-1.2.1
        py27-enum34-1.0.4
        py27-gstreamer-0.10.22_3
        py27-idna-2.0
        py27-ipaddress-1.0.14
        py27-libpeas-1.16.0
        py27-notify-0.1.1_11
        py27-pyasn1-0.1.9
        py27-pycparser-2.10
        py27-telepathy-python-0.15.19_1
        py27-tkinter-2.7.11_6
        zeitgeist-0.9.16
        py27-xdg-0.25
        py34-atspi-2.18.0
        py34-dbus-1.2.0_1
        py34-xdg-0.25_1
        py34-setuptools34-20.0
        qqwing-1.3.4_1
        raptor-1.4.21_5
        ristretto-0.8.0
        sdl_image-1.2.12_8
        spandsp-0.0.6
        tali-3.18.0
        telepathy-idle-0.2.0
        telepathy-salut-0.8.1_1
        thunar-vfs-1.2.0_11
        unoconv-0.6
        vino-3.18.1
        vte3-0.42.3
        wmicons-1.0_2
        wqy-fonts-20100803_5,1
        wv-1.2.9_3
        xcb-util-cursor-0.1.2
        xerces-c3-3.1.2
        xfce4-wm-themes-4.10.0_1
        xfontsel-1.0.5
        yelp-xsl-3.18.1
        zeroconf-ioslave-4.14.3
        zh-libchewing-0.4.0_1
        zh-pyzy-0.1.0_1

The operation will free 2 GiB.

Proceed with deinstalling packages? [y/N]: y
[1/338] Deinstalling gnome3-lite-3.18.0...
[2/338] Deinstalling gnome-utils-3.18.0,1...
[3/338] Deinstalling gdm-3.16.4...
==> You should manually remove the "gdm" user.

To really remove the gdm port, please remove the following
directories manualy:

/var/cache/gdm /var/gdm /var/log/gdm and /var/run/gdm

[3/338] Deleting files for gdm-3.16.4: 100%

…

[20/338] Deinstalling brasero-3.12.1_1...
[20/338] Deleting files for brasero-3.12.1_1: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[21/338] Deinstalling file-roller-3.16.4_1,1...
[21/338] Deleting files for file-roller-3.16.4_1,1: 100%

…

[28/338] Deinstalling nemo-2.4.5...
[28/338] Deleting files for nemo-2.4.5: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[29/338] Deinstalling gnome-todo-3.18.1...
[29/338] Deleting files for gnome-todo-3.18.1: 100%

…

[45/338] Deinstalling aisleriot-3.18.2...
[45/338] Deleting files for aisleriot-3.18.2: 100%
I/O warning : failed to load external entity "/usr/local/etc/gconf/schemas/aisleriot.schemas"
Failed to open `/usr/local/etc/gconf/schemas/aisleriot.schemas':
[46/338] Deinstalling Thunar-1.6.10_1...
[46/338] Deleting files for Thunar-1.6.10_1: 100%

…

[69/338] Deinstalling kdepim-runtime-4.14.3...
[69/338] Deleting files for kdepim-runtime-4.14.3: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[70/338] Deinstalling zh-ibus-pinyin-1.5.0_1...
[70/338] Deleting files for zh-ibus-pinyin-1.5.0_1: 100%
[71/338] Deinstalling zh-ibus-chewing-1.4.14...
[71/338] Deleting files for zh-ibus-chewing-1.4.14: 100%
[72/338] Deinstalling libfm-1.2.3_3...
[72/338] Deleting files for libfm-1.2.3_3: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[73/338] Deinstalling lxpanel-0.6.2_1...
[73/338] Deleting files for lxpanel-0.6.2_1: 100%

…

[239/338] Deinstalling wqy-fonts-20100803_5,1...
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 21 dirs
/usr/local/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/75dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/Caladea: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/Carlito: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/Droid: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/GentiumBasic: caching, new cache contents: 8 fonts, 0 dirs
/usr/local/share/fonts/Liberation: caching, new cache contents: 12 fonts, 0 dirs
/usr/local/share/fonts/LinLibertineG: caching, new cache contents: 10 fonts, 0 dirs
/usr/local/share/fonts/OTF: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/TTF: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/share/fonts/Type1: caching, new cache contents: 29 fonts, 0 dirs
/usr/local/share/fonts/cantarell: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/cyrillic: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/dejavu: caching, new cache contents: 21 fonts, 0 dirs
/usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/gnu-unifont: caching, new cache contents: 1 fonts, 0 dirs
/usr/local/share/fonts/misc: caching, new cache contents: 59 fonts, 0 dirs
/usr/local/share/fonts/noto: caching, new cache contents: 158 fonts, 0 dirs
/usr/local/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/webfonts: caching, new cache contents: 30 fonts, 0 dirs
/usr/local/share/fonts/wqy: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/lib/X11/fonts: skipping, no such directory
/usr/home/gjp4/.local/share/fonts: skipping, no such directory
/usr/home/gjp4/.fonts: skipping, no such directory
Re-scanning /usr/local/share/fonts: caching, new cache contents: 0 fonts, 21 dirs
Re-scanning /usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/var/db/fontconfig: cleaning cache directory
/var/db/fontconfig: invalid cache file: 4682a3e4d52053cb6d3ed27f307ded4c-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: cleaning cache directory
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 5590eef8711d78f75a1d19f78ae9af8f-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 00ed202266c19b8ebe5183686059cdcf-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: b9d2b94919fe346d8b04ef83de2b4cf0-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 4c599c202bc5c08e2d34565a40eac3b2-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: d69df6005be9052cf14e7a84ff78d81b-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 1fe06f2352c4cb897117a756a050a9d4-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 6d95495df1dfa2220dadf839dce46f11-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 4682a3e4d52053cb6d3ed27f307ded4c-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 317e92aa1a4d3e601fb38e2d3c7b366a-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: ba1d92d9e40780c65c2952558e6fa6f5-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: b505adbf72d7253408dd67084a8aa967-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 6e4e6e89d259e13805f6ecfb3b9855b6-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: d3b21a501470a17bfd0b9b6aedc735bd-le64.cache-4
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 3a114eb8ff7128eaeed6b7525120b7d1-le64.cache-4
/usr/home/gjp4/.fontconfig: cleaning cache directory
fc-cache: succeeded
[239/338] Deleting files for wqy-fonts-20100803_5,1: 100%
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 21 dirs
/usr/local/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/75dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/Caladea: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/Carlito: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/Droid: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/GentiumBasic: caching, new cache contents: 8 fonts, 0 dirs
/usr/local/share/fonts/Liberation: caching, new cache contents: 12 fonts, 0 dirs
/usr/local/share/fonts/LinLibertineG: caching, new cache contents: 10 fonts, 0 dirs
/usr/local/share/fonts/OTF: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/TTF: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/share/fonts/Type1: caching, new cache contents: 29 fonts, 0 dirs
/usr/local/share/fonts/cantarell: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/cyrillic: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/dejavu: caching, new cache contents: 21 fonts, 0 dirs
/usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/gnu-unifont: caching, new cache contents: 1 fonts, 0 dirs
/usr/local/share/fonts/misc: caching, new cache contents: 59 fonts, 0 dirs
/usr/local/share/fonts/noto: caching, new cache contents: 158 fonts, 0 dirs
/usr/local/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/webfonts: caching, new cache contents: 30 fonts, 0 dirs
/usr/local/share/fonts/wqy: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/lib/X11/fonts: skipping, no such directory
/usr/home/gjp4/.local/share/fonts: skipping, no such directory
/usr/home/gjp4/.fonts: skipping, no such directory
Re-scanning /usr/local/share/fonts: caching, new cache contents: 0 fonts, 21 dirs
Re-scanning /usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/var/db/fontconfig: cleaning cache directory
/usr/home/gjp4/.cache/fontconfig: cleaning cache directory
/usr/home/gjp4/.cache/fontconfig: invalid cache file: 17692e65f2842a3047704dc734d11f69-le64.cache-4
/usr/home/gjp4/.fontconfig: cleaning cache directory
fc-cache: succeeded
[240/338] Deinstalling wv-1.2.9_3...
[240/338] Deleting files for wv-1.2.9_3: 100%

…

[337/338] Deleting files for yelp-xsl-3.18.1: 100%
[338/338] Deinstalling zh-libchewing-0.4.0_1...
[338/338] Deleting files for zh-libchewing-0.4.0_1: 100%

…

[gjp4@cces3-gjp4-pc-bsd-ergovista621] ~% date ; uptime
Wed  2 Mar 2016 19:35:57 GMT
 7:35pm  up 1 hr, 3 users, load averages: 0.29, 0.44, 0.41
[gjp4@cces3-gjp4-pc-bsd-ergovista621] ~% freebsd-version
11.0-CURRENTNOV2015

…

[gjp4@cces3-gjp4-pc-bsd-ergovista621] ~% sudo pkg autoremove
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 41 packages:

Installed packages to be REMOVED:
        mate-polkit-1.12.0
        mate-base-1.12.0
        mate-applets-1.12.1_1
        accountsservice-0.6.40
        gnome-keyring-3.18.3
        mate-power-manager-1.12.1
        atril-1.12.2
        engrampa-1.12.0
        caja-1.12.3
        mate-terminal-1.12.1
        mate-media-1.12.1
        pinentry-gnome3-0.9.5_1
        vte-0.28.2_2
        gnome-pty-helper-0.40.2
        gtar-1.28_2
        mate-themes-1.12.2_1
        gtk-engines2-2.20.2_2
        gtk-murrine-engine-0.98.2_4
        pluma-1.12.1
        py27-gtksourceview-2.10.1_2
        gtksourceview2-2.10.5_4
        hal-info-20091130
        mate-utils-1.12.0
        marco-1.12.1
        mate-control-center-1.12.1
        mate-settings-daemon-1.12.1
        libmatekbd-1.12.1
        libmatemixer-1.12.1
        mate-panel-1.12.2
        libmateweather-1.12.1
        mate-system-monitor-1.12.1
        mate-notification-daemon-1.12.1
        libwnck-2.30.7_1
        libxklavier-5.3_1,1
        mate-backgrounds-1.12.0
        mate-icon-theme-faenza-1.12.0
        mate-menus-1.12.0
        mate-session-manager-1.12.1
        unique-1.1.6_6
        unzip-6.0_7
        zenity-3.18.0

The operation will free 342 MiB.

Proceed with deinstalling packages? [y/N]: y
[1/41] Deinstalling mate-base-1.12.0...
[2/41] Deinstalling mate-applets-1.12.1_1...
[2/41] Deleting files for mate-applets-1.12.1_1: 100%
[3/41] Deinstalling mate-control-center-1.12.1...
[3/41] Deleting files for mate-control-center-1.12.1: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[4/41] Deinstalling mate-power-manager-1.12.1...
[4/41] Deleting files for mate-power-manager-1.12.1: 100%

…

[13/41] Deinstalling caja-1.12.3...
[13/41] Deleting files for caja-1.12.3: 100%
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
[14/41] Deinstalling mate-terminal-1.12.1...
[14/41] Deleting files for mate-terminal-1.12.1: 100%

…

[41/41] Deinstalling unzip-6.0_7...
[41/41] Deleting files for unzip-6.0_7: 100%
[gjp4@cces3-gjp4-pc-bsd-ergovista621] ~%


Q:

How to remove a applied PnPProvisioningTemplate with PowerShell?

As the title say, how to remove a applied PnPProvisioningTemplate with PowerShell?
I have tried Remove-PnPCustomAction on all "Custom Action's Name attribute" but it does not work after running this script.
I used this example:
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries and the "Custom Tab" Ribbon example.
This module: SharePointPnPPowerShellOnline
# Connect to a previously created Modern Site
$cred = Get-Credential;
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/dev/ -Credentials $cred;
Write-Host "Connected to SharePoint!";

$scriptPath = "$($PSScriptRoot)\custom_action.xml";
Write-host "Running script: $($scriptPath)";

# Apply the PnP provisioning template
#Apply-PnPProvisioningTemplate -Path $scriptPath -Handlers CustomActions;
#Write-host "Applied custom action!";

$test = Get-PnPCustomAction;
Write-Host $test;

#Remove-PnPCustomAction -Identity CA_4 -Force
#Write-Host "Removed custom Action"

Thank you.

A:

PnP Provisioning engine does only set API configurations on the site and uploads possibly assets. There's no actual "template" as such, which you can remove from the site, but you can absolutely remove the configurations which were applied to the template.
Removing, for example, UserCustomAction configuration is dependent on what you did have in the actual template. In the example case CustomActions where applied on the SiteCollection level, so you'll need to remember to use Scope parameter correctly. See documentation from https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/Remove-PnPCustomAction?view=sharepoint-ps


Q:

Perl regex - Is (x|y)* equivalent to [xy]*?

As the title says, does the regex pattern (x|y)* match the same string as [xy]*?

A:

Yes, they match the exact same set of strings.
They are not equivalent.  (x|y)* sets a backreference, [xy]* doesn't.
Thus (?:x|y)* and [xy]* are equivalent in behavior, as neither sets a backreference.

A:

It's close to equivalent, but the first form makes a capture from the group delimited by ( ) that can be retrieved with $1 (for the first one) when the regex match.
If you want to avoid capturing, use
(?:re)

Where re is the regex.
Note
this only works if x and y are exactly x and y, not if they are general regexes
See Backtracking


Q:

How to 'pick' transactions to include when attempting to add a new block?

I saw this question about finding new transactions.
But how do you pick which transactions to include in the block you're trying to add? Should it be in a certain order, or random? How many transactions should you include? Looking at the blockchain I've seen anywhere from just a few, to hundreds. Is the number of transactions something you'd vary when pool-mining to combat exhausting all possible nonces if up-to-date with the timestamp header? (Loosely related to my other recent questions).

A:

Basically, you can include whichever transactions you'd like.
Currently most miners simply include all valid transactions they know of. It is cheap to do so.
There is currently a limit of 1 MB per block, so as transaction volume reaches these levels, miners will typically want to include transactions that have the best ratio of fee / data size.
As a more mature transaction fee framework evolves, miners will choose transactions to optimize for it.
Playing with transactions included is not needed to extend your work scope, as you can extend it indefinitely by changing the extraNonce.


Q:

get postgreSQL client computer name

Is there a way in postgres to SELECT the current clients name? I wish to create an audit field using the clients computer name.

A:

Yes.
select *
from pg_stat_activity
where pid = pg_backend_pid();

client_hostname And client_addr are relevant.
log_hostname needs enabling in order for the name to be resolved correctly. See this link:

By default, connection log messages only show the IP address of the
  connecting host. Turning this parameter on causes logging of the host
  name as well. Note that depending on your host name resolution setup
  this might impose a non-negligible performance penalty. This parameter
  can only be set in the postgresql.conf file or on the server command
  line.


Q:

Export SQL Server database from MySQL import

I have .net script access to a microsoft server and I need to synch the database on this end with a LAMP server on the other end. Currently I've written my own CSV export routine, and a matching importer, but it's creaking under the strain. Is there a more efficient way to go about this? Can I stream a CSV export direct to IIS somehow?
I know that if I had more privileges, I could run a BACKUP DATABASE command, then run the backup to the other server with FTP and hopefully find some way to import this into MySQL. However this is not an option.

A:

If MySQL is accessible from the MSSQL server then you can create a linked server within MSSQL and MERGE, INSERT, UPDATE or whatever into MySQL's tables from within MSSQL.

A:

I have done something similar. The easiest way would be to have a direct connection between your MSSQL server and MySQL server. You setup a linked server in MSSQL to the MySQL server and then use insert,update etc to do transactions to the Linked server. This is what ta.speot.is mentioned in his answer. However you dont have a direct link to the MySQL server so that option is not viable.
The other option would be to use MSSQL Service broker. With service broker you could queue individual updates, deletes and inserts to a webservice. This webservice could be hosted on IIS. The webservice would get called from the queue and then you can apply the individual transactions one at a time to the MySQL database. Service broker is a asynchronous messaging system embedded inside MSSQL 2005+. With it you can send messages to other servers, databases and even external services.
Just keep in mind the Service Broker architecture takes time to learn and implement. I have created custom replication architecture between mssql and mysql using service broker that handle 88 million plus transaction a day on a celeron laptop. It just took some serious elbow grease.
UPDATE
Seems like SQL2008 allows you to run Service Brokers outside of SQL server in some way. See this link http://blogs.msdn.com/b/sql_service_broker/archive/2008/11/21/announcing-service-broker-external-activator.aspx I dont know if this might be more up your street.

A:

You can code a script that has .NET DataReaders to open cursors on MS SQL and then using another connection that is connected to MySQL insert the data row by row. You can process all the tables sequentially.


Q:

How to show div for 10 seconds and then hide it

I have div block which comes on a mouseover of another div.
div1 img // mouse over shows div2.
I want to show div2 for 10 seconds and then hide it , can you please tell me how to achive this
Thanks

A:

$("#div1").mouseenter(function() {
    var $div2 = $("#div2");
    if ($div2.is(":visible")) { return; }
    $div2.show();
    setTimeout(function() {
        $div2.hide();
    }, 10000);
});

Another way to go:
$("#div1").mouseenter(function() {
    var $div2 = $("#div2");
    if ($div2.data("active")) { return; }
    $div2.show().data("active", true);
    setTimeout(function() {
        $div2.hide().data("active", false);
    }, 10000);
});

A:

Use jQuery's delay(n); method
http://api.jquery.com/delay/
 $(function() {
      $("#div1 img").hover(function(){
        $("#div2").show().delay( 10000 ).hide(0);
      });
    });

A:

The accepted answer is the only good one here.
I'm leaving an answer because most of the others fail for various reasons.
If you want to use .delay(), the item delayed needs to be part of the queue. The .hide() method is not. But if you give .hide() a duration, it is.
So you can do this:
var $div2 = $('#div2');

$('#div1').mouseenter(function() {
    $div2.show().delay( 10000 ).hide( 0 );
});

The 0 duration makes .hide() part of the queue. You don't want to use .hover() because it will fire once for mouseenter and once for mouseleave. This is not what was wanted.
Some of the answers using setTimeout() fail because if there are several mouseenter events, then several setTimeout() calls are made. The accepted answer gets around this.


Q:

How does the Hamming code work?

When transmitting data, the Hamming code apparently allows you to recreate data that has been corrupted over the wire (an error correcting code).
How does this work and what are its limitations, if any?
Are there any better solutions for error correction (as opposed to retransmission)? Are there circumstances where retransmission is better?

A:

Let's try to explain it a bit:
We have a 3 bit number. The possibilities can be presented as a cube where each bit represent an axis. The eight possibilities are on the corners.
000 --------001
 | \         | \
 | 100---------101
 |  |        |  |
 |  |        |  |
010-|-------011 |
   \|          \|
   110---------111

Each defect (for example 101 is read as 100) results in a shift on a line on the cube.
If we use two bits for the data and the third for a parity check (say for example even parity). We lose 4 datapoints. But it has the advantage that we can detect a single bit failure (which transforms an even count of 1's into an odd count of ones).
The odd numbers are marked with a *. And we see that each odd (wrongly transmitted) word is cornered by even (rightfully transmitted) words. So if we receive 100, we can be sure it is wrong.
But (with a single bit failure) the correct representation could have been 000, 101 or 110. So we can detect something has been wrong but we cannot detect what was wrong:
 000 -------*001
  | \         | \
  |*100---------101
  |  |        |  |
  |  |        |  |
*010-|-------011 |
    \|          \|
    110--------*111

This is called a one bit error detecting code.
If we use another bit for checking and thus remove one for the data. We are left with 1 databit and 2 "check bits".
In this case, lets assume 000 and 111 are valid data representations and the other six are not. Now we have an interesting situation if one bit is mangled during transport.
If we send 000 and receive 010, we see that 010 has one valid neighbor (000) and two invalid ones (110 and 011). So now we know that we intended to send 000 and are able to correct that:
 000 -------*001
  | \         | \
  |*100--------*101
  |  |        |  |
  |  |        |  |
*010-|------*011 |
    \|          \|
   *110---------111

This is called a one bit error correcting code.
Please note that a one bit error correcting code is also a two bit error detecting code.
And to put it more generally.
If you have n check bits, you have a n bit error detecting code.
If you have 2n check bits, you have a n bit error correcting code.
Of course you should order the "valid" codes so that they do not border on each other.

A:

Here's the really high-level overview.
Suppose that every time I send a message, I send thrie copies of the text.
Suppose that every time I send z message, I send three copies of the teyt.
Suppose that every tyme I send a message, I send three copies if the tezt.

By comparing characters and taking a simple majority vote in each position, you can correct single erroneous characters. However the cost of this scheme (amount of data that must be sent) is high, and it doesn't catch the unlikely-but-possible case of two errors in corresponding positions of different copies (as in the last word of the sample above).
Hamming codes (and other kinds of error-correcting codes, such as Reed-Solomon) are based on formulas that compute the extra data (rather than simple duplication). The added bits depend on combinations of the data bits in a way that errors in copying make detectable patterns of changes when the computation is repeated at the receiving end.
For sake of illustration, let's start with simple odd parity, adding a single bit to ensure that the total number of bits in a message is odd. So the message 10110110 becomes 101101100 (five 1s, no extra 1 needed) and the message 10010110 becomes 100101101 (four 1s, extra 1 needed). If you receive a message of 101101101 and see that there are six 1s, you know that there's an error, but don't know where. Suppose we add more parity bits, each on depending only on a part of the message, as illustrated below by copying the bits considered and using '-' for bits ignored:
10110110
1-1-0-1- => 0
-0-1-1-0 =>  1
10--01-- =>   1
--11--10 =>    0
1011---- =>     0
----0110 =>      1

so the complete message is 10110110011001. Now suppose a transmission error changes the third bit in the message, so that it reads 10010110011001. When the receiver re-runs the error-checking computation, it fails to match:
10010110
1-0-0-1- => 1*
-0-1-1-0 =>  1
10--01-- =>   1
--01--10 =>    1*
1001---- =>     1*
----0110 =>      1

and the check bits that fail to match are exactly the ones affected by the third data bit. This is not a real, robust error-correction scheme; it's just a sketch to illustrate how building in redundancy can help in identifying the exact nature of an error.

A:

You will find details on the way it works here
More general information about Error Corecting Codes is available here


Q:

Load time in dropdown and save it in mysql database

I want to load date and time in dropdown box.If current day is selected, time should start 2 hours from now. So far, I have loaded the date and time. One problem is that, when I select the next day, it not showing from start time. Also when I save the field to mysql database, it just saves first time alone. Suppose if the time selected is 18:00-19:00, It only saves 18. I have used varchar field.
So far my work are
<script type="text/javascript">
    $( document ).ready(function() {
        var d = new Date();
        var hour = d.getHours()+2;
        $('#timeInterval option[value="'+hour+'"]').prop('selected', true);
    });
    $(".form-control[name=dtime]").change(function(){
       selDate = $(this).children(":selected").val();
       var d = new Date();
       var month = d.getMonth()+1;
       var day = d.getDate();
       var hour = d.getHours()+2;

       var curDate = (day<10 ? '0' : '') + day + '-' +
        (month<10 ? '0' : '') + month + '-' +
        d.getFullYear();

       // If selected date is equal to the current Date
        if(selDate != curDate){
            $('#timeInterval option:eq(0)').prop('selected', true); // Select 9:00 AM
        }else {
            $('#timeInterval option[value="'+hour+'"]').prop('selected', true); // Select the next 2 Hours
    });
</script>

<select class="form-control"  name="dtime" onchange="javascript:valueselect(this)" >
<option value="<?php echo date('d-m-Y') ;?>"><?php echo date("d-m-Y", time()) ;?></option>
<option value="<?php echo date("d-m-Y", time()+86400) ;?>"><?php echo date("d-m-Y", time()+86400) ;?></option>
<option value="<?php echo date("d-m-Y", time()+172800) ;?>"><?php echo date("d-m-Y", time()+172800) ;?></option>
</select>
<?php
    echo "<select name='dnotes' id='timeInterval'>";
    $now = new DateTime();
    $s1=$now->format('H')+2;
    $starttime='09:00';
    $endtime='23:00';
$start    = new DateTime($starttime);
$end      = new DateTime($endtime);
$interval = new DateInterval('PT1H'); // Set the interval to One hour
$period   = new DatePeriod($start, $interval, $end);

foreach ($period as $dt)
{
    $dt2 = clone $dt;
    $dt2->add(new DateInterval('PT1H')); // Add One hour
    echo '<option type="time" value="'.$dt->format("G").'">'.$dt->format('H:i').' - '.$dt2->format('H:i').' </option><br />';
}
echo "</select>";
?>

A:

Your value field of option tag has $dt->format("G")
Shouldn't it be $dt->format('H:i').' - '.$dt2->format('H:i') ?


Q:

UDP packet separation

I'm creating an UDP service on andorid.
For clarity part of the code copied here:
    byte[] message = new byte[1500];
    DatagramPacket packet = new DatagramPacket(message, message.length);
    socket = new DatagramSocket(Constants.LISTENING_PORT_NUMBER);
    socket.receive(packet);

Problem is that I'm receiving UDP packets continuously.
For example packet #1 (250 byte long), packet #2 (182 byte long), packet #3 (403 byte long) etc...
I need to get and process the separate UDP packets which has variable length.
According to UDP protocol specification UDP packets has message boundaries defined.
However I found no solution in Java which can separate UDP packets.
In my current solution I have to define the packet length which I must read, but I don't know the packet length before I receive it.
Am I missing a point?

EDIT:
Thanks for both Tobias and shazin both are correct answers. Sad I cant's mark two answer as correct.
The socket.receive(packet); will receive until the UDP packet boundary, subsequent packages can be read with another socket.receive(packet);.
My problem should be that during the process of the first message the arrived further messages are not processed because of synchronous processing, now I'll pass the message processing to an async task and hopefully will be able to catch all arrived packets in time.

A:

Maybe I'm missing something here, but a DatagramPacket is one packet that is sent. It has the getLength() and getOffset() methods require to get to the data. I believe that there is also a getData() that returns the data sent.
Here you have a link That can help you further.


Q:

RoR -- NoMethodError: private method `open' called for Gem::Package:Class

Hey does anyone know what this error message means? I installed ruby from source then proceeded to install rubygems, and then installed rails via gem install rails
After creating a new project, I did a bundle install and got this error:

mark@mark-laptop:~/guide/first_app$ sudo bundle install Fetching
  source index for https://rubygems.org/
NoMethodError: private method open' called for Gem::Package:Class An
  error occured while installing rake (0.9.2.2), and Bundler cannot
  continue. Make sure thatgem install rake -v '0.9.2.2'` succeeds
  before bundling.

I did that command (gem install rake -v '0.9.2.2') and it worked fine.. I'm rather confused

A:

Try gem install bundler to install/update bundler after installing/updating rubygems.
It worked for me when I had your problem.

A:

This appears to be a bug in the master branch of rubygems from GitHub. If you grab an archive of 1.8.24 from http://rubygems.org/pages/download instead, everything works fine.

A:

I have rubygems 2.0.3 and I get the same error. I deleted gemfile.lock file in the project. Only change I got in error is
From
Make sure that gem install rake -v '0.9.2.2' succeeds before bundling.
Changed to
Make sure that gem install rake -v '10.0.3' succeeds before bundling.
The new gem install rake also worked for me.


Q:

How do I announce my presence to someone who is not aware of it without frightening them?

First of all, I'm not sneaking up on people on purpose. But it seems, that I'm quite Ninja-like in my movements and this has caused problems. People are immersed in something (e. g. computer, TV, music etc.) and I want to interact with them in some way, but whatever I do, it frightens them terribly.
Situation
One sample situation is my visit to aunt "Alice". She is about 60 years old and sits in the living room, reading a good book. I need to ask her something. In order to reach her, I even have to walk down old stairs and hope that I make enough noise. But I don't. So finally I stand in the living room (Alice is facing away from the door) right behind her. She has absolutely no idea of my presence. *What shall I do now?"
If I pat her on the shoulder or say something or walk into her line of sight, I scare the living daylights out of her. But I don't want to. Is there even a way out?
I'm not sure that it is always entirely my fault, e. g. when someone is listening to music wearing headhones (also already encountered). I'm not trying hard to move silently and stamping can also become annoying. So far, I have found no way out.
Question
How do I announce my presence to someone who is not aware of it?
My goal is to establish communication without frightening them too much.
I'm looking for verbal or non-verbal cues and strategies. The starting point is the moment I stand behind them (but not necessarily, if you have a totally different idea), since only then do I know that they are not aware of my presence.

A:

If you have a wall near enough, you can always knock on it. It also works with other stuff, like a table. I never tried with floors, but maybe it also works.

What I wrote is based on my own experience, and for me knocking on the wall or on some nearby furniture works better than saying something or making an *ahem * noise behind the person. For example, I got used to knock on the wall to let my bachelor thesis tutor know I wanted something, because acknowledging my presence verbally used to scare him a lot. In the rare cases someone did this to me (knocking instead of talking), I just noticed his presence without being frightened.
I have been searching for an explanation on why knocking works better than speaking or calling, but I found none. My guess is that this works in part because on how the sound is transmitted via something solid instead through air, and it becomes in part something felt. Maybe in part also because of how sound behaves, but it is just a guess.

A:

Right off the bat, I see some possibilities. I have some experience in this because I still live with my parents and when I am gaming with my headset I just don't hear them and since I'm focused on what I'm doing I don't notice them either, just like your example.
The trick commonly used is to flash the room's lights, when applicable, while calling for the person at the same time. Although, they sometimes scare me by coming close to me at night when I have all lights off and slam my desk while calling for me. That's a no-go :)
If you see that's too much for Alice or that she can hear you clearly (no sound impairing environment like the headphones' problem), you knock on the living room's door before reaching up to her, this way she does not get scared by an unexpected close voice or person. A material sound, if not too harsh, does not scare a person like sneaking up on somebody.
Best of luck!

A:

It is pretty traditional in this circumstance to affect a small cough or clearing of the throat. (Usually written as "ahem".) This might cause the person to jump, but probably less so than suddenly touching them.
If that doesn't work, try "Excuse me — sorry to interrupt." Again, they might be a bit startled, but you've already apologized.
If you're coming into a room with an open door, and the occupant doesn't notice you, you could still knock lightly on the door or doorframe and wait to enter. This too might cause a small start, but you've acted politely and within social norms. Follow up with "sorry to startle you", if necessary.
This is all completely normal; I think going much beyond this is over-thinking and over-complicating.


Q:

Not understanding this setTimeout in JS

I thought I understood how the setTimeout method worked, but this is confusing me.
test.html (I'm purposefully loading the test.js file before the jQuery file for demonstration. Let's say the jQuery file is hosted locally).

// ...code

// ...code

test.js
$('#area').text('hello');

I understand in this case "hello" won't get printed on the browser because jQuery is being loaded after the test.js file. Switching the order of these files solves the problem. But if I leave the order alone, and alter the test.js file, a setTimeout makes it work:
function wait() {
    if(window.jQuery) {
        $('#area').text("hello");
    }
    else
    {
        setTimeout(wait, 10);
    }
}

wait();

In this case the "hello" text gets printed on the browser. But I'm sort of scratching my head because somehow the jQuery file does get loaded. But how?  Why doesn't the test.js file get caught in an infinite loop forever checking to see if jQuery has loaded? I'd be grateful for some insight on the mechanics of what's going on.

A:

There would be an infinite loop if jQuery never loaded. But in the normal case:

The first time through, jQuery isn't loaded, so we setTimeout()
1a. Other things happen in the meantime, including loading of resources like jQuery
10ms later, we check again.
Is jQuery loaded now? If not, set a timeout and go back to step two
After some number of retries, jQuery does load, and we're off.

The better way to do all of this, of course, would be to

Load jQuery first
Run your wait() function in a ready() handler so it doesn't run until it's needed.

// test.js
$(document).ready(
  function()
  {
     $('#area').text("hello");
  }
);

A:

Why doesn't the test.js file get caught in an infinite loop forever checking to see if jQuery has loaded?

setTimeout works asynchronously. It does not pause the browser. It simply asks it to execute a certain function after a certain amount of milliseconds.
jquery.js gets loaded and executed inbetween wait() invocations.


Q:

Could there be any issues using "ns" as a subdomain?

I want to setup a subdomain "ns" on my domain, but before I do want to double check if there could be any potential issues using such a subdomain.
For example ns.mywebsite.com
To my knowledge, there shouldn't be, but I know a lot of nameservers are just named ns#.domain.com (e.g. ns1.domain.com ns2.domain.com) so I don't know if that could cause any issues.

A:

Some subdomains are reserved for specific purposes in DNS, like _domainkey for email authentication.
That being said, I don't believe that ns is one of those reserved subdomains, so you should be able to use it for whatever you want.
Actually, after doing some more research it seems like as long as you stay away from underscores, you should be fine. (Underscores for actual hostnames seem to cause trouble anyways.)


Q:

UIImagePickerController in TabBarController

I am trying to implement the imagepickercontroller inside a UITabBarController. So far, so good....
In my ViewController, where I initiate the imagePickerController and then place in my TabBarViewController tabbar array, I implemented the "loadview" method:
- (void)loadView{
    self.arController = [[IFAugmentRealityController alloc] initWithViewController:self];
    [self showCamera];
    [self initOverlayController];
    self.picker.delegate = self;
    [self.view addSubview:self.picker.view];

}

- (void)initOverlayController {
    overlay = [[IFAROverlayView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
    overlay.delegate = self;
}

- (void)showCamera {
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.navigationBarHidden = YES;
    self.picker.toolbarHidden = YES;
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.showsCameraControls = NO;
    self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
    self.picker.cameraOverlayView = overlay;
}

But when I run the app, the app seems to create an inifite loop within the loadView method, and the tabbar does not react anymore. Did I miss something out?
I do not want the ImagePickerController to be fullscreen and pushed with the "presentviewcontroller" method, but loaded as a "normal" view inside one of the tabs.
So my questions are:
1) should I rather use "viewdidload" instead of "loadview"? Because with viewdidload it seems to be working
2) But when using viewdidload I can't fix the frame in which the imagepicker should be shown. There is always a black bar under the video screen and above the tabBar.
Thanks a lot!!

A:

I think the infinite loop is coming in when you send the -addSubview message to self.view before setting the view itself with something like self.view = [[UIView alloc] initWithFrame:someFrame]; because, technically, while in loadView you're supposed to be setting the view controller's view.
If self.view is nil and you try to send it messages, -loadView is called again, resulting in the infinite loop.


Q:

In Eclipse running a Java EE Web Server "Servlet" on Tomcat project attempts to deploy extraneous directories

I have a normal Java EE Servlet on Tomcat project in Eclipse.  When I start the Tomcat server (before I even start running the Servlet) inside Eclipse it attempts to deploy a web application directory for everything in my D: drive.  It even attempts to deploy a web application on the D:\$RECYCLE.BIN directory.  Then says it finished.
Here's an image of the project organization in Eclipse.

Can anyone guess what setting or xml directive is making it do this?
Dec 27, 2018 1:27:51 PM org.apache.catalina.core.StandardEngine startInternal

INFO: Starting Servlet Engine: Apache Tomcat/8.0.36

Dec 27, 2018 1:27:55 PM org.apache.jasper.servlet.TldScanner scanJars

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Dec 27, 2018 1:27:58 PM org.apache.jasper.servlet.TldScanner scanJars

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Dec 27, 2018 1:27:58 PM org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory D:\$RECYCLE.BIN

Dec 27, 2018 1:27:59 PM org.apache.jasper.servlet.TldScanner scanJars

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Dec 27, 2018 1:27:59 PM org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deployment of web application directory D:\$RECYCLE.BIN has finished in 1,124 ms

Dec 27, 2018 1:27:59 PM org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory D:\Customers

Dec 27, 2018 1:28:00 PM org.apache.jasper.servlet.TldScanner scanJars

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Dec 27, 2018 1:28:00 PM org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deployment of web application directory D:\Customers has finished in 927 ms

A:

I can't explain why this consistent mis-configuration happens but here is how to fix it.  Find your 'server.xml' file in your Eclipse Workspace folder.  If you find more than one then avoid the one inside a 'tmp0' directory and do not get confused with 'servers.xml'.
Find the 'Host' property and set the 'appBase' to the directory where your Web App is located and / or set 'autoDeploy' to 'false'.
I do not know why but whenever I added a Tomcat server in the Eclipse Workspace it automatically set 'appBase' to 'D:\' and 'autoDeploy' to 'true'.  I tried reinstalling Eclipse, creating new workspaces from scratch.  It was always the same result.  As such it searched every folder in my D drive for a Web App to run.


Q:

Run-time error 91: Object variable or With block variable not set

I'm using Access 2010 VBA that is returning a recordset from an IBM iSeries.  I have the following loop to append the recordset to a local table:
'Loop through recordset and place values
    Do While rsti401.EOF = False
Set rst401 = CurrentDb.OpenRecordset("tblLocal_SL401WK", dbOpenDynaset, dbSeeChanges)
With rst401
    .AddNew
    .Fields("PC") = rsti401.Fields("PC")
    .Fields("TIME") = rsti401.Fields("TIME")
    .Fields("CONO") = rsti401.Fields("CONO")
    .Fields("STYCOL") = rsti401.Fields("STYCOL")
    .Fields("WHSE") = rsti401.Fields("WHSE")
    .Fields("CUNO") = rsti401.Fields("CUNO")
    .Fields("SIZE01") = rsti401.Fields("SIZE01")
    .Fields("SIZE02") = rsti401.Fields("SIZE02")
    .Fields("SIZE03") = rsti401.Fields("SIZE03")
    .Fields("SIZE04") = rsti401.Fields("SIZE04")
    .Fields("SIZE05") = rsti401.Fields("SIZE05")
    .Fields("SIZE06") = rsti401.Fields("SIZE06")
    .Fields("SIZE07") = rsti401.Fields("SIZE07")
    .Fields("SIZE08") = rsti401.Fields("SIZE08")
    .Fields("SIZE09") = rsti401.Fields("SIZE09")
    .Fields("SIZE10") = rsti401.Fields("SIZE10")
    .Fields("SIZE11") = rsti401.Fields("SIZE11")
    .Fields("SIZE12") = rsti401.Fields("SIZE12")
    .Fields("SIZE13") = rsti401.Fields("SIZE13")
    .Fields("SIZE14") = rsti401.Fields("SIZE14")
    .Fields("SIZE15") = rsti401.Fields("SIZE15")
    .Fields("BQTY01") = rsti401.Fields("BQTY01")
    .Fields("BQTY02") = rsti401.Fields("BQTY02")
    .Fields("BQTY03") = rsti401.Fields("BQTY03")
    .Fields("BQTY04") = rsti401.Fields("BQTY04")
    .Fields("BQTY05") = rsti401.Fields("BQTY05")
    .Fields("BQTY06") = rsti401.Fields("BQTY06")
    .Fields("BQTY07") = rsti401.Fields("BQTY07")
    .Fields("BQTY08") = rsti401.Fields("BQTY08")
    .Fields("BQTY09") = rsti401.Fields("BQTY09")
    .Fields("BQTY10") = rsti401.Fields("BQTY10")
    .Fields("BQTY11") = rsti401.Fields("BQTY11")
    .Fields("BQTY12") = rsti401.Fields("BQTY12")
    .Fields("BQTY13") = rsti401.Fields("BQTY13")
    .Fields("BQTY14") = rsti401.Fields("BQTY14")
    .Fields("BQTY15") = rsti401.Fields("BQTY15")
.Update
End With
rsti401.MoveNext
Loop

'close connections
rsti401.Close
rst401.Close
IBM.Close

Set IBM = Nothing
Set rst401 = Nothing
Set rsti401 = Nothing
Set CMD = Nothing

However, each time I run it I is stopping at the following line:
rst401.Close

With error 'Run-time error 91'.  I can't work it out.  I've set rst401 at the beginning, so why am I still getting the error.
Any pointers would be a great help.
Thanks,
Michael

A:

The problem you have is because the rst401 is set inside the Do While Loop, and you are trying to close an object that has lost its scope outside the Loop. Suggest you make the following changes.
'Loop through recordset and place values
Set rst401 = CurrentDb.OpenRecordset("tblLocal_SL401WK", dbOpenDynaset, dbSeeChanges)

Do While rsti401.EOF = False
    With rst401
        .AddNew
        .Fields("PC") = rsti401.Fields("PC")
        .Fields("TIME") = rsti401.Fields("TIME")
        .Fields("CONO") = rsti401.Fields("CONO")
        .Fields("STYCOL") = rsti401.Fields("STYCOL")
        .Fields("WHSE") = rsti401.Fields("WHSE")
        .Fields("CUNO") = rsti401.Fields("CUNO")
        .Fields("SIZE01") = rsti401.Fields("SIZE01")
        .Fields("SIZE02") = rsti401.Fields("SIZE02")
        .Fields("SIZE03") = rsti401.Fields("SIZE03")
        .Fields("SIZE04") = rsti401.Fields("SIZE04")
        .Fields("SIZE05") = rsti401.Fields("SIZE05")
        .Fields("SIZE06") = rsti401.Fields("SIZE06")
        .Fields("SIZE07") = rsti401.Fields("SIZE07")
        .Fields("SIZE08") = rsti401.Fields("SIZE08")
        .Fields("SIZE09") = rsti401.Fields("SIZE09")
        .Fields("SIZE10") = rsti401.Fields("SIZE10")
        .Fields("SIZE11") = rsti401.Fields("SIZE11")
        .Fields("SIZE12") = rsti401.Fields("SIZE12")
        .Fields("SIZE13") = rsti401.Fields("SIZE13")
        .Fields("SIZE14") = rsti401.Fields("SIZE14")
        .Fields("SIZE15") = rsti401.Fields("SIZE15")
        .Fields("BQTY01") = rsti401.Fields("BQTY01")
        .Fields("BQTY02") = rsti401.Fields("BQTY02")
        .Fields("BQTY03") = rsti401.Fields("BQTY03")
        .Fields("BQTY04") = rsti401.Fields("BQTY04")
        .Fields("BQTY05") = rsti401.Fields("BQTY05")
        .Fields("BQTY06") = rsti401.Fields("BQTY06")
        .Fields("BQTY07") = rsti401.Fields("BQTY07")
        .Fields("BQTY08") = rsti401.Fields("BQTY08")
        .Fields("BQTY09") = rsti401.Fields("BQTY09")
        .Fields("BQTY10") = rsti401.Fields("BQTY10")
        .Fields("BQTY11") = rsti401.Fields("BQTY11")
        .Fields("BQTY12") = rsti401.Fields("BQTY12")
        .Fields("BQTY13") = rsti401.Fields("BQTY13")
        .Fields("BQTY14") = rsti401.Fields("BQTY14")
        .Fields("BQTY15") = rsti401.Fields("BQTY15")
        .Update
    End With
    rsti401.MoveNext
Loop

'close connections
rsti401.Close
rst401.Close
IBM.Close

Set IBM = Nothing
Set rst401 = Nothing
Set rsti401 = Nothing
Set CMD = Nothing


Q:

Scala Spark - Mapping values of tuple to single

I'm trying to map some data looking like this: ("en",(20340,302)) (so a tuple of a string and a tuple: (String, (Int, Int)) ) into data looking like this: (String, Int/Int) (so the example output would be ("en", 67 ) ). What is the syntax for this?
val new = old.map(a,(b,c) => (a, b/c) )
is what I tried to do, is not working though.

A:

val new = old.map { case (a,(b,c)) => (a, b/c) }

Which is syntactic sugar for:
val new = old.map(t => t match {
  case (a,(b,c)) => (a, b/c)
})

or an uglier version:
val new = old.map(t => (t._1, t._2._1/t._2._2))


Q:

Sitecom Wireless Network USB Micro Adapter Problem

I have problem with Sitecom Wireless Network USB Micro Adapter 300N WL-364. I use Ubuntu 10.10 64bit and it does not recognize any drivers for this model. What I did so far:

used ndiswrapper to install drivers from windows'
updated the kernel

In ndiswrapper I have some improvements. At least ubuntu recognize the adapter. But when it comes to scan, it just freezed and I had to restart PC.
How can I solve my problem?
Thank you

A:

My guess is that you are using a new Realtek chipset for this device, which is well supported in Ubuntu 11.04.
What (really easy) options do you have?

You can boot with Ubuntu 11.04 (beta2) and see whether the wireless card will be picked up automatically. If it does, then the new kernel fixes the problem.
You can install the latest kernel for Ubuntu 10.10 if you use the PPA at
https://launchpad.net/~kernel-ppa/+archive/ppa
You need to do some reading to make sure that all are OK, and installing a kernel from a PPA is not as well-tested as the main kernels.
Wait for Ubuntu 11.04 when it comes in about ten days and try it out.


Q:

Unity3D setting blend mode in shader using vertex data

I'm porting a game from iOS / Obj-C / OpenGL ES 2.0 to Unity.
I have a procedural mesh script that generates a batch of quads that need to blend together to create a game board.  Some of the quads add a highlight effect, others on top of those darken the scene.  This is handled with the blend mode and the color of the object.
In the old version I did things inefficiently and just drew each quad individually, as needed setting the blend mode (glBlendFunc) and a color uniform.  I batched similar things as I could.
In Unity3D rather than having 500 sprite gameObjects which IMO would be difficult to manage.  I have one gameObject with a mesh = one draw call. I use per vertex color attribute instead of a uniform to set colors for each quad/sprite.  But I want to also set the blend mode per quad by using vertex data.  I'm sending the blend mode as uv2 data.
I found this question.  See the second answer: http://answers.unity3d.com/questions/399074/change-blend-mode-from-outside-shader.html
Which says you can do this:
Pass {
    Blend [MySrcMode] [MyDstMode]
}

But in the example MySrcMode and MyDstMode are shader properties (uniforms) and again would set the blend mode for the entire draw call.  I want to change it per quad which would have to be done per fragment.
I understand GLSL shaders.  They make sense to me.  But Unity shaders are still a bit mysterious.  The unity docs aren't getting through to me and I can't find any good tutorials on really how they work and what gets called in what order.  I tried:
Blend [texcoord1.x] [texcoord1.y]

But that didn't work. (Meaning that it's not getting a value for texcoord1 there.) My Blend is above the Pass{}.  Moving it inside the Pass either is the same or produces an error depending where it goes.
My other option would be to do something like a gl_LastFragData to fetch the current fragment and do my own per fragment blending.
Or do I have to pull out the quads that use a different blending into another game object.  Which would mean having geometry sorted into game objects based on their blending mode and not their behavior or the script that creates and manages them.

A:

If I have understood your approach, instead of drawing let's say a grid on nxn quads, you are building a mesh from all that quads and trying to render it with a single draw call, right?
Storing sprite colors into vertex color attributes it's fine, and that's a rather common approach.
For what concern blending (and not considering gl_LastFragData), you can't specify a different blend mode without using an additional drawcall neither on plain OpenGL, am I wrong?
In other words, you should setup different blend modes using glBlend in between drawing indexed primitives(glDrawElements), if all vertices are store inside the same VBO or VAO. Am I wrong?

But Unity shaders are still a bit mysterious. The unity docs aren't
  getting through to me and I can't find any good tutorials on really
  how they work and what gets called in what order. I tried:

Even if blend options (and lot of other stuff such as stencil test, depth test,..) are stored inside unity .shader files, their aren't compiled into shader code. AFAIK are just "meta data", used by the engine to setup blend modes just before the drawcall with the real compiled shader(that under the hood is just Cg or GLSL).
I guess the minimum number of draw call correspond to the different blend mode you need to support.
When you generate it and set the indices you can specify the submesh index they belong to. At each submesh you can (maybe must), assign a different material (that can have a different shader accordingly to the required blend mode).
Assuming you are using a single pass shader, you can have one draw call for each material. If you have multiple static meshes with the same materials, then unity can batch them together.
If you have multiple dynamic meshes, than you can consider using Graphics.DrawMesh with MaterialPropertyBlock in order to minimize state changes. (More drawcall, but cheaper due to less GPU state changes)
hope this helps


Q:

Storing duplicate fields: good or bad

Let's say a user has posts table like this:

Post with id=1 is the first post that a user has posted. Post with an id=2 – is the edit that was made to the post, with id=3 – latest current version of the post.
post_param_a cannot be changed throughout versions, as well as user_id – they always stay the same since the first version. So we could store it like this:

So the question is: would it be better to store it the second way, with no duplication? This way, to get a current version of user's post we'd have to join the first version and check its user_id all the time. Or is it okay to store duplicate fields in this case?
p.s. this is questioned because we want to avoid duplication and accident changes of values that cannot be changed throughout versions, so we want to be storing them all in one place

A:

Take the entity Post and look at the simple tuple:
ID  User_ID  Post_Param_A  Comment
 1       69           foo  This is a post

This is perfectly normalized. However, the post may undergo editing and you want to track the changes made. So you add another field to track the changes. Instead of an incremental value, however, it would make more sense to add a datetime field.
ID  EffDate       User_ID  Post_Param_A  Comment
 1  1/1/16 12:00       69           foo  This is a post

This has two advantages: 1) if you track the changes, you will want to know anyway when this version was saved and 2) you don't have to find the largest incremental value for the post to find out what value to save with each new version. Just save the current date and time.
However, with either an incremental value or date, there is a problem. In the simple row, each field has a function dependency on the PK. In the version row, User_ID and Post_Param_A maintain their dependency on the PK but Comment is now dependent on the PK and EffDate.
The tuple is no longer in 2nf.
So the solution is a simple matter of normalizing it:
ID  User_ID  Post_Param_A
 1       69           foo

ID  EffDate        Comment
 1  1/1/16 12:00  This is a post
 1  1/1/17 12:00  An edit was made
 1  1/1/17 15:00  The last and current version (so far)

with (ID, EffDate) the composite PK in the new table.
The query to read the latest post is a bit complicated:
select  p.ID, v.EffDate, p.User_ID, p.Post_Param_A, v.Comment
  from  Posts p
  join  PostVersions v
    on  v.ID = p.ID
   and  v.EffDate = (
        select  Max( v1.EffDate )
          from  PostVersions v1
         where  v1.ID = p.ID
           and  v1.EffDate <= today )
   and  p.ID = 1;

This is not really as complicated as it looks and it is impressively fast. The really neat feature is -- if you replace "today" with, say, 1/1/17 13:00, the result will be the second version. So you can query the present or the past using the same query.
Another neat feature is achieved by creating a view from the "today" query with the last line ("and  p.ID = 1") removed. This view will expose the latest version of all posts. Create triggers on the view and this allows the apps that are only interested in the current version to do their work without consideration of the underlying structure.


Q:

cannot import name 'CredentialsFileSymbolicLinkError'

I install pydrive using pip3 with --user. When trying to run an example script, I get the following error:
$ python3 quick.py
Traceback (most recent call last):
  File "quick.py", line 1, in <module>
    from pydrive.drive import GoogleAuth
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/drive.py", line 2, in <module>
    from .files import GoogleDriveFile
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/files.py", line 12, in <module>
    from .auth import LoadAuth
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/auth.py", line 15, in <module>
    from oauth2client.file import CredentialsFileSymbolicLinkError
ImportError: cannot import name 'CredentialsFileSymbolicLinkError'

What I tried doing was manually editing oauth2client's file.py and adding the missing exception from the github repo (line 32). However, then I encountered an Import error, that there is no module named oauth2client.util. Pydrive's auth.py imports scopes_to_string from oauth2client.util. I checked the oauth2client package folder, and util.py was not present.
I then uninstalled pydrive, oauth2client and google-api-python-client using pip and pip3. Then I installed pydrive agian, this time also with --no-cache-dir. Again the CredentialFile... error was thrown. I don't know how to proceed further.
I don't want to spend days figuring how to go about installing packages, that time be better spend writing code. :(
What I observed that the github repo differed quite a bit from the package files on my system.
Edit: There seem to be two oauth2client packages this and this
Edit: This is bug and is being tracked

A:

If you're experiencing this issue pydrive needs to be updated to a version >= 1.3.1.
Using pip from a command prompt:
pip install pydrive --upgrade

Just submitting this as an answer so that we can mark this as solved/answered.


Q:

How should journalists report about unpublished studies?

In recent times it has become more and more commonplace for journalists to present the results from studies which have not been published or peer-reviewed – without any reservations or warnings.

From a practical ethics standpoint is this something a journalist should do? What circumstances could justify it?
Is it even correct to describe such studies with phrases like “Researches at university X found that, ...”? Without peer-review there has not even been a basic sanity-check. In the case of an unpublished study, criticism is extremely difficult.
Should journalists avoid reporting about such studies alltogether? If not, how should they do it, considering their readers are mostly non-scientists? Probably some don't understand the significance of a study not being peer-reviewed or not even published.

A:

We shouldn't put peer reviewed studies on a pedestal.  The replication crisis unfolding in biomedical research, neuroscience, psychology, and other fields is largely about researchers trying to game the peer review system.  At the same time, researchers in physics, biology, and social science frequently post working drafts on preprint sites, such as http://arXiv.org, http://biorXiv.org, and http://SSRN.com.  Some of these sites are event experimenting with postpublication review, where reviewers post comments and recommend changes after the paper has gone public.  (More here:  http://www.the-scientist.com/?articles.view/articleNo/37969/title/Post-Publication-Peer-Review-Mainstreamed/)
In general, "researchers at university X found that ..." is going to overstate things, unless the "..." is about the particular observations that were made:  "researchers at university X found that 7 of 13 participants preferred chocolate with peanut butter instead of jelly."  Generalizations should be supported by several studies, preferably done by different groups of researchers over a period of time.
I would recommend that journalists emphasize methods and context rather than findings.  In other words, first, science journalists should help readers understand how a study was done.  Was this an experiment, a field study, or based on historical data?  What techniques were used to produce the data, and how were the data analyzed?  What assumptions did the study rely on?  What limitations did it have?
Second, science journalists should help readers understand the scientific and social significance of the study.  What other research has been done in the area?  Does this study conflict or agree with that research?  What disagreements do researchers in the field have?  What arguments do they give for their views?  Does the study have immediate commercial, policy, clinical, or social implications, or are the implications of the research more vague or long-term?  (Very little "cancer research" is designed to directly produce new treatments.)  If the research is socially controversial, what other factors ("besides the science") are contributing to the controversy?


Q:

How to remove unnecessary blank line on code formatting in Android Studio

Is it possible to remove unnecessary blank line on code formatting in Android Studio?

A:

Yes. It is possible to configure the number of blank lines in the settings menu : File -> Other Settings -> Default Settings... -> Code Style -> Java(or whatever your language is) -> Blank Lines


Q:

USB hub circuit

I have a custom made USB hub with 4 USB ports. It gets 5V  max 500mA. Below is the datasheet for the hub chip
http://minipcsale.ru/images/Minix-Neo-X8-h/GL852G.pdf
now my question is

If i connect 4 USB devices each consuming 500mA to this hub, the total  current consumption will be 2A. In which case, the hub will not work with the current power supply. Am i correct?
What is that i need to do in order to make sure each USB port gets a maximum of 600mA power supply?

A:

The Genesys Logic GL852G hub integrated circuit does not deal with the power supplied by the USB hub to downstream devices. That is handled separately on the USB hub PCB.
Most low-cost USB hub implementations I have seen do not bother to limit the per-port current draw. On such USB hub PCBs, the input 5V power source connects directly to the downward-facing USB connectors.
If you want 4 connected downstream devices to each be able to draw 600mA, your power supply must provide at least approximately 2.5A, and your custom USB hub PCB must be designed to handle that amount of current. You will have to look at the USB hub PCB schematic and layout to decide if that is the case.
Some notes:
The GL852G itself consumes a comparatively small amount of current, see the GL852G datasheet page 30.
The USB standard requires that each downstream port VBUS supply have specified capacitance. Off the top of my head I think it is 120uF. If the USB hub PCB includes the required capacitance, your power supply will see all the capacitors in parallel. You will want to make sure that your power supply can handle that total capacitance.
If you check the schematic, also check the Bill of Materials (BOM). On a custom USB hub for me, I noticed that on the schematic, some capacitor values seemed incorrect. The BOM showed that during manufacturing, the correct capacitors were installed. I had the supplier fix the schematic.


Q:

WORD VBA Count Wildcard Search Hits

Hi i have the codes below that is already working perfectly. What i can't figure out is how to count the number of times a wildcard search finds a match. Can anyone tell me how i can go about this? The codes are as follows:
Sub findfunction()
If (findHL(activedocument.Content, "[aeiou]")) = True Then MsgBox "Highlight vowels   Done", vbInformation + vbOKOnly, "Vowels Highlight Result"
If (findHL(activedocument.Range, "<wa*>")) = True Then MsgBox "Highlight words beginning with WA", vbInformation + vbOKOnly, "Prefix Find Result"
End Sub

Function findHL(r As Range, s As String) As Boolean
Options.DefaultHighlightColorIndex = wdRed
r.Find.Replacement.highlight = True
r.Find.Execute FindText:=s, MatchWildcards:=True, Wrap:=wdFindContinue, Format:=True,  replace:=wdReplaceAll

findHL = True
End Function

Any help would greatly be appreciated. Thanks guys!

A:

I think you just need a static Counter field defined at the top of your module - i.e. not within any sub or function (which is what makes it static):
dim MatchCounter as long

Just initialize to zero at the appropriate place and have your matching function increment on each match.  (Could also wrap this in a small Class if the initialization logic / update logic is spread around & hard to pin down).


Q:

Pass object to Query.EQ in MongoDb csharp driver

How to pass Object to MongoDb query builder?
public IMongoQuery Equals(string name,object value){
    return Query.EQ(name, **value**); //compilation error,
                                     //no overloaded method and no implicit overloading
                                    //operator for object
}

If we are just passing primitive variables int, double etc. they have overloaded implicit operator in BsonValue class for all primitive types. I wondered if there's a way to achieve this.

A:

Try this:
public IMongoQuery Equals(string name, object value)
{
   var val = BsonValue.Create(value);
   return Query.EQ(name, val);
}


Q:

Comparing dates in Oracle using the decode function

I need to compare two dates using the Oracle decode function to see if one is less than or equal to the other.
I found this article - http://www.techonthenet.com/oracle/functions/decode.php
Which states (at the bottom) that the below decode function will return date2 if date1 > date2 :
decode((date1 - date2) - abs(date1 - date2), 0, date2, date1)

Would this not return date2 if date1 >= date2 ?
Or is it just if date1 > date2?
Is there an easier solution?

A:

That function will return date2 if date2 <= date1.  Plugging in the values and translating to pseudo-code, you get if 0 - 0 = 0 then date2 else date1 where both dates are the same.

A better solution, if you're using 8i or later is to use case:
SELECT CASE WHEN date1 >= date2 THEN date2 ELSE date1 END FROM Your_Table;

Since case allows inequality operators, it's much more readable.

Or, if you want to be more succinct, you could use the function that's designed to return the lower of n values:
SELECT LEAST(date1, date2) FROM Your_Table;

(There is also a GREATEST function, which does the opposite.)

A:

@Allan has already given you the best solution to me, but if you insist on using decode function, you can process the result of sign function instead.
http://www.techonthenet.com/oracle/functions/sign.php
sign(a) returns -1 if a < 0, 0 if a = 0 and 1 if a > 0. Thus, the following logic
if date1 >= date2 then
    return date1;
else
    return date2;
end if;

could be rewritten using decode in the following way:
select decode(sign(date2-date1),
              -1 /*this means date 1 > date 2*/, date1 /* return date1*/,
               0 /*dates are equal */,           date1 /* again, return date1*/,
               /*in any other case, which is date2 > date1, return date2*/ date2)
from dual;


Q:

rmagick color out of range

I am trying to average the colours in an image, I have come up with the following script (from here):
scrip.rb:
require 'rmagick'
file = "./img.jpg"
img = Magick::Image.read(file).first
color = img.scale(1, 1).pixel_color(0,0)
p [color.red, color.green, color.blue]

img.jpg:

BUT the RGB output is [31829, 30571, 27931].
Questions:

Shouldn't the numbers be in the range of [0-255]?
What am I doing wrong?

A:

What you have there is the red, green, and blue histogram values.
You need to divide by 256 in order to get each RGB value. In this case, the RGB values are:
require 'rmagick'
file = "./img.jpg"
img = Magick::Image.read(file).first
color = img.scale(1, 1).pixel_color(0,0)
p [color.red/256, color.green/256, color.blue/256]
  # => [124, 119, 109]

This blog post provides a more thorough explanation on how to analyse images with RMagick.


Q:

How to secure my query: I get The SqlParameter is already contained by another SqlParameterCollection

I'm trying to parameterize all queries to satisfy SQL Injection findings from the PUMA vulnerability scanning extension in Visual Studio.  While doing that, I'm running into the error in the title:

The SqlParameter is already contained by another SqlParameterCollection

This is the relevant code (second line generates the error):
    IEnumerable<UploadedDocsClass> docLst = prfDao.GetUploadedDocLog(Convert.ToInt32(id));
    if (docLst.Count() > 0){ //<-- this is where the error is thrown
    ...
    }

public IEnumerable<UploadedDocsClass> GetUploadedDocLog(int tickId)
{
  string s = "SELECT * FROM MyTable WHERE [request_id] = @tickId ";
  MyDataBaseContext accCon = new MyDataBaseContext();
  return accCon.Database.SqlQuery<UploadedDocsClass>(s, new SqlParameter("@tickId", Convert.ToString(tickId)));
}

I have searched here and in Google and can't seem to find a solution to my specific situation.  I've tried cloning the parameter, declaring it specifically and setting it to null after using it, putting it into a collection before using it, I even tried adding a random number at the end of the parameter name so it is different each time, but nothing, same error.
How can I solve this while still using a parameter in the query?
Thanks

A:

It is because IEnumerable<UploadedDocsClass> returned. It tries to execute again when docLst.Count() called - differed execution
Try returning List<T>

MSDN: The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach.

Apparently, it is trying to reuse parameters that are added to another collection (previous execution)


Q:

pylint only showing errors in VSCode

If I have the following code:
print("hello")
a = 2
b =3
print "hello"

The only pylint message I get within VSCode or the command line is:

Missing parentheses in call to 'print'. Did you mean print("hello")?
  (, line 4) pylint(syntax-error) [4,1]

If I fix the error then I get no messages from pylint within VSCode, but from a command line I get all the warnings such as bad spacing, bad const variable name, etc. and only get the above error if I call pylint with -E.
I'm running python 3.7.0 installed via miniconda.
Two questions really:
1. Is there a way to get the warnings as well as the errors at the same time
2. How do I fix VSCode to stop showing only errors
Thanks for any help.
btw, this is my settings file entry for python:
"[python]": {},
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.lintOnSave": true,

A:

Seems that's the default behaviour for PyLint in VSCode. To fix it add
"python.linting.pylintArgs": ["--enable=F,E,W"]

This overrides the default (strict checks) and enables all fatal(F), error(E) & warning(W) messages.
The vscode docs mention a lot of other ways to configure this behaviour:
https://code.visualstudio.com/docs/python/linting#_default-pylint-rules


Q:

how i can check condition inside navigationOptions in react native

I want to set a custom navigation headerLeft property;How i can set the headerLeft property only if the condition is satisfied.otherwise not.I use a StackNavigator in my app. and also cannot access props from inside navigationOptions.
here is my code
componentDidMount() {
 this.props.navigation.setParams({goBack: this.goBack, shouldShow: this.state.show });
}

onShow = () => {
  if (this.state.steps >1) {
    this.setState({show:true}, () => {this.props.navigation.setParam({shouldShow:true})} )
  }
}
goBack= () =>{
 this.setState({ steps: this.state.steps - 1 })
}

static navigationOptions = ({ navigation }) => {
  const { params = {} } = navigation.state;
  let headerLeft = null;
  if (params.shouldShow) {
    headerLeft = <TouchableOpacity onPress={() => params.goBack}>
      <Image source={/* src */} style={Styles.navBarIcon} />
    </TouchableOpacity>
  }

  return {
    headerLeft: headerLeft,
    headerTitle: 'Register',
    headerStyle: Styles.navBar,
  };
};

A:

Since navigation options are static and not included inside your class, you cannot simply access states inside it. But you can follow below method.
// ------ inside your class -------

static navigationOptions = ({ navigation }) => {
    const { params = {} } = navigation.state;
    let headerLeft = null;
    if(params.shouldShow) {
    headerLeft = <TouchableOpacity onPress={() => params.onPressButton()}>
                     <Image source={/* source */} style={Styles.navBarIcon} />
                  </TouchableOpacity>
    }

    return {
        headerLeft: headerLeft
    };
};

componentDidMount(){
    this.props.navigation.setParams({ onPressButton: this.onButtonPressedEvent, shouldShow:this.state.show });
}

onButtonPressedEvent = () =>{
// What you want to do when button pressed.
}

onShow = () =>{
   if(this.state.count > 1){
       this.setState({show:true}, () => {this.props.navigation.setParam({shouldShow:true})} )
   }
}

Remember to call onShow method when you change the count to make changes in navigation.


Q:

store IP and subnet mask number in a variable and edit on it in Python

I want to code an application that help me to determine class of IP and edit on it like if I'm using IP class a "10.0.0.0" with subnet mask 255.0.0.0 I want to let user input his IP AND SUBNET MASK as above and I make an equation to inform him how many IPs he can use, during my search I got this code
import sys

sys.stdout.write("Enter IP address: ")
sys.stdout.flush()
ip = sys.stdin.readline()
print("you entered: " + ip)

but when I use it I couldn't make any edit on the ip by that code
import sys

sys.stdout.write("Enter IP address: ")
sys.stdout.flush()
ip = sys.stdin.readline()
a = ip + 1
print("you entered: " + ip + "and your IP will be : " + a)

it shows that error : TypeError: must be str, not int
finally I want to make that number is applicable to edit on it, and kindly explain you're code to help me understand it correctly.
thanks in advance

A:

With Python 3.3 you can make use of the ipaddress — IPv4/IPv6 manipulation library
import sys
import ipaddress

sys.stdout.write("Enter IP address: ")
sys.stdout.flush()
ip = sys.stdin.readline().strip()   # remove the trailing '\n'
assigned_ip = ipaddress.IPv4Address(ip) + 1
print("You entered: " + ip + " and your IP will be: " + str(assigned_ip))

Output:
Enter IP address: 192.168.1.0
You entered: 192.168.1.0 and your IP will be: 192.168.1.1


Q:

Как правильно сделать скрытый блок, который открывается с права на странице при нажатии кнопки

Здравствуйте. У меня страница трансформируется по медиа запросам, и поисковая панель должна скрыватся с экрана, при нажатии на кнопку прилетать справа. Проблема в том, что я не очень понимаю, почему если я задаю этой панели в медиа запросах
position:absolute;
left:500px;

моя страница растягивается(появляется горизонтальный скролл), даже если ставлю на body:
max-width: 300px (к примеру)

Я уже проделал такое с одним блоком, правда он находится сверху и там такие параметры:
position: absolute;
top: -300px;

Как можно реализовать появляение этого блока нормально? Или просто делать ему
display:none

пока не нажмется кнопка?

body {
    overflow: hidden;
    overflow-y: auto;
}

#test {
  position:absolute;
  left:1000px;
}

test

A:

Создается с помощью position: fixed, right: -100500px и right: 0px на родительском элементе с помощью динамичного добавления CSS класа.
Пример на Codepen: Посмотреть пример

var tabElement = document.querySelector(".tab");

tabElement.addEventListener("click", function(event) {
  var slideParent = document.querySelector(".slide");
  if (slideParent.className == "slide") {
    slideParent.className += " slide-open";
  } else {
    slideParent.className = "slide";
  }
})
body {
  box-sizing: border-box;
  color: gray;
  font-family: sans-serif;
  margin: 0;
  position: relative;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

.container {
  height: 410px;
  width: 100%;
  border: 5px dashed grey;
}

ul {
  list-style: none;
}

li {
  margin: 20px 0;
  padding: 5px;
  transition-duration: .25s;
}

li:hover {
  background: yellow;
}

.tab {
  background: lightgrey;
  color: white;
  height: 100px;
  position: absolute;
  left: -20px;
  text-align: center;
  width: 35px;
}

.rotate {
  /* Safari */
  -webkit-transform: rotate(90deg);
  /* Firefox */
  -moz-transform: rotate(90deg);
  /* IE */
  -ms-transform: rotate(90deg);
  /* Opera */
  -o-transform: rotate(90deg);
  /* Internet Explorer */
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
  margin-left: -25px;
  margin-top: 40px;
  width: 100px;
}

.slide {
  background: lightgrey;
  height: 400px;
  width: 200px;
  padding: 20px;
  position: fixed;
  right: -200px;
  cursor: pointer;
  transition-duration: 1s;
}

.slide.slide-open {
  right: -5px;
}

slide me

A Sidebar

One Thing

Two Thing

Three Thing

Four Thing


Q:

How to create a NSDictionary with blank key/ without key for an object

I want to create a JSON string from a NSDictionary.The complete JSON to create is given below.
{
     "source":"point a ",
     "destination":"point b ",
     "boardingPoint":{
           "id":"2222",
           "location":"Some location"
},
"customerName":"test",
"customerLastName":"testing",
"customerEmail":"test@gmail.com",
"blockSeatPaxDetails":[
  {
     "age":"20",
     "name":"test123",
     "sex":"M",
     "title":"Mr",
     "email":"testing@gmail.com"
  }
],
"inventory":0
}

Now I am stuck at creating dictionary for the first part of this JSON ie
    {
    "source": "point a ",
    "destination": "point b ",
    "boardingPoint": {
    "id": "2222",
    "location": "Some location",

   },

Here the boardingPoint is a dictionary which is added to one dictionary.And then along with rest of the keys I make a final dictionary.So when I create the final dictionary, with objectsAndKeys I have no key to set for the first part which is shown below.If I set blank like this @" " the JSON string shows " " as key.And ofcourse I cannot use nil.How to do it then?
This is how it apppears if I insert blank as key for the first part
  {
  "" : {

    "source" : "point a",
    "boardingPoint" : {
    "id" : "2222",
    "location" : "Some location",
  },
    "destination" : "point b"
 },

This is how I create the  dictionaries
  NSDictionary *boardingPoint = [NSDictionary dictionaryWithObjectsAndKeys:boardingPointID,@"id", boardingLocation,@"location",nil];

  NSDictionary *firstDictionary = [NSDictionary dictionaryWithObjectsAndKeys:source,@"source",dest,@"destination",nil];

 NSDictionary *mainDictionary = [NSDictionary dictionaryWithObjectsAndKeys:firstDictionary, @" ",customerName,@"customerName",customerLastName,@"customerLastName",customerEmail,@"customerEmail",blockSeatPaxDetails,@"blockSeatPaxDetails",inventory,@"inventory",nil];

and then ofcourse
     NSData *finalData = [NSJSONSerialization dataWithJSONObject:mainDictionary options:NSJSONWritingPrettyPrinted error:nil];

A:

The first part of your JSON, properly indented, is:
{

    "source":"point a ",
    "destination":"point b ",
    "boardingPoint":{
        "id":"2222",
        "location":"Some location",
    },
    "customerName":"test",
    "customerLastName":"testing",
    "customerEmail":"test@gmail.com",
    "blockSeatPaxDetails":[
        {
            "age":"20",
            "name":"test123",
            "sex":"M",
            "title":"Mr",
            "email":"testing@gmail.com",
        },

(You've apparently elided something toward the end so I can't slow the last few lines.)
There is no "missing key" or anything of the sort.  If you feed your (unelided) JSON through NSJSONSerialization it will produce the correct "tree" of dictionaries and arrays.