How can I pull the right loc information from Sonar? - sonarqube

Sonar reports the lines of code iformation for each language on each project's dashboard.
In order to create a report from 70+ projects, we use THE Sonar's REST API. Currently we iterate over all files of a project to retrieve each file's lines of code. Here we run into the limits issue (the result is cut off at 500 entries, there is no paging on the REST API). See SonarQube API result limit, and https://jira.sonarsource.com/browse/SONAR-2920.
Hence the pulled numbers are wrong, and we need to manually fix the report.
Now my question: Is there a way to pull the numbers shown on the project's dashboard through the REST API? Or going to the database? (Sure, not ideal, but I need to solve my problem ;-)
Thanks in advance.

Why do you want to go through each file to compute the projects' lines of code ?
Why not use the api/resources WS ?
documentation
example
HTH

Related

SonarQube 6.2 - Export issues

I am using the latest SonarQube 6.2.
They have moved out the reporting module into a commercial governance module.
Now I cannot find any way to export the issues into some report, or filter the issues based on set of classes.
The File filter provided on Issues page, is not providing the full list of files, nor does it have any search option to filter the issues based on a given file name.
My basic need is to filter and view the issues for a given file. Is there any way of doing this?
Use the WS api/issues/search and give the componentKeys parameter

building torrent provider website

Recently i have been given a project that is torrent provider just like torrentz.eu, thepiratebay etc, where anyone can search what they want to download and then get the download like with the help of torrent.
I don't know the concept behind this, what is the basic requirement and what is the process to make it done. i have searched over Google but didn't find any relevant answer related to my problem.
I just want to know the process and what i really need to do to make it done. technology i will use that is spring framework.
Thanks
This is not really an Spring specific question but I'll try to help you.
You just need to save the torrent file (a text file with information needed by torrent clients) in a database along with information about the torrent like a representative name, a date and not much more. You could do this using Spring Data JPA for example. This way you won't need SQL knoledges.
If you want a site like torrentz.eu, you will also need to fetch data about the torrent like peers. You can store this also in the database but you will have to update it periodically. To do this, there are APIs like Bitsnoop that return this kind of information.
Having this, you'll need only some controller mappings to show your home and to let users search torrents given a name (the one that your saved before).
Well, first you need to know that Torrentz and ThePirateBay are 2 different things.
Torrentz is a search engine (like google) that searches for torrent files.
ThePirateBay - in past .torrent files hoster, now a simple Magnet linker.
All you need is a website with a huge .torrent files database.
Also a good hosting in a not online controlled country, so you don't get in trouble just like the most popular torrent website (thepiratebay.se / torrentz.com / kickasstorrents.com ...)
Of course they are still online, but that's just because they have a big fan base that keeps creating mirrors and proxies (https://viralifyblog.wordpress.com/2017/06/19/thepiratebay-proxy-list/)
Finally. I don't recommend creating a torrents website.

Where to add Google Remarketing tag in Magento

I am trying to figure out in which file I need to add the Google remarketing tag. I know it needs to be added before the closing of the body tag. Can anyone point me in the right direction?
Thanks
here is I did in the past:
Depending on what kind of google tracking you are using you have a few different way to use:
1) If only add a custom code and should be in all the Magento page, use the "Miscellaneous Scripts" value going to admin section, System > Configuration > Design > HTML Head - Miscellaneous Scripts. (This will be included before head closing tag in page HTML.)
2) By native Magento already have Google Analytics tracking code and you can find this configuration going to admin section System > Configuration > Google API - Google Analytics.
3) If you are looking something more complex and use the Google adWords I used the extension magento connect link. For a particular Client I did some extra modification to include some extra code if a client subscribe to newsletter or a new client etc.
I hope you can find something helpfully in the post.
Best,
GrinGo.
There are different template file for different pages in magento so at first I think you should decide where to place it.For example if you want to place it in footer than you should place that code snippet in
"app/design/frontend/base/default/page/html/footer.phtml"
Similarly you can check other different template files to place your code.
NB:Best practice is to overide the core file of magento before making changes to it.
Hope this will help.
There's no indication as to which Magento version you're using 1 or 2. At the end of the day it depends how much technical knowledge you have and if you're using a version control system to manage your Magento build.
Miscellaneous Scripts as another answer mentioned earlier, this approach is straight forward and very easy to use to plug and play your code.
Google Module depending which version of Magento you use (CE/EE) there will be a built-in section for you to plugin your account ID in backend Magento configuration and then the platform will generate necessary code for you.
Write custom module by writing your own module you can place it the snippet anywhere on the page by targeting before_body_end node in your layout XML file. This is more technical but gives you more control over what you can do.
Google Tag Manager this also depends on if your Magento version comes pre-built with Google Tag Manager module, then you can create a container and place all your logic in there. This is also more technical and require the output of some values in JS format on the frontend to let GTM read the values.
At the end of the day go with what is easy to setup, portable and easy to manage. I usually go with Google Tag Manager as it takes time to create initial setup of exposing data on the frontend but then I have full control of what I want to do with that data through tag manager. In most cases you'll end up using the same data (ex. totals, shipping method, product IDs, SKUs, cost, etc.) in more than one third party API so this gives you flexibility to do just that.

SonarQube WebApi Access File Source Code

It looks like the sonar web api changed in the last days. At least one of my projects using the api isn't working anymore.
I specifically need to access the source code of components / files.
According to the online doc (http://docs.codehaus.org/pages/viewpage.action?pageId=229743288) this should be possible with a call like 'http://nemo.sonarqube.org/api/sources?resource=org.codehaus.sonar:sonar-plugin-api:org.sonar.api.measures.CoreMetrics' what isn't working anymore.
Can anybody tell me how to access the source code of a file via the current sonar web api? Help would be very appreciated.
Thanks and best regards,
Robert
The API hasn't changed. But the key of components has changed in SonarQube 4.2. I updated the example on http://docs.codehaus.org/pages/viewpage.action?pageId=229743288

Resource Filtering with Maven Site Plugin

I'm using the maven site plugin to create and deploy a site of documentation and resources. There are some javascript files that I would like to filter based on what profile is being used. Problem is, I can't figure out how to get the filtering to work. Has anyone come across this?
I'm using Maven 3 and my resources are all in /src/site/resources which automagically get copied to /target/site by the site plugin.
Thanks!
The simplest solution is to name the files you would like to filter as: filename.vm which identifies them as velocity macro files which will be filtered automatically.

Resources