Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Wednesday, January 5, 2011

Google Buzz - let's mark some comments as not spam ;-) or how to unhide "hidden" comments ;-)

[this is translation from my blog post in Polish, so sorry for strange language ;-)]

I think Google Buzz is the best social network/system. FB is way too boring, Twitter with 140 characters is too cryptic for me, but Google Buzz is perfect.

But Google Buzz has some problems ;-) It can hide some comments......

After my investigation I think I found solution for this problem ;-) It will require some effort, but if you like your followers you may do some work for them ;-)

Lets start from some observation. All comments to your Buzz posts are visible in your stream when you are using API, but in web interface some comments disappear. You cannot see some comments on your profile (here is my profile ;-)).
But if you will go to your stream in GMAIL (by click on your profile in Buzz in GMAIL), what looks like this:



and will inspect comments with DOM Inspector or something similar (I was using Chrome developers tools) you will see that in DOM you have those invisible comments....

Here such post, on the first sight it looks that it has only 2 comments (sorry, it is in Polish, but we are interested only in this that here we can see only 2 comments):



But when we will inspect this with DOM inspector, we will see that one comment is hidden:



This hidden comment is differ from the rest of comments, it has additional class "zl", deleting of this class will cause that we will see this "invisible" comment:



How you can see this comment is crossed out, but visible.
But it isn't end yet.
If you will look into DOM, you will see that one of child nodes of node with this comment is:



So it has some "buttons", but those "buttons" aren't visible.
Inspecting other nodes we will find that one of those "buttons", exactly "Not Spam" is visible when we will add to this node class "xq":



When we will add this class, comment will look like this:



Now you may click Not Spam, and if you will do it, GMAIL will send request to URL
https://mail.google.com/mail/?ui=2&ik=<user_ID?>&rid=mail%3Ara.14bf.5.0&at=<some other user_ID?>&view=up&act=ra&rai=<post_ID>&raat=NOT_SPAM&_reqid=1783035&pcd=1&mb=0&rt=j

After click, this comment will change to:



And now the best part ;-) It will be visible for everyone who is able to see this buzz.

Now some code ;-)

If you have problems with Google Buzz and you want to be able to "restore" comments in way as I shown, here you will find some code.
You need to put it in address bar, or add it as bookmark and use this bookmark, when you will be on your stream view in GMAIL (my stream is visible on first image, to see your stream go to Buzz in GMAIL and click on your name :-)):
javascript:{var z=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("zl"); for (var i=0; i<z.length; i++) z[i].className=z[i].className.replace("zl",""); alert("unhide "+z.length+" items."); var z2=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("I0 Yc"); for (var i=0; i<z2.length; i++) z2[i].className=z2[i].className+" xq"; alert("added Not Spam to "+z.length+" items.");}

This is "delicate" or "subtle" version, which may don't work sometimes. In this case here you have more brutal way:
javascript:{var z=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("zl"); for (var i=0; i<z.length; i++) z[i].className=z[i].className.replace("zl",""); alert("unhide "+z.length+" items."); var z2=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("I0 Yc"); for (var i=0; i<z2.length; i++) z2[i].className=z2[i].className+" xq"; var z3=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("nH Yi"); for (var i=0; i<z3.length; i++) z3[i].className=z3[i].className.replace("Yi","Yf"); alert("unhide "+z3.length+" items."); alert("added Not Spam to "+z.length+" items.");}


Because GMAIL is dynamic, you should run this code several times, till you will not see 0 in each alert message :-)

Now you may click on Not Spam and mark comments as not spam :-)

Hope it will help somebody ;-)

Similar postsbeta
Buzz Troll Remover v0.3.2
How to get negative number from size() in LinkedList in Java? ;-)
OOo2GD - surveys results
I want my Android back!!!!
Programmers love to over complicate...

Saturday, May 22, 2010

Buzz Troll Remover v0.3.2

If you are using Google Buzz you might notice that Buzz lacks one feature. Hiding or blocking comments from some people under others peoples buzzes.

When you are following some popular person its almost sure that one or two commenter of buzzes from this person will be rude, unpleasant, too talkative or at least boring.
In other words, it is almost sure that you will meet an Internet Troll :-)

You may fight with it, but it isn't the best way, it is one of the worst. Internet trolls loves to fight and fighting with them gives them power.
So better way is to ignore, but ignoring is difficult when somebody writes unpleasant, rude or stupid comments.....
And in this place Buzz Troll Remover is :-)

You simply need to install it, and after this you will see in Buzz in your Gmail small [x] near name of each person in Buzz:



After you will see prompt with question if you really want to hide all comments from given person:



Movie below shows has it works :-)




Similar postsbeta
Google Buzz - let's mark some comments as not spam ;-) or how to unhide "hidden" comments ;-)
Calculation of SSD life time in EEE PC
Early access version of OOo2GD 1.7.0 with partial MacOS support
"Information animal" ;-)
OOo2GD 1.5.1 Birthday Edition ;-)

Sunday, May 2, 2010

Gouraud Shading in JavaScript :-)

[Update I just changed demo to new version, now on my machine it reaches speed from 90 to 100-110 fps per second :-)]

I was wondering if it is even possible to create Gouraud Shading with JavaScript.

And answer is yes :-)

Here is a proof on youtube :-)



I was wondering also if it is possible to run it on G1 on Android 1.6, and answer is also yes:



As you can see on Chrome we have about 30-40 fps [when recording was of it was almost always near 50 fps on my laptop with Intel Core Duo 2 2.2 GHz on Chrome 5, 20-25 fps on Firefox], on G1 it was only 0.5 fps :-)

If you want to check how it will work on your machine you may try:




If you are reading this post by RSS or Buzz you may use direct link to demo :-)

It will work on Chrome, Chromium and Firefox. I don't know why it doesn't work on Opera :-(

Earlier versions of this worked about 5-10 times slower but it was caused by using fillRect(int,int,int,int) of Canvas object, now I'm working directly with pixels and this gives us big speed boost :-)

Similar postsbeta
Chrome OS and Java
Which language is fastest? ;-)
How to detect clickbaits?
Chrome2Chrome - lets move browser tabs between computers ;-)
OOo2GD - surveys results

Saturday, November 14, 2009

Which language is fastest? ;-)

Update: 15/01/2010 - It seems that I made big bug in test code for C# which caused decreasing of C# results about factor 10! I assumed that DateTime.New.Ticks returns nanoseconds, but it returns ticks, and in one nanosecond we have 10 ticks... Sadly nobody looked into sources of my tests :-(
So results for C# should be divided by 10, and in this case C# is faster than Java about 3 times [but not Java 1.5 with -server switch used in this case Java is a little faster than C#].
New results for Intel Core 2 Duo T6600 2.20 GHz under 64 bit Windows 7:
C# z .NET 4.0 - 1.17 ms
Java 1.5 with switch -server - 1.096 ms
Java 1.6 with switch -server - 2.8895 ms
Python 2.6 - 10.88 ms

Recently I made tests of this which programming language gives quicker code ;-)
Of course it depends from this what this code should to do.
So I choose thing which I'm writing almost always in new [new for me] language :-)

I wrote it even during my first session, over green screen [on RS232 connection] when I was first time connected to HP-UX on my University server ;-) [or maybe not??? I'm not sure now ;-)]

This thing is simple numerical integration of function f(x)=e-x2 in range (-10,10> [when calculated form minus infinity to plus infinity result is equals to square root from Pi :-), I was really impressed when my professor showed it to us on our lecture from mathematical analysis]. Those calculations are performed in 10000 of steps, and repeated 1000 times for stable result [so we measure time of 1000 iterations from 0 to 9999] and divide result by 1000 to get information about time needed to calculate one iteration.

If you are interested in source codes of programs I wrote for those tests, please use one of those links [those are links to my blog in Polish, but you needn't be afraid ;-) you are interested only in source codes] sources for Java, Python, C, and C# [here you may find ZIP file with some of those programs], sources for JavaScript [here is a simple JavaScript tester, which will display info how long took one full iteration for calculate this numerical integration], and finally sources for Go [here you need to be warned, that this Go program should have changed one line, where math.Exp() is used, it should use math.Pow()].

And results are interesting ;-)

C++ 32bit - 0.985 ms
C++ 64bit - 1.387 ms
JavaScript from Mozilla Firefox 3.5.4 - 1.380 ms
JavaScript from Google Chrome 4.0.223.11 - 2.514 ms
Java 64bit - 3.8 ms
Java 32bit - 4.7 ms
Google Go 32bit - 8.521 (5.68) ms
Python 2.5.2 32bit - 10.3 ms
Python 2.5.4 64bit - 10.16 ms
C# 64bit - 14 ms

All tests except test for Go was performed on my 64 bit Windows 7 laptop with Core 2 Duo processor, Go was tested on virtual Ubuntu 9.10 in VMware Player 3.0 hosted on Windows 7, in case of Go first result [8.521 ms] is a result shown by test program, second result [5.68 ms] was calculated by comparing results of JavaScript from Firefox on Windows 7 and in this virtual Ubuntu 9.10.
C++ code was compiled with Visual C++ 2008 Express Edition [for 64 bits I used compiler from Windows 7 SDK, here instruction how to make Visual C++ 2008 Express Edition to use it :-)]

The biggest surprise for me was really poor result of C#, and superb result of JavaScript in FireFox :-) I still don't know why JS was so fast :-) [interesting thing also is this that FireFox JavaScript was here faster than Google Chrome JavaScript ;-)}
Result of Go wasn't so surprising, now after the premiere of this language we can here only praises, but its still experimental thing, and I used 32 bit version of compiler which isn't the best ;-) [I must also admit that after my first experience with Go I don't like it and I hope this one Google project will die].

I think that good advice after this test is ;-) If you need to write some very quick code use C++, if it must be fast but needn't to be extremal fast - use Java, and newer use C# ;-)


Similar postsbeta
Calculation of SSD life time in EEE PC
Sources of JPC - x86 emulator in Java
How to detect clickbaits?
Programmers love to over complicate...
Gouraud Shading in JavaScript :-)

Saturday, March 22, 2008

Translate pages to English :-)

Thanks to Google Translate we may auto translate sites in FireFox from many languages to English :-)
Simple move this scriptlet to your FireFox bar with bookmarks :-)

Sad it cannot translate Polish :-(


Similar postsbeta
OpenOffice.org2GoogleDocs 1.0.3
Yeah... It's snowing... again....
OpenOffice.org2GoogleDocs 0.9.1
Programming languages uncanny valley ;-)
Chrome2Chrome - lets move browser tabs between computers ;-)