Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

Monday, September 17, 2012

Computer Science - Visual Studio

When importing a project that uses the universal compilation method of cmake and qt into visual studio, its possible to get some errors. Namely that the ZERO_CHECK for the project is out of date, and that the system cannot find the file ALL_BUILD. This error occurs in the debug phase, if your project is up to date and can properly compile, just building it will execute properly. It is only when you attempt to create an executable that this break occurs.

In the event that this happened, just right click on the solution explorer to open a menu, select set startup projects, and set your current project as the startup project. This will allow the debug to run properly.

Wednesday, September 12, 2012

Computer Science - Making an icon

On the mac after downloading Xcode its possible to create .icns files for your apps with a command line function called iconutil assuming that you installed the command line tools associated with Xcode. Make sure those are all enabled. Prior to Xcode 4.4, you would use an application called icon composer but this app has long been deprecated.

So first start by creating a folder called icon.iconset.
mkdir icon.iconset

Then create your image files using whatever image editor you want. Create images that are exactly 512x512, 256x256, 128x128, 32x32, 16x16 in size otherwise the utility will fail.

Then just run the following command in the area you want to create the icon in, not necessarily in the icon.iconset folder.
iconutil -c /filepath/to/icon.iconset/folder
The utility should run fairly quickly and generate a .icns file for you to use!

Thursday, September 6, 2012

Computer science - Open Finder from Terminal

When developing on a mac this will help make things a bit easier to manage. When in a terminal all you have to do to open the finder from the command line is use

open .

as shown in the following, it will open up finder in the current directory your terminal is in.


Tuesday, August 28, 2012

Computer Science - BOINC

BOINC is an open-source software that can be used in a volunteer fashion and for grid computing. It can be found at http://boinc.berkeley.edu/. The idea is to use the processing power of computers in idle time. The easiest use is as a donation service of extra computational power to already ongoing research projects. An example is the computation of a 3-D model of the SDSS or sloan digital sky survey. This project can be found here http://milkyway.cs.rpi.edu/milkyway/. It can also be used in a private sense in order to set up a grid supercomputer at a university by linking together the campus computers. The same system can be set up for company long term grid computing, with the application running in the background without need for screensaver graphics.

BOINC works by getting a set of tasks from a project's scheduling server. The computer then downloads executables and input files from the project's data server. The pc then runs the computations and uploads the output files back to the data server. Later the pc will report on completed tasks and receive new tasks indefinitely.

Thursday, August 23, 2012

Computer Science-Gettext


Gettext is a function in gnu that allows the user to switch between different languages. Due to the majority of computer science documentation and software being written in english, gettext is meant to help even the field for the rest of the world. It can be downloaded at the following location.
However, there is a known error with gettext versions 0.18 above. Before doing the normal ./configure 
make 
sudo make install 
You must change the file stpncpy.c. Go into the directory where gettext is installed.
cd ../gettext-0.18.1/gettext-tools/gnulib-lib
vi stpncpy.c


Then before the line #ifndef weak_alias
add #undef stpncpy


It should look like the following


/* This is almost copied from strncpy.c, written by Torbjorn Granlund.  */

#include <config.h>

/* Specification.  */
#include <string.h>

#undef stpncpy
#ifndef weak_alias
# define __stpncpy stpncpy
#endif

/* Copy no more than N bytes of SRC to DST, returning a pointer past the
   last non-NUL byte written into DST.  */

This lets the build compile on a mac machine as there is an overlap in definition issue with stpncpy.c and an already existing strncpy.c in XCode on the mac os. This is not an issue on linux machines.

Tuesday, August 21, 2012

Computer Science-GTK

GTK is a Gnu version of Qt, a packaged gui builder. It builds off of the X window system and was originally designed for GIMP. The following is to help with the installation of it, but since it uses jhbuild to automatically download and compile source code, its not too difficult to follow.

First find the shell script to run here.
https://live.gnome.org/GTK+/OSX/Building
scroll down to the procedure section, and follow the instructions to set up GTK. The text for the script can also be directly found here, execute it after retrieving the text. If you want you can use the curl command to directly get the txt from here:
http://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh
After the script is downloaded, go into terminal and cd to where the script is located and run the following 4 commands.

sh gtk-osx-build-setup.sh
jhbuild bootstrap
jhbuild build meta-gtk-osx-bootstrap
jhbuild build

These commands are also located as comments within the script.

Tuesday, August 7, 2012

Computer Science-Qt build update

Once again I misinterpreted a lot of what was written about the couldn't find Qt issue. The main parts are to ensure that Qt is completely installed, and to add this to the path.
PATH=$PATH:filepath/to/QtSDK/Desktop/Qt/4.8.1/gcc/bin
Once this is done, source it or restart your computer. Then you should be able to execute the commands correctly. For example to build XCode files you can use:
cmake -g XCode /filepath/to/src/

This should definitely allow things to work out on a mac. This location contains the correct bin, with the correct version of qmake, unlike the previous areas.

Computer Science-Qt Madde/PkgConfig

There has been an error I've been getting while calling Qt through cmake. It gives me the error Can't locate Madde/PkgConfig.pm in @INC. In order to help fix this issue, you have to make the pkg-config commands work under the mad environment. Thus in the ../QtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/share/qt4/mkspecs/features folder you can find a file labeled link_pkgconfig.prf.

vi link_pkgconfig.prf

to open it

then edit it by adding the word mad before each instance of pkg-config like so.

mad pkg-config
I still don't know yet if this is necessary, but I've updated some help on building Qt http://ctluk.blogspot.com/2012/08/computer-science-qt-build-update.html

Monday, August 6, 2012

Computer Science-Qt Updated

This is an update to what I wrote previously, I was confused on the installation of Qt.

After installing the QtSDK, cd into it
cd /filepath/to/QtSDK
run the SDK Maintenance tool via command line or through explorer window
Complete install(This will take a few hours)
This installation does not complete the installation of the particular version of Qt you want to run.
This now creates a QtSources folder it will have all the versions of Qt you have downloaded listed here. 
Example used version 4.8.1
cd /filepath/to/QtSDK/QtSources/4.8.1
http://qt-project.org/doc/qt-4.8/install-mac.html
follow the installation instructions
Now there is the appropriate configure file. 

./configure
make
sudo make install

Then set the environment variables, you must extend the path.
pico ~username/.bash_profile
PATH=$PATH:/usr/local/Trolltech/Qt-4.8.1/bin

Now the installation is complete when downloading from sdk.

Wednesday, August 1, 2012

Computer Science-Qt

http://doc.qt.nokia.com/4.7-snapshot/install-mac.html
Qt is a cross platform application framework for the use of developing gui's.
Just as a note, some previous versions of Qt have the command line tools listed under Qt/bin which is no longer existent as Qt has begun to merge with Madde in their development.
http://wiki.maemo.org/MADDE

go to QtSDK and double click on the SDK Maintenance tool in order to complete install and updates.

updates found here
http://ctluk.blogspot.com/2012/08/computer-science-qt-updated.html
http://ctluk.blogspot.com/2012/08/computer-science-qt-build-update.html

Wednesday, July 25, 2012

Computer Science-Android Development Environment


Android Development Environment

This is meant to be a quick summary, in setting up an android development environment. There is more thorough documentation provided at http://developer.android.com/tools/index.html. However it can be a bit confusing to read through. This is meant to help as a quick reference. Now first to get started we must install the necessary development kits and tools, these include the Eclipse JDT, and the Android NDK and SDK. You can find Eclipse at:
http://www.eclipse.org/downloads/
Select Eclipse classic 4.2 for your system whether it be Windows, Linux, or Mac.
Then go to:
http://developer.android.com/sdk/index.html
Where you can find the android sdk, and here for the ndk
http://developer.android.com/tools/sdk/ndk/index.html

Eclipse is the java environment where you can develop your android application, and the ndk and sdk are development kits for c++ and java respectively. Place the ndk and sdk in a development directory of your choosing. Choose a simple file path as you will need to link to these later on.

Now we have to set up eclipse itself for android development. Open eclipse and select a workspace folder.



Installing the ADT Plugin
Follow the instructions located here in order to set up the ADT Plugin
http://developer.android.com/sdk/installing/installing-adt.html
I’ve summarized the instructions here for convenience:

  1. In eclipse, select Help > Install New Software
  2. Click Add in the top right corner
  3. An add repository window should appear, enter "ADT Plugin" for the name and this as the URL for Location: https://dl-ssl.google.com/android/eclipse/
  4. click ok, if there is an error try http instead of https
  5. select the available software and click next, and download the tools that you require for the given api levels.
  6. restart eclipse when finished with instillation
SDK NDK Setup
This is to tell eclipse where to find the development kits

  1. Select Window > Preferences or Eclipse > Preferences if on Mac OS X
  2. Select Android
  3. Find the SDK Location in the top of this main panel and browse to the SDK directory
  4. Apply, then ok
For the NDK

  1. Select Window -> Preferences -> Android -> NDK or Select Eclipse -> Preferences -> Android -> NDK if on Mac OS X
  2. Then locate the NDK directory through browse




Emulation Wrapper
Now browse to the top level folder of your the android sdk.
cd /android-sdk/tools/
Once here we need to make some changes to the emulator, current as of July 2012 there is an error caused by an audio memory leak in running the android emulator through eclipse. Thus we have to create a wrapper so that eclipse can run the emulator with a reduced risk of crash.

mv emulator emulator.real
vi emulator

Input the following into the text file

#!/bin/sh
exec /Users/lukchristo/eclipse/android-sdk/tools/emulator.real -noaudio -avd AndroidTest

Additional commands can be found here
http://developer.android.com/tools/help/emulator.html



AVD Command Line Creation
Now to create a Android virtual device we follow the directions here:
http://developer.android.com/tools/devices/managing-avds-cmdline.html

./android-sdk-macosx/tools/android list targets
./android-sdk-macosx/tools/android create avd -n MyTestAVD -t 1
Do you wish to create a custom hardware profile [no] no

The AVD devices will be placed in /User/<username>/.android/avd/MyTestAVD
~/.android/avd/


ADB Install and Commands
In the case where you want to install a package onto the emulator, first open the emulator. You can do this from either command line or from eclipse. From the command line run
/filepath/android-sdk-macosx/tools/emulator
in order to open the avd
Then once the emulator is open go to
/filepath/android-sdk-macosx/platform-tools/
then run the command
./adb install /filepathtopackage/package.apk

./adb push can be used to push a file from your directory to the device being simulated
./adb push foo.txt /sdcard/foo.txt
./adb pull can be used in the opposite manner to push, retrieving a file from the device being simulated