Skip to main content

Posts

Java SDK not found under Android's SDK Locations settings in Xamarin

To work with Android under Xamarin you have to set up Android SDK and JDK path under Tools->Options->Projects->SDK Locations->Android I faced a problem after setting all SDK locations it says "SDK not found" for JDK despite giving the correct path for JDK installed on my system. After few hit and trials I figured out that the problem is 64-bit version of JDK installed . Xamarin works with 32 bit JDK. So I downloaded the 32-bit version of JDK from http://download.xamarin.com/Installer/MonoForAndroid/jdk-6u39-windows-i586.exe After installing this JDK I set up the options for SDK locations and now Xamarin works fine.

Blackberry 10 cascades - client side socket programming

Blackberry 10 has full support for BSD Sockets API . All the routines one can expect from BSD Sockets are available in Blackberry 10. But cascades make socket programming much easier. In this post we will discuss client side socket programming in Blackberry 10 using cascades . You can study about BSD Sockets API support in Blackberry 10 here . Before starting to use Cascades socket API you have to add this line to your .pro file QT+= network Cascades API provide a high level class QTcpSocket  which makes writing client side socket code very easy. Include following files in your cpp file #include <QtNetwork/QAbstractSocket> #include <QtNetwork/QTcpSocket> Any client side socket app performs following operations 1) Connect to server 2) Send / Receive data 3) Close connection Connecting to server QTcpSocket provides a function connectToHost which takes IP Address/Hostname (QString) , port (quint16) and OpenMode (default value is ReadWrite) as paramet...

Getting location in Blackberry 10

Location awareness is a required feature in most of the mobile phone applications today. Blackberry 10 API provides very easy way of accessing user's current location. In this blog post we will see how applications can access user location through native blackberry 10 API. Before using Location API you must add following to your .pro file LIBS += -lQtLocationSubset To enable your app to obtain the current position or last known position of the device, you must add the access_location_services permission to your bar-descriptor.xml file like this <permission>access_location_services</permission> Note that Location services must be enabled on device to get the location. We use QGeoPositionInfoSource class to find the location of a device and get updates about its position. To use QGeoPositionInfoSource you must include it like this <QtLocationSubset/QGeoPositionInfoSource> First we must initialize position source. which can be done through  createDe...

Decoding JPEG image file using libavcodec

I got a chance to work on a video encoding application that decodes series of jpeg files and convert them into ogg theora video file. I used the infamous libavcodec library that is used in FFMPEG . I decided to write blog posts explaining how I decode jpeg images and convert them into ogg video file. This is the first part and in this I will explain how to decode jpeg images using libavcodec. To learn how to write decoded images as a ogg video file please read http://random-stuff-mine.blogspot.com/2017/07/encoding-raw-images-to-ogg-theora-video.html Before reading this blog post you must be aware of using and setting up libavcodec. I highly recommend this tutorial to get basics of using libavcodec http://www.ffmpeg.org/doxygen/0.6/api-example_8c-source.html Allocating input format context We will first allocate input format for reading the file. We will use avformat_open_input function that will allocate AVFormatContext structure passed to it , the function detects input typ...

Understanding pointers in C Part1 - Basics of Pointer

Pointers are one of the most difficult concepts in C language to grasp. Many programmers get confused in pointers.I am one of them. I decided to write series of blog posts covering basic to advance concepts of pointers. This is the first part to understand very basic of pointer that what pointer actually is and how we can store/access data through pointers. Put simply A pointer is a variable that contains the address of a variable Lets try to understand pointers using some code. int x=3; int *ptrToX; ptrToX=&x;  In above code we simply took a variable x of type int . Then we define a pointer ( * denotes that variable is a pointer and it is known as indirection or dereferencing operator ) ptrToX  of type int and assigned address of x to ptrToX . Now ptrToX points to x . Note that ptrToX do not contain value of x ( i.e 3 ) instead it contains memory address of x . Now we can access and manipulate value of x using ptrToX . Accessing value of a variable ...

Change Blackberry 10 wallpaper programatically

Changing Blackberry 10 wallpaper through code is a fairly easy task. In this blog post we will cover two methods of changing wallpaper of Blackberry 10 programatically. Using Cascades In cascades we can use HomeScreen class defined inside bb::platform namespace. To link against this class you must have following line in your .pro file LIBS += -lbbplatform HomeScreen class has a function setWallpaper which accept object of type QUrl as argument. This function sets the wallpaper to the image pointed by url passed. It returns a bool as status of call. Now we can write code to change the wallpaper. For simplicity, code will set image as wallpaper from assets directory. bb::platform::HomeScreen homeScr; bool wallpaperResult=homeScr.setWallpaper(QUrl("asset:///mywallpaper.png")); Blackberry notes for setWallpaper method The image will be scaled to fit the screen. If the wallpaper image is deleted while it is set as the current wallpaper (say, because the image...

Blackberry 10 Application Deployment failed

When you  try to deploy Blackberry 10 application on your simulator or device, you may get these type of errors many times before application is deployed successfully. Deployment Failed: Info: Failed to obtain QConn connection, sync disabled Info: Sync not enabled, packaging full bar required for installation Info: Sending request: INSTALL_AND_LAUNCH Info: Action: Install and Launch Info: Debug native: on Info: File size: 304312 Info: Installing com.example.BB10TrackerSample.testDev_ackerSamplea7864132... Info: Processing 304312 bytes OR Deployment Failed: Info: Attempt to use sync failed: Connection reset Info: Sync not enabled, packaging full bar required for installation Info: Sending request: INSTALL_AND_LAUNCH Info: Action: Install and Launch Info: Debug native: on Info: File size: 304312 Info: Installing com.example.BB10TrackerSample.testDev_ackerSamplea7864132... Info: Processing 304312 bytes This issue is resolved in Blackberry 10.2 SDK. But for those who have not ...