Hello I m trying to make an app using the tutorial here. https://developers.google.com/maps/documentation/javascript/examples/directions-panel.
the question I want to ask if is it possible to have values from a mysql database in the select box. (The destination) . Also if its possible The start value to be the location of the user that uses the app.
sorry if these are easy questions but I m fairly new to programming and I dont know where to start.
If you look at the HTML the elements added to the drop down list are down list are done so from the html, you will need to query your back-end database for the locations you want and pass them to the javascript (I am unsure what language you are using in your backend) if you're using php then this answer should help: Fetching data from MySQL database to html dropdown list
If you want the start point to always use the users location I would suggest a solution such as:
var location = navigator.geolocation.getCurrentPosition();
var start = new google.maps.LatLng(location.coords.latitude, location.coords.longitude);
Instead of deriving the start point from the ddl. Not this uses html5 geolocation, may not be accurate and may not work in all browsers.
Related
I am trying to create a visual studio 2017 extension. More specifically, I want to extend IntelliSense to create light bulb suggestions and fixes. For that, I am trying to go through the syntax of .cshtml file (both markup and c# code), and parse it so that I can get stuff like values of the attributes and tag names, so that I know when to show the light bulbs.
I went through the documentation on MSDN site. I found out how I could get the light bulbs to show up at specific caret location using ITextBuffer and Snapshot for [ContentType = "text"]. But for my problem, I want the light bulb to show up based on values of attributes and like. So, I think I will have to work with [ContentType = 'code']. I couldn't find proper documentation for that. I found this article
https://designprincipia.com/writing-a-visual-studio-extension-to-automate-code-generation-with-roslyn/
It tells how you can show a light bulb when your caret is on a method name and make a class file with that method name. Now, this is for a C# file and uses the Roslyn APIs to get the syntax tree and sementic model of the C# code.
Problem Comes down to this
I have a .cshtml file and I want to get the syntax tree of the markup and C# code in it. And, I think I should be able to get it because the editor higlights the markup and C# code of the file differently. Thus, it must be parsing it. But I am not able to do this.
So, for my approach I am trying to get the syntax tree. I want to know how this can be done. Please, tell me if this the wrong direction and what else I can do.
PS: This is my first question so please tell me if I have left any information and also I am new to Razor so maybe I am missing something there.
Thanks a lot for your time.
This might be useful:
using System.Web.Razor;
using System.Web.Razor.Parser.SyntaxTree;
var host = new RazorEngineHost(new CSharpRazorCodeLanguage());
var engine = new RazorTemplateEngine(host);
var result = engine.ParseTemplate(new StringReader(<STRING>)));
result.Document.Children provides detailed recursive tree structure.
this is one heck of a confusing question to ask so here it goes. Firstly, I'm not asking you to write me any code I just need help going in the right direction for what I'm trying to achieve here. Basically the task is this, I want to scan a select area of a web page's source code for changes and if something does change, I want to report it somewhere (like a console or something). However, I do not want just a notification of change, I also want what the change is/was. I've been looking into things like jsoup but I am still struggling to even find out what this is called.
Any pointers would be insanely appreciated. Thanks, Optimistic.
Here are some steps assuming this is from a node.js project:
Get the URL for the specific script file you're looking for a change in.
Using the request() module, fetch that URL.
Break the data up into lines (probably using .split()).
Find the specific line you are looking for either by counting line numbers of by searching for some representative text in that line.
Using some sort of search in that line (perhaps a regex), find the current value of the exact item in that line you are looking for.
Save the current value.
Then, at some future time, repeat this whole process and compare what you find to the previous value.
If this is being done from a browser instead of node.js, then use an Ajax call to retrieve the file. If the file is on another domain from your web page and that domain does not permit cross-origin requests, then you cannot solve this problem in an automated fashion from a browser in your own web page.
Here is how I would do it with Jsoup:
Document doc = Jsoup.connect(url).get();
String scriptCssQuery = "script"; // Tune this CSS query to find THE script you need.
Element script = doc.select(scriptCssQuery).first();
if (script != null) {
String scriptLines = script.html();
// Store the changing line somewhere and compare it to its previous value...
}
Hi I am pretty new to wicket but I have been looking around for an example that show's how I can get data from a table in my database and then edit that data on a grid view in wicket and the changes being saved back to my database.
As you can see I tried doing it this way but it looks pretty bad and not very user friendly if the user has to go click edit every time to make a small change is there perhaps a better way to do this?
My goal is to make a time sheet where users will receive there specific time sheet when logging in and be able to edit is as they please like a excel time sheet almost.
Take a look at the 'library' example:
http://examples7x.wicket.apache.org/library/
Wicket is HTML presentation library. The buttons and form submits done in the wicket forms will trigger the logic that will modify your base.
You need a data access technology for this, its can be:
- an ORM like hibernate,
- a SQL generation library like JOOQs
- or you can write directly you hown SQL and pas it to database JDBC connection...
I have a MySQL database, and few perl scripts using which i am generating the webpages.
On Html page links are available,
For example-
Customer_link => (calls customers.pl) query executed - select * from customers.
Now there is one more link say Customer_in_mumbai => it should remove all the customers whose city is not mumbai.
How to achieve that?
do i need to execute the query once again with where clause or any other way is also possible so that i can simply remove the customers whose city is not mumbai?
Also if i need to execute the query again, do i need to write one more perl file, if not how can i use the same file?
You can use Javascript to manipulate on the client side of things after it's been loaded/displayed. There's nothing you can do on the server side to change a page once it's been downloaded without Javascript.
The rest of your questions indicate a lack of familiary with how dynamic web pages are generated. You can have a single page that does all that, using standard HTTP query variables to modify how the script operates. e.g.
http://example.com/yourscript.pl?remove=mumbai
then have Perl retrieve that remove value and use it to modify how the database query runs. But showing you that is beyond the scope of this site - we're not here to teach you, just help fix problems.
From your question, it seems you only want to remove it from the page temporarily for the user. You can achieve that simply by remove rows with mumbai as a value with Javascript. That should save you server side processing. Use a Library like JQuery to achieve it easily.
I have Mysql and Zope talking to each other nicely.
I can insert values in, and even view one record from the databse and have it show up in the form fields(not that cool really).
I have just been following tutorials, but now I need to search the Database and display the results.
I have been fiddling with this for a while but I haven't gotten far.
I know that using a Zope Page template we can call the Zsql method and show the results with TAL, but I need to some how using a script and a redirect form the search form pass the search data.
Can anyone help we get started?
Can anyone show me a way to do it with formgen and a custom script adapter?
Go into your ZMI, and add a "Z Search Interface" object in the same folder as your ZSQL method. Your ZSQL methods should show as "searchable objects". Select the ZSQL method you want, fill in the rest of the fields, and it will generate form and display page templates. Then modify the templates to taste.