Friday, March 6, 2015

Having fun with C# dynamic and reflection: create a class that let us to avoid access modifier

Yeah, the title says it all.

Have you ever get tired of manually call reflection methods to get a value of an hidden field? Yes I do!

In my spare time I found a funny solution to work around this problem.
I found a dummy way to avoid access modifier without losing 'deafult' syntax: thanks to c# dynamic object!
public class MyClass
{
    private int value = 1 ; 
}
private static void Main(string[] args)
{
    MyClass myInstance = new MyClass();

    //cannot access private field 'value' here
    //myInstance.value = 2;

    dynamic myInstance2 = myInstance.Expose();

    //can do it!
    myInstance2.value = 2;
}

Tuesday, July 29, 2014

Make a joke to your colleague

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...

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...

New year, new theme!

I know actually it's not a very new year.... we are almost in august!

I do not write in this blog from more than an year... and I miss it a little bit.
I see posting like a way to share things, make a personal memo, suggest how to solve problem or just turn on a lamp inside a brain.

Meanwhile, I change theme!

P.s.
Sorry for my bad english! The important thing is that you understand me!

Monday, July 1, 2013

Convert from jar to dll

Nowadays, development is very eased from community.
We can easily re-use our code between different platforms in so many ways, gaining time, money and above all... today have multiple skills is not so as useful as before.

By the way, I recently had necessity to bring some java code to .NET runtimes.
No difficulties with IKVM.NET !

If you follow these steps you can convert from JAR to DLL or even from Runnable JAR to EXE!

Tuesday, April 23, 2013

15 reasons why Windows Phone 8 sucks for me ( as consumer )


  1. Facebook app really fucking sucks!  Notification messages doesn’t work!
  2. Integrated Facebook chat is the same...
  3. Twitter, is the same… nicer than Facebook but  same notifications problem.
  4. No dropbox app (but Skydrive is awesome!)
  5. No Instagram app, is there any free alternative?
  6. Native Youtube is missing ☹ 
  7. There’s no alternative browser or search engine to bing
  8. Whatsapp app is maybe the nicest app I downloaded
  9. Sometimes network  goes offline and there’s no way to get it back
  10. Saving photos directly to SD card is very slow, it may takes about 10 seconds per photo
  11. Saving a recorded video to SD card is completely buggy with video lags  and audio strutterings. 
  12. There’s a folder called “Others” that is always full of something that fill internal memory. I can’t delete its content and I must delete some applications because memory is full and phone doesn’t work properly.
  13. Bluetooth doesn’t match with my BT-Voice speaker.
  14. No notification center
  15. Only four vibrations while ringing!


Am I too critic?
Don't you agree with me?

Damn the day I sold my Android :(

Friday, November 9, 2012

That damn NFC alert after tapping a tag on WP8

In these days I had the opportunity to develop a Windows Phone 8 application for my company.
The main reason we choose WP8 was the new Proximity API for reading NFC Tags.

I don't wanna write about how to read or write a NFC Tag but I just want to notify you an issue I encountered while developing.

When you tap a Tag over a device, a system dialog appears asking you if you want to view the content of the tag. A dialog is showed even if there aren't app that can manage a specified tag content.
So read a Tag brings an annoying system dialog.

I had to realize an app that reads tags during an event and does a check-in . So in a single page I want to read several nfc tags without any kind of interruptions.
Can I read a tag without seeing this damn alert that is literally ruining my UX? The answer is yes I can.