All posts by nick

Android – Final project COMP 3617 – Struggles

Yesterday and the day before i worked on my app, to display in the listView the following items:

title, event date and the picture of the event.

the things that i dislike is that the download the picture if each event , took place in the EventListAdapter, and reload everything when i switch tab from music to event, even the pictures.

so the mainactivity of the App where looking in the main url : http://www.straight.com/listings/events

Capture

and would use the html tag element to grab the title. dates and the picture’s url, as well as the url for each events represented like this : /listings/events/723706

then store everything in a Event object.

then the EventListAdadpter will get the Event object and use titl and date but also download image of the event.

clicking on that link will bring up details of the event with description of the event :

Capture_event

this page contains further informations , like the event description, the location, that i will need to display (with the date, title, picture  as well)by tapping on one of the event in the listView.

The listAdapter was very slow and struggling to display the picture fast enough, even if those pictures where pretty slow.

So i took an another approch, that will be to load all the Events details in one shot.

Here is the step i did followed :

Step 1 – Download the http://www.straight.com/listings/events index.html (using a Thread) and it will return a String with all the HTML data.

Step 2 – Parse this String object to find the link of each Music and art event (eg : /listings/events/723706) and store them in 2 String array one for music and one for arts.

Step 3 – go on each String array and download the HTML data of each events and store the data in String array for Musics and arts, so now i have every Event complete informations.

Ste 4 – for each String Array Event html data i will invoke a Method to parse and get me the following : title, date, location, full description, imglink and create an array of event object for music and one for art.

step 5 – in that step i am going to download each image of the event, store and name them (title event) in the device memory, the save method is going to return me the full path name that i will store in each object event.

step 6 – i am going to add those Event object in my SQlite database.

The project has been tested on a simple Mainactivity application, that display the images in the main Layout, i am going to post it on bitbucket :

https://bitbucket.org/ntarral/websitegetimages

 

 

 

 

Android – Final project COMP 3617 – PART 2

I have a fews things that needs to be put in place :L

First  : the UI that will be  2 tabs that will display the Arts and Musics event list:

a little picture the title and the date.

i will use for that 2 fragments and inside each fragment i am using a ListView.

if we click on one of the item in the list it will display a new activity with further details.

second :

i will have to implement the core function of the app, that will consist of a web parser that will use the event url.

I started with the UI :

Screenshot_20160627-204009

 

So far this is a first quick presentation and there is 2 tabs each tabs have a fragment , in that fragment currently selectioned, we have a LisView with 4 view, i am actually using a list View adapter to build the listView and each view is customized.

Android – Final project COMP 3617

COMP 3617 needs to be validated by a  final project, that need to be presented to the class, for the last session.

Here is the pitch :

Motivation :

I like to visit the Georgia straight new paper on my smartphone to check for the latest events and have time to see them.

I find out the website to be a little heavy in order to access the information I just need.

The purpose of this application will be to display the just announced events which are under the URL :

http:// http://www.straight.com/listings/events

georgia

I can choose to display the Music events  or arts event from the Georgia straight Journal.

Clicking on one of the event shows the details of the show with the Image, the location the date, the price and the full description.

Implementations :

The main activity will display a list View with 2 tab , one tab will display the music events and the other to display the arts events.

It will display those events with the title, the image, and the date.

Clicking on one of the item in the listView , will display a second Activity called EventActivity

EventActivity :

Displaying further details of the event.

Display the picture, the date of the show, the event’s location, the price and also a short description.

There will be options to set up the event on the calendar or to share it by email.

In order to get the information’s from the website I could choose to use the news feeds or to try to GET the webpage and parse the HTML, I find out than the news feeds might not have the just announced events.

I will also implement a preference menu to choose to display the images or not in the Main Activity, and also an another CheckBoxPreference to choose to display only the week end events.

Every time the application opens, the Main activity will load the events from the website, which depends on the users Preferences, there will be a refresh button to refresh those events.

Further implementation :

If I have the time I can choose to show the event’s address on a map with a button in the EventActivity.

servlet doGet /doPost

there is a method to get the launch the doGet method servlet when we start the server on eclipse or when we access the server.
there is a JSP page which is in charge to display all the details given by a database.
we must load the database before launching the JSP and displaying the date.

all the magic happen in the web.xml configuration file :

================================================================================================================================================================

 

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” version=”3.0″>
<display-name>Lab03_Project</display-name>

<context-param>
<param-name>instruction</param-name>
<param-value>
Please enter a temperature to convert.
</param-value>
</context-param>

<servlet>
<servlet-name>Driver</servlet-name>
<servlet-class>a00805231.assignment1.Driver</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Driver</servlet-name>
<url-pattern>/assignment1</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>assignment1</welcome-file>
</welcome-file-list>
</web-app>

we have to get the serlvet name Driver and the access to the Main class called Driver as well.
there is a server mapping which is going to map the url assignment1 to the servlet name.

then there is the welcome file before it was my main JSP page called index.jsp so the server were launching this page by default then skipping the doGet method which load the DB(this need to be fixed later to implement this inside the init method of the servlet.
here we choose to provide the url-pattern called assignment1 which is going to launch the servelet main class and the doGet by default.

This is a remionder for me in case i need this later.

COMP-2613 RaodMap

COMP-2613

Week
Outcome/Material Covered
Assignment
Note! The topics below have links to the Java Tutorial. You are expected to read the material each week.
0
The following is covered in the prerequisites and you are expected t know this material:
1
The eclipse Integrated Development Environment
Lab 1
2
Core Classes – Numbers & Strings
Debugging
Lab 2
3
Quiz 1
Lab 3
4
Lab 4
5
Quiz 2
Lab 5
6
Midterm Exam (1 hour)
Assignment Q & A
Assignment 1 due before session 7
7
Lab 7
NOTE: Course Withdrawal Deadline
Please inform your instructor that you are dropping this course. You must also fill out and submit the ‘REQUEST TO WITHDRAW FROM A PART-TIME STUDIES COURSE’ before week 8 or else you will receive a failing grade on your academic record.
8
(read up to Guarded Blocks)
Lab 8
9
User Interfaces with Swing
Lab 9
Quiz 3
10
Design patterns featuring Model-view-Controller
Lab 10
Assignment 2 due before session 11
11
Quiz 4
12
Final Exam

deferencer pointeur en C

Ici, je vais expliquer le notion de deferencement de pointeurs en C.

Un pointeur contient une addresse qui identifie l’addresse d’une variable.

 

lorsque l’on veut acceder a une valeur, une donnee localise a une addresse memoire qui est pointe par un pointeur, on apeller cela deferencer un pointeur.

en C ceci est un pointeur de char :

const char*  p = “abc”;

on utilise 4 octets (bytes), 4 car on mets en memoire 4 caractere a, b, c et 0 pour indiquer au C ou ce termine la chaine de caractere.

tous ceci est stocke dans un addresse memoire quelconque et sont addresse est stocke dans la variable p

 

addresse memoire                                     variable                               contenue
1000                                                                                                                      ‘a’
1001                                                                                                                      ‘b’
1002                                                                                                                      ‘c’
1003                                                                                                                        0
….
2000-2003                                                                p                                         1000

pour deferencer p on utilise une de ces code :

assert(*p == 'a');le premier caractere a  l'addresse p sera 'a'
assert(p[1] == 'b'); p[1] deference le pointeur cree en ajoutant p et une  fois la taille de la chose que p pointe dans ce cas ce un char de taille 1 octet 
assert(*(p + 1) == 'b');on ajoute 1 au pointeur soit addresse 1001

p++; va faire pointer sur addresse 1001 et

assert(*p == 'b'); et p pointera vers 'b'

Dans le cas ou on utilise l’allocation de memoire dynamique avec un malloc

int* p = malloc(sizeof(int)); reserve de la memoire a un endroit  quelconque

*p = 10; on deference le pointeur de la memoire et on ecrit une valeur
fn(*p);  appelle fonction fn et passe la valeur a l'addresse de p.
(*p) += 3; change la valeur de p et ajoute 3.
free(p); libere la memoire alloue dynamiquement.


un cas pour les void  * :

le compilateur nous transmettra un message d’erreur si on essaie de deferencer un void * car il ne sait pas la taille de la variable qu’il  pointe.

si  par exemple la variable pointe est un char qui est un octet le compilateur accedera ce seul octet. si il sagit d’un double il y aura plus de memoire alloue mais aussi son architecture sera differente. avant de deferencer ce pointeur generique void * nous devrons le caster vers le type de valeur desire.

quelques exemples pour le deferencement :

int nb = 6;
void *ptr;
ptr = &nb; /* ici dans la case memoire de ptr on range l’addresse de nb. */
printf(“\nLa valeur de nb est : %d”,*((int*)ptr)); /* on caste le ptr en pointeur de int, puis on accede a sont contenant grace a l’etoile exterieure (*…..). */

ou alors :

int nbptr
void* ptr = NULL;
ptr = &nb;
nbptr = *((int*)ptr); /* meme explication que au dessus, le pointeru

Le pointeur void* ne pointe vers rien de particulier, si l’on veut le deferencer, il faut d’abors changer de type de pointeur, dans ce cas ci il faut passer par un pointeur de int.
soit l’ecriture (int*) qui caste le pointeur void* appeler ptr en pointeur de int, mais ce n’est pas fini.
notre pointeur ressemble a int* ptr, pour acceder a la case memoire par ce pointeur il faut donc regarder ou il pointe ou le deferencer avec *((int*) ptr) qui va donc extirper la valeur int de la case memoire.

 

 

My new application in C

Here is a new application i made in C with the SDL 1.2.

this is just the front screen for the interface of my internal software at work.

the front screen is just a few button to select option and a char field to enter the customer phone number, and of course a submit button.

 

here is a print screen, the source code will be available soon on my Git hub.

i had the idea to create a GUI in DOS-like gui, it might be not that nice but that could be a good template to improve it.

front screen Dos-like

front screen Dos-like

First Game in C

Hello,

i was busy learning about C and making some progress as i did manage to get a Game fully working in C with the SDL library.

This is a very short video  of my game working, i did manage to get it working on my linux box with the GCC 4.7.2 and SDL version 1.2.

but i do not have an exe file for windows for now.

Borpion