How can fixe the probel of saving gganime file that is related to using the old API? - ggplot2

My code is following:
p <- ggplot() +
geom_sf(data = world, size = .1) +
geom_sf(aes(fill = SupDem), data = plotdata) +
scale_fill_viridis_c(option = "plasma") +
ggtitle("Democratic Support - {closest_state}") +
transition_states(Year)
anim_save("SupforDemAnim.gif", p)
The error:
Error: It appears that you are trying to use the old API, which has been deprecated.
Please update your code to the new API or install the old version of gganimate
from https://github.com/thomasp85/gganimate/releases/tag/v0.1.1

Related

Package ‘ggpattern’ is not available for R version 4.0.2

Is anybody able to tell me why the package "ggpattern" is not available for R version 4.0.2?
I'm using "geom_sf" to create a map and I want to add patterns instead of a simple color.
Is there an other way to do this other than using this package?
This is my code:
P <- ggplot(data = shpZone, aes(geometry = geometry)) + geom_sf (data = shpZone, fill = "blue") + geom_sf_text(aes(label = ID), size = 3)
P
Thank you!

How to get anchor point of SymbolItem

I can't figure out how to retrieve registration point that I see in properties panel transform section in script.
I use this script documentation http://ai.aenhancers.com/jsobjref/SymbolItem/
As far as I can tell they are just coordinates of the symbol's center. You can get them this way:
var symbol = app.activeDocument.selection[0];
var X = symbol.position[0] + symbol.width/2;
var Y = -symbol.position[1] + symbol.height/2;
alert("X: " + X + "\n" + "Y: " + Y);

codename one push notification meet error "javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure"

We have a web project which is always working fine, it just using codename one push api to push notification to our devices, but it suddenly get the following error:
javax.net.ssl.SSLHandshakeException: Received fatal alert:
handshake_failure
Below is the core code (same with codenamoe one demo)
HttpURLConnection connection = (HttpURLConnection)new URL("https://push.codenameone.com/push/push").openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
String cert = ITUNES_DEVELOPMENT_PUSH_CERT;
String pass = ITUNES_DEVELOPMENT_PUSH_CERT_PASSWORD;
if(ITUNES_PRODUCTION_PUSH) {
cert = ITUNES_PRODUCTION_PUSH_CERT;
pass = ITUNES_PRODUCTION_PUSH_CERT_PASSWORD;
}
String query = "token=" + PUSH_TOKEN +
"&device=" + URLEncoder.encode(deviceId1, "UTF-8") +
"&device=" + URLEncoder.encode(deviceId2, "UTF-8") +
"&device=" + URLEncoder.encode(deviceId3, "UTF-8") +
"&type=1" +
"&auth=" + URLEncoder.encode(FCM_SERVER_API_KEY, "UTF-8") +
"&certPassword=" + URLEncoder.encode(pass, "UTF-8") +
"&cert=" + URLEncoder.encode(cert, "UTF-8") +
"&body=" + URLEncoder.encode(MESSAGE_BODY, "UTF-8") +
"&production=" + ITUNES_PRODUCTION_PUSH +
"&sid=" + URLEncoder.encode(WNS_SID, "UTF-8") +
"&client_secret=" + URLEncoder.encode(WNS_CLIENT_SECRET, "UTF-8");
try (OutputStream output = connection.getOutputStream()) {
output.write(query.getBytes("UTF-8"));
}
int c = connection.getResponseCode();
// read response JSON
I directly run the code in unit test, it works well.
But when I call the function from project (such as a button from webpage), the error happened.
I tried several way to solve it but still can not work, please give me some suggestion to fix the issue. Thank you!
This generally happens if the certificate is invalid or out of date etc. It can happen if your connection. I just verified our SSL certificate on the push servers and it's valid (generated by cloudflare) so I suggest checking the routes to the server and your version of Java. You should have Java 8 or newer with a recent enough minor update version.

Issue in creating a raw bitcoin transaction(single input and single output)

When signing a transaction,I have copied the scriptPubKey from previous referenced transaction (for script field in input) and appended the hash-type.
Then in the original transaction,I have replaced the script with scriptSig and removed the hash-type.
Raw Transaction.
But,when I check the transaction is coinb.in,it says that the transaction is not signed.
The code I'm using to generate is inspired from Ken Shirriff's blog and Shlomi's video on youtube
My version of the code can be found here
Snippet which populates the transaction is here:
def get_real_transaction(self,account):
sigscript = self.generate_sig_script(account)
self.real_transaction = ""
self.real_transaction = (
self.version
+ self.txn_inputs_count
+ self.txn_inputs[0]["output_hash"]
+ self.txn_inputs[0]["output_index"]
+ self.txn_inputs[0]["sigScriptBytes"]
+ self.txn_inputs[0]["sigScript"]
+ self.txn_inputs[0]["sequence"]
+ self.txn_outputs_count
+ self.txn_outputs[0]["value"]
+ self.txn_outputs[0]["scriptPubKeyBytes"]
+ self.txn_outputs[0]["scriptPubKey"]
+ self.locktime
)
return self.real_transaction
Entire transaction.py is here
Any guidance/hints will be extremely helpful.

how to obtain version of app?

Is there a way to obtain a version number of a Titanium app?
e.g when installed on an iOS device then perhaps obtain the CFBundleVersion and when installed on Android then obtain its version number.
UPDATED: I was looking in the Titanium.Platform documentation for the app version number. The app version number is under Titanium.App.
Here is my code for sending the version number of my app to the server, so that the server can provide different content depending on the app-version-number.
function obtain_request_header() {
var caps = Titanium.Platform.displayCaps;
var s0 = 'appversion=' + Titanium.App.version;
var s1 = 'osname=' + Titanium.Platform.osname + ',name=' + Titanium.Platform.name + ',version=' + Titanium.Platform.version + ',model=' + Titanium.Platform.model;
var s2 = 'width=' + caps.platformWidth + ',height=' + caps.platformHeight + ',dpi=' + caps.dpi;
return s0 + ',' + s1 + ',' + s2;
}
To obtain the version of your application regardless of OS, simply use:
Titanium.App.version