How to remove old/closed tasks in IntelliJ - intellij-idea

I have the following task menu in IntelliJ. What I want is to clear it completly. I don't care if I have to remove a settings folder or something like that. But I want it to be cleared. Deleting every single task is not an option because there are hundreds of then.
I figured out it has to be something in the .idea folder or in the settings because I already freshly installed IntelliJ

You can select many tasks with Shift and then delete all of them at once, which is much faster than removing all the tasks individually:
https://www.jetbrains.com/help/idea/managing-tasks-and-context.html#delete-tasks
Alternatively, all tasks are stored in workspace.xmlin .idea folder under <component name="TaskManager">, such as:
<task active="true" id="LOCAL-00674" summary="Some Task">
<created>1501071813825</created>
<option name="number" value="00674" />
<option name="presentableId" value="LOCAL-00674" />
<option name="project" value="LOCAL" />
<updated>1501071815536</updated>
<workItem from="1501071815699" duration="59000" />
</task>
You can delete them all from there.

Related

Intellij IDEA - DB Navigator - reveal password

I use "DB navigator" plugin(https://plugins.jetbrains.com/plugin/1800-database-navigator/) for my Intellij IDEA Community version quite some time and am very satisfied.
I want to know the password of my DB connection saved in the plugin. They are saved, they are there, but I cannot share it with my teammates.
Even all the IDEA passwords are set to be stored in the system keyring, I don't find them in seahorse, i.e., "Passwords and Keyrings" application in my Ubuntu.
Where are they?
At last, I found it in
<project_root>/.idea/dbnavigator.xml
search your connection name, and you will see sth like this:
<connection id="e208f307-8c08-45d5-93fd-958c1d68d049" active="true">
<database>
<name value="UAT" />
<description value="" />
<database-type value="ORACLE" />
<config-type value="BASIC" />
<database-version value="11.2" />
<driver-source value="BUILTIN" />
<driver-library value="" />
<driver value="" />
<url-type value="SERVICE" />
<host value="some-host" />
<port value="1523" />
<database value="APP_DB" />
<type value="USER_PASSWORD" />
<user value="admin" />
<deprecated-pwd value="<base64-encoded-password>" />
</database>
...
</connection>
So, I tried to base64 decoded them... and it works...
Please, if the author sees this, please don't encrypt it in the future versions; I need them to be in my local so that I don't have to ask my teammates again; too shy am I. Please take into consideration that I created the tag db-navigator for the first time while asking this question, so that ppl around the world could gather together with love of this plugin.
And, any coder reading this: please ignore this file in Git, as it contains sensitive data.

wix: How to set environment variable based on UI radio-group value?

In a Wix installer, I'm trying to set an environment variable based on the value of radio group. I'm not having luck finding out how to do it.
The radio group in the UI has 3 options:
Do not set environment variable
Set the variable per user
Set the variable per machine
The UI with the 3-button radio group looks like this:
<Control ...>
<RadioButtonGroup Property="VAR_SCOPE">
<RadioButton Value="user" ... />
<RadioButton Value="machine" ... />
<RadioButton Value="none" ... />
</RadioButtonGroup>
</Control>
The component that creates the environment variable is like this:
<Directory ...>
<Component ...>
<CreateFolder />
<Environment Id='Evar' Action='set' System='yes' Name='FOO' Value='bar' />
</Component>
</Directory>
Whether the env-var is set per user or per machine is dependent on the value of the 'System' attribute: yes for machine, no for user.
I don't believe MSI supports this. I see a comment in https://msdn.microsoft.com/en-us/library/windows/desktop/aa368369(v=vs.85).aspx saying that on Windows 2000 the * prefix controls scope but I've never used this. As far as I know, MSI always respects the system context of the installation. ( Per-User vs Per-Machine) I suppose that is a short coming compared to what the registry table can do. Environment variables are effectively just registry table entries with a SendMessage so you could use Registry and a minmilist custom action.
If you do this, you'd want to have 2 mutually exclusive components.

IntelliJ IDEA 15 - How to migrate task history between projects?

I have been using IntelliJ IDEA 15 for close to a year now, and using the same project this whole time, where I have created Tasks to basically act as workspaces for various work assignments so I can group files I've touched based on the assignment title. I've recently had an issue in my project workspace where I am basically being forced to create a new workspace, and thus a new project in IntelliJ. The problem is that this new project has none of my Task history in it.
Does anyone know if it's possible, and if so, how, to migrate this Task history from one project to another?
Thanks in advance!
Tasks are saved in YOUR_PROJECT/.idea/workspace.xml so you can backup this file and if needed you can just copy and paste these lines defining tasks to the other workspace.xml file. This is the example of one:
<configuration default="false" name="my-debug-task" type="JavascriptDebugType" factoryName="JavaScript Debug" uri="http://localhost:4200">
<mapping url="webpack:////home/marcin/Sprawozdania/Inzynierka/sqap/sqap-ui/src" local-file="$PROJECT_DIR$/sqap-ui/src" />
<mapping url="webpack:////home/marcin/Sprawozdania/Inzynierka/sqap/sqap-ui" local-file="$PROJECT_DIR$/sqap-ui" />
<method />
</configuration>
Addittionaly In workspace.xml you need to add reference of copied task to:
<project>
<component>
<list>
like here :
<list size="3">
<item index="0" class="java.lang.String" itemvalue="JavaScript Debug.my-debug-task" />
<item index="1" class="java.lang.String" itemvalue="JavaScript Debug.Unnamed" />
<item index="2" class="java.lang.String" itemvalue="Maven.config start -devs" />
</list>

How to modify XML file with wix toolset

I have XML file that include a next content:
<!--<appcache appCacheType="None" />-->
<appcache appCacheType="SingleClient" defaultExpiration="3600"/>
On installation patch i need to change this content in XML file to:
<appcache appCacheType="None" />
<!--<appcache appCacheType="SingleClient" defaultExpiration="3600"/>-->
What is a better way to do it?
Thanks.
I tried (in vain) to use the MSI Community Extensions for this purpose, but wasn't able to get them up and running.
I ended up using the util:XmlFile-tag from the Util-extension that works flawlessly.
Add the namespace of the Util-extension to your source-file in the Wix-element:
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
Then use it as sub-element of a related component. In your case you want to delete an attribute and change the value of another one. The following should do the trick, just adjust the XPath in the ElementPath-attribute to the one that matches your tag (in the example it updates the appcache-tag which has an attribute appCacheType with the value SingleClient) and the filekey of the XML-file:
<Component Id="myComponentToUpdateTheXmlFile" ... >
<!-- Removing the defaultExpiration-attribute first -->
<util:XmlFile Id="UpdateAppCacheTag" Action="deleteValue" ElementPath="//appcache[\[]#appCacheType='SingleClient'[\]]/#defaultExpiration" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="1" Name="defaultExpiration" />
<!-- Now updating the value -->
<util:XmlFile Id="UpdateAppCacheTag" Action="setValue" ElementPath="//appcache[\[]#appCacheType='SingleClient'[\]]/#appCacheType" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="2" Value="None" />
</Component>
Be sure to add the Util-extension also on the commandline when invoking candle and light:
<candle or light command line> ... <parameters> ... -ext <PathToWiXExtensions>\WixUtilExtension.dll
If you want to do this only during e.g. patching, then add the appropriate condition for this component.

Scope and order of evaluation of Items in MsBuild

I wonder why in the following code, MsBuild refuses to set the Suffix Metadata. It does work with a CreateItem task instead of the ItemGroup Declaration (because CreateItem is computed at build time) but I can't do this here because this code is in a "property file" : the project has no target, it's just a bunch of properties/items I include in real projects.
<ItemGroup>
<Layout Include="Bla">
<PartnerCode>bla</PartnerCode>
</Layout>
<Layout Include="Bli">
<PartnerCode>bli</PartnerCode>
</Layout>
</ItemGroup>
<ItemGroup Condition="'$(LayoutENV)'=='Preprod'">
<LayoutFolder Include="Preprod">
<Destination>..\Compil\layout\pre\</Destination>
</LayoutFolder>
</ItemGroup>
<ItemGroup>
<Destinations Include="#(LayoutFolder)" >
<Suffix>%(Layout.PartnerCode)</Suffix>
</Destinations>
</ItemGroup>
Destinations is well built but the Suffix Metadata is not set.
As for now, I have duplicated the Destinations Definition in every project I needed it but it's not very clean. If someone has a better solution, I'm interested!
With MSBuild 4 you can use metadata from previous items in item declaration like this :
<ItemGroup>
<Layout Include="Bla">
<PartnerCode>bla</PartnerCode>
</Layout>
<Layout Include="Bli">
<PartnerCode>bli</PartnerCode>
</Layout>
</ItemGroup>
<ItemGroup>
<Destinations Include="#(Layout)" >
<Suffix>%(PartnerCode)</Suffix>
</Destinations>
</ItemGroup>
(It's strange that you batch on LayoutFolder and try to get Layout metadata. What value do you want as Suffix bla or bli?)
It appears that I try to set Metadata dynamically outside a target which is impossible.
I try to set the Suffix Metadata by batching over Layout items but Layout items are not properly set when the batching is done. The batching is done when msbuild parse my property files, it does not wait for Layout to be declared.
Nevertheless, like MadGnome pointed out, I can batch over LayoutFolder (which is the source items for my includes) because MSBuild does wait for it to be declared.
The issue you're encountering is that you're referring to metadata in a list. The %(Layout.PartnerCode) iterates through the ItemGroup of "Layout", which in this case returns 2 items. Even with 1 it causes undesired, unexpected results, as you're pointing to a list. MSBuild returns two meta tags and doesn't know which one you would want to have. The result being that it chooses none instead... or.. well, MSBuild ends up setting it to nothing.
I'd suggest setting a default ItemDefinition, like this (MSBuild 3.5)
<ItemDefinitionGroup>
<Layout>
<PartnerCode>%(Identity)</PartnerCode>
<Suffix>%(PartnerCode)</Suffix>
<Destination Condition="'$(LayoutENV)'=='Preprod'">..\Compile\layout\pre\</Destination>
</Layout>
</ItemDefinitionGroup>
And then define them as you would have.
<ItemGroup>
<Layout Include="Bla" />
<Layout Include="Bli" />
<Layout Include="Bloop">
<PartnerCode>B2</PartnerCode>
<Suffix>%(PartnerCode)</Suffix>
</Layout>
</ItemGroup>
Sidenotes
Note. Metadata seems to be only parsed once per definition group / itemgroup, so if you're setting PartnerCode, you'd also have to reset Suffix, as seen in the second example. I am not familiar with the behaviour in MSBuild 3.5, but it is the case in MSBuild 4.0.
Note. I'm assuming that you want your filename as a suffix, Identity does the trick, see here "MSBuild Well-known Item Metadata": (https://msdn.microsoft.com/en-us/library/ms164313.aspx), if this is not the case, you can always follow the custom override example or write your own function based on it. Read more on stuff like that here "MSBuild Property Functions": (https://msdn.microsoft.com/en-us/library/dd633440.aspx)