Lots of broken haskell packages - ghc

(Arch linux) I have been having a lot of problems lately with haskell packages. Normally I would fix them fairly easily by updating some packages, but there is probably a root cause to all of them that I cannot figure out. I currently think the most likely explanation is that I went wrong somewhere in the haskell installation process, as I did not use the “haskell platform” but somewhat haphazardly installed packages from all over the place when I needed them. I just performed a system upgrade, and now when I run startx, this is the result. The shared object file it references near the end, libHSxmonad-contrib-0.16-AAxGT3H9yrS67i4YFgpjoh-ghc8.10.1.so, does not in fact exist, but two libHSxmonad-contrib shared object files that end in ghc8.0.2 (which is my ghc —-version) do exist. Also, most of the packages it says are missing I remember installing (some via cabal, some pacman) at some point or another. If it helps, here is my cabal list —-installed, ghc-pkg check, and pacman -Q|grep haskell.

[Arch Linux] I am not sure if this is related, but recently I've been increasingly annoyed by the recurrent frequency of interminable Haskell package updates -- in my case virtually solely triggered by my pandoc installation.
Resolution
yay -Syu ## system update; alt: sudo -Syu
sudo pacman -R pandoc ## uninstall pandoc
## ----------------------------------------
## Repeated cycles (~5-6) of the following, until nothing shown:
sudo pacman -Qdt ## list all packages no longer required
## as dependencies (orphans) ...
sudo pacman -R $(pacman -Qdtq) ## ... and delete them
## ----------------------------------------
yay -Syu ## system update; alt: sudo -Syu
Update. For clarity, run as many cycles as needed of:
sudo pacman -R $(pacman -Qdtq)
To find dependencies , use pactree :
[victoria#victoria ~]$ pactree -h
pactree v1.8.2
Package dependency tree viewer.
Usage: pactree [options] <package>
Options:
-a, --ascii use ASCII characters for tree formatting
-c, --color colorize output
--config <path> set an alternate configuration file
-b, --dbpath <path> set an alternate database location
--debug display debug messages
-d, --depth <#> limit the depth of recursion
--gpgdir <path> set an alternate home directory for GnuPG
-g, --graph generate output for graphviz's dot
-l, --linear enable linear output
-o, --optional[=depth] controls at which depth to stop printing optional deps
(-1 for no limit)
-r, --reverse list packages that depend on the named package
-s, --sync search sync databases instead of local
-u, --unique show dependencies with no duplicates (implies -l)
-h, --help display this help message and exit
-V, --version display version information and exit
[victoria#victoria ~]$ pactree -r haskell
error: package 'haskell' not found ## removed per this discussion
[victoria#victoria ~]$ pactree -r vim
gvim provides vim ## I installed Vim via gVim to get the clipboard
[victoria#victoria ~]$
Sample output
[victoria#victoria 2.0]$ sudo pacman -R $(pacman -Qdtq)
checking dependencies...
Packages (88) asar-3.0.3-1 crypto++-8.2.0-3 dep-0.5.4-5 devilspie-0.23-4 extra-cmake-modules-5.77.0-1 fuseiso-20070708-8 gendesk-1.0.6-1 giblib-1.2.4-8 gnome-common-3.18.0-4 go-2:1.15.6-1 go-bindata-3.5.2-2
gobject-introspection-1.66.1-3 gperf-3.1-3 haskell-bitarray-0.0.1.1-19 haskell-citeproc-0.2-9 haskell-cmark-gfm-0.2.2-20 haskell-commonmark-pandoc-0.2.0.1-36 haskell-doctemplates-0.8.3-10 haskell-glob-0.10.1-33
haskell-haddock-library-1.9.0-65 haskell-hslua-module-system-0.2.2.1-22 haskell-hslua-module-text-0.3.0.1-10 haskell-http-4000.3.15-57 haskell-http-client-tls-0.3.5.3-344 haskell-ipynb-0.1.0.1-128
haskell-jira-wiki-markup-1.3.2-32 haskell-juicypixels-3.3.5-42 haskell-regex-pcre-0.95.0.0-7 haskell-sha-1.6.4.4-15 haskell-skylighting-0.10.0.2-4 haskell-tagsoup-0.14.8-67 haskell-texmath-0.12.0.3-48
haskell-unicode-transforms-0.3.7.1-16 haskell-zip-archive-0.4.1-71 ibus-1.5.23+3+gaa558de8-2 ipython2-5.9.0-1 jq-1.6-4 js68-68.12.0-1 kitty-terminfo-0.19.3-1 libgpod-0.8.3-11 libguess-1.2-3
libhandy0-0.0.13+12+gaa6b6f4-2 libkcddb-20.12.0-1 libkeybinder2-0.3.1-4 liblastfm-qt5-1.0.9-5 libmspack-1:0.10.1alpha-3 libmygpo-qt5-1.1.0-3 liborcus-0.16.1-5 libpqxx-6.4.5-2 libspf2-1.2.10-5 lsb-release-1.4-18
lv2-1.18.0-1 mathjax2-2.7.9-1 perl-number-bytes-human-0.11-4 perl-test-needs-0.002006-3 perl-test-pod-1.52-5 pygtk-2.24.0-12 python-atomicwrites-1.4.0-3 python-click-log-0.3.2-7 python-configobj-5.0.6-10
python-flask-babel-2.0.0-3 python-icalendar-4.0.7-3 python-pipenv-2020.11.15-1 python-pytoml-0.1.21-6 python-tensorflow-serving-api-2.3.0-2 python-tzlocal-2.1-3 python-urwid-2.1.1-3 python-yaml-5.3.1-4
python2-apsw-3.33.0-3 python2-dateutil-2.8.1-5 python2-dbus-1.2.16-3 python2-feedparser-5.2.1-9 python2-ipaddress-1.0.23-2 python2-msgpack-0.6.2-4 python2-mutagen-1.43.0-3 python2-pillow-6.2.1-3
python2-psutil-5.7.3-3 python2-simplejson-3.17.2-3 quilt-0.66-2 sndio-1.7.0-3 tesseract-4.1.1-4 uwsgi-plugin-python-2.0.19.1-7 wxgtk2-3.0.5.1-1 xorg-bdftopcf-1.1-2 xorg-font-util-1.3.2-2 xorg-mkfontscale-1.2.1-2
xorg-server-xvfb-1.20.10-3 yasm-1.3.0-4
Total Removed Size: 867.02 MiB
:: Do you want to remove these packages? [Y/n] y
...
## ***************************
## ** Subsequent cycles: ***
## ***************************
Packages (47) autoconf-archive-1:2019.01.06-4 cmake-3.19.2-1 cmark-gfm-0.29.0.gfm.0-2 diffstat-1.63-1 gtk-doc-1.33.1-1 haskell-aeson-pretty-0.8.8-101 haskell-commonmark-extensions-0.2.0.4-6 haskell-connection-0.3.1-72
haskell-data-default-0.7.1.1-92 haskell-digest-0.0.1.2-21 haskell-doclayout-0.3-50 haskell-file-embed-0.0.13.0-2 haskell-hslua-1.3.0-7 haskell-hsyaml-0.2.1.0-57 haskell-http-client-0.7.3-22
haskell-old-time-1.1.0.3-26 haskell-pandoc-types-1.22-20 haskell-regex-base-0.94.0.0-7 haskell-skylighting-core-0.10.0.2-4 haskell-temporary-1.3-145 haskell-text-conversions-0.3.1-22 haskell-text-icu-0.7.0.1-36
haskell-uniplate-1.6.13-9 haskell-xml-1.3.14-26 haskell-xml-conduit-1.9.0.0-82 intltool-0.51.0-6 leptonica-1.80.0-1 libixion-0.16.1-5 libmusicbrainz5-5.1.0-4 python-certifi-2020.6.20-3 python-flask-1.1.2-4
python-greenlet-0.4.17-3 python-mako-1.1.3-3 python-speaklater-1.3-9 python-virtualenv-20.2.2-1 python-virtualenv-clone-0.5.4-3 python2-backports.shutil_get_terminal_size-1.0.0-4 python2-cairo-1.18.2-4
python2-gobject2-2.28.7-6 python2-numpy-1.16.6-1 python2-olefile-0.46-3 python2-pexpect-4.8.0-3 python2-pickleshare-0.7.5-5 python2-prompt_toolkit1-1.0.15-2 python2-traitlets-4.3.3-6 sg3_utils-1.45-1
yelp-tools-3.38.0-1
Packages (41) glib2-docs-2.66.4-1 haskell-aeson-1.5.4.1-26 haskell-ansi-terminal-0.11-25 haskell-base16-bytestring-1.0.1.0-1 haskell-base64-bytestring-1.2.0.1-8 haskell-blaze-html-0.9.1.2-62 haskell-cmdargs-0.10.20-15
haskell-commonmark-0.1.1.2-7 haskell-conduit-extra-1.3.5-75 haskell-cookie-0.4.5-8 haskell-data-default-instances-containers-0.0.1-32 haskell-data-default-instances-dlist-0.0.1-105
haskell-data-default-instances-old-locale-0.0.1-32 haskell-emojis-0.1-52 haskell-errors-2.3.0-58 haskell-http-types-0.12.3-105 haskell-hxt-9.3.1.18-185 haskell-mime-types-0.1.0.9-10 haskell-quickcheck-2.14.2-24
haskell-socks-0.6.1-64 haskell-syb-0.7.1-8 haskell-tls-1.5.4-52 haskell-utf8-string-1.0.1.1-20 haskell-x509-system-1.6.6-164 haskell-xml-types-0.3.8-4 itstool-1:2.0.6-2 jsoncpp-1.9.4-1 mallard-ducktype-1.0.2-6
python-anytree-2.8.0-3 python-beaker-1.11.0-6 python-filelock-3.0.12-5 python-itsdangerous-1.1.0-6 python-jinja-2.11.2-4 python2-decorator-4.4.2-3 python2-enum34-1.1.9-1 python2-pathlib-1.0.1-5
python2-ptyprocess-0.6.0-6 python2-pygments-2.5.2-2 python2-wcwidth-0.2.5-3 rhash-1.4.0-1 yelp-xsl-3.38.2-1
Packages (23) haskell-attoparsec-0.13.2.4-41 haskell-base-compat-batteries-0.11.2-18 haskell-blaze-markup-0.8.2.7-32 haskell-case-insensitive-1.2.1.0-44 haskell-cereal-0.5.8.1-8 haskell-colour-2.3.5-83 haskell-conduit-1.3.4-8
haskell-data-fix-0.3.0-32 haskell-dlist-1.0-28 haskell-erf-2.0.0.0-20 haskell-hxt-regex-xmlschema-9.2.0.3-24 haskell-hxt-unicode-9.0.2.4-20 haskell-network-uri-2.6.3.0-204 haskell-old-locale-1.0.0.7-26
haskell-safe-0.3.19-4 haskell-streaming-commons-0.2.2.1-33 haskell-strict-0.4.0.1-6 haskell-time-compat-1.9.5-6 haskell-typed-process-0.2.6.0-68 haskell-uuid-types-1.0.3-63 haskell-x509-validation-1.6.11-96
python-babel-2.9.0-1 python-markupsafe-1.1.1-6
Packages (14) haskell-async-2.2.2-48 haskell-base-compat-0.11.2-3 haskell-blaze-builder-0.4.1.0-15 haskell-byteable-0.1.1-21 haskell-data-default-class-0.1.2.0-20 haskell-hxt-charproperties-9.4.0.0-8
haskell-mono-traversable-1.0.15.1-79 haskell-network-3.1.2.1-6 haskell-random-1.2.0-68 haskell-resourcet-1.2.4.2-36 haskell-scientific-0.3.6.2-58 haskell-these-1.1.1.1-33 haskell-x509-store-1.6.7-96
haskell-zlib-0.6.2.2-4
Packages (8) haskell-assoc-1.0.2-32 haskell-integer-logarithms-1.0.3.1-2 haskell-split-0.2.3.4-86 haskell-splitmix-0.1.0.3-13 haskell-unliftio-core-0.2.0.1-5 haskell-unordered-containers-0.2.13.0-16
haskell-vector-algorithms-0.8.0.4-6 haskell-x509-1.7.5-97
Packages (6) haskell-asn1-parse-0.9.5-63 haskell-bifunctors-5.5.8-22 haskell-cryptonite-0.27-37 haskell-hashable-1.3.0.0-44 haskell-pem-0.2.4-119 haskell-vector-0.12.1.2-76
Packages (3) haskell-asn1-types-0.3.4-42 haskell-distributive-0.6.2-48 haskell-transformers-compat-0.6.6-2
Packages (4) haskell-base-orphans-0.8.4-8 haskell-hourglass-0.2.12-87 haskell-memory-0.15.0-54 haskell-tagged-0.8.6-13
Packages (1) haskell-basement-0.0.11-9

Related

Wrong directory for sipcfg.sip_module_dir

By trying to compile QGIS from sources on Ubuntu, there is the file /opt/QGIS/cmake/FindSIP.py which content is:
import sipconfig
sipcfg = sipconfig.Configuration()
print("sip_version:%06.0x" % sipcfg.sip_version)
print("sip_version_num:%d" % sipcfg.sip_version)
print("sip_version_str:%s" % sipcfg.sip_version_str)
print("sip_bin:%s" % sipcfg.sip_bin)
print("default_sip_dir:%s" % sipcfg.default_sip_dir)
print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
# SIP 4.19.10+ has new sipcfg.sip_module_dir
if hasattr(sipcfg, "sip_module_dir"):
print("sip_module_dir:%s" % sipcfg.sip_module_dir)
else:
print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
In Python3.6, the last if/else statement prints:
sip_module_dir:/usr/lib/python3.6/dist-packages
But the string /usr/lib/python3.6/dist-packages doesn't match an existing directory (it is probably part of why I encountered the error:
python/CMakeFiles/python_module_qgis__core.dir/build.make:537: recipe for target 'python/core/sip_corepart0.cpp' failed' failed during build process).
I either have:
/usr/lib/python3/dist-packages
or
/usr/lib/python3.6/site-packages
And it's only in /usr/lib/python3/dist-packages that I have some 'sip' related files (the other directory gives no results):
$ find . -iname "*sip*"
./twisted/protocols/__pycache__/sip.cpython-36.pyc
./twisted/protocols/sip.py
./twisted/test/test_sip.py
./twisted/test/__pycache__/test_sip.cpython-36.pyc
./sipconfig.py
./sip.pyi
./sipconfig_nd6.py
./sipdistutils.py
./__pycache__/sipconfig_nd6.cpython-36.pyc
./__pycache__/sipdistutils.cpython-36.pyc
./__pycache__/sipconfig.cpython-36.pyc
./sip.cpython-36m-x86_64-linux-gnu.so
I guess there is something to fix within 'sip' itself but don't know where exactly, neither how to do that.
More information;
OS: Ubuntu 16.04 64 bits
Python: 3.6.7
Sip: 4.19.7

Does ns2 has capability to implement store-carry-forward mechanism? If it has how to do that?

I don't know ns 2 has capability to do this but I want to implement store-carry-forward mechanism in ns 2. However, I don't know where to start. Also I don't know what its steps. What protocols this mechanism uses? Is there anybody who can help me?
ns2 + DTN
If you have other ns2 builds / installs : Rename the executable´s ns to a new name → ns-orig, 'ns-app-name', etc. And remove any ns2 *PATH text from .bashrc .
Build ns2 + DTN
tar xvf ns-allinone-2.35_gcc5.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
cd ns-allinone-2.35/
zcat dtn_ns235.patch.gz | patch -p0
./install
cd ns-2.35/
sudo make install
Simulation : Copy an example (from ns2dtn_campaign/) to ns-allinone-2.35/, and run ./simulate_dtn.sh. The location is important as this path is used : ../ns-allinone-2.35/dei80211mr-1.1.4/src/.libs/libdei80211mr.so
Example, simulation files (and one empty folder) to be copied : { bundle-test-large-scen.tcl, create-traffic-file.tcl, scen_n40_pt2_ms20_t5000_x2000_y2000, simulate_dtn.sh, Run1/ }.
Please note that the simulation time is an hour (or more).
Watch the trace file qtrace.tr : Will very slowly increase to ~9MB.
Result : ns-allinone-2.35/Run1/{ bundle_delays.tr, qtrace.tr, receipt_delays.tr }. The files can be used with Xgraph.

Automating version increase of R packages

Problem
I am developing an R package and I want to increase the version automatically each time I build it. I want that to be able to associate my results to package versions. For now I was using my own ugly function to do that.
My question is: is there a way to do it better? Or, should I avoid doing that in general?
Another option
Another option I was thinking of is to install my package (hosted in github) using ´devtools::install_github´ and then save with my results (or adding to plots) the GithubSHA1 that is saved in the installed DESCRIPTION file.
For example I can get the version and GithubSHA1 like that for the ´devtools´ package:
read.dcf(file=system.file("DESCRIPTION", package="devtools"),
fields=c("Version", "GithubSHA1"))
## Version GithubSHA1
## [1,] "1.5.0.99" "3ae58a2a2232240e67b898f875b8da5e57d1b3a8"
My tries so far
I wrote the following function to produce a new DESCRIPTION file, with updated version and date. (Increasing the major version is something I don't mind increasing per hand)
incVer <- function(pkg, folder=".", increase="patch"){
## Read DESCRIPTION from installed package ´pkg´ and make new one on the specified
## ´folder´. Two options for ´increase´ are "patch" and "minor"
f <- read.dcf(file=system.file("DESCRIPTION", package=pkg),
fields=c("Package", "Type", "Title", "Version", "Date",
"Author", "Maintainer", "Description", "License",
"Depends", "Imports", "Suggests"))
curVer <- package_version(f[4])
if(increase == "patch") {
curVer[[1,3]] <- ifelse(is.na(curVer$patchlevel), 1, curVer$patchlevel + 1)
} else if (increase == "minor") {
curVer[[1,2]] <- ifelse(is.na(curVer$minor), 1, curVer$minor + 1)
curVer[[1,3]] <- 0
} else {
stop(paste("Can not identify the increase argument: " , increase))
}
f[4] <- toString(curVer)
## Update also the date
f[5] <- format (Sys.time(), "%Y-%m-%d")
write.dcf(f, file=paste(folder, "DESCRIPTION", sep="/"))
}
If you are using git, then you can use git tags to create a version string. This is how we generate the version string of our igraph library:
git describe HEAD --tags | rev | sed 's/g-/./' | sed 's/-/+/' | rev
It gives you a format like this:
0.8.0-pre+131.ca78343
0.8.0-pre is the last tag on the current branch. (The last released version was 0.7.1, and we create a -pre tag immediately after the release tag.) 131 is the number of commits since the last tag. ca78343 is the first seven character of the hex id of the last commit.
This would be great, except that you cannot have version strings like this in R packages, R does not allow it. So for R we transform this version string using the following script: https://github.com/igraph/igraph/blob/develop/interfaces/R/tools/convertversion.sh
Essentially it creates a version number that is larger than the last released version and smaller than the next versions (the one in the -pre tag). From 0.8.0-pre+131.ca78343 it creates
0.7.999-131
where 131 is the number of commits since the last release.
I put the generation of the DESCRIPTION file in a Makefile. This replaces the date, and the version number:
VERSION=$(shell ./tools/convertversion.sh)
igraph/DESCRIPTION: src/DESCRIPTION version_number
sed 's/^Version: .*$$/Version: '$(VERSION)'/' $< | \
sed 's/^Date: .*$$/Date: '`date "+%Y-%m-%d"`'/' > $#
This is quite convenient, you don't need to do anything, except for adding the release tags and
the -pre tags.
Btw. this was mostly worked out by my friend and igraph co-developer, Tamás Nepusz, so the credit is his.
For a simpler approach, consider using the crant tool with the -u switch. For instance,
crant -u 3
will increment the third component of the version by one. There is also Git and SVN integration, and a bunch of other useful switches for roxygenizing, building, checking etc..
As auto-incrementing version numbering is not going to be built into the devtools package, I figured out a way based on Gabor's answer (the link to igraph in his answer is dead btw).
When I am about to commit to our repository, I run this bash script to set the date to today and to set the version number based on the latest tag, the .9000 suffix (as suggested here in the book R Packages by Hadley Wickham) and the number of commits within that tag:
echo "••••••••••••••••••••••••••••••••••••••••••••"
echo "• Updating package date and version number •"
echo "••••••••••••••••••••••••••••••••••••••••••••"
sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION
# get latest tags
git pull --tags --quiet
current_tag=`git describe --tags --abbrev=0 | sed 's/v//'`
current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'`
# combine tag (e.g. 0.1.0) and commit number (like 40) increased by 9000 to indicate beta version
new_version="$current_tag.$((current_commit + 9000))" # results in 0.1.0.9040
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
echo "First 3 lines of DESCRIPTION:"
head -3 DESCRIPTION
echo
# ... after here more commands like devtools::document() and git commit
To be clear - this script actually makes these changes to the DESCRIPTION file.
EDIT: support for hundreds - now just increases the commit sequence number by 9000. So commit #120 in tag v0.6.1 leads to 0.6.1.9120.

Qt: How to find text, while the criteria is in a QStringList?

I load a file with QTextStream, then read it line by line with readLine. Then I want to get the line which have some keywords. Then, I remove the keywords from each line, so I will get entire line minus the keywords.
I wonder if the keywords can be stored in a QStringList so I can do looping to find them. Or any other simpler way to do it?
To be clear, I want to get some data from APT cache file of Ubuntu. Similar like this:
Package: flashplugin-downloader
Priority: optional
Section: multiverse/web
Installed-Size: 41
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: Bart Martens <bartm#knars.be>
Architecture: i386
Source: flashplugin-nonfree
Version: 11.2.202.359ubuntu0.12.04.1
Depends: flashplugin-installer (>= 11.1.102.55ubuntu3)
Filename: pool/multiverse/f/flashplugin-nonfree/flashplugin-downloader_11.2.202.359ubuntu0.12.04.1_i386.deb
Size: 1832
Homepage: http://www.adobe.com/products/flashplayer.html
Description-md5: 66ea91f4e504085408ea841953dc65d0
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Package: flashplugin-installer
Priority: optional
Section: multiverse/web
Installed-Size: 137
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: Bart Martens <bartm#knars.be>
Architecture: i386
Source: flashplugin-nonfree
Version: 11.2.202.359ubuntu0.12.04.1
Replaces: flashplugin (<< 6), flashplugin-downloader (<< 11.1.102.55ubuntu3), flashplugin-nonfree (<< 11.0.1.152ubuntu1)
Provides: flashplugin-nonfree
Depends: debconf (>= 0.5) | debconf-2.0, wget, libgtk2.0-0, fontconfig, libxt6, libxext6, libatk1.0-0, libc6, libcairo2, libexpat1, libfontconfig1, libfreetype6, libglib2.0-0, libice6, libpango1.0-0, libpng12-0, libsm6, libx11-6, libxau6, libxcursor1, libxdmcp6, libxfixes3, libxi6, libxinerama1, libxrandr2, libxrender1, zlib1g, libnss3-1d, libnspr4-0d, libcurl3 | libcurl3-gnutls, libasound2, update-notifier-common (>= 0.119ubuntu2)
Recommends: libasound2-plugins (>= 1.0.16)
Suggests: firefox, x-ttcidfont-conf, ttf-mscorefonts-installer, ttf-bitstream-vera | ttf-dejavu, ttf-xfree86-nonfree, xfs
Conflicts: flashplayer-mozilla, flashplugin (<< 6), flashplugin-nonfree (<< 11.0.1.152ubuntu1), libflashsupport
Breaks: flashplugin-downloader (<< 11.1.102.55ubuntu3)
Filename: pool/multiverse/f/flashplugin-nonfree/flashplugin-installer_11.2.202.359ubuntu0.12.04.1_i386.deb
Size: 7014
Homepage: http://www.adobe.com/products/flashplayer.html
Description-md5: a03e9ebc20ce82c05567d088e79bf750
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
I want to get lines which contains Package, Size, Filename, and Description from above file.
I don't get a proper keyword to ask Google.
EDIT:
So far, my approach is like this:
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream text(&file);
while(!text.atEnd())
{
QString line = text.readLine();
foreach(QString key, criteria) //criteria is a QStringList
{
if(line.contains(criteria))
{
qDebug() << line.remove(criteria);
}
}
}
}
The files to be read might have size up to 25 MB. I wonder if above code can be effective. Maybe you can teach me how to use QVector or else.
Don't you think using shell script would be better of in this case.
All you need to do is call cat <filename> | grep -e Package -e Size -e Filename -e Description. Use a QProcess and read the output stream. You could change the shell script call to only get the fields (lines) that you require, And instead of hardcoded values use regex.
I still don't know what are you trying to achieve. And why are you using QT to achieve the task.
Maybe some more information regarding what are you trying to achieve will give a better idea of the problem in hand. And its corresponding solution.

history search backward in R

Normally in my machine I can search R's history backwards by typing the desired first characters of the command I want to backward-search and then use the PageUp or PageDown keys to go through all the entries in the R history.
I am working as a guest in a remote cluster now and this option is not available in this machine.
Does anyone have an idea of where can I add this function to R?
EDIT: I am interested on key bindings rather than how to reproduce this function.
EDIT2: I am locally on a Fedora 16 machine; remotely CentOS release 5.3 (Final)
history(pattern="lm\\(") # finds lines with lm or glm calls
There are a variety of history mechanisms and it may be that what your console is looking at will not be the same as that which the history call will be accessing. Read the Details section of the ?history page.
I found where to look at in order to tell R how to behave.
The key was to modify my ~/.inputrc file as it is the reference for R's input method.
I used the same file from my local Fedora 16 /etc/inputrc and copied it into the remote cluster as ~/.inputrc. The file looks like this
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
$if mode=emacs
# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# for rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

Resources