I've just started using RestKit, and got an issue when trying to create RKObject subclass; apparently, such class is not found, but this example http://mobile.tutsplus.com/tutorials/iphone/restkit_ios-sdk/ shows how to make it. I installed it and it seems to be working ok.
So I am wondering whether that class was removed and there is an alternative or am I doing something wrong here?
Yes, RKObject was removed. Here is an answer to the same question.
Related
I've just upgraded from Rails 5.0.0 to 5.1.1 and started getting a ton of deprecation warnings like this:
DEPRECATION WARNING: The behavior of changed_attributes inside of
after callbacks will be changing in the next version of Rails. The new
return value will reflect the behavior of calling the method after
save returned (e.g. the opposite of what it returns now). To
maintain the current behavior, use
saved_changes.transform_values(&:first) instead.
and this:
DEPRECATION WARNING: The behavior of attribute_changed? inside of
after callbacks will be changing in the next version of Rails. The new
return value will reflect the behavior of calling the method after
save returned (e.g. the opposite of what it returns now). To
maintain the current behavior, use saved_change_to_attribute?
instead.
I don't use those methods explicitely anywhere in my project and the warnings are pointing mostly at create and update calls on my models.
I believe it has something to do with my validations and after_update and after_create callbacks where I use confitions like if: { author_id_changed? } but I have no idea what to do with them.
I also believe the warning is related to this massive update to ActiveRecord.
Would appreciate any hand you can give with this.
UPD
This article helped alot!
Well, got around everything by running bundle update and updating the gems and also following this article and changing attribute_changed? calls in after_ callbacks (but not in before_ callbacks and validations) and switching from attribute_was to attribute_before_last_save.
For After callbacks, you can use saved_change_to_attribute?
For Before callbacks and validations, you can use will_save_change_to_attribute?
I hope this information will help!
I've done an upgrade to Rails 5.1.6 and have the same DEPRECATION warnings. If ever anyone still wants to solve this warning. Here are the steps I took:
Search all of your*_changed?
Changed this:
if name_changed?
...
if user_id_changed?
To this if it is inside after_* (after_save, after_commit, after_update, etc.) blocks:
if saved_change_to_name?
...
if saved_change_to_user_id?
AND to this if it is inside before_* (before_save, before_commit, before_update, etc.) blocks:
if will_save_change_to_name?
...
if will_save_change_to_user_id?
On my own opinion, this is quite tricky thing to change since we've been used to attribute_changed?. But change is good. The syntax also made more sense now.
You can change author_id_changed? to saved_change_to_author_id?
I'm new to developing and I'm teaching myself based on tutorials online, and Stanford lectures on iTunesU (I'm only 15).
I'm having two problems with an email form I'm trying to implement into my app. I took a screenshot, here is the link to it: http://tinypic.com/r/2utq05c/5
I've tried everything and just can't seem to get it to work. Any help is GREATLY APPRECIATED.
Thank you.
See that #end line? That ends the class implementation. You can only implement methods within a class implementation—i.e., between the #implementation line and its corresponding #end.
That isn't the only syntax error in that file. You also haven't finished writing your email method, so the method that you have after it is technically within it. Methods can't go within methods, so that's another error. The solution to that one is simply to finish the email method.
Is something like this possible? If so, could you point me in the right direction for learning how?
applicationx tries to run the method start() in dll_one.dll
dll_one.dll runs the command
applicationx tries to run the method run() in dll_one.dll
dll_one.dll doesn't have a method run() and hasn't prepared for such an occurance.
dll_one.dll asks dll_two.dll if it has a run()
dll_two runs run()
Basically, I want it so if dllA doesn't have a method that the application is looking for, it asks dllB. This is assuming, as well, that ApplicationX and dllB don't know anything about dllA and dllA kind of just appeared out of nowhere (I want dlls dynamically like a patch to my applications without having to rewrite ALL of the methods, properties, etc. in the dll and have everything else just routed to the old dll).
Any ideas? Keep in mind, I'm using vb.net so a .net reference is appreciated.
It seems like you're asking for a plug-in architecture for your app (except that "patch" part is bothering me). If so, you can try MEF, which solves this exact problem.
The specific thing you ask for isn't possible. You can't have a non-existent method call automatically re-routed to a different dll. You can't "run the method run() in dll_one.dll" unless you've compiled that code, and it won't compile if the method doesn't exist. You also can't compile code against dllB and then drop dllA in and have it intercept method calls. Reflection could conceivably solve part of your problem, but you'd not want to base your code around calling all methods by reflection - it'd be horrendously unperformant and not very maintainable.
As Anton suggests, a plugin approach might work. However, this would rely on you being able to specify up-front the interface for your plugin, which sounds like it would contradict your original requirement.
Another problem: if you'd not deployed dllA until later, how would your ApplicationX know to call method start() in dll_one.dll anyway? You'd surely need to re-deploy at least the base application for that part to work.
These kinds of problem are often best solved by having a more specific set of requirements to work to: what functionality are you likely to want to extend or change in the future? Could you support a common set of interfaces that allow extensibility via plugins, or can you need to redeploy encapsulated chunks of your application with new functionality? Is there UI involved or is this just to change back-end logic? Questions like this could help to suggest more viable solutions.
I'm trying to port a C++.NET (managed extensions) application to C++/CLI. However I'm not very strong with the syntax yet.
What I'm trying to do is to create a wrapper for a C Dll file.
To do this I'm using DllImport but I failed to found documentation on it's use. There are some problems due to changes of the syntax but I couldn't find out why yet.
The C++.NET line looks like this:
[DllImport("my.dll", CharSet = Ansi, CallingConvention = Cdecl, EntryPoint = "#10")]
static MY_STATUS CPPInit(MY_HANDLE *pLmxHandle);
The idea is to pass a reference of MY_HANDLE to the function which initializes it. One problem is that the keywords Ansi and Cdecl are unknown. I expect I need to put some class infront of them but it's a little hard without docs or samples.
The other thing I have is a function which returns a static string:
char *MyFunc();
Can I assume that it can be mapped to String^?
Thanks in advance.
thanks for the comment.
I thought to myself that I need to build a mixedmode library in order to avoid p/invoke. This just takes some time though.
Actually I solved the compile error in another way. Although I havn't tested it yet because I'm facing some 32/64 bit issues which I can't solve because of other bugs in Whidbey beta2.
My solution was to write the protype in the following way:
interior_ptr<MY_HANDLE> pMyHandle;
From what I understood it should give the function a reference (hence an address) to the dll function. Once I get to try it out I will see if my idea works.
Otherwise I will go for the following option (which i've been offered):
[Out] IntPtr p_MyHandle
Anyway I think the problem is solved because one of those should work.
When I'm using VB.NET to use subsonic, It seems to have problem marking records as Old and Clean. Whenever I query using ExecuteSingle or ExecuteTypedList, i need to manually MarkClean and MarkOld, else whenever I save it will save as a new record.
Am I the only one facing this problem ? I'm using SubSonic 2.2 btw.
I checked the source code of SubSonic.. and I found that the VB class generator doesn't implements the IActiveRecord. I think most likely is because VB.Net doesn't seem to support 're-implementation' of inheritance or whatever you call that...
So when I debug, I found that Utility.IsSubSonicType returns false (because the ActiveRecord class returns as IReadOnlyRecord, but IsSubSonicType checks for IActiveRecord and IRecordBase) and thus doesn't call the SetLoadState and MarkClean.
So I'm not sure if this is a bug or it is intentional. Any way to solve this?
When you use ExecuteSingle or ExecuteTypedList, you could be doing with a class that didnt have those properties, I think the intention is that you are populating a POCO and not (necessarily) an Entity or other ORM object.
ExecuteAsCollection and all of the .Load methods behave as you expect because they call SetLoadState() and/or MarkClean().
Personally, I dont face this problem because I use Subsonic purely as a (smart) DAL (CRUD Only) and my own entity layer takes care of things like dirty/new.
Yes, I had the same problem. MarkClean and MarkOld before setting properties and saving fixed the issue. see this