Is there a full HTML/Javascript online search engine? - javascript

I'm looking for a search engine that would also index the html and javascript code, and not only the rendering.
Use case: Some specific hardcoded javascript parameter is used somewhere in the ~80000 pages site I work on. I need to find where is the page with a specific parameter.
Much appreciated.
EDIT: Context: I don't have direct access to the code. The parameter in question is used to configure some info to send to Adobe's Omniture (into which I get weird hits).
EDIT: Maybe there is no such search engine. I'll keep the question open...

As far as I know, there isn't an online search engine that would do that. The closest you can get to that would be Google Code Search which indexes public source code. You might be able to make use of it if you host your code as a public repository on services such as github, google code, sourceforge, etc.
If it is a private project you're working on, then you should have access to the source code, no? If so, then as #Spiny Norman mentioned, you can simply use grep.
For a large source base, you might be better off using ack.
If you have your code in SVN/Git, look up svnquery or git grep.

Related

Read Google App Script Files from another script

I am looking to create a little Google App Script to parse another GAS file to pull out the functions and any jsdoc type comments, and then display it.
Like if you navigate to a script you can get the revision history etc, but I wanted to be able to pass in a Drive folder containing multiple script files and develop a front end to display each's content.
I know about the Google Drive REST API with exportLinks do download as JSON.
I wondered if there was a simpler way to do it from another GAS file, or would I need to URLFetch of some description to do it over the RestAPI?
I have tried searching for similar things but they always lead back to the DriveAPI.
Any help with a starting place, or what GAS Objects I should start looking at?
Thank you
You have to use the REST based Drive API, there is really no other alternative. However, you don't need to use URLFetch to access it. Google Apps Script has what's known as Advance Google Services a collection of interfaces that grant native access to many REST based APIS including the Drive API.
You can check out the Drive specific documentation here. Its somewhat sparse, so you'll often have to fall back on the REST based documentation as well as rely on autocomplete inside the script editor to make sense of things.

Does C# code contained in Javascript still need to be compiled?

We have a web application built with C# and ASP.NET. I have to reference a few .NET session variables in my JavaScript code, so I use the following line to do so:
var layoutID = '<%=Server.UrlEncode(string.Format("{0}", Session["layout_id"]))%>';
This works just fine. The web application is built and published to our web server. If I want to make a change, a .NET change would require me to compile the changes and publish it to the web server again. If it's a JavaScript change, I can simply edit the js in the .ASPX page and the fix is immediately picked up...no compiling needed.
My question - what if I make a change to this inline C# code contained in JavaScript? Say, for example, I meant to access Session["layoutid"] without the underscore. Could I just edit the .ASPX page on the web server, or will this require compiling just as if it were in a .CS file? I'm guessing since it's C#, I will still need to compile for the change to be picked up. And yes I could just try it and see for myself, but I was hoping someone could give a little insight into what goes on behind the scenes with this inline c# code. And while we're on the topic, is the technique I'm using to access .NET sessions variables in JavaScript the most efficient way to do it?
Bonus question - what is this technique called? I tried searching for an answer but I wasn't sure what to search for other than "in-line c# code JavaScript".
Thanks!
No, changes to ASPX/CSHTML files don't require re-compilation.
Note: whether it is good idea to jump on production server and change random code bypassing source control/testing is question to discuss and answer by your team.

MVC3 - How to dynamically set facebook app Id in javascript?

I have an MVC3 web app that uses a number of the facebook api calls. When I am testing I am using one facebook app Id but will use another in prod (this will be swapped in during the build).
Ideally I'd like to put the app Id in the web.config file to make swapping it during the build easy and so that the id is only in one place. However, I can't see an elegant way to get the id from the app.config into the multiple javascript functions that need it. I looked at reading it into a variable in the _AppStart.cshtml file but not sure that this is right as it means reading the value into a c# object and then passing that as a string to a javascript function that is called before each page loads and that smells a bit wrong.
I'm still learning javascipt so I'm not sure how this thing "should" be done. Any pointers would be great.
Matt
So, I've just come across this which deals with my question. I thought I'd exhausted google before asking this question but obviously not ;-)
integrating-facebook-login-button-in-aspnet-mvc-4-application

Is there a way to search the HTML, JavaScript, CSS of a website

I am looking for a way to search through a website for specific front-end source code: HTML, CSS and JavaScript. This is easy on a single page, but I know of no way to do it over an entire site.
It would be helpful when working for larger institutions that lack good communication. To see how things were implemented on other areas of the site, or by other front end developers (typically number in the 100s).
I don't think it is possible, but I wanted to send it up the flag pole.
wget can recursively search a website. I haven't tried, but I imagine you could pipe its output through grep or such.
Use Google Developer Console.
Once the console is open hit 'sources' tab and you can see the whole applications file tree, simply open a file up > hit the { } to unminify and simply act is if it's any other code edit 'command / control + F' to search!
Check this tut, used slightly differently here, but good way to see how to access files within console.

blogengine without php or asp.net etc

Is there a way to have a blog directly integrated into my HTML/javascript-only website, without having to have something like a SQL-database and a dynamic engine like PHP or MySQL?
Maybe there is some service in the web that offers this (hopefully without ads :) ). Or maybe I can have a blog engine entirely written in javasript?
Entirely written in JavaScript? Surely that defeats the entire point of having a "blog-engine" in the first place? The point being that the data is stored somewhere and dynamically retrieved. To avoid using anything server-side (which seems to be your intent), and only use HTML/JavaScript, you'd have to store all the data for the blog in files that are served up to each visitor, and then retrieve the data from the particular, local, locations using JavaScript.
Sorry if I'm misunderstanding the point here... but this seems to be an utterly useless way of trying to go about things. Blogs are, in general, either written statically (in HTML [even though this is rare]), or are dynamically generated from a database by a server-side scripting language (most common).
Edit: As an additional point, I suppose you could include some third-party blog feed, or service, in your page, via use of JavaScript... but I'm unsure as to which (if any) blogging services would directly support this method of working. Additionally, this is quite an unreliable way of including third-party data in a page...
Here's a thought. It's not really a blog engine - but a wiki.
Entirely javascript/html/css. All lives in a single html file:
http://www.tiddlywiki.com/
not sure how it would work on a real live site, but their site is using it:
* A personal notebook
* A GTD ("Getting Things Done") productivity tool
* A collaboration tool
* For building websites (this site is a TiddlyWiki file!)
* For rapid prototyping
* ...and much more!
You could use github pages. You will get a generated blog with version control.
Other option is to use a Desktop blog tool and then update your site.
You can user iWeb if you have a Mac or CityDesk on Windows or you may try this open source tool
Edit Today I came across this tool: Zeta producer that may help.
http://code.google.com/p/showdown-blog/
Blog engine written in just JS and XML [v0.6] {JavaScript, XML}
So, what you want is to have a blog where you're website provider doesn't provide a way to serve dynamic content?
The only way I see that you can do it in that case is writing html-files (or text-files if you prefer) and adding them to the site. After that you can have some JavaScript to add them to your "blog-page".
You of course need to upload them to the website in the same way as you do for the other files, and then have a way for the JavaScript to know which pages it should fetch.
I am not aware of any JavaScript blog-engines, but you can have a look at the templating functions in for instance Prototype
Of course, that means that you will have to fetch both the template and the content through Ajax and let the client do all the processing (could be slow and possibly insecure), and you still need to have a place to upload the content and update it.
Your best bet is going to be using a generator to create the HTML/CSS/JS to upload to your server, take a look at Webby: http://webby.rubyforge.org/
IF you really need to you can use a public api for a service that lets you post small bits of info and retrieve it using javascript.
for example if you only need small posts you can make a blog in html.javascript that utilizes twitter as the engine. of course you will be limited to 140 chars. I am sure there are other services that will allow a similar idea but with less restrictions.
And of course the best option - Get a blog software or host your blog with a service provider and link to it from you site.
Good luck
One solution would be to use some application that generates the static web pages of your blog, and uploads them to your web server. This way you'd have a blog with static content that could all be managed in javascript alongside your existing site, without needing to install database, daemon software, or additional dynamic web programming languages on your server. The static content generation could happen directly on your server if possible, or you could run the html generation tool locally and upload the output.
MoveableType has a tool like this. You still need somewhere to store the content of your blog, and for this MoveableType uses MySQL by default, so you'd still need to install a database somewhere, but the database could simply be one your local desktop.
MoveableType also has support via plugins or older versions that can retrieve data from a sqlite or other database. The advantage of sqlite is that it doesn't require installing daemons like MySQL does, you can just put a sqlite file on disk somewhere, give MoveableType the path to the file, and run the script to generate your static content.
There are likely other tools like MoveableType, and I have in the past generated blog-like web pages simply by writing small scripts to generate HTML. The main issue is just that you need somewhere for these scripts to fetch data from.
Another option might be to develop your blog using XSLT, ... with XSLT, you'd put the content of your pages in XML files, and then write a template in XSL that converts your XML to HTML.
If you google for 'static blog site generation' you might find other ideas/options, including Jekyll/github mentioned in one of the other responses.

Categories