Raw urls on GitHub keep changing - github

I need a Markdown file to be able to refer to diagrams in my repository and for the links to remain valid as the diagrams are updated. I am finding that the url I get when I right-click the Raw button and copy the link varies between these two forms:
https://github.com/user/repo/raw/branch/folder/file.png
https://raw.github.com/user/repo/branch/folder/file.png
Note the change in the position of "raw".
Could anyone explain, please, what is happening?

One of these URLs is a redirect to the other, or they're both in a redirect chain to a third link. It's possible your browser has prefetched one and knows the destination already in some cases, and not in others.
I'd take either one to a command-line prompt and give it to curl -Lv and see where the final one ends up. Alternately, you can use the API to query for the raw link for this object, and whatever it gives you should be correct.
I will tell you that the latter domain name is probably not correct; I would suspect that the right URL is at the domain raw.githubusercontent.com, but I'd ask the API to be sure.

Related

AEM-6.4 Original Value of sling:resourceSuperType for /libs/foundation/components/redirect

I have accidentally make changes to the sling:resourceSuperType value of /libs/foundation/components/redirect in CRXDE. I have tried to google from AEM site like https://www.aemcomponents.dev/ to get the answer, but still no avail.
I would like to know the original value that set to the sling:resourceSuperType. It will be good if someone can share the value here, or will even better if able to share any other site and guide that can get the original properties of each AEM components.
foundation/components/page is the sling:resourceSupertype for /libs/foundation/components/redirect
(The 'redirect' component refers to a page. Hence, its super-type is 'page')
Also you can always copy your jar with a new name and port and extract it. It will create a vanilla system and there you can check it.

internal links in Lektor's markdown blocks

I want to build a website, maybe similar to a movie database, where every page has, say, actors, director, year (it seems that Lektor can deal very well with such structured metadata), and I am thinking about how to realize internal links between pages on that site.
Say I have a text such as
just like in [his previous movie](link), he shows again ...
then I guess I could use the absolute path of the linked page as link target, but that makes me very inflexible with respect to changing URL structure. Can I somehow just use the ID of the target content?
Or, better yet, can I somehow automatically obtain the title of the linked page?
just like in his previous movie <<link:title>>, he shows again ...
Can I use the standard Markdown blocks for that or would I have to add some handcrafted database lookup logic?
if some contents will be changed in future. I think you can use the databag feature to implement it. you just modify the databg in case changed is need.

Netsuite - Dynamically determine domain url

I have been researching for quite a while now about how to dynamically determine the domain url of a netsuite account.
In general I have seen developers hardcoding domain url to "https://system.na1.netsuite.com" or "https://system.netsuite.com" in portlets.
But nobody determines it dynamically.
This in general is a bad practice(although I know Netsuite redirects) and I presume there should be way to determine the correct URL.
Can anyone help in this?
Depending on what you're trying to find the URL for, you can use nlapiResolveURL to dynamically generate the URL for several different NetSuite objects (Suitelets, records, etc). I suggest investigating that function to see if it fits your needs.
Another options is to check the current environment.
You can use nlobjContext to get the environment. Below is the code snippet
var url = 'sandboxurl';
if(nlapiGetContext().getEnvironment()=='PRODUCTION'){
url = 'productionurl';
}
Hope it helps
Depending on your needs, you may simply be better using relative urls. If you use window.location, anything that starts with a / is a relative location: How do I set window.location to a specific path (without a host)? has a good example.
If there is a specific example of what you are using the url for, we might be able to help more!

Google Content Experiments for whole part of the site

I want to run an A/B-test or an experiment for whole part of the site. For example on my /blog/ page, where one variation would have a newsletter form and other variation a free ebook download button.
The problem is that I have to use a full URL path for the experiments, for example /blog/2013/article/1?var=1 and /blog/2013/article/1?var=2 With this method I would need create a new experiment for each blog post. This is impossible.
Any tips on how to approach this?
It's possible, but the documentation is lacking.
When you choose your variation URLs, you need to use relative instead of http://. This let's you use query parameters to define the variations, instead of the full URL. In your example, you would define your original page as:
http: //www.example.com/blog/2013/article/1
and your variation URLs would be ?var=1, var=2, etc. using relative as the option in the dropdown (instead of http:// or https://).
Here's the not-so-clear documentation on using relative URLs for your variations:
https://support.google.com/analytics/answer/2664470?hl=en&ref_topic=1745208
One important thing to remember is that if you're doing it this way, you need to include the content experiment code on every "original" page.
There's also another way to have even more control over serving the variation pages and controlling the experiment using the Content Experiments JavScript API. This is a relatively new feature - you can see the developer documentation about this here:
https://developers.google.com/analytics/devguides/collection/gajs/experiments
I am not sure this is possible. You might look at a more robust yet simple to use tool like Visual Website Optimizer or Optimizely.

How to show a User view in GWT app by typing in browser address bar

I have this gwt app which say, runs on http://mygwtapp.com/ (which is actually: http://mygwtapp.com/index.html)
The app host a database of users, queried by searching usernames using the search view and results are shown in the user results view. Pretty useful enough. However I need to bb add a way that user view can be viewed by just typing http://myapp.com/user123
I am thinking that the question I have here, the answer is a server side solution. However if there's a client side solution, please let me know.
One fellow here in StackOVerflow suggested that the format would be like this:
mygwtapp.com/index.html#user123
However the format is important to be like: http://myapp.com/user123
The 'something' in 'http://host/path#something' is a Fragment identifier. FIs have a specific feature: the page isn't reloaded if only FI part in URL changes, but they still take part in browser history.
FI's are a browser mechanism that GWT uses to create "pages", i.e. parts of GWT application that are bookmarkable and have history support.
You can try to use an URL without # (the FI separator), but then you will have a normal URL, that reloads the page with every change and it could not be (easily) a part of a normal GWT app.
mygwtapp.com/index.html#user123
That would be using the History mechanism (http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsHistory.html) which I would add is the recommended way of doing it.
However, if you insist on using something like http://myapp.com/user123, one of the possible ways is to have a servlet which accepts this request (you might have to switch to something like http://myapp.com/details?id=user123). The servlet will look up the DB and return your host html back. Before returning it will inject the required details as a Dictionary entry in the page (http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/Dictionary.html) On the client you can read this data and display on the UI