Reading DOMDocument and find elements using CSS selectors - objective-c

I must convert an android app to iOS, this app uses deeply the jsoup library and the element.select(cssQuery) to find elements starting from CSS selectors.
Initially I wanted to convert selectors to XPATH and use xmllib2 but the css-selector usage is really pervasive (dozen of configuration files, already existing stored files)
Does exist some Cocoa code/library/framework able to create an HTML document and search using CSS selectors?

Have a look at these Gumbo wrappers. Gumbo is an html5 parser written by Google. Note that the CSS selectors that can be used are very simple and might not suit your needs.
ObjectiveGumbo
OCGumbo
Hope this help (even if you already approved another answer).

I dont know if there is existing method to search using css selectors in Cocoa, but i here is an article about most common xml parsers for iOS:
http://www.raywenderlich.com/553/xml-tutorial-for-ios-how-to-choose-the-best-xml-parser-for-your-iphone-project
Personally, i would recomend KissXML. It's DOM with support for XPath queries.

Related

applying css properties in image using CSS Plugin in Createjs

trying to change the css properties of an image using CSS Plugin in Createjs but i am not able to do so. Guys plz help
var wheel = new createjs.Bitmap(preload_queue.getResult("bg"));
stage.addChild(wheel);
wheel.set({x:0 ,y:0})
wheel.image.style.transform = "translate(20px, 30px)";
wheel.image.style.perspective= "2000px";
wheel.image.style.perspectiveOrigin = "left";
createjs.Tween.get(wheel)
.to({transform: "translate(500px, 50px)"}, 1000)
Have you "installed" the CSSPlugin?
createjs.CSSPlugin.install();
TweenJS natively just works with numerical values, but the transform is a string that is composed of various functions (translate, scale, etc). The CSSPlugin was updated in version 0.8.2 to deal with transforms.
CSSPlugin Documentation
Note that CSSPlugin is not included in the minified version of TweenJS, so you have to download it and add it to your project if you want to use it.
I hope that helps!
For this particular demo, the issue is that you are using the canvas to display your image.
EaselJS does not support CSS, especially perspective transforming. You can do typical x/y/rotation/skew/scale transforms using direct properties, or the setTransform() method, but that is all 2D-canvas supports.
The CSSPlugin for TweenJS is to affect the CSS transformations of DOM elements, and is not intended for use with EaselJS objects.
Hope that helps!

intelliJ shows Bootstrap classes as typos

I just created a new static web project using the Bootstrap template. In my html files it is marking the names of Bootstrap css classes as typos. Surely the worlds smartest IDE is better than that? How do I make it aware of Bootstrap classes? I know I can disable spell checking but that seems like an awful solution.
Please follow WI-4762 for updates to be notified on any progress with it. For now, I can only suggest to either disable the spell checker or add the words shown as typos to dictionary

Is it possible to re-skin activeadmin to work with JQuery-Mobile?

I've got an app that's using JQueryMobile and it's using the awesome ActiveAdmin extensively as well. While I love the ease and simplicity of the ActiveAdmin interface, I'd really like consistency with the rest of my app.
Is it possible (i.e. using standard ActiveAdmin and not modifying its sources) to re-skin ActiveAdmin to use the JQuery-Mobile look and feel?
Its very possible to reskin ActiveAdmin, though it would be a bit of a job to do, and there would likely be quite a number of things that can't perfectly be built to match a mobile presentation, especially if you don't want to get into overriding markup rendering.
You can always simply start adding styles of your own to the active_admin.css file that is generated for you. If you'd like to start without any of ActiveAdmin's styles at all, you can comment out the two sass imports in that css file:
#import "active_admin/mixins";
#import "active_admin/base";
Or at least just the base file. It may be intriguing to you in itself, or informative about the organization of the markup, to view your current admin pages without the base css, or with css turned off in your browser altogether. From that vantage point, you could begin to think through how the bare markup could be restyled to match a mobile presentation.

JSLint, when using JS frameworks

I use the Dojo framework, which I load from an url.
How should I deal with the 'dojo' was used before it was defined errors, and the alike?
Yes, my feeling really get hurt, when running code through JSlint.
Perhaps you can put something like
/* globals dojo */
in the beggining of your file to tell JSLint that dojo exists?
I personaly use JSHint (a fork of JSLint that is less nitpicky) instead and one of the preconfigured options is support for Dojo.
Sounds like you need to put Dojo first in your JavaScript. The message suggests that you have an ordering problem.
Don't take it personally. You are not your code. Just make it better, learn something, and don't do it again.
If you scroll all the way down to the bottom there is a "predefined" textbox. Simply put in any of the variables you need into there (comma separated).

Objective-c code formatter site to create html that can be embedded into a blog

I'm looking for site similar to http://www.manoli.net/csharpformat/ that allows one to put in c# code snippet and it formats the html to post into your blog with a CSS file.
I need one that actually does this for Objective-C.
You want the GeSHi (Generic Syntax Highlighter) library. It's is excellent, has dozens of languages (including Objective-C, with the ability to automatically linkify classes/protocols to the documentation), and support for many popular CMSs (Django, WordPress, Drupal, Joomla, Mambo, etc).
If you'd like to see it in action, you can check out nearly any wiki page on our local CocoaHeads website. For example: http://cocoaheads.byu.edu/wiki/different-nslog
Assuming you're on a Mac, copying code from Xcode will keep the syntax coloring. Any WYSIWYG blog editor should support that.
In case your blog software isn't WYSIWYG, you can paste into TextEdit and save as HTML. It outputs pretty crappy HTML considering it's just highlighted source code, but it's nonetheless compliant HTML.
Other than that, I don't know of an online service for that.
I use pygments (python) to generate syntax highlight for source code examples embedded in blog.
If your entry text is just the source code it will work the same for what you are after, I tested it to highlight Objective-C as well.
I actually use markdown syntax to type plain text blog post in a file and I copy plain text code examples. Then I run the file via markdown processor, which includes pygments for highlight and store it into a file.
It's as simple as:
include markdown
html = markdown.markdown(text,['codehilite'])
See simple script at the link which just takes file name of your plain text file and creates html file.
Then I can copy/paste the code.
You have to include link or copy the css as well to get the syntax highligh but it's easy.
I do this for blogger, see example how to use markdown with pygments to do syntax highlight.