Does facebook use comet or long polling for getting new stream and messages? - comet

I would like to know if there are any code references that I can follow to write a very simple example. Many posts or websites just talk about the technology.

Yes "it's a variation of Comet, specifically XHR long polling, and/or BOSH."
reference site:
https://www.facebook.com/note.php?note_id=14218138919

Related

Using Mysql in iOs App [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
My friend already has his own working web-site (selling some stuff). We have an idea to create the iOs app for the site to attract more people(for me - to gain some badly needed experience).
The UI is going to be simple, and there won't as many problems, as using the web-site's data. We need the app to have some data locally, so that people, who do not have an internet access, were able to use the app.
But, of course, we want the information in the app to be up-to-date, so I need to use MySQL data somehow (I mean, that if the person has an internet access, the app can use it and download some data, If not - the app must contain some data to show). To be honest, I want the app to be really good, so I have a question: What combination is better to use???
To use core data, create a data model(it is huge and it's difficult to reproduce it, a lot of classes to create). I can do it, but how to update the data then? =) Have no idea.
To create a sqlite database, then use something like php code to insert get and encode the data into json, then parse it.
Maybe I should connect to MySQL directly from the app and use it's data, because it's impossible to have same data locally?
Or just to parse it, using json or xml?
Please, help me guys, I need my app to be cool and robust, but I don't know how to do it. Maybe you can tell the better way to solve such a problem??
Generally you'll have to build a similar database inside your application using SQLite and import data from MySQL through some kind of API bridge. A simple way to do this data interchange is via JSON that encodes the record's attributes. XML is also a possible transport mechanism but tends to have more overhead and ends up being trickier to use. What you'll be sending back and forth is generally sets of key-value pairs, not entire documents.
Stick to Core Data unless you have an exceptionally good reason to use something else. Finding it irritating or different is not a good reason. It can be a bit tricky to get the hang of at first, but in practice it tends to be mostly unobtrusive if used correctly.
Unless you're writing something that's expressly a MySQL client, never connect directly to MySQL in an iOS application. Period. Don't even think about doing this. Not only is it impossible to secure effectively, but iOS networking is expected to be extremely unreliable, slow, and often unavailable entirely. Your application must be able to make use of limited bandwidth, deal with very high latency, and break up operations into small transactions that are likely to succeed instead of one long-running operation that is bound to fail.
How do you sync data between your database and your client? That depends on what web stack you're going to be using. You have a lot of options here, but at the very least you should prototype in something like Ruby on Rails, Django, or NodeJS. PHP is viable, but without a database framework will quickly become very messy.

To captcha or not to captcha [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I would like to know what do you think about adding captcha mechanisms to registration forms?
I notice that many sites don't use captcha mechanisms in their registration forms(examples: http://djdesignerlab.com/2010/04/14/25-cool-sign-up-and-login-form-designs/).
I would like to open this topic to see what people thinks.
I always thought that we should make our forms as secured as possible, but from another point of view there are many users out there that don't really have to much patience to fill a captcha at a registration page.
-Do you think adding this mechanism to a registration page can drastically drop the amount of registered users at long term?
-How dangerous can it be not including this mechanism at a registration page?
I setup captcha on my system for one main reason: To know that the user who register or is registered is actually human. Don't forget that captcha is not only used for registration and/or login security checks. SO, for example, have captcha if it senses that there's too frequent edit on the same question/answers in a very short time span. Captcha, in this case, is a check to see if the editor is human instead of a robot.
In essence, you have to make a good decision of where you will like to use captcha (if you're planning to use it) and how will it serve for your purpose.
Hope this helps.
I can't stand captcha's at all. I understand the need for checking against bots, but why should the legitimate end user have to pay the price in reading obfuscated words... that's my personal opinion.
I have seen some sites actually ask basic questions such as, "The colour of the sky is: " provided with a textbox and clue to the word length. Its a bit more on the fly but to be honest I have had no problem getting the right answer with the ones I have seen.
I refuse to implement it - its a big 'F U' to users. The only exceptions are those where numbers are required... these are much better as there is no casing involved, half the time with letter based captchas you can hardly tell which letter are uppercase or lowercase.
We've come a very long way in web accessibility, captcha's are sending us in the wrong direction. Recaptcha does serve a purpose I agree, but its still a captcha.
Danger is one thing, but the flood of SPAM you will get is another. I have seen situations where a commenting system was rendered useless because of the SPAM that was being added.
There are definitely issues with CAPTCHA's beyond simple inconvenience. There are accessibility issues with a lot of them. I prefer RECAPTCHA which does a really nice job of handling accessibility while performing a service at the same time.
There are other options out there, Akismet is a verification tool that does not require user input. I would recommend looking at that if you are trying to avoid the manual verification process.
I think it's a case by case situation. If your site is public and popular and bots could gain a financial value for a clever programmer by posting content to your site, then the captcha is the way to go.
If you find that your site does not get much traffic or it is on a private network, then there is no point to employ a captcha.
I would suggest going without it at first, then pull it out of your tool belt if spam becomes a problem.
Me and a few of my fellow small publishing friends created a private database to pool IP addresses and netblocks of known spammers. Some of us have removed our recaptcha integration in favor of backend IP check. Some backlink spammers are getting through, but its slowing down as the database gets larger. We've opened up the api so others can give it a try: http://www.spamerator.com
CAPTCHA? Fine. Set it up. But please make it human-friendly, like this one:
The letters are clear, big and readable. And if you don't use images, I have implemented a base64 one in addition.

Could CouchDB benefit significantly from the use of BERT instead of JSON? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I appreciate a lot CouchDB attempt to use universal web formats in everything it does: RESTFUL HTTP methods in every interaction, JSON objects, javascript code to customize database and documents.
CouchDB seems to scale pretty well, but the individual cost to make a request usually makes 'relational' people afraid of.
Many small business applications should deal with only one machine and that's all. In this case the scalability talk doesn't say too much, we need more performance per request, or people will not use it.
BERT (Binary ERlang Term http://bert-rpc.org/ ) has proven to be a faster and lighter format than JSON and it is native for Erlang, the language in which CouchDB is written. Could we benefit from that, using BERT documents instead of JSON ones?
I'm not saying just for retrieving in views, but for everything CouchDB does, including syncing. And, as a consequence of it, use Erlang functions instead of javascript ones.
This would modify some original CouchDB principles, because today it is very web oriented. Considering I imagine few people would make their database API public and usually its data is accessed by the users through an application, it would be a good deal to have the ability to configure CouchDB for working faster. HTTP+JSON calls could still be handled by CouchDB, considering an extra cost in these cases because of parsing.
You can have a look at hovercraft. It provides a native Erlang interface to CouchDB. Combining this with Erlang views, which CouchDB already supports, you can have an sort-of all-Erlang CouchDB (some external libraries, such as ICU, will still need to be installed).
CouchDB wants maximum data portability. You can't parse BERT in the browser which means it's not portable to the largest platform in the world so that's kind of a non-starter for base CouchDB. Although there might be a place for BERT in hovercraft as mentioned above.
I think it would be first good to measure how much of overhead is due to JSON processing: JSON handling can be very efficient. For example these results suggest that JSON is the fastest schema-less data format on Java platform (protocol buffer requires strict schema, ditto for avro; kryo is java serializer); and I would assume that same could be done on other platforms too (with erlang; for browsers via native support).
So, "if it ain't broke, don't fix it". JSON is very fast, when properly implemented; and if space usage is concern, it compresses well just like any textual formats.

Has using an acknowledged anti-pattern ever been proven to actually solve a problem, or be beneficial in any other way? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Has using an acknowledged anti-pattern ever been proven to actually work in a certain specific case? Did you ever solve a problem or gain any kind of benefit in one of your projects by using an anti-pattern?
My understanding of the "anti-pattern" concept is that it encompasses solutions that have drawbacks that only reveal themselves over the long term. Indeed, the primary danger associated with a lot of them---like writing spaghetti code with loads of global variables and gotos every which way, or tossing exceptions into the black hole of an empty catch block---is that they're seductive because they provide an expedient solution to an immediate problem.
EDIT to add: Because of that, sometimes you do derive benefit from these anti-patterns. Sometimes your calculation that you're writing throwaway code that no one will touch again is dead wrong and you wind up with maintenance programmers slandering your heritage and sexual hygiene, but other times you're right and that crummy shell script that's held together with baling wire and spit does the job you intended it to do and is then blessedly forgotten, saving you the considerable time and effort of putting together something decent.
Anti-Patterns are still so widely around just because they solve a particular problem (while creating 10 new ones). Also known as workaround. But how do they say? Nothing lasts longer than a makeshift.
In fact I believe we'd all be jobless if things had been done right from the beginning.
The biggest problem that it has solved in my experience is launching a new application.
When the dev team has scoped the new application thouroughly, the timeline to implement the correct solution is usually too much for management to bear. Therefore, oftentimes, you code to meet the timeline, rather than "correctness" of the solution to get to the launch date, (but have others coding the "correct" solution for the next rev), making it essentially "throw-away" code.
One software anti-pattern is Softcoding, also defined at the daily WTF. Softcoding happens when programmers put material that "should be" inside code into external resources.
I'm working with software that some might say is suffering from softcoding. External files drive the software. Those external files are a micro-language: they must be compiled to XML before the software can use them. This micro-language has its own tools.
But softcoding is always in the mind of the beholder.
Having the material in a micro-language with its own parser has made my life easier. One data source can generate many different outputs: In addition to the version that the main program uses, I am able to extract information into HTML, .csv, and other formats that our customers want. Other programs can generate code in the micro-language, making automation easier.
In our case, softcoding has been a useful pattern, not an anti-pattern.
There is a reason for calling it a pattern rather than a law.
I would surmise that almost everyone has at least one example of a place in code where exactly the wrong thing was done, and it turned out better in the long term than the "right" thing would have.
And a far longer list of examples of anti-patterns causing trouble.
I have used magic pushbuttons a number of times, out of ignorance or laziness, and sometimes it actually worked out just fine, and it turned out that I did not need the extra abstraction of proper MVC.
Duff's Device utilizes the Loop-Switch Sequence (AKA For-Case Paradigm) anti-pattern.

How do you stay on top of Microsoft's public information? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Microsoft is tearing down walls and barriers. Their product and project development process is becoming increasingly transparent. They are blogging all over the place and they are releasing open source code projects by the minute. While all this is great, it can be overwhelming!
People like Scott Hanselman are doing their best to keep up with all the information and clarifying stuff. Still it is virtually impossible to get any kind of complete picture of where Microsoft is heading and which projects that will last in the longer run. Projects lingers in beta stage (courtesy of the "Google Approach"), and information is spread in blogs, on Codeplex and elsewhere. And in the midst of everything new, we poor developers need to produce stuff and pick which projects to use.
I want to know how you handle all this? My own sources for good info is:
Trusty 'ol MSDN
Scott Hanselman (blog and podcast)
Various other bloggers like Glenn Block
Personally, I handle it by not caring. If one of my friends thinks something is important or cool, they'll link me. Beyond that, I don't have the time to worry about what Microsoft is doing this month/week/day.
I use Microsoft Communities. They are all listed on http://www.microsoftcommunities.com/. The orbs and ticker are cool, but I have never had them open for very long.
Channel 9 is usually buzzing about nearly everything they're up to. They're starting to do more podcasts, screencasts and interviews.
Channel 10 is more blurbs and videos but I find it suppliments Channel 9 nicely.
I always look at each new thing and try to figure out if this is something that is truly new and useful or is it something old in a new, shiny package.
For me personally I like to pick one thing and work on it for a while to learn it in a way that allows me to be effective at my job. If you try to "drink from the fire hose" you will retain little and only end up feeling overwhelmed.
Out of everything that Microsoft has released lately there are only two of things that I found to be pertinent and truly groundbreaking: WCF and LINQ. I have spent a lot of my time learning these technologies as I believe that they are the most relevant and useful.
Now none of this may be true for you - the trick is to figure out what is relevant to you and your goals and focus on those things.
I have had a lot of luck with the weblogs.asp.net main feed. It's an aggregation of all blogs on the site, including Scott Guthrie's and other Microsoft insiders, as well as a lot of non-Microsoft folks who are fairly serious technical bloggers.
The topics are definitely not just limited to ASP.NET, there is healthy coverage of .NET development and Microsoft technologies in general.
You can scan the headers of the blog posts, and themes jump out to you that point to what is "hot" and new in the Microsoft space.
The DotNet Rocks podcast is good. Not necessarily purely MS oriented though.