Coder Social home page Coder Social logo

notepadpp-codestats's Introduction

notepadpp-CodeStats

Github All Releases GitHub release Build status

Code::Stats - Write code, level up, show off! A free stats tracking service for programmers. This plugin enables XP tracking in Notepad++.

To get started, you need to create an account at codestats.net.

Installation

  1. Inside Notepad++ open the Plugins Admin (PluginsPlugins Admin...).

  2. Check the box next to Code::Stats in the list of plugins. (Note: If the plugin version in the list is outdated, you need to update your Notepad++ to the latest version)

  3. Click the Install button.

  4. Confirm the restart of Notepad++.

  5. Enter your API token in the window that pops up, then press OK.

  6. Use Notepad++ like you normally do and your amount of programming will be tracked for you automatically.

  7. Visit https://codestats.net to see your logged stats.

OR

  1. Go to releases and download zip file for correct architecture of your Notepad++ installation.

  2. Put CodeStats.dll in Notepad++ plugin dir, inside of CodeStats folder, for example (for x86): C:\Program Files (x86)\Notepad++\plugins\CodeStats, or (for x64): C:\Program Files\Notepad++\plugins\CodeStats.

  3. Start/restart Notepad++.

  4. Enter your API token in the window that pops up, then press OK.

  5. Use Notepad++ like you normally do and your amount of programming will be tracked for you automatically.

  6. Visit https://codestats.net to see your logged stats.

Anonymous usage statistics

On the next Notepad++ launches, after API token has been provided, this plugin is making HTTPS request to analytics server containing plugin version and unique randomly generated ID. This is because author would like to see the amount of people using this. If you really do not want to be included, you can opt-out in plugin settings.

Troubleshooting

CodeStats for Notepad++ logs to C:\Users\<user>\AppData\Roaming\Notepad++\plugins\config\CodeStats.log.

Turn on debug mode (click the CodeStats icon in Notepad++) then check your log file.

Other info

This plugin was originally based on notepadpp-WakaTime

notepadpp-codestats's People

Contributors

chcg avatar p0358 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notepadpp-codestats's Issues

Code::Stats Plugin will not uninstall

I installed Code::Stats not realizing I had to get an API key. I don't want to do that. Tried to uninstall the plugin.
Code::Stats will not uninstall (it goes thru the motions, but is still present after notepad++ restart.
Now, the itimetracker plugin (company that developed Code::Stats) gives me TWO (not 1 but 2 seperate ) Windows demanding an API key upon startup. I can't get rid of it.

I have tried steps to manually uninstall, I still get the pop-up windows on restart.
I have tried totally uninstalling, then reinstalling Notepad++, Code:Stats still remains.

Code::Stats by iTimetracker appears to behave like a virus.
It demands your attention and money (to get the API key) to make being pestered go away.
Once you install it, you can never get rid of it, and it will pester you forever.

Cannot connect to remote server

Using version 1.0.1 from the releases page i get the following error when trying to set up the codestats plugin:

Screenshot (german text, sry :P)
roughly translated it means something along the lines of "Could not establish a connection to the remote server".
i have no third party firewall, its not in my pi-hole block lists, and the windows firewall is disabled.

im using win10 enterprise x64, version 1909, build 18363.815

(ive translated this one line for yall because im pretty sure its the most important one)
[Code::Stats HandledException 10:00:05 ] Error Initializing CodeStats: System.Net.WebException: Die Verbindung mit dem Remoteserver kann nicht hergestellt werden. ---> System.Net.Sockets.SocketException: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte 141.8.224.221:443
roughly means:
[Code::Stats HandledException 10:00:05 ] Error Initializing CodeStats: System.Net.WebException: The connection to the remote server could not be established. ---> System.Net.Sockets.SocketException: the connection could not be established because the remote computer refused the connection 141.8.224.221:443
CodeStats.log
which sounds like a ssl problem, given the port 443

Code Stats version 1.1.0 - Suggests updating to previous version v1.0.1

Fresh install from the Plugin Admin causes the API to not work.
Installing the dll from the repo directly causes the plugin to notify you of an update to the previous version from Notepad++'s plugin repo.

To Reproduce
Steps to reproduce the behavior:

  1. Install plugin from Plugins Admin in Notepad++
  2. Update Plugin from Github repo (x64) - https://github.com/p0358/notepadpp-CodeStats/releases/tag/v1.1.0
  3. Replace DLL file
  4. Open Notepad++ after update, and you should get the message. As I get it on both computers.

Expected behavior
Close the Notepad++ window work without update message.

Screenshots
image

Desktop:

  • OS: Windows 10 - 21H2 (Latest)
  • Version 19044.2130

Additional context
Otherwise I am SUPER happy with the plugin and have just started on my Github and Programming journey.

Code::Stats plugin is hanging Notepad++

When I have the plugin active, Notepad++ hangs after some time. It's 100 % reproducible. It hangs after tens of minutes to an hour. I don't have more information, unfortunately. The plugin itself is working fine, it's successfully sending the stats to the Code::Stats API.

Notepad++ version: 7.5.6
Plugin version: 1.0.1

thanks

it's very useful,thanks to your.

BaanC is detected as plain text

My Programming Language is detected as plain text, but it should be BaanC.
Instead of trying to detect the language by file type, using the lexer (syntax highlighting) would be more accurate.

In case you use python script (that's a plug in) just type in the console:

editor.getLexerLanguage()
'baan'

It might be a good idea to make the conversion from the language the lexer gives in a file a user can change, as this would help small languages.

Save and restore pulses on shutdown

Currently pulses that weren't sent upon Notepad++ shutdown (either because not enough time passed or there's no internet connection) are logged into the log file and dropped.

It should be considered to save them into some JSON array and file in such situation, and then restore them and delete the file on next Notepad++ launch and delete the file so that not a single pulse is lost.

Maybe in another 5 years... :D

Errors popping as I type in files that have extensions that are not supported (eg. .*cmd, *.au3)

Installed the Code::Stats Plugin for Notepad++ a few hours ago, and run into a pretty serious issue; the kind of issue that will make me uninstall CodeStats ASAP.

What is the bug about:
As soon as I start typing in files which have an extension that is not registered I am getting error.

The bugfix should :

  • either allow registering other file extension,
  • or prevent the errors from popping up.

image

---------------------------
Error writing to log file
---------------------------
System.IO.IOException: The process cannot access the file 'C:\Users\Pino\AppData\Roaming\Notepad++\plugins\Config\CodeStats.log' because it is being used by another process.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)

   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

   at CodeStats.Logger.Setup()

   at CodeStats.Logger.Log(LogLevel level, String msg)
---------------------------
OK   
---------------------------

Followed by:

---------------------------
Error writing to log file
---------------------------
C:\Users\Pino\AppData\Roaming\Notepad++\plugins\Config\Code::Stats.log
---------------------------
OK   
---------------------------

Typical files which trigger the error are ".cmd" and ".au3".

Despite the fact the error says the log file could not be written, we can still see some output in there. (And the output seem up-to-date.)

[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 97, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 115, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 97, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 115, lang: AutoIt
[Code::Stats Debug 06:28:28 PM] No proxy will be used. It's either not set or badly formatted.
[Code::Stats Debug 06:28:28 PM] Pulsing {"xps":[{"language":"AutoIt","xp":16}],"coded_at":"2019-04-25T18:28:12+02:00"}

Or when editing a "*.cmd" command file

image

What those ".cmd" and ".au3" files seem to have in common is that they are not registered in the Plugin DLL, which, if you open it, contains the following static string :
(C:\Program Files\Notepad++\plugins\CodeStats\CodeStats.dll)

  "plaintext": "Plain text",
  "txt": "Plain text",
  "log": "Log",
  "bat": "Batch",
  "clojure": "Clojure",
  "coffeescript": "CoffeeScript",
  "coffee": "CoffeeScript",
  "c": "C",
  "cpp": "C++",
  "hpp": "C++",
  "csharp": "C#",
  "cs": "C#",
  "css": "CSS",
  "diff": "Diff",
  "dockerfile": "Docker",
  "elixir": "Elixir",
  "elm": "Elm",
  "fsharpcss": "F#",
  "git": "Git",
  "gitignore": "Ignore File (gitignore syntax)",
  "git-commit": "Git",
  "git-rebase": "Git",
  "go": "Go",
  "groovy": "Groovy",
  "handlebars": "Handlebars",
  "hlsl": "HLSL",
  "html": "HTML",
  "i18n": "Localization file",
  "ini": "Ini",
  "properties": "Properties",
  "conf": "Properties",
  "cfg": "Properties",
  "java": "Java",
  "javascriptreact": "JavaScript (React)",
  "javascript": "JavaScript",
  "js": "JavaScript",
  "jsx-tags": "JavaScript (JSX)",
  "json": "JSON",
  "less": "LESS",
  "lua": "Lua",
  "makefile": "Makefile",
  "markdown": "Markdown",
  "md": "Markdown",
  "nut": "Squirrel",
  "objective-c": "Objective-C",
  "perl": "Perl",
  "perl6": "Perl 6",
  "php": "PHP",
  "powershell": "PowerShell",
  "jade": "Pug",
  "python": "Python",
  "py": "python",
  "r": "R",
  "razor": "Razor",
  "raml": "RAML",
  "ruby": "Ruby",
  "rust": "Rust",
  "scss": "SCSS",
  "shaderlab": "Shaderlab",
  "shellscript": "Shell Script",
  "sql": "SQL",
  "swift": "Swift",
  "typescript": "TypeScript",
  "typescriptreact": "TypeScript (React)",
  "vb": "Visual Basic",
  "xml": "XML",
  "xsl": "XSL",
  "yaml": "YAML"

I don't think the log file is used by another process. The only thing that is specific with my setup is that my directory "%AppData%\Roaming\Notepad++\plugins\Config" is actually a hardlink to another location (a Dropbox directory), and for some reason this is maybe making harder for the plugin to write in it, which then causes the exception and finally makes Notepad++ display error message dialogs as I type.

Also, note that I don't have this problem if I write in more common files, such as a .txt or a .cs, so it's a cascading effect, ie. there are 2 problems here : 1/ log file being filled with the "Key = "EXT" is not found." and 2/ actually sometimes failing to write there and causing the errors to pop and interrupt editing ever couple of keystrokes.

Failed to create SSL/TLS channel.

I have used this plugin for several months. But one day I found that my Code::Stats xp was not growing any more:

Last programmed Sep 10, 2019.

And here's part of the log file. The following Chinese has a similar meaning with the sentence
Request aborted: failed to create SSL / TLS secure channel.

[Code::Stats Debug 05:33:43 下午] No proxy will be used. It's either not set or badly formatted.
[Code::Stats Debug 05:33:43 下午] Pulsing {"xps":[{"language":"Log","xp":1}],"coded_at":"2019-11-06T17:32:07+08:00"}
[Code::Stats HandledException 05:33:44 下午] Could not pulse. Are you behind a proxy? Try setting a proxy in Code::Stats settings with format https://user:pass@host:port. Exception Traceback:: System.Net.WebException: 请求被中止: 未能创建 SSL/TLS 安全通道。
在 System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request)
在 System.Net.WebClient.UploadString(Uri address, String method, String data)
在 System.Net.WebClient.UploadString(String address, String data)
在 CodeStats.CodeStatsPackage.ProcessPulses()

I tried changing API URL's protocol from https to http but nothing changed. If I checked the usage reporting option, I would also get a warning "cannot connect to remote server". I'm able to access https://codestats.net/api/my/pulses directly using my Chrome.

Using v1.0.1. & Notepad++ v7.7.1 (32-bit)

Language detection improvements

  • Add custom local extension mapping file, allowing user to override values in built-in extension mapping file
  • Fix lexer language detection (#11)
  • Add custom user-defined lexer languages support (toolbar -> Langauge -> Define your language...)
  • Allow user to select priority options for detecting language (TBD how)

Add small built-in auto-updater

Since Notepad++ now hardcodes plugin list, it is not possible to push update to Plugin Admin without waiting for the next Notepad++ release.

Planned functionality:

  • Check a JSON file in repo for latest version information
  • If new version was detected, ask user if they want to attempt automatic update
  • Download latest zip update file to temp folder and verify its contents with RSA signature and public key (throw error if verification fails obviously)
  • Check if we can write to plugins directory, if not, start separate updater process as admin
  • Rename currently running plugin DLL to something else (that's Windows feature!) [if this fails, I guess it will have to ask user to close Notepad++)
  • Extract update zip to plugin directory (support both new and old plugin directory structures)
  • Notify user that update was successful, and new plugin version will be loaded on next Notepad++ launch
  • On next Notepad++ (and plugin) startup, plugin will delete old plugin versions waiting for deletion

Thoughts on this are welcome.

Basically it will be pretty similiar to WinGUP functionality, but differences are that it will rename running executable, and verify update using RSA signature and not just a checksum, so no forged updates will be accepted. (however Notepad++ is not really less secure here, since its list is in signed DLL that's verified before being loaded as well)

So can you PLEASE rebuild it!

In #20 @p0358 said:

But it would be best to get a new release to fix this.

Hopefully I can release something finally this week. It would be an update that would fix numerous issues...

So can you please do that! I also have the issue from #20 and I don't know how to fix it (if I can fix it)

Missing nullpointer check

@p0358 Happens at:

>	CodeStats.dll!CodeStats.CodeStatsPackage.ProcessPulses() Zeile 320	C#	Symbole wurden geladen.
 	CodeStats.dll!CodeStats.CodeStatsPackage.PluginCleanUp() Zeile 692	C#	Symbole wurden geladen.
 	CodeStats.dll!CodeStats.UnmanagedExports.beNotified(System.IntPtr notifyCode) Zeile 58	C#	Symbole wurden geladen.

Ausnahme ausgelöst: "System.NullReferenceException" in CodeStats.dll
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

with:

		currentPulse	null	CodeStats.Pulse
+		pulseQueue	Count = 0	System.Collections.Concurrent.ConcurrentQueue<CodeStats.Pulse>
		pulseQueue.IsEmpty	true	bool

Also happening for x64. Startup N++, wait for the popup of CodeStats requesting the API key and close N++ without closing the popup.

-> missing nullpointer check at:

https://github.com/p0358/notepadpp-CodeStats/blob/master/CodeStats/CodeStatsPackage.cs#L320

for currentPulse

Notepad++ freezes when file is synced by pCloud

If the Code::Stats plugin is installed, notepad++ will freeze after you edit and save a file in a directory that is synchronized by the pCloud desktop app. The freeze happens in the exact moment when pCloud starts syncing. This seems to only happen with pCloud, no other cloud provider i've tested.

The freeze itself is not a real freeze, as all buttons in notepad++ flicker rapidly when you hover over them, but you cannot interact with notepad++ anymore and have to close it via the task manager.

CSV File missing from extension_mapping.json

When trying to do a text replace in a large CSV, the log file is flooded with lines like this, one for each time a replacement happens:

[Code::Stats Info 09:58:26 AM] Key = "csv" is not found.
[Code::Stats Info 09:58:26 AM] Key = "csv" is not found.
[Code::Stats Info 09:58:26 AM] Key = "csv" is not found.
[Code::Stats Info 09:58:26 AM] Key = "csv" is not found.

Can csv be added to the extension_mapping.json?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.