Sometimes you want to find all views using a specific database table in Oracle. If you are using a small amount of views, this is not an issue, but if you have a huge Oracle database with thousands of views using hundreds of tables you need help from your database.
In this case there is a handy small select statement which can be used to find all Oracle views using specific table in your database. It uses the “SYS.ALL_DEPENDENCIES” view which is provided by oracle.
and REFERENCED_NAME like '%[YOUR_TABLE_NAME]%'
and REFERENCED_TYPE = 'TABLE'
With this simple select statement you will get a list of all view names using your specific table.
Plsql is a nice and simple programming langunage for oracle databases, but sometimes you can’t believe what you see. In the following example you can see the Schrödinger’s cat equivalent of oracle.
testNumber number := 10;
grNumber := greatest (null,testNumber);
leNumber := least (null,testNumber);
if grNumber = testNumber then
dbms_output.put_line(testNumber || ' is greater then null');
dbms_output.put_line('null is greater then ' || testNumber);
if leNumber = testNumber then
dbms_output.put_line(testNumber || ' is less then null');
dbms_output.put_line('null is less then ' || testNumber);
The result is:
null is greater then 10
null is less then 10
In this case null is greater and less then any number.
To avoid this strange behavior you have to use nvl to avoid null in greatest und least functions.
If you want to rename a big amount of files and you don’t want to to it one by one, you can use the following bash script.
for f in *.txt;
nf=`echo $f | sed s/OLD/NEW/`
mv $f $nf
This script will list all *.txt files and replace OLD by NEW in the filename.
You just have to modify the “*.txt” and the /OLD/NEW/ part to your needs and it will change all filenames by the given pattern.
The zero-width space (ZWSP) is a non-printing character used in computerized typesetting to indicate word boundaries to text processing systems when using scripts that do not use explicit spacing, or after characters (such as the slash) that are not followed by a visible space but after which there may nevertheless be a line break. Normally, it is not a visible separation, but it may expand in passages that are fully justified.
The zero-width space character is very useful for html layout and controlling word wrapping in case of long words, urls, emails, etc. With the ​ character you have full control over word wrapping within your html pages.
To show the effect of the zero-width space, the following words have been separated with zero-width spaces.
To add the zero-width space character to your string you can use the following PHP function. The addZWSP function will split the string into parts of 8 char length.
function addZWSP ($str)
// zero-width space character
$zwsp = "​";
$tiles = str_split ($str, 8);
$del = "";
$ret = "";
foreach ($tiles as $tile)
$ret .= $del . $tile;
$del = $zwsp;
If you want to get updates on YouTube Channels into your RSS Feed-Reader, you have to do some easy steps.
1. Open the YouTube channel you want to track in your preferred browser
2. Copy the channel name from the URL into the YouTube Channel Name Converter and click “Get Channel ID”
3. Copy the Channel ID from the page
4. Replace the CHANNEL_ID from https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL-ID with your Channel Id from the YouTube Channel Name Converter.
5. Copy the RSS Feed URL (https://www.youtube.com/feeds/videos.xml?channel_id=UC6ySWla_95opV6RuXOX3HMQ) to your RSS Feed reader.
If you want to add multiple YouTube channels into your RSS reader, it could be helpful to use the YouTube Subsription Manager to export your YouTube subscriptions into a single xml file. This “OPML File” can be imported to several RSS readers.
OPML (Outline Processor Markup Language) is an XML format for outlines (defined as “a tree, where each node contains a set of named attributes with string values”). Originally developed by UserLand as a native file format for the outliner application in its Radio UserLand product, it has since been adopted for other uses, the most common being to exchange lists of web feeds between web feed aggregators.
If you want to create a dump file of a mysql database you can use the mysqldump command which is part of the mysql installation. This great utility can perform a backups of your mysql database, producing a set of SQL statements that can be executed to reproduce the original database table data.
Open your terminal or command prompt and run the following command to create a mysql backup file from the selected database.
mysqldump -u mysql_user -p DATABASE_NAME > backup.sql
Note: You have to grants all privileges to mysql_user before performing mysqldump.
To import the backup you can perform the following command:
mysql -u mysql_user -p DATABASE < backup.sql
This is just a simple example. You find more information aout mysqldump at https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html
If you want to drop a oracle user with the DROP USER statement to remove a database user and optionally remove the user’s objects you can execute ‘drop user @USERNAME cascade’. But if you have a problem to drop the user and you get the error “ORA-01940: cannot DROP a user that is currently logged in”. The problem is that the user is not connected according to v$session. I suspect that it’s related to my replication, and the user is a propagator. How do I get around this ORA-01940 error?
When you drop a user, Oracle Database also purges all of that user’s schema objects from the recycle bin.
-- prevent any further connections
EXECUTE IMMEDIATE 'alter user @USERNAME account lock';
--kill all sessions
FOR session IN (SELECT sid, serial#
WHERE username = '@USERNAME')
-- the most brutal way to kill a session
EXECUTE IMMEDIATE 'alter system kill session ''' || session.sid || ',' || session.serial# || ''' ';
-- killing is done in the background, so we need to wait a bit
FROM v$session WHERE username = '@USERNAME';
EXIT WHEN open_count = 0;
-- finally, it is safe to issue the drop statement
EXECUTE IMMEDIATE 'drop user @USERNAME cascade';
You can use Properties to configure your java application. The Java platform itself uses System Properties to maintain its own configuration. With the java.lang.System class you can access the Properties object that describes the configuration of the java environment. In System Properties you can find information about the current user, the current version of the Java runtime, the CPU and the character used to separate components of a file path name. To list all System Properties you can use the following snippet.
Iterator iterator = System.getProperties().keySet().iterator();
String key = (String)iterator.next();
String value = System.getProperties().getProperty(key);
System.out.println (key + " " + value);
On my machine the result looks like this:
java.vm.specification.vendor Oracle Corporation
os.name Windows 10
java.library.path C:\Tools\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Users\jentsch\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\jentsch\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\app\oracle\product\11203\client64\bin;C:\app\oracle\product\11203\client32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Program Files\PuTTY;C:\Android;C:\Windows\System32;C:\Program Files\TortoiseGit\bin;C:\Users\jentsch\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\nodejs;C:\Program Files\TortoiseSVN\bin;C:\Users\jentsch\AppData\Local\Microsoft\WindowsApps;C:\Program Files\apache-maven-3.2.5\bin;C:\Program Files\Java\jdk1.8.0_141\bin;C:\Program Files\Microsoft VS Code\bin;C:\Toolsl\Gource\cmd;C:\Tools\ffmpeg-3.4.1-win64-static\bin;C:\Users\jentsch\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl;.
java.specification.name Java Platform API Specification
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.java.command org.test.commandline.Main migrate
java.specification.vendor Oracle Corporation
java.vm.info mixed mode
java.vendor Oracle Corporation
This code snippet have been written for JDK 8. Examples and practices described in this page don’t take advantage of improvements introduced in later releases.
In case you have created a branch with a wrong name and pushed your branch to the remote git repository you can follow these steps to change the name of your branch.
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push –set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
Please note, if you use the name of the branch somewhere in your build scripts or somewhere else like SonarQube you have to change it there also.
Up to API Level 7 you can use android.view.Display.getOrientation() to get the rotation of the screen from its default orientation. But this method was deprecated in API level 8.
But now you can use
The returned value is:
Surface.ROTATION_0 (no rotation)
If your device has a naturally portrait screen, and the user has turned it on its side to go into a landscape orientation, the value returned here may be either Surface.ROTATION_90 or Surface.ROTATION_270 depending on the direction it was turned.
With this simple line of code you can get the information about the screen orientation related to the default. This could be helpful, if you want to deal with your Sensor.