w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Incorrect path for generated coffee sourcemaps when serving with nodejs
This appears to actually be a bug in the CoffeeScript Grunt task. See: https://github.com/gruntjs/grunt-contrib-coffee/blob/master/tasks/coffee.js#L87 options = _.extend({ generatedFile: path.basename(paths.dest), sourceRoot: mapOptions.sourceRoot, sourceFiles: mapOptions.sourceFiles }, options); Here, if the options object has a "sourceRoot" element, it will override the generated sourceRoot which is created by this function: https://github.com/gruntjs/grunt-contrib-coffee/blob/master/tasks/coffee.js#L130 var createOptionsForFile = function (file, paths) { return { code: grunt.file.read(file), sourceFiles: [path.basename(file)], sourceRoot: appendTrailingSlash(path.relative(paths.destDir, path.dirname(file))) }; }; Which uses the relative path from

Categories : Node Js

webstorm: typescript bool vs. boolean
Webstorm language service currently only works with 0.8.x, The typescript language service inside WebStrom does not understand the changes made in 0.9.x, and since the TypeScript language service api changed (for the better imho) from 0.8 to 0.9 its not a drop in replacement. A new version of WebStorm with these features is on the way though (should be soon).

Categories : Javascript

webstorm typescript display compile error
Based on Meta Discussion Update (25/8/2013) This issue has been fixed in typescript 0.9.1 Update (7/8/2013) Looks like this issue is already on the radar, please vote for it to make it a BIG blip.

Categories : Typescript

Webstorm: how to exclude javascript from code completion in typescript project
Right click on the folder that contains your compiled javascript and select "Mark Directory As" then "Excluded". WebStorm will hide the directory from the project view, stop indexing it for searches and code completion, and not include it in code refactoring tracing. I tend to mark all build output as ignored and ensure that WebStorm is only worrying itself with the source.

Categories : Typescript

webstorm + typescript "unresolved variable" after adding reference path
Modify it to "export interface IBaseClass" and on the other side you need to require it. At runtime you might get an error loading a js file not there. If so make an empty js file. My recommendation : do not have a file just with interfaces when using requirejs/commonjs

Categories : Typescript

Closure Compiler annotations in WebStorm 6, how to use Record Types?
The first example the annotation is incorrectly applying to socket.on, not to the callback function. In addition, the annotation is formatted incorrectly. An @param tag describes exactly one parameter and it's type. You are attempting to describe two. Also, record types only need one set of braces surrounding them. Here's one way that might look: /** * @param {string} eventName, * @param {function({ pageId: string })} callback */ socket.on = function(eventName, callback) {}; socket.on('page:getSource', function (data) { //data = { pageId: id } console.log(data.pageId) }); Your second example seems correct - but since the socket.on definition wasn't provided I can't verify. Here's a similar test case that does work: // ==ClosureCompiler== // @compilation_level ADVANCED_OPTI

Categories : Javascript

Typescript - isn't this a compiler bug?
No. It should not be a compiler bug. You should be free to declare any signature you feel suitable for your class as long as it the type is compatible. e.g. void (as in your example) or any as in below example : class Base { constructor (public name) { } SomeMethod(param:number) { console.log(this.name + " " + " called with param:" + param); } } class Derived1 extends Base { constructor(name) { super(name); } SomeMethod(param:any) { // is compatible console.log("Derived1"); super.SomeMethod(parseInt(param,10)); } } works. However string would give a compiler error: class Base { constructor (public name) { } SomeMethod(param:number) { console.log(this.name + " " + " called with param:" + param); } } class Derived1 e

Categories : Typescript

Too many TypeScript compiler instances
i had created a _reference.ts file in root and referred all my ts files over there,something like this /// <reference path="app/logic/init/init.ts" /> /// <reference path="app/logic/controllers/profilecontoller.ts" /> /// <reference path="app/logic/directives/directives.ts" /> /// <reference path="app/logic/enums/enums.ts" /> /// <reference path="app/logic/init/bootstrap.ts" />

Categories : Typescript

Errors trying to compile TypeScript compiler
I got it working. I was getting errors because I was at the master branch which is broken. My steps: Clone git clone https://git01.codeplex.com/typescript Switch to develop branch git checkout -b develop origin/develop Installed node.js Installed Jake (npm install -g jake) Compile (jake local on project's root folder) I replaced the new compiled files on the compiler folder C:Program Files (x86)Microsoft SDKsTypeScript And ran tsc test.ts, and it worked. Note: The develop branch compiles, but it is definitely not stable, beware.

Categories : Typescript

How to obtain TSC (TypeScript Compiler) w/o Node.js
You can download it here: http://www.microsoft.com/en-us/download/details.aspx?id=34790 That's both the typescript compiler and a plugin for VS2012

Categories : Typescript

Typescript 0.9 + Knockout: strange compiler errors
I was having this same issue. I haven't investigated why this is happening, but in my project after commenting out the last interface in knockout.validation.d.ts the errors go away. This will break your call to isValid for validation though. interface KnockoutSubscribableFunctions { isValid: KnockoutComputed<boolean>; isValidating: KnockoutObservable<boolean>; rules: KnockoutObservableArray<KnockoutValidationRule>; } I added the following to get back the isValid function interface KnockoutObservableBase { isValid: KnockoutComputed<boolean>; isValidating: KnockoutObservable<boolean>; rules: KnockoutObservableArray<KnockoutValidationRule>; }

Categories : Visual Studio 2012

Output "build complete" when TypeScript compiler is done?
I accomplished this by putting this on line 24819 of tsc.js: _this.compile(); _this.ioHost.printLine("Build Complete (" + new Date() + "): "); I found this by looking for the string "Recompiling" in the source. I was hoping to find a switch or option that could accomplish this, but this works for now. This is inside the onWatchedFileChange function so presumably you will only get the notification on the 2nd and subsequent builds, not on the first build.

Categories : Typescript

New version of __extends generated by TypeScript compiler
It now respects static properties on classes as well. The key statment is: for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; which will copy the parent class static members to child classes. e.g.: class Foo{ static x = "asdf"; } class Bar extends Foo{ } alert(Bar.x); Try it The original (now closed) bug report : http://typescript.codeplex.com/workitem/825

Categories : Typescript

Setting Typescript --module compiler option in WebEssentials?
Tools - options - webessentials - typescript - module : amd Having said that I rely on grunt to do my compilation : https://github.com/basarat/grunt-ts

Categories : Visual Studio 2012

Custom TypeScript definitions file not picked up by compiler?
Your definition looked okay to me, so I grabbed the jQuery.d.ts from Definitely Typed and added your code to scrollable.d.ts and it all worked fine... as long as I referenced your definitions... /// <reference path="scrollable.d.ts" /> $('#id').scrollable({ vertical: true }); This made me think that maybe you hadn't referenced your definition file (I called it scrollable.d.ts, but you might have called it jquery.scrollable.d.ts or something like that).

Categories : Typescript

Typescript compiler error. The name 'boolean' does not exist in the current scope
You should try this version : https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts Also try doing an uninstall / install of typescript. npm uninstall typescript npm uninstall -g typescript npm install typescript Also before doing that I am curious what tsc -version shows you. Did it change after the above steps?

Categories : Jquery

lack of compiler warning with incorrect brace initializer
Clang++ has the same behavior. You are passing the value of c0 when it is uninitialized into the default copy constructor without receiving an "uninitialized when used here" warning. (Write a private copy constructor to confirm.) I think what is happening is direct-list-initialization. I don't know if a diagnostic is required by the standard, but it's worth filing a bug report about.

Categories : C++

c++ application cannot find com dll because compiler generating .tlh file with incorrect guids
No you do not have to register the COM DLL but you do need to register an object responsible for creating the COM objects. Use do this in your application by calling CoRegisterClassObject after the COM subsystem has been initialized (by calling CoInitialize or CoInitializeEx). IClassFactory *factory = new ObjectFactory(); // Register the factory responsible for creating our COM objects DWORD classToken; HRESULT hr = CoRegisterClassObject( Object_CLSIID, factory, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &classToken); // Now we can create the objects Object *obj = nullptr; hr = CoCreateInstance( Object_CLSIID, nullptr, CLSCTX_LOCAL_SERVER, Object_IID, reinterpret_cast<void**>(&obj)); Not sure why it's creating a temporary .tlh but I

Categories : C++

Can I compile a .js file with the TypeScript compiler without renaming it to a .ts file?
It's such a common user error (one letter off) with such annoying consequences (pages full of errors) that the compiler won't do it. You could remove the check from the source code pretty easily, though -- just change the implementation of isTSFile

Categories : Typescript

Sass sourcemaps in Chrome not working. Flummoxed
Are you loading your page from the file:// URL? That won't work for security reasons - use any http server on localhost. Also, updating your Canary is a good idea; CSS source maps have graduated from the experiments. You should check "Enable CSS source maps" in the General settings.

Categories : Google Chrome

Add a TypeScript file to a non-TypeScript project in Visual Studio 2012?
My experience has been that I can add .ts files and .d.ts files to web c# projects and they compile. I have not found 'add typescript' file on the add context menu but I have found you can add a text file .ts or .d.ts and it is recognised. You may have to amend the compile action to 'TypescriptCompile'. Apart from that and some debugging funnies I have found TypeScript to be one of the cleverest things around...awesome in fact

Categories : Typescript

Error message in typescript saying that function parameters don't match @TypeScript 0.9.1
When you want to use the lexically escaped value of this (which refers to the class) as well we as the context value of this (e.g the this inside a jquery callback which refers to the element that raised the event etc). You cannot use fat arrow / lambdas ()=>{}. You use function, and store this for the class variable yourself. However in your code I see that you only want to use this which refers to the class so a lambda ()=>{} is sufficient for your case. Your code compiles fine: Check it online.

Categories : Javascript

D3, Typescript, and GraphNodes (Optional fields in a typescript interface)
All of them are not required but perhaps some are and the interface definition does not reflect that as of yet. Perhaps you can mark which ones are optional for community support. In any case. When you want to enforce strict behavior on others but want the flexibility to break out your self you can use any. e.g. : var data:GraphData = <any>{ "nodes": [{ "group": 0, "id": 0 }, { "group": 0, "id": 1 }, { "group": 0, "id": 2 }], "links": [{ "source": 0, "target": 2, "value": 1 }, { "source": 0, "target": 0, "value": 1 }, { "source": 2, "target": 1, "value": 1 }, { "source": 2, "target": 1, "value": 1 }] }

Categories : Javascript

i am facing problems while running a code on GNU GCC compiler while it's working fine on VC++ compiler
You are not allocating enough memory: mat=(char**)malloc(row*sizeof(char)); label=(char**)malloc(row*sizeof(char)); Each item in the arrays is a pointer to char (char*), so you should multiply by sizeof(char*): mat=(char**)malloc(row*sizeof(char*)); label=(char**)malloc(row*sizeof(char*));

Categories : C

C++ compiler error: passing pointers but compiler sees references
In your second signature, the type of the second formal parameter, var, is const double**. The actual argument, constr, is, hovewer of type double** which cannot be implicitly converted to the former type. Example #include <stdio.h> void fn(const int** pp) { printf("%p : %p : %d", pp, *pp, **pp); } int main() { int n = 1; int *p = &n; fn(&p); // ERROR. see below return 0; } The error reported is accurate: main.c:17:8: Passing 'int **' to parameter of type 'const int **' discards qualifiers in nested pointer types.

Categories : C++

What makes a typescript module, a typescript module? Toastr example
the following declare definition would create a module you can import via amd/commonjs: declare module "jquery"{ export var jQuery: JQueryStatic; } Then you can do: import jquery = require("jquery"); You can see such definitions in this underscore definition: https://github.com/borisyankov/DefinitelyTyped/blob/master/underscore/underscore.d.ts#L2853 or node.d.ts : https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts#L203 However not all files on DT have this definition. As it is simple enough to add on your own and you are free to name these modules whatever you want (in your AMD configuration http://www.youtube.com/watch?v=4AGQpv0MKsA )

Categories : Node Js

fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1794)
I figured out what caused that error. One of the include paths (passed to a compiler with the /I switch) had a trailing backslash. The compiler cmdline is: CPP /nologo /MT /W3 /GX /Zi /Od /I "$(ZLIB_PATH)" /I "..headers" and ZLIB_PATH had a trailing backshlash. Removing that backslash solved the problem.

Categories : C++

Switched to Code Blocks from c++ with updated gcc compiler which causes errors in my source code that compiled fine with the old gcc compiler v3
Do it this way SendMessage(hwnd_SSMAIN_PARENTCONTAINER_RTFCONTROL,WM_SETTEXT,(WPARAM)0, (LPARAM)webfilebuffer.str().c_str()); This code converts a char* to an LPARAM, which should be legal. You will have to change the code that receives the message too. Post that code if you need help with that.

Categories : C++

Default Values C++11, compiler to compiler
In all versions of C++, all the variables in your question will be zero-initialized (statically) if they're declared at namespace scope. In all other cases, they will have garbage values if left uninitialized. Note that a garbage value is anything which is at the memory location where the variable is defined — it is just a pattern of 0s and 1s. Such values shouldn't be read by your program, else your code will invoke undefined behaviour. In C++11, if you write these as local variables (or namespace variables): bool foolean {}; int fintoo {}; double fooble {}; char charafoo {}; They're default-initialized which means zero in this case (as they are built-types).

Categories : C++

cannot open file '%f' webstorm
This is something I have no idea why it was showing that message. But upon research,, I found in the menu properties there is the extra "%f" at the end. Remove that, voila. It works with no annoying error.

Categories : Misc

How to run build.dart in WebStorm?
OK, thanks to LazyOne's hint I was able to dig a bit deeper. The solution to this is to create a File Watcher in WebStorm with the following options: Scope: Project Files Program: [your path to]dart-sdkindart.exe Arguments: build.dart Working Directory: $ProjectFileDir$ This will run the build.dart every time a file in your project changes, pretty much exactly like the Dart Editor.

Categories : Dart

WebStorm - Node.JS project
it's not currently supported - please vote for WEB-1173 and WEB-8333

Categories : Debugging

Grunt debugging from Webstorm
You have to run grunt-cli as a Node application: Create a new Node.js Run/Debug configuration: Run->Edit configurations... In Path to Node choose your node binary, ie: /Users/someuser/nvm/v0.10.5/bin/node In Working Directory, choose your Gruntfile.js directory, ie /Projects/someproject In Path to Node App JS File, choose your Grunt CLI path (you can choose the grunt-cli symlink created on your node bin directory, WebStorm will use the symlink target), ie: /Users/someuser/nvm/v0.10.5/lib/node_modules/grunt-cli/bin/grunt (C:UserssomeuserAppDataRoaming pm ode_modulesgrunt-cliingrunt on Windows 7) In Application parameters enter the Grunt task to run, ie test Click on Run or Debug and you are done :)

Categories : Node Js

Setup Jade With webstorm on MAC
The EISDIR error is caused when a Node application expects a file, but gets a directory. This particular instance of that error was thrown by this block of code: fs.writeFile(path, output, function(err){ if (err) throw err; console.log(' 33[90mrendered 33[36m%s33[0m', path); }); You can tell because it's not error number 156, but the line number of the relevant code. Do you, by any chance have a directory named main.html in /Applications/MAMP/htdocs/HTMLCodes/Sports/public_html? Also, you should be able to just execute the command, jade main.jade without the second argument. That would seem to make your life easier. Though if your dead set on using Webstorm on a Mac, this configuration should work equally well, or to keep it really simple, just put $File

Categories : Osx

How to set up instant code completion in WebStorm 7 EAP?
It can just be slow. If explicit Ctrl+Space is as slow, I'd suggest you to file a performance problem request to http://youtrack.jetbrains.com/ with a CPU snapshot attached (http://devnet.jetbrains.com/docs/DOC-1253).

Categories : Intellij Idea

Multi-select Jetbrains Webstorm
Well, you cannot. I think you're talking about the multiple cursors that are present in Sublime Text 2. But, if your text is aligned, then you can change it using the ALT + CLICK and dragging that. You can vote for this feature as lena mentions. UPDATE This feature is now supported in Webstorm 8. If you press the ALT key and click on a different location, you will get a separate cursor there. Before, you could only drag and create cursors in the same line, however, now you can place your cursor wherever you want to. Please take a look at this video to learn more.

Categories : Misc

WebStorm Linking to a .js file in HTML
No idea what 'Webstorm' is, but your HTML contains no reference to the jQuery library. This is where $ is defined. At the following above your existing <script> tag: <script type="text/javascript" src="[ PATH TO JQUERY ]"></script>

Categories : Javascript

Getting angularJS autcomplete in Webstorm/PHPStorm
If you don't already have angular set up, go to Preferences > Project Settings > Javascript > Libraries and add your version of angular. As for autocomplete in html strings, I don't think that's going to happen with the current version of PHPStorm, but in most other places, it should do the trick.

Categories : Angularjs

WebStorm and PHPStorm debug php and js at same time
Solution: As LazyOne suggested I should use "zero configuration" option inside PhpStorm, complete instructions at jetbrains/... Below is a description of the steps: Install Xdebug (sudo apt-get install php5-xdebug) Add inside /etc/php5/apache2/php.ini the lines: [Xdebug] zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so xdebug.remote_enable=1 xdebug.remote_host=localhost xdebug.remote_port=9000 restart apache: "service apache2 restart" check Xdebug is enabled "php --version" should show "with xDebug vx.x" Toggle the “Listen debugger connections” button., this will listen for incoming connections to the test.php script Set a breakpoint in the test.php source code Activate the xdebug debugger, to do this we need to set a special GET/POST or COOKIE paramete

Categories : PHP

Shortcut to quickly run a project from a Javascript in WebStorm?
To have the application opened in a specific browser of your choice, choose View | Web preview on the main menu or press Alt+F2. Then select the desired browser from the pop-up menu.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.