Permalink
Browse files

Readme + 1 bug

  • Loading branch information...
1 parent dc6080f commit 01ff8579a5a518711eca7e258f2cf0b007cc2089 @Silviu-Marian committed Jun 29, 2012
Showing with 308 additions and 24 deletions.
  1. +22 −0 .gitattributes
  2. +163 −0 .gitignore
  3. +100 −2 README.md
  4. +15 −16 debugger.js
  5. +8 −6 scripts/sse.js
View
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
View
@@ -0,0 +1,163 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
View
102 README.md
@@ -1,4 +1,102 @@
<h1>NodeJS Console Object Debug Inspector </h1>
-<p>node-codein</p>
+<p>Or simply node-codein (longtail for SEO) is supposed to do what Webkit Inspector's Console does. Except this works exclusively with NodeJS.</p>
+<h2>Screenshot</h2>
-<img src="https://github.com/ketamynx/node-codein/raw/master/images/screenshot.png" alt="NodeJS Console Object Debug Inspector" />
+<img src="https://github.com/ketamynx/node-codein/raw/master/images/screenshot.png" alt="NodeJS Console Object Debug Inspector" />
+
+<h2>License &amp; disclaimer</h2>
+<p><b>License:</b> <a href="http://www.youtube.com/watch?v=8yR7LZxp-IU">http://www.youtube.com/watch?v=8yR7LZxp-IU</a><br />
+ <b>Disclaimer:</b> Said tool is only intended for dicking around, and is thus unsuitable for enterprise-level operations; this program should not be used for reliable remote instrumentation or monitoring, or as a replacement for NodeJS's console system. This program cannot guide missiles out of North Korea.</p>
+<h2>Minimum requirements</h2>
+<p>NodeJS v0.8.0+, Chrome 19.xx.xxxx.xx+, Win XP+</p>
+<h2>Instructions</h2>
+<ol>
+ <li>Download the package, put it somewhere you can find it</li>
+ <li>In your script add require(&quot;path/to/folder/node-codein&quot;)</li>
+ <li>Run nodejs</li>
+ <li>Start <b>%localappdata%/Google/Chrome/Application/chrome.exe --app=http://localhost:55281</b></li>
+
+ <li>Make sure you only use Chrome. It might works on something else but going straight with Chrome will save you time.</li>
+</ol>
+
+
+<h2>Main features</h2>
+
+<ul>
+ <li>Displays objects in tree format, with expand/collapse controls</li>
+ <li>Executes arbitrary code</li>
+ <li>Wraps the common logging functions: console.log(), console.info(), console.warn() &amp; console.error()</li>
+ <li>Wraps unhandled exceptions via process.on('uncaughtException', ...)</li>
+ <li>Broadcasts messages to all connected clients</li>
+ <li>Reconnects automatically</li>
+</ul>
+<h2>Visible and hidden features</h2>
+
+<ul>
+ <li><b>Top buttons:</b> <ul>
+ <li>enable iScroll (click-drag to scroll/pan)
+ <li>theme switcher (dark seems to attract the ladies lol :D)
+ <li>YAND.info (Node's API docs)
+ <li>Node's twitter
+ </ul>
+ </li>
+ <li><b>Middle thin bar: </b>
+ <ul>
+ <li>drag to resize</li>
+ <li>double click to hide input area</li>
+ </ul>
+ </li>
+ <li><b>Bottom row - left: </b>
+ <ul>
+ <li>hide/show input area</li>
+ <li>clear all messages</li>
+ <li> automatically expand objects (just first level)</li>
+ <li> structure object levels + row highlighter</li>
+ <li> input preservation (for spammers)</li>
+ </ul>
+ </li>
+ <li><b>Bottom row - right: </b>
+ <ul>
+ <li>expand + collapse every single visible object</li>
+ <li> reload (alias for F5)</li>
+ <li> duplicate window (opens all the messages in it; uses $.clone() so some controls might be inherited from the parent window)</li>
+ </ul>
+ </li>
+ <li><b>Not-so-obvious features:</b>
+ <ul>
+ <li>saves last 50 command in local storage, use arrow keys to navigate through previous commands</li>
+ <li>typing suggestions and autocomplete</li>
+ <li>double-click a property name in the message window to insert it</li>
+ <li>shit+enter for new lines </li>
+ <li>tab key indents</li>
+ </ul>
+ </li>
+</ul>
+
+<h2>Known bugs</h2>
+<p>Lots of them. Because I had to took a day off from work to build this, so there's was no time to organize nor bughunt.</p>
+
+<ul>
+ <li>Console log may not pass through every now and again or so. I planned on using EventSource but it wasn't working (maybe buffering instead of flushing, I don't know, can't WireShark locally). So what it does is it keeps connections in a waiting state and when it gets something, it writes and closes those connections. Then clients are supposed to connect back. </li>
+ <li>Autocomplete spams your server. Lag is in place and can be tweaked but it'll basically chop-off words when you hit enter.</li>
+ <li>iScroll + expand all + ctrl+f to find properties will lock the whole browser; not sure why, don't care much, just disable iScroll if you're using this tecnhique to find properties.</li>
+ <li>Autocomplete may not appear after using left / right arrow keys or escape. This is intentional, those 3 keys are GTFO master keys, but if you want the list of suggestions back, type some gibberish and press backspace.</li>
+ <li>The whole source code is haywired.</li>
+</ul>
+
+<h2>FAQ</h2>
+<ul><li><b>What's wrong about the regular console?</b><br />
+ Its overall buffer size, no syntax coloring, hard to use, no direct input, so forth. If you're familar to webkit's &quot;Inspect Element&quot; console tab, you'll see the differences.</li>
+ <li><b>Then what's wrong with Eclipse's V8 Debugger?</b><br />
+ A debugger is something totally different. Well not really but you still need to set breakpoints, stop executions, scope variables, etc. Plus you have to restart Node to put code in. I can make more excuses if necessary. </li>
+ <li><b>Why not just fix node-inspector?</b><br />
+ I tried. I first tried to pass back stringified objects and decode them in the local console. The problem was that there was a hardcoded limit of 80 characters beyond which the string turned into &quot;str... (length: 2219)&quot;. I'm not sure where this came from but I believe it was built into v8 when it was compiled with Node. I also tried fixing the 0:0:0 (context:scope:handle) but it seemed to pass back blank values no matter what. I didn't had time for that.</li>
+ <li><b>Can you help me do X / can you add X / can you fix X?</b><br />
+ I'll do everything that doesn't take more than 5 minutes to do. I'm really in a time crisis, but even if I wasn't, I'm highly capitalistic about all my work. </li>
+</ul>
+
+<hr />
+<p>Fork, pull, push, drag, chop, send, fax whatever you want you're free to do it.<br />
+ Good luck buddy.
+</p>
+<p>- ketamynx </p>
View
@@ -45,10 +45,21 @@ var dbg = {
if(!dbg.cons.length) return dbg.pendingBroadcast = setTimeout(function(){ sendFn(); },dbg.broadcastLag);
var data = jsencr(dbg.queued);
- dbg.queued = [];
- for(var i=0; i<dbg.cons.length; i++)(function(c){
- process.nextTick(function(){ c.end(data); });
- }(dbg.cons[i]));
+ dbg.queued = [];
+ for(var i=0; i<dbg.cons.length; i++){
+ dbg.cons[i].writeHead(200,{
+ 'Content-type':dbg.mimes['txt'],
+ 'Content-length' : data.length,
+ 'Cache-control':'no-cache'
+ });
+
+ dbg.cons[i].write(data);
+ dbg.cons[i].end("\r\n");
+ dbg.cons[i] = null;
+ dbg.cons.splice(i,1);
+ i--;
+ console.__log(i);
+ }
};
dbg.pendingBroadcast = setTimeout(function(){ sendFn(); },dbg.broadcastLag);
@@ -102,19 +113,7 @@ var dbg = {
break;
case 'sse':
-
var thiscon = dbg.cons.push(s);
- q.on('end', function(){ process.nextTick(function(){
- s.writeHead(200,{
- 'Content-type':'text/event-stream',
- 'Connection':'keep-alive',
- 'Cache-Control': 'no-cache'
- });
- }); });
-
- q.on('close', function(){ dbg.cons.splice(thiscon,1);});
- s.socket.setTimeout(0);
-
break;
default:
View
@@ -3,9 +3,9 @@ $(document).ready(function(){
var constat = $('.constat');
var conmsg = constat.find('.msg');
var conic = constat.find('.eicon');
- var toReconnectOnFail = 3000;
+ var toReconnectOnFail = 2000;
var toReconnectOnSSE = 60;
- var toLoggingInterval = 1000;
+ var toLoggingInterval = 500;
var showOnline = function(state){
if(!!state) {
@@ -21,13 +21,13 @@ $(document).ready(function(){
var rq = {};
var reconnect = function(){
- rq = $.ajax({url:'sse', type:"GET", dataType:'text', timeout:0, complete:function(r){
- if(Number(r.status)!==200){
+ rq = $.ajax({url:'sse?x='+(new Date().getTime()),type:"GET", dataType:'text', timeout:0, complete:function(r){
+
+ if(Number(r.status)!==200){
showOnline(false);
return setTimeout(function(){ reconnect(); }, toReconnectOnFail)
- };
+ }
- setTimeout(function(){ reconnect(); }, toReconnectOnSSE);
try{ var q = JSON.parse(r.responseText); }
catch(e){ var q = []};
@@ -46,6 +46,8 @@ $(document).ready(function(){
break;
};
}(q[j]));
+
+ setTimeout(function(){ reconnect(); }, toReconnectOnSSE);
}});
};

0 comments on commit 01ff857

Please sign in to comment.