RestKit with ASIHTTPRequest - asihttprequest

Is it possible use RESTKit with ASIHTTPRequest?
I have been using ASIHTTPRequest but it seems to be deprecated and I read that RESTKit is the newer library. I just want to know if I can fall back to ASIHTTPRequest if I need to later.
Thanks

It is possible to use them together, but general you should be ok replacing ASIHTTPRequest with RESTKit. For a way to combine the two, you can see here:
ASIHTTPRequest backed RestKit object mapping

Related

How to create multiple USE statements in sniff

I'm working on a sniff for PHP_CodeSniffer 3.x. For example, the class declaration class NoInlineFullyQualifiedClassNameUnitTestInc extends \PSR2R\Base\AbstractBase should be split into a uses and class AbstractBase. The sniff detects similar issues for method signatures.
I believe the problem is that I'm generating and inserting multiple use statements at the same line (i.e., same token), but doing so in separate fixer->beginChangeset() ... fixer->endChangeset() sequences. The fixer treats multiple sets of changes to the same token as a conflict, and things get messy (and wrong).
The GitHub issue is here: https://github.com/php-fig-rectified/psr2r-sniffer/issues/9
Has anyone figured out how to do this writing custom sniffs for the latest 3.x CodeSniffer?
You can also use SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff
It turns this
Into this
How to use it?
The best is to use it with EasyCodingStandard like this:
# easy-coding-standard.neon
checkers:
- SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff
Install it:
composer require --dev symplify\easy-coding-standard
Run it:
vendor/bin/ecs check src
Fix it:
vendor/bin/ecs check src --fix
Enjoy and let me know how it works for you.
If any troubles come up, just create an issue here. I'm happy to improve this tool as much as possible.
The problem is multiple Sniffer (fixer) changesets editing the same token. I was able to get the Sniff to work by collecting a list of USE statements and inserting them at the end of the Sniff's processing.
I identified the end of processing by searching backwards from the last token to find the first token of the list of registered tokens.
Edit: Here is the sniff: https://github.com/php-fig-rectified/psr2r-sniffer/blob/master/PSR2R/Sniffs/Namespaces/NoInlineFullyQualifiedClassNameSniff.php

JSON.NET without classes

I have a component that acts as a middle man between 2 web services. Both of them communicate using JSON.
The data that goes back and forth from the web services is very similar. However, it does need to be massaged a little.
I currently have this working by deserializing the JSON, build a new JObject and serialize it. It seems like there should be better way.
I'm looking at JsonConvert, JsonConverter, JsonSerializer, JsonReader, etc. trying to see if there's a better way to do this.
Any guidance on what classes to use/override to make this process more efficent?
Thanks!
You can write a custom JsonConverter using the approach described in the documentation, so you'll only have one concrete class, but this class can translate to a slightly different JSON representation of your object.
Another, more verbose, blog post about writing custom JsonConverters can be found here: http://blog.maskalik.com/asp-net/json-net-implement-custom-serialization/

multipart/mixed support in Netty

By browsing the source code and playing with some toy examples I got to the conclusion that Netty currently (as of 5.0.0 alpha2) supports only multipart/form-data, but not multipart/mixed, at least not as specified in RFC1342 (sec. 7.2). It looks like mixed is supported inside a part in multipart/form-data though.
Is that really the case or am I missing something?
Since I get the very same question, I post here what could be an beginning of answear...
However, the current implementation seems to have 2 limitations:
1) it supports only multipart/form-data. I would like to also be able
to use multipart/mixed, which is very similar on the wire (see
http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html ). I think that
the encoder/decoder could be extended to understand multipart/mixed
and still create the same kinds of HttpDatas.
Yes, the current codec is focused on multipart/form-data. I shall be possible to extend or propose a new one (based on it probably) to enable the support of multipart/mixed.
The current codec was made based on user needs (mine in the beginning, others following). Since no one yet has requested a support for multipart/mixed, it was not coded, except for internal multipart/mixed code.
The reference is RFC1867.
As Netty loves contributions, you are more than welcome to propose yours ;-)
2) it seems that is it only possible to use efficient HttpDatas like
FileUpload if you are in multipart/form-data. I would like to be able
to add a FileUpload to the request, and by this way make the contents
of the file be the body of the request, without making it a multipart
request. I think this could be done by extending the Standard Post
Encoder to understand FileUploads.
This could a bit more complicated since it has to be done without multipart, which holds currently the FileUpload class.
Maybe a good direction could be to switch to ChunkFile or ChunkNioFile and to combine it with "your" HttpCodec or in your "HttpHandler" when doing the body request, in order to pass the content through the ChunkFile.
Hoping this helps you in the right direction...

Quartz 2D substitude for graphicsPort in SDK 10.10

The scenario:
I'm editing some CGImages and strangely enough until now I was first creating NSImages from those CGImages before drawing them. So I tried to change the code so that I would draw the CGImages directly in into NSGraphicsContext.currentContext().graphicsPort. As you see I'm using Swing here but the same problem goes for Objective-C I presume.
Having a look into the documentation I saw that graphicsPort will be deprecated in 10.10, but I couldn't find another way to the current CGContext from NSGraphicsContext nor is there a way to create the CGContext from an NSGraphicsContext.
The Question:
Does anybody know what the proper way to retrieve the context would be? If not - Is there a way to cast the graphicsPort's COpaquePointer, which apparently is an initialized NSPipeObject, to a CGContextRef? Although using code that has already been marked deprecated would be quite unsatisfactory I would consider it until there is a better solution.
After spending a half hour digging around for information on this, I realized I should just check out the header file for NSGraphicsContext. Turns out there's a new property on NSGraphicsContext that's apparently not documented yet: CGContext. The header also notes that this should be used instead of graphicsPort.

Make post request on GameMaker

I'am new to game maker, and now creating a very simple application, which should get some data from web server (in JSON), and display in special way on device. GameMaker looks to be useful to create this kind of cross-platfrom applications, but it is very difficult for me to find a good samples.
I need to make post request with two name-value pairs ("data", and "info"), and parse result from JSON.
Maybe, someone have a sample, how to do it?
Thanks.
If use GM Studio, use http_post_string, for other versions you have to use extensions.

Resources