[Solved] How ubuntu software center make “search” operation? [closed]

It is open-source and it might even use Python. To find out what package installs Software Center: $ apt-file find -F /usr/bin/software-center software-center: /usr/bin/software-center To download the source code: $ mkdir software-center $ cd software-center/ $ apt-get source software-center Look for the word ‘search’ in the source code. utils/search_query.py seems relevant. It looks like it … Read more

[Solved] Using SFTP to transfer images from HTML form to remote linux server using PERL/CGI.pm

use CGI qw(:standard); use File::Basename; my ( $name, $path, $extension) = fileparse ( $productimage, ‘..*’ ); $productimage = $name . $extension; $productimage =~ tr/ /_/; $productimage =~ s/[^$safechars]//g; if ( $productimage =~/^([$safechars]+)$/ ) { $productimage = $1; } else { die “Filename contains invalid characters”; } $fh = upload(‘image’); $uploaddir = “../../.hidden/images”; open ( UPLOADFILE, … Read more

[Solved] Remove lines from a text file that contains multiple string patterns from another file in linux [closed]

$ cat tst.awk BEGIN { FS = “[\t|]” } NR==FNR { for (i=1; i<=3; i++) { if ($i == “”) { $i = “N.A.” } } a[$1 OFS $2 OFS $3] next } !(($3 OFS $5 OFS $6) in a) $ awk -f tst.awk file1 file2 123|234|aa|ur29842|b|c|234|567 123|234|aa|ur2909842|bb|ccc|234|567 123|234|aaa|ur29042842|bb|cc|234|567 123|234|N.A.|ur2922|bbb|cccc|234|567 0 solved Remove lines from … Read more

[Solved] How to perform cache operations in C++?

You have no need to flush the cache from your user-mode (non-kernel-mode) program. The OS (Linux, in the case of ubuntu) provides your application with a fresh virtual address space, with no “leftover stuff” from other programs. Without executing special OS system calls, your program can’t even get to memory that’s used for other applications. … Read more

[Solved] Cannot use array with GCC

Because <array> got indirectly included from somewhere and you made the mistake of using namespace std, “array” in ErrorMessage refers to that name in the std namespace. That is a class template, not a type – hence the error message. Outside of value, its array is called value::array. (The typedef value::array array in value is … Read more

[Solved] How to define new header files with preprocessing directive #define? [duplicate]

You must fix your usage of the preprocessor as follows: Include a space between #define and its operand. To implement include guards properly, you need a corresponding #ifndef before the #define. As wildplasser said, you can’t use macro names beginning with underscore(s), so remove them, or replace them with some other prefix of your own. … Read more

[Solved] How can I edit a file in Linux and add line breaks? [closed]

Assuming your data is in file named “file”: sed -i ‘s/^\(.\{27\}\)\(.\{26\}\)\(.*\)/\1\n\2\n\3/g’ file sed is a very powerful tool for text processing, although not the easiest to use (but very easy when you want to make an example like this). Here is the magic: “-i” is a flag for “do this stuff for me” in single … Read more

[Solved] change any linux user password using c++

All is possible in this way -> to make c++ code which change password I done this: Password must be encrypted, so I used code to make it in $6$:SHA-512 hash. Must open /etc/shadow file, read it, find user by username and change password. There you can read about shadow file structure. To open file … Read more

[Solved] how do I basic script with linux? [closed]

#!/bin/bash is called the shebang (you missed the leading #). It tells which program will execute your script. clear is for clearing screen. echo outputs following argument to the standard output (your terminal by default). But you must not surround your string with parenthesis as it’s used for grouping command in a sub-shell. If you … Read more

[Solved] How to create simple command line UI like the debian installer? [duplicate]

There is also the whiptail command, if you only want to write a shell script (as the debian installer is). There is a good page of it in the Bash Shell Scripting Book on WikiBooks: https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Whiptail solved How to create simple command line UI like the debian installer? [duplicate]