Disable (or workaround) form rebuild with managed_file field

I’m using the Form API to create a custom form. It has a managed_file field and some other fields, some of which are required. If any of the required fields are not filled in, the file upload for the managed_file field doesn’t work, and produces an error informing the user to fill out the required field first before the image upload can process.

I’m assuming this is because the form is being rebuilt when the form uploads, but is there a way to stop it from checking for required fields? Surely there is a way, as node edit forms have this functionality working.

Here is my form code (simplified):

function create_event_form($  form, &$  form_state) {    $  form['event_image'] = array(     '#type' => 'managed_file',     '#upload_validators' => array(       'file_validate_extensions' => array('jpg jpeg gif png')     ),     '#upload_location' => 'public://event_images/',     '#required' => FALSE,   );    $  form['event_name'] = array(     '#type' => 'textfield',     '#title' => t('Event Name'),     '#required' => TRUE,   );    $  form['submit_button'] = array(     '#type' => 'submit',     '#value' => t('Create Event'),   );    return $  form; } 

If event_name field is empty when attempting to upload a file, the upload will not process.

api limit workaround

Are there any ways to avoid limitation for api calls (5/sec)?

I need the info about transactions and balance (of certain account), UTXOs and the ability to broadcast my transaction.

Currently I am using public blockchain explorers such as




However they have limits on their calls, which is unacceptable for cases if my service in use of at least 1000-2000 people.

I am begginer, so after some surfing I understood that the only way to tackle that issue is by saving the info in my own database or run my own full nodes (for each currency I have – eth/etc/bitcoin/btc/doge/dash.. etc) which might be pretty expensive and time-consuming.

Can you suggest any good solution?

Thank you!

RSS Feed HTTPS Workaround

I’ve been tasked to add RSS feeds to our SP site but am not myself permitted, or even able, to adjust the authentication on the server to allow for the use of an “https://” feed address. I need to use an “http://” address. I am using SharePoint 2013 Online and the RSS Viewer web-part.

What options exist that I could explore?

Google import contacts from CSV not working – workaround?

I’m trying to import contacts from my Microsoft Outlook (company server) to my Gmail, but whatever I try, it fails.

Even when I export my contacts in Gmail to a CSV and then try to import it again, Gmail gives the annoying error, saying it experienced an “unknown error”. Hence Google is not even accepting its own export as import format.

I don’t have the illusion that anyone is going to fix this specific problem, so my question is: does anyone know a workaround to migrate/import contacts to/in Gmail? Some tool somewhere maybe, other inspiration on how to migrate contacts from Outlook to Gmail?

CGPathContainsPoint broken in iOS 12? Is a workaround possible?

I will try to keep this short.

Take the following test code:

CGPath* path =  CGPathCreateMutable(); CGPathMoveToPoint(path, nil, 318.43, 183.47); CGPathAddCurveToPoint(path, nil, 322.98, 189.32, 327, 194.93, 329.81, 201.62); CGPathAddLineToPoint(path, nil, 339.36, 182.58); CGPathCloseSubpath(path); CGPathMoveToPoint(path, nil, 327.8, 193.04); CGPathAddCurveToPoint(path, nil, 323.06, 193.04, 323.06, 185.5, 327.8, 185.5); CGPathAddCurveToPoint(path, nil, 332.54, 185.5, 332.54, 193.04, 327.8, 193.04); CGPathCloseSubpath(path); CGRect boundingBox = CGPathGetBoundingBox(path);  CGPoint testPoint = CGPointMake(200,185);  NSLog(@"path contains point=%d | bounding box contains point=%d",CGPathContainsPoint(path, nil,  testPoint, NO), CGRectContainsPoint(boundingBox, testPoint) ); 

This code returns correctly on iOS 10:

path contains point=0 | bounding box contains point=0

The same code on iOS 12 returns:

path contains point=1 | bounding box contains point=0

As you can see, on iOS 12 CGPathContainsPoint says my testPoint is inside the shape even if the bounding box of the shape says it is not.

Changing the fill rule to NO in CGPathContainsPoint does not change anything.

Is there a solution to this? I tried apple forums before but nobody seems to answer there.

Thank you for any help!

AWS SQS FIFO Limit Workaround

According to the AWS feature page for SQS:

FIFO queues support up to 300 messages per second

Standard queues support a nearly unlimited number of transactions per second (TPS) per API action.

I’m trying to build a system that will add notifications to a queue that will then be sent to a customers device using push notifications.

There will be a Lambda function that will read items off this queue and actually handle sending the message to the user.

Problem is, I’d like this system to be able to scale as efficiently as possible. Being constrained to 300 notifications per second might cause problems in the future. So I want to design this in a way that is much more scalable than that.

I have thought about building some type of system that will use a standard queue then check to see if that notification has already been sent by having a database that stores the ID of notifications that have been sent. Which might work. But at that point I think I’d be opening the door for race conditions. What happens if for the same notification two Lambda functions got triggered at the exact same time? Neither of them have been sent yet. And the user will send up with 2 notifications instead of one.

How can I design a system that has the best of both worlds? nearly unlimited number of transactions per second while ensuring that no duplicate notifications are sent.

I don’t think I mind quite as much if a Lambda function gets triggered twice for 1 notification, so long as it doesn’t get sent multiple times to the user. Of course if I can completely prevent this, that’d be awesome too, so that I can reduce cost.

I’d also love to keep using AWS and the more serverless technologies of AWS if possible. I know there is software and ways I could provision EC2 or other types of instances for this. But that takes out the huge advantage of serverless, which is what I’m really aiming for.

Workaround for no www.subdomain.domain coverage on wildcard cert

Edit: Would deleting the www.hungry.example.org DNS record be a good solution if there are no links to it?

I have a domain (example.org) and a subdomain (hungry.example.org). Until recently they had separate SSL Certificates and everything was nice and peachy.

We moved to Sucuri recently and they requested to replace these 2 certs with 1 wildcard certificate in order for the subdomain traffic to go through the firewall.

Our cPanel has the Let’s Encrypt Plugin which I used to generate a cert that covers *.example.org. It covers hungry.example.org, www.example.org, and example.org. Unfortunately; however, it does not cover www.hungry.example.org and users that navigate there will get a browser ssl misconfiguration error.

Things I’ve tried so far:

  1. Setting www.hungry.example.org as a CNAME to hungry.example.org

    Didn’t work, still getting ssl misconfiguration error when going to www.hungry.example.org

  2. Doing an .htaccess redirect from www.hungry.example.org to hungry.example.org

    Didn’t work, still getting ssl misconfiguration error when going to www.hungry.example.org

  3. I’ve thought about issuing a separate certificate for www.hungry.example.org to avoid the error, and then using one of the above methods to redirect all traffic to non-www and thus go through Sucuri. However, the Let’s Encrypt plugin doesn’t allow issuing a certificate for only www.hungry.example.org. It would also need to cover hungry.example.org which is already covered by the wildcard cert – and I’m worried that having two certs cover hungry.example.org isn’t a good configuration idea.

Any tips?

Workaround for no methods in namespace in C#

I am new to C# and have a difficulty with the code structure. My application has:

(1) GUI with button Show my Ethernet IP. When user clicks this button PC’s IP address is displayed.

(2) Class ModbusTCPSlaveMachine. Within this class I create TCPListenter and supply it with PC’s Ethernet IP address.

In both cases I get local IP address using the same method GetAllLocalIPv4. Right now I have 2 copies of this method in the code (in classes Form and ModbusTCPSlaveMachine) which is not good I guess. For example, in Python I would simply place the method in some utility module. I am aware that methods cannot be located directly in the namespace in C# while don’t quite understand why.

The option I can think of is to place this function in a separate class – some utility class containing a single method (based on Python experience). Not sure if this is reasonable solution in C# beacuse this utility class looks like a meaningless container to me.

How can/should I solve the problem?