For those of you that are following my web development series, you can download the latest tutorial here :
Website Tutorial 2 – HTML 5
Additionally here is a link to Notepad++ !
For those of you that are following my web development series, you can download the latest tutorial here :
Website Tutorial 2 – HTML 5
Additionally here is a link to Notepad++ !
I’ve just been digging around in some of my old projects and found my Hours Manager application.
The purpose of the application is to provide me with a way of logging the hours that I do, given that my schedule is so busy, trying to remember when I did what can often be challenging. Unfortunately it never saw the light of day again due to my hectic schedule.
Given that again I am in a situation where having a log of my work schedule would be beneficial, of course you may be wondering, why don’t I just download one of the many good time management apps for the play store? The answer for me is simple, what would I learn from that?
Programming in Java is something new for me and I have various other android app’s that i have developed in the past although none of which have ever been polished enough to publish. Therefore I’m making a real effort to get this app on the market, not for profit just for the whole experience of releasing an application.
The challenge I have overcome today was adding the functionality to allow users to delete entries from the sql database. To do so I wanted a dialog window to pop up when the user long pressed one of the entries in the list view.
The code that follows simply creates a new Alert Dialog window from within the SQL View fragment, from there two buttons are initialized (one to confirm and one to cancel). The database is also queried to ensure that the correct item is successfully removed, then the array adapter is notified that the data has changed. From there the list view adapter is updated with a new incarnation of the database.
Hopefully this snippet help’s someone else who’s struggling with creating a Alert Dialog within a Fragment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
protected void removeRow(final long _position) { // Create a new Alert Dialog, with the fragment activity context AlertDialog.Builder alert = new AlertDialog.Builder( getActivity() ); // Here we set the dialog title to that of a static string ("Delete Record?") alert.setTitle(R.string.dialog_title); // Now we open the database and query it for the current entry string - Date , Start Time, End Time etc openDatabase(); alert.setMessage("Are you sure you want to remove the following entry?n" + info.getRowInfo(_position)); closeDatabase(); // When the confirm button is pressed alert.setPositiveButton("Delete", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { // Open the database again openDatabase(); // Delete the entry at a specific position info.deleteRow(_position); // Tell the adapter things have changed adapter.notifyDataSetChanged(); adapter.notifyDataSetInvalidated(); // Re-populate our information in the List Adapter populateList(); lv.setAdapter(adapter); } }); // If the cancel button is pressed simply dismiss alert.setNegativeButton("Cancel",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); // Ensure our database is closed closeDatabase(); // Finally show the alert dialog alert.show(); } |
Alert Dialog displaying record information |
Gender diversity in the video games industry is currently a hot topic at the moment in the light of the gamer gate controversy.
For my Individual Study module I have looked into what the problems are surrounding the topic which you can view here.
I hope someone might find this work useful !
For my final year real time rendering project, I decided to undertake the modeling of the Japanese Matsumoto castle. Most of the modeling was undertaken using 3DS Max of which took around two weeks to model, it was no easy task, given that I am by no means an artist ! This project took a considerable amount of time due to the complexity of the mostly hidden detail that this castle features. Here is a quick example video that took 3 days to render ! After my exams I’ll do a better video of the model & have a play around with the lighting, additionally I will explain some of the difficulties regarding exporting and loading this model into a DirectX program.
Just handed in my last piece of coursework for my third year in University, what a momentous occasion!
Update to follow detailing what I’ve been up to in my last term here in The University of South Wales.
Now all I have left to do is complete exams in Concurrent & Parallel Programming and Artificial Intelligence, then the fun beings!
The plan for the summer is to develop my skills in these areas :
After three days of hacking together mount commands finally my NAS is connected so that it can be accessed from terminal.
The script’s purpose is to mount a networked attached file store using terminal with the correct read and write attributes.
1: ################################################################ 2: # Author : Robert Lutken 3: # E-mail : [email protected] 4: # Date : Sat, 15-02-2014 5: # File Name : nasmount.sh 6: # Purpose : To connect to NAS 7: # Version : 1.0 8: # Notes : Unsecure version should not be used in 9: # volitile domains 10: # 11: ################################################################# 12: 13: #!/bin/bash 14: 15: ## The user name of the account on remote device i.e. admin 16: username=yourusername 17: 18: ## The Password of the user's account on remote device 19: password=yourpasword 20: 21: 22: ## The source location of the server and the share directory. 23: ## In order to mount you should ensure that /etc/nsswitch.conf apears as so: 24: ## hosts: files mdns4_minimal wins [NOTFOUND=return] dns mdns4 25: ## The order is important ! 26: ## and that winsbind is installed -> sudo apt-get install winbind 27: ## 28: ## If it isn't then you may use the IP address of the local server 29: 30: mountSRC=//nameofserver/sharedirectory 31: 32: ## The local directory of where the shared folder should be mounted i.e. /mnt/myshare. 33: ## This will need to be created i.e. sudo mkdir /mnt/myshare 34: mountDST=/wheretomount/share 35: 36: ## Finally the command that put's it all together with relvent read and write permissions. 37: sudo mount -t cifs $mountSRC $mountDST -o username=$username,password=$password,iocharset=utf8,file_mode=0777,dir_mode=0777 38: 39:
There is however an inherent security issue with this script as it stores passwords in plain text.
I would recommend that the use of a credentials file is used :
sudo nano $HOME/Desktop/CIFSCRED
All this file should contain is :
username=yourusername password=yourpassword domain=servername
Press CTRL+X and enter Y and Return to save
The file should then be restricted by using :
sudo chmod 0440 $HOME/Desktop/CIFSPWD
Finally the original script can be updated to
1: ################################################################ 2: # Author : Robert Lutken 3: # E-mail : [email protected] 4: # Date : Sat, 15-02-2014 5: # File Name : nasmount.sh 6: # Purpose : To connect to NAS 7: # Version : 1. 8: # Notes : This version uses a credentials file 9: # which should be secured using : 10: # 11: # sudo chmod 0440 myPasswordFile 12: # 13: ################################################################# 14: 15: #!/bin/bash 16: 17: myCredentials=$HOME/Desktop/CIFSPWD 18: 19: ## The source location of the server and the share directory. 20: ## In order to mount you should ensure that /etc/nsswitch.conf apears as so: 21: ## hosts: files mdns4_minimal wins [NOTFOUND=return] dns mdns4 22: ## The order is important ! 23: ## and that winsbind is installed -> sudo apt-get install winbind 24: ## 25: ## If it isn't then you may use the IP address of the local server 26: 27: mountSRC=//nameofserver/sharedirectory 28: 29: ## The local directory of where the shared folder should be mounted i.e. /mnt/myshare. 30: ## This will need to be created i.e. sudo mkdir /mnt/myshare 31: mountDST=/wheretomount/share 32: 33: ## Finally the command that put's it all together with relvent read and write permissions. 34: sudo mount -t cifs $mountSRC $mountDST -o credentials=$myCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 :