I've written a script to parse out some needed code in HTML files that are uploaded to our app. On OS X, this process works fine. However, when I upload to our testing server, it doesn't. When I go into the console on the test server and attempt to parse the file, Nokogiri won't see the structure - each time I get a single line of output instead of the whole document structure. The rest of my script isn't being executed because Nokogiri isn't traversing the document. Looking for some help on how to resolve the issue.
Here's the requisite code I'm using to open the file and feed it to Nokogiri:
html = Nokogiri::HTML(File.open("index.html", "r"))
Here's what html equates to:
#<Nokogiri::HTML::Document:0x10d9bbf0 name="document" children=[#<Nokogiri::XML::DTD:0x10d9b81c name="html">]>
In OS X, I get the entire tree, as expected.
Here's the contents of index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="zero.css" type="text/css" charset="utf-8" />
</head>
<body class="fullpage-vert" onunload="javascript:clearInterval(audioLoop);">
<div id="container">
<div id="danceHolder">
<img id="danceVid" src="1-1.jpg" width="320" height="480" alt="" />
</div>
<div id="introHolder">
<img id="introVid" src="0-1.jpg" width="320" height="480" alt="" />
<div id="ctabg"></div>
<div id="cta1"></div>
<div id="cta2"></div>
<div id="cta3"></div>
<div id="phone"></div>
<div id="logo"></div>
</div>
</div>
bridge test
<frameset cols="25%,75%">
<frame src="frame_a.htm" />
<frame src="frame_b.htm" />
</frameset>
</body>
</html>
When I try and search for the frameset, for example, I get nothing:
html.css("frameset").size
0
I know Nokogiri has problems with the default Libxml2 version installed on CentOS (2.6.2), but I've followed the instructions to get it built on a new version (2.7.8). Here's the output for nokogiri -v:
# Nokogiri (1.5.0)
---
warnings: []
nokogiri: 1.5.0
ruby:
version: 1.9.2
platform: x86_64-linux
description: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
Has anyone else seen behavior like this?
For some reason, swapping
html = Nokogiri::HTML(File.open("index.html", "r"))
for
html = Nokogiri::HTML(File.read("index.html"))
works, although now it won't calculate line numbers properly (everything is line number 0).
Related
I have an app I developed in Android. I installed a VM with Mac, and I'm testing it in iOS. The app worked perfectly in Android, but in iOS it is not. When I use 'ionic serve' or 'ionic serve --lab' the browser show a white screen, and in the console I get this errors (link of image below):
Console
Here is some code from the index.html:
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="lib/ionic/css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/bluebird.min.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic.cloud.min.js"></script>
<script src="lib/ionic/js/ionic-modal-select.min.js"></script>
<script src="lib/ionic/js/ionic-toast.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
I'm really lost here because the exact same files works OK for Android.
Which error you are posted, not library error.Error coming from app.js file.If you dont mind create a new ionic app and replace your file in new app.it will works.
I have a Jenkins project that does a gradle build and uploads build artifacts to a Nexus maven hosted repository using the Jenkins upload artifact to nexus plugin. This was working fine when I was using Nexus 2.13 - but after upgrading to Nexus 3, the upload to Nexus is no longer working. I have made sure that I have configured Nexus 3 repository just like my Nexus 2.13 repository. When I build my Jenkins project I get a response
GroupId: com.company
ArtifactId: hello-world-util
Version: 1.0.0
File: hello-world-util-1.0.0.jar
Repository:companyDevops
Uploading artifact hello-world-util-1.0.0.jar started....
Reason Phrase: Method Not Allowed
<!DOCTYPE html>
<html>
<head>
<title>405 - Nexus Repository Manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!--[if lt IE 9]>
<script>(new Image).src="http://192.168.99.100:18081/favicon.ico?3.0.1-01"</script>
<![endif]-->
<link rel="icon" type="image/png" href="http://192.168.99.100:18081/favicon-32x32.png?3.0.1-01" sizes="32x32">
<link rel="mask-icon" href="http://192.168.99.100:18081/safari-pinned-tab.svg?3.0.1-01" color="#5bbad5">
<link rel="icon" type="image/png" href="http://192.168.99.100:18081/favicon-16x16.png?3.0.1-01" sizes="16x16">
<link rel="shortcut icon" href="http://192.168.99.100:18081/favicon.ico?3.0.1-01">
<meta name="msapplication-TileImage" content="http://192.168.99.100:18081/mstile-144x144.png?3.0.1-01">
<meta name="msapplication-TileColor" content="#00a300">
<link rel="stylesheet" type="text/css" href="http://192.168.99.100:18081/static/css/nexus-content.css?3.0.1-01"/>
</head>
<body>
<div class="nexus-header">
<a href="http://192.168.99.100:18081">
<div class="product-logo">
<img src="http://192.168.99.100:18081/static/images/nexus.png?3.0.1-01"/>
</div>
<div class="product-id">
<div class="product-id__line-1">
<span class="product-name">Nexus Repository Manager</span>
</div>
<div class="product-id__line-2">
<span class="product-spec">OSS 3.0.1-01</span>
</div>
</div>
</a>
</div>
<div class="nexus-body">
<div class="content-header">
<img src="http://192.168.99.100:18081/static/rapture/resources/icons/x32/exclamation.png?3.0.1-01"/>
<span class="title">Error 405</span>
<span class="description">Method Not Allowed</span>
</div>
<div class="content-body">
<div class="content-section">
HTTP method POST is not supported by this URL
</div>
</div>
</div>
</body>
</html>
My Jenkins nexus upload is configured like (and this has not changed between Nexus 2.13 and 3)
Upload artifact to nexus
Nexus Details
Protocol HTTP
Nexus URL 192.168.99.100:18081
User admin
Password admin123
Credentials com.company
GroupId com.company
ArtifactId hello-world-ui
Version 1.0.0
Packaging jar
Repository companyDevops
File build/libs/hello-world-util-1.0.0.jar
My Nexus 3 maven hosted repository is configured like
Name companyDevops
Format maven2
Type hosted
URL http://192.168.99.100:18081/repository/companyDevops/
Online
Maven 2
Version policy Release
Layout policy Strict
Storage
Blog store default
Strict content type validation X
Hosted
Deployment policy Allow redeploy
Not sure why I’m getting this error
-I’ve validated that the Nexus admin user has permission to upload artifacts
-I’ve validated that allow redeploy is enabled
What might be happening
-possibly the Jenkins ‘upload artifact to nexus’ plugin is not compatible with Nexus 3?
Has anyone got this to work with Nexus 3? Any suggestions?
Thanks!
Nexus Artifact Uploader plugin now supports Nexus-2.x & Nexus-3.x.
Support for Nexus-3.x with plugin version 2.6
https://wiki.jenkins-ci.org/display/JENKINS/Nexus+Artifact+Uploader
Please use "Nexus Artifact Uploader", below is the url and also support nexus 3 as well.
https://plugins.jenkins.io/nexus-artifact-uploader
After the installation of plugin, we would get nexus artifact uploader in build section.
This plugin doesn't support Nexus-3.x, We are working to provide capability uploading artifacts to Nexus-3.x
I am trying out a Polymer Dart App under Cordova. So I started with the Dart Editor Sample App.
I use a recent version of Polymer so I had to edit the sample code. Here is my pubspec.yaml
name: cortst
description: Cordova Test Application
dependencies:
polymer: '>=0.15.1+3 <0.16.0'
transformers:
- polymer:
entry_points:
- web/cortst.html
And here is the combined HTML and Dart. I think the initialization uses the new/approved technique:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample App</title>
<link rel="import" href="clickcounter.html">
<link rel="stylesheet" href="cortst.css">
<script type="application/dart">
import 'dart:async';
import 'package:polymer/polymer.dart';
void main() {
initPolymer().run( () {
Polymer.onReady.then( (_) {
new Future( () {
// stuff goes here!
});
});
});
}
</script>
</head>
<body>
<h1>A Test</h1>
<div id="sample_container_id">
<click-counter count="5"></click-counter>
</div>
</body>
</html>
To generate stand-alone JavaScript I run dart2js via the command line:
pub build --mode=debug
And these are the results:
Dartium (37.0.2062.120 (292122) via Dart Editor 1.7.2) - OK
Run as JavaScript on Chrome (38.0.2125.111 m) - OK
Run as JavaScript on Firefox (33.0.3) - OK
dart2js and run on Chrome - no shadow DOM.
dart2js and run on Firefox - OK
When it fails the click counter is rendered (invisibly) as
<click-counter count="5"></click-counter>
This Chrome problem matters because the standard web host on Android is Chrome.
For brevity, I have embedded the Dart script in the HTML. I get the same results when I use a separate .dart file.
Perhaps I have overlooked something - it wouldn't be the first time...
I'm setting up an AngularDart/PolymerDart project, but I keep running against the following error:
Breaking on exception: Module.DEFAULT_REFLECTOR not initialized for dependency injection. http://goo.gl/XFXx9G
Now I've read the page behind the url given at the end of the error and did some Stackoverflowing, but the only sollution I came across was adding -angular as a transformer in the pubspect.yaml. And so I did. But still I keep getting the same error and my project won't start.
My pubspec.yaml:
name: application
description: application
dependencies:
angular: '>=1.0.0 <2.0.0'
angular_node_bind: any
core_elements: '>=0.3.2 <0.5.0'
paper_elements: '>=0.5.0 <0.6.0'
polymer: '>=0.14.0 <0.16.0'
web_components: '>=0.9.0 <0.10.0'
dependency_overrides:
args: '>=0.10.0 <0.12.0'
code_transformers: '>=0.1.4+2 <0.3.0'
html5lib: '>=0.10.0 <0.13.0'
observe: '>=0.11.0 <0.13.0'
transformers:
- angular
- polymer:
entry_points:
- client/web/index.html
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Application</title>
<!-- include the web_components polyfills with support for Dart. -->
<script src="../packages/web_components/platform.js"></script>
<!-- imports -->
<link rel="import" href="../packages/polymer/polymer.html">
<link rel="import" href="components/component.html">
</head>
<body>
<!--
don't put ng-app on html or body. the polymer build inlines
custom elements definitions, which can trigger bugs if the code
inlined is inside of ng-app
-->
<div ng-app>
<section>
<p>Angular</p>
<p>
<input type="text" ng-model="cool"> Angular binding: {{cool}}
</p>
</section>
<section>
<p>Polymer</p>
<my-element message="[[ cool ]]"></my-element>
</section>
</div>
<!-- initialize -->
<script type="application/dart" src='dart/init.dart'></script>
<script src="../packages/browser/dart.js"></script>
</body>
</html>
init.dart:
import 'package:polymer/polymer.dart';
import 'package:angular/application_factory.dart';
import 'package:angular_node_bind/angular_node_bind.dart' show NodeBindModule;
void main() {
initPolymer()
.run(() {
applicationFactory()
.addModule(new NodeBindModule())
.run();
});
}
It appears that the "web" folder MUST be in the same folder as your pubspec.yaml. I placed the web folder inside a folder "client", which caused the problem. Putting the web folder in the project root folder again fixed the issue.
I'm receiving this error:
Class#new_employee_survey_email failed with ActionView::Template::Error: uninitialized constant ActionView::CompiledTemplates::Liquid ..
The liquid gem is installed. I can use it in views or in the rails console. I can't get it to work in the email template only.
That template have only several html tags and the call to the Liquid class from their example:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
<% #template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template %>
<%= #template.render( 'name' => 'tobi' ) %>
</body>
</html>
The email is send by delay job if this makes difference.
I will apreciate any help in making this work.
I found the solution:
The jem was successfully found after restarting my box.
Possible reasons - the terminal that had "rake jobs:work" running was not aware of the installation and the addition of the Liquid gem to my gem file.
To not look like complete newby ... :(
I have restarted the rake server and the gem started working on all views/controlers but the mailers
I have restarted the the rake job, but not the console that it is running on ...
I hope this helps others to not waste time ... I'm still feeling newb thought :( ...