Trying to perform a diff using netbeans and its Git repository - netbeans-7

I have two different version of a website, an older version, and a newer version that is supposed to have some sort of virus on it (or malicious code of some kind). I need to perform a diff between the two sites and try to eliminate the virus in the newer one.
After some searching I found netbeans 7.1 is able to do this using it's Git Repository. I was following this tutorial http://netbeans.org/kb/docs/ide/git.html but I am not getting the same options on my screen as in the tutorial. I am using netbeans 7.1 RC1 and downloaded the jdk from the link on that same page. The jdk download itself says jdk7 but the folder it creates on my computer is named jdk1.7.0_01 . I'm assuming jdk7 is short for jdk1.7 .
I get as far as the very end of the "Initializing a Git Repository" step. The end when it says "All the project files are marked Added in your Working Tree. To view a file status, place the cursor over the file name in the Projects window. The status of the file in the Working Tree displays in green to the right of the slash like shown in the following picture." does not happen.
I tried going further anyway, but there is just more and more options that do not show up for me.
I am also open to another way to perform a diff operation between the sites, it doesn't have to be with using netbeans. I should note however I do not have access to a unix box. So the solution has to work for windows, or I guess I can go on a coworkers mac if I need to.
Thank you.

From your question, it sounds like you did not already have your web site code under version control. If that's the case then I'd suggest doing so, and git is a very good choice. It is what I use.
Your goal, however, is to diff the older version of your site with the "newer" (possibly infected) version, and that can be done without having to deal with a version control system. There are several good diff tools for Windows. I mainly use WinMerge, as I like its user interface and simplicity. KDiff3 is another good one, and I use that one in conjunction with git merge operations, because it supports a three-way-merge comparison (which WinMerge does not).
If you were to use WinMerge for your diff, and you had the code from the old version in Q:\example.com\old-version and the "new" version in Q:\example.com\current-version, then you would start WinMerge, and either choose File|Open... from the menu, or click on the open icon in the toolbar. You would get a dialog like the following, and would fill it in as shown:
If you filled everything in correctly, then you would be able to click on the OK button, and would get a list of file differences. Depending on the default settings, you might also see files that have not changed at all in that list. You can hide those using the View menu. Double-clicking on a file with differences will open the two versions and show you the differences.
Explore the WinMerge options. I have mine set, for example, to compare white-space differences, but to ignore different line endings (Unix's LF versus Windows' CR/LF).

Related

how can I execute a three.js example in my project folder?

How can I execute a three.js example in my project folder? The example I want to execute is this:
https://threejs.org/examples/webgl_animation_keyframes.html
.
After installing three.js through npm, I copied example's source code:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_keyframes.html
in my empty examples folder located at '/node_modules/three/examples'.
I think there's a path direction problem importing some of including library files such as
"import { RoomEnvironment } from './jsm/environments/RoomEnvironment.js';"
"loader.load( 'models/gltf/LittlestTokyo.glb', function ( gltf )"
etc.
Do I have to copy those library files and paste it on the right path by hand? I'm afraid this is not a correct solution. Is there a solution something like, as I wish, downloading all necessary library files in the right places by input some npm command?
The situation is certainly not ideal, but here are some tips:
You can clone the whole repository so you have all the resources used by the examples: git clone --depth=1 https://github.com/mrdoob/three.js.git
You can use a web browser's web page saving feature (Ctrl+S) but be sure to replace the HTML with the example's source HTML, because it will be much cleaner. You'll need to fix up file path references, and it may still miss some resources. Also make sure not to get the iframe containing page, but rather the demo itself.
If Save Webpage As misses some resources, you can use Chrome's dev tools Network tab. Refresh the page to populate it, then right click inside the table > Copy > Copy All as CURL. This will give you a command you can paste in your terminal (in an empty directory, ideally) to download all the resources used by the webpage. This can still miss some resources that are dynamically loaded, such as with 1. the model selector in the LDraw Loader example, in which case you could switch to each model to purposely populate the network requests table, or 2. a fallback for older browsers, in which case you may not be able to get it through this method.
It's much easier to remove features than to add and combine them, so try to find an example that uses as many of the things you want as possible (without being overwhelmingly complex). It's worth looking outside of the official examples to real projects and third party experiments. Just note that they may not be up to date with the latest APIs.
I hope someone writes a script to automate setting up a Three.js project from an example... and posts a better answer than this!

Get back lost shelf changes

I have shelved my 26 java files changes via Intellij Idea 2016.2.1 and I checkout to different branch.
When I came to old branch to check my shelved changes.
I gone a mad now, I lost all the files. I was worked nearly two months
Can somebody help to get it back?
You can restore the state of those files if they were edited in IntelliJ. Use local history to see all the changes made in IntelliJ (VCS -> Local History -> Show History).
Even there isn't Shelf tab in IDE you can find shelved changes as patch files at {ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf.
Then your can apply any selected patch.
I was able to view lost changes and revert back to them by:
right click on project directory, select Local History > Show History
Find the entry in the history menu that you want to restore. You can examine the files by double clicking on the entry and the files to examine differences.
Right click on the entry you want to restore, and select Revert
Note in my case Git>VCS Operations>Show History showed nothing. Only through the Project Files menu.
Andrei's answer was helpful for my situation where I renamed my project and my previously shelved changes were no longer found under the shelf, but I did run into an issue when applying the patch file because I was prompted to "Select missing base" for various files in the patch. Similar to what is seen in the screenshot below:
https://youtrack.jetbrains.com/issue/IDEA-183910
I was able to avoid having to "Select missing base" for various files by first changing the default shelf location and then applying the patch.
https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html#change-shelve-location
Also, I found my patch in this location:
{ProjectName}/.idea/shelf
instead of the aforementioned location:
{ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf
Maybe this will help someone:
I lost part of my shelved changes in combination with an update of IntelliJ. I'm not sure if the update was the reason but eventually most of my most recent (and important) changes were gone.
I couldn't restore them from local history as this does not "survive" an update of IDEA. But in the files I saw that there still is some data:
C:\Users\myUser\AppData\Local\JetBrains\IntelliJIdea2021.2\LocalHistory had a changes.storageData with ~50MB.
Copying the files to the folder of the new version didn't help as the files got overwritten again.
Solution:
I was able to get the old version of IntelliJ (2021.2) here and installed it. This can be done in parallel, without removing the newer version.
Here I was able to retrieve my changes from the Local History and shelve or apply them again.
Hint: Backup the "Local History" folder (or the whole IntelliJIdea20xx.x folder) before you start. I don't remember if I had to copy it in there again or if it worked out of the box. (Just to be sure the local history doesn't get lost).
I've also experienced this bug repeatedly and hence no longer use shelved changes, but rather the Git CLI directly. As of 2022 Jetbrains IDE's still cannot be trusted with their "Smart Checkout" feature, which has a small probability of the total loss of your files (experienced personally in both IntelliJ & Rider).
Unlike another comment here regarding using the Local History, this did not work for me as the history showed nothing. I've also lost many hours of work due to this bug which remains unfixed.
The solution is to use "git stash -u" on the command line, then checkout the desired commit. Once youre done, type "git stash apply" to restore your files. Trusting the "smart checkout" feature is like playing Russian roullette. It's IDE magic that may just fail and you lose everything.

How to Export/Import a Data Source from DataGrip?

I can't seem to figure out how to export a data source configuration in DataGrip (currently on 2016.2 EAP).
I would like to export a handful of data sources and share them with my teammates to make it easier for them to get up and running on DG.
I've tried File->Export Settings (exporting all settings) and did not notice the data source configurations within the resulting jar file.
I seem to recall that in earlier versions of the tool (when it was still called 0xDBE), you could find data source configuration files on the drive and share them that way, but I am unable to locate any at this time.
Perhaps it's not possible?
UPDATE FROM 2021!
Starting from version 2021.1, you can just press Ctrl/Cmd+C on the data source, and then Ctrl/Cmd+V it in another IDE. The clipboard contains XML for the data source, so you can send it to the colleague via e-mail, messenger etc.
It is possible!
You need to share a project with your friend — all you do in DataGrip is in the context of a project. If you did not create a new one, everything is under the default project. Look at the gif:
The more detailed information can be found in the tutorial: https://blog.jetbrains.com/datagrip/2018/05/21/copy-and-share-data-sources-in-datagrip/
You can do it easily via the clipboard, although it took me a while to figure it out:
in your source project, open the Database tool window, select the data sources you want to export, then right click / "Database Tools..." / "Copy Settings"
in your target project, open Database tool window, click on "+" then "Import from Clipboard"
Also works between DataGrip and IntelliJ.
Addendum
The wording has changed slightly in DataGrip 2018.2 EAP (or before), instead of "Copy Settings" it's now "Copy Data Source(s) to Clipboard", which reflects better what it does.
DataGrip stores data sources on two different levels:
Project level: together with project configuration files inside .idea subfolder of the project folder
IDE level: stored in IDE config/options directory.
Project level data source is available once you open the project.
To import/export IDE level Data Source use File | Import/Export settings action.
To move Data Source to IDE settings and back use corresponding action in Datasource Properties dialog (see screenshot) as shown here:
On my current version 2020.1 the projects are on:
/System/Volumes/Data/Users/<USER_NAME>/Library/Application Support/JetBrains/DataGrip2020.1/projects/default/
A good way to find where is it store is just calling:
find . -name "dataSources.xml"
It will find for that file everywhere.
make the data source global and use export settings to export.
https://www.jetbrains.com/help/datagrip/managing-data-sources.html#sharing-data-source-settings
You can find all data sources at this path (change username and version):
C:\Users\fouad.DataGrip2019.1\config\projects\default\.idea
I recently discovered a really cool Mongodb plugin for IntelliJ and DataGrip called 'Mongo Expert' that helps users navigate the Mongodb database and work more efficiently. With support for Commandline MongDB Database Tools like mongoexpert, mongoimport, mongodump, and mongorestore, users can create and execute commands through easy-to-understand dialogues. You can download 'Mongo Expert' from the JetBrains Plugin Repository. I hope it will be useful for you too!
https://plugins.jetbrains.com/plugin/20761-mongo-expert

Script TFS Powertools shell extension getter

Is there a simple way to script the TFS powertools "get latest version" feature ?
I am refering to this window:
I just want to get it via a script, rather than by right clicking on a folder. I am aware of tf get but I like the powertools window better
The window you are showing above is not specific to TFS Powertools. That is the basic get window that comes packaged with TFS. Based on that fact, I am not 100% sure I understand your question.
Do you mean to say "How can I, using tfpt, do a get latest version and show this window." Maybe you are simply asking how to display the TFS window from the command line or via script?
TFPT has getcs if you know the latest changeset but that doesn't display in a window. TFPT adds features that TF doesn't have so obviously TFPT will not have a basic get.
I am unaware of a way, via a script (which would rely on tfpt or tf) to get latest in TFS and then display the aforementioned TFS get window. I can't think of any reason why there would be a need for this either. There is command line syntax to handle the gets.
Of course there are commands that will display in the viewer because it wouldn't make sense in plain text; however, since the get command simply gets files it wouldn't make sense to pop the viewer.

Creating PDF file in PowerBuilder

I am new to PowerBuilder. I got an assignment to create a PDF file using PowerBuilder. How can I do that?
Our organization used to use Ghostscript, but has instead moved to Amyuni.
as suggested by Alberto Megia, download PDF creator, but dont use SAVE AS.
After you install pdf creator it will install a printer, use that printer to save the
datawindow with the print function.
after call print function, you will see a "Save as" dialog.
If you use "saveas" function, the pdf will not have the format that the datawindow shows.
What version of PowerBuilder are you using? The most recent versions have PDF capability built in (using Ghostscript).
Install Ghostscript.
Get PDFCreator for free there and install it.
Then you can save as PDF any datawindow or datastore with the statement:
dw_1.saveAs(path_where_to_save_with_name_of_file.pdf, PDF!, true)
Third parameter is for override if the file exists with that name. I hope it works for you.
Regards,
Alberto
We just use Ghostscript. I wrote Ghostscript setup instructions earlier. We also print Word documents we've filled in to PDF from our app by printing them to 'Sybase DataWindow PS' printer then running Ghostscript to make the PDF.
Good Question - There really isn't an easy way other than finding a third party tool. I've tried the prior method mentioned and it does work but not without headaches and you are left with deployment headaches, deploying ghost script and having to make sure Post Script drivers are on the client.
I ended up trying many PDF converters, both free and paid, the one that worked most seamlessly was one that installed as a "printer" such as if you have Adobe installed on the PC, but you need to dynamically verify existence of the printer via RegistryGet and if it doesn't exist ask user to install or install it dynamically via code, and registry entries (not fun).
After several headaches mostly related to deployment issues I ended up going with a server solution, but it requires having a server that you can have a process (distiller) running that grabs post script files and distills them to PDF. I used a response window with progress bar, the PB app printed post script file to server location upon which the distiller grabs and converts. My PB app polls the server until it finds the PDF, or the user cancels whichever comes first. With a good distiller the process is fast (< 5 seconds) which was acceptable to our users.
Upon existence of the PDF, we'd attach it to an email and send via Oracle (mapi). This solution limits the requirements on client to post script driver which in most corporate environments is there, but you need to check it via Registry. Maybe there is a better solution out there since I did this last, around 2008.
fyi- I usually don't make vendor recommendations but will in this case because there was one that stood out in ease of use and quality, it was called PDFCreator which installs as a windows printer. It looks to be open-source right now but I recall that we would have had to pay to use it in corporate environment.
Good Luck.
Use the tutorial How to use PowerBuilder to create PDF file?.