Twitter Tips and Tricks

I recently went back to twitter after a long time, but was disappointed by the lack of

Tools and Extensions to read my Timeline etc.

The only 2
avarage readers for timeline etc. streams are:

1.
https://hootsuite.com/dashboard#/tabs?id=28486925

2.       Chrome
Extension for Twitter: TweetDeck

On the other
hand to get your own activity as RSS there is: http://www.rssitfor.me/getrss?name=tarun_khemani
which works ….

What I was
looking for was RSS Feed of the timeline, which I did not find….

 

 

 

–>

Advertisements

Variance in Delegates

1.       Delegates
can have Contravariant Parameter Type and covariant return type.

2.       But
this does not mean Contravariance for the actual function that the delegates
are pointing to.

3.       Eg.

    public static void f1(Object o)
        {
            Debug.WriteLine("Called");
        }

        public static void Main(string[] args)
        {
            Action<object> x = f1;
            Action<string> y = x;
            y("test");
        }

Here even though a Delegate for string is referencing
Object delegate (Contravariance), you can  call the underlying function f1 by
passing a subtype of Object only (which is Covariance).

Use of “in”

1.       The
Action used here is actually delegate void CustomAction<in T>(T arg);

2.       But
when u remove in from the decleration, compiler doesn’t allow:
Action<string> y = x;

3.       Note
that the compiler complains about this even for 2.0 or 3.0 framework and on adding
“in”, it works even in 2.0

 

 

 

 

–>

SQL Server Express LocalDB

Intro

1.     ItIs installed by VS 2012 Pro

2.     This is execution mode of SQL Express (Not a service), so can do everything of
Express without having to install Express externally. To confirm this you can see
the sqlserver.exe process in the Task Manager

3.
Go to SQL Server Object Explorer Window in VS 2012 and you’ll see it
under servers with Name: (localdb)\Projects:

a.       Location:
C:\Users\khematar\AppData\Local\Microsoft\VisualStudio\SSDT

b.      Connection
String:
Data Source=(localdb)\Projects;Initial Catalog=master;Integrated
Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False

c.       Version
: 11

d.      OS:
Microsoft Windows NT 6.1 (7601)

e.      Product:
Microsoft SQL Server Express Edition (64-bit)

4.
When we create a new Project of type SQL Server Database Project (after
installing SSDT), we can see that in project properties, the target is SQL
Server 2012 only and the connection strin (in Debug) is set to the Local DB :
Data Source=(localdb)\Projects;Initial Catalog=Database1;Integrated
Security=True;Pooling=False;Connect Timeout=30

Query Inside Iframe Using Jquery

My requirement is to create a chart of data from 2 sources that return data inside

different iframes on my page:

<iframe src="http://a.b.com/as/a.aspx" style="height250px; width360px"></iframe>
 
<iframe src="http://c.b.com/as/a.aspx" style="height250px; width360px"></iframe>

 

Now when I
try to load any of these locally using ajax I get CORS Error:

$(document).ready(function () {
    $("#GetInfo").click(function () {
        $.ajax({
            url: " http://a.b.com/as/a.aspx ", success: function (result) {
                $("#div1").html(result);
            }
        });
    });
});

 

So the
simplest way would be to query inside iframe using Jquery:

$(“#frameid”).contents().find(“div”).html(‘My
html’);

Ref :http://stackoverflow.com/questions/5924936/change-html-of-an-iframe-with-jquery/5926475#5926475

But, It
cannot be done in case the iframe src is in a different domain. I tried
accessing and got this error:

$(“#a”).contents()

1.
Blocked a frame with
origin “http://localhost:9107” from accessing a frame
with origin “http://popualertwsv01.msdwis.com“.
Protocols, domains, and ports must match. jquery.js:5883

SecurityError:
Blocked a frame with origin “http://localhost:9107&#8221; from accessing a
cross-origin frame.

 

So now I’m
creating a proxy that will send over JSON to this client page where the data
will be displayed on the Main HTML page only and not iFrames.

 

 

 

 

–>

Communivating (client to server) in Real Time VS in Chunks

 

S. No.

Real Time (wsDualHttpBinding)

Chunked

1.

The no. of http connections increase to 2x

No. of http connections will be > 2x, depending on the size of chunk
and the requirements to send exceptions in real time

2.

All connections are long lived so 1 thread is blocked for each http
request forever

All connections are short lived, so the thread is not blocked for a
long time.

3.

Real time reporting and tracking is possible

Delayed reporting (Delay depends on the size of the chunk and the
latency configured)

4.

Real Time messages so no file to write to.

Latency in writing to the log file and sending it over

This is what I had listed before doing this Tutorial: http://www.codeproject.com/Articles/491844/A-Beginners-Guide-to-Duplex-WCF

Now I See that with wsDualHttpBinding, every call to the
endpoint is a new method and so the only best way to keep both the channels
open is to do long polling at both sides…which is complicated specially when implemented
with Async stuff….

 

 

–>

SignalR for Communication between WCF svc and Windows Form Client

What Transport will be used ?

The Microsoft.AspNet.SignalR.Client.Transports namespace
includes the following classes that you can use to specify the transport.

1.       LongPollingTransport

2.       ServerSentEventsTransport

3.       WebSocketTransport
(Available only when both server and client use .NET 4.5.)

4.       AutoTransport
(Automatically chooses the best transport that is supported by both the client
and the server. This is the default transport. Passing this in to the Start
method has the same effect as not passing in anything.)

http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-net-client#transport

What is signalR LongPollingTransport?

http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-net-client#transport

signalR transport used in case client is .net

http://blogs.msdn.com/b/using_signalr/archive/2013/03/21/new-signalr-documentation-is-live-quot-what-is-signalr-quot-and-quot-transports-and-fallbacks-quot.aspx

http://msdn.microsoft.com/en-us/magazine/hh882442.aspx

https://github.com/SignalR/SignalR/wiki/Faq
CODE

 

 

–>

SignalR Bidirectional Chat

I am looking to replace IBM MQ pub/sub  with SignalR

 

 

–>