w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

Running batch script from windows service to dump database
Basically you have two options. The preferred option, as you noted, is to use the pgpass.conf. The second option is to pass the password in using the PGPASSWORD environment variable. The libpq connection interfaces accept both approaches. Usually the pgpass.conf method is preferred for security reasons, but there are cases where the environment variable is the best way to get things done.

Categories : C#

How to running application under root privilege?
You can split your application into two parts: service(daemon) and UI and install them via installer in the way so your service will have root privileges You can run some command from your app using AuthorizationExecuteWithPrivileges() but it is deprecated. Still it works You can run some command via NSAppleScript using "do shell script "some script" with administrator privileges". But it more like a hack and apple documentation says that NSAppleScript class must be used only from the main thread of an application. But it works too, and personally I don't have any troubles with that. You can create helper tool and use ServiceManagement.framework and SMJobBless() You can find some additional info here and here

Categories : Osx

PowerShell MySQL Dump Script does not dump correctly
ÿþ is the Byte Order Mark of a file encoded in little-endian Unicode format. Try this: $cmd = "& 'C:wampinmysqlmysql5.6.12inmysqldump.exe' -u ipbform -p123123 wiki" Write-Host $cmd Invoke-Expression $cmd | Out-File $backupFilePath -Encoding ASCII

Categories : Mysql

json.dump object rename attribute before the dump
You'll have to use a more elaborate default: json.dumps(object, sort_keys=True,indent=4, separators=(',', ': '), default=lambda o: {'machines' if k == '_machines' else k: v for k, v in o.__dict__.iteritems()}) It might be a good idea, for the sake of readability, to make that a separate function: def serialize_custom_object(o): res = o.__dict__.copy() res['machines'] = res['_machines'] del res['_machines'] return res json.dumps(object, sort_keys=True,indent=4, separators=(',', ': '), default=serialize_custom_object) Here, serialize_custom_object() is a little more explicit that you are renaming one key in the result.

Categories : Python

How to check if running as root in a bash script
If the script really requires root access then its file permissions should reflect that. Having a root script executable by non-root users would be a red flag. I encourage you not to control access with an if check. chown root:root script.sh chmod u=rwx,go=r script.sh

Categories : Bash

Running shell script as root using apache/php
You look for tool called sudo: https://en.wikipedia.org/wiki/Sudo But most likely instead of going for sudo you should rethink your app architecture as once your httpd is compromised, attacker can easily get root rights.

Categories : PHP

Running/Debugging an app on Xcode as root user
I think running things as root is typically not advised, and I think that you wouldn't be able to get special write access on an actual device, but you could try logging in as root on your mac and launching Xcode from there. I have not tried it, but it may enable the "Run as root" option

Categories : IOS

Core dump while running 'rake rails:update:bin' during Rails 4 upgrade
Problem solved. I had been using the bundle binstubs option in Rails 3.2 and I hadn't deleted the project's bundle and bin dirs prior to the upgrade. After deleting these dirs and re-running bundle install, then running rake rails:update:bin the problem was solved.

Categories : Misc

Running python cron script as non-root user
Cron jobs run with the permissions of the user that the cron job was setup under. I.E. Whatever is in the cron table of the reports user, will be run as the reports user. If you're having to so sudo to get the script to run when logged in as reports, then the script likely won't run as a cron job either. Can you run this script when logged in as reports without sudo? If not, then the cron job can't either. Make sense? Check your logs - are you getting permissions errors? There are a myriad of reasons why your script would need certain privs, but an easy way to fix this is to set the cron job up under root instead of reports. The longer way is to see what exactly is requiring elevated permissions and fix that. Is it file permissions? A protected command? Maybe adding reports to certai

Categories : Python

android root emulator? Running application on sdcard
Read this stackoverflow post. Its about your problem,and a user answered with a solution for the use of sudo commands on Android emulator. Here the link: Obtain root access via su on the Android emulator

Categories : Android

Launch a Python GUI from a C program running with user root
The reason it works when you run it the first way is that the DISPLAY environment variable is already set before you start the C program, and it will be inherited by subprocesses. If you're launching the C program on bootup, the DISPLAY variable (probably) won't be set, so you'll need to set it before spawning the subprocess, with something like... #include <stdlib.h> setenv("DISPLAY", something, 1); // Now launch the Python script The tricky bit is what to put in for something. It needs to be whatever you get when you do echo $DISPLAY from a regular X11 session, assuming the C program runs on the same system as your X11 session. You'll either have to hardcode a value which works, or find some way to pass the correct value to the C program. Update Regarding permissions issu

Categories : Python

Tracing mysqld Using SystemTap
It seems that the -DENABLED_DTRACE=1 bits for mysql were not enough to actually compile in the sys/sdt.h instrumentation. If they did, you'd have seen extra data in readelf. You might try looking at the individual .o files in the mysql build tree. For example, Fedora 19's mariadb-server package does have the markers: % stap -L 'process("/usr/libexec/mysqld").mark("*")' process("/usr/libexec/mysqld").mark("command__done") $arg1:long ...54 lines omitted... process("/usr/libexec/mysqld").mark("update__start") $arg1:long And there it is configured with -DENABLE_DTRACE=ON. Perhaps yours is just a -DENABLED_DTRACE vs -DENABLE_DTRACE typo?

Categories : Mysql

mysqld working but wampmysqld not starting up
This is what worked for me: http://jinengbali.wordpress.com/2010/04/20/mysql-server-stop-working-in-wampserver-error-wampmysqld-shutdown-complete/ I installed an "addon" and then from the wampserver icon selected > MySQL > Version and selected one of the newly installed version. The icon finally went green!

Categories : Mysql

How do I dump `VM: Mapped File`?
Mapped files are not like regular memory; they can either be on disk only, or in memory and on-disk, and the system will manage that for you. icudt51l.dat is the localization data for the system; it's what powers NSDateFormatter, NSNumberFormatter, etc... you can't get rid of it. Basically: that's not really an allocation in the traditional sense and you don't need to worry about it

Categories : IOS

Dump variable to file
Have you tried using pickle? It's in the standard library, and it should pretty much work like this : import pickle # Write to file pickle.dump(obj, open("file.dat", "wb")) # Read that file obj = pickle.load(open("file.dat", "rb"))

Categories : Python

Reading Big Dump file
I can think of a few options: You could CREATE VIEW for a subset of columns, and then export the view to XML. You could design an XSL script and filter the XML output with xsltproc. You could export all columns, but then choose which columns to import with LOAD XML.

Categories : Mysql

deleting a sql dump file
One solution to do this right, is (This is a rough example of how it could be done): Return the data from the database as an array, and iterate through it: // tell the browser that this is a download header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=list.csv"); // column separator $separator = ';'; // field delimiter $field_delimiter = '"'; // line end $line_end = " "; foreach ($result as $row): $i = 0; foreach ($row as $item): // do not add separator before the first item if ($i > 0) { echo $separator; } echo $field_delimiter.$item.$field_delimiter; $i++; endforeach; // line end echo $line_end; endforeach; Do not output anything else, just the CSV content.

Categories : PHP

replace N in csv dump of a sql file
If the FIELDS ESCAPED BY character is empty (in your query), no characters are escaped and NULL is output as NULL, not N. So following should give you desired result: $sql = "SELECT 'id','username','name','email', 'phone_number','city', 'batch_code','course_type' UNION ALL SELECT id, username, name, email, phone_number, city, batch_code, course_type FROM users INTO OUTFILE '".$file_path."' ". "FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY ' '"; It's just one way to do it and you might not want to use this if you need other characters escaped.

Categories : PHP

Importing Dump (.dmp) file into mysql
No, you probably can't. An Oracle export is a proprietary, undocumented files format. It can, realistically, only be read by the Oracle import utility. There may be some third party tools that may have reverse engineered the file format, but I'm not aware of any that would import into MySQL. If you import the data into a local Oracle database, it becomes much easier to transfer it into a MySQL database. Any ETL tool can do so, you can write an application to move the data, you can connect from Oracle to MySQL to push the data, you can extract the DDL and DML from the Oracle database, etc.

Categories : Mysql

Analyzing a crash dump file
To some extent, you can debug a 64-bit dump of a 32-bit process with Windbg, by use of the wow64exts. However if possible I think it’s best to have a 32 bits dump. If the customer can provide a 32-bit dump , get it. Here is a sample of the wow64exts: 0:008> k Child-SP RetAddr Call Site 00000000`0291f128 00000000`779d263a wow64cpu!CpupSyscallStub+0x2 00000000`0291f130 00000000`7792c4f6 wow64cpu!WaitForMultipleObjects32+0x1d 00000000`0291f1e0 00000000`7792b8f5 wow64!RunCpuSimulation+0xa 00000000`0291f230 000007fe`e51fd6af wow64!Wow64LdrpInitialize+0x435 00000000`0291f770 000007fe`e519c1ae ntdll!_LdrpInitialize+0xde 00000000`0291f7e0 00000000`00000000 ntdll!LdrInitializeThunk+0xe 0:008> .load wow64exts 0:008> !sw Switched to 32bit mode 0:008:x86> k ChildEBP

Categories : C++

svn dump file : Node-copyfrom-rev
Yes, the field Node-copyfrom-rev can point to revisions, in which the file Node-copyfrom-path has not been changed - and it usually does. Here is an example: If have added the file foo in rev 1 and it hasn't been changed in rev 2. Now I execute the following command lines: svn cp foo@1 bar svn cp foo@2 baz svn commit Using svnrdump dump, I get the following output: Node-path: bar Node-copyfrom-rev: 1 Node-copyfrom-path: foo Node-path: baz Node-copyfrom-rev: 2 Node-copyfrom-path: foo

Categories : Svn

import dump.sql file into postresql
We have determined in chat that you were trying to import your dump.sql file from within the psql prompt, which obviously couldn't work... The data is now imported.

Categories : Database

Does MySQL bin log append to dump file?
Go-through these links, i think it will be useful, 1) http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html#option_mysqldump_delete-master-logs 2) http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

Categories : Mysql

PostgreSQL - dump each table into a different file
If you are happy to hard-code the list of tables, but just want each to be in a different file, you could use a shell script loop to run the pg_dump command multiple times, substituting in the table name each time round the loop: for table in table1 table2 table3 etc; do pg_dump -t $table -U userName dbName > /home/anik/psqlTest/db_dump_dir/$table.sql; done; EDIT: This approach can be extended to get the list of tables dynamically by running a query through psql and feeding the results into the loop instead of a hard-coded list: for table in $(psql -U userName -d dbName -t -c "Select table_name From information_schema.tables Where table_type='BASE TABLE' and table_name like 'thr_%'"); do pg_dump -t $table -U userName dbName > /home/anik/psqlTest/db_dump_dir/$table.sql; done; He

Categories : SQL

Visual svn dump file size 0kb
Paths in your code are invalid. The wrong string is: startInfo.Arguments = @"C:Program Files (x86)VisualSVN Serverinsvnadmin dump E:RepositoriesTest > E:AFSAFS.Schedule.VisualSVNTestFolderDestTestNewTest.dump"; The correct string is: startInfo.Arguments = @""C:Program Files (x86)VisualSVN Serverinsvnadmin.exe" dump E:RepositoriesTest > E:AFSAFS.Schedule.VisualSVNTestFolderDestTestNewTest.dump"; Note the missing .exe and quotation.

Categories : C#

How to extract a table from a *.dump file into a CSV
The output from pg_restore --data-only -t my_table db.dump basically is tab-separated headerless tabulated text with some comments and a few extra commands. A script to mangle it into csv with a tool like perl or awk would be pretty simple. That said, personally I would: Restore the table to a temporary database created for the purpose. If the table depends on custom types, functions, sequences, etc you will need to restore them too. In psql, copy the_table TO 'some_file.csv' WITH (FORMAT CSV, HEADER ON) This way you can control the representation of nulls and lots more.

Categories : Database

linux: running self compiled kernel in qemu: VFS: Unable to mount root fs on unknown wn-block(0,0)
maybe your system image file is bad and can not be mounted. You may try these command to mount the image file and check if it is a valid root file system for linux. losetup /dev/loop0 /var/lib/libvirt/images/Debian.img kpartx -av /dev/loop0 mount /dev/mapper/loop0p1 /mnt/tmp

Categories : Linux

GDB + Core dump file generated by another compiler
You have to make sure that all the libraries (and hopefully their debuginfo) that were in use by the remote program are available to the local gdb. They have to be the exact same versions. Then, the simplest thing to do is use "set sysroot" before loading the core file into gdb. You don't need to tell gdb about the compiler or the kernel.

Categories : C

How to restore Mysql Backup from dump file?
If it's a dump file that you created using mysqldump, then you can build a new database from the dump file using the source command. Just login to MySQL using mysql -p, enter the root mysql password, then type: source /path/to/mysqldumpfile

Categories : Misc

SQL Server : how to dump/extract each row to separate file
The links below contain some previous posts and another link to a possible solution using SSIS. You might have to play around until you get what you want. Good luck. Some clues here or http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=127561

Categories : SQL

Finding End Of SQLite File In Disk Dump?
I've always had luck recovering data using PhotoRec which, despite its name, supports many file formats including sqlite. http://www.cgsecurity.org/wiki/File_Formats_Recovered_By_PhotoRec I've never tried it on a dump of flash memory so I don't know how successful it would be. It depends on how the file is layed out in memory and PhotoRec bets on the fact that most files are stored in contiguous blocks (i.e. not fragmented).

Categories : Sqlite

Dump file (.dmp) of SQlite Database in Android
The Oracle dump files produced by its EXP (old skool) or EXPDP (more modern) utilities are in an Oracle proprietary format. So you cannot use them with any import utility except Oracle IMP or IMPDP. The SQLite dump file is pure ASCII SQL statements, so there's your difference. Oracle provides a built-in for unloading table structures and related objects as text, DBMS_METADATA. However, there is no equivalent built-in for the data. Tools like SQL Developer offer something, and it would be straightforward (if time consuming) to roll your own. It depends what - and how much - data you actually what to dump out. "need to update the device DB regularly based upon the changes in the Server DB (Oracle). Max data to transfer will be around 100 queries." Yeah, I thought your use cas

Categories : Android

Python dump dict to json file
This should give you a start >>> import json >>> print json.dumps([{'name': k, 'size': v} for k,v in sample.items()], indent=4) [ { "name": "PointInterpolator", "size": 1675 }, { "name": "ObjectInterpolator", "size": 1629 }, { "name": "RectangleInterpolator", "size": 2042 } ]

Categories : Python

How do I filter file names out of a SQLite dump?
You should be able to use .gsub('%2', ' ') the %2 with a space, while quoted, it should be fine. Split does remove the character that is being split, though. So you may not want to do that, or if you do, you may want to use the Array#join method with the argument of the character you split with to put it back in.

Categories : Ruby

Convert MySql Dump into h2db file
There are a few tools that are specialised to migrate data from one database to another: Flyway, agile database migration framework for Java. SQuirreL DB Copy Plugin, a tool to copy data from one database to another.

Categories : Java

Reading a Dump File in VS2010 64/32 Bit Conflict
You can still open this dump using WinDbg from Debugging Tools for Windows package. To produce good dumps for Win32 application in x64 systems you need to create the dump using Win32 version of MiniDumpWriteDump API. Regular Task Manager started from appbar content menu or Ctrl+Shift+Esc hotkey (as well as Process Explorer) is of the OS bitness and the produced dumps are not helpful. 32-bit dumps can be taken by Visual Studio itself, attaching to the process, pausing it and saving minidump from menu, or using 32-bit task manager started directly: C:WindowsSYSWOW64 askmgr.exe. I am using LogProcessExceptions utility (I am sure there are many other as well) to generate minidumps on exceptions and on interactive request. Since the utility is available in both Win32 and x64 bitnesses, 32-bit

Categories : C++

How is Heap dump file created after JVM crash
You are getting a heap dump on crash already. To get a thread dump in addition, use the following JVM argument -XX:OnOutOfMemoryError="kill -3 %p" Note: This will most likely create the thread dump in a different file or console though.

Categories : Java

How do i dump errors reported by logger.error into a file
you must configure log4j.properties file. see links: http://www.theserverside.com/discussions/thread.tss?thread_id=31659 http://www.mkyong.com/logging/log4j-log4j-properties-examples/

Categories : Java

How to bypass a 2TB core dump file system limit?
ulimit -c is the command to verify and change the allowed maximum size of core files created; it is documented in the bash man page. Use something like ulimit -c 16000000 As root, you can run ulimit -c unlimited

Categories : Misc



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.