Prism JS line number misaligned in Chrome - syntaxhighlighter

I'm using Prism Js to highlight code, but line numbers are not aligend properly in Chrome in some cases. However it works perfectly in Firefox. Here's the screenshot.
Can anybody help?

You solve this using external CDN. Try
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.css"/>
and
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
on top of your default prism.

Related

Bootstrap navbar sample always showing mobile on desktop

I copied the navbar default sample from from the samples but without any changes it appears to be doing what I think is mobile format. The only thing I see is the brand tag to the left and the button to the right. My monitor is pretty big so it can handle the menu and it does when I view it online which you can visually see here. I can only assume that since I cut and paste from the demo code I have a setting somewhere else that is wrong but I have no idea where to look. I did make sure to run nuget and get the latest version of the code so I should match what is on the demo. Any ideas?
Update
The issue appears to be with VS2012 and debug mode. Using Visual Studio Development Server seems to be the problem. If I publish locally it works as expected. I thought it might be IE8 but realized it was VS2012 after I published the site.
Is there a way to work around this while using the debugger in VS2012?
Update 2
And somehow it is not working in IE8 again even after being published. Chrome seems to work fine. Must be something picky about IE8 that I need to code around.
Try to copy all the page html, then if it works cut unnecessary code.
Use this instead of your local bootstrap:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
Looks like this was an issue with IE8 all along. I didn't think it was a browser issue so I never looked for IE8 nav problems but here is a link that documents the issue.

Link to local files (cdvfile://) on iOS PhoneGap 3.3

To easily update my app, I copy the content of the www folder to the phone and then do a window.location = workingDirectory.toURL() + "/index.html".
EDIT - note that this works until Phonegap 3.4, but not on 3.5 (nothing seems to be happening when I try to change the location). If instead of toURL I use toNativeURL, then it works also on 3.5. Using toNativeURL also fixes the current issue on iOS.
Copying all the files and opening the index works fine on both iOS and Android. The problem on iOS though is that there is absolutely no styling to the page, as if the links to the CSS files weren't working. Everything is working fine on Android.
My links are relative (eg <link href="css/reseter.css" rel="stylesheet">). Links to other pages or to scripts do work.
Here is the simplified main page I open:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="style.css" rel="stylesheet">
<script src="main.js"></script>
</head>
<body>
<div class="red">I should be red but I'm not!</div>
This correctly takes me to the other page.
</body>
</html>
style.css
.red { color: red; }
main.js
alert("HELLO is correctly displayed");
I correctly get the alert (its title is cdvfile://localhost/) and I can also correctly go to page2.html. The only problem is with the styles.
If I open the page in Safari pointing to my computer, the style is correctly displayed.
I tried a few things, to no avail:
Add <base href="cdvfile://localhost/persistent/MyApp/"> in the <head>
Update all my href and src to have the full cdvfile path (eg use <link href="cdvfile://localhost/persistent/MyApp/css/reseter.css" rel="stylesheet">)
I finally got it working in PhoneGap 2.9 by using fileSystem.root.fullPath. On PhoneGap 3.3 it only return /. Is this a bug on PhoneGap 3.3 that when using cdvfile, everything seems to work except the CSS files?
I decided to temporally use a relative path to my app for iOS on PhoneGap 3.3: ../../Documents/MyApp/index.html. I don't know if it's safe to use or not.
EDIT In Phonegap 3.5 (I haven't tested in 3.3), using work window.location = workingDirectory.toNativeURL() + "/index.html"; (ie using toNativeURL instead of toURL) works.
Check the following link (the plugin was changed):
http://cordova.apache.org/news/2014/02/10/plugins-release.html
It looks like you are running into CB-6532. I just put in a pull request for a fix -- you can temporarily use my fork until it is accepted:
https://github.com/loufranco/cordova-plugin-file
To use it, do
cordova plugin remove org.apache.cordova.file
cordova plugin add https://github.com/loufranco/cordova-plugin-file.git
Remember to reverse it if the pull request is accepted.

Orbeon : linking ressources (css, images, js) leads to erratic behavior

I'm developing a new webapp based on the orbeon samples. I'm using orbeon 3.9 CE. I got VERY ERRATIC behavior when I use custom ressources. They are placed in following folders :
/orbeon/WEB-INF/resources/config/theme/*.css
/orbeon/WEB-INF/resources/config/theme/*.js
/orbeon/WEB-INF/resources/config/theme/images/*.jpg
In my custom theme file (/orbeon/WEB-INF/resources/config/theme-xnotes.xsl), they are linked like this (a few examples) :
<xhtml:link rel="stylesheet" href="/config/theme/bootstrap.css" type="text/css" media="all"/>
<xhtml:script src="/config/theme/bootstrap.js"/>
<xhtml:link rel="icon" href="/config/theme/images/icone_grue.png" type="image/png"/>
When I point my browser at the application (http://localhost:8080/orbeon), it SOMETIMES work, SOMETIMES doesn't (css are ignored, page transitions are wrong) and SOMETIMES it works partially (css are ok, js not, a few images are ok, others are not and so on)
When I look at the page source code, the links seems to be ok, to take the sames examples as above :
<link rel="stylesheet" href="/orbeon/config/theme/bootstrap.css" type="text/css" media="all">
<script src="/orbeon/config/theme/bootstrap.js">
<link rel="icon" href="/orbeon/config/theme/images/icone_grue.png" type="image/png">
But some links are not valid and point to the root of the application. The main problem is that I just can't make this behavior consistent to isolate the issue(s).
Help really appreciated ! It's driving me crazy...
I don't think there can be more than one GET or POST per request, but per open connection certainly.
However, this might be related to authentication since you mention j_security_check. Can you try to make sure that the CSS and other resources are not protected by form authentication?

From JQuery Mobile to PhoneGap / Cordova

I have a JQuery mobile app. I now want to deploy it natively to Android and iOS. To assist with this, I thought I would use PhoneGap. When I run my app, none of the styling information appears. There are no errors in the console window. I'm not sure what I'm doing wrong.
Are there any guides on going from JQuery mobile to phone gap? Everything I see starts with Phone Gap and builds from there. Am I doing this in reverse?
Thank you for any insistence. I really want to get this app onto Android and iOS. I feel like I'm so close. But I have no idea what I'm doing wrong.
Thank you,
This is just a guess, but you have something like this in your code?
<link rel="stylesheet" href="//code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
If so that's wrong and you need to store your css locally in the assets folder if you want it to run locally within your WebView.
Otherwise, I'd suggest that you first run an 'hello world' on phone gap, and style just one element through an external local stylesheet (without worry about javascript for now). That's essentially the most difficult part, knowing where to put the file and how to reference it, so you do not want to confuse yourself with the extraneous code of your current project when you're learning that part.
Once you've figured that part out, it will be trivial for you to do the same with the jQuery Mobile library, both the css one and the js one.
Have you include properly?
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.min.css" />
<script src="jquery.mobile/jquery-1.7.2.min"></script>
<script src="jquery.mobile/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
put the .js file and .css file in the jquery.mobile folder.
But if you are using eclipse then you can create phonegap app directly.
I hope it would be helpful for you.

jquery cdn on iphone

For some strange reason, when I load my web app on chrome, jquery mobile is flawless but when I try it on my iphone, it never renders properly. The page just crashes and looks awfully bad. I decided to use the cdn because I was told it was faster.
<!-- the three things that jQuery Mobile needs to work -->
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
I copied the above snippet directly from the jquery site. Any suggestions as to why am getting different behaviors?

Resources