Dynamically adding data to divs with SQL? - sql

A little background first, recently began coding and I decided to take the "learn as you go" approach as this is solely a project. I have a pretty good handle of HTML and CSS, I have an understanding of Jquery, and haven't even begun to look at other languages.
So basically I'm making a suedo-e-commerce site, and I'm trying to create a page layout comprising of several divs stacked together (think standard catalog page) Creating the modules and every static with HTML and CSS, but I want to add the content, comprising of a banner and some text blocks, dynamically from a database. Now, I'm pretty sure that I will have to use SQL and reference each entry with the HTML, but I have no idea how to do that or where to even start. So I'm asking if someone could point me in the right direction with some reading material, or some examples would be awesome.

You need to use one of databases (MySQL, MSSQL etc.) to save data. In order to show data from database you need to use one of background/server side programming languages. For start I would suggest that you try with php.
W3schools is good starting point for you.

This is very simplified and I hope not condescending. Consider separating how you collect your data and you present your data (the 'view layer'). SQL will help you pull / organize your data, and you could just string functions to add formatting (e.g. div's) to it, but you are better off investigating templating HTML. What happens when you want to put this data into a ul list or something? You have to re-write your perfectly good SQL. Again, very broadly, pull data (with SQL, PHP, combination), ( or get it from a URL with javascript), into a data structure, then within a loop in your template, add the dives for each element.
Good reading really depends on which platform you'll be developing this in. There are a bazillion alternatives, including many in Javascript, PHP, Ruby, Python, Go, ASP. Since you mention SQL, you must have some data somewhere (rather than a data service) so you'll need a server-side language, and since you are a beginner, you may want to look into PHP which I think is approachable. Within that there are several PHP frameworks for data, and several for templating, and several with both. Many of the full frameworks (in any language) are geared for experienced web devs. That said, I like the twig templating language for PHP
This, I think, is a good place to start http://www.phptherightway.com along with the super popular but basic W3schools. The link above I think organizes the concept a little better.
You can install the stuff you need on your laptop for that standard (and old school) 'LAMP stack', or use one of the many hosting companies, nearly all of which provide everything you need. good luck learning!

Related

MarkLogic : Design question on Query Options Vs Transform

Our team creates a bunch of custom REST APIs (v1/resources/...) and expose them as enterprise services to other stakeholders, who do not need to know anything about MarkLogic. However, our team is responsible for creating, enhancing and maintaining the server-side scripting (we use JavaScript) within MarkLogic.
While creating custom REST APIs, our current design to meet the search requirements is to start with a Query Options, incorporate as many requirements in Query options, and for any requirements that could not be met by Query Options (for example, sorting within a document, complex XPath, merge with other documents etc.), code within the Java Script extension program (technically not a transform but conceptually similar to a transform).
With the limitations in Query options, increasingly, most of our logic is going into the Javascript extension programs and the query options seem to be just a maintenance overhead. Do we really need to maintain a query options file for every REST extension, while the transforms offer much powerful functionality? Can I get rid of Query options and just use server side Java Script code (conceptually, similar to transforms)? Initially, our thought was that Query options is configuration based and hence changing query options is not exactly a code change, however, based on our experience, we realized that changing query options also involves deployment, regression testing and all other activities. Hence I do not see any specific advantage of query options, in our case (creating custom REST APIs).
Design gurus, please suggest!
These questions are tough to answer without properly knowing the whole situation. You talk about custom REST endpoints, but are using REST extensions on the built-in REST api for that purpose. Are you using anything else of the built-in REST api? You use search options, but don't use them for /v1/search. Could you have done the same with /v1/search with those options, but an extra REST Transform on top? And you speak of a lot of data mangling happening at sub-document level. Have you considered doing part of that processing upfront, or organize your data differently so that handling at request-time becomes much simpler?
A lot of questions, and a lot of possibilities. It is hard to give one straight answer on such an open question. I hope I gave some food for thought nonetheless.
HTH!

Standard library in ABAP

Is there something similar to a standard library for modern ABAP (maybe even OO-Abap)? For example a curated list of objects that address some of the most common programming tasks like
high-level data structures (not just plain internal tables)
working with file paths and directories
working with files (reading, saving, ...)
working with different file types (text, csv, xml, ...)
regular expressions
working with the environment (client, application server)
...
My current workflow is to stumble upon a problem like getting the extension of a file from a filename (or something fairly similar and easy). Then I have three options:
Dig through a ton of (mostly old and lacking) posts on SDN until i maybe find a pointer to solve the problem
Hack away and create a one-off solution to the problem
Take my time and implement a good and well documented solution
Many times I feel a bit lost. A lot of the available information is old, bad or both. Is there a more structured approach to tackle the problem of finding a suitable abstraction in the ABAP-world?
To answer your first question no, unlike C, C#, Java, there is no need to include a library since all the functions are always available to you, so in that regards it might be simpler. What you are asking though is a great question, I am sure you probably see tons of queries in SDN for "Is there a Function module for?" etc.
There isn't an easy answer but In SAP ABAP I think the easiest way might be to find this is by looking at packages. Similar to a library by looking at a package for the type of function your looking for might get you there. For example if I am looking for handling files I might look for the control framework package and there I can see all the available functions/classes/methods/BAPIs etc. that are related to front end controls/file handling etc. and might be able to find what I am looking for. Note its not perfect as the way packages are used has changed from time to time so its actually better for finding functions related to for example purchasing or sales etc. but its one way that we use.
Like other languages in that we still need to know what library to link in to get the function you need, in ABAP you just have to find the related package. Hope it helps a little, I know its not perfect. Example package for front end controls
For working with the environment:
If you have access to SAP there is a transaction code called BAPI
Here you could find a hierarchical list of all the main objects in SAP (i.e. Material, Purchase Order, etc)
In this list you could find documentation, the function modules used for the object (i.e. créate/get detail/update etc)
And digging into the function modules could take a look to the structures, receiving parameters, etc
The other questions are a little bit complex, I am not aware of any comprehensive list but digging into SCN usually is easy to find a solution for the most common things like handling files, etc
In the particular case of regular expressions, SAP native language, ABAP, has keywords for handling them, but you also have a class in SAP called CL_JAVA_SCRIPT which you could use for doing thigs in "JavaScript way"
For example I used this class in the past to evaluate a simple formula provided in a string (i.e 3 + 2 * 5 )
This is an operation really complex to do in ABAP but easy to do in JS.
Hope it helps
SAP Reuse Library (SE83) is the most close thing to what you are looking for. It provides common development tasks grouped in hierarchy (UI controls, standard dialogs, confirmation prompts) and contains code snippets for each with commonly used classes/modules:
Though, it is incomplete and lacks many popular things.
Consider also DWDM, BIBS, LIBS transactions and other packages in this link.

How to make a language pack for a VB.Net application

I am making a web browser made in VB.Net, and I do have people using it from around the world, but I don't think all of them can understand everything it can do. Does anyone know how to create a sort of language pack that users can change the language of every label on the form? The only way I can think of is editing all the labels to another language, then publishing the application again, but that is a lot of work because I do use a lot of labels... any help would be appreciated. Thanks!
What you're looking to do is called "localization." While localization itself is not a difficult topic to understand, depending on the complexity of your application, and the number and diversity of languages you want to support, it can become a rather involved task.
The general concept behind localizing an application is separating translatable elements (like all of the strings in your buttons, labels, and menus, or any images containing words) from the application itself, and storing them as resources which can then be chosen appropriately based on user preference or region, and then loaded into the application dynamically. There are a vast number of ways to accomplish this, and which you choose is entirely up to you, and how much effort you're willing to support. Techniques can range from loading strings from text files, storing and retrieving resources from a database, to using .NET's built-in localization functionality which stores assets in external resource files.
Localization as a topic is incredibly broad, so there is no single method that can be discussed without first knowing your specific goals and constraints. Your best plan of action is to start researching, and find a technique which seems most suitable for your project.
Google: ".net localization"

Connecting to existing database to make ASP tables

I am taking a hand in development for the first time and trying to teach myself some things, and chose to start with ASP and Visual Studio. I have a rather simple question to ask... I generally search and search and search... but I don't know what the proper term/phrase is for what I'm searching for.
Assumptions: Visual Studio 2013 (not express), asp.net mvc5 with bootstrap(3.1.1) is what I'll be using.
Two part question: what is the phrase/term to use when searching for an answer to part two? data grid? data fill? something else?
The second part of my question is what are the most commonly used methods of creating and filling a table with data from an existing database? Do people almost always just have to hand code everything or are there great tools out there?
So far I only found...igniteUI and I haven't actually read the website to see what it's about yet. I want to be able to design something... maybe using bootstrap or boilerplate.. and then create tables and fill them with tables. I've only ever made static sites. Anything that has some kind of GUI that lets me build these tables and and direct certain data types to specific table columns and rows would be a major plus, as I could compare what I just did with the code that was created... and then I could learn to make cleaned up handcoded versions myself. this is how I learned web design, I figured I could learn SOME parts of development the same way.
As I said above, the reason I am asking this question is because I do not know what any of the proper term(s) for what I'm describing and wasn't sure where to start.
Welcome to SO.. kind of a loaded question and somewhat opinionated, but I have 2 spare cents I can offer.
In the end, it depends what data you are trying to present, and what you want that user to do with that data. With HTML, anyone can create a simple table and present some data (aka TR and TD tags). What's this good for? Showing tabular data. What's this not good for? Anything interactive...
OK, so then what do we use instead? Again.. depends what you're trying to allow the user to use, AND if you have any existing resources in place. For example, jqGrid is your front runner in late bound, jquery enabled sortable\editable data presentation. ExtJS is also a popular scripting library, and they have some tools as well.
But that's late bound, javascript enabled stuff.. what about things that are already bundled into ASP.NET? Well, you have the gridview and listview at your disposal. Both are nice because they allow some quick and easy ways to connect to structured data, and if you're using some of the more popular data stores, such as SQL server, you even get drag\droppable connections (aka, less coding). Telerik has been in the game a long time, and for some cash, you can get some pretty advanced tools.
Again, all opinionated stuff. ASP.NET has some very nice things out of box, but nothing is perfect.. all of the items mentioned above I have used at one time or another, and they've been a great foundation for starting my applications. But at the end of the day, I always had to take what was given to me and add\edit functionality to get what I ultimately needed.
Hope this helps...

django multilanguage Website: SQL vs. xml?

We are actually creating a website with some comunity elements. We choose django as programming language. We'd like to keep the website multilingual.
We already created some apps and website, but kept them static and singlle-language. I read about 2 approaches to create a multilingual website. The first is to keep the translations in a database. This should be the easiest way, but way to unefficient and with an ordinary performance. I also read about setting up a xml translation file, where you can store every single translation.
I'd like to know the differences in performance and the advantage or disadvantages of these approaches. Is there any efficient way in django to keep my website multi-language?
Django has good built in support for multiple languages based on GNU gettext.
Unfortunately, the support is limited to text that you know in advanced, which is good enough for your UI, but if you have users creating content in multiple languages, it will not be enough, and you'll have to deal with it yourself in the database.