Search Results

Search found 4826 results on 194 pages for 'compiler directives'.

Page 1/194 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • add_header directives in location overwriting add_header directives in server

    - by user64204
    Using nginx 1.2.1 I am able to add multiple headers using add_header as follows: server { listen 80; server_name localhost; root /var/www; add_header Name1 Value1; <=== HERE add_header Name2 Value2; <=== HERE location / { echo "Nginx localhost site"; } } GET / HTTP/1.1 200 OK Name1: Value1 Name2: Value2 However I soon as I use the add_header directive inside location, the other add_header directives under server are ignored server { listen 80; server_name localhost; root /var/www; add_header Name1 Value1; <=== HERE add_header Name2 Value2; <=== HERE location / { add_header Name3 Value3; <=== HERE add_header Name4 Value4; <=== HERE echo "Nginx localhost site"; } } GET / HTTP/1.1 200 OK Name3: Value3 Name4: Value4 The documentation says that both server and location are valid context and doesn't state that using add_header in one prevents using it in the other. Q1: Do you know if this is a bug or the intended behaviour and why? Q2: Do you see other options to get this fixed than using the HttpHeadersMoreModule module?

    Read the article

  • Write a compiler for a language that looks ahead and multiple files?

    - by acidzombie24
    In my language I can use a class variable in my method when the definition appears below the method. It can also call methods below my method and etc. There are no 'headers'. Take this C# example. class A { public void callMethods() { print(); B b; b.notYetSeen(); public void print() { Console.Write("v = {0}", v); } int v=9; } class B { public void notYetSeen() { Console.Write("notYetSeen()\n"); } } How should I compile that? what i was thinking is: pass1: convert everything to an AST pass2: go through all classes and build a list of define classes/variable/etc pass3: go through code and check if there's any errors such as undefined variable, wrong use etc and create my output But it seems like for this to work I have to do pass 1 and 2 for ALL files before doing pass3. Also it feels like a lot of work to do until I find a syntax error (other than the obvious that can be done at parse time such as forgetting to close a brace or writing 0xLETTERS instead of a hex value). My gut says there is some other way. Note: I am using bison/flex to generate my compiler.

    Read the article

  • How to write a very basic compiler [closed]

    - by Ali
    Possible Duplicate: Best Online resources to learn about Compilers? What would be the best way to learn about compilers, and executable formats? Advanced compilers like gcc compile codes into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of each codes according to library and functions of the corresponding languages. Correct me if I'm wrong. I wish to better understand compilers by writing a very basic compiler (probably in C) to compile a static file (e.g. Hello World in a text file). I tried some tutorials and books, but all of them are for practical cases. They deal with compiling dynamic codes with meanings connected with the corresponding language. How can I write a basic compiler to convert a static text into a machine readable file? The next step will be introducing variables into the compiler; imagine that we want to write a compiler which compile only some functions of a language. Introducing practical tutorials and resources is highly appreciated :-)

    Read the article

  • Can compiler optimization introduce bugs ?

    - by ereOn
    Hi, Today I had a discussion with a friend of mine and we debated for a couple of hours about "compiler optimization". I defended the point that sometimes, a compiler optimization might introduce bugs or at least, undesired behavior. My friend totally disagreed, saying that "compiler are built by smart people and do smart things" and thus, can never go wrong. He didn't convinced my at all, but I have to admit I lack of real-life examples to strengthen my point. Who is right here ? If I am, do you have any real-life example where a compiler optimization produced a bug in the resulting software ? If I'm mistaking, should I stop programming and learn fishing instead ? Thank you !

    Read the article

  • Learning to implement dynamic language compiler

    - by TriArc
    I'm interested in learning how to create a compiler for a dynamic language. Most compiler books, college courses and articles/tutorials I've come across are specifically for statically typed languages. I've thought of a few ways to do it, but I'd like to know how it's usually done. I know type inferencing is a pretty common strategy, but what about others? Where can I find out more about how to create a dynamically typed language?

    Read the article

  • Learning to implement dynamically typed language compiler

    - by TriArc
    I'm interested in learning how to create a compiler for a dynamically typed language. Most compiler books, college courses and articles/tutorials I've come across are specifically for statically typed languages. I've thought of a few ways to do it, but I'd like to know how it's usually done. I know type inferencing is a pretty common strategy, but what about others? Where can I find out more about how to create a dynamically typed language? Edit 1: I meant dynamically typed. Sorry about the confusion. I've written toy compilers for statically typed languages and written some interpreters for dynamically typed languages. Now, I'm interested in learning more about creating compilers for a dynamically typed language. I'm specifically experimenting with LLVM and since I need to specify the type of every method and argument, I'm thinking of ways to implement a dynamically typed language on something like LLVM.

    Read the article

  • Compiler warning when passing NSError ** as a method parameter

    - by splicer
    I've been scratching my head about this for the last 4 hours, trying out all kinds of little experiments, but I can't seem to figure out what's going wrong. Could this be a compiler bug? Test.m: - (id)initWithContentsOfURL:(NSURL *)aURL error:(NSError **)error { if (!(self = [super init])) { return nil; } return self; } main.m: NSError *error; Test *t = [[Test alloc] initWithContentsOfURL:[NSURL fileURLWithPath:@"/"] error:&error]; Here's the compiler warning (from main.m): warning: incompatible Objective-C types 'struct NSError **', expected 'struct NSDictionary **' when passing argument 2 of 'initWithContentsOfURL:error:' from distinct Objective-C type I'm using the latest versions of Xcode and Snow Leopard.

    Read the article

  • Can I get a C++ Compiler to instantiate objects at compile time

    - by gam3
    I am writing some code that has a very large number of reasonably simple objects and I would like them the be created at compile time. I would think that a compiler would be able to do this, but I have not been able to figure out how. In C I could do the the following: #include <stdio.h> typedef struct data_s { int a; int b; char *c; } info; info list[] = { 1, 2, "a", 3, 4, "b", }; main() { int i; for (i = 0; i < sizeof(list)/sizeof(*list); i++) { printf("%d %s\n", i, list[i].c); } } Using #C++* each object has it constructor called rather than just being layed out in memory. #include <iostream> using std::cout; using std::endl; class Info { const int a; const int b; const char *c; public: Info(const int, const int, const char *); const int get_a() { return a; }; const int get_b() { return b; }; const char *get_c() const { return c; }; }; Info::Info(const int a, const int b, const char *c) : a(a), b(b), c(c) {}; Info list[] = { Info(1, 2, "a"), Info(3, 4, "b"), }; main() { for (int i = 0; i < sizeof(list)/sizeof(*list); i++) { cout << i << " " << list[i].get_c() << endl; } } I just don't see what information is not available for the compiler to completely instantiate these objects at compile time, so I assume I am missing something.

    Read the article

  • C# compiler error CS0006: metadata file is not found

    - by Rob
    I've built a c# compiler using the tutorial on MSDN and a few other resources including here, and I've gotten it to work until I add additional reference assemblies. My errors stem from adding "System.dll" and "System.Windows.Forms.dll" to the ReferenceAssemblies list. here's my code: private void SetUpCompilingParameters() { string ver = string.Format("{0}.{1}.{2}", Environment.Version.Major, Environment.Version.MajorRevision, Environment.Version.Build); string libDir = string.Format(@"{0}", Environment.CurrentDirectory); string raDir = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"; string exWpfDir = string.Format(@"C:\WINDOWS\Microsoft.NET\Framework\v{0}\WPF", ver); string exDir = string.Format(@"C:\WINDOWS\Microsoft.NET\Framework\v{0}", ver); MyCompiler = new CSharpCodeProvider(); CompilingParam = new CompilerParameters(); CompilingParam.GenerateExecutable = false; CompilingParam.GenerateInMemory = true; CompilingParam.IncludeDebugInformation = false; CompilingParam.TreatWarningsAsErrors = false; CompilingParam.CompilerOptions = string.Format("/lib:{0}", libDir); CompilingParam.CompilerOptions = string.Format("/lib:{0}", raDir); CompilingParam.CompilerOptions = string.Format("/lib:{0}", exDir); //CompilingParam.CompilerOptions = string.Format("/lib:{0}", exWpfDir); CompilingParam.ReferencedAssemblies.Add("System.dll"); CompilingParam.ReferencedAssemblies.Add("System.Windows.Forms.dll"); } As you can see, I've explicitly referenced directories in CompilerOptions but its not helping. I'd like to test the solution on here on stackoverflow that utilizes: CompilingParam.ReferencedAssemblies.Add(typeof(System.Xml.Linq.Extensions).Assembly.Location); but I'm having trouble using it for the general System.dll etc...

    Read the article

  • Php error in closure compiler execution

    - by Mohammad
    When I run php-closure i get a PHP error Undefined index: HTTP_IF_NONE_MATCH in <b>/php-closure.php</b> on line <b>183</b> Line 184 of php-closure is trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { This error only happens when closure has already written the compressed javascript file to the directory once, if the directory is emptied the error does not appear. What does this error mean and how can I avoid it? Thank You So Much!

    Read the article

  • O&rsquo;Reilly Deal of the Day 10/June/2014 - AngularJS Directives

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/06/10/orsquoreilly-deal-of-the-day-10june2014---angularjs-directives.aspxToday’s half-price E-Book offer from O’Reilly at http://shop.oreilly.com/product/9781783280339.do is AngularJS Directives. “AngularJS, propelled by Google, is quickly becoming one of the most popular JavaScript MVC frameworks available, working to invert the development paradigm and bring data-driven modularity to the web frontend. Directives serve as the core building blocks in AngularJS and enable you to create reusable models that mold around your data structures and breathe new life into the intersection of HTML and JavaScript.”

    Read the article

  • organize using directives, re-run tests?

    - by Sarah Vessels
    Before making a commit, I prefer to run all hundred-something unit tests in my C# Solution, since they only take a couple minutes to run. However, if I've already run them all, all is well, and then I decide to organize the using directives in my Solution, is it really necessary to re-run the unit tests? I have a macro that goes through all files in the Solution and runs Visual Studio's 'Remove and Sort' command on each. In my understanding, so long as all projects still build after using directives are changed around, things should be fine at runtime, too. Is this correct thinking?

    Read the article

  • C Problem with Compiler?

    - by Solomon081
    I just started learning C, and wrote my hello world program: #include <stdio.h> main() { printf("Hello World"); return 0; } When I run the code, I get a really long error: Apple Mach-O Linker (id) Error Ld /Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Products/Debug/CProj normal x86_64 cd /Users/Solomon/Desktop/C/CProj setenv MACOSX_DEPLOYMENT_TARGET 10.7 /Developer/usr/bin/clang -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Products/Debug -F/Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Products/Debug -filelist /Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Intermediates/CProj.build/Debug/CProj.build/Objects-normal/x86_64/CProj.LinkFileList -mmacosx-version-min=10.7 -o /Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Products/Debug/CProj ld: duplicate symbol _main in /Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Intermediates/CProj.build/Debug/CProj.build/Objects-normal/x86_64/helloworld.o and /Users/Solomon/Library/Developer/Xcode/DerivedData/CProj-cwosspupvengheeaapmkrhxbxjvk/Build/Intermediates/CProj.build/Debug/CProj.build/Objects-normal/x86_64/main.o for architecture x86_64 Command /Developer/usr/bin/clang failed with exit code 1 I am running xCode Should I reinstall DevTools?

    Read the article

  • What are the tools required to build a compiler?

    - by kevin
    What are the various tools that are required to build a compiler for a particular programming language, say C? I want to know how each part of the compiler works. So, I am trying to use all the existing tools like loader, linker, etc, and combine them together to build one compiler (or can just say "compiling a compiler"). Can any one list out all such tools that are required to build a fully functional one?

    Read the article

  • Writing preprocessor directives to get string

    - by Dave18
    Can you write preprocessor directives to return you a std::string or char*? For example: In case of integers: #define square(x) (x*x) int main() { int x = square(5); } I'm looking to do the same but with strings like a switch-case pattern. if pass 1 it should return "One" and 2 for "Two" so on..

    Read the article

  • How to use Preprocessor directives in MVC aspx pages

    - by Zuber
    I am using MinifyJS.tt which is a T4 template to minify all my JS files automatically. In my aspx files, I am referencing all the javascript files. Now, I want to add a condition (maybe compiler directive) to use the original JS file when I am debugging the application, and to use the minified JS files when I simply run the application without debug. I tried using #if in the aspx page, but that did not seem to work. Can we make use of preprocessor directives in aspx pages? Is there an alternative way to achieve my goal?

    Read the article

  • Integrating a Custom Compiler with the Visual Studio IDE

    - by M.A. Hanin
    Background: I want to create a custom VB compiler, extending the "original" compiler, to handle my custom compile-time attributes. Question: after I've created my custom compiler and I've got an executable file capable of compiling VB code via the standard command-line interface, how do I integrate this compiler with the Visual Studio IDE? (such that pressing "compile" or "build" will make use of my compiler instead of the default compiler). EDIT: (Correct me if i'm wrong) From the reactions here, I see this question is a bit shocking, so I shall further explain my needs and background: .NET provides us with a great mechanism called Attributes. As far as I understand, making attributes apply their intended behavior upon the attributed element (assembly, module, class, method, etc.) - attributes must be reflected upon. So the real trick here is reflecting and applying behavior at the right spot. Lets take Serialization for example: We decorate a class with the Serializable attribute. We then pass an instance of the class to the formatter's Serialize method. The formatter reflects upon the instance, checking if it has the Serializable attribute, and acting accordingly. Now, if we examine the Synchronization, Flags, Obsolete and CLSCompliant attributes, then the real question is: who reflects upon them? At least in some cases, it has to be the compiler (and/or IDE). Therefore, it seems that if I wish to create custom attributes that change an element's behavior regardless of any specific consumer, i must extend the compiler to reflect upon them at compilation. Of course, these are not my personal insights: the book "Applied .NET Attributes" provides a complete example of creating a custom attribute and a custom C# compiler to reflect upon that attribute at compilation (the example is used to implement "java-style checked exceptions").

    Read the article

  • IDEA modular problem (jsp)

    - by Jeriho
    I have project in with 2 separate modules(frontend and backend, first depends on second). When I'm trying to access backend code from frontend code, things going fine. Things turn for the worse when I do the same from jsp. This is stacktrase for simple accessign bean <jsp:useBean id="mybean" class="backend.main.MyBean" scope="request"></jsp:useBean> org.apache.jasper.JasperException: /results.jsp(9,0) The value for the useBean class attribute backend.main.MyBean is invalid. org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1220) org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417) org.apache.jasper.compiler.Node$Root.accept(Node.java:495) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361) org.apache.jasper.compiler.Generator.generate(Generator.java:3416) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231) org.apache.jasper.compiler.Compiler.compile(Compiler.java:347) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) And this error will appear if I try to access regular class: An error occurred at line: 12 in the jsp file: /results.jsp backend.main.RegularClass cannot be resolved to a type Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439) org.apache.jasper.compiler.Compiler.compile(Compiler.java:349) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) Sorry for so many stacktraces.

    Read the article

  • Is Google Closure a true compiler?

    - by James Allardice
    This question is inspired by the debate in the comments on this Stack Overflow question. The Google Closure Compiler documentation states the following (emphasis added): The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. However, Wikipedia gives the following definition of a "compiler": A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language... A language rewriter is usually a program that translates the form of expressions without a change of language. Based on that, I would say that Google Closure is not a compiler. But the fact that Google explicitly state that it is in fact a "true compiler" makes me wonder if there's more to it. Is Google Closure really a JavaScript compiler?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >