If I have the free account,with a JAR size limit of 1mb,I want to understand
approximately what can or can't I do with this limit;Is this limit too small to make an app?I want that my app have access to camera,web browsers and that cointains images,few videos,a lots of documents??
The 1mb size applies to the jar sent to the server, this is around 6kb for a barebones application. All of our demos and many 3rd party apps in the stores fall under this limit which is generally a good approach.
It doesn't limit the size of the final application or 3rd party libraries used which means you can still use a large library like google maps without hitting this limit. If you use a very heavy theme or many images (within the app JAR not downloaded dynamically) you will hit this limit.
There is a bit of an overview here on how to shrink the JAR overhead https://www.codenameone.com/blog/shrinking-sizes-optimizing.html
Notice that I'm currently working on a fully functioning clone of the Uber application which is currently under 600kb.
Related
I'm creating a RESTful backend API for eventual use by a phone app, and am toying with the idea of making some of the API read functions nothing more than static files, created and periodically updated by my server-side code, that the app will simply GET directly.
Is this a good idea?
My hope is to significantly reduce the CPU and memory load on the server by not requiring any code to run at all for many of the API calls. However, there could potentially be a huge number of these files (at least one per user of the phone app, which will be a public app listed in the app stores that I naturally hope will get lots of downloads) and I'm wondering if that alone will lead to latency issues I'm trying to avoid.
Here are more details:
It's an Apache server
The hardware is a hosting provider's VPS with about 1gb memory and 20gb free disk space
The average file size (in terms of content and not disk footprint) will probably be < 1kb
I imagine my server-side code might update a given user's data once a day or so at most.
The app will probably do GETs on these files just a few times a day. (There's no real-time interaction going on.)
I might password protect the directory the files will be in at the .htaccess level, though there's no personal or proprietary information in any of the files, so maybe I don't need to, but if I do, will that make a difference in terms of the main question of feasibility and performance?
Thanks for any help you can give me.
This is generally a good thing to do: anything that can be static rather than dynamic is a win for performance and cost (it's why we do caching!), but the main issue with with authorization (which you'll still need to do for each incoming request).
You might also want to consider using a cloud service for storage of the static data (e.g., Amazon S3 or Google Cloud Storage). There are neat ways to provide temporary authorized URLs that you can pass to users so that they can read the data for a short time and then must re-authorize to continue having access.
I create a photo-gallery site. I want an each photo to have 3 or 4 instances with different sizes (including original photo).
Is better to resize a photo on client-side (using Flash or HTML5) and upload all the instances of this photo to a server separately? Or it's better to upload a photo to a server only one time, but resize it using server resources (for example GD)?
What would be your suggestions?
Also it's interesting to know, how does big sites do this work? For example 500px.com (this site for each photo creates 4 instances and all works fast enough) or Facebook.
There are several schools of thought on this topic, it really comes down to how many images you have an how likely it is that the images will be viewed more than once. It is most common for all of the image sizes to be created using a tool like Adobe Photoshop, GIMP, Sizzlepig or GD (locally or on A server, not necessarily the web server) then upload all the assets to the server.
Resizing before you host the image takes some of the strain off of the end-user's web browser and more importantly reduces the amount of bandwidth required to host the site (especially useful when you are running a large site and paying per GB transferred)
To answer your part about really big sites, some do image scaling ahead of time, others do it on the fly, but typically it's done server side.
I am working on e-Shop project.
I my design for each product I need a picture with three sizes:
480 * 480
290 * 290
200 * 200
Which one is better ?
Asking e-Shop Admin to upload a picture for all above sizes.
Asking him to upload a picture with size 480 * 480 then generating other sizes via asp.net
Requiring your site admin to upload three separate images is simply pushing unnecessary work overhead onto the admin, and this generally results in them not bothering to create and upload three separate images for each product - resulting in an ecommerce site with missing images.
You're far better to use the technology to make the administrators life easier by requiring them to load a single image and automating the creation of the smaller sized images. Automating manual tasks is the whole point of the IT industry, and not doing so where possible kind of defeats the purpose of building these systems.
There's not really any issue with CPU usage as you only need to generate the 2 smaller images once at the point of loading, or not at all by using CSS to resize (this may not be optimal use of bandwidth). I'd go with creating the 2 smaller images either when it is uploaded by the admin and storing it in a cache, or creating them on the fly upon the first time it is requested and then putting it into a cache.
Upload all three images - will reduce the CPU overhead. You can then use the processing power to enable your site to be more responsive.
In my opinion, preparing three sizes of the image is a time consuming process because it must be repeated for every product.
generating would be better.
on the other hand just uploading a big one and then showing small images with css class' can be useful. (if the visitor will see all the images all the time)
We're trying to add some kind of persistence in our app.
The app generates about 250 entries per second. Each of these entries belong to one of 2M files. For each file, we want to keep the last 10 entries, so we can look them up later.
The way our client application works :
it gets a stream of all the data
it fetches the right file (GET)
it adds the new content
it saves the file back (PUT)
We're looking for an efficient way to store this data that can scale horizontally as the amount of data we're getting is doubling every few weeks.
We initially looked at S3. It works fine, but becomes very expensive very fast (>$1000 monthly just in PUT operations!)
We then gave a shot at Riak. But it seems we can't get more than 60 write/sec on each node, which is very very slow.
Any other solution out there?
There are lots of knobs you can turn in Riak - ask the mailing list if you haven't already and we'll figure out a sane configuration for you. 60 writes/sec is not within the norm.
See: http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
What about Hadoop's HDFS spread over Amazon EC2 instances? I know each instance has a good amount of storage space, and you don't have to pay for put/get, only the inbound transfer.
I would suggest looking at CloudIQ Storage from Appistry. Its a fully distributed file store. Its accessible via a REST-based API, and can run on commodity hardware. You can define the number of copies retained on a file by file basis. It supports an Eventually Consistent model so you can balance file consistency with performance.
I'm developing a app with a list of products. I wanna let the user have 1 picture for each products.
Now, the problem is what to do next. I think that the best way is that the photos get sync when the user connect to their computer & itunes, and acces them from the app (something like: /photos/catalog/ref1.jpg.
The other option is put them on my sqlite database, but I worry that that get bigger. I have data + picture, data change a lot but pictures are rarely modified (if much, I expect the user take 2-3 new pictures each time).
I would just use the network connection available on the device, and not bother with sync through iTunes.
When you download the images, write them to the apps Documents folder, then load them from there. Network usage vs. disk space will be concern. Keep in mind some carrier networks can be crazy expensive for data transfer.
If the images are named with a systematic format, then you can maintain them by comparing the image identifiers against your data, pruning out the older or irrelevant ones.
Do the math and ballpark just how much disk space you think it would take for a local copy of all the images.