Symbole im Artikel gezählt: 1.5kLesezeit ≈1 minuten.
Breadth first Traversal in a binary tree is a famous problem related to binary trees tree
Breadth first/Level order traversal of a binary tree
The Problem
Imagine you have a binary tree where as shown above. You may be aware of InOrder traversal where you follow a scheme of visiting left subtree and then visit root node and finally visit right subtree. With small variations in order same is done in pre-order as well as post-order traversal. How do you do a breadth first traversal? It is slightly more tricky. Doing it non-recursively is even more difficult at first sight. Let me first explain what is breadthfirst traversal.
Different traversals produce different output as shown below
Symbole im Artikel gezählt: 1.3kLesezeit ≈1 minuten.
The ojInputText component of OracleJet doesn't let you restrict the input. Here is a solution that rejects any non numeric characters.
Oracle Jet is a beautiful toolkit for simplifying lot of tasks. ojInputText is a basic editor the framework provides, it can validate the text entered based on the regular expression we give, but validation only happens on blur and if we simply want to filter any keystrokes that don’t match that, we can’t do it by default.
Here is the result before we go and learn how to do it.
Ofcourse we can use ojInputNumber and use the example they gave for eating non-numbers, but what if we don’t want the increment and decrement the arrows of ojInputNumber. One way to do it is to bind a keyUp event and check everytime a character is pressed. Infact this is the approach that is used for the example given in OracleJet cookbook.
Here is an alternative approach using ojInputText. Instead of bindng to value, we can bind to rawValue attribute. This ensures that the observable gets updated on every keystroke.
Symbole im Artikel gezählt: 8.4kLesezeit ≈8 minuten.
I'm going to show you how to solve JamCoins problem of 2016 Google codejam for both small as well as large datasets within time limit.
Here is a moderate problem of CodeJam’s qualification round of 2016. The Jam Coins. It is an interesting problem which gives a glimpse into another popular virtual currency, bit-coin mining. Here is the description of the problem. You need to generate jamcoins of either 16 digits for small dataset or 32 digits for large datasets. Jam Coins follow the given rules…
A Jam Coin is only made up of 1’s & 0’s of the required number of digits.
It begins and ends with 1.
If that interpreted from base 2 to base 10, it should not be a prime number in any of them.
For Small dataset, you need to generate 50 jam coins of 16 digits and for large dataset, you need to generate 500 jam coins of 32 digits following above rules.
Symbole im Artikel gezählt: 2.5kLesezeit ≈2 minuten.
Couple of handy dandy tricks for bypassing the authentication mechanism of Dyn Admin for a quick opening of it.
We use Dyn/Admin for many of the development related tasks of Oracle Commerce(ATG). However, the log-in ticket expires too frequently forcing us to enter credentials repeatedly. Some times we will also have to give both application server(weblogic/jboss) credentials and dynamo administration credentials. As we are not in a production critical environment where multiple people may access our DynAdmin and create issues, it is not necessary to have this security check every time we try to open DynAdmin of our development environment. I have found following solutions to be free of this issue. This can come in handy when we are doing active development and have to frequently access dynamo administration.
Solution 1 - Enable lazyAthentication
This approach works by enabling Lazy Athentication which means login will only be asked once per session. This means, as long as the session is not expired, dyn/admin will not ask for credentials again.
Symbole im Artikel gezählt: 1.9kLesezeit ≈2 minuten.
Introduction to an opensource utility for generating patch files for pending changelists in perforce version controlling system
Perforce is a proprietary version controlling system. It has been around for more than 20 years. However, one glaring limitation always bugs the users. The inability to generate proper diff files. Where is my patch? I can anticipate what is going on in your mind, we can generate a diff file by using the command line interface. p4 diff helps us generate a diff file. However if you ever had a misfortune of trying to generate patch files on regular basis. You would understand the pain. It works fine as long as you just modify existing files. However, if you have new files added to the workspace to be checked into to the depot, you quickly run out of luck. One more problem is that you can’t control the files included in the diff file based on change list. It gives you diff file for all the files that are modified. Of course, you can give individual file names, but you have to repeat it either one by one or by using common wildcard. To overcome this, I have come up with a simple JavaFX utility. Using this utility is as simple as it can get.
First step is to download the Perforce Patcher jar. Just double click the jar file to run it.
You Need JRE 8+ to run this without any additional configuration. If you are using JRE 7, please keep jfxrt.jar in class path or simply copy it to your jre/lib/ext folder. This jar file can be found inside your {jre or jdk}/lib folder.
Upon opening the application you will be presented with the login screen. Login with your regular perforce credentials, deselect Remember me, if you don’t want to store the data entered by you locally. By leaving the default value your credentials will be saved in the application cache so that you need not enter it again. Login Pane
If the login is successful, you will be taken to the next screen otherwise check the Log pane for error. Select the local perforce workspace name and the change list id and click Generate Patch button and save the file at your preferred location through the Save dialog which pops up. Patch Generation Pane
Once you are done with generating the patch, you can quit the application. You will be automatically logged out upon closing it.
You can find the project and its source in github. If you like the project, and want to contribute by adding more features, please fork the github repo. It is a maven project so building it is as quick as a wink.