prompt stringlengths 1 63.6k | completion stringlengths 1 53.1k |
|---|---|
Hello everybody!! Thanks for passing by, I'm having troubles creating functions directly in the shell. I am following a tutorial where it explains how to make a function to prepend environment variables. It shows how to mae the script: Code: Select allroot@Zion:~# prepend() { [ -d "$2" ] && eval $1=\"$2':'\$$1\" && export $1; } So then I would be able to use the function to add an specific path to $PATH. In the tutorial, obviously, worked fine, but when I declare the function, a new line appears, specting to write something else. Like if I haven't finish, and the only way to get out of it is pressing crtl+c, but, obviously, the function is not declare at all. Code: Select allroot@Zion:~# prepend() { [ -d "$2" ] && eval $1=\"$2':'\$$1\" && export $1; } > > root@Zion:~# prepend LD_LIBRARY_PATH /my/path -bash: prepend: no se encontró la orden Thanks a lot for your time! | Works for me: Code: Select allbash-4.4$ unset LD_LIBRARY_PATH bash-4.4$ echo $LD_LIBRARY_PATH bash-4.4$ prepend() { [ -d "$2" ] && eval $1=\"$2':'\$$1\" && export $1; } bash-4.4$ prepend LD_LIBRARY_PATH ~/Go bash-4.4$ prepend LD_LIBRARY_PATH ~/git bash-4.4$ echo $LD_LIBRARY_PATH /home/empty/git:/home/empty/Go: bash-4.4$ echo $BASH_VERSION 4.4.23(1)-release bash-4.4$ This is under xterm in OpenBSD -current, what are you running? |
Hello everybody!! I'm developing a version of the game Mastermind in bash script. It results to be that when I try to make my non repetitive random code, sometimes, the process takes much more time that the expected. Code: Select allfor i in {1..5} do if [ $i -eq 1 ] then random_num="$(( $RANDOM % 8 + 1 ))" code=$random_num else until [ $full_list -eq 4 ] do random_num="$(( $RANDOM % 8 + 1 ))" for element in $code do if [ $element -ne $random_num ] then (( full_list++ )) else full_list=0 break fi done if [ $full_list -ne 0 ] then code="$code $random_num" fi done fi done For instance I presume that it is just the "while" which came across with kind of an infinite repeated numbers. OR I did something wrong and can't see it right now. So in case is the "while".... Is there a way to limit it? So in case it takes to long to generate the number, starts the loop over? Does bash allow recursive functions?? Thanks a lot for your time and support!! | (Preface:I have initialized full_list with 0 before I analysed your snippet.) Your problem is that you don't reset full_list and get therefore sometimes in an endless loop. See this example: Code: Select allfull_list: 0 current compare: 8 3 current code: 8 full_list: 1 current compare: 8 4 current compare: 3 4 current code: 8 3 full_list: 3 current compare: 8 6 current compare: 3 6 current compare: 4 6 current code: 8 3 4 full_list: 6 current compare: 8 5 current compare: 3 5 current compare: 4 5 current compare: 6 5 current code: 8 3 4 6 full_list: 10 current compare: 8 6 current compare: 3 6 current compare: 4 6 current code: 8 3 4 6 5 full_list: 0 current compare: 8 2 current compare: 3 2 current compare: 4 2 current compare: 6 2 current compare: 5 2 current code: 8 3 4 6 5 full_list: 5 current compare: 8 1 current compare: 3 1 current compare: 4 1 current compare: 6 1 current compare: 5 1 current compare: 2 1 current code: 8 3 4 6 5 2 full_list: 11 current compare: 8 6 current compare: 3 6 current compare: 4 6 current code: 8 3 4 6 5 2 1 full_list:0 You will never be able to reach full_list equal 4 again to leave the loop. The only situation your snippet works, is when the fifth number is already in $code and resets full_list for you. See: Code: Select allfull_list: 0 current compare: 4 7 current code: 4 full_list: 1 current compare: 4 8 current compare: 7 8 current code: 4 7 full_list: 3 current compare: 4 8 current compare: 7 8 current code: 4 7 8 full_list: 0 current compare: 4 8 current compare: 7 8 current code: 4 7 8 full_list: 0 current compare: 4 3 current compare: 7 3 current compare: 8 3 current code: 4 7 8 full_list: 3 current compare: 4 8 current compare: 7 8 current code: 4 7 8 3 full_list: 0 current compare: 4 7 current code: 4 7 8 3 full_list: 0 current compare: 4 3 current compare: 7 3 current compare: 8 3 current code: 4 7 8 3 full_list: 0 current code: 4 7 8 3 full_list: 0 current compare: 4 2 current compare: 7 2 current compare: 8 2 current compare: 3 2 current code: 4 7 8 3 When the fifth number doesn't reset $full_list and is added to $code, then you end up an endless loop. Potential fix: Code: Select all... until [ $full_list -eq 4 ] do full_list=1 random_num="$(( $RANDOM % 8 + 1 ))" ... |
Hi I am trying to make a script to copy 00_STD_Letter_Serial01_To_ABC_-_Title.odt to current directory: Code: Select allls aaa.txt abc.txt pqr.txt to get in current directory: Code: Select allls Letter_Serial01_To_ABC_-_aaa.odt Letter_Serial02_To_ABC_-_abc.odt Letter_Serial03_To_ABC_-_pqr.odt but this fails in renaming exactly: Code: Select allfor i in *.txt;do cp -v ../00_STD_Letter_*.odt "${i/.txt}".odt ;done I also get an error for: Code: Select allfilename1=../00_STD_Letter_*.odt; for i in *.txt;do cp -v ../00_STD_Letter_*.odt "$filename1""${i/.txt}".odt ;done Kindly inform any possibility? Thanks in advance! | So is this the problem or did I misunderstand? You want to copy a file and append a running number to it (iterator in for loop) and then add to that a suffix (.txt)? |
Hi I dont have much understanding of awk/sed! I have a text file with lots of sentences / paragraphs. The words are single space separated. ... such that: the new file should only have 8 words (or less if sentence ends) on one line. Please do inform: Will it will be possible if this formatted text be some how "cat" into the .odt file format, like the text files. I actually want to use the data in Writer for next task. I tried, but the .odt file got corrupt! Thanks in advance! | As I recall odt is a zip file. Do the following... Code: Select allmdkir contents cp your_file.odt contents/ unzip your_file.odt Your text should be in content.xml. Here are some possibilities: 1) Unzip the file, edit content.xml, and then zip the file. 2) Because you want to use writer, just write your data to a text file and import. 3) Find a text/markdown/xml/html to odt converter. Write the file in that format and then convert to odt. Hope this helps... |
Hello ! I have recently started programming using Xlib and C. As you probably already know, to specify that you want your application to use default font you set font to "fixed", like this Code: Select allfont = XLoadQueryFont(display, "fixed"); But how can I get variations of that font, like bold, italic and bold italic? I have tried specifying this string instead of "fixed". Code: Select all-*-*-*-*-normal-*-*-*-*-*-*-*-*-* or Code: Select all-*-fixed-*-*-normal-*-*-*-*-*-*-*-*-* (This is X logical font description.) But it didn't work, text didn't show up. I thought that if I can specify "fixed" font like this that I can later change 3th field to "bold", 4th to "italic" and so on. | Try using this to get a correct name: Code: Select allxfontsel https://packages.debian.org/stretch/x11-utils This seems to be valid (but with a limited size selection available): Code: Select all-*-fixed-bold-*-*-*-*-*-*-*-*-*-*-* |
dear citizens of gotham, tldr: i can just run the binary after running make in the source folder of applications built in c, no need to install the damn thing. Is there is any way to do the same for packages built in python? long version i realized a couple months back that there is no need to actually install an application built from source. I limit what i run using root privileges. Installing anything needs that. I am more than happy to just run make and then run the built binary (after making it executable of course). My world was a happy place until i stumbled across apps in python. And i c what i did earlier is not possible for packages written in python. So my question is is there any way to just build the app from source and run the binary without installing for something written in python? I see that their readme.md advises to run sudo setup.py install together. I dont want to install it but just build it and run the binary. i can add the links to usr application folder and wherever required. | sickpig wrote:Is there is any way to do the same for packages built in python? Yes: Code: Select all./application.py |
[SOLVED] - tnx to a deleted post and of course everyone who replied Folks, I am logged in as user 'a' and I can run synaptic as user 'b' by Code: Select allsu b sudo synaptic How can I achieve the above with a bash script? | Probably notthe smartest way nor exactly what you want to do, but what I have done is this: in my sudoers file: Code: Select allchris ALL = NOPASSWD: ALL Then I have a few simple alias setup: Code: Select allalias pacman='sudo apt $1' alias pamac='sudo synaptic-pkexec &' I use pamac and pacman since I came off of Arch but this does what I need it to do. Again, not exactly what you are asking but I hope it lends to some ideas for you. C |
Hi! I'm on Bash and I want to display, some colored text onscreen. I gave Code: Select allCYAN='\033[0;36m' and then Code: Select allLPURPLE='\033[1;35m' (which can be permanent adding them to .bashrc). (First is for Cyan and later for the Light Purple ASCII colors). Then giving: Code: Select allecho -e "${CYAN}This is a ${LPURPLE}nice${CYAN}, colored text.", outputs the "This is a nice, colored text." string, all words in cyan, except "nice" which is in light purple. So far, so good! The problem is, that giving the above command from inside a script file, outputs the same string, but without any coloring. All characters are white. Any thoughts? Of course one can achieve the desired (colored) output, with the help of a computer language. (I did it with FreeBASIC, but naturally any language will do). I'm just curious why the above mentioned command didn't work. PS. I also tried with printf (instead of echo), with similar results. TIA! M. | Good resource for many scripting questions http://mywiki.wooledge.org/BashFAQ and this https://www.differencebtw.com/differenc ... -and-dash/ |
I made a (first) script to launch a file that needs to be ran in a terminal. Then I made a .dekstop to launch it. If I used x-terminal-emulator: Code: Select all#!/system/bin/sh cd <file_location> x-terminal-emulator -e ./<file> It cannot take many of all the (gnome-terminal) arguments like Code: Select all--maximize --profile=<profile_name> but works. And I need to use a second script that launch the first one: Code: Select all#!/bin/sh cd /<first_script_location> sh <first_script> The .desktop executes the second script: Code: Select all[...] Exec=/<second_script_location>/./<second_script> [...] How can I use all the arguments in x-terminal-emulator? If i use gnome-terminal: It can take all the arguments: Code: Select all#!/system/bin/sh cd <file_location> gnome-terminal --maximize --profile=<profile_name> -e ./<file> But the .desktop doesn't work. If I launch it nothing happens. If I launch the first script: nothing happens. I if I do it with the option "Run it in terminal" (that is not necessary as the script use the terminal): Code: Select allFailed to execute child process "/<first_script_location>/<first_script>" (No such file or directory) Same error with x-terminal-emulator (when I use directly the first script). | First line: Code: Select all#!/system/bin/sh How did you get a /system folder in / ? Usually Code: Select all#!/bin/sh is just fine. |
We recommend using GCC to build VLC, though some people reported success with the Intel C compiler (version as well. GCC version 4.8 or higher is required. On older systems (e.g. FreeBSD 4.x), please select a more recent version manually by setting the CC and CXX environment variables appropriately while running the ./configure shell script. Since vlc 4 from github required to use last version of qt5 I' m trying vlc 3.0. Code: Select allconfigure: error: Requested 'Qt5Core >= 5.9.0' but version of Qt5 Core is 5.7.1. If you want to build VLC without GUI, pass --disable-qt. But i have the newest version: Code: Select all qtbase5-dev is already the newest version (5.7.1+dfsg-3+b1). Before I was able to build it somehow but I did not have the interface. So I used make uninstall. But there are some files somewhere as in /usr/bin. How can I remove all old files? I tried apt purge but "vlc is not installed". How install gcc 4.8? I found it in Jessie but in on stretch. Can I install the unstable version? If I build vlc 3.0 I get make error 2. | VLC 3.0.3 is already in the stretch repos. I'm not sure why you're trying to reinvent the wheel here by building that. Stretch already has gcc-6.3. That's higher than 4.8, so that's not a problem for you. VLC 4 needs at least Qt 5.9, and that's not in Stretch, so you'll have to wait for Buster for that. Qt 5 versions are not readily backportable. If you're getting that error with VLC 3, you still have some of VLC 4 code somehow that's throwing that error. Also, you need to realize that the apt system can only track packages installed by it or locally from debs. When you go around it by manually compiling and installing stuff, there's no way it can know what you did behind its back! |
[h1=0 store_newgolf="home/john1/learning/store_newgolf" while (( "$h1"<4)) do read -p "Enter hole number : " h1 read -p "Enter par : " p1 read -p "Enter strokes : " s1 read -p "Enter fairways hit : " f1 read -p "Enter greens in regulation : " g1 read -p "Enter putting strokes : " ps1 echo "hole number-$h1" echo "par-$p1" echo " strokes- $s1" echo "fairways hit - $f1" echo "greens in regulation - $ g1" echo "putting strokes-$ps1" printf "$h1":"$p1:"$s1":"f1":"$g1":"ps1" >> "store_newgolf" done] Hello, I am new at bash scripting and cannot get this script to print on separate lines in the file "store_newgolf" Any help would be greatly appreciated. Also when trying to write a loop I came across this code [- le ] I could not find any explanation for this. What does this mean? Thank you for your assistance. | That does not look like any kind of bash script I have seen. Any bash script starts with: Code: Select all#!/bin/bash I am not any kind of expert on bash, but even if I was, I would not start writing a complete tutorial in a forum post, especially when there are so many readily available on line. I think your best approach would be to start with some bash tutorial, there are many: How to start writing a bash script One of many: https://www.linux.com/learn/writing-simple-bash-script This statement is puzzling : Also when trying to write a loop I came across this code [- le ]---snip-- If you are trying to write a loop, ok, so you start writing your code, How is it you come across other code that you do not know what it does ? I could not find any explanation for this. What does this mean? It appears to me, you are not actually writing anything, what you are doing or trying to do is copy/paste other code that some one else wrote, with out having a clue as to what the code actually does. That is not a good practice at all, and not wise. You could easily copy/paste something into a script , that does things you really don't want to have happen. On the same : Also when trying to write a loop I came across this codeCode: Select all [- le ] I could not find any explanation for this. You did not really look anywhere did you ? It means " less than or equal to " and A simple search would have give a explanation : what does the [- le ] in a loop mean This is from the first hit at: https://stackoverflow.com/questions/837 ... while-loop Code: Select allman test n1 -lt n2 True if the integer n1 is algebraically less than the integer n2. n1 -le n2 True if the integer n1 is algebraically less than or equal to the integer n2. Also : Code: Select allman bash is help full. How to write loops with bash For details on writing various loops. |
Hi all - Please have a look at the syntax I currently use below: Code: Select all#!/bin/bash os=`hostnamectl |grep "Operating System:" |awk '{print $3" "$5}'` When ran, it produces the output, Debian 9 What I need it to do, is put print $3 into a variable that can be used in the variable $destdir Any help would be ideal Cheers Chris | Thank you. This does work pretty darned well for my overall use. The next part of the puzzle, would be to take one piece of that data (for example just the value of $3 and assign just that value to a var? Again, thank you for the response - its certainly neater than the kludge I came up with since this posting. Cheers Chris |
Hello, Few years back I wrote a C program using libgd with the intent of producing JPG images with some line drawings and filled rectangles. That was probably on Fedora x86_64, if I remember. As is, that compiled program fails to run under Debian Stretch 9.4 (amd64) saying "libjpeg.so.8: cannot open shared object file: No such file or directory". Realizing I may need to compile that again under current Debian, tried gcc and it failed quickly with missing "gd.h" include file. Checked with Synaptic to see there is ligd3 (2.2.4-2+deb9u2) already installed but no libgd-dev. So, I install libgd-dev (2.2.4-2+deb9u2) and then it finds the "gd.h" in /use/include path. However, gcc fails at link stage looking for gd-library symbols like gdImageJpeg, gdImageCreateTrueColor, gdImageLine, etc. Unresolved externals. So, do I need to compile the GD library too? Or, is there a library that I missed during install? Note that there is no C++/Python/PERL, etc, just straight C. Thanks. | After some investigation with a cool head in the morning, I realize it was my error. See this below: Code: Select all/usr/lib/x86_64-linux-gnu$ ls -alt libgd* lrwxrwxrwx 1 root root 29 Jan 14 18:04 libgdk_pixbuf-2.0.so.0 -> libgdk_pixbuf-2.0.so.0.3600.5 -rw-r--r-- 1 root root 146856 Jan 14 18:04 libgdk_pixbuf-2.0.so.0.3600.5 lrwxrwxrwx 1 root root 34 Jan 14 18:04 libgdk_pixbuf_xlib-2.0.so.0 -> libgdk_pixbuf_xlib-2.0.so.0.3600.5 -rw-r--r-- 1 root root 68168 Jan 14 18:04 libgdk_pixbuf_xlib-2.0.so.0.3600.5 -rw-r--r-- 1 root root 549372 Aug 31 2017 libgd.a lrwxrwxrwx 1 root root 14 Aug 31 2017 libgd.so -> libgd.so.3.0.4 lrwxrwxrwx 1 root root 14 Aug 31 2017 libgd.so.3 -> libgd.so.3.0.4 -rw-r--r-- 1 root root 406184 Aug 31 2017 libgd.so.3.0.4 After copying the libgd.so.3.0.4 to a safe area... Code: Select all$ objdump -T libgd.so.3.0.4 | grep gdImageCreateTrueColor 000000000000e640 g DF .text 000000000000026e Base gdImageCreateTrueColor Just some flags were needed in gcc that I forgot to put in during compilation:- Code: Select allgcc -lgd -lpng -lz -ljpeg -lfreetype -lm -o myObj mySrc.c |
hi, I'm learning Python and when I compile one of the exercises from the course, the results come strikingly different than the original version. This is not me solving an exercise! It is an example that I ran from file & interpreter, and the results I receive are different (similar on my machine, but different than other machines). I posted on the Python forum, but there's no solution yet https://python-forum.io/Thread-py4e-boo ... n-compiled I was thinking maybe there is a package issue... Any ideas? Thanks! | +1 for what reinob said. I had the same problem recently. See http://forums.debian.net/viewtopic.php? ... 02#p675102 |
when I build the program(C) using CodeBlocks there is this thing /bin/sh: 1: g++: not found What to do? | (you should then mark the topic as solved.. as otherwise other people might want to help further..) |
I read in my textbook that while creating variables the length should not be normally more than eight characters(though ANSI standard recognizes the length of 31 characters), since only the first eight characters are treated as significant by many compilers. The question is Will there be any problem or not if there are two variabled having first eight character same (for eg:- average_length and average_width) when only first eight characters are significant? | Why not just try it and see, ? |
I need to extract only strings with capitalized words from a text file export. Text file is like this: Code: Select all{"maps":{"idOthers":{"label":"Others","state":1,"bkmrk":{"id1517321708544042":{"label":"Thornbury","latlng":"-37.758959,145.002408","z":15},"id1517404948177044":{"label":"SE Oz","latlng":"-37.383253,146.799316","z":7},"id1524907539056020":{"label":"Melbourne wide","latlng":"-37.736512,145.266724","z":10},"id1526128108894092":{"label":"Melbourne city","latlng":"-37.814412,144.963698","z":15}}}},"portals":{"idOthers":{"label":"Others","state":1,"bkmrk":{"id1519870156505020":{"guid":"bd3c83881e864833a1d6ba7f74d48932.16","latlng":"-28.101867,140.198912","label":"Moomba Airport"},"id1524017293988041":{"guid":"5d28dfb8e5c74235bcb6ebabe7db137e.16","latlng":"-38.052737,140.699065","label":"MacDonnell Water Tower"},"id1524017431668144":{"guid":"cef5a3a6052b4db5918f240633c87d1a.16","latlng":"-35.354197,145.725536","label":"Horgan Walk"},"id1524017542894278":{"guid":"981d883b207a4f469d1cfd6ef6a83c99.16","latlng":"-35.651077,145.572401","label":"Finley and District Museum"},"id1524017595214323":{"guid":"9c02931bd84a44f09d0eb7d528440dde.16","latlng":"-40.121934,148.016741","label":"Flinders Anchor"},"id1524018796438428":{"guid":"729ba75fe8af4915ad0171398308dd1a.16","latlng":"-34.276904,146.053927","label":"Griffith Water Tank 3"},"id1524018933096574":{"guid":"f9f356e2a6cb4311b8d5e6b8597e9f10.16","latlng":"-38.379673,141.369564","label":"The Blowholes"},"id1524573178960029":{"guid":"4807ea2a1f5446eca437f30d00249070.16","latlng":"-35.812108,145.564549","label":"Murraay Valley Trail"},"id1524573424316121":{"guid":"da1fa66c47e04ab8bd63ca889477fc64.16","latlng":"-35.919043,145.64944","label":"Cobram Court House"},"id1525240907654076":{"guid":"f7f0413875e849f0bd4144deeb2e1dd3.16","latlng":"-37.10952,142.412065","label":"Keep Wildlife Wild"},"id1524573612772224":{"guid":"ee648daae1954dfaae922dbf8b73b628.16","latlng":"-35.355555,145.725977","label":"Jerilderie Library"}}}}} I tried these 2 perl commands found on stackexchange but they extract each word to a separate line. Is there a way to extract so each string is on a line, no matter if it is 1,2,3 or whatever number of words? File is called "bookmarks" and they are location markers for Ingress portals. I tried to modify but my perl-fu is weak. Code: Select allperl -e 'print "$_ " for map {m/(\w*[A-Z]+\w*)/g} <>' bookmarks or perl -nE 'say $1 while /(\w*[A-Z]+\w*)/g' bookmarks | Just to complete this, arzgi's script didn't work after copying and pasting from here. It took a while to work out, after a few PMs, that the spaces were not copied correctly. After replacing the spaces with tabs in a text editor, it worked perfectly. I'm advised that replacing the spaces with spaces should have worked instead. So be careful copying Python scripts, they may have fake spaces when copied from HTML pages! Many thanks to arzgi for his help with this. |
Script does what I meant it to do except last else chunk. If I comment it out, script works for numbers 1-32 as the first argument, and just exits, if given number is higher. Idea is to limit output to 32 characters, but if I enable that else clause, it will take and print any positive number of characters. Why so? Code: Select allif [ $# -eq 0 ]; then < /dev/urandom tr -dc [:graph:] | head -c${1:-8};echo; exit 0 elif (( $1 < 1 )); then exit 1 elif (( $1 < 33 )); then < /dev/urandom tr -dc [:graph:] | head -c${1:-$1};echo; exit 0 else < /dev/urandom tr -dc [:graph:] | head -c${1:-32};echo; exit 0 fi | what does this do? please break it down (for us) step by step. i can see there's at least one error here, or at least this doesn't make any sense: Code: Select all${1:-$1} if $1 is undefined, fill it with $1??? also keep in mind that bash doesn't differentiate between strings and numbers. it does not necessarily return an error if you use a string in an arithmetic operation. |
Hello, My Java EE Development Station is on Debian 8.8 on a bi quad cores Opteron (amd64) in full 64 bits. I changed from IDE I went from Eclipse March to Eclipse Oxygen! I made a change of JRE 1.8 or oracle-java8-jre_8u144_amd64 on my station. Eclipse Oxygen starts up well my workspace is open. I have problems setting up Eclipse Oxygen and moreover I can not locate the packages * .jar, in order to properly set Eclipse. All the "import" of my projects are in error! how to set Eclipise Oxygen correctly? Greetings Philippe | i found servlet api missing, everything works fine Post / thread SOLVED |
I have someone asking me about this on the spanish forum, Ataque DoS, question In a nut shell, a user , experimenting , started this script: Code: Select all #!/bin/bash # Ping multiple destinations at once args=$# interval=$1 shift; pktsize=$1 shift; for (( i=3; i<=$args; i++ )); do ping -i $interval -s $pktsize $1 > /dev/null & shift; done I do not know enough about bash scripts to even know what it does, However, DO NOT run it, the problem it has caused is they can not stop it, even killing the process, apparently, it starts up again even after re-booting the server, some additional info: Code: Select all ps -ef | grep pingIP | grep -v 'grep pingIP' lausan 3317 2649 0 10:23 pts/0 00:00:00 grep --color=auto pingIP lausan 3318 2649 0 10:23 pts/0 00:00:00 grep --color=auto pingIP and Code: Select all pkill pingIP I have told the person to try using 'top' and see what the P id number is, and instead of "pkill" Code: Select all kill "pid number" Any way , if anyone has some ideas, any feed back or suggestion is appreciated, and thanks. P.S. I am also trying to do some searches, to see what more I can find, | Any way , if anyone has some ideas, any feed back or suggestion is appreciated, and thanks. Tell the punk that DoS ain't funny, and grow up? |
Short question: I've signed up for a Udemy short course for Python and the instructor is using a Mathematica looking notebook environment called Jupyter which I've been trying to install. Has anyone successfully installed Jupyter? I'll go into more detail if I get any hits. | Marking as solved. https://odedrabhavesh.blogspot.in/2017/ ... named.html The above blog's solution fixed the issue that was keeping Jupyter from starting, which ultimately turned out to be an issue with python-pip, running as pip. Bottom line is the solution fixed all errors, hopefully it won't cause more that I haven't found yet, ha. The solution: Code: Select all# apt-get purge -y python-pip $ wget https://bootstrap.pypa.io/get-pip.py $ python ./get-pip.py # apt-get install python-pip Now onto Python... |
Hello to everyone who is reading this. I'm trying to get both images to float to opposite sides, but it seems that they're both only floating to the left, and that whatever the float values are for flag_image_1 and flag_image_2, only the floating that I want done to flag_image_1 is done, but it's done for both images. This image ( https://i.stack.imgur.com/gh5Os.png ) represents what I'm trying to achieve. The following is the HTML and CSS syntax I typed. Code: Select all<html> <head> <link rel="stylesheet" type="text/css" href="styles.css" /> <title>Name/Title of the Page</title> </head> <body> <h1>This is a headline</h1> <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <img id="flag_image_1" class="flag_images" src="image1.png" alt="first_image" title="This is the first image."> <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <img id="flag_image_2" class="flag_images" src="image2.png" alt="second_image" title="This is the second image."> <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. </body> </html> Code: Select allimg#flag_image_1 { float: left; } img#flag_image_2 { float: right; } img.flag_images { width: 200px; } Could someone please tell me why it's not behaving as I intend it to, or at least point me to a resource that should help me figure out how to solve my problem myself? I already tried to follow the advice in the following link about a similar situation as mine unsuccessfully.: http://stackoverflow.com/questions/6036 ... of-one-div Any help would be GREATLY appreciated! | Have you tried with spaces before # in the css? |
Hello everyone I am creating a script to install gnome shell extensions I get an issue to get the description from the info page ie this one : https://extensions.gnome.org/extension- ... rsion=3.14 if i use "| grep description" after a "wget" i get only the first line of the description Some gnome shell extensions have a description on one line only, some not Using the above url i get a result but i loose the layout of the description. i see only instead of new lines : Code: Select allcat gnome_shell_extensions/extn | grep -v "\"version" | grep -v "\"screenshot" | grep -v "\"creator" | grep -v "\"name" | grep -v "\"link" | grep -v "\"download" | grep -v "\"icon" | grep -v "\"uuid" | grep -v "\"pk" | sed 's/" /"/g' | sed 's/"description": //g' | sed 's/"//g' Result : A Gnome shell interface for todo.txt. Todo.txt is a future-proof syntax for tasks (not made by me) for more info: http://todotxt.com/ Some examples: Task: Basic task (A) Task: High priority task Task @project +context: Task is part of project and has a certain context x 2013-08-22 Task: Task was completed on the 22nd of August For more info about the syntax: https://github.com/ginatrapani/todo.txt ... t Quick start: When you first enable the extension chances are high you'll see a [X] in your top panel. If you click the [X] you will be able to choose between creating the necessary files automatically or selecting your own existing files to be used with the extension. Please use the issue tracker on the homepage to report bugs and/or file feature requests this makes tracking easier for me. Thanks! See the included CHANGELOG.md for info about changes between different versions or see it online: https://bitbucket.org/bartl/todo.txt-ba ... ANGELOG.md using Code: Select allsed 's/ / /g' does nothing Who knows a better way to get the complete description with a correct layout ? | You could install jq (it's in the repo) and then something like Code: Select allcurl -s 'https://extensions.gnome.org/extension-info/?pk=570&shell_version=3.14' | jq -r '.description' I'm using curl here but I'm sure you can just use this as an example and modify it accordingly. |
Good morning I want to share a piece of code which gives me problems when comparing variables The variables are probably strings and i can not make arithmetic comparisons As you see i have tried different ways to do it but without success It seems Bash have problems with decimals ? So i tried to remove the period n $GSVS and $YYY but with no success Code: Select allGSVS2=`echo $GSVS | sed 's/.//g' YYYY2=`echo $YYY | sed 's/.//g' Code: Select all#!/bin/bash wget -q -O ext "https://extensions.gnome.org/extension-info/?pk=307&shell_version=$GSVS" GSVS="$(DISPLAY=":0" gnome-shell --version | tr -cd "0-9." | cut -d'.' -f1,2)" #| sed 's/.//g' XXX=`sed "s/\([0-9]*\.[0-9]*[0-9\.]*\)/ \1/g" ext | grep "pk" | grep "version" | sed "s/^\([0-9\.]*\).*$/\1/" | sort -V` YYY=`sed "s/\([0-9]*\.[0-9]*[0-9\.]*\)/ \1/g" ext | grep "pk" | grep "version" | sed "s/^\([0-9\.]*\).*$/\1/" | sort -V | tail -1` echo "Gnome-shell version : $GSVS" echo echo "Available versions : $XXX" echo echo "Last available version : $YYY" # Tests but not working #GSVS=`expr $GSVS + 0` #YYY=`expr $YYY + 0` #GSVS=$GSVS/.*} #YYY=$YYY/.*} if (( $YYY -eq $GSVS )) ; then echo "=" ; fi if [[ $YYY -gt $GSVS ]] ; then echo ">" ; fi if test $YYY -le $GSVS ; then echo "<" ; fi #--- I get those errors #./comp-versions.sh: line 19: ((: 3.24 -eq 3.14 : syntax error: invalid arithmetic operator (error token is ".24 -eq 3.14 ") #./comp-versions.sh: line 20: [[: 3.24: syntax error: invalid arithmetic operator (error token is ".24") #./comp-versions.sh: line 21: test: 3.24: integer expression expected Which documentations are good about this ? | The first error I can see is you do not have your $GSVS variable set before using it in your wget command. For comparisons there could be some relevant info on this site might help. One thing I would try is using quotes inside your comparison, ie Code: Select allif (( "$YYY" -eq "$GSVS" )) ; then echo "=" ; fi |
Good evening I have tried how to align text correctly I can't get better than this What can i do ? The text file i am using : PK 744 - Hide Activities Button - User - Enabled - PK 72 - Recent Items - User - Disabled - PK 584 - TaskBar - User - Enabled - PK 704 - All Windows - User - Disabled - PK 15 - AlternateTab - System - Enabled - Favorite PK 6 - Applications Menu - System - Disabled - PK 16 - Auto Move Windows - System - Disabled - PK 779 - Clipboard Indicator - User - Enabled - Favorite PK 307 - Dash to Dock - User - Enabled - Favorite PK 884 - Disper Menu - User - Disabled - PK 7 - Removable Drive Menu - System - Disabled - PK 442 - Drop Down Terminal - User - Enabled - PK 885 - Dynamic Top Bar - User - Enabled - Favorite PK 810 - Hide App Icon - User - Enabled - PK 544 - HistoryManager Prefix Search - User - Enabled - PK 600 - Launch new instance - System - Disabled - PK 36 - Lock Keys - User - Enabled - PK 898 - MMOD Panel - User - Disabled - PK 18 - Native Window Placement - System - Disabled - PK 750 - OpenWeather - System - Enabled - Favorite PK 708 - Panel OSD - User - Enabled - PK 8 - Places Status Indicator - System - Disabled - PK 836 - Internet Radio - User - Disabled - PK 881 - Screenshot Window Sizer - System - Disabled - PK 9 - SystemMonitor - System - Disabled - PK 1052 - Taskwarrior Integration - User - Disabled - PK 570 - Todo.txt - User - Enabled - Favorite PK 1166 - Extension Update Notifier - User - Enabled - PK 19 - User Themes - System - Disabled - PK 549 - Web Search Dialog - User - Enabled - PK 602 - Window List - System - Disabled - PK 10 - windowNavigator - System - Disabled - Favorite PK 21 - Workspace Indicator - System - Disabled - Favorite My script : Code: Select all#!/bin/bash input="status.fav" ni=0 while IFS= read -r var do var=`sed 's/ - /-/g' <<< $var` IFS="-" read -a arr <<< $var #echo ${#arr[@]} IFS=" " read -a arr2 <<< ${arr[0]} #stri=${arr[0]} strpk1=${arr2[0]} strpk2=${arr2[1]} strname=${arr[1]} stred=${arr[2]} strusrsys=${arr[3]} strfav=${arr[4]} #echo $stri1 ; echo $stri2 ; echo $strj ; echo $strk ; echo $strl ; echo $strm ; echo "---" line='..........................................................................................' format="%-2s %4d %-80s %s %-10s %-10s %-10s " printf "$format" "$strpk1" "$strpk2" "$strname ${line:${#strname}}" "$stred" "$strusrsys" "$strfav" ni=$[ni+1] nf=`grep Favorite status | wc -l` ne=`grep Enabled status | wc -l` nd=`grep Disabled status | wc -l` nu=`grep User status | wc -l` ns=`grep System status | wc -l` done < "$input" echo "(Extensions installed : $ni - Favorites : $nf - Enabled : $ne - Disabled : $nd - User : $nu - System : $ns)" Also printf is slower than echo | maybe use column? see: Code: Select allman column I think it is installed by default on Debian (it is in package bsdmainutils) But I am not sure I understand what you want. |
Hello I have file.txt. I want to change this: Code: Select allZ nad n contrahendo / Anna Zachiewicz // W: Rota : ofiarowane Panu wi. - Klucork : Kluck Sp. z o.o., [2007]. - s. 331-354 Zachowe rezsji nad pkowego / Mhariasiewicz // Rejent. - 1996, nr 2, s. 180-202 Zasada mownych / Marsiewicz // Wwa prywatnego : kwa dedykowana ProfOleszce. - Waszy RP, (2012). - s. 550-566 Zasada dny stron w : ("culptrahendo") / Mhariasiewicz // W: Rwnicze : profesora Ma. - Kasa : "Zakaze", 1944. - s. 1501-1518 to this: Code: Select allZasada mownych / Marsiewicz // Wwa prywatnego : kwa dedykowana ProfOleszce. - Waszy RP, (2012). - s. 550-566 Z nad n contrahendo / Anna Zachiewicz // W: Rota : ofiarowane Panu wi. - Klucork : Kluck Sp. z o.o., [2007]. - s. 331-354 Zachowe rezsji nad pkowego / Mhariasiewicz // Rejent. - 1996, nr 2, s. 180-202 Zasada dny stron w : ("culptrahendo") / Mhariasiewicz // W: Rwnicze : profesora Ma. - Kasa : "Zakaze", 1944. - s. 1501-1518 I want sort this lines descending by date: Code: Select allgrep "[1-2][0,9][0-9][0-9]" file.txt Date is bettween 1900 - 2999, but the date is on each line on diffrent position and place: [2007]; 1996; (2012) Help. | Another homework? Please pay me Code: Select all#!/bin/bash sed -e 's/.*\(19[0-9][0-9]\|2[0-9][0-9][0-9]\).*/\1/' file.txt|nl -n ln -s " "|tr -s " "|sed -e "s/\(^[0-9]*\) \(.*\)/\2 \1/"|sort|sed -e "s/.* \([0-9]*\)$/\1/"|grep '^[0-9]\+$' > /tmp/test cat /tmp/test|while read num do sed -n ${num}p file.txt done |
Hi guys. I had a search on the net for this but nothing came up exactly as I am looking for. I'm working on a custom Debian Jessie installer for an "obscure" PowerPC platform, AmigaOne XE, and in validating the boot partition I need to scan the start of the HDD and locate a boot block. So I need to convert the boot partition back to the root block device that is pointing to the whole HDD. To put this into perspective and in a way easy to understand here is an example. Say the boot partition is at: Code: Select all/dev/sda2 How do I convert that to? Code: Select all/dev/sda I know I can use some Bash commands to knock off the number, and a friend told me how, but I'm wondering if there is a proper way to get the root block device? My code is in C so right now I'm opening it as a file and reading in blocks. So if there is also a function in the Linux API that can help that would be fine also. I know hardly anything about the Linux device API except the convenience of being able to transparently open devices as file. I could keep on searching online and test programs I find to see if that helps but I thought I would just ask. Sorry if root block device is an abuse of terms. But I think you know what I mean there. I'm happy to use a shell command or a Linux function call for this purpose. Either will be fine. It will be run from a partman hook in d-i. | You can use dd(1) to copy the sectors with a defined offset, if that's what you mean. |
hi guys, I want to know how to plot in a loop. This is my code Code: Select allclc clear all for x=1:0.5:10 y=x+1 printf(" the value of y:%f",y) plot(x,y) end the plot only shows the axes. This is my output. http://i.imgur.com/2mZQEhL.png | Not pertinent to your problem, but pertinent to your post... As a courtesy to folks who have metered/limited bandwidth, please thumbnail your images. Those bandwidth-guzzling fullscreen images add up fast. |
I have this simple program: Code: Select all#include<iostream> using namespace std; int main() { cout << "Hello from an ARMHF architecture "; } I compiled it as follows: Code: Select allarm-linux-gnueabihf-g++ test.cpp -o test I transferred it over to my BeagleBone Black... it ran just fine (as it has in the past). I installed qemu... Code: Select allsudo aptitude install qemu-user-static ... and then I attempt to run the binary under emulation on my build machine using qemu as I have in the past under a Debian Jessie install (but running the 4.7 kernel (i'm running a Skylake machine)) but now under Stretch/testing I get this: /lib/ld-linux-armhf.so.3: No such file or directory A search on my machine indicates the file is located here: /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 So... I created a symbolic link: Code: Select allsudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 ld-linux-armhf.so.3 Then I ran the binary again... and now I get this: Code: Select all./test: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory Now, this file exists in this location: /usr/arm-linux-gnueabihf/lib/libstdc++.so.6 ...but unlike the previous error, this one doesn't tell me WHERE it was looking that it couldn't find it. My question is... Is there a way to find out where it thinks this file should be? Cheers | There was a dependency that qemu failed to install... sudo aptitude install libstdc++6:armhf Solved the problem. |
It seems that some programs are overriding my $PATH settings in /etc/profile. All the shell configurations are done in /etc/profile and /etc/bash.bashrc.I have no ".profile" and ".bashrc" in mine and root's $HOME. Code: Select all6677,0,0>pthfdr@SALAMAND:~$ mkfs.fat --help bash: mkfs.fat: command not found 6678,127,0>pthfdr@SALAMAND:~$ which mkfs.fat 6679,1,0>pthfdr@SALAMAND:~$ sudo which mkfs.fat /sbin/mkfs.fat 6680,0,0>pthfdr@SALAMAND:~$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/games 6681,0,0>pthfdr@SALAMAND:~$ sudo echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/games 6682,0,0>pthfdr@SALAMAND:~$ su Password: 204,0,0>root@SALAMAND:/home/pthfdr# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 205,0,0>root@SALAMAND:/home/pthfdr# cat /etc/profile|grep PATH # SET PATH PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" export PATH 206,0,0>root@SALAMAND:/home/pthfdr# cat /etc/bash.bashrc|grep PATH 207,1,0>root@SALAMAND:/home/pthfdr# | i have noticed the discrepancy between "sudo echo $PATH" and "sudo which mkfs.fat", but i think this is how it's supposed to be. in fact, your whole output looks pretty sane and i can fully reproduce it on my debian system. |
WORKING in a namespace container with the debian/sid distribution (but doesn't "properly" use X and graphics and file trasnfers are not easy) -> THANK YOU Hello, I've tried to compile the following package :Paquet gcc-6-source : i 6.1.1-11 testing 750 p 6.2.0-4 unstable 50 I've had errors during the debian/rules build process : Stage 1 05-stamp errors with gcc-6-6.1.1/build/libbacktrace/conftest.c. Did you find any way to get gcc-6 working in the stable release? I would like to get the recent improvements in C++. Thanks for your help. My system : Debian Jessie x86-64 | If you just want a build environment then try a testing/unstable container, I find systemd-nspawn the easiest to set up. General method here: http://forums.debian.net/viewtopic.php?f=16&t=129390 You don't need to run stuff in the X server so it should be a bit simpler than that for you |
Hi. I've written very simple bash script to read user input for a variable and then echo that variable to a text file for later use. I want this script to work on a graphical interface without a terminal window, so currently I'm using Zenity to read the input. It is working marvelously, but the text entry dialog in Zenity only has one line. I need to have a input dialog that allows me to input a string of text with line breaks in it. I couldn't find a way around this in the documentation of Zenity, which leaves me to the conclusion it simply is not possible with Zenity. Is there another, similar software I could use? Of course there is dialog, but as mentioned, I'd like to stay graphical. I found some ~10 years old discussion online about this very same issue, and they recommended using gtkdialog, but I can't find it in the repos anymore. And yes, I could theoretically just add -e -switch for echo in my script and use instead of enter when writing the input, but that is far from easy-to-use and minimalism I'm aiming for. What should I use? | Did you have a look here and here? |
Hello I have file with many lines ~8000 and I want merge each line of beginning "Rec." with previous line: Source: Code: Select allone test test two Rec. something two test three yes or not another lines Rec. something else and another Destination what i Want: Code: Select allone test test two Rec. something two test three yes or not another lines Rec. something else and another I have: Code: Select allsed -e ':a N' -e 's/ \(Rec\.\)/ \1/' text.txt But it missing some Rec. from beginnings lines and don't merg it with previus. What should I use for it? | as a dirty solution Code: Select allsed "s/$/#NEWLINE#/" text.txt | sed "s/^Rec\./#DELETE#Rec\./" | tr -d " " | sed "s/#NEWLINE##DELETE#/ /g" | sed "s/#NEWLINE#/ /g" |
Hi everyone ... I have recently installed Linux Debian 8.3 Jessie, with an Apache web server that works in localhost. I added PHP, MySQL and PhpMyAdmin. Everything was fine till I started using some more specific functions. For two purposes (generating PHP pages and creating txt files with the content of a MySQL table) I need to use the function fopen ... and it fails. It might because I am making an obsolete use of that function, but it is probably linked to the rights that has that the server to write a file. $fp = fopen ($fichier, "a"); if (! ($fp)) { echo " -- Attention -- l'ouverture du fichier a échoué: vérifiez les droits d'écriture ...<br>"; return FALSE; } ... gives that error message : Attention -- and so on. Is there anything wrong with the server ? My use of this PHP function looks ok. | I have given rights 777 to all PHP files involved in this. Instead of option a for fopen I have also tried with w. And it still does not work. There may be something wrong with the server. |
Does anyone have experiences about the "newer" Eclipse/CDT releases? (With "newer", I mean post Kepler SR2 = Luna, Mars and Neon.) I've been using Kepler SR2 (32-bit), and it works fairly well, but there has been some hick-ups. I remember that some releases are very heavy and some releases have quite annoying bugs. Which one (Kepler/Luna/Mars/Neon) works best on x86_64 Debian 8.1 with CDT? I'm using Eclipse/CDT for Cross development of bare metal Raspberry Pi programs in C and assembly. (And maybe some other C/C++/assembly cross-development later.) | turboscrew wrote:Does anyone have experiences about the "newer" Eclipse/CDT releases? Versions: I've used Mars and Neon (M2 Package) on Debian 9 (Stretch) over the past 2 months for C/C++ programming. Experience: They both worked well indeed. I now use Neon primarily and have since gotten rid of Mars. I realized a slight improvement in the executing of the program. The application (Eclipse <Neon>) opens quicker too. Bugs: None for me to date. |
I understand that embedian is obsoleted, so which is the current way to install ARM cross-development tools on Debian 8.1? | If you don't mind using unstable/experimental repositories you can add armel (and/or armhf) architectures (dpkg --add-foreign-architecture ...) and then install e.g. crossbuild-essential-armel, which will pull all required packages. I have NOT tested this, so I don't know how good it works or if it fits your workflow. I myself use scratchbox for armel (N900) stuff, which hardly qualifies as "modern" :) |
Hi, I'm trying to install QT5 on Jessie. I get the following error when running apt install qt5-default: Code: Select allThe following packages have unmet dependencies: qt5-default : Depends: qtbase5-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages. Could this be because I have QT4 installed and my desktop environment (KDE) depends on it? Note, I am not mixing stable with unstable/testing or any other outside repositories except Google chrome. I don't mind compiling QT5 from source and installing it locally if I have to, but it would be nice if it were possible to install it on my system with apt. From what I gathered from searching online, it should be possible to install it using apt, but that may have been assuming a system that wasn't already dependent on QT4. I didn't find much from searching here on the forums. Thanks for your advice. | Just some more info. Here's what happens when I simulate an attempt to install the unmet dependencies: Code: Select allsudo apt install -s qtbase5-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: qtbase5-dev : Depends: libgl1-mesa-dev but it is not going to be installed or libgl-dev Depends: libglu1-mesa-dev but it is not going to be installed or libglu-dev E: Unable to correct problems, you have held broken packages. Code: Select allsudo apt install -s libgl1-mesa-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libgl1-mesa-dev : Depends: mesa-common-dev (= 10.3.2-1+deb8u1) but it is not going to be installed Depends: libgl1-mesa-glx (= 10.3.2-1+deb8u1) but 11.1.2-1~bpo8+1 is to be installed Depends: libdrm-dev (>= 2.4.52) but it is not going to be installed E: Unable to correct problems, you have held broken packages. Code: Select allsudo apt install -s libdrm-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libdrm-dev : Depends: libdrm2 (= 2.4.58-2) but 2.4.67-1~bpo8+1 is to be installed Depends: libdrm-intel1 (= 2.4.58-2) but 2.4.67-1~bpo8+1 is to be installed Depends: libdrm-radeon1 (= 2.4.58-2) but 2.4.67-1~bpo8+1 is to be installed Depends: libdrm-nouveau2 (= 2.4.58-2) but 2.4.67-1~bpo8+1 is to be installed E: Unable to correct problems, you have held broken packages. So it appears that QT5 depends on older versions of some of these packages, but other parts of my system need newer versions of them, which seems kind of strange to me. Is QT5 really incompatible with, for example, libdrm2 > 2.4.58-2? |
I use debian testing and I use Gnome 3 , yesterday I install KDE4 but can not work good , so remove KDE with this command Code: Select allapt-get remove kdelibs-bin kdelibs5-data before I use Gnome3 , I use mate . so I remove all gnome with these command Code: Select allaptitude purge `dpkg --get-selections | grep gnome | cut -f 1` aptitude -f install aptitude purge `dpkg --get-selections | grep deinstall | cut -f 1` aptitude -f install and after this I install gnome 3 before install gnome 3 ps_mem.py work good and I do not have problem , but . today when I run this script , I see this error Code: Select all Private + Shared = RAM used Program Traceback (most recent call last): File "/usr/local/sbin/ps_mem.py", line 485, in <module> sorted_cmds, shareds, count, total = get_memory_usage( pids_to_show, split_args ) File "/usr/local/sbin/ps_mem.py", line 395, in get_memory_usage private, shared, mem_id = getMemStats(pid) File "/usr/local/sbin/ps_mem.py", line 227, in getMemStats digester.update(line.encode('latin1')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 103: ordinal not in range(128) and this script can not run and work. | Sounds like a problem with unicode according to this. Maybe the upgrade messed up your language encoding? I'm no programmer, so this is just a hunch. |
Does anyone know where to find a working gdb for remotely debugging ARM? I've tried gdb-multiarch, but it seems to have issues with loading programs to boards. I'm running Jessie, and the gdb-multiarch version is 7.7.1. It seems to send corrupted data. | I got a lot of results using these key words: where to find a working gdb for remotely debugging ARM? and http://startpage.com Below , is one, https://sourceware.org/gdb/wiki/Buildin ... dGDBserver There were not enough details in the post to be able to figure out which ones might be of use to you, seems like there are quite a few options, as far as anything in the Debian repositories, specifically for Debian, I don't know. |
Hi, when i try to compile this code: #include <math.h> int main (void) { double x, y; x = 2; y = sqrt(x); return 0; } With the command: $ gcc test.c I got this message: /tmp/cc5QZmCN.o: In function 'main': test.c:(.text+0x16): undefined reference to 'sqrt' collect2: error: ld returned 1 exit status Any help? I tried this on a fresh jessie install. I have the same problem on wheezy. Thanks in advance. | There's lots of stuff on this. Here's one http://linux.die.net/man/3/sqrt Code: Select allgcc -o test test.c -lm I do think you will want build-essential installed. |
am using R version 3.1.2 with rstudio-server 0.98.113 on debian build 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux. I often use the %dopar% operator in from the foreach package to run code in parallel. However, the only other use on the box seemingly installed a few items and suddenly %dopar% will use far more than the number of cores I am specifying and seems to load balance between all of them. The issue with this is that it doesn't actually seem to perform non-trivial tasks at all anymore. This is an example of testing code I've been using for testing the %dopar% loop. Code: Select alllibrary(iterators) library(foreach) library(doParallel) library(Parallel) nCores <- 4 cl <- makeCluster(nCores) registerDoParallel(cl) trials = 100000 x <- iris[which(iris[,5] != "setosa"),c(1,5)] t2 <- system.time({ r2 <- foreach(icount(trials), .combine=cbind) %dopar% { ind <- sample(100,100,replace= TRUE) results1 <- glm(x[ind,2]~x[ind,1],family=binomial(logit)) coefficients(results1) } })[3] stopCluster(cl) Another interesting behavior is that I can now stop R code that should be running on the slave workers where as previously I had to use a kill command to handle the workers. I have checked the system logs and can't seem to find what's been changed so it's unclear to me exactly how to proceed. It is almost reminiscent of a change in the BLAS library but this behavior persists after recompiling R to not use the shared BLAS lib. here is the output from lsof -p 23618 | grep 'blas\|lapack' Code: Select allR 39781 mem REG 8,17 3576576 1055038 /usr/local/lib/R/lib/libRlapack.so R 39781 mem REG 8,17 655336 1572936 /usr/lib/libblas/libblas.so.3.0 Output from R CMD ldd /usr/local/lib/R/bin/exec/R Code: Select alllinux-vdso.so.1 (0x00007ffca59fd000) libR.so => /usr/local/lib/R/lib/libR.so (0x00007f15fdc30000) libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f15fd9f7000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f15fd7da000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f15fd431000) libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f15fd190000) libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f15fce72000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f15fcb71000) libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f15fc933000) libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f15fc6e9000) liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f15fc4c6000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f15fc2bd000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f15fc0b9000) libicuuc.so.48 => /usr/lib/x86_64-linux-gnu/libicuuc.so.48 (0x00007f15fbd4a000) libicui18n.so.48 => /usr/lib/x86_64-linux-gnu/libicui18n.so.48 (0x00007f15fb97e000) /lib64/ld-linux-x86-64.so.2 (0x00007f15fe1cf000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f15fb768000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f15fb53d000) libicudata.so.48 => /usr/lib/x86_64-linux-gnu/libicudata.so.48 (0x00007f15fa1cd000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f15f9ec2000) Is it possible to rebuild R without any shared library's? I am open to any suggestions at this point. Thanks for your help guys! | Because your question is all about R, and nothing about Debian, your highest probability of a satisfactory answer would come from posting your question in a R forum. (Just sayin') |
I was playing around with QT5 today and I am getting the error Gtk-Message: Failed to load module "canberra-gtk-module". Searching suggested that the module may not be installed however it looks like it is to me. Does anyone know what I am missing here? Code: Select allii libcanberra-gtk3-0:amd64 0.30-2.1 amd64 GTK+ 3.0 helper for playing widget event sounds with libcanberra ii libcanberra-gtk3-module:amd64 0.30-2.1 amd64 translates GTK3 widgets signals to event sounds ii libcanberra-pulse:amd64 0.30-2.1 amd64 PulseAudio backend for libcanberra ii libcanberra0:amd64 0.30-2.1 amd64 simple abstract interface for playing event sounds Code: Select allimport sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == '__main__': app = QApplication(sys.argv) w = QWidget() w.resize(250, 150) w.move(300, 300) w.setWindowTitle('Simple') w.show() sys.exit(app.exec_()) | Does this or this helps? |
I've searched both the forum and google and can't find anything related. Both on my wheezy 7.8 laptop (perl v5.14.2) and my jessie 8.1 (perl v5.20.2) perlvar returns nothing. Is there a package that needs to be installed that I'm missing seeing? | Not sure what it is you are asking, my search got this: key words=perlvar for debian http://perldoc.perl.org/perlvar.html There is much more: http://perldoc.perl.org/5.8.9/index-tutorials.html http://www.perlmonks.org/?node=perlman%3Aperlfaq Try also on your computer, Code: Select allman perl That explains how to use perl , also from the manual: If you're new to Perl, you should start by running "perldoc perlintro", which is a general intro for beginners and provides some background to help you navigate the rest of Perl's extensive documentation. Run "perldoc perldoc" to learn more things you can do with perldoc. --------------------------- Code: Select allgarry@debian:~$ perldoc You need to install the perl-doc package to use this program. You may also need to install "perl", when you try the Code: Select allman perl If perl is not installed, you will get a similar message, or "not found" message. I've searched both the forum and google and can't find anything related. If you want I would be happy to explain more on how to do a search, so in the future your searches do find something, but that would be a different topic. ------------------------------------------------------------------------------------- Edited: Just a little "clue", this is in the "perldoc" -v perlvar The -v option followed by the name of a Perl predefined variable will extract the documentation of this variable from perlvar. Examples: perldoc -v '$"' perldoc -v @+ perldoc -v DATA Just goes to show, how much someone can learn, just doing a few searches, I did not know the answer to your question, I used to know nothing about "perl", did a few searches, and in less the 15 minuets found all of this ... Your welcome ! |
I wrote a program which uses strcpy. It passes compilation stage, but fails when executing the program. With gdb it shows that no such file or directory for strcpy-sse2.S _strcpy_sse2 () at ../sysdeps/i386/i686/multiarch/strcpy-sse2.S:2099 2099 ../sysdeps/i386/i686/multiarch/strcpy-sse2.S: No such file or directory. Compiling with a simple program #include <string.h> #include <stdio.h> int main(int argc, char **argv) { char *str; strcpy(str, "hello"); printf("say %s ", str); return 0; } also has the same problem. The program simply fails with segment fault. My debian is kernel 4.0.0-2-rt-686-pae, and gcc (Debian 4.9.2-10) 4.9.2 How to fix this error? Thanks | You are not allocated memory for str. Write Code: Select allchar str[16]; or how you needed. If is needed very much, use alloc() and free(). Peter. |
Hello everyone, I could not find a proper answer to my question, so here I am. Could someone explain me the difference between "int *a" and "int (*a)" in c ? I now that "int *a" is an array (integer pointer) but then, what is "int (*a)" ? If someone could help me, I would be very glad, Thanks for helping me. | Those two statements are the same thing, the latter form is just more explicit. The parentheses are unnecessary because they group things using the default grouping rules. Similar to the way "2 + (3 * 4)" is the same as "2 + 3 * 4". |
[SOLVED : The solution lay in backporting a version of python-webob >=1.4 to replace the 1.1.1-1.1 in the wheezy repository at debian. There is a copy generously provided below : https://copy.com/INMOCwyJl61ZtGbo. All I needed do was remove the python-webob from the devian wheezy repository and install the mnemosyne/python-webob-1.4/python-webob_1.4-2steve_all.deb provided below and then the menemocyne 2.3.2 installation I got from the mnemosyne site was good to go. I have since discovered anki, http://ankisrs.net/ which installed wirh no problem, and looks as though it may better suit my particular needs. It did not list python-webop in its - shorter - list of dependencies. Thanks to Steve Pusser for the solution. N.B. I let the mnemosyne developers know about my problem and your solution : https://groups.google.com/forum/#!topic ... ZJLmLg-KM0 ] Trying to set up a python program named mnemosyne ... installed the dependencies listed for ubuntu, there was no separate listing for debian ... setup.py ran ok ... but when I type mnemosyne to start the program ... Please forward the following info to the developers: Traceback (innermost last): File "/usr/local/bin/mnemosyne", line 4, in <module> __import__('pkg_resources').run_script('Mnemosyne==2.3.2', 'mnemosyne') File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 517, in run_script self.require(requires)[0].run_script(script_name, ns) File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1443, in run_script exec(script_code, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/Mnemosyne-2.3.2-py2.7.egg/EGG-INFO/scripts/mnemosyne", line 191, in <module> File "build/bdist.linux-x86_64/egg/mnemosyne/libmnemosyne/__init__.py", line 174, in initialise self.register_components() File "build/bdist.linux-x86_64/egg/mnemosyne/libmnemosyne/__init__.py", line 244, in register_components exec("from %s import %s" % (module_name, class_name)) File "<string>", line 1, in <module> File "build/bdist.linux-x86_64/egg/mnemosyne/pyqt_ui/qt_web_server.py", line 13, in <module> File "build/bdist.linux-x86_64/egg/mnemosyne/web_server/web_server.py", line 14, in <module> ImportError: No module named static jfl@wsdeb:~$ The developer sent me here .... any clue? Thanks. | The developer suggested that I make sure python-webob installed properly ... apt-get says its installed ... what could be proper or improper ? sudo apt-get install python-cherrypy3 python-virtualenv python-qt4-dev pyqt4-dev-tools qt4-designer python-qt4-sql libqt4-sql-sqlite python-matplotlib python-qt4-phonon python-sphinx python-webob [sudo] password for jfl: Reading package lists... Done Building dependency tree Reading state information... Done python-cherrypy3 is already the newest version. python-matplotlib is already the newest version. pyqt4-dev-tools is already the newest version. python-qt4-dev is already the newest version. python-qt4-phonon is already the newest version. python-qt4-sql is already the newest version. python-virtualenv is already the newest version. python-webob is already the newest version. libqt4-sql-sqlite is already the newest version. qt4-designer is already the newest version. python-sphinx is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 11 packages on the command line and 11 packages 'already the newest version'. What's the '1 not upgraded' about? |
I am trying to to compile and debainize the latest version of qupzilla on my version of Wheezy. I used the guide found in this thread. However I am getting this error when I execute dpkg-buildpackage dh_installinfo install -d debian/qupzilla/usr/share/info cp bin/themes/chrome/theme.info bin/themes/default/theme.info bin/themes/windows/theme.info bin/themes/mac/theme.info bin/themes/breathe/theme.info bin/themes/linux/theme.info debian/qupzilla/usr/share/info cp: will not overwrite just-created `debian/qupzilla/usr/share/info/theme.info' with `bin/themes/default/theme.info' cp: will not overwrite just-created `debian/qupzilla/usr/share/info/theme.info' with `bin/themes/windows/theme.info' cp: will not overwrite just-created `debian/qupzilla/usr/share/info/theme.info' with `bin/themes/mac/theme.info' cp: will not overwrite just-created `debian/qupzilla/usr/share/info/theme.info' with `bin/themes/breathe/theme.info' cp: will not overwrite just-created `debian/qupzilla/usr/share/info/theme.info' with `bin/themes/linux/theme.info' dh_installinfo: cp bin/themes/chrome/theme.info bin/themes/default/theme.info bin/themes/windows/theme.info bin/themes/mac/theme.info bin/themes/breathe/theme.info bin/themes/linux/theme.info debian/qupzilla/usr/share/info returned exit code 1 make: *** [binary] Error 2 dpkg-buildpackage: error: debian/rules binary gave error exit status 2 I even tried running it with the -rfakeroot and as root and still get this error. For my google search it seems that the issue is with the make file, but I cannot seem to see where. I am attaching my makefile if anyone wants to take a look. Thanks! Makefile: ############################################################################# # Makefile for building: QupZilla # Generated by qmake (2.01a) (Qt 4.8.2) on: Fri Dec 26 20:31:58 2014 # Project: QupZilla.pro # Template: subdirs # Command: /usr/bin/qmake -nocache QMAKE_STRIP=: PREFIX=/usr -o Makefile QupZilla.pro ############################################################################# first: make_default MAKEFILE = Makefile QMAKE = /usr/bin/qmake DEL_FILE = rm -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p COPY = cp -f COPY_FILE = $(COPY) COPY_DIR = $(COPY) -r INSTALL_FILE = install -m 644 -p INSTALL_PROGRAM = install -m 755 -p INSTALL_DIR = $(COPY_DIR) DEL_FILE = rm -f SYMLINK = ln -f -s DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p SUBTARGETS = \ sub-src-lib \ sub-src-main \ sub-src-plugins src/lib//$(MAKEFILE): @$(CHK_DIR_EXISTS) src/lib/ || $(MKDIR) src/lib/ cd src/lib/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/lib/lib.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-lib-qmake_all: FORCE @$(CHK_DIR_EXISTS) src/lib/ || $(MKDIR) src/lib/ cd src/lib/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/lib/lib.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-lib: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) sub-src-lib-make_default: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) sub-src-lib-make_first: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) first sub-src-lib-all: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) all sub-src-lib-clean: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) clean sub-src-lib-distclean: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) distclean sub-src-lib-install_subtargets: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) install sub-src-lib-uninstall_subtargets: src/lib//$(MAKEFILE) FORCE cd src/lib/ && $(MAKE) -f $(MAKEFILE) uninstall src/main//$(MAKEFILE): @$(CHK_DIR_EXISTS) src/main/ || $(MKDIR) src/main/ cd src/main/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/main/main.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-main-qmake_all: FORCE @$(CHK_DIR_EXISTS) src/main/ || $(MKDIR) src/main/ cd src/main/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/main/main.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-main: src/main//$(MAKEFILE) sub-src-lib FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) sub-src-main-make_default: src/main//$(MAKEFILE) sub-src-lib-make_default FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) sub-src-main-make_first: src/main//$(MAKEFILE) sub-src-lib-make_first FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) first sub-src-main-all: src/main//$(MAKEFILE) sub-src-lib-all FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) all sub-src-main-clean: src/main//$(MAKEFILE) sub-src-lib-clean FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) clean sub-src-main-distclean: src/main//$(MAKEFILE) sub-src-lib-distclean FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) distclean sub-src-main-install_subtargets: src/main//$(MAKEFILE) sub-src-lib-install_subtargets FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) install sub-src-main-uninstall_subtargets: src/main//$(MAKEFILE) sub-src-lib-uninstall_subtargets FORCE cd src/main/ && $(MAKE) -f $(MAKEFILE) uninstall src/plugins//$(MAKEFILE): @$(CHK_DIR_EXISTS) src/plugins/ || $(MKDIR) src/plugins/ cd src/plugins/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/plugins/plugins.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-plugins-qmake_all: FORCE @$(CHK_DIR_EXISTS) src/plugins/ || $(MKDIR) src/plugins/ cd src/plugins/ && $(QMAKE) /home/rican-linux/Build/git/qupzilla-1.8.5/src/plugins/plugins.pro -nocache QMAKE_STRIP=: PREFIX=/usr -o $(MAKEFILE) sub-src-plugins: src/plugins//$(MAKEFILE) sub-src-lib FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) sub-src-plugins-make_default: src/plugins//$(MAKEFILE) sub-src-lib-make_default FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) sub-src-plugins-make_first: src/plugins//$(MAKEFILE) sub-src-lib-make_first FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) first sub-src-plugins-all: src/plugins//$(MAKEFILE) sub-src-lib-all FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) all sub-src-plugins-clean: src/plugins//$(MAKEFILE) sub-src-lib-clean FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) clean sub-src-plugins-distclean: src/plugins//$(MAKEFILE) sub-src-lib-distclean FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) distclean sub-src-plugins-install_subtargets: src/plugins//$(MAKEFILE) sub-src-lib-install_subtargets FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) install sub-src-plugins-uninstall_subtargets: src/plugins//$(MAKEFILE) sub-src-lib-uninstall_subtargets FORCE cd src/plugins/ && $(MAKE) -f $(MAKEFILE) uninstall Makefile: QupZilla.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/common/gcc-base.conf \ /usr/share/qt4/mkspecs/common/gcc-base-unix.conf \ /usr/share/qt4/mkspecs/common/g++-base.conf \ /usr/share/qt4/mkspecs/common/g++-unix.conf \ /usr/share/qt4/mkspecs/qconfig.pri \ /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ /usr/share/qt4/mkspecs/features/qt_functions.prf \ /usr/share/qt4/mkspecs/features/qt_config.prf \ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/release.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ /usr/share/qt4/mkspecs/features/qt.prf \ /usr/share/qt4/mkspecs/features/unix/thread.prf \ /usr/share/qt4/mkspecs/features/moc.prf \ /usr/share/qt4/mkspecs/features/resources.prf \ /usr/share/qt4/mkspecs/features/uic.prf \ /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf $(QMAKE) -nocache QMAKE_STRIP=: PREFIX=/usr -o Makefile QupZilla.pro /usr/share/qt4/mkspecs/common/unix.conf: /usr/share/qt4/mkspecs/common/linux.conf: /usr/share/qt4/mkspecs/common/gcc-base.conf: /usr/share/qt4/mkspecs/common/gcc-base-unix.conf: /usr/share/qt4/mkspecs/common/g++-base.conf: /usr/share/qt4/mkspecs/common/g++-unix.conf: /usr/share/qt4/mkspecs/qconfig.pri: /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri: /usr/share/qt4/mkspecs/features/qt_functions.prf: /usr/share/qt4/mkspecs/features/qt_config.prf: /usr/share/qt4/mkspecs/features/exclusive_builds.prf: /usr/share/qt4/mkspecs/features/default_pre.prf: /usr/share/qt4/mkspecs/features/release.prf: /usr/share/qt4/mkspecs/features/default_post.prf: /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: /usr/share/qt4/mkspecs/features/warn_on.prf: /usr/share/qt4/mkspecs/features/qt.prf: /usr/share/qt4/mkspecs/features/unix/thread.prf: /usr/share/qt4/mkspecs/features/moc.prf: /usr/share/qt4/mkspecs/features/resources.prf: /usr/share/qt4/mkspecs/features/uic.prf: /usr/share/qt4/mkspecs/features/yacc.prf: /usr/share/qt4/mkspecs/features/lex.prf: /usr/share/qt4/mkspecs/features/include_source_dir.prf: qmake: qmake_all FORCE @$(QMAKE) -nocache QMAKE_STRIP=: PREFIX=/usr -o Makefile QupZilla.pro qmake_all: sub-src-lib-qmake_all sub-src-main-qmake_all sub-src-plugins-qmake_all FORCE make_default: sub-src-lib-make_default sub-src-main-make_default sub-src-plugins-make_default FORCE make_first: sub-src-lib-make_first sub-src-main-make_first sub-src-plugins-make_first FORCE all: sub-src-lib-all sub-src-main-all sub-src-plugins-all FORCE clean: sub-src-lib-clean sub-src-main-clean sub-src-plugins-clean FORCE distclean: sub-src-lib-distclean sub-src-main-distclean sub-src-plugins-distclean FORCE -$(DEL_FILE) Makefile install_subtargets: sub-src-lib-install_subtargets sub-src-main-install_subtargets sub-src-plugins-install_subtargets FORCE uninstall_subtargets: sub-src-lib-uninstall_subtargets sub-src-main-uninstall_subtargets sub-src-plugins-uninstall_subtargets FORCE sub-src-lib-check: src/lib/$(MAKEFILE) cd src/lib/ && $(MAKE) -f $(MAKEFILE) check sub-src-main-check: src/main/$(MAKEFILE) sub-src-lib-check cd src/main/ && $(MAKE) -f $(MAKEFILE) check sub-src-plugins-check: src/plugins/$(MAKEFILE) sub-src-lib-check cd src/plugins/ && $(MAKE) -f $(MAKEFILE) check check: sub-src-lib-check sub-src-main-check sub-src-plugins-check mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all install: install_subtargets FORCE uninstall: uninstall_subtargets FORCE FORCE: | Existing wheezy-based source and deb packages here: http://main.mepis-deb.org/mepiscr/testr ... /qupzilla/ |
I recently decided that I wished to try and learn programming for fun and to see if I am any good at it not to mention it'd be nice to have a deeper understanding of how things work. I was wondering what books you all would recommend for a beginner to learn C. I would prefer books with sample codes and 'assignments/projects' at the end of chapters to build/test my understanding. Better yet if people can advise a series of books to progress my knowledge on as I move from total idiot -> beginner -> intermediate etc Thanks in advance! | Learn Python and PyQt and you will make nice programs in no time. Rapid GUI Programming with Python and Qt |
Debian wheezy 64 bit kde. I'm trying to get this simple program working: Code: Select all#include <ncurses.h> int main() { initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print it on to the real screen */ getch(); /* Wait for user input */ endwin(); /* End curses mode */ return 0; } I have this installed: libncurses5:amd64 install libncurses5-dev install libncursesw5:amd64 install ncurses-base install ncurses-bin install ncurses-doc install ncurses-term install I compile like this: gcc firstone.c -Wall -o firstone And I get these errors: /tmp/ccTeZP63.o: In function `main': firstone.c:(.text+0x5): undefined reference to `initscr' firstone.c:(.text+0x14): undefined reference to `printw' firstone.c:(.text+0x1b): undefined reference to `stdscr' firstone.c:(.text+0x23): undefined reference to `wrefresh' firstone.c:(.text+0x2a): undefined reference to `stdscr' firstone.c:(.text+0x32): undefined reference to `wgetch' firstone.c:(.text+0x37): undefined reference to `endwin' collect2: error: ld returned 1 exit status What am I missing? | gcc firstone.c -Wall -o firstone -lncurses |
I already wrote this post, then the laptop shut-down. So here is the short version: After backing up the OS via rsync over the Lan to the second PC i want to rsync a few user-folders. I often forget it (shutdown the source PC, shutdown the LIve-CD, oh?forgotten : shut on everything again...) so i wrote a few lines to put it in a file/script. I have thought it would be ok, but i need to re-enter the passwd for rsync/ssh for each folder i rsync. Is there a way around that (besides doing it with exclude. In this case i don't want to use exclude). Thanks. Here is the script (like said, i just smashed it together). The rsync is at the bottom (the rest is chat) for each rsync i need to enter the passwd. Besides that it does what needs to be done. Code: Select all#!/usr/bin/env/bash # set -e clear; echo date ############### # VARIABLES ############## SOURCE="m1arkust@debian-sid:/home/m1arkust" TARGET="/media/backup/home/m1arkust" echo " The sources are: $SOURCE/Documents $SOURCE/Pictures $SOURCE/bin $SOURCE/Programming The targets are: $TARGET/Documents $TARGET/Pictures $TARGET/bin $TARGET/Programming " echo ############################ # FUNKTION asks for going on ############################ function ask_for { echo -n " You want to go on? Say yes or no: " read answer case $answer in [Yy]es | [Yy] ) echo "ok: ";; *) echo " You didn't answer yes. The script will die." exit 0 esac } ask_for ################ # RSYNCING ############### rsync -e ssh -auv --delete-after "$SOURCE"/Documents/* "$TARGET"/Documents rsync -e ssh -auv --delete-after --exclude="photos" "$SOURCE"/Pictures/* "$TARGET"/Pictures rsync -e ssh -auv --delete-after "$SOURCE"/bin/* "$TARGET"/bin rsync -e ssh -auv --delete-after --exclude="Bash/Git/git" "$SOURCE"/Programming/* "$TARGET"/Programming notify-send "Done" exit 0 No biggie, just a simple question if someone has got an easy idea how to solve it. Might rather be a rsync than a programming question. Just move it around if that is the case. Thanks | That sounds like a job for keychain. I will keep your ssh agent active so scripts or cron jobs can run without entering the password. I use this in my .bashrc where I want to to be active. Code: Select all# If keychain is running source the file to take advantage of it if [ -e ~/.keychain/`uname -n`-sh ] ; then . ~/.keychain/`uname -n`-sh; else if [ -e /usr/bin/keychain ] ; then keychain ~/.ssh/id_rsa . ~/.keychain/`uname -n`-sh fi fi I also remove them on reboot by adding code to /etc/rc.local Code: Select all# remove stale .keychain files on boot HOST=`hostname -s` for user in `ls /home`; do if [ -f /home/$user/.keychain/$HOST-sh ]; then rm /home/$user/.keychain/$HOST* fi done |
I answered my own question. Could anyone explain to me what is the purpose of the parameter within single quotation marks and what it does? I am assuming it is a call to pkg-config with those paramaters. Code: Select allgcc -o gtkprog gtkprog.c `pkg-config --libs --cflags gtk+-2.0` Using: Code: Select allpkg-config --libs --cflags gtk+-2.0 -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype So, if my logic serves me right, this command parameter is a neat replacement for this litany of libraries to be used in the compilation process. Correct me if I am wrong. | For the most part you are correct, however, it is more than just a simple insertion of the libraries and includes into the command line. pkg-config is part of GNU autotools and it resolves the dependencies of the packages dynamically within the compiler environment at compile time. In your example, it does this by starting with /usr/lib/pkgconfig/gtk+-2.0.pc and recursively checking all of the other packages specified. |
I tried compiling for 32 bit linux on my 64 bit machine using this command Code: Select allgcc -m32 stuff.c -o bit and it returns this error: In file included from /usr/include/stdio.h:27:0, from stuff.c:1: /usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory compilation terminated. So I tried getting multilib stuff using these commands Code: Select allsudo apt-get install gcc-multilib and Code: Select allsudo apt-get install g++-multilib and they returned these errors, respectively. Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: gcc-multilib : Depends: gcc-4.7-multilib (>= 4.7.2-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages. Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: g++-multilib : Depends: gcc-multilib (>= 4:4.7.2-1) but it is not going to be installed Depends: g++-4.7-multilib (>= 4.7.2-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages. Then I tried getting those dependencies individually but it did not work. I'm running Wheezy and i'm using some Jessie things such as Steam, Gimp, Gnash and VLC. | I'm running Wheezy and i'm using some Jessie things such as Steam, Gimp, Gnash and VLC. And your apt system is broken as a result. Stealing from Ballmer: Backports, backports, backports! |
Hi, i caught strange error of GCC/g++ compiler. the compiler issues an error in a particular directory(~/src/c/test directory). what does this error mean?? Code: Select all--------------------------------------------------------------------------------------------------------------- Error case 1 of 1. ~/src/c/test$ # error case. compile at '~/src/c/test' directory. ~/src/c/test$ cat test.cpp #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; } ~/src/c/test$ g++ -std=c++11 test.cpp >& results ~/src/c/test$ tail results In file included from /usr/include/c++/4.7/bits/basic_string.h:44:0, from /usr/include/c++/4.7/string:54, from /usr/include/c++/4.7/bits/locale_classes.h:42, from /usr/include/c++/4.7/bits/ios_base.h:43, from /usr/include/c++/4.7/ios:43, from /usr/include/c++/4.7/ostream:40, from /usr/include/c++/4.7/iostream:40, from test.cpp:1: ./initializer_list:1:2: error: ‘ELF’ does not name a type ./initializer_list:4:196: error: expected declaration before ‘}’ token --------------------------------------------------------------------------------------------------------------- Success case 1 of 2. ~/src/c/test$ # success 1 case. compile without '-std=c++11' flag at '~/src/c/test' directory. ~/src/c/test$ g++ test.cpp && ./a.out Hello, world! --------------------------------------------------------------------------------------------------------------- Success case 2 of 2. ~/src/c/test$ cd .. ~/src/c$ # success 2 case. compile at '~/src/c' directory. ~/src/c$ cat test.cpp #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; } ~/src/c$ g++ -std=c++11 test.cpp && ./a.out Hello, world! | Perhaps, this will be helpfull? http://forums.debian.net/viewtopic.php?f=8&t=113571 Peter. |
I'm trying to compile a Linux kernel module called hello-2.c using the command "make -C /lib/modules/$(uname -r)/build M=${PWD} modules" (without the quotes) (which I found online), and the following is the (seemingly successful) output.: Code: Select allmake: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64' Building modules, stage 2. MODPOST 0 modules make: Leaving directory `/usr/src/linux-headers-3.2.0-4-amd64' However, I don't see a hello-2.ko (in the same folder or anywhere else for that matter). I'm Using Debian GNU/Linux 7.6. Everything I am doing is within a folder/directory called "thefolder" (without the quotes) in the "/tmp" directory (without the quotes). Could someone please tell me why I can't see a hello-2.ko, and what to do to get it? | Can you put a copy of your module and makefile here? Thanks! Lev |
I think I am missing something here. If I use a character array and pass that to dirname everything is fine. If I use the char *testpath below I get a segfault. This is just a test program to show the behaviour. I ran into this using a string from another method that returns a char *. something like printf("%s ", dirname(somefunction())); Can anyone explain why this is not working? Code: Select all#include <stdio.h> #include <libgen.h> int main() { // char testpath[] = "/etc/passwd"; // This works char *testpath = "/etc/passwd"; // This causes segfault on next line printf("%s ", dirname(testpath)); return 0; } | The first form ("char testpath[]") results in a string variable being created. The second form ("char *testpath") results in a pointer being created that references a string constant. Being a constant, the string constant is created in read-only memory, and a segfault will be generated when dirname() attempts to modify read-only memory. |
This python script works , but not from crontab Here is my python script: #more datetimedir.py import os, datetime; datestring = datetime.datetime.now().strftime("%Y%m%d_%H%M%S"); print (datestring); os.mkdir(datestring); Here is how I call it from crontab */30 * * * * /usr/bin/python3 /home/cwc/logs/datetimedir.py Please throw me a bone. | Python tends to play games with the current working directory depending upon whether the current module is in sys.path . I would suggest that your script set the output directory manually before it creates the log subdirectories. |
Hi, I'm trying to setup tools for developing android apps on my Debian Wheezy (backport) system. Eclipse with android plugins is installed. Android SDK installed using android-sdk_r22.6.2-linux.tgz available from https://developer.android.com/sdk/index.html. Neccessary Android SDK Tools, Platform-tools, Build-tools and APIs etc was fetched too. My problem is I can't build the android app. The console in Eclipse tells me something (translated) like this; Code: Select all[2014-05-30 16:36:45 - adb] Unexpected exception 'Cannot run program "/usr/lib/android-sdk-linux/platform-tools/adb": java.io.IOException: error=2, No such file or directory' while attempting to get adb version from '/usr/lib/android-sdk-linux/platform-tools/adb' I have searched the web quite extensively but found no solution. It seems the issue may be due to I'm having a 64bit system but building the app requires some 32bit stuff. Some older posts suggest adding package by "apt-get install ia32-libs". In later posts (i.e. http://stackoverflow.com/questions/2710 ... ux-machine) it appears ia32-libs isn't the preferred way anymore and suggests something like Code: Select alldpkg --add-architecture i386 apt-get update apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 However doing apt-get install libc6:i386 asks me to remove 1536 installed packages and installing just 5 new... Hmm That gives me the feeling I will be sitting in front of a dead brick when done. I didn't expect it to be this tricky to get it working... What can be wrong? Any help highly appreciated! Some info about my system if it helps; Code: Select all>uname -mrv 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.4-1~bpo70+1 (2014-05-14) x86_64 | My post is about using android-studio instead of eclipse. You can install it as instructed in my howto. I tested it and it works. The downside: it is too slow for someone used to using an optimized Debian GNU/Linux installation. See here for any installation details. |
I come here in search of someone who understands Dash/portable scripting better than I do. Today, my Google-foo is failing me. I am in the process of cleaning up someone else's semi-portable shell script. The original script uses colors, in the form of Code: Select allecho -e "\e[1;32mpassed\e[0m" "echo" should be avoided in general and any option passed to "echo" is non-portable. In bash, I can easily port this to printf Code: Select allprintf '%b' "\x1b[32;1mpassed\x1b[0m " However, it does not work in dash. I have read both the echo and printf sections of the dash manual, and it seems that both "\e" and "\x" are unsupported. Using "%b" allows additional backslash-escape sequences, but only \c and \0. I know the purpose of dash is to provide an efficient POSIX compliant shell. Is there really no POSIX compliant way to use color? It seems so... 80s. Dash's manpage does state that it supports "backslash notation as defined in ANSI X3.159-1989 (“ANSI C89”)", but I can't find a copy of ANSI C89 online to confirm whether it includes display attributes. ANSI C89 is old, but still... too old for color? Am I somehow missing some hidden functionality in printf, or is there really no POSIX compliant method of printing colors, or is Dash simply incomplete with its POSIX support in this regard? Any insight is most appreciated. ---Alex | Not being an expert in this, I'm wondering if there's a reason you can't use \0 ? This works for me in dash & bash: Code: Select allprintf '%b' "\033[32;1mpassed\033[0m " |
Hi! I have problem with compiling of wmchargemon. Code: Select all$ make gcc -O2 -ldockapp -lm wmchargemon.c -o wmchargemon wmchargemon.c:20:21: fatal error: dockapp.h: No such file or directory #include <dockapp.h> ^ compilation terminated. <builtin>: recipe for target 'wmchargemon' failed make: *** [wmchargemon] Error 1 | Hello Google tells me you need to be looking for a library called libdockapp-dev The 'dev' bit says that this library may well provide the dockapp.h 'header' you may need to compile the little application. http://www.novellshareware.com/info/wmchargemon.html The page above suggests that you may need version 0.6.1 or higher, and Debian Wheezy has version 0.5.0.3 as does Jessie and SID. https://packages.debian.org/stable/libd ... ockapp-dev So you may need to find a later version of the library to compile or as a binary. I'm no expert, learning this stuff myself. |
Hello, I'm trying to follow the tutorial over at https://wiki.debian.org/BuildingTutorial#Introduction to learn how to patch a package. However, When I get to the part where I'm supposed to use dpatch-edit-patch ( https://wiki.debian.org/BuildingTutoria ... ource_code ), it fails with an error : Code: Select alldpatch-edit-patch 90-testpatch 80-bts719246-set-CC-to-allow-cross-compilation.dpatch dpatch-edit-patch: * /home/user/Code/fdupes/fdupes-1.51/debian/patches/90-testpatch.dpatch does not exist, it will be created as a new dpatch. dpatch-edit-patch: Error: Base-patch /home/user/Code/fdupes/fdupes-1.51/debian/patches/80-bts719246-set-CC-to-allow-cross-compilation.dpatch does not exist, aborting. dpatch-edit-patch: * Copying /home/user/Code/fdupes/fdupes-1.51 to reference directory. dpatch-edit-patch: * Cleaning /tmp/dpep-ref.aVM6oL/fdupes-1.51 dh clean dh_testdir dh_auto_clean make[1]: Entering directory `/tmp/dpep-ref.aVM6oL/fdupes-1.51' rm -f fdupes.o md5/md5.o rm -f fdupes rm -f *~ md5/*~ make[1]: Leaving directory `/tmp/dpep-ref.aVM6oL/fdupes-1.51' dh_clean dh unpatch dh: Unknown sequence unpatch (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep) make: *** [unpatch] Error 25 Am I missing a package? Do yo uknow what I am doing wrong ? I am doing this tutorial on Jessie 64-bits. Thank you for your help EDIT: I think it's because that package now uses quilt instead of dpatch to manage the patches | Most packages now use the 3.0 (quilt) source format, which does not actually use the separate quilt package to manage packages. You can recognize these from the debian.tar.gz source files it creates. It's easy to create a patch--just make your changes to the source code, then run Code: Select alldpkg-source --commit and your new patch will be created (after you name it) and it will open it in the nano text editor. I just close nano with <Ctrl> <X> and finish editing the patch with a GUI editor. If you have an already existing patch to add, put it in /debian/patches and add it to the series file. |
Unexpectedly i can no longer run cmake, and i have no idea what it has been able to compromise. Could someone help me? cmake (2.8.12.1-1.1) cmake-curses-gui (2.8.12.1-1.1) Code: Select allroot@workstation:/home/alfio# cmake Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! root@workstation:/home/alfio# ccmake Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! Code: Select allroot@workstation:/home/alfio# uname -a Linux workstation 3.12-1-rt-amd64 #1 SMP PREEMPT RT Debian 3.12.9-1 (2014-02-01) x86_64 GNU/Linux Debian Jessie, with some Experimental Packages. My /etc/apt/preferences Code: Select allPackage: * Pin: release a=jessie Pin-Priority: 901 Package: * Pin: release a=testing Pin-Priority: 900 Package: * Pin: release a=sid Pin-Priority: 850 Package: * Pin: release a=experimental Pin-Priority: 800 Package: iceweasel* Pin: release a=experimental Pin-Priority: 901 My /etc/apt/sources.list Code: Select alldeb http://ftp.it.debian.org/debian/ jessie main contrib non-free deb-src http://ftp.it.debian.org/debian/ jessie main contrib non-free deb http://ftp.debian.org/debian sid main contrib non-free deb-src http://ftp.debian.org/debian sid main contrib non-free deb http://ftp.debian.org/debian experimental main contrib non-free deb-src http://ftp.debian.org/debian experimental main contrib non-free deb http://security.debian.org/ jessie/updates main contrib non-free deb-src http://security.debian.org/ jessie/updates main contrib non-free deb http://ftp.it.debian.org/debian/ jessie-updates main contrib non-free deb http://ftp.it.debian.org/debian/ jessie-proposed-updates contrib non-free main deb-src http://ftp.it.debian.org/debian/ jessie-updates main contrib non-free Other repository Code: Select alldanielrichter2007-grub-customizer-jessie.list deb-multimedia.list firestorm.list google-chrome.list google-earth.list google-talk.list irie-opencollada-builddep-jessie.list jenkins-debian-glue.list jenkins.list neuro.list steam.list webupd8team.list | Ok, solved. Not the most elegant of ways ... but solved I tried to compile from source the CMake with the debian method ... but with poor results: Code: Select allroot@workstation:~# apt-get build-dep cmake ..... root@workstation:~# apt-get -b source cmake 99% tests passed, 1 tests failed out of 318 Label Time Summary: Label1 = 0.02 sec Label2 = 0.02 sec Total Test time (real) = 567.04 sec The following tests FAILED: 229 - CMakeOnly.AllFindModules (Failed) Errors while running CTest make[2]: *** [test] Error 8 make[2]: Leaving directory `/root/cmake-2.8.12.1/Build' dh_auto_test: make -j1 test ARGS=-E CTestTestUpload ARGS+=-j1 returned exit code 2 make[1]: *** [override_dh_auto_test] Error 2 make[1]: Leaving directory `/root/cmake-2.8.12.1' make: *** [build] Error 2 dpkg-buildpackage: error: debian/rules build gave error exit status 2 Comando "cd cmake-2.8.12.1 && dpkg-buildpackage -b -uc" di generazione non riuscito. E: Creazione processo figlio non riuscita So at some point exhausted by the various attempts, i entered the source directory (folder created from the file that apt has downloaded and unpacked for me), and i've compiled and installed manually all in the classic way: Code: Select allroot@workstation:~# cd cmake-2.8.12.1/ root@workstation:~# ./bootstrap root@workstation:~# make root@workstation:~# make install And now everything works fine. Maybe i will have some problems during the updates, but now i know how to solve. I can mark the thread as SOLVED, but it would be interesting to understand why fails the test phase with the debian way. |
I have a code that uses the Firefox webdriver with Selenium to execute a couple javascript commands and fetch me some info. Since Debian doesn't use Firefox by default, and Selenium doesn't recognize Iceweasel as the equivalent of Firefox (which may be reasonable, but still kinda dumb), I downloaded and extracted the firefox-28.0 bz2 folder to my desktop. Next, I used the top answer suggested here to point Selenium to the binary: Code: Select allfrom selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary [...] binary = FirefoxBinary('~/firefox/firefox-bin') driver = webdriver.Firefox(firefox_binary=binary) However, it results in this error message: Code: Select allTraceback (most recent call last): File "./seltest.py", line 19, in <module> driver = webdriver.Firefox(firefox_binary=binary) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__ self.binary, timeout), File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__ self.binary.launch_browser(self.profile) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 60, in launch_browser self._start_from_profile_path(self.profile.path) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 83, in _start_from_profile_path env=self._firefox_env).communicate() File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory Did I set the binary path incorrectly or something? | Shouldn't it look like this: Code: Select allbinary = FirefoxBinary('~/firefox/firefox') |
Hello, I've just installed Debian 7.4 on my PC. I need python 3.3.2 or higher AND python3-lxml for my inner developments. As python 3.2 is the base line for the python3.x serie in debian wheezy Ive' compiled a 3.4.0 python version and uninstalled the old 3.2. (it also uninstalled some gnome dependencies). After that work Python3 packages (cherrypy for ex) install fine and can be imported thru the interpreter. When trying to install python3-lxml , the system needs to install the lxml repository dependencies as python3.2 ... that I just don't want to. So I decided to compile lxml over python 3.4.0. Dependencies installed : * libxml2 >= 2.7.8 * libxml2-dev * libxslt1= >= 1.1.26 * libxslt1-dev Code: Select allsudo apt-get install libxml2 libxml2-dev libxslt1 libxslt1-dev I think that only the *-dev packages are required, aren't they ? The problem is that I faced this issue while compiling in the source directory : Code: Select alljeby6372@mercure:~/Pack/lxml-3.3.4$ sudo python3 setup.py build Building lxml version 3.3.4. Building without Cython. Using build configuration of libxslt 1.1.26 Building against libxml2/libxslt in the following directory: /usr/lib /opt/python-3.4.0/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) running build running build_py copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.4/lxml/includes running build_ext building 'lxml.etree' extension gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/jeby6372/Pack/lxml-3.3.4/src/lxml/includes -I/opt/python-3.4.0/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w gcc -pthread -shared build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -L/usr/lib -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-3.4/lxml/etree.cpython-34m.so /usr/bin/ld: cannot find -lz collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 the -lz option is not recognized by the gcc. For information i've install the tool chain with : Code: Select allsudo apt-get install build-essential Any idea ? In advance thanks for your help. | Try install zlib1g and zlib1g-dev. peter. |
I've been trying to install GCC, and it's being difficult. The first thing I tried was "sudo apt-get install gcc". The terminal threw this error at me: Code: Select allErr http://ftp.us.debian.org/debian/ wheezy/main libc-dev-bin i386 2.13-38 404 Not Found [IP: 64.50.233.100 80] Err http://ftp.us.debian.org/debian/ wheezy/main linux-libc-dev i386 3.2.51-1 404 Not Found [IP: 64.50.233.100 80] Err http://ftp.us.debian.org/debian/ wheezy/main libc6-dev i386 2.13-38 404 Not Found [IP: 64.50.233.100 80] Failed to fetch http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc-dev-bin_2.13-38_i386.deb 404 Not Found [IP: 64.50.233.100 80] Failed to fetch http://ftp.us.debian.org/debian/pool/main/l/linux/linux-libc-dev_3.2.51-1_i386.deb 404 Not Found [IP: 64.50.233.100 80] Failed to fetch http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc6-dev_2.13-38_i386.deb 404 Not Found [IP: 64.50.233.100 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? I checked, and the reason it can't get those files is because they are not in the repositories. Not deterred, I tried to install GCC manually. This is what I got: "configure: error: no acceptable C compiler found in $PATH". That's probably because I don't have a compiler. This is the output from my console when I look for one: Code: Select allportabuild@PAB-Deb:~/gcc$ /usr/bin/cc bash: /usr/bin/cc: No such file or directory portabuild@PAB-Deb:~/gcc$ /usr/bin/gcc bash: /usr/bin/gcc: No such file or directory Debian, just how am I supposed to install GCC if I need to install GCC before I can install GCC? I'm in a pickle. Not even apt-get build-essentials works. So, my question is, how can I install GCC? | E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? Did you try apt-get update first? |
I'm sure this is really really simple, but I can't figure it out. Background: I want to run a script something like once a week, but my computer isn't on 24/7 so I thought I'd run this script every day with a cron job and the first thing it does is see whether it has been run in the last 7 days or not. If it finds a file in a certain directory from any time in the last 7 days then just exit. I can do the search easily with "find dir -mtime -7" but what I can't seem to do is persuade a bash script to react to whether this "find" has found something or not. My first attempt was like this:Code: Select allif find somedirectory -mtime -7; then echo "returned true" else echo "returned false" fi but of course the find command always returns success, even when it didn't find anything. And I can't find any options to find to change the return code. Another idea was to pipe the output of find to "wc -l", but that's ugly. So I tried setting some variable like this:Code: Select alllet "foundSomething=0" find somedirectory -mtime -7 -exec let "foundSomething=1" \;but I can't get that to work either. This should be really simple, can anyone help? | Try putting the find results in a variable, and test if the variable is empty or not. Something like this might work:Code: Select alllastweek=$(find somedirectory -mtime -7) if [[ -z "$lastweek" ]]; then run-your-script fi |
Hi everybody, I'm trying to install TeXLive 2013 on my Debian Wheezy KDE desktop, 32bit processor. In Konsole I've done this: Code: Select allwget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz then this: Code: Select alltar -xvzf install-tl-unx.tar.gz Next, Code: Select allcd install-tl* Went root: Code: Select allsu Installed perl-tk from the repos (v. 1:804.030-1) then gave Code: Select all./install-tl -gui perltk Instead of getting the nice graphical interface I get the text interface: Code: Select allroot@aliquis:/home/guest/install-tl-20140123# ./install-tl -gui perltk No protocol specified perl/Tk unusable, cannot create main window. Error message from creating MainWindow: couldn't connect to display ":0" at /usr/lib/perl5/Tk/MainWindow.pm line 53. Tk::MainWindow->new() at ./install-tl line 339 Continuing in text mode... Switching to text mode installer, if you want to cancel, do it now. Waiting for 3 seconds ^[Loading http://ctan.mirror.garr.it/mirrors/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb Installing TeX Live 2013 from: http://ctan.mirror.garr.it/mirrors/CTAN/systems/texlive/tlnet Platform: i386-linux => 'Intel x86 with GNU/Linux' Distribution: net (downloading) Using URL: http://ctan.mirror.garr.it/mirrors/CTAN/systems/texlive/tlnet Directory for temporary files: /tmp ======================> TeX Live installation procedure <===================== ======> Letters/digits in <angle brackets> indicate <======= ======> menu items for commands or options <======= Detected platform: Intel x86 with GNU/Linux <B> binary platforms: 1 out of 21 <S> set installation scheme (scheme-full) <C> customizing installation collections 44 collections out of 45, disk space required: 3535 MB <D> directories: TEXDIR (the main TeX directory): /usr/local/texlive/2013 TEXMFLOCAL (directory for site-wide local files): /usr/local/texlive/texmf-local TEXMFSYSVAR (directory for variable and automatically generated data): /usr/local/texlive/2013/texmf-var TEXMFSYSCONFIG (directory for local config): /usr/local/texlive/2013/texmf-config TEXMFVAR (personal directory for variable and automatically generated data): ~/.texlive2013/texmf-var TEXMFCONFIG (personal directory for local config): ~/.texlive2013/texmf-config TEXMFHOME (directory for user-specific files): ~/texmf <O> options: [ ] use letter size instead of A4 by default [X] allow execution of restricted list of programs via \write18 [X] create all format files [X] install macro/font doc tree [X] install macro/font source tree <V> set up for portable installation Actions: <I> start installation to hard disk <H> help <Q> quit Enter command: Q root@aliquis:/home/guest/install-tl-20140123# How do I get the perltk interface? Clearly what I have installed isn't good enough. I'd like to be able to choose the packages I need now and tick the extra packages along the way, when I need them. | Anyone knows what went wrong? Why isn't the nice perltk GUI showing up? |
hi I'm looking for script, running on the admin desktop to change /etc/hostname and /etc/hosts. | You just want to add entries to the end of the host file? Script: !# /bin/bash echo "whatever-you-want" >> /etc/hosts You will have to be root for this to work. |
Hi guys, I'm using Python 2.7.5 64 bits and I have a problem when importing libraries that were installed via PIP when importing them inside Eclipse (version 4.3.1). Outside Eclipse (directly in Python's shell) everything works fine, here is an example: Code: Select all>>> import numpy # installed from repositories >>> from numpy import array >>> import pybrain # installed via PIP >>> from pybrain import Network >>> Everything works outside Eclipse. But inside Eclipse I can't import libraries installed via PIP using "from x import y" format, it will give an error. The only way I can import libraries installed via PIP is using "import x" format. Here is an example: Code: Select allimport numpy # no errors (installed from repositories) from numpy import array # no errors import pybrain # no errors (installed via PIP) from pybrain import Network # gives the error below Traceback (most recent call last): File "/media/arquivos/pybrain_import_test.py", line 4, in <module> from pybrain import Network ImportError: cannot import name Network I suspected it could be related to virtualenv, but here is a print screen of my Python's PATH. The directory /usr/lib/python2.7/site-packages where PyBrain is installed is already in Python's PATH inside Eclipse. Could someone help me, please? | Code: Select allImportError: cannot import name Network If you import modules, most likely they have been compiled to pyc. Delete pycs and modules will be recompiled with fresh data. Code: Select allfind . -name "*.pyc" | xargs rm Or maybe it attempts to compile into pyc but the directory is not writable. Change permissions. |
Hi all I have a couple of shell scripts (#!/bin/sh i.e. dash), and I want them to include a common source file for configuration. Since it is my own scripts, they are either in /opt or in a local git repo somewhere. I then make a symbolic link to some sane location in my path, say, ~/bin or /usr/bin. The question is how to figure out which path the config file is at. I have in the path /usr/bin/MyScript.sh --> /home/me/somepath/git/Scripts/MyScript.sh And in the git repo /home/me/somepath/git/Scripts/MyScript.sh /home/me/somepath/git/Scripts/MyScript_cfg.sh Directory stuff pwd - current directory - not useful dirname $0 - yields /usr/bin readlink $0 - works, but only if it is a link, not if it is the "real" script. I have been searching a lot and I don't find a simple solution to what I expected to be a common problem. I found big multiline solutions, and a lot of differences between the different shells. I am just hoping that someone knows of an easy way to do this. regard moz | test case: Code: Select allmkdir test1 test2 echo -e 'pth=`realpath $0`; dr=`dirname $pth` sh $dr/config.text' > test2/test.sh echo ' echo "This is a config file" ' > test2/config.text ln -s ../test2/test.sh test1/test.sh sh test1/test.sh sh test2/test.sh Is that what you're looking for? Basically, get the path, then get the directory Code: Select allpth=`realpath $0`; dr=`dirname $pth` sh $dr/config.text Works for both links and 'real' files. |
Goodnight to everyone, I have a (hope small and easy) request: I have bought a pdf dictionary, but I would like to convert it to stardict for my ereader. I have converted the pdf into txt but is quite a bad result. So I need to reorganize a bit the txt. I'm not a programmer, so I should need you write me a small script (python, sed, bash...) that if at the end of the line there is not a point then the line have to be joined with the following line. Sometimes happens that there is a point even in the middle of the line: in this case the line have to be splitted. Once last thing: after the first word it's needed a TAB. I have appended a preview of the txt file. I know it's a quirk request, but I really need the dictionary to learn spanish. Thank you very much | Code: Select alldos2unix first_pages.txt sed -e '/[A-Z]$/d' -e '/^$/d' first_pages.txt|tr ' ' ' ' | sed -e 's/\./\. /g' -e 's/\ / /' -e 's/\-\ //g' Not pretty but seems to get the job done -- first get rid of the A, B, C etc. headers, then get rid of all empty lines, then all linebreaks using tr, then put line breaks after all periods, replace the first space in each line with a tab and replace all instances of '- ' with, well, nothing. First 20 lines first_pages.txt: A a prep a, ad; (temporale) a; (locativo) su; (con verbi di movimento) a; in ◊ a las siete alle sette; a la puerta sulla porta; voy a casa vado a casa; se marchó a España se ne andò in Spagna; corrió a su coche corse verso la sua macchina; espero a mi hermana aspetto mia sorella; a todo correr di corsa. abad sm abate. abadejo sm merluzzo; baccalà. abadesa sf badessa. abadía sf abbazia. abajo avv da basso, giù, sotto ◊ inter abbasso ◊ cuesta abajo giù per la disce- sa; de arriba abajo dall’alto in basso; formatted.text: a prep a, ad; (temporale) a; (locativo) su; (con verbi di movimento) a; in ◊ a las siete alle sette; a la puerta sulla porta; voy a casa vado a casa; se marchó a España se ne andò in Spagna; corrió a su coche corse verso la sua macchina; espero a mi hermana aspetto mia sorella; a todo correr di corsa. abad sm abate. abadejo sm merluzzo; baccalà. abadesa sf badessa. abadía sf abbazia. abajo avv da basso, giù, sotto ◊ inter abbasso ◊ cuesta abajo giù per la discesa; de arriba abajo dall’alto in basso; hacia abajo in giù. abalanzar v tr bilanciare. abalanzarse v rifl avventarsi, scagliarsi. abanderado sm portabandiera (m/f); iscritto. abandonar v tr abbandonare, lasciare; trascurare. abandonarse v rifl lasciarsi andare, avvilirsi, scoraggiarsi; (fig) trascurarsi; affidarsi. abandono sm abbandono; (dei beni) rinuncia (f); (sport) abbandono, forfait. abanico sm ventaglio. abaratar v tr abbassare (i prezzi). abarcar v tr abbracciare, cingere; circondare; (Messico) accaparrare. abarracado agg accampato. abarrotar v tr stipare; riempire completamente; ingombrare. abarrotarse v rifl (Perù) deprezzarsi. abastecedor sm fornitore. abastecer v tr approvvigionare, rifornire. |
Just an observation: could things be any more convoluted? Today I installed ruby1.9.3 on my Debian system. After I finished my initial playing around with it, I decided to see how things are set up. First I ran "which ruby", which responded /usr/bin/ruby. Nice and clean, so far. Next, I ran "ls -l /usr/bin/ruby". This showed that ruby is a symbolic link to /etc/alternatives/ruby. Hmmm. So, I ran "ls -l /etc/alternatives/ruby" and found that this is a symbolic link to /usr/bin/ruby1.9.1. Almost back where I started. Except I thought it was supposed to be 1.9.3. So, I ran "ruby -v" and got ruby 1.9.3p484... So, it is 1.9.3, but the filename is 1.9.1. Please, make things more confusing! Tim | There is nothing confusing but that /etc/alternatives/ruby points to 1.9.1 (for that ask in #debian-ruby irc.oftc.net irc channel). Is your question what /etc/alternatives is used for? Use rvm: https://rvm.io/ (then we can talk about "confusing"). |
Running debian wheezy. I noticed recently, whenever I fork a process using "&" from a terminal, such as Code: Select allleafpad & it starts up, shows the processid in the terminal, but every time when I close the terminal, leafpad gets killed. However, I create a simple bash script, Code: Select all#!/bin/bash leafpad& exit The script launches leafpad, then exits out leaving leafpad running, as it should. Is what I mentioned above normal? I'm confused, because I think I used to be able to do this in terminal without it depending on the terminal to stay running. edit: SOLVED by the kind and wise people below. Yep, I guess I'm remembering wrong. As it turns out, commands begun on terminal get closed with terminal unless, as mentioned, you use nohup or start subshell. Process hierarchy and tracking etc. is something I'm just beginning to understand. Thanks for the help. | You'll want: Code: Select allnohup leafpad & |
I am not the best Google searcher on this topic as I'm not too familiar with this problem but everything I find seems to tell me to use math.h. Which I am. I am trying to refresh my C/C++ skills. I have this sample code that runs properly on my phone (Android 4.1.2). All it is supposed to do is output pi to the given decimal place but it gives me "undefined reference to pow" and "undefined reference to sqrt" when I run it in geany. Does this mean I have an incomplete math header? Any advice on how to resolve this? gcc -Wall -o "calc_pi" "calc_pi.c" (in directory: /home/inktitan/Documents/Code/SampleCode) /tmp/cc77lqwF.o: In function `main': calc_pi.c:(.text+0x41): undefined reference to `pow' calc_pi.c:(.text+0x4d): undefined reference to `sqrt' collect2: error: ld returned 1 exit status Compilation failed. Code: Select all#include <stdio.h> #include <stdlib.h> #include <math.h> //for more accurate result increase the value #define ITERATION 9999 int main (void) { double pi = 0.0; int n = ITERATION; int i; for( i = 1; i<=n; i++ ){ pi += sqrt( (double)1.0 - pow( ( (double)(2.0*i)/n - (double)1.0 ) , 2 ) )*((double)2.0/n); } pi *= (double)2.0; printf("%f ", pi); return (0); } | I think you want to tell gcc to link it: gcc -lm mathtest.c http://stackoverflow.com/questions/1033 ... brary-in-c http://gcc.gnu.org/onlinedocs/gcc-4.8.2 ... nk-Options Both didn't make me understand why, but i am sure there are people who do understand and can explain. If not try a C board or unix.org. If you get help elsewhere and it is clear i would appreciate if you link to it here (if it gets explained here that is superfluous: duh ) |
Hi, First of all I want to apologize for my zero knowledge in bash programming. I am writing a script that calls a program which writes a lot of lines to stdout continuosly. If the last line in stdout has some regex, THEN, certain variables are updated. My problem is that I don't know how to do that. A simplified example would be (it's not my exact case, but it I write it here to clarify): suppose I issue a ping command (which writes output to stdout continuously). Every time that the response time is t=0.025 ms, THEN, VARIABLE1=(column1 of that line) and VARIABLE2=(column2 of that line). I think the following code would work in awk (however, I want the variables in bash and I don't know how to export them) Code: Select allping localhost |awk '{ if ( $8 == "time=0.025" ) var1=$1 var2=$2}' In the previous code, awk analyzes each line of the output of the ping command as soon as it is created, so the variables $var1, $var2, ... are updated at the appropriate time. But I need the "real-time" updated values of $var1, $var2 in bash, for later use in the script. Does anybody knows how can I do that? Do I need some kind of loop or something? | I'm not a guru in awk, but you may make it such: Code: Select allvar="" var1= var2= var=`ping localhost | awk '{ if ( $8 == "time=0.25" ) printf("%s %s",$2,$3)}'` if [ ! "$var" = "" ] ; then var1=`echo $var | awk '{printf("%s",$1)}'` var2=`echo $var | awk '{printf("%s",$2)}'` fi It is a bad solution, but it works. Peter. |
Hello folks, I would like to know how to upgrade to the latest release my gcc compiler set. I have a 4.4.5 version running on a Squeeze "stable" release. Thank you for your kind replies, | The most recent build is gcc-4.8. Download the source files from mirrors Follow the instructions at installation page. Normally, all you would have to do should be Code: Select alltar xzvf gcc-<version> cd gcc-<version> ./contrib/download_prerequisites cd .. mkdir build cd build ../gcc-<version>/configure make make install disregard the third line if you wish to compile the prerequisites yourself, but it is highly discouraged. gcc wiki page on installing GCC should be a big help. the code quote above is from the said page. |
Hi. I'm trying to build gcc 4.7 on Debian squeeze and i'm having a compilation problem that I cannot solve. I have compiled all the dependencies that I need(gmp, mpfr, mpc, ppl, and CLooG). they're all built into /usr/local. I have a ~/works/gcc directory, and gcc/src contains all the source files and gcc/build is my build directories. I configured it on gcc build directory: Code: Select all../../src/gcc-4.7.0/configure --prefix=/usr/local/ --program-suffix=4.7 --enable-cloog-backend=isl all the dependencies are omitted because they're all in /usr/local. (I've tried it with full option with /usr/local, just to be sure. in other words, Code: Select all configure --prefix=/usr/local/ --with-gmp=/usr/local ... etc having given the premises, in the middle of the compilation I come across this error during the make(important parts are the first two lines and the last three lines: Code: Select all make[3]: Leaving directory `/home/niuzeta/works/gcc-4.7/build/gcc/gcc' mkdir -p -- i686-pc-linux-gnu/libgcc Checking multilib configuration for libgcc... Configuring stage 1 in i686-pc-linux-gnu/libgcc configure: creating cache ./config.cache checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... mawk checking for i686-pc-linux-gnu-ar... ar checking for i686-pc-linux-gnu-lipo... lipo checking for i686-pc-linux-gnu-nm... /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/nm checking for i686-pc-linux-gnu-ranlib... ranlib checking for i686-pc-linux-gnu-strip... strip checking whether ln -s works... yes checking for i686-pc-linux-gnu-gcc... /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/home/niuzeta/works/gcc-4.7/build/gcc/i686-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] Error 1 so apparently it couldn't compute suffix of object files and could not compile. A gcc faq has a section for this issue. It directed me to look at the config.log file at the path. so I looked at it. I'll leave an excerpt of the file that should be relevant to this case: The following is the entire error section for reference; for shorter, more focused and more relevant excerpt go ahead and skip the immediately following. Code: Select allConfigured with: ../../src/gcc-4.7.0/configure --prefix=/usr/local/ --program-suffix=4.7 Thread model: posix gcc version 4.7.0 (GCC) configure:3418: $? = 0 configure:3407: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -V >&5 xgcc: error: unrecognized command line option '-V' xgcc: fatal error: no input files compilation terminated. configure:3418: $? = 1 configure:3407: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -qversion >&5 xgcc: error: unrecognized command line option '-qversion' xgcc: fatal error: no input files compilation terminated. configure:3418: $? = 1 configure:3434: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -o conftest -g -O2 conftest.c >&5 /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/cc1: error while loading shared libraries: libppl_c.so.4: cannot open shared object file: No such file or directory configure:3437: $? = 1 configure:3625: checking for suffix of object files configure:3647: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -c -g -O2 conftest.c >&5 /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/cc1: error while loading shared libraries: libppl_c.so.4: cannot open shared object file: No such file or directory configure:3437: $? = 1 configure:3625: checking for suffix of object files configure:3647: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -c -g -O2 conftest.c >&5 /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/cc1: error while loading shared libraries: libppl_c.so.4: cannot open shared object file: No such file or directory configure:3651: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU C Runtime Library" | #define PACKAGE_TARNAME "libgcc" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "GNU C Runtime Library 1.0" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "http://www.gnu.org/software/libgcc/" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3665: error: in `/home/niuzeta/works/gcc-4.7/build/gcc/i686-pc-linux-gnu/libgcc': configure:3668: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. My understanding of the problem is the first part. I'll copy it here for readability. Code: Select allconfigure:3418: $? = 0 configure:3407: /home/niuzeta/works/gcc-4.7/build/gcc/./gcc/xgcc -B/home/niuzeta/works/gcc-4.7/build/gcc/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -V >&5 xgcc: error: unrecognized command line option '-V' xgcc: fatal error: no input files configure:3418: $? = 1 the previous operation had an exit status of 0, whatever it was. then the xgcc operation with a lot of options attached. but there's no input file. I have no idea why it had to reference '.' before going into gcc subdirectory, but this doesn't seem to have to do anything with any of the dependencies. the error message later says it failed to find shared object file libppl_c.so, but it is indeed in /usr/local/libs. I think the error on libppl_c is misleading because xgcc argument failed first and I think it caused the later error to occur. I am quite stumped and if anyone could shed an insight I would be grateful. EDIT: edited the subject to better fit the problem now that the problem is resolved. | I solved it. As it turned out, I had not given the compiler the correct path for shared library. The rest of this post is in case anyone looks for the same problem. http://gcc.gnu.org/onlinedocs/libstdc++ ... ge.dynamic this link discusses exactly the problem I faced. what I precisely did was, Code: Select all$export LD_LIBRARY_PATH=/usr/local/lib where /usr/local/lib/ is where all my static libraries are, including the dependencies such as ppl.(mostly ppl). |
Hi, I have a piece of bash code like the following Code: Select allfor file in *.dat; do echo -n "${file}, " done That will give Code: Select allfile1.dat, file2.dat, file3.dat, The thing is, I want to get rid of the last ", ". I have tried appending an echo -e "\b\b" to delete the last two characters, but that does not seem to work. I'm kind of new to bash scripting, so perhaps there is an easier way to achieve the same. Perhaps it is possible to process all the files in *.dat except the last one inside de do, and then write an specific echo to print the last file without the final colon, but I would not know how to do that. Thanks for your help. | It sounds like you're looking for a utility program that works like Perl's join to glue things together intelligently. (That is, not to put the glue string after the last element.) I feel like the shell should have something like that, but at the moment, I can't come up with it. (join in the shell works on multiple files, not strings or parameters as far as I can tell.) Anyhow, here's how you can do it manually: Code: Select alllast="" for file in *dat; do if [ "$last" ]; then printf "%s, %s" "$last" "$file" fi last="$file" done printf " " |
My programing knowledge is extremely limited, however I am trying to learn. I have been messing around with bash scripts and looking at some of the init.d scripts to understand them, however there is one line that I don't nessessarly understand. [ -f /var/log/dmesg ] out of if which dmesg >/dev/null 2>&1 then [ -f /var/log/dmesg ] && savelog -q -n -l -p -c 2 /var/log/dmesg dmesg -s 524288 > /var/log/dmesg I'm just trying to figure out what that section does. Any help or a general direction would be awesome. Thanks - Aaron | [ is the same like the command test (man test), -f checks if the file is there and a regular file, and && will execute the following command only if the previous returned with success (as opposed to ; After ; the following command will be run in each case) [ -f save.txt ] && echo "foo bar baz" >> save.txt If the file save.txt exists, it returns success, and the next command will be run (echo "foo bar baz" and redirect the output to save.txt). If the first part ( [ -f save.txt ] ) fails, nothing will happen. If you don't want your code to be portable, then [[ is a bit more comfortable than [ (Iow: [[ is a bashism ) Or somehow like that. I am not too sure. There are many sublime differences in bash code (+ a lot of dark corners), and i barely know the basics. I usually can copy and paste bash code. Just search for "bash test" , there should be explanations out there, including all the confusing details. |
I have an X11 window that I'm trying to set a window title on with: Code: Select allXStoreName(X_display, X_window, "Window Title"); and although the window title is set on the decoration, it shows "Unknown" in Gnome3's panel. This did work in Gnome 2, so I don't know what's changed or different. I'm using C. | Interestingly, the window title shows correctly next to the window preview in Gnome Shell's overview. But it shows "Unknown" in the panel and in the dock. |
I can't run UNetBootIn on Debian. It turned out that the libgthread files are missing. I've tried to reinstall it, but it didn't extract them, so I needed to extract and move them, but they've left unattended, so UNetBootIn still crashes. I think that the flies wasn't prepared. So I'd like to edit the said package to make it extract those files. But how can I do it? | You have messed up your system and you need to fix it before trying to do anything else. If you are going to 'install' a program on your system then that program needs to be the proper version to work with the libs already on your system. And once again, unetbootin is not needed anyway. |
Hello, I need to read a privileged file (my mailbox, and also other similar files) into a PHP script. I have tried many variants, but the result always comes out empty. Here is one of many tries that only returns an empty string. Code: Select all$out = shell_exec('echo "ROOTSPWD" | su -u root -S "cat /var/mail/MYUSER"'); echo $out; Please tell me how to execute Linux system commands as root in a web-page PHP script. Thanks in advance. | This is what sudo is for. If i want user www-data to run ethtool, I put this in /etc/sudoers: Code: Select allwww-data ALL=(root)NOPASSWD:/sbin/ethtool This allows www-data user run ethtool without password (but nothing else, this is important!). And just run ethtool in the script. |
Hello All! I am working with Quanta+ for some time and I really love that program. Now, with the release of Squeeze, it is missing from the repositories. Before writing here I tried backports but couldn't find Quanta in there. I also tried to compile version 3.5.8 but I got blocked at an error message that states that Qt stuff should be of version bigger than 3.x and smaller than 4. I don't remember the exact numbers and since then I messed things up, ending up with a "checking for KDE... configure: error: in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!" error. The problem is that I have no idea how to clean this up since i don't know what variables have been changed while installing many packages that other forums have stated are necessary. I also have downloaded Quanta 4.5 sources but it seems like, it is not compiled in the old-fashioned .configure, make, make-install way (it doesn't even have a configure file). Any ideas how to solve this problem? I really would like to go on with this wonderful program. Thank you! | Hi, you may try installing kdelibs4-dev package. I looked and tried to backport that program, but there are too many dependencies on KDE3.5 programs that add some extra functionality. Anyways, when I installed kdelibs4-dev package, configure went okay. Didn't try to build it. |
Did anybody have netbeans "javadoc not found" problem before? I had solved the problem before but unfortunately don't remember what I did. This time I added all possible javadoc folders that are under the /usr/lib/jvm, using the Tools -> Java Platforms -> JavaDoc but no luck. | Here is the solution just in case if anybody else encounters the problem: Go to main menu "Tools -> Java Platforms" choose the platform from the left panel, and activate the "Javadoc" tab. Press "Add URL" button, enter the value "http://download.oracle.com/javase/7/docs/api" and click OK. Move the recently entered value up so it will be the first one in the list in case if you have multiple entries in the list. |
Good morning, I find myself having to do several things repeatedly(across @400 machines this time) and would Love to automate this task as much as possible. The following is a list Note: this will need to be done by ip address 1. Logon as root 2. copy an existing script from my pc to the root of another 3. change permissions of this script 4. Execute said script Not asking to much is it..... Hahaha Seriously though any help Greatly appreciated. Chad | Chad, not an expert, but here's my best effort. It assumes that you have key-based ssh login set up. The script uses a list of ip addresses stored in a file called iplist.dat which is passed on using xargs, transfers a file called "mytest" to ~/tmp on a remote host via scp, and changes the permissions to +x using ssh. You could probably use e.g.a python script to elegantly generate a list of ip addresses on the fly and pass them to the script. test.sh: Code: Select all#!/bin/bash scp mytest me@$1:/home/me/tmp ssh me@$1 "chmod +x /home/me/tmp/mytest && /home/me/tmp/./mytest" iplist.dat Code: Select all192.168.1.120 192.168.1.101 192.168.1.150 mytest: Code: Select allhostname Running it gives: Code: Select allme@beryllium:~$ cat iplist.dat |xargs -I {} ./test.sh {} mytest 100% 9 0.0KB/s 00:00 neon mytest 100% 9 0.0KB/s 00:00 boron mytest 100% 9 0.0KB/s 00:00 tantalum (neon is the hostname of 192.168.1.120, boron 192.168.1.101 and tantalum 192.168.1.150) You can suppress the Code: Select allmytest 100% 9 0.0KB/s 00:00 by using the -q switch for scp. I don't see how it would be any different running this as root -- the main issue is setting up key-based authentication, which you would probably have done already for a 400 node system. Hopefully this will point you in the right direction. |
I am using Debian 7 (Wheezy/Testing). I installed the drupal7 package and localhost/drupal and localhost/drupal7 aren't working. localhost alone says "It works!" (and other stuff) and localhost/phpmyadmin also works so it must be something drupal-specific. I would rather not use something out of the official repositories. If more information is needed, just ask and any help would be greatly appreciated! | Have a look in /etc/apache2/conf.d/drupal.conf for it's vhost directives. That should tell you the virtual dir to use and also the log file (if not the defasult apache one) to check. Maybe just removing the default /var/www/index.html will then allow index.php to be served as the default file for the dir. FWIW it will be obvious and simple once you work out how it is set up. Debian default setups are usually very well thought out. |
So I am writing a piece of code where the originality version was written in Arduino (based on C/C++) and the new version is in Python. The two pieces are Code: Select all0x80|(variable<<3)|((othervariable&0x3FF)/128) and Code: Select all(variable&0x3FF)&0x7F I need help porting this to Python so I can execute it. Please help. I would make this into a tiny C/C++ script, but I have a horrible inability to code in C/C++ . Thanks! Coffeeman | I think those pieces are valid python code too, and has the same meaning. |
I really like the standard syntax that most Unix applications use on the command line, it's easy to use and understand, and is standard. I'm creating come applications myself in C++ and I think I'll use the same standard. Is there a standard way that this »option syntax« is implemented? And if yes, how? I've tried out using a switch statement that searches argv's i^th elements second character to implement this the first time. Here's a sample of the code: Code: Select allfor(int i = 1; i < argc && wrongCase==false; i++) { switch (argv[i][1]) { case 't': *language=argv[++i]; break; case 'l': *table=argv[++i]; break; case 'a': showTables = true; break; case 'k': showLanguages = true; break; default: cerr << "allowed values are only -f and -d" << endl; wrongCase=true; break; } } Am I doing it right? I'd also like to know how the »mutually exclusive« options are implemented i.e. options that cannot be used together. | Code: Select allapt-get install libgetopt++1 |
I've been doing some C++ programming these days (obviously ), and have pretty much gone through most of what's needed to be known. I've also come across something that's called a »vector« in C++. There appears to be very little information about vectors, so I'd like to know: What are vectors? Should they be used? What are their uses? Thanks beforehand for any answers. | They are classes which are used to store lists of structures/objects/simple data types. However, why didn't you search the internet for such a basic c++ construct? |
I am not sure whether this is the right board to ask since it is not actual programming. Today I had to rename a batch of files to .mp3. Having tried the find, mv, and rename commands, I searched and usedCode: Select allfor i in *;do mv $i $i.mp3;done1. I would like an explanation of what the letter i is, if another letter can be used as well, and why the dollar sign is used in the second part of the command. I believe that it can also be done with the sed command which is similar to the rename command. If anyone is interested give me an example for each. I am not familiar with regular exppressions. 2. The find command I tried was similar to thisCode: Select allfind *i386* -exec mv {} 'directory' \;My questions on this one (not relevant to the first part, renaming), is what the brackets {} after the mv command are (it looks like "all output files"), and is why the last two characters (\ and ; ) are needed and what do they do. | (1) The letter i is a 'variable'. It's basically a name for a place that's used to store stuff. In this case, i is used as a "counter" to count however many files you happen to have. And yes, you can use (nearly) any name you like. The use of i is merely an leftover from the earliest days of programming. Lots more information, including the answer to your question on the use of $, is available from most any decent shell scripting tutorial. Here's the first one that came back from a StartPage search for shell variables: http://lowfatlinux.com/linux-script-variables.html (2) The find man page addresses these exact questions. If you're in a hurry, drop to the "examples" section, near the very end of the man page. And a couple of unsolicited corrections to your post: - FYI, sed is nothing like a rename command. Sed is more like a scriptable text editor. (Indeed the ed in sed stands for "editor.") - Shell scripting is indeed actual programming. A shell script contains all the same elements (loops, conditionals, etc.) as any other programming environment. One last thing... Your question makes it sound like you ran the code above without really understanding what it did, or how it did it. At the risk of pointing out the obvious, that's Really, Really Dangerous. Remember, code does not have the be malicious to be destructive. |
Code: Select all#!/bin/bash # Verficamos la presencia de zenity if [ ! -x "/usr/bin/zenity" ]; then echo "zenity no encontrado" exit 1 fi # contenedor SoundDir="/usr/share/sounds" # tema actual TemaActual=$(xfconf-query -c "xsettings" -p "/Net/SoundThemeName") # Llenar lista for item in $(ls -d $SoundDir/*); do if [ -f $item/index.theme ]; then Tema=${item##*/} if [ "$Tema" = "$TemaActual" ]; then echo TRUE else echo FALSE fi echo "$Tema" fi done | ans=$(zenity --list --text "Selecciona el tema de sonido" --radiolist --column "Estado" --column "Tema") if [ "$?" = "0" ]; then echo $ans fi I can't display the value of $ans...any ideas? | When you use pipes, they create separate shells. They have their own variables scope, the $ans which you set in the pipe becomes irrelevant in the later context, since it goes out of scope. Consider these two examples: Code: Select all#!/bin/bash for ((i=1; i<6; i++)) do printf "false $i " done | ans=$(zenity --list --text "Test" --radiolist --column "Choice" --column "Value") echo $ans Code: Select all#!/bin/bash ans=$( zenity --list --text "Test" --radiolist --column "Choice" --column "Value" < \ <( for ((i=1; i<6; i++)) do printf "false $i " done ) ) echo $ans First one repeats your pattern, and uses pipe. The scope of the $ans is limited to the pipe, and $ans later is unset (since it's a different variable). Second example doesn't use pipes, it uses temporary file descriptor which is directed as input for zenity. In this case $ans is in the same scope, and can be used later. |
I have a textfile with some lines and i want my prompt to be one randomly selected line of that file that changes every time there is a new prompt. Can this be done? Is there a way to execute a shell script whenever i hit enter in bash? | search the 'bash' manpage for PROMPT_COMMAND (if you need more instruction, ask; but that should start you in the right direction). |
How can i use sgb, Stanford Graph Base, once it is installed? I did "locate sgb" and "man sgb" and "man cweb", to no avail. I did a short search with duckduckgo, same problem. Will it be of any use for me, while trying to learn C? What i am looking for is C example code, mainly algorithms (but anything is fine, as long it's not too long). If it is of no use there is no need to explain to me how to use it (duh). thanks | nadir wrote:How can i use sgb, Stanford Graph Base, once it is installed? I did "locate sgb" and "man sgb" and "man cweb", to no avail. I did a short search with duckduckgo, same problem. From what I gathered, the package has sgbdemos in it. I tried it for kicks (assign_lisa and football) and I think they're meant to be taken as examples of what you can do with sgb (or rather gb_graph.h, if I'm not mistaken). CWEB seemingly consisted of two apps (ctangle, which converts the *.w files (a hybrid of TeX and C) to C source files and another one (I can't remember the name) that converts the .w files into TeX source files). If you download the sgb source, you'll find the .w files used for the example programs in it. nadir wrote:Will it be of any use for me, while trying to learn C? Hard to say (since I didn't delve in too deep), but I think not, at this point. nadir wrote:What i am looking for is C example code, mainly algorithms (but anything is fine, as long it's not too long). The source package provides examples that can be ctangle'd into plain C source files. nadir wrote:If it is of no use there is no need to explain to me how to use it (duh). I'm not totally sure if it's of no use or not. A lot of stuff by Mr. Knuth goes miles over my head but well, he's a renowned genius so that's kinda given. nadir wrote:thanks If this helped at all, you're welcome. |
I have a C program I wrote and compiled under GCC. I put the executable onto my data disk (FAT format) and tried to execute it with: /ddisk/p/exelin/PanBack1 </edisk/PANBACK1.txt (in Terminal) and got Permission Denied. I copied the executable to my home directory and when I entered ~/PanBack1 </edisk/PANBACK1.txt it worked fine. In each case I turned on all three execute permission bits. I searched TFW and don't have TFM. I am trying to figure out why I'm getting permission denied and if it's possible to run it out of /ddisk/p/exelin. WHY I am trying to do that or WHAT else I am trying to accomplish by doing so is not revelant -- please don't ask. This C program (no plus signs) is a simple filter with all input from STDIN and all output to STDOUT. This is my first attempt at programming under GCC. Does anybody know why this is? Caitlin | Can you run any other executables from the FAT disk? It can be mounted with 'noexec' parameter, in which case you won't be able to run any binary from there. |
How can i install the Gnu C libary without installing build-essential. Did a "apt-get install -s build-essential" and went through the list, searched the Web (did you ever search for questions related to C? big fun), apt-cache search libc --names-only, apt-cache search glibc --names-only, tried a bit. No luck. Code: Select alldemo@antiX1:~/C$ gcc tester.c tester.c:1:20: fatal error: stdlib.h: No such file or directory compilation terminated. Code: Select allThe following packages will be upgraded: cpp gcc libgcc1 libgomp1 libquadmath0 libstdc++6 6 upgraded, 13 newly installed, 0 to remove and 855 not upgraded. Inst gcc-4.7-base (4.7.1-2 Debian:testing [i386]) Conf gcc-4.7-base (4.7.1-2 Debian:testing [i386]) Inst libgcc1 [1:4.6.2-12] (1:4.7.1-2 Debian:testing [i386]) Conf libgcc1 (1:4.7.1-2 Debian:testing [i386]) Inst libstdc++6 [4.6.2-12] (4.7.1-2 Debian:testing [i386]) Conf libstdc++6 (4.7.1-2 Debian:testing [i386]) Inst libgomp1 [4.6.2-12] (4.7.1-2 Debian:testing [i386]) Inst libitm1 (4.7.1-2 Debian:testing [i386]) Inst libquadmath0 [4.6.2-12] (4.7.1-2 Debian:testing [i386]) Inst libc-dev-bin (2.13-33 Debian:testing [i386]) Inst linux-libc-dev (3.2.21-3 Debian:testing [i386]) Inst libc6-dev (2.13-33 Debian:testing [i386]) Inst cpp-4.7 (4.7.1-2 Debian:testing [i386]) Inst cpp [4:4.6.2-4] (4:4.7.1-1 Debian:testing [i386]) Inst gcc-4.7 (4.7.1-2 Debian:testing [i386]) Inst gcc [4:4.6.2-4] (4:4.7.1-1 Debian:testing [i386]) Inst libstdc++6-4.7-dev (4.7.1-2 Debian:testing [i386]) [] Inst g++-4.7 (4.7.1-2 Debian:testing [i386]) Inst g++ (4:4.7.1-1 Debian:testing [i386]) Inst libdpkg-perl (1.16.4.3 Debian:testing [all]) Inst dpkg-dev (1.16.4.3 Debian:testing [all]) Inst build-essential (11.5 Debian:testing [i386]) Conf libgomp1 (4.7.1-2 Debian:testing [i386]) Conf libitm1 (4.7.1-2 Debian:testing [i386]) Conf libquadmath0 (4.7.1-2 Debian:testing [i386]) Conf libc-dev-bin (2.13-33 Debian:testing [i386]) Conf linux-libc-dev (3.2.21-3 Debian:testing [i386]) Conf libc6-dev (2.13-33 Debian:testing [i386]) Conf cpp-4.7 (4.7.1-2 Debian:testing [i386]) Conf cpp (4:4.7.1-1 Debian:testing [i386]) Conf gcc-4.7 (4.7.1-2 Debian:testing [i386]) Conf gcc (4:4.7.1-1 Debian:testing [i386]) Conf g++-4.7 (4.7.1-2 Debian:testing [i386]) Conf libstdc++6-4.7-dev (4.7.1-2 Debian:testing [i386]) Conf g++ (4:4.7.1-1 Debian:testing [i386]) Conf libdpkg-perl (1.16.4.3 Debian:testing [all]) Conf dpkg-dev (1.16.4.3 Debian:testing [all]) Conf build-essential (11.5 Debian:testing [i386]) Reason is this: on a liveCD, when doing some stuff, i don't want to install all of build-essential, but only do a bit of training while waiting for something to finsish (say an rsync-operation). After this operation, 81.7 MB of additional disk space will be used. | The runtime library is called libc6, is essential to the system, and so should be already installed. I suspect you want the header files instead, which are called libc6-dev. |
I've installed QT (qt4-dev-tools 4.6.3.-4) But I can't found demos directory. Also missed demo launcher tool (qtdemo) . Assistant, Designer, qmake, moc, uic and other tools installed under /usr/share/qt4/bin. The qtdemo executable should be installed alongside the other tools supplied with Qt. I've tried to search qtdemo under /usr but nothing found. May be I must install some additional packages? Or may be it is a debian specific: QT without demos? | Found in separate package named qt4-demos. |
I'm writing a bash script for screen casting and I want to select an area on the screen, but not using xwininfo as that would select just the window I want to highlight an area on screen then get those coordinates to then use them with ffmpeg. any hints would be fantastic | what about shutter? that's a rather powerful gtk+ screenshot utility which can be started in "selection" mode from the command line. the only snag is that it's written in perl (Tk), which means that the startup may take some seconds. but once it's there it is quick and versatile. and it stores everything xou do in sessions, so nothing ever gets lost except you want it to. Code: Select allapt-cache search shutter |
I have a few hundred HTML files, and I want to write a script to pull a few specific urls out of each one and dump all those urls in a single new file. The formatting of the files is consistent enough that I can get the right urls with regular expressions, but I don't have any experience with scripting, so I don't know how I'd go about reading multiple files or writing to a new one, or even what language to choose. I have some amateur programming experience, I'm just not sure where to look or what to look for to accomplish this job. If someone could point me in the direction of a) what language could accomplish this efficiently, and b) documentation about functions in that language that'd help me get this done, I'd greatly appreciate it. Thanks. | When I once made similar work with html, I use sed and awk in script. For sed, perhaps, it will be needed write a script_file. man awk, man sed, but about sed will be easier to read in a book. Peter. |
How do I get intel assembly code out of gdb? "set disassembly-flavor intel" does not work - I still get ATT code:-( | The setting apparently only takes effect for the next assembly window you open, so if you already have the assembly window open, you'll have to close it and reopen a new one. |
Hi, Intro I want to learn programming using Python and I wanted my first serious project to involve using Django. https://docs.djangoproject.com/en/dev/intro/install/ But the guide says that Django is only supported from version 2.6 to 2.7. So I needed to upgrade Python in a way that didn't disturb Debian's default Python 2.5, since I read somewhere that it can break the system if I touched Debian's default Python. So I followed this setup example written by bluszcz: http://stackoverflow.com/questions/1388 ... n-in-linux So now I have both the old 2.5 and new 2.7 available. lenny@debian:~/usr-32/Python-2.7.3$ python Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit lenny@debian:~/usr-32/Python-2.7.3$ ./python Python 2.7.3 (default, Apr 23 2012, 22:43:22) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> Question 1 But I still have a few setup questions. When I ran these commands then it seemed like sqlite3 wasn't included. But when I look in Synaptic then it's already installed. What have I done wrong? Code: Select all$ ./configure --prefix=/home/lenny/usr-32/Python-2.7.3 Code: Select alllenny@debian:~/usr-32/Python-2.7.3$ make running build running build_ext INFO: Can't locate Tcl/Tk libs and/or headers Python build finished, but the necessary bits to build these modules were not found: _bsddb _curses _curses_panel _sqlite3 _ssl _tkinter bsddb185 bz2 dbm gdbm readline sunaudiodev zlib To find the necessary bits, look in setup.py in detect_modules() for the module's name. running build_scripts | If you want to compile against debian packages, you need to install the -dev version that contains the headers. You probably need something like libsqlite3-dev. |
I'm trying to automate rotating incremental backups. I've got the backup creation part figured out. My problem is when i use a here-document to go thru the files in the dir, bash doesn't like it. here's my code: Code: Select all#!/bin/bash BACKUPDIR=/home/jteal/backup touch -d '-24 hour' $BACKUPDIR/hourly/.limit while read testfile do if [ "$BACKUPDIR/hourly/$testfile" -ot "$BACKUPDIR/hourly/.limit" ] then rm -rf $BACKUPDIR/hourly/$testfile fi done << `ls -1 $BACKUPDIR/hourly` exit 0 and here's the output: Code: Select alljteal@AMD-Media:~$ ./backup-rotate ./backup-rotate: line 15: warning: here-document at line 13 delimited by end-of-file (wanted ``ls -1 $BACKUPDIR/hourly`') I also tried using ls -1 > filelist and using filelist as the here-doc, but i got the same result. I think what bash is telling me is that the last line ends in an EOF instead of a ? Should I change $IFS somehow? I also tried not using the -1 switch, but again, same result... If anyone could explain what's happening here that'd be great. TIA | Although I'd still like to understand what was happening, I've stopped it from happening: Code: Select all#!/bin/bash BACKUPDIR=/home/jteal/backup touch -d '-24 hour' $BACKUPDIR/hourly/.limit for testfile in $(ls -1 $BACKUPDIR/hourly/) do if [ "$BACKUPDIR/hourly/$testfile" -ot "$BACKUPDIR/hourly/.limit" ] then rm -rf "$BACKUPDIR/hourly/$testfile" fi done exit 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.