This 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.html
sunnuntai 23. marraskuuta 2014
Android application - pixel check
I 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: https://play.google.com/store/apps/details?id=com.shnigi.pixelcheck
perjantai 7. marraskuuta 2014
Alphabets game
When 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: http://84.251.124.101/~shnigi/aakkoset/index.php
tiistai 14. lokakuuta 2014
Javascript applications
So 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.
First one is rock, scissors, paper game. Simple game. Try the demoversion here: http://84.251.124.101/~shnigi/kivisaksipaperi/pewi.html
First one is rock, scissors, paper game. Simple game. Try the demoversion here: http://84.251.124.101/~shnigi/kivisaksipaperi/pewi.html
Next one is coinflipper. Select your side and flip it here: http://84.251.124.101/~shnigi/kolikonheitto/
Last one is Lotto-machine where you enter 4 different things and the machine tells you which one is best. Try it here: http://84.251.124.101/~shnigi/lottokone/
I'm planning to do a mobile app (Android) later from one of these.
perjantai 3. lokakuuta 2014
What is XML and how to use
XML 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:
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.
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>
<xsl:for-each select="sports-content/tournament/tournament-division/tournament-round">
<h3>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml-stylesheet href="filename.xslt" type="text/xsl" ?>
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:
<xsl:for-each select="sports-content/tournament/tournament-division/tournament-round">
<h3>
<xsl:value-of select="tournament-round-metadata/site/site-metadata/home-location/@city"/>
<xsl:value-of select="tournament-round-metadata/site/site-metadata/home-location/@country"/>
</h3>
<xsl:value-of select="tournament-round-metadata/site/site-metadata/home-location/@country"/>
</h3>
</div>
Then open the XML file with web browser and if it is correctly set up it will show up as HTML. Tada!
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.
maanantai 15. syyskuuta 2014
Java Exception has occurred Eclipse
Make sure you have you have the latest version of JRE installed in your system.
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 .
1) Eclipse Tool Bar>Window>Preferences> Java>Installed Jre’s.
2) You should be seeing the path of the JRE installed.Now copy the location of installed JREs
3) Close the window.
4) Select your Project>Rt ck >Properties>Java Build Path
5) In Libraries tab > clk Add library button
6) In Add Library Window>Select JRE System Library option>next
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
8) Finish
OR
Other Things done if the above did not solve the problem : - A ) Eclipse Tool bar > Project >Clean
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 .
1) Eclipse Tool Bar>Window>Preferences> Java>Installed Jre’s.
2) You should be seeing the path of the JRE installed.Now copy the location of installed JREs
3) Close the window.
4) Select your Project>Rt ck >Properties>Java Build Path
5) In Libraries tab > clk Add library button
6) In Add Library Window>Select JRE System Library option>next
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
8) Finish
OR
Other Things done if the above did not solve the problem : - A ) Eclipse Tool bar > Project >Clean
perjantai 4. heinäkuuta 2014
Gmail account stealer
Today 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.
Check it here: http://gmailstealer.tk/
Link to the original article (written in Finnish: http://www.iltasanomat.fi/digi/art-1288710145714.html?pos=ksk-trm-digi-etmin)
Check it here: http://gmailstealer.tk/
Link to the original article (written in Finnish: http://www.iltasanomat.fi/digi/art-1288710145714.html?pos=ksk-trm-digi-etmin)
torstai 3. heinäkuuta 2014
Windows bat script
I 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:
Robocopy C:\NRTEcho C:\NRTEchocopy /E
cd C:\NRTEcho
FOR /D %%p IN ("C:\NRTEcho\*.*") DO rmdir "%%p" /s /q
del C:\NRTEcho\*.* /Q
Robocopy C:\NRTEcho C:\NRTEchocopy /E
cd C:\NRTEcho
FOR /D %%p IN ("C:\NRTEcho\*.*") DO rmdir "%%p" /s /q
del C:\NRTEcho\*.* /Q
maanantai 5. toukokuuta 2014
Simple javascript yes/no prompt and html forward
I 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.
First I created a simple button
<button type="button" class="button" onclick="myFunction()">Press me please</button>
and the javascript
<script>
function myFunction()
{
var answer = confirm ("Yes")
if (answer)
window.location.assign("page1.html")
else
window.location.assign("page2.html")
}
</script>
Tilaa:
Blogitekstit (Atom)