Turn off phantomjs messages when running a casperjs script - phantomjs

I am running the basic script with casperjs:
http://docs.casperjs.org/en/latest/quickstart.html
I see that my console output shows the following additional messages from phantomjs apart from the page's titles :
2014-01-28 15:14:01.150 phantomjs[19493:110b] * WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
2014-01-28 15:14:04.050 phantomjs[19493:110b] CoreText performance note: Client called CTFontCreateWithName() using name "Palatino" and got font with PostScript name "Palatino-Roman". For best performance, only use PostScript names when calling this API.
2014-01-28 15:14:04.050 phantomjs[19493:110b] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
Is there a way to turn these off so I can get a clean output?

Related

QtCreator WYSIWYG quality

I am making my first steps with QtCreator and I see some issues. I designed a simple widget, see the image below. On this screenshot the bottom view is what I designed and the top view is the result of running the design. I say they are similar, but I expected more. It looks like the running version compresses the components. Is there something I should set in QtCreator?
I also attempted to check the functionality of my widget, using debugging, but I receive the Warning 'This does not seem to be a "Debug" build.' Shall I set something to produce a debug build?
In the meantime I found out that if I do not put the widgets in a layout box,then I receive as output what I expected. Why a layout has such side effect?
Also, in the meantime I added some signal/slot connections. Since I did, I am presented with error message ui_registerwidget.h:13: error: QtWidgets/QAction: No such file or directory. It is a file/code generated by the QtCreator.

Import UIKit for debugging Objective-C by default

Whenever I try to read the frame of an UIView for example while debugging, I get this error:
error: property 'frame not found on object of type 'UIView *'
error: 1 errors parsing expression
After searching for a solution, I found out that I can use this command to solve this without adding (annoying and in some cases complicated) casts:
expr #import UIKit;
But I still find it annoying to have to do this every time (why doesn't Xcode do this by default?!), so I thought I should be able to do this using the .lldbinit file, but I couldn't get it to work.
I don't know much about that file, I have this in it atm:
command script import /usr/local/opt/chisel/libexec/fblldb.py
so I tried adding the UIKit import command at the end of the file but it didn't look that it worked. I also tried prefixing it with command to no avail. Is this possible or not? (please say yes; it will save my life)
lldb will auto-import modules that the debug info tells us the program imports fairly soon now. All the pieces weren't in place to do that for the first Xcode 7 releases.
Statements in the .lldbinit get run before the main file is read in, it is supposed to help set up the environment to read in your program. But at that point there's nothing into which to import these symbols. You need to do it after the main binary is read in (and you really need to do it after you have run, since I think we need to run some code to do this.)
At present, the simplest way to do this is to make an auto-continue breakpoint at main, and attach the expr #import UIKit statement as a debugger command in that breakpoint. You'll have to do this once per new project you make, but if you're working on the same project for a while, it's not such an inconvenient workaround.

Set windows size of QuickLook Plugin

I'm building a QuickLook plugin. I want to change the width of the windows that pops up when user hits the spacebar.
I've read there are two keys in the info.plist file of the project where height and width are customisable. Even if I change those values I can't get the size of the preview windows to my desired one.
I don't know what else to try. Any idea?
Thanks!
Thought I'd dig a little on this. I have not tried any of the following suggestions, so nobody get their hopes up. I'll assume you're using the generator callback:
OSStatus (*GeneratePreviewForURL)(
void *thisInterface,
QLPreviewRequestRef preview,
CFURLRef url,
CFStringRef contentTypeUTI,
CFDictionaryRef options
);
Before anything else, you might manually check the options dictionary argument and verify that the kQLPreviewPropertyWidthKey and kQLPreviewPropertyHeightKey keys are indeed mapped to the desired CFNumber values.
Referring to each of these properties, the Apple QuickLook programming guide says:
Note that this property is a hint; Quick Look might set the width
automatically for some types of previews. The value must be
encapsulated in a CFNumber object.
(Edit: If your preview representation is flexible, you might try finding a preview type for which QuickLook honors your size hints, as per the statement above. Just a thought.)
Running nm on the QuickLook framework binary revealed some undocumented kQLPreviewProperty-- constants as well as the aforementioned width and height keys. One that caught my attention was kQLPreviewPropertyAutoSizeKey. Recalling Apple's statement about ignoring the hints to set the size automatically, this might be significant? Following the convention in QuickLook.framework/Headers/QLBase.h, you might try declaring
extern const CFStringRef kQLPreviewPropertyAutoSizeKey;
Then you could try associating a CFNumber 0 with that property key in the options dictionary. There are other undocumented keys of note, such as kQLPreviewPropertyAttributesKey.
Back to the Info.plist you mentioned, Apple says about those keys QLPreviewWidth and QLPreviewHeight:
This number gives Quick Look a hint for the width (in points) of
previews. It uses these values if the generator takes too long to
produce the preview. (emphasis added)
This is where someone makes the terrible suggestion of calling sleep() in your generator. But I'm perplexed as to why Apple would make following the size hints dependent on the generator latency. (?)
Edit: Also note the above statement says the Info.plist hints must be expressed in points (not pixels), a unit dependent on the user's screen resolution.
Recently I was developing a Quick Look Plugin myself which uses HTML+CSS and faced the same problem.
The solution for my was to test the plugin not within Xcode and qlmanage as the executable but instead to try the real .qlgenerator from my user library.
When invoking the generator from my user library, the Quick Look window was resized exactly the way I specified in the *-Info.plist.
I've run into the same problem, and may offer some clues: In my case I'm generating an image quick look preview for my custom file format. I initiate the preview context to draw my preview into using
CGContextRef QLPreviewRequestCreateContext(QLPreviewRequestRef preview, CGSize size, Boolean isBitmap, CFDictionaryRef properties);
The curious thing is that if I set isBitmap to true, quick look adjusts the preview panel size to the size specified for the context (up to a certain size at least). But if you set isBitmap to false, it seems to disregard the context size and instead always shows a full size preview panel with the vector graphics image scaled to cover the entire panel.
So, if you use a bitmap graphical preview context, it seems the preview panel will be set to the size of the context you specify. However, I haven't found any way to set the size of the panel when using a vector graphic preview context (which is what I want).

Rendering a GSP in grails as PDF via a Quartz Job problems

Has anyone had success in Grails 1.3.7 rendering gsps inside a quartz job?
I'm having a tough time getting it to work, tried various options including the template engine plugin, and the renderer plugin.
The Grailstemplateengine plugin doesn't get far at all, when the call is made to render, I get:
No signature of method: GrailsTemplateEngineService.renderWithTemplateEngine() is applicable for argument types: (java.lang.String, java.util.LinkedHashMap) values: [/reports/templates/product_summary, [model:net.dbws.ieur.ProductSummaryModel#356eb0]]
Renderer plugin looks to be getting the furtherest except it seems to not control its own output correctly, calling pdfRenderingService() appears to be outputting the rendered PDF to standard out, as I'm seeing the content output in the IDE's output window, rather than rednering to its own byte array. And its raising an exception as its doing some kind of illegal cast as mixed in the output I can see 'java.io.ByteArrayOutputStream' to class 'java.lang.Number' [See nested exception: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '%PDF-1.4'
So if anyone had success rendered gsps from within a quartz job, i'd love to know how you did it.
Thanks,
Ok found issue.... The docs for the grails template engine were totally out of date and incorrect.. it should have been calling 'renderView' not renderWithTemplateEngine

Require CoreTelephony framework examples

Greetings everyone.
Can any one has a working example for the CoreTelephony framework? I dumped all the CoreTelephony headers using class-dump and added them to "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework". Now I'm following the Erica's tutorial (http://blogs.oreilly.com/iphone/2008/08/iphone-notifications.html).
I added these following lines of code in my main.m,
id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(
ct,
NULL,
callback,
NULL,
NULL,
CFNotificationSuspensionBehaviorHold);
but I'm getting a warning like,
Implicit declaration of function "CTTelephonyCenterGetDefault()" and "CTTelephonyCenterAddObserver(...)".
Can any one has full working example, which will explain how to get the CoreTelepony notifications?
I have been successfully using this private framework. The warnings will not prevent your code from running, but you could put the following declaration in your code to get rid of the warning on CTTelephoneCenterGetDefault():
id CTTelephonyCenterGetDefault();
(you can do something similar for the CTTelephonyCenterAddObserver() warning, if you like)
I Did managed to get this framework to work partially - i still have some functions that i don't know their exact API - is there somewhere a full description of all the functions in this framework?
The warning "Implicit declaration of function" means that the compiler cannot find a definition for the function in the header.
If the functions are defined in the header then you most likely did not import them correctly.
I would also note that you should not put any code in the main.m of an iPhone app. Most of the important code does not load until UIApplication is launched. Put the code in the application delegate's applicationDidFinishLaunching: instead.
even using http://www.alexwhittemore.com/?p=281 - Open Tool Chain for 3.0 sdk (last tool chain i'd found) - i couldn't have CoreTelephony working - so it's seams to be impossible in last Xcode's/SDK's
You can find the coretelephonyframework example here!