Plugin to help copy/paste XML in android studio according to some pattern? - regex

I use android studio for creating android apps. While designing the UI I mostly find myself copy pasting my custom made components to test different things out and to see how would they look when I actually populate the view with my component using some adapter. But when I duplicate my components I manually have to update there id's and other attributes in XML according to needs. But those changes mostly have some sort of pattern which I can always define using a regular expression.
So, in short is there any tool for android studio that can help me copy/paste XML by defining some pattern via regex or something else ?
Or should I see this as an opportunity to create my own plugin and start coding right away.

Android Studio (Version 3.3+) supports Live Templates, that you can make as per your use. These can be for .java as well as .xml file formats. See this official Android Developer Youtube channel.
More resources regarding templates in Android Studio:
How to make your own file templates in Android Studio - This is
a multi-part post.
Supercharging your app development speed with
custom file templates
A collection of some Android Studio Live
Templates - This is a Github repo.
You can also try to make repeatedly used classes, activities etc into a library package and reuse them across your projects. Add some tests to them to make sure they work as intended and with some CI/CD scripting and gradle plugins (like gradle-use-latest-versions-plugin) you can have them automatically upgrade to use latest dependency versions etc. Then all you'd need to do is pull them from a repository or include them as a library in your projects to reduce code redundancy.
Hope this helps.

Related

Azure CI Pipeline does not discover any tests once I have multiple 'TargetFrameworks'

Here's the relevant part of my C# library csproj file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net46;net48</TargetFrameworks>
<Platforms>AnyCPU;x64</Platforms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
As the question states, my Azure CI build pipeline completes successfully, but I'm noticing that the Test task in my pipeline takes only 1 second - and that is due to the discovery of any 'test' .dll's is failing to find anything.
I am quite certain that it's due to my outdated test DLL discovery paths
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
The above is what USED to work, when there was only 1 target framework moniker.
Now that I'm trying to support multiple frameworks, I am wondering if there's a slick way to indicate that by tweaking these discovery paths (some type of wildcard technique that I can use everywhere, across different Azure DevOps projects)
I finally discovered that there is no magic discovery path that really works
My old pipeline was using Visual Studio Test task from the days when it was a traditional .NET Framework application
When I changed my .csproj to conform to the new SDK format (even though I was still building .NET Framework apps) I should have changed to a different type of task for doing the tests...
Changing to dotnet test did the trick. It has a different approach. Instead of wanting paths to compiled DLLs, it starts by wanting a pattern to help it find the PROJECT file

How to build and install google-url as a shared library on Mac OS/Linux

I want to use google-url in my project as a shared library on Linux\Mac OS, but can not figure out the right way to build it...
Question: what is the way you suggest to build it from scratch form official sources?
Requirements - be able to stay in sync with official repo and use standard(make) tools.
As far as i can see, right now there are few ways to build it:
in the official repo itself only Visual Studio 2005 build files are included
it is in use at Chromium and so there is .gyp available for it but looks like it is tight integrated with Chromium build structure, so there is no easy way to generate Makefile for the standalone library build.
Although it has a comment inside "TODO(mark): Upstream this file to googleurl."
So at list this considered to be possible.
Googleurl is also integrated with PageSpeed project in .gyp form (thought no the same one as above) and so it is somehow built there
third-party bindings for python are available and also contain some build instructions, but with SCons this time, and AFAIK it is kind of obsolete system to rely on.
Looks like i'm not the only one with this trouble, so other people i found both just implemented their own build files using autotools:
https://github.com/artemg/Googleurl-separate-library
https://github.com/commoncrawl/commoncrawl-crawler/blob/master/src/native/src/libGoogleURL/googleurl/README.google
It could work but the filesystem layout is not the same as in official repo/they have local modification so there are no easy way to downstream changes and stay in sync.
The most tempting way would be to use GYP to generate platform-specific build files for the oficial repo once: make/xcode/visual studio, then just save and use them later as needed..but i have no idea how to approach this and where to start from.

Can a Windows Installer perform logic like a normal application

Can a Windows Installer perform logic like a normal application?
For example: I am creating an installer that installs plugin files to a 3rd Party Application's directory on the C drive. But the destination directory will be different if the user has an old version of the 3rd Party Application.
So the installer needs to determine what version of the 3rd Party Application is on the C drive. If its the new version I install the plugin files to C://Program Files//3rdPartyApplication// and if its the old I install to C://3rdPartyApplication//
So can a windows installer perform logic and if not can it run batch files that can do this?
An "installer" is just a regular application designed to unpack its contents onto a persons hard drive, and possibly perform actions like registry modifications.
If you use a installer like install shield for example you will have to look at that installer documentation to see what it can do. Most installer applications have some sort of area to create custom scripts.
You could also build your own, it is really not very hard.
Yes, installer can perform logic just like regular application. From this point of view, an installer is a regular application.
How you program installer logic depends on which installer suite you use. For detecting whether an application exists in C:\Program Files\3rdPartyApplication or in C:\3rdPartyApplication, you can use FileSearch element of WiX Toolset, look through Windows Installer documentation: Searching for Existing Applications, Files, Registry Entries or .ini File Entries.
More sophisticated logic can be implemented by custom actions. [Custom Actions}(http://msdn.microsoft.com/en-us/library/aa368066.aspx) can be written in JScript, VBScript, C/C++ (DLL or EXE; yet the EXE can't communicate to the Windows Installer session).
I'd like to give a different perspective. Windows Installer is a declarative domain specific programming language. It is not a Turing complete general purpose programming language. It is not intended to be just like any other application. It can be extended with custom actions written in general purpose programming languages such as C++/C# but it should stil follow the same declarative approach where you seperate the "how" to do something from the "what" to do.
Now to answer the second part of your question. Windows Installer has built in searching capabilities. Read the MSDN topics on the AppSearch standard action and related tables (AppSearch, Signature, DrLocator, CompLocator, RegLocator ) You can also put conditions on components and you can set directory destinations dynamically so yes, there are ways of doing what you want to do.
It would require much more information to explain exactly how to do it.
Yes, Windows Installer can perform logic like a normal application.
You can use the WiX Toolset, as suggested by Alexey to get the job done.
You can use the FileSearch element ( http://wix.sourceforge.net/manual-wix3/wix_xsd_filesearch.htm) to check for the existence of files or the RegistrySearch element ( http://wix.sourceforge.net/manual-wix2/wix_xsd_registrysearch.htm) in case you want to check using a registry key.
Alternatively, if the search isn't as simple as checking for a file or a registry, a Custom Action would let you write managed or unmanaged code (according to your preference) to check which version of the 3rd party application is installed.
On the basis of the result of your search, you can, at run-time, change your install directory. A Type 35 Custom Action would let you change the install directory:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa368093%28v=vs.85%29.aspx

Source code dependency manager for C++

There are already some questions about dependency managers here, but it seems to me that they are mostly about build systems, while I am looking for something targeted purely at making dependency tracking and resolution simpler (and I'm not necessarily interested in learning a new build system).
So, typically we have a project and some common code with another project. This common code is organized as a library, so when I want to get the latest code version for a project, I should also go get all the libraries from the source control. To do this, I need a list of dependencies. Then, to build the project I can reuse this list too.
I've looked at Maven and Ivy, but I'm not sure if they would be appropriate for C++, as they look quite heavily java-targeted (even though there might be plugins for C++, I haven't found people recommending them).
I see it as a GUI tool producing some standardized dependency list which can then be parsed by different scripts etc. It would be nice if it could integrate with source control (tag, get a tagged version with dependencies etc), but that's optional.
Would you have any suggestions? Maybe I'm just missing something, and usually it's done some other way with no need for such a tool? Thanks.
You can use Maven in relationship with C++ in two ways. First you can use it for dependency management of components between each other. Second you can use Maven-nar-plugin for creating shared libraries and unit tests in relationship with boost library (my experience). In the end you can create RPM's (maven-rpm-plugin) out of it to have adequate installation medium. Furthermore i have created the installation for CI environment via Maven (RPM's for Hudson, Nexus installation in RPM's).
I'm not sure if you would see an version control system (VCS) as build tool but Mercurial and Git support sub-repositories. In your case a sub-repository would be your dependencies:
Join multiple subrepos into one and preserve history in Mercurial
Multiple git repo in one project
Use your VCS to archive the build results -- needed anyway for maintenance -- and refer to the libs and header files in your build environment.
If you are looking for a reference take a look at https://android.googlesource.com/platform/manifest.

Resources for setting up a Visual Studio/C++ development environment

I haven't done much "front-end" development in about 15 years since moving to database development. I'm planning to start work on a personal project using C++ and since I already have MSDN I'll probably end up doing it in Visual Studio 2010. I'm thinking about using Subversion as a version control system eventually. Of course, I'd like to get up and running as quickly as I can, but I'd also like to avoid any pitfalls from a poorly organized project environment.
So, my question is, are there any good resources with common best practices for setting up a development environment? I'm thinking along the lines of where to break down a solution into multiple projects if necessary, how to set up a unit testing process, organizing resources, directories, etc.
Are there any great add-ons that I should make sure I have set up from the start?
Most tutorials just have one simple project, type in your code and click on build to see that your new application says, "Hello World!".
This will be a Windows application with several DLLs as well (no web development), so there doesn't need to be a deploy to a web server kind of process.
Mostly I just want to make sure that I don't miss anything big and then have to extensively refactor because of it.
Thanks!
I would also like a good answer to this question. What I've done is set it up so that each solution makes reference to a $(SolutionDir)\build directory for includes and libraries. That way each project that has dependencies on other projects can access them and versions won't compete. Then there are post-build commands to package up headers and .lib files into a "distribution" folder. I use CC.net to build each package on checkin. When we decide to update a dependency project we "release" it to ourselves, which requires manual tagging, manual copying current.zip into a releases area and giving it a version number, and copying that into the /build of the projects that depend on the upgrade.
Everything works pretty great except this manual process at the end. I'd really love to get rid of it but can't seem to. Read an article from ACM about "Continuous Release" that would be really nice to have an implementation of but there isn't any. I keep telling myself I'll make one.
If I use "junctions" in the windows filesystem I can link "distribute" to "build" and then build a secondary solution that includes all the projects that are dependent on each other to build a product. When I did that though it encouraged developers to use it for active development, which discouraged TDD and proper releasing.