Thursday, October 26, 2017

Angular.js Dersleri 1 - Giriş, Referanslar

1 -  Loading angular.js file  and References

https://curran.github.io/screencasts/introToAngular/exampleViewer/#/  -> input ve output gözüküyor bunu tercih et.
https://github.com/oiyio/angular_examples_and_other_web_sources/tree/gh-pages/introToAngular
adresinde çoook işimize yaracak örnekler var. Video açıklamaları için :  https://www.youtube.com/watch?v=TRrL5j3MIvo
https://plnkr.co/
http://codepen.io/   -> çok güzel örnek projeler var hem source kod hem output'lar mevcut.
https://github.com/angular/angular.js/wiki/JSFiddle-Examples  -> çok güzel jsfiddle örnekleri
https://groups.google.com/forum/#!forum/angular google group
https://dribbble.com/   -> logo resim gibi designlar
http://skillgun.com/angularjs/interview-questions-and-answers test soru-cevap
https://github.com/johnpapa/angular-styleguide   style gruide'ıu okumamı tavsiye etti tecrübeli bir isim forumda.
We need to load the angular.js file from one of the CDNs or from the local disk.
If you'd like to load it from Google CDN then put this in your HTML. Bu örnekte bunu kullanacağız:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
If you'd like to use the Cloudflare CDNjs, use this :
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular.min.js"></script>
Ayrıca angular.min.js veya angular.js dosyasını indirip de kullanabiliriz:

<script src="angular.min.js"></script>

Saturday, October 22, 2016

NAT - network address translation - nedir ?

Şu kaynakta çok güzel bir şekilde izah edilmiş.
http://thgtr.com/nat-nedir-ne-ise-yarar/6
 Buna ilaveten benim de özet olarak eklemek istediğim bir kaç şey olacak. (Buraya graph gelecek.)

Thursday, September 8, 2016

How to download an audio file in Python ? How to download an video file in Python ? How to download any file in Python ?

This example shows downloading an mp3 file by using urllib and urllib2.

# Python 3 code
import urllib.request, urllib.parse, urllib.error

url = 'http://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'

print("downloading with urllib")
urllib.request.urlretrieve(url, "code.mp3")

print("downloading with urllib2")
f = urllib.request.urlopen(url)
data = f.read()
with open("code2.mp3", "wb") as code:
    code.write(data)


 If you downlad a zip, file change the line
urllib.request.urlretrieve(url, "code.mp3")
with
urllib.request.urlretrieve(url, "code.zip")

with open("code2.mp3", "wb") as code:
with
with open("code2.zip", "wb") as code:


Apply the same thing if you want to download any file format.

Reference :
http://www.blog.pythonlibrary.org/2012/06/07/python-101-how-to-download-a-file/

Monday, August 22, 2016

How to dynamically change a web page's title?

http://stackoverflow.com/questions/413439/how-to-dynamically-change-a-web-pages-title

From Developer tools ->

document.title = "This is the new page title.";

Saturday, April 16, 2016

What is the difference between GenericServlet, HttpServlet? Differences Between doGet(),doPost(),service()? doGet and doPost in Servlets? When to use doGet, doPost and service methods

If you use HTTP Protocol, you should extend HTTPServlet class and override doGet(), doPost(),etc methods. Don't override service() method ! If you need to execute the same business logic when both POST or GET methods are invoked, just make one method call the other one where all the logic is(For example, say that you write all the business logic in doGet() method. Then in doPost method, you should invoke doGet() method). HTTPServlet class has service() method, and the default behaviour is that when any request is made by client, the service() method is invoked in the lifecycle of servlet. service() method has the responsibility of parsing the request and invoking the appropriate doX() method. If you overrride service() method in a subclass of HTTPServlet, only service() method is called for all types of requests(e.g. post request, get request, put request, etc. ). doPost, doGet, doPut methods are not called if you don't call them in service() method explicitly. You have the responsibility of parsing the request message, and doing something with that. service() method does not call doX methods unless specified explicitly. All control is in your hands! If you want to develop a servlet which does the same thing for all types of requests(i admit that this is a very weird and rare scenario), override service() method.

If you use a protocol other than HTTP, you should extend GenericServlet class and overrride service() method. If you will response to requests made by a client that is not using the HTTP protocol, you must override service() method(). There is no other choice other than that! For all types of requests, service() method is invoked. There is no doGet, doPost, doPut, etc. methods in GenericServlet class.

Quoting From Oracle's site:
"The default service() method in an HTTP servlet routes the request to another method based on the HTTP transfer method (POST, GET, and so on). For example, HTTP POST requests are routed to the doPost() method, HTTP GET requests are routed to the doGet() method, and so on. This enables the servlet to perform different request data processing depending on the transfer method. Since the routing takes place inservice(), there is no need to generally override service() in an HTTP servlet. Instead, override doGet()doPost(), and so on, depending on the expected request type."

To sum up,
For HTTP protocol, extend HTTPServlet class, don't override service() method, override only doX methods.
For other protocols, extend GenericServlet class, override service() method. There is no doX method in GenericServlet class.

Thursday, February 25, 2016

Cannot run Eclipse; JVM terminated. Exit code=13, eclipse open and close immediately

After java update, eclipse will not start because default jdk location has changed. Adding the following lines to eclipse.ini file solved my problem immediately:

    -vm
    C:\Program Files (x86)\Java\jdk1.7.0_75\bin\javaw.exe

I added these lines just before vmargs. It looks like as the following :

    ...
--launcher.defaultAction
openFile
-vm
C:\Program Files (x86)\Java\jdk1.7.0_75\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m

For more information on eclipse.ini, visit this the site http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example


In my case, i use 32 bit eclipse and java. If you installed both 32 bit and 64 bit versions of java, be careful to choose the right version. For 64 bit versions, refer to the javaw.exe file under the directory
   
    C:\Program Files\Java\jdk1.8.0_60\bin


Saturday, January 23, 2016