Thursday, October 4, 2018

CPLD Vs FPGA

https://numato.com/kb/cpld-vs-fpga-differences-one-use/

Complex Programming Logic Device & Field Programmable Gate Array

CPLD and FPGA nicely explained, courtesy www.numato.com. 

Thursday, October 3, 2013

XCode app as Agent in MAC

How to make Agent app in Xcode

If you already wrote the NSApplication using Xcode and want to run the same app in background, it can be done simply by adding a entry in -info.plist . Just add a "Application is agent(UIElement)"- Yes.
This would make your app run in background and provide some service, so that other apps can make use of it. Below is the screenshot of -info.plist entry FYR



Hide the Window in Xcode app

To hide the Xcode app main window or any window inside

1. Choose the xib file from the Xcode project.
2. Select the Window that you want to hide, and check the corresponding attributes from attribute window.
3. Uncheck the "Visible at Launch" checkbox.

And you are done, below attached is the screenshot of the window attributes from Xcode ide FYR.


Sunday, September 29, 2013

make install problem

make[2]: Nothing to be done for `install-exec-am'.
====================================

This may be a error that one may encounter during installation of some linux based sofwares. In the process of executing ./configure, make, make install , this could be a error when we do make install. To eliminate the issue just try

./configure --prefix=/usr

this would work for most of the installation.

Monday, September 23, 2013

QLThumbnailImageCreate Fails


Console Output 

ImageIO:   CGImageDestinationAddImage image parameter is nil

ImageIO:   CGImageDestinationFinalize image destination does not have enough images

The above error happens due to either CGSizeMake size is zero,i.e., the image we are trying to create has maximum size as Zero. or The system doesn't have codec to parse the file passed as parameter. I just spend quite a bit of time puzzling, unable to find why the QLThumbnailImageCreate fails, although all the parameters are valid, the reason was, i was trying to parse a video file, for which my current system didn't have codec. Finally, tried with some .mpg extension and it worked fine. Hope this post help someone save sometime. 

Friday, September 20, 2013

XCode objective-c++ Compilation error


XCode compilation error
==================
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)


The above error is due to .cpp extension used for objective-c++ file, ie., a file that
has the objective-c and c++ code has extension .cpp insted of .mm. Rename to .mm extension
could solve this issue.

Thursday, September 19, 2013

Setting up VIM as IDE in MAC OS X


To setup VIM in mac os x :
#####################

1. By default MAC OS X comes with vim installed.

2. Download and install cscope-15.8a.tar.gz (601.2 kB) from cscope.org.

3. Unzip the cscope-15.8a.tar.gz from terminal. (tar -xvzf cscope-15.8a.tar.gz).

4. cd cscope-15.8.a folder, and do ./configure, make, and make install.

5. the above install may fail due to ncurses dependency with following error.
 
In file included from main.c:49:
/usr/include/ncurses.h:539:40: error: macro "cbreak" passed 1 arguments, but takes just 0
/usr/include/ncurses.h:564:44: error: macro "erasechar" passed 1 arguments, but takes just 0
/usr/include/ncurses.h:600:43: error: macro "killchar" passed 1 arguments, but takes just 0
make[2]: *** [main.o] Error 1

6. The above error can be resolved by making changes in src/constants.h file. Open this file in vim and modify the below line
 
 #if (BSD || V9 ) && !__NetBSD__ && !__FreeBSD__
with this
#if (BSD || V9 ) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__

 
7. Now repeat step 4. It will succeed.
 
8. Download and install Exuberant Ctags from crags website http://ctags.sourceforge.net

9. Follow the similar procedure to install ctags
tar xzvf ctags-5.8.tar.gz
cd ctags-5.8
./configure
make
sudo make install
 
10. After exuberant crags installed, you can verify it using the below commands
which -a ctags

/usr/bin/ctags ==> original ctags
/usr/local/bin/ctags ==> exuberant ctags

11. To set OS X to use exuberant crags, just export the path
 
  export PATH="/usr/local/bin:$PATH"

12. Downlod Taglist plugin and unzip using tar -xzvf and do the following
 
Copy the tag list.vim to /usr/share/vim/vim73/plugin/.
Copy the tag list.txt to /usr/share/vim/vim73/doc/.

13. Thats it you are ready to go. If any problem such as Taglist showing empty or no tags appears add the following lines in vimrc file

let Taglist_Ctags_Cmd = "/usr/local/bin/ctags"
"to inform vim about filetype
filetype on
"to inform vim about syntax highlighting
  syntax on

14. To permanently avoid exporting path export PATH="/usr/local/bin:$PATH" each time, add following line in top of /etc/paths
 
/usr/local/bin

15. Add the below line  vimrc file to automatically find the tags file generated in current directory , all the way to root

 set tags = ./tags; /

If any doubt related to creating scope db and others refer to my previous posts. thank you.

Ref: http://vim-taglist.sourceforge.net/faq.html

Monday, September 2, 2013

To Know the Library architecture

To Know the Library architecture for which the library has been compiled for

Execute the following command from the Windows command prompt

It will be 14c for x86 and 8664 for x64

Following is sample output of the command

c:\> dumpbin ex.lib /headers

Microsoft (R) COFF/PE Dumper Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file ex.lib
File Type: LIBRARY
FILE HEADER VALUES
             14C machine (x86)
 

Thursday, August 29, 2013

Solving C1083 error for Visual Studio 2012 Express with Windows Kit

To solve error c1083 cannot open include file 'windows.h' no such file or directory
===========================================================
(The following solution assume, you have installed Visual Studio 2012 Express / Windows Kit for x86 or x64 platforms)

  • Change the following properties (if you installed the SDK to a different location, replace the SDK path with your custom install location):

  • - In “Executable Directories” replace $(WindowsSdkDir)bin with $(ProgramFiles)\Windows Kits\8.0\bin\x86
    - In “Include Directories” add $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared at the beginning and remove $(WindowsSdkDir)include
    - In “Library Directories” replace $(WindowsSdkDir)lib with $(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x86
    - In “Exclude Directories” replace $(WindowsSdkDir)include with $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared
    - When targeting x64, replace x86 with x64

    That’s it – you should be ready to build and run!

    Ref : You can dynamically include path of Program Files folder using the following in Windows.
              On 64bit Windows, things are a little more complicated, as application can be installed both in
               %ProgramFiles% and %ProgramFiles(x86)%

     

    Thursday, March 14, 2013

    Touchpad turning off

    To turn off the laptop/notebook touchpad in ubuntu, type the following command in the terminal window

                 $synclient TouchpadOff=1

    to enable the touchpad again

                  $synclient TouchpadOff=0

    Synaptic Package Manager behind Proxy

    To configure the Synaptic Package manager behind the proxy, follow the below simple steps
    1. Open Synaptic Package manager, by searching it from Ubuntu dash or clicking open it from launcher panel.
    2. Click, Settings->Preferences menu.
    3. The below screen would appear.

    4. Select "Network tab".
    5. Select "Manual proxy configuration"
    5. Enter the "HTTP proxy:" ip address and "Port", and also "FTP proxy:" ip address and "Port".
    6. Enter "localhost" in the "No proxy for:" text box.
    7. Click on the "Authentication" button near HTTP proxy port spinner box.
    8. Enter your network "username" and "password" for proxy authentication.
    9. Thats all, you are through to download and install packages.

    Monday, October 29, 2012

    android - Unable to create a new project in Eclipse after update to SDK Rev. 20

    After updating the android SDK, if you are unable to create a "Android application project", or "New Android Activity", wherein everytime you try to create the following below popup comes in


    Solution:-
         Open the SDK manager, delete the Android support package. Choose the current project, try install from the above popup. This should work. It worked for me. You can find the same below as a issue in code.google.com
    http://code.google.com/p/android/issues/detail?id=33859

    Friday, October 26, 2012

    Android Support package not present in SDK Manager

    Android Support package not present in SDK Manager:-

    Solution:
    "For some weird reason android-sdk decided to install everything in /extras/compatibility instead of /extras/support which eclipse recognises, so I renamed /extras/compatibility to /extras/support and now everything works fine."

    Saturday, July 28, 2012

    VIM as IDE

    Install CTags for VIM
    -------------------------------------
         sudo apt-get install exuberant-ctags

    Install Cscope for VIM
    --------------------------------------
        sudo apt-get install cscope

    Install the following plugins for VIM
    ------------------------------------------------------------
    1. Automatic Display of Declarations in the Context Window on the bottom in the (G)VIM window using the script named 'Source Explorer(srcexpl.vim)' :
        http://www.vim.org/scripts/script.php?script_id=2179

    2. Symbol Windows For Each File on the left in the (G)VIM window (G)VIM using the script named 'taglist.vim':
        http://www.vim.org/scripts/script.php?script_id=273

    3. Quick Access to All Files on the right in the (G)VIM window using the script named 'The NERD tree(NERD_tree.vim)':
        http://www.vim.org/scripts/script.php?script_id=1658

    4. Cscope maps the keyboard shortcuts for various commands in cscope using the script named '(cscope_maps.vim)':
        http://cscope.sourceforge.net/cscope_maps.vim

    4. Trinity manages all the above plugins and fit them in VIM to get the feel of source insight IDE using the script named '(trinity.vim)':
        http://www.vim.org/scripts/script.php?script_id=2347

    4. You can change various options of each plugin in trinity.vim according to you request.


    Additonal Info:
    -------------------------
              After installing cscope its mandatory to build cscope DB for your project inorder to execute the commands inside VIM. If your project is c,cc,cpp project the following command will generate you a basic database. However you can tweak the same for your project requirements. Execute the following command at the top level project directory.

        find . -regex '.*\.\(c\|cpp\|h\)$' > cscope.files

        cscope -b

    the above commands should generate a cscope.out DB file in your current working directory. If successfull, open VIM and type the following command

        :cscope add /home/xyz/cscope.out

    some useful cscope commands:
    • Find this definition - :cs f g
    • Find functions called by this function - :cs f d
    • Find functions calling this function - :cs f c
    • Find this text string - :cs f t
    • Find this file - :cs f f
    • Find files #including this file - :cs f i
    • Find this C symbol - :cs f s
    • Find this egrep pattern - :cs f e

    - Done and now you are ready to go. Happy VIM'ing.

    Thursday, July 19, 2012

    Chromium depot_tools download


    During download of depot_tools of chromium browser using git in linux, we may get the following error

    -------------------------------------------------------------------------------------------------------------------------
    root@aphone-ubuntu:~/chromium_src# git clone https://git.chromium.org/chromium/tools/depot_tools.git
    Initialized empty Git repository in /root/Chromium_Src/depot_tools/.git/
    error: Couldn't resolve host 'git.chromium.org' while accessing https://git.chromium.org/chromium/tools/depot_tools.git/info/refs

    fatal: HTTP request failed

    --------------------------------------------------------------------------------------------------------------------------

    this error may occur due to http proxy or firewall behind which we are trying to use git. Try setting the global htty proxy config for git. It worked for me.

    git config --global http.proxy http://proxy:8080
    // To check the proxy settings
    git config --get http.proxy

    After setting the above try  #git clone "url" .

    Thursday, December 15, 2011

    Android --no crunch error

    Error Situation:
    This error would arise in unexpected situation, wherein we tried to execute some application after doing some updates on eclipse or software that installed inside eclipse. This strange error is due to incomplete update of software inside eclipse.

    Scenario:
    Android SDK version 2.3.3, API level 10, and  updated the ADT to recent version 15 and tried to execute an app. But it failed due to this error. 

    Reason:
      Incomplete update of Android SDK and ADT is recent version.

    Solution:
    To resolve this, update the Android SDK version that is being currently used from SDK Manager. After updating the Android SDK the problem disappeared. 

    Thursday, September 22, 2011

    Eclipse Content Assist Not Working

    Eclipse sometimes goes clueless on assisting content when Ctrl + Space is pressed. Either it does'nt pops up the list, or else the popped up list would be empty without any suggestions. This can happen in any version of the eclipse begining from 3.2 to the latest 3.7 Eclipse Indigo. This is not due to the bug in eclipse. Its all about the configuration of eclipse editor and the Java project. Below are the four possible solutions that can help the user to get back the content assist

    1.Create a New workspace project in Eclipse
    Create a totally new workspace and import your existing project. Remember check “Copy projects into workspace” to copy all your existing work to new workspace.

    2. Check the Content Assist Configuration
    Configure Eclipse’s content assist, go “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “1
    Other Java Proposals” is ticked

    3. Change Regional Setting option in Windows
    Make sure “regional and language options” is in English language. For example, Windows, Control panel –> Region and language options –> Advance tab –> Language for non-unicode program –> Make sure English (United States) is selected.

    4. Check the Lib folder in Current Project
    Scenario -
    There might be some class references with same name inside the jar's that are included in the library, or there might be chance of same "xyz.jar" included in two or more library jar's in the current project lib folder.
    Solution -
    1. Keep only one "xyz.jar". Remove "xyz.jar" from the jar's that include it, and keep only in current project lib.
    2. Include it in any one of jar's inside the lib.

    Wednesday, September 14, 2011

    vlcj player with SWT


    Find below the vlcj player embedding inside the eclipse plugin. It takes only few lines to get it embedded. The videocomposite below created should always be SWT.EMBEDDED, otherwise, it may give "Invalid Arugument" Error. For compiling and running add vlcj library and its dependecies JNA.jar and platform.jar libraries to the project. These libraries can be donwloaded from below reference.


    /*VLC Player*/
    org.eclipse.swt.widgets.Composite videoComposite = new org.eclipse.swt.widgets.Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
    java.awt.Frame videoFrame = SWT_AWT.new_Frame(videoComposite);
    java.awt.Canvas playerCanvas = new java.awt.Canvas();
    playerCanvas.setBackground(java.awt.Color.black);
    videoFrame.add(playerCanvas);
    MediaPlayerFactory mpFactory = new MediaPlayerFactory();
    EmbeddedMediaPlayer vlcPlayer = mpFactory.newMediaPlayer(null);
    videoComposite.setBounds(5,5, 560,244);
    videoComposite.setVisible(true);

    ePlayer.setVideoSurface(playerCanvas);
    /*end */


    Additional reference
    Java bindings for vlc media player
    http://code.google.com/p/vlcj
    http://code.google.com/p/vlcj/wiki/SwtExample
    vlcj sources can be downloaded from
    http://www.capricasoftware.co.uk/vlcj/downloads.php
    vlcj tutorial
    http://www.capricasoftware.co.uk/vlcj/tutorial.php

    Tuesday, September 6, 2011

    Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library

    Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)



    Scenario
    The above is the error sometimes we get, when we try to load a DLL built using Microsoft Visual Studio. This error commonly happens when, one try to load a DLL built on his/her PC and distribute to others. In such situation, the library will be successfully loaded in the source machine in which the DLL is built, but will fail to get loaded in other machines causing the above error. This is due to the library dependencies that gets created when building DLL.

    Reason
            This is due to the library dependencies as said above. Microsoft Visual Studio is highly sensitive on the Build configuration, due to which the generated DLL's dependencies may get affected. For example, the "sample.dll" built may have dependencies on some "XYZ.dll version a.b.c". This "XYZ.dll version a.b.c" may exist in multiple version on a machine due to various reasons, such as Visual Studio version installed, Internet explorer installed etc. Its responsibility of the System, or Application to find the dependencies correct version and load the required DLL. This responsibility factor is decided based on the RT_MANIFEST present in DLL generated.

    Solution
    Sol -1.There are various tools available for checking the dll dependencies. "Dependency Walker" is one of the common tool used to check such dependencies. Once you find the dll dependencies, try to copy these missing dll's in respective folders based on the dll category such as (System dll, application dll's). If all the dll's exist go for the next solution.

    Sol -2. Build the DLL using "release" mode instead of "Debug". This avoids the Visual C++ Redistribution package DLL dependencies being getting added in the RT_MANIFEST. If still unable to load the library in java, go for the final solution below.

    Sol -3. The Project Properties->Code Generation -> Runtime Library option play a crucial role in dll creation. Based on this many dependencies gets added or removed such as MSVCR80D.DLL, MSVCP80D.DLL, IESHIMS.DLL. One solution would be build the DLL as Multi threaded instead of Multi thread DLL as shown

    Monday, June 27, 2011

    Restore Default Ubuntu Panel

    Restoring Default panel on ubuntu

    Open gnome terminal type the below commands

    gconftool-2 --shutdown


    rm -rf ~/.gconf/apps/panel


    pkill gnome-panel"

    :) happy linuxing...