Implementing ctpp / nginx for deployment - c

I've never posted here before so excuse me,
I am developing a test project that can provide a narrow set of information dynamically based on user input. My deployment targets include a select few low power embedded systems.
My application logic is mostly done, but I am having trouble getting ctpp to work correctly with nginx, and I'm afraid its ignorance on my part but I'm tired of banging my head on the wall and its starting to take a toll.
I've got the whole nginx / ctpp / ngx_ctpp2_plugin (or whatever its named) bundle compiling and running, and I can serve html. Getting nginx to serve data from a templating framework seems to be harder than I thought.
I can get ctpp to compile my templates from command line, or by linking some test C code to the ctpp2 library. I cant figure out how to actually serve the data with nginx, I'm getting a "500 internal server error" every time.
Ive already gone pretty far out of my comfort zone on this, my only other experience with a templating framework has been Node/jade. So if you know another way of generating some dynamic data with minimal effort with a small footprint on an embedded system let me know.
TIA

The problem I was having is apparently a result of the plugin requiring an empty json response if it nginx is going to serve anything otherwise it returns a 500 error.
https://translate.google.com/translate?hl=en&ie=UTF8&prev=_t&sl=ru&tl=en&u=http://ngx-ctpp.vbart.ru/
Have yet to see it work, but this is the answer to the current problem.

Related

What's a good way to navigate code base and find source for a webpage

I'm new to frontend development and thinking about what's a good way to find source code in our code base for a webpage. What I usually do is going to the element tab in chrome dev tool, finding a special class name, and searching that in code base to locate the file. I feel there should be better way for this task. I tried to use source tab in dev tool, but it shows tons of files and folders in navigation column. I also tried to use Components tab since we're using react, but component names are minified to single letters. So want to get suggestions from you folks. How do you usually do this? Thanks!
You have the right idea, the problem is that you are looking at the minified (presumably production) version of the website. In general, while developing a website, you run a development server, in which all of the code (mostly) appears as it is written in your IDE/editor. That way you can find component names and inspect the source code through the chrome dev tools.
You should talk to whoever is currently responsible for the code to help you get a development server running on your machine. Then, you find the component names and then do a "find in files" search through your IDE/editor to see what they are, and where they are used in the code base. There may be many results that you have to sift through. That's par for the course in large code bases until you become more familiar with what goes where. And even afterwards.
I will say; even things that appear simple can be fiendishly complex, so it would be useful for you if the owner of the code could give you a rough outline of how things are organised and why to make navigating the code base easier. But, it will always be a bit hard, and depending on how clean the code is, it might be nearly impenetrable. Good luck.
There are many ways to to find source code or debug Code
①You can use Chrome dev tool
②You can use debbuger in VS
③you can debug your code by puttin debugger in java script code
④browser has good functionality to find
code(For reference please check Image.)

How to stop Next duplicating HTTP requests for my project? Huge payloads affecting performance

Been really loving Next so far but I'm running into this issue where my static requests are being duplicated( as per first screenshot below from page speed insights--this is also just a subset of what's happening as it's also duplicating CSS files).
I couldn't figure out why this is happening so I created a fresh new next project and the same issue is happening (screenshot 2 directly from inspecting browser and looking at the individual network requests).
The new project is extremely minimal with barely any code. I made sure that I'm not importing anything twice or in different places. What could be causing this to happen? (For reference, I copied most of the code to Gatsby/Firebase and when I deployed it, this issue doesn't happen even though it's almost exactly identical code).
Any help appreciated. Thanks.
If anyone else runs into this issue, as of this moment this is a bug to do with the automatic preloading prop of the component from Next.js.

React build not loading all chunks

simple problem that I've seen asked in a few places and seems to have no structured answer. Because of this I though I would start a thread here and maybe get something going that will help everybody!
Diving right into it, I have build a react app using create-react-app, compiling this into a prod version using npm run build it does everything that it needs to and completes successfully.
After all of this we can observe the compiled app having multiple chunks.
All good and well until we enter the app and try to navigate to a different page, where we find it is not loading any other chunks besides the chunks responsible for the first page you access when entering the app.
This is the base problem, I realize I'm not giving any snippets or anything but again, this is because the problem seems very general, there are a lot of people with different applications and code looking for a solution to this and haven't found something practical and normal (having messaged some on forums and such).
If anybody needs any specific information to may case please ask and I will happily provide :)
As far as I can tell, this is webpack related or something like that, webpack from what I understand only includes one chunk and then loads the others as needed, is this correct?
If so and if the chunks are created but not loaded when switching to other pages, then it seems like a webpack issue, but what?
When you, then other developers, create a react app and it contains multiple chunks, do they load well?
Any and all information is appreciated, lets try to tackle this issue!
P.S. If you go into the compiled production build and manually add all the chunks, everything works perfectly. I will try to add any and all information to this thread as I find out more.

Using backends and google cloud store to efficiently process large data files

This is a follow up on my question regarding processing large files using google app engine. The solution was Google Cloud Storage and I've spent the whole day wrestling with it and have run into some big issues.
The backend I'm using is a B4_1G. And I'm trying to process a 55mb sized xml file. The code currently is pretty basic, I'm just trying to make sure I can simply print out the file to a user before I start doing anything fancy with it:
gcs_file = gcs.open(filename)
gcs_file.seek(0, os.SEEK_SET)
for line in gcs_file:
self.response.write(line)
gcs_file.close()
The result is that the backend simply crashes. On the browser it spits out "Uncaught application failure" (even though it's nestled in a try, except statement). On my logs it says:
"The process handling this request unexpectedly died. This is likely to cause a new process to be used for the next request to your application."
I've tested this code with a tiny hello world text file and it works. So my guess is that as a beginner I'm doing something so inefficient that it's causing the server to crash after a few minutes. I have considered chaining tasks to do it, but I really would prefer not to write all that extra code... there must be a way to do it in backends right?
After messing around it a ton, it turns out the self.response.write was the problem. My guess is, printing out 55mb messed the whole thing up. Once I removed that and added my processing code, I noticed that everything was working fine :).

Away3D & AwayPhysics: Content uses capabilities that require a license

Just grabbed all the Away3D branches from Github and included them in a test project I created in FlashBuilder. All runs fine, but if I run any of the files from the ‘awayphysics-examples-fp11’ collection, I get this dreaded message,
I’ve searched here and on Google, with Away3D included, for this message, but nothing relevant came up, so I’m sorry if this is already a known issue.
Is this just something I’ve just got to accept if I want to use Away3D and AwayPhysics?
The branches I'm getting the problem with are away3d-core-fp11, awayphysics-core-fp11 and awayphysics-examples-fp11.
And just to say, I understand Adobe's new models which stipulate that you must get a license to use both shared memory space (Alchemy and the like) and Stage3D. I'm questioning if there's a way to use Away3D and AwayPhysics without the Alchemy element, a lá (I've just found out) jiglibflash.
Don't use flash player. Using Stage3d in in a flash player app is a premium feature. http://www.adobe.com/devnet/flashplayer/articles/premium-features.html
Sorry for necroposting, but someone might find it useful, since google drops this link first on a few queries.

Resources