I have configured Aptana Studio 3 to use JSLint for validation. At least some of the JSLint options don't seem to work correctly, however. For example, the code below produces errors on the line f = function() { -- because of the missing space after function -- and on the line j = i++; -- because of the use of ++. Both of these errors should have been suppressed by the options. If I run this same code through the jslint.org site, I get no errors. If I reverse the options (put false in place of true) the errors go away in Aptana but now jslint.org shows errors. So it appears the options are backwards. In addition, in Aptana the absence of use strict is not flagged as an error, regardless of the "sloppy" option.
/*jslint white:true, plusplus:true*/
var f;
f = function() {
var i, j;
j = i++;
};
I've created a bug report with Aptana on this issue.
http://jira.appcelerator.org/browse/APSTUD-4129
Related
So I’m trying to make a development environment that’s easily reproducible (staying away from home-manager currently to understand Nix better). After enough searching around I figured out how to make a few custom derivations, use buildEnv for package sets, and use ~/.config/nixpkgs/config.nix to do overrides. I’m working now to setup zsh and oh-my-zsh which have a ton of configuration options, but the only documentation I can find seems to suggest adding them to configuration.nix, which is a NixOS option I can’t use.
Currently my config.nix code looks something like this:
let
pkgs = import <nixpkgs> {};
in {
allowUnfree = true;
programs = {
zsh = {
enable = true;
promptInit = "source ${pkgs.zsh-powerlevel9k}/share/zsh-powerlevel9k/powerlevel9k.zsh-theme";
ohMyZsh = {
enable = true;
plugins = ["autojump"];
theme = "powerlevel9k/powerlevel9k";
};
};
};
packageOverrides = pkgs: with pkgs; rec {
all = buildEnv {
name = "all";
paths = with pkgs; [
tmuxinator
zsh
oh-my-zsh
autojump
...
];
};
};
}
My understanding so far is that within ~/.config/nixpkgs/config.nix, there should be a single config set which contains things like the overrides function and corresponds to documentation examples of config.programs.zsh.enable, etc. However, nothing I write in that programs section affects or causes a different ouput of any of my programs.
What am I missing? How can I affect the configuration options listed here (https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/zsh/zsh.nix)?
You seem to be trying to use home-manager's config without using home-manager itself. As you can see in the NixOS module you linked, this actually sets up /etc/zshrc etc, so it's not intended for use in a user-local config and won't do anything there. If you look at the corresponding home-manager module, you'll see that it basically reimplements the whole module for user-local purposes. So you won't get far with this approach without relying on home-manager.
I am building an IPython cell magic to support interactive SQL queries and want the syntax highlighting of that cell to change from Python to SQL. What is the best way to achieve this?
Imagine an input cell of the following:
%%sqlite example.db
SELECT id,name FROM Users;
Currently, the query is parsed as Python code, with messy results.
In particular, is the language parameter of the Notebook format supported? None of the cell magics supported by the official documentation (R, Ruby, Octave, ..) seem to bother changing it from "python".
I'm running Jupyter 4 (4.2.0, to be exact), and putting the following code in ~/.jupyter/custom/custom.js works very well for me.
IPython.notebook.events.one('kernel_ready.Kernel',
function(){
IPython.CodeCell.config_defaults
.highlight_modes['magic_text/x-mssql'] = {'reg':[/^%%sql/]} ;
IPython.notebook.get_cells().map(
function(cell){
if (cell.cell_type == 'code'){
cell.auto_highlight();
}
}) ;
}) ;
Update
Newer versions of the notebook (I'm now using 5.2.2) use a slightly different key for configuration,
codecell.CodeCell.options_default.highlight_modes.
The code I'm currently using (still in custom.js) looks like this:
require(['notebook/js/codecell'],
function(codecell) {
codecell.CodeCell.options_default
.highlight_modes['magic_text/x-mssql'] = {'reg':[/^%%sql/]} ;
Jupyter.notebook.events.one('kernel_ready.Kernel',
function(){
Jupyter.notebook.get_cells().map(
function(cell){
if (cell.cell_type == 'code'){
cell.auto_highlight();
}
}) ;
});
});
found this
import IPython
js = "IPython.CodeCell.config_defaults.highlight_modes['magic_sql'] = {'reg':[/^%%sql/]};"
IPython.core.display.display_javascript(js, raw=True)
worked for me.
This is clear (IMO) and valid javascript:
do var playerId = newPlayerId();
while(playerId in players);
JSHint complains that it expected a { before playerId. Is there any way to disable this warning, without disabling all curly-brace related warnings? My style is cool, right? No ambiguities or obscurities?
For some reason, this does not appear to be possible. It is possible with other similar statements (such as if and while) by setting the curly option to false:
/*jshint curly: false */
var x = 10;
if (x < 20)
x = 30;
I see no reason why this rule should not apply to the do statement, so I've opened a pull request to add this functionality to JSHint.
Javascript in a web application runs the following loop:
for (var name in this) {
if(typeof(this[name]) == "function") {
if((/^on_|^do_/).test(name)) {
console.debug("Adding ", name, " to ", this, "(", this[name], ")");
f = this[name].bind;
console.debug(f);
this[name] = this[name].bind(this);
}
}
}
Under Chrome 24.0.1312.56, the line f = this[name].bind correctly sets f to the native code function.bind(), while in my QWebKit Qt application it sets f to 'undefined'.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
Any idea how I'd be able to convince QtWebkit to behave correctly here?
Apparently, Function.prototype.bind is part of ECMAScript 5. It's implementation in webkit should be covered by (fixed bug): https://bugs.webkit.org/show_bug.cgi?id=26382
Perhaps there is a mode to enable ECMAScript 5 that i'm missing?
Apparently i'm using version 534.34 for QtWebkit:
(Pdb) str(QtWebKit.qWebKitVersion())
'534.34'
Which according to this:
https://trac.webkit.org/changeset/85696/trunk/Source/WebKit/mac/Configurations/Version.xcconfig
Corresponds to revision 85696. Combined with the comment in the above bug ("Fixed in r95751"), seems like I need a newer version, specifically anything better than 535.5. Now to find what version of PyQt uses that...
Thanks.
It seems that the latest version of PyQt (4.9.6-1) is compiled against wekbit version 534.34.
The first release of webkit that supports Function.prototype.bind is 535.5.
In addition, it seems that both PySite 1.2.2 and PyQt 4.9.6-1 report webkit version 535.34, and do not have Function.prototype.bind.
Try using the following code which forces you to use Function.prototype.bind
this[name] = Function.prototype.bind.call(this[name], this)
In IE, some of the host objects don't have a bind method on their methods (functions)... could be something related.
Unable to get ll = -15 even when the Flex builder console show correct result. Which part could I go wrong?
//b-a = (3) && c-a = (6)
if((naArray[i+1]-naArray[i])<=3 && (naArray[i+2]-naArray[i])==6) {
ll=-15;
}
Not an answer as such, but wanted to put in the screenshot.
I ran this piece of code in as3term, and it worked ok (replaced the arrays with the variables you commented a, b and c). You should do the same with those arrays and step through in debug mode.