Tuesday 23 April 2019

How to track your visa application to UK

Have you applied for UK visa and waiting for the decision? Have patience and keep calm, there isn't much that you can do.

- As of now, truly speaking there is no direct way to track your visa application. Neither the official UK site (one where you applied online) nor the VFG global site (one where you took appointment) provide any update about your application progress.
- But you can purchase sms service which sends you message once it is processed.
- By default, you are supposed to receive email notification from VFS for processing so there is not any need to purchase sms service.
- There is one way to track the delivery of your processed visa application, once it is dispatched, by tracking at the Blue Dart. You simply navigate to tracking page of Blue Dart and use your visa application reference number and select 'Ref No.' option. Reference numbers looks like this: GWF*********.
- There are paid services to call and email for asking the progress about your visa

PRIORITY VISA: I attended biometrics collection at VFS centre on 16 April then it was sent to UK VI office Delhi on the same day. 17th was national holiday and then it was processed and accepted on 18th (because letter carries that date). Now 19-21 were holidays and meanwhile it was sent back to VFS office and from there picked by BlueDart on 23rd evening and received the message that application has been processed on the same day, i.e., 4 working days (excluding holidays) and total 8 days including both dates. It was delivered by 25 April.


Thanks
Vinod

Sunday 21 April 2019

MEX compilation issue on Octave but works on MATLAB

I have multiple C++ files in a project. These compile perfectly on MATLAB but do not compile on Octave. There can be 'n' reasons for this problem but I am discussing one case which could lead to such situation.

Assumption: Both MATLAB and Octave are working with the C++ compiler properly.

Issue: In MATLAB you can specify multiple source files using '*.cpp' and that compiles properly but in Octave that does not seem to work and displays the following error:

Error: "clang: error: linker command failed with exit code 1 (use -v to see invocation)
warning: mkoctfile: building exited with failure status"

Solution: Simply specify all source files with their name and don't use '*' in compilation command.

Example: 
With problem:
mex -I.. -I./code -I./code1 -I./code2 main.cpp ./code1/*.cpp ./code2/*.cpp

With solution:
mex -I.. -I./code -I./code1 -I./code2 main.cpp ./code1/s1.cpp ./code2/s2.cpp

I did not find the solution to my problem. So I created a small project and after great efforts and with luck, I got the solution. And thought, it's my responsibiltiy to make this solution available to you. You can find see the mex code example with multiple sources files here.

Sunday 31 March 2019

How to get transcript from Himachal Pradesh University Shimla for UK NARIC

I applied to UK and for that I had to prove my English language efficiency. Due to lack of time, I could not take IELTS exam so I thought of going with plan B, i.e., to get UK NARIC statement for my English language efficiency. Follow the steps to get it for you:

1. Apply for transcript in HPU and it needs following things from you-
a. Photocopy of degree
b. Photocopy of detailed mark sheet
c. Name and address of the organisation where you want to send transcript.
e. Pay fee of Rs. 5000.
2. You will get it on the same day or the next day.

There was a lot of confusion for applying to UK NARIC to me because in order to apply for UK NARIC statement, I needed three things degree, transcript and English language as medium of instruction certificate from the University and the confusions were:
a. First as per the definition of transcript, given on NARIC, it is something like detailed marks-sheet which contains the details of all subjects you have studied from first semester to last, and HPU, by default, provides students detailed mark sheet with all the required information.
b. In India, I believe, transcript is treated as a confidential document which verifies the degree details and contain one line related to medium of instruction. So it should be given on some institution's name and generally posted by the university directly to that institution (or given in sealed envelope). But in my case, I was suppose to upload it to NARIC website so I was in doubt whether this would be accepted or not.
c. HPU doesn't provide separate English language certificate as I required and as shown on the demos of application on the NARIC website.
So keeping in view to all these things, I was in doubt to get the NARIC statement. Because HPU's transcript served as English language as medium of instruction certificate. But all these things worked and I was able to get the UK NARIC statement for English Language Efficiency and Comparability statement for my HPU degree.

Since I faced a lot of confusion in this process so I am sharing with a hope that it will help you.

Thanks
Vinod

Other helpful and related blogs:
Blank Surname in Passport issue for UK Visa
How to prove English Language Efficiency for UK Visa?
How to track your visa application to UK

Dedicated to my parents...

Blank Surname in Passport issue for UK Visa

I applied for UK Visa and I had a surname related problem. In my passport, my surname is empty. My hosting institution (Cambridge Univ) says, surname is very important in UK and it has to be specified on the documents. So I contacted UK Visas and Immigration office and raised the question then they suggested me to use the given name in both the places, i.e., for given name and surname name. For example:
In passport my given name is 'Vinod Kumar' and surname is empty so they suggest to use given name as 'Vinod Kumar' and surname as 'Vinod Kumar'.
Please note that all these inquiry services are paid and I have to pay around Rs. 500 to get the answer to my question so I thought of sharing this with you to save your time and money. And yes, this worked as my visa application was successful.

Other helpful and related blogs:
How to get transcript from Himachal Pradesh University Shimla for UK NARIC
How to prove English Language Efficiency for UK Visa?
How to track your visa application to UK

Dedicated to my gurus....

How to prove English Language Efficiency for UK Visa?

I applied for the Tier 2 Visa to UK and for that I had to prove my English language proficiency. Remember this is a point based visa and English language efficiency have 10 points. You have only two options to prove it, as discussed below:

1. Taking Exams
You can take exams like 'IELTS for UKVI' (academic or general). You need only CEFR level B1 for Tier 2 visa, which is equivalent to IELTS 4-5 band. Pay attention, you need a specific type of IELTS test and that is for UKVI.

2. UK NARIC Statement
If your bachelor or master or PhD degree was in English medium then you need not to worry for taking IELTS exam because you can get a UK NARIC statement to prove your English efficiency. You need three things to get your UK NARIC statement: photocopy of your degree, transcript and English language certificate. Follow the following steps:
a. Navigate to UK NARIC
b. Create your individual account
c. Select Visas and Nationality service.
Be careful here. We need two things, one certificate for English efficiency and second for the UK equivalent of our degree. So we need to select the Visas and Nationality service because it is customised service for visas and immigration purposes and contains both the certificates. You will see separate service for English language efficiency and Comparability service but you are not supposed to select that.
d. Select processing type and delivery options.
You can select faster processing by paying extra for processing and for delivery options. They process documents in 10 days (standard service), 48 hours and 24 hours option + delivery time of around 7 days.

NOTE: For other visas like Tier 4 (student visa), it is not necessary to take any of these options because it depends upon the hosting university as they they can waive off the English requirements.

Other helpful and related blogs:
How to get transcript from Himachal Pradesh University Shimla for UK NARIC
Blank Surname in Passport issue for UK Visa
How to track your visa application to UK

Dedicated to parents....

Saturday 1 December 2018

Lessons Learnt from Developing a C++ Library

Work in PROGRESS... I am working on a C++ library with MATLAB interface, i.e., MEX files for large-scale machine learning problems. So in this blog, I am sharing the lessons (I mean scenarios which faced while development) which I have learnt from the C++ development (MEX context). Moreover, I will continue to update the blog as I will find anything new or the inputs provided by you. I will try to add code snippets and error message, as I will get time. Any suggestions are welcomed....


Lesson #1. To delete derived object, we need virtual base destructor
For efficient library, efficient memory management is required. And for every dynamic memory allocation, we need to have dynamic memory deallocation otherwise there will be memory leak and for large-scale problems it can create problems.
In some situations, we need the base class reference to hold objects of different derived classes. So while deallocating/deleting such objects, we get errors if we have not defined virtual destructor for the base class. We need virtual destructor even when the base class is abstract class. Example:

class Base { 
   virtual ~Base() {}; \\ if commented, this will give error.
};
class Derived: public Base {}; 
class C { 
    public void main() { 
       Base obj = new Derived(); 
       delete obj; 
   }
};


Lesson #2. Delete for new and free() for malloc()
While dynamically managing the memory, one should use delete to free the memory allocated using new and free() should be used with malloc() (c type methods). Otherwise it can also create trouble, as the memory is allocated and deleted to different places using them.

Lesson #3. Before returning mid way from a function, be sure to free the memory
When you are using dynamic memory allocations inside a function then be sure to deallocate the memory before leaving the function from any of the exit points. Generally, we allocate memory at the beginning of function and free at the end of the function. But this could lead to memory leaks if there are conditional exits. This means a function can have multiple exit points, i.e., using return statement and conditional exits so we should ensure that memory is deallocated whatever exit path is taken by the program.

Lesson #4. Safe include
Error: Safe includes are helpful to fix the 'multiple definitions' compile time error. When, you have a header file (say A) included into multiple source files (say B and C) and then these new files (B and C) are included in another file  (say D) then we see this error because compiler sees multiple definitions of the code present in A because it was included in B and C, and then they were included in the D so D has two copies of A.
Solution: Use safe includes with A, i.e., we define contents of header file A using compiler directives #ifndef, #define and #endif, as given below:
           #ifndef FILE_A
           #define FILE_A

           //-----//-- here comes the contents of header file A.//----
          

          #endif

Lesson #5. Comment and print
In order to debug the code, especially with MEX files one should use debugging tools like Visual Studio Code etc. but if you don't have any such tool then we can use comment and print strategy for debugging. Suppose you have huge amount of code which is not running and you are not sure where is that crashing point then first comment the complete logic part and run the blank flow. After this add few lines of code and run the code, if it works then keep on adding few lines of code until find the erroneous code. Yes you can keep printing some variables which help you track the code.

Lesson #6. Verify loop sizes, indexes
This is one of the culprit, when we copy-paste code or try to use the existing code because we forget to update the loop sizes and indexes used in the destination code environment.
Segmentation fault (known as segfaults) is one of the common error (run time), we see during the development process and it occurs whenever there is unauthorised memory access. One unfortunate thing about this error is it does not necessarily occur at the time of unauthorised access of memory but can occur at later stage so it is difficult to locate this error. One possible reason for segfaults is array out of bounds and this occurs when the indexes of arrays or the loop sizes are not correct.
So whenever there is segfaults, first check the loop sizes or indexes of the loops and every time you copy-paste the code be sure to have a look at the indexes and loop sizes.

Lesson #7. You are unlucky if your code runs in the first place and shows results
It's not very relevant to coding errors but to our learning. Every error in the code is a possibility for your learning new thing and adds something to your experience. Generally, it hardly happens that we don't see any error but if it happens then that means we have missed the opportunities to learn something. 

Lesson #8. Test new code/functionality separately and then add to library
Whenever you want to add new idea/logic/code (probably small code) to large code, don't add it directly. Whenever possible write the code separately, test it and then add it to the larger code, e.g., you can develop the logic in NetBeans (obviously for C++). This helps to reduce errors, especially logical. Remember, it is difficult to locate the error in larger code than the smaller one.

Lesson #9. Verify the allocation, deletion and initialisation of all the pointers
Once you complete any code/function/class or you can say when you see errors, verify that you have allocated, initialised and deallocated all the pointer variables. Because generally we miss some of them for some of the variables and this happens when we copy-paste or modify the existing method and this happens quite frequently when developing libraries because methods share some of the logic so you need to copy code from one place to other place.

Lesson #10. Name collision for counters of for-nested loops
Whenever we have multiple nested loops, spread over large amount of code, then many times we repeat the loop counters, i.e., we use the same variable name  in the inner loop for the counter as used in the outer loop.

Lesson #11. If some function is called very frequently then do not do allocation and deallocation in that function
This is interesting and very critical point. If one function is called frequently then do not do any memory allocations/deallocation inside that, because the allocation/deallocation process takes a lot of time and make your algorithm slow. In such situations, you can do it globally, like in the class constructor/destructor.

Lesson #12. If some function is called very frequently with large number of parameters then either reduce the params
When a function is called, its parameters are saved on to the stack along with the return address and for every function call, all the information is written to the stack. So if one function takes large number of parameters and is called a number of times then we should think of reducing number of parameters to the function call. This will save running time.

Lesson #13. Before you could think of beating other algorithms, just verify if the algorithms implemented by you are giving the results as reported earlier.
This point is not very relevant to C++ but to library development or implementing our ideas. In a paper, we compare our method with existing techniques. So in this process, we are hardly able to do it in one go, rather make mistakes, get wrong results and then we get the method right. So here I suggest you to implement your method and existing methods and run on bench marked datasets and compare with the results reported in the literature. If the results are at par only then move to comparing with other methods.

Lesson #14. If 'unsigned' is assigned to 'signed' then occasionally goes down.
When you have huge amount of data but limited RAM then even the indexes has to pay heavy value. So to be more efficient, generally I use unsigned values for indexes so that I could have high range with lessor memory and use unsigned values in the loop control. But this might put you in an infinite loop in certain situations, as I was stuck once, for at least 30 minutes.
When decremented, unsigned index can't go to -1 rather they repeat in a circular fashion. So we need to use signed indexes in such situations, e.g., look at the following situation, once upon a time I stuck with this infinite loop:
    unsigned memory_size = 5;
    for(unsigned i=memory_size; i>=0; i=i-1) {
        printf(" %d", memory_size);
    }
Lession #15. Use Debuggers for MEX Files
We should use debuggers to locate the errors, like we can use it in NetBeans. But when we are using the MEX files, we might not have much options or at least MATLAB does not offer anything (to the best of my knowledge) to debug C++ code. It is very unfortunate that MATLAB does not provide any error messages for runtime errors but directly crashes when we run the MEX files. Perhaps this is due to the fact that MATLAB passes the execution control to a different program for MEX files so for runtime errors, it directly crashes.
In the first place, one can try 'Lesson 5. Comment and Print' but that's not very good way to deal with the errors. So we should look for some debugging tools and I want to suggest Visual Studio Code, which works with Mac as well as Windows. For a tutorial to VS Code, you can follow the link

Some suggestions:
1. For some tips for debugging MEX files, you can follow this document from Caltech University: mex_debugging.
2. And this is a very nice, a little complex but very detailed and helpful post which talks about header and base class issues: link.


Dedication: to my Gurus....

Friday 23 November 2018

Only 1% newness is needed to solve a problem

In order to solve a new problem, in general, we need only 1% newness and rest 99% we already know. So we need a proper approach to use the existing knowledge for solving a given problem.

Here I have outlined a very general approach of solving any problem. This approach tells about, how to utilise the idea that only 1% newness is used to solve any problem. As per this approach, there are four steps in solving any problem in general,

Step 1. What is given?
First ask this question from yourself and write out whatever is given to you to solve a problem.

Step 2. What we know?
Second ask this question from yourself and write out everything you know about the given entities, e.g., suppose you are given a triangle then we need to write everything that we know about triangle, like, sum of angles is equal to 180 etc.

Step 3. What we need?
Write out what we are required to find in order to solve the problem and simplify if possible which further lead to some results which we need to prove.

Step 4. 1% Logic/trick
Yes, now look at the relations given to us (from Step 2.) and keep in view the goal (relations from Step 3.), we want to achieve. How can we map relations in Step 2 to target relations in Step 3, this is where you need 1% logic to solve the problem. If you have done the Step 2 and 3, correctly then it should be easy to solve the problem, theoretically.

Happy Mathematics!

NOTE: This idea is from my high school Maths teacher Mr. Pradeep Thakur, who taught me this about 13-14 years back. I believe this is a wonderful approach of problem solving. Since the idea was taught to me more than decade ago so if there is any problem with the theory then I take responsibility for that because I don't remember the exact thing he taught. If you have any comments then please share. I will add example problem soon (as I will get time....).

Dedicated to Sir Pradeep Thakur!