Find the limit of shared object - actionscript-3

I have been trying to play around with shared object , I need to alert the user what i am going to save in shared object , but whenever i call flush() i cant get the current limit of storage i.e as of now 100 KB. is there any way to get the current limit of shared object for a particular domain ?
i even tried flush status , but flush status is created only after it shows up the security panel , i need to know the limit even before flush calls the security panel.
i need data just like this have the limit
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html

SharedObject.size will return current size of data on disk.
You can't get current limit, but I'm 95% sure you do not need it. Instead you can use SharedObject.flush(128*1000*1000) to request unlimited space once.

Related

Telegram api. Get all uploaded photos by media_group_id

I send to my telegram bot a few photos as group. How I can get the file_id all of my uploaded photos?
I use webhooks, but response is not contain any data about all photos, just some data about last uploaded photo and media_group_id. How I can get all file_id's of my uploaded group photos
response:
The Telegram Bot API does not give to your web-hook any reliable information about the order of each item in a media group. https://core.telegram.org/bots/api#message
Suggestions:
If bot is in a private chat, save the incoming file_id against their media_group_id. Whenever media_group_id changes you would have all you need to use. Engage the user in some other way so that you can quickly determine the media_group_id change and respond quickly from that processing.
If bot is in a group chat, save incoming file_id against the users id as well as media_group_id and similarly monitor changes to media_group_id and user id to take action.
When a solution starts getting too complex for my liking, I prefer to go back to the basic reason for my need and perhaps find out that I do not need to do something an API doesn't afford like "Get all uploaded photos by media_group_id". Maybe I can just process them individually as the updates stream in.
Tip: If the media group has a caption and you only care about the first media item in the group, then monitoring the media_group_id and caption of an incoming message should be sufficient.
if(message.caption != null && message.media_group_id != null){
// first item in new group received
}
Okay, this way is not simple and not elegant but it's working.
We need to see in webhook response media_group_id element - this means that this is a group of media.
If the first point is true - save the data about this media on own server (data must be contain media_group_id)
example: ["media_group_id" => [[some data about photo]]]
When next webhook is come, we need to see his media_group_id, if it's the same - ok, add him to array...
example: ["media_group_id" => [[some data about photo],[some data about photo]]]
if not - ok, make a new element of array:
example: ["media_group_id" => [[some data about photo]], "media_group_id2" =>
[[some data about photo]]]
So we got an array that contains all data about the photos of the one(or more) group.
hmmm... I don't like this way, but how make better?
In Pyrogram, we can use the get_media_group function, https://docs.pyrogram.org/api/methods/get_media_group.html#pyrogram.Client.get_media_group. in my opinion, it is much better than using BOT API.

SSIS Kingswaysoft CRM Destination Update Error .. ExecuteMultiple Request batch size exceeds the maximum.. Err -2147220715

When using a flat file to update a field on the account entity, no matter what I put in for Batch size I get that number of rows that get the below error:
ExecuteMultiple Request batch size exceeds the maximum batch size allowed!(Error Code: -2147220715)
For example, I'm using a file with 450 updates. If I leave the batch size at 200, I get 200 of the above errors and the rest process fine. If I set the batch size to 10, I get 10 errors and the rest are fine.
If I select the Enable Multithreaded Writing, I still get the same results even if I update the "use up to" to more than one.
I know I could just set the batch size to 450 or more, but when this runs for real, we'll need to update 10s of thousands.
Using CRM Destination V9.2
Am I missing a setting somewhere?
For this error message, are you currently using “Update All” as the Handling of Multiple Matches? If that is the case, this might be the cause of this problem, since you have too many duplicates in your target system that matches the input. You can either remove those duplicates or you can change the option to “Update One” to handle this situation. Hope this helps.

List request page size being ignored

I've been working with the drive SDK for the last few days and previously I was able to request 1000 items on a page using listrequest. Now I'm only getting 100 files no matter how high I set the parameter, but if I set it below 100 it will return whatever number. Did they decide to change the max results overnight or something?
I'm facing the same problem so I've been doing some tests and this is what I've found:
If I try files.list with fields: "files, nextPageToken", I get 100 files only.
If I try files.list with fields: "files(name, id, etc, parents), nextPageToken", I get 460 files.
If I try files.list with fields: "files(name, id, etc), nextPageToken" without parents field, I get 1000 files.
If I try files.list with fields: "files(parents), nextPageToken", I get 460 files.
So it seems that depends on how many fields you request and also if one of the fields requested is parents field.
You've misunderstood what pagesize does. It is a maximum value, not an absolute value. You should always iterate list results until nextPageToken is null.
Ok never mind I figured this out. I was requesting all the metadata of each file, which seems to limit the request to 100. I was able to get 1000 per page by requesting only three fields.
EDIT by pinoyyid: This is not the answer. There is nothing that you can do to guarantee that the page will have exactly pageSize items.

Creating a URL that will randomize at intervals and remove access to past URLs

Okay, I know this question has been half answered around here, but I'll explain in full and see if there maybe a better way to handle this then in just two parts.
I'm building an HTML5 voting site, that will close voting every half hour. And then open a new batch of voting.
What I need to do, is have the URL of this site be 'masked' ie:
have a random URL for it be generated that leads to the same location- so say I'm directing users to voting.com, I want them to only access it via the url votingstuff.com/hg67, and have that end portion be changed every half hour- and once the new url is generated, remove access to the site via the old URL.
I might add that after the user votes, I'd also like to close their voting access until the new URL is posted. AKA- everyone only gets one chance to vote.
Thoughts? Libraries to check out? Sites that do this? I know the randomization has been answered a few times, but usually it's a generator led to by a page, I want to START with a randomly generated URL, and not have a page that creates it as a function. I may have to write code that generates the page I guess?
Here is an approach I can think of -
You don't need to handle multiple URL's, you can achieve this on the same URL itself by enabling/disabling access to the URL content every hour.
You will need some action on your application/server side as well. For reference lets assume you have a PHP server running. You will need some table that holds a status setting for you, something like this -
Settings Table
id settingCode value
=============================
1 votingOpen 1
You will also need to setup a cron job on your server that will run every half an hour. The cron job's task would be to run every half an hour & change the value of the votingOpen to its inverse. So assume open your votings, initial value of the votingOpen field would be 1 i.e the first half an hour of voting starts.
Along with this you will start the cron job as well. Now what will happen is that after half an hour the cron job will fetch the value of votingOpen read it & if its 1, it will change it to 0 & if its 0 it will change it to 1. This will happen every half an hour on your server.
Now you need to make this votingOpen variable accessible on your client side code using a simple query to fetch its value. On each render of your voting page, on top somewhere you can check this value & if its 1 i.e true, you will write the logic to go ahead & show the voting page. But if its 0, you can redirect the user or show a different message on that page.
Lets say your voting happens on http://somedomain.com/voting, on the render logic of this page you can do something like this -
Voting View Logic
<?php
$votingOpen = {some database query that fetches the value from the database};
if($votingOpen) {
// your voting view resides here
} else {
// either redirect user to some other page
// or show some message like voting is closed on this same page.
}
?>
Limit multiple votes from one person
Normally the best way to handle this is a combination or registered user only vote + cookie/localStorage + IP tracking
But if you don't have registered user voting, you can still capture IP of user & allow only one vote per IP and you can also set a cookie or a localStorage variable in the users computer so he can only vote once.
Hope this helps.
Ref for Cron Job - http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428

Box API: Get_managed_users returning all users

Using the Box 1.0 REST API, I am trying to work with the functions in SOAP UI.
The API doc for get_managed_users with user_id=12345 (internal id retrieved with get_user_id call correctly) is returning all the users. The docs say that would be the case if you do not specify a user_id value. But my full command is: (Token and API key changed to protect the clueless)
https://www.box.com/api/1.0/rest?user_id=27360&auth_token=blahbalhblah1234&action=get_managed_users&api_key=someKeyYouShouldNotSee
Now I could work with the complete result list, but that won't scale as we get thousands of users into the system.
I can make a call with edit_managed_user, using the same user_id value and the change is reflected in the UI, and in the next get_managed_users call. Thus I do have the correct user_id value, I would so assume.
I tried testuser#gmail.com as the user_id value as well, and get the entire list back. This leads me to believe that somehow I am sending user_id wrong, but I just do not see it.
Any hints? Why, with what seems like a valid user_id value is it acting like it is absent or incorrect?
Most likely you have either called this method with an invalid user_id, or one that is not in your set of managed users. Can you double check that the user comes back in your list of already managed users?