Quantcast
Channel: ClearScript
Viewing all 2297 articles
Browse latest View live

New Post: Using ClearScript. WebApplication problem

$
0
0
I tried above 2 suggestions, but it didn't work. I am running latest version of ClearScript.Manager i.e. 1.2.0.17920

Thanks

Edited Issue: Dubugging in V8 not working as expected [61]

$
0
0
I can connect with the debugger, which gives me source code but does not stop on breakpoints. It does yield the source code so I am sure I am connected, but the breakpoints do not work. I have followed the instructions in the readme and I have read a helpful blog from Satyendra Kumar Pandey http://pandeysk.wordpress.com/2014/05/25/debugging-with-clearscript/

Steps to reproduce
I have download the codebase and run the v8 setup script, I was able to get v8 up and running. I am just using the simple console application from you demo project. I can connect the the script engine using both eclipse and webstorm, neither one will stop at a break point. I have tried using the debugger key word and that does not stop debugging.





Commented Issue: Dubugging in V8 not working as expected [61]

$
0
0
I can connect with the debugger, which gives me source code but does not stop on breakpoints. It does yield the source code so I am sure I am connected, but the breakpoints do not work. I have followed the instructions in the readme and I have read a helpful blog from Satyendra Kumar Pandey http://pandeysk.wordpress.com/2014/05/25/debugging-with-clearscript/

Steps to reproduce
I have download the codebase and run the v8 setup script, I was able to get v8 up and running. I am just using the simple console application from you demo project. I can connect the the script engine using both eclipse and webstorm, neither one will stop at a break point. I have tried using the debugger key word and that does not stop debugging.





Comments: Glad to hear that your issue is resolved. Thanks!

New Post: Using ClearScript. WebApplication problem

$
0
0
Hi again,

A couple more things:

  • Make sure those DLLs are not in the "bin" directory.

  • If you're deploying to a server that doesn't have Visual Studio installed, it must have the Visual C++ Redistributable Package installed (VS2012, VS2013). Be sure to install the 32- and/or 64-bit version as necessary.
Thanks!

New Post: Serializing passed object

$
0
0
hi

i wrote a hosted function :
public void myUpdate(string collectionName, DynamicObject entity)
{
  //somehow serialize the object to json
}
engine.Execute("myObjdate({name:"hello"});
And i didnt found any way to serialize the object to json/bson any idea on how to do it?

New Post: Serializing passed object

New Post: Using ClearScript. WebApplication problem

$
0
0
Did you try to resolve the dependencies with the AssemblyResolve event? I've described the procedure a few posts up in this same thread.

New Post: Serializing passed object

$
0
0
Another possibility, if your function has access to the script engine, might be to use its JSON object:
publicvoid myUpdate(string collectionName, DynamicObject entity)
{
    var json = Convert.ToString(engine.Script.JSON.stringify(entity));
    // ...
}
Good luck!

New Post: Is the following thread concerning Server-Side execution still accurate?

$
0
0
Hey guys, there was a thread that I had based some work off of, but there was some indication that some optimizations may be made in ClearScript to better help deal with some of these issues. Has anything changed in regards to this thread? (Is was over a year ago)

https://clearscript.codeplex.com/discussions/467415

Reviewed: ClearScript 5.4 (Dec 11, 2014)

$
0
0
Rated 5 Stars (out of 5) - looks great

New Post: Is the following thread concerning Server-Side execution still accurate?

$
0
0
Hi Eric,

ClearScript and V8 have not changed in terms of their basic architectures. However, ClearScript 5.4 includes a number of important changes for server-side usage, including fixes for memory leaks, more deterministic disposal of V8 resources, and performance improvements for repeated script execution.

Thanks!

New Post: Is the following thread concerning Server-Side execution still accurate?

$
0
0
Cool, thanks for the fast responses. Can you elaborate any on "perfomance improvements for repeated execution"? I did read the release notes and I get the gist, but the details are somewhat cryptic to me. I've been taking the approach of having a pool of runtimes and creating engines when needed via CreateScriptEngine from the runtime. I also compile and cache the scripts per runtime for reuse. Would that still be a recommended approach for a server-side implementation? Is there anything new that might help perf/scalability?

Thanks,
Eric

New Post: Is the following thread concerning Server-Side execution still accurate?

$
0
0
Hi Eric,

Can you elaborate any on "perfomance improvements for repeated execution"?

Sure. The biggest performance improvement for V8 users affects repeated invocation of host methods.

Let's say you've exposed the Console type and are running a script that repeatedly calls Console.WriteLine(). Because methods in JavaScript are just function-valued properties, each call consists of two steps - fetching the "WriteLine" property and invoking the result.

Previously this required two expensive round trips across the native-managed boundary, but now host methods are cached as native JavaScript properties, so after the initial call, subsequent calls require only one round trip.

This caching mechanism is also used to speed up repeated access to host events and const/readonly fields (most significantly enum tokens).
​​
I've been taking the approach of having a pool of runtimes and creating engines when needed via CreateScriptEngine from the runtime. I also compile and cache the scripts per runtime for reuse. Would that still be a recommended approach for a server-side implementation?

Yes, that's the best general-purpose design for concurrent script execution via V8.

Cheers!

New Post: access indexer of a hosted object

$
0
0
I've run into this problem, too. I have tried to implement IList<> in the hopes that the object could then be indexed as an array in V8 script land:

e.g.

.NET
    public class NodeList : IList<Node>
    {
       ....
        public Node this[int index]
        {
            get
            {
                return item(index);
            }
            set
            {
            }
        }
       ...
    }
Script:
   document.getElementsByTagName('head')[0]
document.getElementsByTagName('head') returns a NodeList as expected but attempting to get [0] returns undefined (although .Item.get(0) works)

Is it possible to get an object to act as an array? Is IList the interface I should use? Should I make it a DynamicObject instead?

UPDATE: Neeeevermind. I realized I should have used the non-templated IList. It's late :P

New Post: Is the following thread concerning Server-Side execution still accurate?


Created Unassigned: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference

New Post: Global window object

$
0
0
So another question in regards to simulating the window object in a browser:

I have created a DynamicObject "window" which uses the GlobalMembers method which is great (access to location, screen, document, etc as expected). The thing I am trying to accomplish now is to allow dynamic properties set on the global host to be reflected in the window object and visa-versa.

e.g.

answer = 42;
console.log(window.answer); // 42

So one direction works:
window.answer = 42;

Evaluate("answer") = 42;

But this:
answer = 42;

Evaluate("window.answer") = undefined

I tried to override GetDynamicMemberNames() in my window object to include dynamic properties from the global context but that results in a stack overflow. Is there a way my window object can retrieve a list of properties from the global object without recursively coming back to itself?

New Post: Global window object

$
0
0
Hi again,

It sounds like you really want window to be the same as the global object, and that's very easy to set up:
engine.Execute("window = this");
Then you could simply expose your GlobalMembers host object under a different (dummy) name:
engine.AddHostObject("_window", HostItemFlags.GlobalMembers, new MyWindow());
With this setup, your host object's members - and any dynamic properties added by script code - are visible in both window and the global object (because they're one and the same). In fact, this way your host object might not need dynamic support at all.

Good luck!

Commented Unassigned: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference
Comments: Hi Max, On a brand new 64-bit Windows 7 SP1 machine with [Visual Studio Express 2012 for Windows Desktop](http://www.microsoft.com/en-us/download/details.aspx?id=34673), we cannot reproduce this problem. Comparing the logs (ours attached below) reveals that your build skipped some custom steps that presumably would have generated the missing files. Could you try building on another machine, or with another version of Visual Studio, or maybe repairing your Visual Studio 2012 installation? Thanks!

Commented Unassigned: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference
Comments: Thanks for suggestions, I will try again to build both ways (with repair and by using another machine) and will let you know how it went.
Viewing all 2297 articles
Browse latest View live




Latest Images