Yakkety randomizes function addresses at runtime

mogeb2

Hi,

I was using -finstrument-functions to profile function entry and exit. On function entry and exit, I print the address of the function entered or exited (parameter func) and then use nm to resolve address to symbol name translation. After upgrading to Yakkety, I just realized that the addresses of the func parameter are always very high; all functions used to be close to the begining of the address space of the process, as expected for the text section. I looked at /proc/PID/maps, the text section now actually starts at a higher address, which is weird because they’re in a completely different range than whatever nm shows, so a direct translation doesn’t work anymore. Not only are the addresses much higher, but they’re also randomized. And this, I have difficulty understanding: I understand randomizing the address of writable sections for security reasons, but the text section is not writable. In any case, my question is regarding the address space of the text section: any idea what happened to yet on Yakkety, and how can I disable this behavior?

Thanks.
——

Is there any GUI R for ubuntu?

ash11112

Hello everyone,
I am new to Linux, I have installed R, and it is working fine in terminal. I want to know is there any GUI R available for linux?
Thanks,
——
howefield

Thread moved to the “Programming Talk” forum, probably a better fit.

advise on web development in c++

chuchi

Hi everyone!

I am sorry if this was post before.

I am planning to develop a website in C++ and I would like to know your opinion about that.

In the past I did PHP web development. But, in my opinion, PHP and other interpreted languages are error-prone because of undefined and uninitialized variables and such things, and I feel more comfortable in C++.

Would it be a crazy idea to develop a website using C++?

Thanks a lot!
——
T.J.

I am planning to develop a website in C++ and I would like to know your opinion about that.

You can use whatever suits you best. The actual language chosen is almost irrelevant. The real questions are how much work do you want to do (reinvention), does the compiler produce optimal results, and do you require thread-safety while programming?

In the past I did PHP web development. But, in my opinion, PHP and other interpreted languages are error-prone because of undefined and uninitialized variables and such things, and I feel more comfortable in C++.

In my opinion, PHP is over-hyped junk. It is neither thread-safe nor consistent when used with most libraries. It cannot be used with Apache’s intended threading model in most cases, and serves primarily as a vehicle for promoting buy-in products offered by Zend. That said, I do not consider C++ to be a good choice either. C++ does not initialize by default, so it is not better than PHP in that regard.

OOP in general is a bad model for development, IMO. Of its supposed benefits, inheritance is seldom used, and actively discouraged – especially in C++ and Java. Exceptions are questionable and produce stack calls where you can lose debugging data. Polymorphism can be achieved in better ways with generics if it is really needed.While you can disable exceptions in some cases, the language violates the principle of “pay for what you use.” The entire OOP model leads to designs that are over-designed and wasteful of resources – again in my opinion. I realize that there are going to be those who will descend on that evaluation shouting heresy, and to them I’d answer that I’d stack C code against their C++ any day; and see who performs better.

Even OOP advocates are dropping or disabling OOP features as programmers evaluate their usefulness. Google coding guidelines do not permit the use of exceptions, and their language: Go does not have them at all. The Clang project coding guidelines ban exceptions and RTTI. Game and embedded programmers already prefer not to use OOP in many cases. Naturally, you should defer to your own judgement – but I think most developers do not consider the costs of OOP as opposed to not using it.

Would it be a crazy idea to develop a website using C++?

No, I don’t think so. It’s no crazier than anything else that has already been done. If you want to do it, go for it! Webpages are nothing more than text output with links to scripts, pictures or other resources, after all. I’ll even offer to look at the code if you want. Before making a decision though, I’d look to see what libraries you can find to ease development.

chuchi

Hi T.J.!

I can’t believe this! Because I am also a C fan, and prefer it over C++! But most of my mates argue that C++ and OOP is better, saying things like code reuse is easier. In the end they convinced me to use C++.

But now I realized I disagree with them. You can also achieve code reuse with C and good module development, and avoid complicated OOP overhead.

I like C and will use it, definitely!

The web application I am thinking about is not only to serve web pages, but also as a web services application, because an android application will consume those web services.

Thank you very much for your advice!

All the best

T.J.

I can’t believe this!

Believe it my friend. We aren’t the only ones. We are in good company, such as Edsger W. Dijkstra, Alan Kay, Paul Graham, and even Linus Torvalds.

OOP has been tremendously over-sold. In the 20+ years I have been a programmer, I’ve never seen OOP save the day in a way that functional programming could not – not once. It works sure, but it just as easily makes things far more complex than they need to be. The ultimate example that an OOP language is not necessary? The Linux kernel. It is a huge project with millions of lines, and hundreds or thousands of programmers. It’s written in C. It is well maintained – far better than many C++ projects. All that it takes is discipline and clear design.

Because I am also a C fan, and prefer it over C++! But most of my mates argue that C++ and OOP is better, saying things like code reuse is easier. In the end they convinced me to use C++.

The greatest arguments for OOP are code reduction and reusability. Well, my response is “Create libraries.” You can dismiss close to 80% of the justification for OOP features that way, IMO.

But now I realized I disagree with them. You can also achieve code reuse with C and good module development, and avoid complicated OOP overhead.

More pity for them. If you would like, we can discuss this at length. Believe it or not, OOP is so entrenched in the industry that very few people are even willing to discuss the facts, so meeting you is a treat.

Thank you very much for your advice!
You’re very welcome, but in all it is just advice and you must decide if it is valid.

QIII

What I find interesting about topics like this is the idea that it is a choice of one or the other.

Which is better? The $64,000 question is: “For what?”

In my line of work (granted, it’s pretty specialized) the best approach is a mix of FP and OOP for different aspects of a multitude of processes.

In dogma we sometimes find selective memory that helps us forget the times that strict adherence to our pet has caused a lot of extra effort and complexity.

As with all things: use the best tool for the job at hand. Better to have a box full of different tools than a box with a single tool which you diligently use for every purpose.

If I want a dovetail joint with variable pins and tails, I’ll use a saw and chisels. If I am interested in a strong joint without design flair, I’ll use a jig and a router. In either case, I want a perfect, tight joint.

But I’m pragmatic, not dogmatic.

T.J.

That is not really the discussion, at least as I try to frame it. For me, it is a cost/benefit with the question on “Does OOP deliver what it promises over functional programming?”

The answer for me at least, is increasingly: “No.”

The pillars of OOP are usually stated as:

1. Polymorphism.

Well, polymorphism is not exclusive to OOP, and never was.

Common OOP structures such as object variables or vars are really no different than C void. In fact, in order to use object variables or vars in languages like C#, you have to cast them, just as you would a void. It strikes me as pointless hyperbole.

C14 has enhanced function generics as well, so much of the function name argument is moot.

2. Inheritance

Inheritance is a dead-duck feature IMO. C++ actively discourages its use for fear of the “diamond problem”. Java cripples it so you can’t inherit more than once.

Furthermore, what is the actual difference between:

class class1: public class 2 {}

or

class class1
{
public:
class2 my_instance;
}

Not very much…and you are avoiding potential multiple inheritance issues. It’s a useless feature, especially when you consider that most RL problems do not break down into objects anyway, but steps. My question is what good is it, really?

3.Encapsulation

Encapsulation is often touted as a benefit,but structs and function parameters perform this very well. The only justification for C++ style encapsulation is to create spaghetti code, using class defined variables as scoped globals within the class to avoid function parameters.

In my experience, hiding data in classes actually makes writing reusable code harder. Let me know if you want an example, I’d think it would be obvious though.

4.Abstraction

Abstraction is basically a way of crafting an API. I’ve never met a piece of code that once designed clearly,needed a special language feature to keep it that way.

That said, OOP introduces some annoyances with linking and complexity of the compiler as well. OOP programs tend to result in larger binaries and consume more resources. They also tend to be slower – both of which waste precious battery life. OOP has some interesting ideas to be sure, but I believe they are overstated. All in all, compared to functional programming, the OOP paradigm spends an inordinate amount of time trying to find ways to avoid problems inherent in its use. C++14 has blossomed into a mismatched cesspool of so many ways to compensate for flaws or or shortcut using clean code that few people if any have ever actually mastered the language. It’s a pink camel with 6 different sized humps decided on by committee after a drunken binge, IMO.

Error while compiling the kernel

thinker1

Greetings and salutations:

I am trying to compile the Ubuntu linux kernel based on the instructions from this page

https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

I got all the way to the following command

fakeroot debian/rules binary-headers binary-generic

I get the following errors:

/home/adil/ubuntu-precise/arch/x86/kvm/svm.c: In function ‘svm_vcpu_run’:
/home/adil/ubuntu-precise/arch/x86/kvm/svm.c:3707:18: error: invalid character ‘ ‘ in raw string delimiter
“push %%”R”bp; \n\t”
^
/home/adil/ubuntu-precise/arch/x86/kvm/svm.c:3707:3: error: stray ‘R’ in program
“push %%”R”bp; \n\t”
^
/home/adil/ubuntu-precise/arch/x86/kvm/svm.c:3708:33: error: invalid character ‘ ‘ in raw string delimiter
“mov %c[rbx](%[svm]), %%”R”bx \n\t”
^
….

When I looked in the file svm.c, I see the following code

asm volatile (
“push %%”R”bp; \n\t”
“mov %c[rbx](%[svm]), %%”R”bx \n\t”
“mov %c[rcx](%[svm]), %%”R”cx \n\t”
“mov %c[rdx](%[svm]), %%”R”dx \n\t”
“mov %c[rsi](%[svm]), %%”R”si \n\t”
“mov %c[rdi](%[svm]), %%”R”di \n\t”
“mov %c[rbp](%[svm]), %%”R”bp \n\t”

….

So apparently this is assembly code and my guess is that I am not linking the right libraries.

Any help will be greatly appreciated

Thanks!
——

run by dbl-clk .sh file in GUI file manager generates weird errors

pablogener

I have this script I’ve been working on for a while and when running it from command line, it works like a charm.
BUT…!
when I double-click it on the GUI file manager (as I would advice anyone I give the script to, to do), some errors arise.

I repeat: these errors never come up when I run from CLI with the “./.sh” command.

for example, this code:

((cntImagenes++))

throws this error:

/home/pablo/sh-scripts/monwha/monwha1.1.sh: 38: /home/pablo/sh-scripts/monwha/monwha1.1.sh: cntImagenes++: not found

this is easily worked around with:

cntImagenes=$((cntImagenes+1))

BUTTTTTTT!!!!
after I did that, further down the code, this:

while [ “$keepAdding” -eq 1 ]
do
cntImagenes=$((cntImagenes+1))

nTitulo=”Imagen n°$cntImagenes”
filNarchivo=$(zenity –file-selection –title=”$nTitulo”)

if [ “$filNarchivo” == “” ]; then #THIS IS LINE 43
keepAdding=0
else
echo “Cantidad de imagenes, hasta ahora:$cntImagenes”
lstImagenes=”$lstImagenes TRUE \”$filNarchivo\””

# lstImgsTotal[$cntImagenes]=$filNarchivo
# echo “Imagen n°$cntImagenes:$filNarchivo”

fi
done

throws this other error:

/home/pablo/sh-scripts/monwha/monwha1.1.sh: 43: [: /home/pablo/sh-scripts/monwha/7D6.jpg: unexpected operator

I have no idea, if I keep trying ‘workarounds’ for every error I stumble upon, how far will all this come. I mean, I have a feeling that this will lead to more and more errors in an endless error-ridden spiral. I also feel there’s some conceptual mistake that arouse that first error, and I should aim at fixing that ‘conceptual’ error which, in turn, may set everything “the right way” so that it runs just as smooth even from ‘double-clicking’ from the GUI file browser.

Any idea of what the #$%#$% is going on here?
Thanks in advance to the community for your dedication and time.
——
spjackson

It looks like you are missing the following as the first line of your script:

#!/bin/bash

because the errors you are getting suggest that sh (dash) not bash is interpreting your script.

pablogener

not quite. here, I’ll past the complete code, you’ll see I had included that:

#################################
# MONWHA 1.1 #
# #
# creado por Pablo Gener #
# (cc) 2016 #
# pablogener@hotmail.com #
# #
#################################

#!/bin/bash

cntImagenes=0
lstImagenes=””
lstImgsDefn=””
keepAdding=1

GREEN=’\033[1;32m’
CELESTE=’\033[1;34m’
RED=’\033[1;31m’
NC=’\033[0m’ # No Color

printf “{$CELESTE}”;

clear
echo “——————————————————–”
echo “MonWha 1.1”
echo “”
echo ” creado por: Pablo Gener (cc) 2016. free software”
echo ” pablogener@hotmail.com”
echo “”
echo “——————————————————–”
echo “”
echo “llamando al dialogo de selección de archivos. espere…”
#echo “keepAdding:” $keepAdding

while [ “$keepAdding” -eq 1 ]
do
((cntImagenes++))

nTitulo=”Imagen n°$cntImagenes”
filNarchivo=$(zenity –file-selection –title=”$nTitulo”)

if [ “$filNarchivo” == “” ]; then
keepAdding=0
else
echo “Cantidad de imagenes, hasta ahora:$cntImagenes”
lstImagenes=”$lstImagenes TRUE \”$filNarchivo\””

# lstImgsTotal[$cntImagenes]=$filNarchivo
# echo “Imagen n°$cntImagenes:$filNarchivo”

fi
done

((cntImagenes–))

if [ $cntImagenes -eq 0 ]; then
printf “${RED}”;
echo “MonWha panic! – no se seleccionó ninguna imagen para procesar”
echo “Abortando el procedimiento”
printf “${NC}”;
echo “————————————————————-”
echo “fin.”
exit 99
fi

echo “——————————————–”
echo “Se procesarán: $cntImagenes imagenes.”

lstImgsDefn=$(zenity –list –text “Imágenes incluidas:” –checklist –column “Incluir” –column “Imagen” $lstImagenes –separator ” “)

lstImgsDefn=$(echo $lstImgsDefn | tr -d \”)

montage $lstImgsDefn -geometry 360x -tile 1×1 -border 5 result_360_%d.jpg

echo “——————————————–”
echo “Se crearon todos los mosaicos”
echo “”
echo “——————————————–”
echo “Se solicitan datos adicionales”
echo “”

txtTitulo=$(zenity –entry –title “Titulo descriptivo” –text “Ingrese un titulo para la imagen final:”)
txtDesc=$(zenity –entry –title “Texto descriptivo” –text “Ingrese una breve descripción de la imagen final:”)

echo $txtTitulo | convert -font FreeSans-Regular -pointsize 24 \
-size 360x -gravity Center caption:@- \
titulo.jpg
echo $txtDesc | convert -font FreeSans-Regular -pointsize 12 \
-size 360x -gravity West caption:@- \
descrip.jpg

convert titulo.jpg descrip.jpg result_360* -append final_result.jpg

printf “{$GREEN}”;
echo “Exito!”
echo “——————————————–”
echo “Procesamiento completo. Resultado en: final_result.jpg”

printf “{$CELESTE}”;
zenity –question –text “Quiere abrir ahora el archivo de resultado?”
abrir=$?

if [ $abrir -ne 1 ]; then
echo “intenta abrir: final_result.jpg”
xdg-open final_result.jpg
fi

echo “——————————————–”
echo “Intentando limpiar archivos temporales…”
rm titulo.jpg descrip.jpg
rm result_360*

echo “fin.”
echo ;
echo “free software (cc) 2016 Pablo Gener pablogener@hotmail.com”
echo “———————————————————-”
printf “{$NC}”;

keep up the good spirit!!

spjackson

#!/bin/bash

is on line 10. It needs to be the first line, as I said earlier.

pablogener

ooooooh ****!! ok.
I’ll see to it that I never again make that mistake.

thanks so much!!

Lubuntu language translation

steven66

I’m not sure where would be the best place to post this, but I’m wondering if I could help with language translation in Lubuntu. I use the Norwegian Bokmål language (not Norwegian Nynorsk), and it’s a (mess) of two Norwegian languages and English 🙂

Can I (easily) help with translation to Norwegian Bokmål?
——
Rocket2DMn

That’s awesome, thanks for wanting to give back to the community! The place to start is here – https://community.ubuntu.com/contribute/translations/

There are a ton of links on that page, but especially see the “Documentation resources” section.

“ssh localhost git pull” fails immediately

azzamite

Hello guys

I’m working with a script that enters some build servers and updates
the git repositories before building on each of them… for security
reasons we can’t use password-less login.

The problem is that *git pull* isn’t waiting for the user to provide the
password, instead it fails immediately, here is an example:

$ ssh localhost ‘cd repo; git pull’
user@localhost’s password:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly

Any ideas?
——
reegz

How have you set up the repo URL? Run
git remote -v to see what the URL looks like. I have a sneaky suspicion that your URL looks as follows:-

https://:@host

If it is the case that the password is included in the URL then it’s a simple case of updating the URL to exclude the password. That should solve it.

If that still doesn’t work, try resetting the git config.

git config –global core.askPass “”

azzamite

git config –global core.askPass “”

I saw that suggestion, but the thing is that I don’t want to mess with other people’s git configuration.

The solution I found was to add -xt while ssh’ing

ssh -xt localhost ‘cd repo; git pull’

Now it works : )

reegz

Cool. You can also run that git command without the –global and in so doing only affect the changes on the project you’re in.

Developing with OpenCL on Ubuntu

Pietro_Monsurr

Last year I installed openCL on Ubuntu 14.04 (I have an AMD A10-7870K CPU and used the AMD OpenCL SDK). It worked.

Now Ubuntu has become incompatible with the proprietary AMD driver fglrx: I have 14.04 (5) and that driver is incompatible with libcheese and other packages, so that apt-get won’t install it, and aptitude has corrupted my system when I forced installation*.

Without fglrx, however, I have no idea how to install AMD OpenCL SDK: I installed it, but of course it sees no OpenCL devices.

I need to find a driver to execute openCL code (with g++), and then install AMD OpenCL SDK or something similar (with clFFT, clRAND, clBLAS and as many libraries as possible).

I did my homework and some suggested Oibaf (https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers), but it is not clear what I’m supposed to install from that repository. A library exists called mesa-opencl-icd but I can’t find it on the repository, with or without update to the new repository for Oibaf.

Thank you,
PM

* I’ve been forced to reinstalled Ubuntu from scratch.
——

Need Help Setting .cpp Files to Default with Netbeans

sccman

Hi everyone,

I’m looking to have Netbeans open with .cpp C++ files. I tried right-clicking on a .cpp file and using the Open With… option. However Netbeans isn’t listed as a program I could assign to .cpp.

Does anyone have any way to add Netbeans to the list, or even any workarounds for the problem?
——
sccman

Nevermind, I found a solution:

http://askubuntu.com/questions/69722/how-to-change-default-application-if-it-is-missing-in-other-applications-list

installing octave-4.0.2 on Precise machine

mark allyn

Hello everyone,

I have run into trouble trying to install Octave-4.0.2 on a 32-bit 12.04 machine. I have tried to download from a repository (Octave/stable). I have also tried to build from source, but this failed in the “make” phase with a series of messages I frankly couldn’t follow. I tried removing an existing Octave-3.8.2 on this machine before trying the new installation and this got nowhere. I have previously successfully installed octave 4.0.2 on two 14.04 (Trusty) machines.

A related question to the above is as follows. One of the Octave packages I want to install after I get Octave installed is a package (“Symbolic”) that requires a version of SymPy greater than 0.7.6. I can’t for the life of me figure out how to do the install.

Scoured the web for guidance and found none on both of these issues.

Could someone kindly guide me thru the installation.

Many thanks
——