tag:blogger.com,1999:blog-58255569710010610102024-02-06T21:10:49.469-08:00Code Blog by Niki AhlskogThis page is a random collection of notes addressed to myself. Nothing here is intended as a guide per say, however i have posted them hoping that it may help someone.
Blog about Coding and things related. Everything in this blog can be copied or edited GNU General Public License (version 2 or newer) http://www.gnu.org/licenses/gpl.htmlUnknownnoreply@blogger.comBlogger28125tag:blogger.com,1999:blog-5825556971001061010.post-80190478914342491492016-08-02T00:42:00.001-07:002016-08-02T00:42:53.755-07:00AngularJS tips and tricks.I struggled with few things in AngularJS so here are the solutions I managed to do everything.<br />
<br />
<h3>
NG-repeat in select way 1. different value and text</h3>
<br />
<select class="styled-select" ng-model="group.id"><br />
<option disabled selected value> -- select group -- </option><br />
<option ng-repeat="group in groups" value="{{group.id}}">{{group.name}}</option><br />
</select><br />
<br />
<h3>
NG-repeat in select way 2. different value and text</h3>
<br />
<select class="styled-select"<br />
ng-options="group.name for group in groups track by group.id"<br />
ng-model="group.id"></select><br />
<br />
<br />
<h3>
NG-repeat if condition</h3>
<div>
<br /></div>
<div>
<div>
<li ng-repeat="group in user.groups"></div>
<div>
<span class="label label-info label-groups"></div>
<div>
<span ng-if="group.group.name === 'admins'">Admin</span></div>
<div>
<span ng-if="group.group.name === 'devices'">User</span></div>
<div>
<span ng-if="group.group.name === 'business'">User</span></div>
<div>
<span ng-if="group.group.name === 'readers'">Viewer</span></div>
<div>
</span></div>
<div>
</li></div>
</div>
<div>
<br /></div>
<h3>
Class based on condition</h3>
<div>
<br /></div>
<div>
<div>
<td ng-class="{'label label-danger' : alarm.severity === 'CRITICAL',</div>
<div>
'label label-warning' : alarm.severity === 'MAJOR',</div>
<div>
'label label-info' : alarm.severity === 'MINOR',</div>
<div>
'label label-default' : alarm.severity === 'WARNING'}">{{alarm.severity}}</td></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-91022999338548742772016-03-04T05:37:00.002-08:002016-03-04T05:37:28.806-08:00How to create fancy looking triangles with CSSI wanted to learn how to create those fancy looking triangles with css so here is my result.<br />
<br />
<!DOCTYPE html><br />
<head><br />
<style><br />
body {<br />
padding: 0;<br />
margin: 0;<br />
}<br />
.arrow-up {<br />
margin-top:10px;<br />
background: transparent;<br />
height: 0;<br />
border-left: 100vw solid transparent;<br />
border-bottom: 100px solid #ff0;<br />
}<br />
.tausta {<br />
background:#ff0;<br />
height:200px;<br />
padding:20px;<br />
}<br />
</style><br />
</head><br />
<body><br />
<div class="arrow-up"></div><br />
<div class="tausta">Sample text</div><br />
</body><br />
</html><br />
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1jpgaBCX-Wyzf01qKxKMJVJsUSqaxyF9sb2OZYb7cGApVh5yTr3r-WPz8LDLyAGC8GrL4_qokCk-rqINVBS1-5WIgcEZqH5Wxa-dlMVJIj_zX8SVC0iRKGGu_NctyI9zj2uf-eZZhPXs/s1600/Selection_010.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1jpgaBCX-Wyzf01qKxKMJVJsUSqaxyF9sb2OZYb7cGApVh5yTr3r-WPz8LDLyAGC8GrL4_qokCk-rqINVBS1-5WIgcEZqH5Wxa-dlMVJIj_zX8SVC0iRKGGu_NctyI9zj2uf-eZZhPXs/s640/Selection_010.png" width="640" /></a></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-60661116633162733792016-03-04T05:10:00.002-08:002016-03-09T05:39:32.916-08:00MongoDB server learningsToday I just needed to learn what is MongoDB. First I watched these four episodes what is MongoDB and got the idea. <a href="https://www.youtube.com/watch?v=liQzIsFnCr0">https://www.youtube.com/watch?v=liQzIsFnCr0</a> I really recommend watching these if you have no idea what mongo is.<br />
<br />
MongoDB is "file based" database. MongoDB has collections and inside colletions we have documents which represents our relational database model.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbCzRBEQhT01QpVaq0zMnZCUviC6aVt_xRGlza2ruDrISWBog_l6PJB0k0FWtxcY9SI-K1zOfNFFgdFtk9d9b4pPePPDG5YhtVQmTjMH-QGzOs8hBlHMX0Au8FGCSRQ-AX0R-o8kaZV1w/s1600/crud-annotated-mongodb-insert.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbCzRBEQhT01QpVaq0zMnZCUviC6aVt_xRGlza2ruDrISWBog_l6PJB0k0FWtxcY9SI-K1zOfNFFgdFtk9d9b4pPePPDG5YhtVQmTjMH-QGzOs8hBlHMX0Au8FGCSRQ-AX0R-o8kaZV1w/s640/crud-annotated-mongodb-insert.png" width="640" /></a></div>
<br />
So this is how mongoDB looks like. Compared to MySQL relational database, we have rows:<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY-0rPq4dhvJlmp2WEwc7IwxCiqK9GW2iu9W-6KTz04cOqFSvJnhMhXWnkbha3y6zCRv71E8QK6OyFyEu56P1RfN9y6ezzsOGba9lksX_lQKGG23cFktbanCylHCynSnmjLjm7s1cLWl8/s1600/Selection_008.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="70" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY-0rPq4dhvJlmp2WEwc7IwxCiqK9GW2iu9W-6KTz04cOqFSvJnhMhXWnkbha3y6zCRv71E8QK6OyFyEu56P1RfN9y6ezzsOGba9lksX_lQKGG23cFktbanCylHCynSnmjLjm7s1cLWl8/s640/Selection_008.png" width="640" /></a></div>
<br />
<br />
Student_id, score, first_name, last_name and so on. MongoDB format is called BSON, its almost like JSON format: <a href="http://bsonspec.org/">http://bsonspec.org/</a><br />
<br />
To install mongodb on linux platform:<br />
<br />
<b>sudo apt-get install mongodb-server</b><br />
<b><br /></b>
And php driver for mongo<br />
<br />
Install MongoDB PHP Driver<br />
<b><br />sudo apt-get install php5-dev php5-cli php5-mongo php-pear -y</b><br />
<b>sudo pecl install mongo</b>Open your php.ini file and add to it:<br />
<div>
<b><br /></b></div>
<div>
<b>extension=mongo.so</b></div>
<div>
<b><br /></b>Restart apache.<br />
by default mongodb server will be installed on port 27017. Mongodb commands are pretty similar to mysql, here I found good examples: <a href="http://www.tutorialspoint.com/mongodb/mongodb_create_database.htm">http://www.tutorialspoint.com/mongodb/mongodb_create_database.htm</a><br />
<br />
Create new index.php file and insert following:<br />
<br />
<b><?php</b><br />
<b> // connect to mongodb</b><br />
<b> $m = new MongoClient();</b><br />
<span class="Apple-tab-span" style="white-space: pre;"><b> </b></span><br />
<b> echo "Connection to database successfully";</b><br />
<b> // select a database</b><br />
<b> $db = $m->mydb;</b><br />
<span class="Apple-tab-span" style="white-space: pre;"><b> </b></span><br />
<b> echo "Database mydb selected";</b><br />
<b>?></b><br />
<div>
<br /></div>
MongoDB will create database automatically if it doesnt exist. You should be creeted with message:<br />
<br />
<div>
Connection to database successfully<br />
Database mydb selected<br />
<br />
<h2>
Mongo Shell</h2>
</div>
</div>
<div>
MongoDB is javascript like preprocessor or something like that. To login to MongoDB server, say <b>mongo</b></div>
<div>
<b><br /></b></div>
<div>
Then you can try to type: <b>for(i=0; i<5; i++) print("hello");</b> in the shell and Mongo should print hello five times.</div>
<div>
<br /></div>
<div>
<b>show dbs</b> shows current databases.</div>
<div>
<b>db </b>shows the current selected database</div>
<div>
<b>use databasename </b>selects database</div>
<div>
<b>db.first.insert({"name": "test"}) </b>creates new collection to database.</div>
<div>
<b>db.first.find() </b>prints the collection<br />
<b>db.first.find().forEach(printjson) </b>prints in json format</div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-7914275930747499202016-01-28T06:09:00.000-08:002016-01-28T06:09:08.711-08:00CSS Tricks - Text overflow fixed with CssSo probably everyone has seen a problem where floating items or text overflows the current div. The usual solution is to create empty div after the element and clear both, but it can be solved with pure CSS. Here is how:<br />
<br />
<b>.classname::after{</b><br />
<b> content:"";</b><br />
<b> clear:both;</b><br />
<b> display: block;</b><br />
<b>}</b><br />
<b><br /></b>
Use pseudo element after to add an empty item. This fixes the overflowing problem without using: overflow: hidden.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-72773538759760428232016-01-27T03:14:00.002-08:002016-01-27T03:14:38.080-08:00jQuery tricks Toggle HTML Element ChangeI struggled so much about changing element with jQuery and I finally after few hours of searching found a little hack to do this so I wanted to share it with everyone.<br />
<br />
First create two html elements with same classname, but add display:none to other element like this:<br />
<br />
<b> <span class="trick">Open</span></b><br />
<b> <span class="trick" style="display:none;">Closed</span></b><br />
<br />
Then with jQuery just do<br />
<br />
<b> $('.trick').toggle();</b><br />
<b><br /></b>
And super, the element is toggling!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-88668281739186321492016-01-14T00:37:00.002-08:002016-01-14T00:37:51.412-08:00Storing cordova project to GitI have had this question in my mind for a while. What should I store to git when creating Cordova project? Here is the answer:<br />
<br />
hooks (can be empty)<br />
res<br />
www (not mandatory)<br />
config.xml<br />
splash.png<br />
<br />
So the minimum requirements are there. Even www folder is not mandatory if project is generated from other files. After you have cloned the project, create folders: plugins, www, platforms and use command: <b>cordova platform add android</b><br />
<b><br /></b>
With empty folders cordova recognizes the project. So platform folder should always be generated on development computer.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-10140531043620450432015-12-14T04:51:00.000-08:002016-01-27T01:07:18.560-08:00Learning HerokuappHeroku is a cloud application platform designed for developers. You can focus on developing and heroku does the rest. Publishing is through best practises; GIT. Software developers prefer using command line tools so Heroku is built that way. Heroku lets app developers spend their time on developing, not managing servers. Deployment, ongoing operations or scaling are easy to do in heroku.<br />
<br />
To get started register your account at https://www.heroku.com/ next install heroku toolbelt which is command line tool to use heroku. First make sure you have Ruby installed in your system, if not then<br />
<br />
<b>sudo apt-get install ruby-full</b><br />
<div>
<br /></div>
<div>
After that install heroku toolbelt </div>
<div>
<br /></div>
<div>
<b>wget -O- <a href="https://toolbelt.heroku.com/install-ubuntu.sh">https://toolbelt.heroku.com/install-ubuntu.sh</a> | sh</b></div>
<div>
<b><br /></b></div>
<div>
After installation do:</div>
<div>
<br /></div>
<div>
<b>heroku login </b>and login with your credentials. After that you are logged in. Next create a project in some folder.</div>
<div>
<br /></div>
<div>
<b>heroku create</b> creates a new "server" for you. You can name it how you want as long as its not already taken. Like <b>heroku create lollero</b></div>
<div>
<b><br /></b></div>
<div>
Then create a new folder for your project, add files and commit then normally. After that add your heroku remote with command:</div>
<div>
<br /></div>
<div>
<b>heroku git:remote -a lollero</b></div>
<div>
<b><br /></b></div>
<div>
Now you can deploy your app just by typing <b>git push heroku master</b><br />
<b><br /></b>
If you have multiple heroku remotes, just check them with:<br />
<br />
<b>git remote -v</b><br />
<b><br /></b>
and then push to another heroku app:<br />
<br />
<b>git push herokuappname master</b><br />
<b><br /></b>
IF heroku complains about public key, just simply add it before pushing:<br />
<b>heroku keys:add ~/.ssh/id_rsa.pub</b></div>
<div>
<b><br /></b></div>
<div>
and ta-da, your application is about to be deployed. In herokuapp you can also set custom domain names for your project, rollback versions etc.</div>
<div>
<br /></div>
<div>
<b>heroku releases </b>shows all your releases.</div>
<div>
<b>heroku rollback v5 </b>rolls back to version you wanted.</div>
<div>
<br /></div>
<div>
Buildback defines your application language. To add buildbacks:</div>
<div>
<br /></div>
<b>heroku buildpacks:set heroku/nodejs</b><br />
<b>heroku buildpacks:add https://github.com/username/package.git </b><br />
<div>
<br /></div>
<div>
https://devcenter.heroku.com/articles/buildpacks#detection-failure<br />
<br />
Read heroku log with <b>heroku logs --tail</b></div>
<div>
<br />
Set heroku configuration variables with command: <b>heroku config:set IS_HEROKU=TRUE</b><br />
<br /></div>
<div>
To read more about heroku:</div>
<div>
<br /></div>
<div>
Heroku devcenter has very good documentation: https://devcenter.heroku.com/start</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-64656336716233320612015-12-08T02:34:00.000-08:002015-12-11T05:33:36.813-08:00Node version manager and usefull NPM commandsInstall Node version manager with command:<br />
<pre style="background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash</code></pre>
(https://github.com/creationix/nvm/blob/master/README.markdown)<br />
<br />
Then install Node version <b>nvm install 5.0</b><br />
<b><br /></b>
Change Node version with <b>nvm use 5.0</b><br />
<br />
See what packages you have previously install globally: <b>npm list --depth 0 -g</b><br />
<div>
<br />
Node versions can be found here http://nodejs.org/dist/<br />
<br />
To see versions of single package use command: <b>npm view appname versions</b><br />
<b><br /></b>
To install specific version use command: <b>npm install -g appname@4.3.1</b></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-5518695472600199622015-10-29T03:40:00.006-07:002016-01-05T02:21:00.721-08:00Advanced git. Cherry-pick, rebase and reset.Today I encountered the following problem: I had put code in another branch that I would need in my master branch, BUT I could not take all code, just few commits. So I first found command called cherry-pick.<br />
<br />
With cherry-pick you can merge one (1) commit from another branch and is quite easy to do, but eventually I found out that it is not a right tool for my job. Anyway, checkout your branch where you want to pick the commit.<br />
<br />
<b>git checkout mysecondbranch</b><br />
<b><br /></b>
then do git log with oneline option to show prettier log.<br />
<br />
<b>git log --oneline</b><br />
<div>
<b><br /></b></div>
<div>
Then just select the commit you want and checkout back to the master branch. Do</div>
<div>
<br /></div>
<div>
<b>git cherry-pick 62ecb3</b></div>
<div>
<b><br /></b></div>
<div>
And you will merge that commit to your master.</div>
<div>
<br /></div>
<div>
Now if you need to merge multiple commits but not the whole branch cherry-picking is not the right tool for this job. We can rebase. First create a new temporary branch from the branch you want to do the changes. Then do rebase.</div>
<div>
<br /></div>
<b>git rebase --onto mythirdbranch 76cada^</b><br />
<div>
<b><br /></b></div>
<div>
This means that from our "mythirdbranch" from commit number to the last one are applied to the temporary branch. </div>
<div>
<br /></div>
<div>
Here this all is explained very well! <a href="https://ariejan.net/2010/06/10/cherry-picking-specific-commits-from-another-branch/">https://ariejan.net/2010/06/10/cherry-picking-specific-commits-from-another-branch/</a></div>
<div>
<br /></div>
<div>
OK so if you mess up with the rebase thing, you can do </div>
<div>
<br />
<b>git rebase --abort</b><br />
<b><br /></b>
or if you already did the rebase, revert it with the following:<br />
<br /></div>
<b>git reflog</b><br />
<div>
<b><br /></b></div>
<b>git reset --hard HEAD@{5}</b><br />
<div>
<b><br /></b></div>
<div>
and the number inside head is the commit where you started the rebase. </div>
<div>
<br /></div>
<div>
Finally merge the temporary branch your master branch.<br />
<h2>
<br />PRO TIP</h2>
<br />
<b>ssh-add id_rsa </b>will add your ssh key to keyring or something. Then you don't need to enter password every single time when you connect to git.</div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-56834901528994365222015-08-14T03:46:00.002-07:002015-08-14T03:46:46.836-07:00Potatoman adventures - Mobile gameLong time no articles for my blog. I attended to Haaga-Helias mobile programming couse last year so this post is about my experience about mobile programming.<br />
<br />
We had to use <a href="http://phonegap.com/">PhoneGap</a> for compiling our apps, but in the end we decided to use <a href="https://www.ludei.com/cocoonjs/">CocoonJS</a> for building our game. The final task of the course was to create our own mobile application of course. I haven't created any mobile games yet, so I decided with my friend we will make a mobile game for Android. I also had two Android phones to test the application.<br />
<br />
First we decided the game should be Super Mario like 2D runner game with very easy controllers. Maximum of 4 buttons. Then we decided to use only 3 buttons. Left, right and jump. The game is easy enough to be played on the mobile. The challenging part was which game engine we should use or use our own? We found many different engines, but we wanted HTML5 based game engine, because then the game would be easy to port to any operating system. Then we found <a href="http://www.html5quintus.com/">Quintus</a> which was what we were looking for. It had mobile controllers implemented already. We decided to do at least three levels for the game, create some sound effects, background music and a little starting intro like in Max Payne which is black and white comic.<br />
<br />
It actually took us very long to do the game. If we had created the whole engine it would have taken over a year from the team of two guys.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKqDtA_aRmFfHBqw0j21FrrTazfV9yNrkbFvpAHNd3AQ2HZreow3e4G3Yt5vdm2t7BLHLVR2LXWNIF5b4ST7tqvXqYUdqAtJY767-yzb5Nl3ZB7I8jTOzagRo65pCr7iXBvQPaPFwrQ1c/s1600/Selection_021.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKqDtA_aRmFfHBqw0j21FrrTazfV9yNrkbFvpAHNd3AQ2HZreow3e4G3Yt5vdm2t7BLHLVR2LXWNIF5b4ST7tqvXqYUdqAtJY767-yzb5Nl3ZB7I8jTOzagRo65pCr7iXBvQPaPFwrQ1c/s640/Selection_021.png" width="640" /></a></div>
<br />
I was in charge of the game graphics. All graphics are done with Adobe Photoshop and Illustrator. Our game engine needed <a href="http://www.mapeditor.org/">Tiled map editor</a> for the level design. I created also the levels. Then I used microphone and Audacity to create sound effects. My partner focused on game logic and programming. When all the material were ready we also created teaser video for our application and compiled it in the CocoonJS. We had some trouble converting the game but in the end we managed to do it. It was a nice little project. To keep our code nice and clean we put it to GitHub.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHkN3fj3i6LhycX9t2VB8AjcH0hMuOCjGILltP342miNfs7cbg9YuoS1GbM_bCDBZs1Hz7BrWFIxXBKYs6t0fpjt_jyTADDWpI2d6vslDagSr-_Eu6VbF3A2G5dTcohz2zcHMXwU-1FFM/s1600/Selection_022.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHkN3fj3i6LhycX9t2VB8AjcH0hMuOCjGILltP342miNfs7cbg9YuoS1GbM_bCDBZs1Hz7BrWFIxXBKYs6t0fpjt_jyTADDWpI2d6vslDagSr-_Eu6VbF3A2G5dTcohz2zcHMXwU-1FFM/s640/Selection_022.png" width="640" /></a></div>
<br />
Till this day 14.8.2015 our game has got over 200 downloads from the Play Store.<br />
<br />
https://play.google.com/store/apps/details?id=com.potatoman.adventures<br />
<br />
We got 5/5 grade for creating and publishing this game.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Tl9e9eLmLfE/0.jpg" src="https://www.youtube.com/embed/Tl9e9eLmLfE?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-36570594102251197292015-05-27T23:21:00.002-07:002015-05-27T23:21:37.350-07:00Robots.txt file for WordpressFor Wordpress its good idea to put wp-admin in disallow. This means Google bots don't visit wp-admin page and rank it on search.<br />
<b><br /></b>
<b>User-agent: *</b><br />
<b>Disallow: /wp/wp-admin/</b><br />
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-36875320286413928022014-11-23T22:41:00.004-08:002014-11-23T23:17:20.106-08:00Android application - pixel checkI just published my second Android application to Google PlayStore. It goes by the name "Pixel check". You can change the screen color by tapping screen. If there are dead pixels they show as black/grey and if the pixel has color errors it should stand out. Try it out here: <a href="https://play.google.com/store/apps/details?id=com.shnigi.pixelcheck">https://play.google.com/store/apps/details?id=com.shnigi.pixelcheck</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv2Rpq7y5LpUvdf6y_Iswjd3jhVr5kSnmSRdDS2r15rvKS2-TSBrIRueKrJUgAktFPh416ArsMduIOJWxjvm4zTEC3ParLli_TjUv9yBlKFVX52fepk8GzgWyNY5LutCEB0tGLpKcIs0k/s1600/pixelcheck.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv2Rpq7y5LpUvdf6y_Iswjd3jhVr5kSnmSRdDS2r15rvKS2-TSBrIRueKrJUgAktFPh416ArsMduIOJWxjvm4zTEC3ParLli_TjUv9yBlKFVX52fepk8GzgWyNY5LutCEB0tGLpKcIs0k/s1600/pixelcheck.PNG" height="222" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ3SuoCdOwiOxqkFREtGPaZNi60as7bSZHYzw9_V9OPf0ELyhHBEx3GSb3A0DRRwkYJW5KlX1mLLfoDTXdHNCWkh9Ddn7YpTXeoMJblVgcG76zuvN1869_l3mBRY-YywbKsA0ri1MbNkM/s1600/qrcode.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ3SuoCdOwiOxqkFREtGPaZNi60as7bSZHYzw9_V9OPf0ELyhHBEx3GSb3A0DRRwkYJW5KlX1mLLfoDTXdHNCWkh9Ddn7YpTXeoMJblVgcG76zuvN1869_l3mBRY-YywbKsA0ri1MbNkM/s1600/qrcode.png" height="200" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-83031322542441189842014-11-07T02:05:00.001-08:002014-11-07T02:06:19.020-08:00Alphabets gameWhen I was a kid I played game where I had to enter all the alphabets as fast as I can. Two days ago I remembered that game and wanted to create my own version. This game is written with Javascript + HTML + CSS + PHP + MySQL. Game is created with Javascript and then PHP saves results to database. Top 10 players are queried from the database. Try it out here: <a href="http://84.251.124.101/~shnigi/aakkoset/index.php">http://84.251.124.101/~shnigi/aakkoset/index.php</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKuEznsZeXlkzzOD58wyB9q7qVxw6_2PrtCfb-rQAXDuGzCcZSx3PcaS2xcIxTu-s0714yCtLwRsvJEnGXDShvbeNxiv0LMHEew591I3KAtpiwuleoSxPkUGAyaVXVAFL7M0GK4k-oHhE/s1600/aakkoset.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKuEznsZeXlkzzOD58wyB9q7qVxw6_2PrtCfb-rQAXDuGzCcZSx3PcaS2xcIxTu-s0714yCtLwRsvJEnGXDShvbeNxiv0LMHEew591I3KAtpiwuleoSxPkUGAyaVXVAFL7M0GK4k-oHhE/s1600/aakkoset.JPG" height="448" width="640" /></a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-58686549061004083662014-10-14T06:36:00.002-07:002014-10-14T06:36:17.272-07:00Javascript applicationsSo I have been learning Javascript for a while now and I'm getting it slowly. But still it feels so hard. I completed codeacademy.com Javascript course and had some other things to read. So far I have quickly developed three little things.<br />
<br />
First one is rock, scissors, paper game. Simple game. Try the demoversion here: <a href="http://84.251.124.101/~shnigi/kivisaksipaperi/pewi.html">http://84.251.124.101/~shnigi/kivisaksipaperi/pewi.html</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOxgQbjofzl2VxAKtoFoXDqslpkSbCI5rNH2Lcj0Y5bbnY1DkBoEZt918dL2QmK2-eW7mw2zFpzBEXVr12Js_GJxE74AgSUn5KKIIVRGBXKelst7DNJq6JRhuTWkhMBXvNntqd2eZBFkg/s1600/kivipaprusaksi.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOxgQbjofzl2VxAKtoFoXDqslpkSbCI5rNH2Lcj0Y5bbnY1DkBoEZt918dL2QmK2-eW7mw2zFpzBEXVr12Js_GJxE74AgSUn5KKIIVRGBXKelst7DNJq6JRhuTWkhMBXvNntqd2eZBFkg/s1600/kivipaprusaksi.PNG" height="320" width="205" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Next one is coinflipper. Select your side and flip it here: <a href="http://84.251.124.101/~shnigi/kolikonheitto/">http://84.251.124.101/~shnigi/kolikonheitto/</a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS14G7ZB-e84NFzQ9Eut_SdAvShmw7MYDsvgYLqqpO1VKQ3jdFPagwDCFNYlLcHqJfwrACUTVSup6Bnj0DTeBPVobMaHZPDN0WwCP3ZqI3Mfkbui1GIf6ZKQXG_0ExXK5uMz5OX0IcnpQ/s1600/coins.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS14G7ZB-e84NFzQ9Eut_SdAvShmw7MYDsvgYLqqpO1VKQ3jdFPagwDCFNYlLcHqJfwrACUTVSup6Bnj0DTeBPVobMaHZPDN0WwCP3ZqI3Mfkbui1GIf6ZKQXG_0ExXK5uMz5OX0IcnpQ/s1600/coins.PNG" height="320" width="142" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Last one is Lotto-machine where you enter 4 different things and the machine tells you which one is best. Try it here: <a href="http://84.251.124.101/~shnigi/lottokone/">http://84.251.124.101/~shnigi/lottokone/</a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhav7fZpu3h8-EtzAteIiusqiytCN8kX9KuQTB9WgNGLX1s14ug-h-082yPmqy9d0UmgFJj9m_KChH_MyZlyenKGiLMwze1lETpvWCfidN8OG3lLaLYdssd76yi7-FdwL2WZHYJy7i44W8/s1600/lotto.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhav7fZpu3h8-EtzAteIiusqiytCN8kX9KuQTB9WgNGLX1s14ug-h-082yPmqy9d0UmgFJj9m_KChH_MyZlyenKGiLMwze1lETpvWCfidN8OG3lLaLYdssd76yi7-FdwL2WZHYJy7i44W8/s1600/lotto.PNG" height="149" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
I'm planning to do a mobile app (Android) later from one of these.</div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-74585300915988577942014-10-03T07:29:00.001-07:002014-10-03T07:29:10.356-07:00What is XML and how to useXML was designed to describe data. With XML one can for example change data between two systems running on different platform and code. XML does not do anything. XML needs to be manipulated that it can be used. Here is an example of XML file from W3 schools:<div>
<br /><div>
<span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">note</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><br style="font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;" /><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"> </span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">to</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">Tove</span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">/to</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><br style="font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;" /><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"> </span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">from</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">Jani</span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">/from</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><br style="font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;" /><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"> </span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">heading</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">Reminder</span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">/heading</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><br style="font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;" /><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"> </span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">body</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><span style="background-color: white; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">Don't forget me this weekend!</span><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">/body</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span><br style="font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;" /><span class="highLT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><</span><span class="highELE" style="color: brown; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">/note</span><span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;">></span></div>
<div>
<span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><br /></span></div>
XSD is somekind of file that defines how XML file should be formatted. For example elements are defined as string and should be manipulated as string.<br /><div>
<span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><br /></span></div>
</div>
<div>
<span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"><xs:element name="note"></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:complexType></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:sequence></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:element name="to" type="xs:string"/></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:element name="from" type="xs:string"/></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:element name="heading" type="xs:string"/></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> <xs:element name="body" type="xs:string"/></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> </xs:sequence></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"> </xs:complexType></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"></xs:element></span><br style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;" /><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"></xs:schema></span></span></div>
<div>
<span class="highGT" style="color: blue; font-family: Consolas, 'courier new'; font-size: 14.3999996185303px;"><span style="background-color: #f1f1f1; color: #444444; font-size: 14.3999996185303px;"><br /></span></span></div>
XML and XSD files can be easily generated from online converters. Next is XSLT file which is used to select data and define how it is generated in HTML file. To define the XSLT file which will be used to convert the XML file to HTML use this tag<div>
<br /></div>
<div>
<?xml-stylesheet href="filename.xslt" type="text/xsl" ?></div>
<div>
<br /></div>
<div>
To select values from XML file with XSLT one can put HTML tags inside XSLT and then use for example for each loop to select all items. In the select tag is the "path" to the thing that should be selected. If the XML file path has "properties" use @ to select the property. Example of XSLT file:</div>
<div>
<br /></div>
<div> <br /> <xsl:for-each select="sports-content/tournament/tournament-division/tournament-round"><br /> <h3> <div>
<xsl:value-of select="tournament-round-metadata/site/site-metadata/home-location/@city"/><br /> <xsl:value-of select="tournament-round-metadata/site/site-metadata/home-location/@country"/><br /> </h3> <div>
</div> </div>
</div>
<div>
<br /></div>
<div>
Then open the XML file with web browser and if it is correctly set up it will show up as HTML. Tada!</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdV_pi-2wHaRS7rbYoYqsJTmhKCvKioaBbQjbNvWiIvCtx22NShKuY6AyLfAlu6cEKVn9RA51PLvLTkKfM0RiHdulilzVdys3FFQIS1qF4bfsLgh4Q4SyOSDoCVqhAcAr1oe8QEIX1AWQ/s1600/xml.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdV_pi-2wHaRS7rbYoYqsJTmhKCvKioaBbQjbNvWiIvCtx22NShKuY6AyLfAlu6cEKVn9RA51PLvLTkKfM0RiHdulilzVdys3FFQIS1qF4bfsLgh4Q4SyOSDoCVqhAcAr1oe8QEIX1AWQ/s1600/xml.JPG" height="322" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
As IDE I use Eclipse. For more information check W3 Schools. I find XML hard to understand. But for example data could be changed from PHP program to Java program with XML. </div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-23890147896640372202014-09-15T05:24:00.002-07:002014-09-15T05:24:41.607-07:00Java Exception has occurred EclipseMake sure you have you have the latest version of JRE installed in your system.<br /><br />If the problem still persists then ,the reason being the JRE’s of your system might not be added to the project under consideration. Please follow the steps below .<br />1) Eclipse Tool Bar>Window>Preferences> Java>Installed Jre’s.<br />2) You should be seeing the path of the JRE installed.Now copy the location of installed JREs<br />3) Close the window.<br />4) Select your Project>Rt ck >Properties>Java Build Path<br />5) In Libraries tab > clk Add library button<br />6) In Add Library Window>Select JRE System Library option>next<br />7) In JRE System Library window >clk on Installed JREs > (you should be able to see the path of the insatlled JREs) Select the JRE path <br />8) Finish<br /><br />OR<br /><br />Other Things done if the above did not solve the problem : - A ) Eclipse Tool bar > Project >Clean<br /><br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-21251179429163546122014-07-04T06:42:00.001-07:002014-07-04T06:47:03.195-07:00Gmail account stealerToday I read an article from local news that a mysterious web bank link has been sent to a bank customers. That site of course was a scam. The email / site was written in poor Finnish. Of course there are always people who go in to these kind of tricks. First the user had to log in with their bank account and then enter credit card number. So then I decided to do my own scam. This is just for educational purposes. My site looks like Gmail log in, but actually steals your account to mysql table.<br />
<br />
Check it here: <b><a href="http://gmailstealer.tk/">http://gmailstealer.tk/</a></b><br />
<br />
Link to the original article (written in Finnish: <a href="http://www.iltasanomat.fi/digi/art-1288710145714.html?pos=ksk-trm-digi-etmin">http://www.iltasanomat.fi/digi/art-1288710145714.html?pos=ksk-trm-digi-etmin</a>)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKY2T7CCWsKBLks8gJEAWCjjK99QuCuxwaHduKDlL-9mxXQ37443Z0TH8ezSzPdzuZsy2FGPzGgJ3iN98LgUR4Dnc6UdUggwi7UF5m1m4mgGi8IL9hLbgg5Y7i_4PQT1HFxyCwwS4JbgU/s1600/gmailstealer.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKY2T7CCWsKBLks8gJEAWCjjK99QuCuxwaHduKDlL-9mxXQ37443Z0TH8ezSzPdzuZsy2FGPzGgJ3iN98LgUR4Dnc6UdUggwi7UF5m1m4mgGi8IL9hLbgg5Y7i_4PQT1HFxyCwwS4JbgU/s1600/gmailstealer.PNG" height="279" width="320" /></a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-89659687304086408422014-07-03T23:37:00.001-07:002014-07-03T23:37:13.700-07:00Windows bat scriptI needed a windows script which makes backup copy of a folder with different name and then deletes all files in the original folder. This is because Filesite has some problems with Microsoft office and is complaining about echo files that are not synchronized. Cleaning the echo folder solves this problem. Users complain about this and I needed a script which clears it automatically and makes sure it can be backed up if something goes wrong. My bat file code is this:<br />
<br />
Robocopy C:\NRTEcho C:\NRTEchocopy /E<br />
cd C:\NRTEcho<br />
FOR /D %%p IN ("C:\NRTEcho\*.*") DO rmdir "%%p" /s /q<br />
del C:\NRTEcho\*.* /QUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-56600293352928160012014-05-05T00:44:00.000-07:002014-05-05T00:44:12.339-07:00Simple javascript yes/no prompt and html forwardI needed a simple confirmation YES/NO on my web page which would then redirect to a different page depending on the answer. I couldn't use any other languages but javascript so this is how I acquired it.<div>
<br /></div>
<div>
First I created a simple button</div>
<div>
<br /></div>
<div>
<button type="button" class="button" onclick="myFunction()">Press me please</button></div>
<div>
<br /></div>
<div>
and the javascript</div>
<div>
<br /></div>
<div>
<div>
<script></div>
<div>
function myFunction()</div>
<div>
{</div>
<div>
var answer = confirm ("Yes")</div>
<div>
if (answer)</div>
<div>
window.location.assign("page1.html")</div>
<div>
else</div>
<div>
window.location.assign("page2.html")</div>
<div>
}</div>
<div>
</script></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-89553538079789718802013-11-26T12:32:00.001-08:002013-11-26T12:32:12.261-08:00HTML 5 Short Page Example<!doctype html><br />
<html><br />
<head><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><title>Niki's HTML 5 Short Page</title><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><meta charset="utf-8" /><br />
</head><br />
<body><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><h1>Niki's HTML 5 Short Page</h1><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><p>Welcome!</p><br />
</body><br />
</html><br />
<br />
<br />
Test your valid HTML 5 page with <a href="http://validator.w3.org/">validator.w3.org</a>. Start coding from this "Hello World" template.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-39424583880659130452013-10-17T04:13:00.001-07:002013-10-17T04:13:25.373-07:00Java - Hello World with Eclipse QuicklyOpen Eclipse and create new "Java Project"<br />
Give a name for your project<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixh7HwZ1OjEJLCC41y_behZTS5A9di3FVy87IWihdaamBmTKHZmnU9gRnFO2jB6dCLUxV8835U7lcghasl1dO1MRCHCqu77Xp4c58qDpaCgTBnsUXNQCYNwnVuKLd2p1lloXCsFAsEFLs/s1600/Selection_007.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixh7HwZ1OjEJLCC41y_behZTS5A9di3FVy87IWihdaamBmTKHZmnU9gRnFO2jB6dCLUxV8835U7lcghasl1dO1MRCHCqu77Xp4c58qDpaCgTBnsUXNQCYNwnVuKLd2p1lloXCsFAsEFLs/s640/Selection_007.png" width="460" /></a></div>
Click Finish<br />
<br />
Create new class inside src folder<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWVmcf5N2RVQX7nVMN_4Tpp_IEIVdNMMSOqIAjp1zH05oo1mZ3inZIxL0Ld08h7bYxliA-F2qcmhpNFMXQiXd3l5QHFgazrJsgfKDubVJqrQYqZJJ_hGMP2v4t2YxD-yWViR3_WOHwThs/s1600/Selection_009.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWVmcf5N2RVQX7nVMN_4Tpp_IEIVdNMMSOqIAjp1zH05oo1mZ3inZIxL0Ld08h7bYxliA-F2qcmhpNFMXQiXd3l5QHFgazrJsgfKDubVJqrQYqZJJ_hGMP2v4t2YxD-yWViR3_WOHwThs/s640/Selection_009.png" width="640" /></a></div>
<blockquote class="tr_bq">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpsnZ9oLt-d8dIZ_iBPn0OUBrADaCECC2g3_ppE0GZVS1rf8XKDwnrwlQFc5y7fEa-idcPwQS5N1d_qmLAenVtWPFmLFxQLFZGVW0tUe2OFeIfFwyZXCOUfv99k8FSozjqp9_pGGwOy2g/s1600/Selection_008.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpsnZ9oLt-d8dIZ_iBPn0OUBrADaCECC2g3_ppE0GZVS1rf8XKDwnrwlQFc5y7fEa-idcPwQS5N1d_qmLAenVtWPFmLFxQLFZGVW0tUe2OFeIfFwyZXCOUfv99k8FSozjqp9_pGGwOy2g/s640/Selection_008.png" width="534" /></a></div>
</blockquote>
Write "main" inside hello and press CTRL + SPACE and ENTER to autocomplete<br />
<br />
<div style="color: blue;">
public class Hello {</div>
<div style="color: blue;">
main </div>
<div style="color: blue;">
}</div>
<br />
<br /><span style="color: blue;">public class Hello {</span><br style="color: blue;" /><span style="color: blue;"> public static void main(String[] args) {</span><br style="color: blue;" /><span style="color: blue;"> }</span><br style="color: blue;" /><span style="color: blue;"> }</span><br /><br />
write "syso" and press CTRL + SPACE<br />
then add print text<br />
<br />
<br /><span style="color: blue;">public class Hello {</span><br style="color: blue;" /><span style="color: blue;"> public static void main(String[] args) {</span><br style="color: blue;" /><span style="color: blue;"> System.out.println("Hello World!");</span><span style="color: blue;"></span><br style="color: blue;" /><span style="color: blue;"> }</span><span style="color: blue;"> </span><br style="color: blue;" /><span style="color: blue;">}</span><br /><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEqFp-2QmDsf_8Vc6V-KACKSjW_rHkJt-N_V-iE5uXPxxAZ_OzSnkmkO1eSfG9h5jaPqJnTzkvt4b22vpeFhmtPnMv5N8BsWMcsYNRyhV8wT6xZDuGx3ZowZT-HwejwdhOJD-FfL9g9Gk/s1600/Selection_011.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="98" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEqFp-2QmDsf_8Vc6V-KACKSjW_rHkJt-N_V-iE5uXPxxAZ_OzSnkmkO1eSfG9h5jaPqJnTzkvt4b22vpeFhmtPnMv5N8BsWMcsYNRyhV8wT6xZDuGx3ZowZT-HwejwdhOJD-FfL9g9Gk/s640/Selection_011.png" width="640" /></a></div>
<br />
<br />
It prints Hello World! to Console.<br />
<br />
TIPS: to install JDK on Linux: sudo apt-get install openjdk-7-jdk<br /><table style="border: solid;">
</table>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-77335589705245230632013-10-02T06:06:00.002-07:002013-10-02T06:06:24.324-07:00How To Use CVS-VersionControl (School notes)<b>How to pull existing project from CVS:</b><br />
Start Eclipse<br />
<br />
Notice that only one person in team pushes the project into workspace and then other team members pull the project from cvs.<br />
<br />
Select File -> New -> Project<br />
and select CVS - Projects from CVS<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigsS3DQ5u_Cb8TE0F07c1tuNcLmA8bKIoxvdLxyQ-Y1r8_PedLWePF7JggAjQ-tLMIjCi1ojbvX-2iUlp5YfXMbMcbFH2FouVKfQ6uSxpPEGLC92a3RZteS97DDUnHb_gCTBR-4gD3hjY/s1600/project.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigsS3DQ5u_Cb8TE0F07c1tuNcLmA8bKIoxvdLxyQ-Y1r8_PedLWePF7JggAjQ-tLMIjCi1ojbvX-2iUlp5YfXMbMcbFH2FouVKfQ6uSxpPEGLC92a3RZteS97DDUnHb_gCTBR-4gD3hjY/s640/project.PNG" width="582" /></a></div>
<br />
<br />
From the next window select existing project.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi70-qlaoleG2bBhscVU56OqR-jgymaiJXfVzwjzRtOIC5Upjfcs08DongF31Kdo8kDkRqO_43Ssh9NMnwZJz6CH5ZGVspEf9wuvdgOSxhiH0bIa-2keaH6Lsipx0jipjkn9Mp45lwRaEk/s1600/existing.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi70-qlaoleG2bBhscVU56OqR-jgymaiJXfVzwjzRtOIC5Upjfcs08DongF31Kdo8kDkRqO_43Ssh9NMnwZJz6CH5ZGVspEf9wuvdgOSxhiH0bIa-2keaH6Lsipx0jipjkn9Mp45lwRaEk/s400/existing.PNG" width="400" /></a></div>
<br />
Location:<br />
Host: proto999.haaga-helia.fi // 999 change this to your own group number<br />
Repository path: /home/cvs<br />
Authentication<br />
user: accountname<br />
password: your pw<br />
Connection<br />
Connection type: extssh<br />
click next<br />
Enter Module Name:<br />
choose use an existing module<br />
select the project you want and click finnish<br />
<br />
<b>How to push</b><br />
Right click your project, first select update and then commit<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggG3CThkvtsbbJDcilqdfURYFVAqZzYOehPbsPYyfL35yewX3mnU8hyII8zwdp1dRNdavew-nS2QiX-Z7idF3YcPrnyq6yfoLLRqdcPtmaeQrpjverPLvqy7HOFkGkvjziGaC1BMMsi6k/s1600/toiminnot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="614" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggG3CThkvtsbbJDcilqdfURYFVAqZzYOehPbsPYyfL35yewX3mnU8hyII8zwdp1dRNdavew-nS2QiX-Z7idF3YcPrnyq6yfoLLRqdcPtmaeQrpjverPLvqy7HOFkGkvjziGaC1BMMsi6k/s640/toiminnot.png" width="640" /></a></div>
<br />
<b>Creating new project:</b><br />
Simply right click again your project, select team menu and choose share project.<br />
<b><br /></b>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-1329952139704187902013-09-26T02:15:00.002-07:002013-09-26T02:15:26.901-07:00Eclipse cannot create server problem and delete serverIf you ever run to this problem that you cannot add Tomcat server to your Eclipse it is very easy to fix.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF1hjnHz6w0pEKeA6MwjZGAuctC9P77z7CQJvoxchrqsh4LYbO-B5iOKrqkGt8cOY-itD3gbgEqOo0pn89HNmmOimfD0oGjSWGRAHFmVOsrFU3XGe7-CHHfGcFEoNn8cO_yuHrrrv-sik/s1600/tomcat+problem.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF1hjnHz6w0pEKeA6MwjZGAuctC9P77z7CQJvoxchrqsh4LYbO-B5iOKrqkGt8cOY-itD3gbgEqOo0pn89HNmmOimfD0oGjSWGRAHFmVOsrFU3XGe7-CHHfGcFEoNn8cO_yuHrrrv-sik/s640/tomcat+problem.PNG" width="568" /></a></div>
<br />
Go to <b>Window–>Preferences–>Server–>Runtime Environments</b> click edit and fix the broken path/link for the server. (Locate the Tomcat folder you have unzipped)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuf8ZEpU1dgrUccpwUFwtl5ZjxurUpKhda_VOh5e8XrPE-AmXDjchrDaJ8IrQ4esKk5UEEmpQFFnpdO3H8mwfxNJipFZag71RoYGMHPaOxoTXffA83O0fh_G0u1luH5GgXPYwsJnWk-Hc/s1600/solution.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="632" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuf8ZEpU1dgrUccpwUFwtl5ZjxurUpKhda_VOh5e8XrPE-AmXDjchrDaJ8IrQ4esKk5UEEmpQFFnpdO3H8mwfxNJipFZag71RoYGMHPaOxoTXffA83O0fh_G0u1luH5GgXPYwsJnWk-Hc/s640/solution.PNG" width="640" /></a></div>
<br />
After that it should work.<br />
<br />
<b>Delete server</b><br />
<br />
Right click servers from the left side menu, select delete and tick box delete from disk. Also from the bottom view of eclipse select servers and delete them there.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSJZFbVzL63Y6XYqOiO4N2y4u-ORDGtB3At2VC-6IQE59ribpU0VjxZEffp6AlJM53W6uCTkaq4lJ7Ncv8Hql9mFW_jowEfK1wWR4yYOG70HsGTPxIkupyHz7mJBdVxqtCY7o2Fvafm8w/s1600/servers.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="136" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSJZFbVzL63Y6XYqOiO4N2y4u-ORDGtB3At2VC-6IQE59ribpU0VjxZEffp6AlJM53W6uCTkaq4lJ7Ncv8Hql9mFW_jowEfK1wWR4yYOG70HsGTPxIkupyHz7mJBdVxqtCY7o2Fvafm8w/s640/servers.PNG" width="640" /></a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-73421418051873588912013-09-23T08:32:00.003-07:002013-09-23T08:32:53.929-07:00SQL ZooGood page to train your SQL skills: http://sqlzoo.net/wiki/Main_PageUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-5825556971001061010.post-59262100166640404182013-09-19T04:42:00.000-07:002016-01-27T00:12:20.428-08:00MySQL From Command lineIf you have set up or you are going to use MySQL with SSH for example not via PHPMyadmin open your terminal and type<br />
<br />
<b>mysql -u username -p</b><br />
<br />
Which means go to mysql, after -u put your username and -p is password, but do not enter your password after that it is going to ask it in the next prompt.<br />
<br />
Enter your password (if you are using Putty press SHIFT + INSERT to paste)<br />
<br />
Create new database:<br />
<br />
<b>CREATE DATABASE Niki_Aanitteet;</b><br />
<br />
To select database you want to use insert<br />
<br />
<b>use databasename;</b><br />
<br />
to see what tables you have type<br />
<br />
<b>show tables;</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtuzNWyIcGd8r8QfQRc9CfrpZmxd-N5VbyS3maqPVidSlSenSBEUo0jNxyG0V02bnr2C-wjg27W3G_37DQ-hj3-9ZZxXmUZx_bKgM8l7km-HTnwwmlst5NH0LbuM33ENBoFfBuaAlDBOI/s1600/mysql.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="438" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtuzNWyIcGd8r8QfQRc9CfrpZmxd-N5VbyS3maqPVidSlSenSBEUo0jNxyG0V02bnr2C-wjg27W3G_37DQ-hj3-9ZZxXmUZx_bKgM8l7km-HTnwwmlst5NH0LbuM33ENBoFfBuaAlDBOI/s640/mysql.PNG" width="640" /></a></div>
<br />
To see what you have in the tables type<br />
<br />
<b>select * from tablename;</b><br />
<br />
<b></b><br />
<b></b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP88U81eCB6By-XB8ac5KUY1PVRpyk1qf4xals40RaIcroYncf0JBaL2horr3Bcl2BwvKuyOKz_zFqYf284GkPbPgxOgE1XVoahSerpOtBdd5ll5eSxd6ZYNdvbFtE0STxaeIqnuyeLQU/s1600/mysql2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="404" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP88U81eCB6By-XB8ac5KUY1PVRpyk1qf4xals40RaIcroYncf0JBaL2horr3Bcl2BwvKuyOKz_zFqYf284GkPbPgxOgE1XVoahSerpOtBdd5ll5eSxd6ZYNdvbFtE0STxaeIqnuyeLQU/s640/mysql2.PNG" width="640" /></a></div>
<b><br /></b>As you can see it works with same commands as phpmyadmin. If you want to add a table here is my example code:<br />
<br />
CREATE TABLE Niki_Aanitteet(<br />
id SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,<br />
artisti VARCHAR(255) NOT NULL,<br />
levyn_nimi VARCHAR(255) NOT NULL<br />
) ENGINE=Innodb DEFAULT CHARSET=latin1;<br />
<br />
And to insert some data into the tables:<br />
<br />
INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('PSY', 'Gangnam Style');<br />
INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('Train', 'Drive By');<br />
INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('Rihanna', 'Where Have You Been');<br />
<br />
To see field, type, null, key, default, extra information type: <br />
<b>describe Niki_Aanitteet;</b><br />
<br />
Create new user for your database and grant all privileges:<br />
<br />
<b>CREATE USER 'shnigi'@'localhost' IDENTIFIED BY 'passwordhere';</b><br />
<br />
<b>GRANT ALL PRIVILEGES ON * . * TO <a href="mailto:'shnigi'@'localhost'">'shnigi'@'localhost'</a>;</b><br />
<br />
Explained bit better here: <a href="https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04">https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04</a><br />
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #fdfdfd; color: black; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">create database testdatabase;</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #fdfdfd; color: black; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">create user 'folio'@'localhost' identified by 'password123';</span></div>
<span id="docs-internal-guid-04ca1d95-8222-7f5c-2bbd-be2705c1fcb4"></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #fdfdfd; color: black; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">grant all privileges on testdatabase.* to 'folio'@'localhost' with grant option;</span></div>
Unknownnoreply@blogger.com0