When learning about GUIDs, it feels like 39 measly digits aren’t enough. Won’t we run out if people get GUID-crazy, assigning them for everything from their pets to their favorite bubble gum flavor?
Let’s see. Think about how big the Internet is: Google has billions of web pages in its index. Let’s call it a trillion (10^12) for kicks. Think about every wikipedia article, every news item on CNN, every product in Amazon, every blog post from any author. We can assign a GUIDfor each of these documents.
Now let’s say everyone on Earth gets their own copy of the internet, to keep track of their stuff. Even crazier, let’s say each person gets their own copy of the internet every second. How long can we go on?
Over a billion years.
Let me say that again. Each person gets a personal copy of the internet, every second, for a billion years.
It’s a mind-boggling amount of items, and it’s hard to get our heads around it. Trust me, we won’t run out of GUIDs anytime soon. And if we do? We’ll start using GUIDs with more digits.
Copied from: [The Quick Guide to GUIDs]
This is my bookmark about webservice protocol which genereated by Diigo when I investigate about them.
Soap introduction at W3C
What is SOAP?
- SOAP stands for Simple Object Access Protocol
- SOAP is a communication protocol
- SOAP is for communication between applications
- SOAP is a format for sending messages
- SOAP communicates via Internet
- SOAP is platform independent
- SOAP is language independent
- SOAP is based on XML
- SOAP is simple and extensible
- SOAP allows you to get around firewalls
- SOAP is a W3C recommendation
HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
“When to Use REST”
tags: REST webservice
The web services are completely stateless
A caching infrastructure can be leveraged for performance
However, the developer must take care because such caches are limited to the HTTP
GET method for most servers.
Bandwidth is particularly important and needs to be limited. REST is particularly useful for limited-profile devices such as PDAs and mobile phones
So this means areas that REST works really well for are:
- Limited bandwidth and resources; remember the return structure is really in any format (developer defined). Plus, any browser can be used because the REST approach uses the standard GET, PUT, POST, and DELETE verbs. Again, remember that REST can also use the XMLHttpRequest object that most modern browsers support today, which adds an extra bonus of AJAX.
- Totally stateless operations; if an operation needs to be continued, then REST is not the best approach and SOAP may fit it better. However, if you need stateless CRUD (Create, Read, Update, and Delete) operations, then REST is it.
- Caching situations; if the information can be cached because of the totally stateless operation of the REST approach, this is perfect.
if you have the following then SOAP is a great solution:
- Asynchronous processing and invocation; if your application needs a guaranteed level of reliability and security then SOAP 1.2 offers additional standards to ensure this type of operation. Things like WSRM – WS-Reliable Messaging.
- Formal contracts; if both sides (provider and consumer) have to agree on the exchange format then SOAP 1.2 gives the rigid specifications for this type of interaction.
- Stateful operations; if the application needs contextual information and conversational state management then SOAP 1.2 has the additional specification in the WS* structure to support those things (Security, Transactions, Coordination, etc). Comparatively, the REST approach would make the developers build this custom plumbing.
Amazon has both SOAP
interfaces to their web services, and 85% of their usage is of the REST interface.
Posted from Diigo. The rest of my favorite links are here.
1. What is FrameBuffer?
- A Framebuffer (or sometimes Framestore) is a video output device that drives a video display from a memory buffer containing a complete frame of data.
- The information in the memory buffer typically consists of color values for every pixel (point that can be displayed) on the screen
- Color values are commonly stored in 1-bit binary (monochrome), 4-bit palettized, 8-bit palettized, 16-bit highcolor and 24-bit truecolor formats. An additional alpha channel is sometimes used to retain information about pixel transparency.
- With a framebuffer, the electron beam (if the display technology uses one) is commanded to trace a left-to-right, top-to-bottom path across the entire screen, the way a television renders a broadcast signal
1.2 Display mode
- Framebuffers used in personal and home computing often had sets of defined "modes" under which the framebuffer could operate. These modes would automatically reconfigure the hardware to output different resolutions, color depths, memory layouts and refresh rate timings. In the world of Unix machines and operating systems, such conveniences were usually eschewed in favor of directly manipulating the hardware settings.
- Modern CRT monitors introduces a "smart" protection circuitry. When the display mode is changed, the monitor attempts to obtain a signal lock on the new refresh frequency. If the monitor is unable to obtain a signal lock, or if the signal is outside the range of its design limitations, the monitor will ignore the framebuffer signal and possibly present the user with an error message.
- LCD monitors tend to contain similar protection circuitry, but for different reasons. Since the LCD must digitally sample the display signal (thereby emulating an electron beam), any signal that is out of range cannot be physically displayed on the monitor.
1.3. Color Palette
- Framebuffers have traditionally supported a wide variety of color modes. Due to the expense of memory, most early framebuffers used 1-bit (2 color), 2-bit (4 color), 4-bit (16 color) or 8-bit (256 color) color depths. The problem with such small color depths is that a full range of colors cannot be produced. The solution to this problem was to add a lookup table to the framebuffers. Each "color" stored in framebuffer memory would act as a color index; this scheme was sometimes called "indexed color".
- The lookup table served as a palette that contained data to define a limited number (such as 256) of different colors. However, each of those  colors, itself, was defined by more than 8 bits, such as 24 bits, eight of them for each of the three primary colors. With 24 bits available, colors can be defined far more subtly and exactly
- The data from the framebuffer in this scheme determined which of the  colors in the palette was for the current pixel
- The framebuffer’s output data, instead of providing relatively color data, served as an index – a number – to choose one entry in the lookup table.
1.4. Virtual Framebuffers.
- Many systems attempt to emulate the function of a framebuffer device, often for reasons of compatibility. The two most common "virtual" framebuffers are the Linux framebuffer device (fbdev) and the X Virtual Framebuffer (Xvfb)
- The Linux framebuffer device was developed to abstract the physical method for accessing the underlying framebuffer into a guaranteed memory map that is easy for programs to access. This increases portability, as programs are not required to deal with systems that have disjointed memory maps or require bank switching.
Pixels – corresponds to actual pixels on the screen.
Density-independent Pixels – an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.
Scale-independent Pixels – this is like the dp unit, but it is also scaled by the user’s font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user’s preference.
In my experience, never use px in android xml layout file (except special case). You should use dp unit instead. Since sp unit is preferred to the font size which was set on real device by user, you should use this measurement when defining text size. But, never use it for layout size.
What is android intent?
Android folds multiple ideas into the concept of an intent. You can use intents to invoke other applications from your application. You can use intents to invoke internal or external components from your application. You can use intents to raise events so that others can respond in a manner similar to a publish-and-subscribe model. You can use intents to represent actions.
At the simplest level, an intent is an action that you can tell Android to invoke. The action Android invokes depends on what is registered for that action. (Pro Android – Apress)
Register an activity as android intent?
In this section, I want to describe a way to register an activity as an android intent.
If you don’t know how to add an activity, please read my post here. Suppose that you created an activity name MyActivity. Now, open AndroidManifest.xml file, choose the tab AndroidManifest.xml to edit it manually. Add action and category element inside your activity element as below image.
The general convention for an action name is <your-package-name>.intent.action.YOUR ACTION NAME
From now, whenever you need to use your intent, you can invoked it such as below:
String actionName = “sandbox.basic.activity.intent.action.ShowMyActivity”;
Intent newIntent = new Intent(actionName);
There are some ways to declare a new activity in android. But in this section, I just want to describe an simplest way to do it.
– Open the AndroidManifest.xml file then follow below steps to add new activity.
– Look at the Attributes for Activity section at right side, click Name to create a new class or Browse to choose an existing class. This class will contain code-behind of this activity and it must inherit from Activity class under android.app.Activity namespace. Also you can configure other properties for you activity such as orientation, theme, label…
– Right click on Layout folder, choose new > Android XML File. In the new Android XML File dialog, type the class name then hit button Finish. Note that the layout file name must end with “.xml” and just contains a-z, 0-9 character.
– Open MyActivity.java file, edit the OnCreate method as below image.
Now, whenever MyActivity is invoked, it load the myactivity.xml layout to the screen.
Years ago, when I was younger
I kinda liked a girl I knew
She was mine and we were sweethearts
That was then, but then it’s true
I’m in love with a fairytale
Even though it hurts
‘Cause I don’t care if I lose my mind I’m already cursed
Every day we started fighting
Every night we fell in love
No one else could make me sadder
But no one else could lift me high above
I don’t know what I was doing
When suddenly, we fell apart
Nowadays, I cannot find her
But when I do, we’ll get a brand new start
I’m in love with a fairytale
Even though it hurts
‘Cause I don’t care if I lose my mind I’m already cursed She’s a fairytale, yeah…
Even though it hurts ‘Cause I don’t care if I lose my mind I’m already cursed