Basically I like to have fun and be funny in every possible way, expecially be fun through code.
As follows a joke you can make to a colleague who goes away from his desktop and leave the pc unlocked.
If your colleague was working with a browser you can leave him any kind of javascript joke, an alert, a confirm...
You can inject it through dev-console (F12) or url address bar typing for example javascript:confirm('Format your Hard Drive?').
But you can think about something more annoying...
This devblog borns as a container for projects, ideas and anything I can think or do in my spare time ... Here you will not find my pictures or photos of my dog, but snippets of Java, C#, C++, T-SQL, HTML, javacript and who so forth ...
Showing posts with label web. Show all posts
Showing posts with label web. Show all posts
Tuesday, July 29, 2014
Monday, July 28, 2014
Move ViewState out of the page
From this year I'm working on a ASP.NET Web Forms project. I'm currently tuning this project with some tweaks.
One of those tweaks is related to ViewState, IMHO the Achilles' heel of this framework.
Due to business decisions, budget etc... dev-team could not re-engineer the entire pages, so they decided to improve whatever possible.
Move ViewState out of the page... that means one thing: lighter pages!
ViewState, by default implementation, is actually stored in a HiddenField, but you can move it everywhere: Session, Cache, Database...
One of those tweaks is related to ViewState, IMHO the Achilles' heel of this framework.
Due to business decisions, budget etc... dev-team could not re-engineer the entire pages, so they decided to improve whatever possible.
Move ViewState out of the page... that means one thing: lighter pages!
ViewState, by default implementation, is actually stored in a HiddenField, but you can move it everywhere: Session, Cache, Database...
Wednesday, August 8, 2012
String-based Socket communication classes
I recently removed an old post called "A little framework for TCP client-server communication".
That's why I think it was not so clear and useful.
Today I propose the "engine" I used.
I used those libs for some projects like:
I think it's very useful, scalar and powerful for simple projects.
It's basically composed by two class and two interfaces.
class Server: wraps a ServerSocket object and manages incoming client connections, and messages through an interface called OnServerEventsListener.
interface OnServerEventsListener: defines some standard events like, adding a client, receiving messages, receiving errors of Server or from Clients.
class Client: wraps a Socket object and manages a simple communication through an interface called OnClientEventsListener.
interface OnClientEventsListener: defines events like connecting, disconnecting, on receiving message, on exception generated.
That's why I think it was not so clear and useful.
Today I propose the "engine" I used.
I used those libs for some projects like:
- A push server for Android clients
- A server that controls some computer's feature like volume, services, tasks, also file exchange
- A computer's mouse controller
- Data exchange between two different processes
I think it's very useful, scalar and powerful for simple projects.
It's basically composed by two class and two interfaces.
class Server: wraps a ServerSocket object and manages incoming client connections, and messages through an interface called OnServerEventsListener.
interface OnServerEventsListener: defines some standard events like, adding a client, receiving messages, receiving errors of Server or from Clients.
class Client: wraps a Socket object and manages a simple communication through an interface called OnClientEventsListener.
interface OnClientEventsListener: defines events like connecting, disconnecting, on receiving message, on exception generated.
Sunday, March 11, 2012
A little framework for TCP client-server communications (part2)
Here we are for the second part of this article. I remeber to everybody that this little framework is not created for market, distrubution or diffusion. (Not even for best practices)
Let's start with some example code!
On the base of what I wrote in the first part, let' see how to create a simple server with JRR Framework.
Let's start with some example code!
On the base of what I wrote in the first part, let' see how to create a simple server with JRR Framework.
ResponseManager server = new ResponseManager(8888); //8888 is the listening port server.setConsoleLogEnabled(true); //enable printing log on the console server.start(); //start listening
Wednesday, February 29, 2012
A little framework for TCP client-server communications (part1)
Hello world! I'm back from work and now it's time for requiem... :)
Today I wanna talk about a little framework written in Java for managing tcp/ip sockets connections.
Why I need a framework such this and what can I do with this framework ?
Remember that a good framework is very useful if can save you a lot of time/money on writing a lot of code. I think that JRR (Java Request Response) has a big potential and if you have to write an application,on every kind of device that supports internet, you should try it and see how it's simple to manage it all
Zooming out on features: with JRR you can:
Today I wanna talk about a little framework written in Java for managing tcp/ip sockets connections.
Why I need a framework such this and what can I do with this framework ?
Remember that a good framework is very useful if can save you a lot of time/money on writing a lot of code. I think that JRR (Java Request Response) has a big potential and if you have to write an application,on every kind of device that supports internet, you should try it and see how it's simple to manage it all
Zooming out on features: with JRR you can:
- Enstablish a Server that listens on a port; Provide your own implementation of handling client messages and server response. Also manages timeouts.
- Create a Client that send requests to server, and handles response, exceptions, connection timeout and custom response timeout.
P.S. If you don't provide your implementation, classes have their own.
Want to know more? Keep scrolling this post...
Thursday, January 5, 2012
Server Multi-client in C# .NET
Un altro progetto a scopo didattico che è sempre carino da affrontare è la comunicazione Client/Server via socket TCP.
Il progetto in questione si divide quindi in due parti. La prima è semplicemente un server, realizzato in c# .net, che:
-riceve in ingresso delle stringhe formattate in un certo modo,
-effettua un operazione a seconda di che stringa riceve,
-rimanda al client la risposta in formato stringa.
Vediamo un po' più nel dettaglio come funziona.
E cosa schiarisce meglio le idee di un immagine?
Il progetto in questione si divide quindi in due parti. La prima è semplicemente un server, realizzato in c# .net, che:
-riceve in ingresso delle stringhe formattate in un certo modo,
-effettua un operazione a seconda di che stringa riceve,
-rimanda al client la risposta in formato stringa.
Questo tipo di progetto può avere numerosissimi tipi di applicazione: in teoria tutto quello che può fare un applicativo .Net è "attivabile/reperibile" via socket. Le più stupide modalità di utilizzo che mi vengono in mente ora possono essere: reperire dei dati da un database, lanciare procedure, controllare funzioni di sistema ecc... ecc...
Vediamo un po' più nel dettaglio come funziona.
Tuesday, December 20, 2011
Interrogare un Web Service ASP.NET con Android
Abbiamo il nostro bel WS in ASMX o WCF e vogliamo renderlo raggiungibile dai nostri terminali Android senza troppe rogne?
Le librerie ksoap2 ci stravengo incontro!
Scarichiamo il jar relativo qui , importiamolo nel nostro progetto e aggiungiamo le referenze nella nostra classe:
Supponendo di avere un webservice con una pagina "Service1.asmx" la quale contiene questo metodo:
Scarichiamo il jar relativo qui , importiamolo nel nostro progetto e aggiungiamo le referenze nella nostra classe:
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
Supponendo di avere un webservice con una pagina "Service1.asmx" la quale contiene questo metodo:
[WebMethod] public string HelloWorld(string valore) { return valore; }
Subscribe to:
Posts (Atom)

