FAQ Database Discussion Community


SQL Server insert Attribute to top node of xml

sql-server,xml,insert,attributes,root
I want to insert an attribute to the root node of XML datatype. If I know the name of the root node is Quote, then I can insert like this: DECLARE @myDoc xml; DECLARE @id int; SET @id = 12345; SET @myDoc = '<Quote> <Close> 123 </Close> </Quote>' ; SET...

Difference between `sudo su` and `sudo fish`

shell,ubuntu,root,sudo,fish
I am running fish (Friendly Interactive Shell) as my standard terminal in Ubuntu 14.04, rather than bash. I noticed the following behaviour and don't know, if any of these are the preferred one to gain root access. I can type the command sudo su or sudo fish and it will...

Change network settings in Linux without root privilege

c,linux,network-programming,root,privileges
The settings I'm talking about are IP, subnet mask and default gateway (set and get). For setting all of these I use the ioctl function along with options like SIOCSIFADDR and SIOCSIFNETMASK. For getting the IP and mask I use the same approach but with options like SIOCGIFADDR. For getting...

Changing root URL Angular UI-Router

angularjs,url,angular-ui-router,root,ngroute
I'm learning Angular by rewriting a JS web application in Angular, and I'm having some struggles with replacing ngRoute with ui-router. Although I realise that it is designed to build SPAs, I'm only rewriting a branch of pages in angular. My current understanding is that ui-routing requires you to define...

MySql can not grant privileges to root

mysql,root,privileges,grant
I ran command grant all privileges on *.* to 'root'@'%' identified by 'root'; And it keep showing following error 11:43:51 grant all privileges on . to 'root'@'%' identified by 'root' Error Code: 1045. Access denied for user 'root'@'%' (using password: YES) 0.00045 sec I also checked User table on Mysql...

.htaccess root changed with mod_rewrite

.htaccess,mod-rewrite,root
So i'm trying to rewrite the URL like this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) index.php?page=$1 [QSA] Works perfectly but relative paths to JavaScript and CSS get messed up. Shouldn't the line below exclude files ? RewriteCond %{REQUEST_FILENAME} !-f ...

Run shell command in jenkins as root user?

linux,shell,jenkins,root
I have recently started using Jenkins for integration. All was well until I was running jobs on master node without shell command but I have to run jobs on master as well as slave node which contains shell commands to. I am not able to run those shell commands as...

Access denied while running Mysql for the first time on Centos

mysql,centos,root
I just installed Mysql for the first time on a CentOS machine using yum. The installation had no errors. Then I followed those steps: $ sudo /sbin/service mysqld start --skip-grant-tables --skip-networking $ sudo /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE!...

My password root caused disappearance in Mysql database

mysql,phpmyadmin,passwords,root
I set a password for the user root manually in the phpmyadmin, and suddenly the mysql database disappeared from the list. When I use the control console, the root user can connect without a password, but the command line show database doesn't display the mysql database.

Attempting to link to root directory on home computer

php,html,directory,root
I'm attempting to build a website on my computer and I'm having issues linking with my root directory from anywhere on the website. I know I can use ../ to go up 1 directory as many times as needed, but I need a way to link to my root directory...

Open server socket in android : permission denied?

android,sockets,root
I'm trying to create server socket on port 554 (rtsp) in Android and i'm getting BindException with 'denied' message: public RequestListener() throws IOException { try { mRtspServerSocket = new ServerSocket(mPort); start(); } catch (BindException e) { Log.e(TAG, "Port bind exception"); throw e; } } Are standard ports (or < 1024)...

Privileges in an Ubuntu Docker container after USER statement in Dockerfile

ubuntu,docker,root,dockerfile
I created a Dockerfile FROM ubuntu:latest as the parent image. Later the Dockerfile creates a new group and user without sudo privileges via RUN groupadd -r myappuser -g 433 RUN useradd -u 431 -r -g myappuser -d /opt/myapp -s /bin/false -c "my app user" myappuser Before executing the application I...

File permissions, root bash script, edit by user

bash,shell,root,file-permissions
I have a script that needs to be ran as root. In this script I create directories and files. The files and directories cannot be modified by the user who ran the script (unless there root of course). I have tried several solutions found here and other sites, first I...

Approximation error when using sqrt and floor

c++,root,square,approximation
I have to do an enumeration of solutions of an equation and I know that y < x *( sqrt(n) - 1 ), where x, y and n are integers. My naive approach would be to look for y less or equal than floor( x * ( sqrt( (float)n )...

Rooted Android Nexus 7 Lollipop disable SystemUI (system + navigation bar)

android,root,statusbar,navigationbar
I use the following code to disable the navigation bar and the status bar on my 4.4 nexus device try { proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "service call activity 42 s16 com.android.systemui" }); } catch (Exception e) { Log.w("Main","Failed to kill task bar (1)."); e.printStackTrace(); } try {...

Android Write file to a different application folder

java,android,root
My device is rooted The target audience (if app is shared) will be rooted devices only I'm trying to customize another app slightly by modifying some image files. So objective is to simply overwrite tiny jpg files (one at a time as required) /data/data/com.otherapp/files/somefile.jpg for example needs to be...

admin crontab won't run sudo command

crontab,root,cron-task
sudo: no tty present and no askpass program specified Hi I am getting the above error when ever I try to get the following crontab to run. */5 * * * * sudo bash /home/admin/scripts/monitor.sh /dev/null 2>&1 I am using nano as the editor to edit the admin user crontab...

Android copy sqlite database from pc to device

android,database,sqlite,adb,root
I want to use a database I have on my pc in my android project. To archive that, I have to copy the database into the /data/data/xxx.xxx.xxx/databases folder. How can I do that? I read of using adb but I think you require root to access the /data/data folder. Is...

How to connect computer via Huawei C8812?

android,driver,root
I can't run android programs on android mobile phone. I need USB driver to connect. I want to connect my computer (Windows 7 32 bits) via my android phone Huawei c8812. I can't find USB driver on the Internet. And I also want to root my phone. Please Help me...

Can I disable my wifi device driver from my application?

wifi,driver,root
I have root access on a proprietary system. I am trying to "securely" disable wifi by either renaming or removing the device driver file "wlan.ko" in folder /system/lib/modules. I figured out how to do this using commands through a shell/console basically like so: su first make the partition writable as...

Adding “sudo” before a command makes the command unknown

python,linux,root,redhat,sudo
This is a linux problem that's been stumping me for a while. On my work linux box (running RedHat) I was trying to install some Python packages. However, some funny business is occurring, see below: This is my objective and first command pip install scrapylib This creates a 'Permission Denied'...

getenv(“HOME”) returns “/root” with “sudo”

c++,raspberry-pi,root,sudo,getenv
I'm writing a program on my Raspberry Pi that requires the function "getenv("HOME")" to locate "/home/pi". However, since I'm using the "wiringPi" library that requires "sudo" to run, "getenv("HOME")" now returns "/root" as the HOME directory instead of "/home/pi". Is there a way to locate "/home/pi" with "getenv("HOME")" while using...

setuid(0) fails to execute for root owned program

c,linux,shell,root,setuid
I need to write some code which can gain root priveleges and execute system level operations. Here's what I've written (this is not the actual code, just to test if I'm doing things correctly or not): #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { int current_uid = getuid(); printf("My...

Linux server with . and .. directories

linux,unix,directory,root,hidden-files
Why does each folder directory in my linux server has . and .. directories with same files ? is it user error or by design ? Example: I have folder bladelogic with list of these files along with . and .. directories which contains same files. ...

Get the output from executed commands through android app

java,android,linux,command-line,root
I'm performing the following code to execute linux commands in my android application that I'm creating: public void RunAsRoot(String[] cmds){ Process p = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(p.getOutputStream()); for (String tmpCmd : cmds) { os.writeBytes(tmpCmd+"\n"); } os.writeBytes("exit\n"); os.flush(); } I want to know if there is a way to...

How to deploy a java application as root in tomcat without allow access to other webapps

java,tomcat,web-applications,deployment,root
I have a java application.war and I copied the file to tomcat7/webapps directory. I'm able to access it with www.application.com/application (My domain points to ip 200.xyz.12.jk:8080) BUT I want to access it through www.application.com (without the name of the folder inside webapps directory) Also i dont want to allow access...

Copy Files and directories with su command on rooted device

android,root,su
Similar Questions are often asked here, but I can´t figure out, what exactly I have to do. This is not a duplicate, because the solutions on many threads here are not what I am looking for or doesn´t work for me. I want to copy files and directories to a...

Why can't I access my vi folder?

mongodb,path,terminal,root,cd
I keep getting this error on my terminal which stops me accessing the vi folder. I've been trying to set a path to the MongoDB bin and when experimenting on how to do this, I think I've broken the folder. Can someone please help? Last login: Mon May 18 10:31:54...

How to run everything as “root”

linux,ubuntu,root,debian-based,ubuntu-15.04
How can make it so when I run a command it's always "root" without being root? I want my account to be basically on the same level of permissions as root with all it's perms ext and can also access the /root and when i install new software i wont...

Searching files from root directory on mac - Java

java,directory,root
I have a file on my Desktop I have to find If I insert the following code: f = new RandomAccessFile("\Desktop/greg.txt", "r"); I get an error on the \ But this is how I access the root directory. Anyone know what the problem is?...

Function as parameter of a function, using bisection method C++

c++,root,bisection
// Function as parameter of a function #include <iostream> #include <cmath> #include <cassert> using namespace std; const double PI = 4 * atan(1.0); // tan^(-1)(1) == pi/4 then 4*(pi/4)== pi typedef double(*FD2D)(double); double root(FD2D, double, double); //abscissae of 2-points, //For the algorithm to work, the function must assume values...

Developing a Secant Method Program for root finding

matlab,root,numerical,scientific-computing
So I have been trying to develop a secant method program that can be used for finding the root of f(x) = tanh(x) - (x / 3) However the answer output is nowhere close. Every solution I have found seems a more complex way to solve it. x = 2;...