JSON-LD - any way to link it? [duplicate] - json-ld

This question already has an answer here:
Does JSON-LD have to be embedded?
(1 answer)
Closed 6 years ago.
I was tasked on putting json-ld schema on a website - seeing however that the particular schema is biggish I wanted to link it, as you would link any other script (so - it would be <script src='http://foo.bar/json.jsonld' type="application/ld+json"></script>). Is there a way to do it?
Browsing through the documentation at json-ld.org gives me nothing of such thing; on the other hand I'd find it surprising, as I'd gather crawling an external resource shouldn't be a bother and it would certainly spare me administrative headache (have each object json-ld schema be defined in a json file, identified by id of object). I can echo the contents of those files as well, so it's not really an obstacle, but was wondering if I couldn't just link these files.

You can obviously do it but search engines won't consume it if you just reference it. Google, for instance, supports dynamically embedded JSON-LD though. So you could reference it and write a small JavaScript function that looks for <script src="..." type="application/ld+json"></script> tags, fetches the content and embeds it in the document.

Related

In Drupal should I use content-types or database abstraction layer?

I posted a question on the Drupal forum about whether I should build my database in Drupal using content-types or the database abstraction layer and schema module: [here][1]
Any advice would be greatly appreciated.
[1]: https://drupal.stackexchange.com/questions/98020/should-i-use-content-types-or-database-abstraction-layer
I'd recommend using content types.
For a PHP coder, sometimes using the Drupal User Interface to build things feels non-intuitive, but in the long run you're going to benefit a lot from doing things "the drupal way.
Once you reverse engineer your need into a content type and all it's associated fields, install the modules that provide those field types and set things up, you'll start to see the benefits.
Validation on all the data-entry froms will already be done for you.
Multiple display modes are available for your data (email addresses can be shown with or without mailto: links, images can be shown using any of Drupal's image styles)
Integration with other Drupal modules already exists, and will be supported (almost anything built with fields is available to views)
By writing your own schema you'll need to handle all these things yourself (and more), and not just once, but you'll need to maintain all that custom code over time.
Learn to leverage the community and all the great work that's been done already, you'll save yourself time in the long run :)
What i see you are going to have shop site.
You may tray this:
https://drupal.org/project/commerce_kickstart
, i've found it usefull once. It's drupal distribution with nice themed shop rady to use straight forward.
And of course do it with content type + views + entity reference modules.
Here is a link to a comment that answers the question I asked. It backs up what arpitr outlined in their answer on the orignal post on the drupal forum, whose answer is also in agreement with jenlampton's suggestion above.
https://drupal.org/comment/7848011#comment-7848011
I will implement my system using node entities until the need arises to build a custom entity (if it ever does).
The top answer in this forum give a good way to evaluate whether to use nodes or custom build an entity:
https://drupal.stackexchange.com/questions/22586/when-is-it-appropriate-to-create-an-entity-versus-just-adding-a-new-content-type

How to Prevent from re-uploading a file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
i have an Educational website and i create always pdf files from my learning and ad them for download
but there is many learchers that download my files and reupload them somewhere else
i used google dmca but is there any way to Prevent from re-uploading my files?
One way is to use your .htaccess to prevent hotlinking, but even if you do that, you'll again have the problem that when someone views the document via an in-browser extension (e.g. Adobe Reader, Foxit PDF Reader), they can save it and you've lost control over what they can do with it. Or, depending on how you've set up your site, they can simply directly download it, leaving you again back at square one.
Hence, the solution is to bypass direct access to the document. And, there are a number of ways to do that, which varies based on technique and web software (platform) used.
However, since you didn't mention a particular platform or technology: you can use web controllers (MVC type controllers) to broker the dynamic viewing and displaying of the documents in tandem with a client-side tool / plugin to do the displaying for you (much like Scribd).
However, Scribd uses a proprietary Flash PDF viewer called iPaper, and while it isn't available for use, you can find many other alternatives on the web. One that comes highly recommended (there's even a tag on SO for it) is FlexPaper, an open source plugin that implements a client-side web-based PDF viewer - which I think will suit your needs perfectly (from here):
This project provides a light weight document viewer component
enabling PDF files to be viewed without having any PDF reader software
installed. This project provides both Flex library and stand-alone web
version.
Here are some demos of it in action:
http://flexpaper.devaldi.com/demo/
Sorry, by mistake posted partial comment. Anyway...
Why do you afraid of reuploading of your files ? Put links to original site into the PDF and get profit of this. More copies, more downloads, more popularity for your resource. If you indeed would like to make PDFs available from your site only, you have to hide files from users and provide some functionality to read them from your web site only (you can use existing sites of this type). That makes duplicating of your resources to be harder task, but be ready that many users reject to read it this way.

How do database driven blog-style websites work? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Before I start: I know this is a very broad question, but it is the best way I could phrase it, I have searched around a lot and can only seem to find generic explanations. I searched SO and didn't find much. I have also skimmed through some pages in the wordpress codex, and didn't find anything really useful.
I would like to create a simple database driven blog-style website, it will really only consist of stories (their title, date, content, etc), I just began teaching myself web development and my idea of how database driven websites work has proven to be completely wrong. I figured you would always need a file connecting to the database for each article, but the more I read I learn about mark up being generated on request, and so on, so the actual /year/month/day/article doesn't actually have to exist on the server, or that may be wrong, that is why I am here.
As I said I cannot find much on this topic that isn't a generic graphic of a server interacting with a web page. How does one go about creating a database driven website of this style? Are the files/directories not actually on the server but only created on a case by case basis as someone requests it? If so, then why can you type out a complete url and it be there with out throwing a 404? I have a lot of questions, really all I need is a strong explanation of how these sites work, code examples, and so on. Could someone explain how they work or point me to information (recommended articles, examples or books)?
EDIT: Please don't recommend a framework, I want to understand how these sites work and build one myself.
It's actually quite simple. Wordpress's index page calls wp-blog-header.php. That file calls for other files, and those files call for other files. It goes on for some time until all the contents of the page are actually loaded.
The databases come in when you start thinking about having users. Obviously the user information is stored in the database. Beyond that, Wordpress keeps post titles, dates, and other information in the database for easy loading later on.
Comments are also stored in the database. Each comment is associated with a number, and in the database, just like the posts, the dates/times as well as the usernames associated with the comments are kept.
Further exploration in the actual Wordpress files will reveal a lot of interesting features.
You might want to check out Django. It is an open source Python web framework that provides a lot of the functionality you are talking about. It also has a lot of very good high-level documentation with even a free e-book. It is centered a bit more on newspaper type sites than blogging, but most of the same principles apply. If you are new to python and like to use IDEs I would recommend checking out PyCharm. It has tight Django integration and makes for simple project setup and debugging.
Generally speaking, you'll use a framework that will take input parameters (year/month/day/article), run some code to fetch data from the database, and dynamically create the webpage. There isn't an actual .html file sitting on the webserver. One of the most popular frameworks to do websites like you're describing is Ruby on Rails, which makes it incredibly simple to do.

mind mapping based on file system [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I've just started using some mind mapping software (Freemind and Xind) as a replacement for text documents I was previously using to keep track of my work. The main issue (in both cases) is to maintain references to files and folders when I add,remove, or rename them (as every time I have to update the mind map).
What I am looking for is a mind mapping tool that would allow me to:
-automatically generate a folder/file structure in the mind map matching a folder on my filesystem.
-create relations between, add notes to, and change the style of these folders and files.
-whenever a folder/file is added, removed, or renamed, the mind map would automatically be updated accordingly (I'm guessing on linux it would work based on inodes).
Thanks.
Freemind can create your entire file structure by going to import->folders.
It works fine in freemind or freeplane but is you publish it to the web with the addon, it crashes. Working on that problem.
Mindjet 8 has a limited capacity but only maps two levels down. Not very useful.
randy
Docear has a mindmap mode which will import a directory structure, create a mind map, allow you to create graphical links between folders, and add notes. It has a feature "Add Monitoring Folder" and "Re-read Monitoring Folder", but the monitoring feature seems to only work for pdf files and sub-folders with pdf files in them. It might be a good place to start since it's open source. (It's based on freeplane).
There is an add-on for Freeplane that looks promising for what you are trying to achieve: dView(indexfile)
A sub-optimal solution is to use your file manager as the mind-mapping tool and then using directory names for topics, text files for details/notes and links for inter-relations.
To the best of my knowledge FreeMind and Xmind provide some sort of linking to external files but are not as extensive as what you request.

Tagging file system instead of directories? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
In the modern file systems there are files and directories. In a directory, there are sub-directories and files.
My question is, wouldn't it be better if all the files were in one place, and each file could tagged? So each file have tags, just like in Stack Overflow: every question has tags. The main advantage, is that searching could be much more faster.
What is your opinion? For you, was it more comfortable?
Having developed my own tagging program http://www.taggtool.com I can offer the following thoughts:
It is super useful to be able to cross-reference multiple files using tags but
it involves a lot of upfront and ongoing effort to add tags to your files although automatic rules help.
Technically on Windows it's a challenge to code such a system, where do you save the tag metadata? Ideally in the file but that's only possible with a tiny set of file formats.
Alternative Data Stream offered a possible solution but it feels like a half baked solution.
The other option is to store the metadata in a database which introduces the new challenge of keeping everything in sync.
It's a shame that the native OS doesn't provide a robust metadata storage for files but that's the way it is at the moment.
Hmm. Current research goes into this direction. For example tracker
or WinFS.
Personally I believe that we cannot easily resign from directory structure as:
It is tightly connected with how computers file systems works and what programs expects
Hierarchical organisation helps manage large number of files if there is strong separation. I.e. I have folders Projects, Music, University etc. which shares no files in common
I guess that semi-power users (like *nix geek on windows) need to know the underlying structure easily. I gave up when I tried to do 'search for file XYZ.exe and delete the folder containing it' using standard tools in Windows 7.
On the other hand tags function better when the sets overlaps like:
Photos of family, photos of buildings - where photo of my parents in from of monument belongs?
Music
Questions
If user is 'power-user' enough he might want to use hierarchical tags and form some ontologies. Those on the other hand can be simulated on *nixes by symlinks.
To conclude - in certain areas I prefer tags but not for all of them. Sometimes I need to know underlying structure. But probably as most other stackoverflow users.
File system tagging would be useful - not as a replacement, but as a complement of a directory system. I don't want to have all files in one directory, but I would like to have some files or directories inside a tree hierarchy (like image/video/music collections) organized using tags.
I've started a project to develop a tagging filesystem. Check it at http://code.google.com/p/labelfs/
You may take a look at Reggata It's a simple tagging system for local files.

Resources