Posts

Showing posts from August, 2018

Marshalling/unmarshalling struct containing array of structs

While handling a change request I stumbled into this very peculiar scenario. I had a structure which had array of structs and I had to read/write this in a file. So to and from buffer conversions, I knew marshalling will be most effective. I had previously used it very effectively for CAN communication. So I had to google a bit n found how to handle this peculiar case. Below is the code. [StructLayout(LayoutKind.Sequential)] public struct tagX { public UInt32 a; public UInt32 b; } [StructLayout(LayoutKind.Sequential)] public struct tagY { public UInt32 x; public UInt32 y; [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = 20)] public tagX[] stX; } To initialize this: tagY stY = new tagY(); StY.stX = new tagX[20]; // Ensure size of array is equal to size const supplied in marshalAs directive. Then on this object we can run marshalling / unmarshalling routines.

Adventure with ZTE Blade C (ZTE V807)

Got hold of the ZTE Blade C after almost couple of years. Last thing I remember doing with this phone is flashing shit load of custom roms and then none of them working out the way I wanted. Every ROM had some issues. The last one I flashed was called PNG v5 and had a battery bug - but that may have creeped due to some other offbeat roms I flashed earlier. Anyway, coming back, what I wanted to do was to get this phone back to Stock state.    Unfortunately being 4Year old I could not get anything. First I started with ZTE's official website, but it's down due to US sanctions. Actually I had almost all the tools but stupidly I deleted about six months back.    Anyway so I started digging around to find a stock ROM. Needrom came through and I found someone's ROM backup there. To download that I'll need SP Flash tools and since I formatted my laptop a year or so back, will need MTK USB and MTK PreLoader drivers. Ok, took me couple of days of hunting around the net to get ...

Paytm games

I am not on any digital payment bandwagon. In fact I started using debit card only when the merchants stopped charging the stupid 2% transaction charge. And since I'm cautious about my money I have stayed away from payment wallets and the new app based payment methods.  I primarily use cash for small payments. And shop where the merchants don't charge extra for using debit card. Anyway last week I tried to use Paytm app. It's a popular payment app. Many of my friends do use it for small payments. My feedback from them was positive, so I decide to take plunge. Also another major reason was - paytm food wallet.  In india we get about 50Rs per day tax free out of salary for food. This you can collect monthly as Sodexo coupons. If you don't take sodexo coupons then this becomes taxable and you lose 10/20/30% depending on your income bracket.  Anyway, coming back to Paytm, I tried to install the app. My poor panasonic was not a match - google play store said - device not com...