samedi 27 août 2016

Byte-Serving Implementation - HEAD verb

How would/should the various meta response headers (Content-MD5, Content-Length, ...) behave in regards to byte serving on an HTTP HEAD request?

W3 describes the HEAD verb as follows :

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself.

Therefore if I were to send the following request on a byte-serving enabled server :

HEAD /test.txt HTTP/1.1
Host: 127.0.0.1:8000
Range: Bytes=1
Connection: close

... I would expect the byte serving to be applied on the implied GET request and an appropriate HEAD response would be generated with a Content-Length : 1.

My question is : How does/should a server respond to a request like the one above?




Website appears 180 degrees rotated on iPhone

I have a pretty confusing problem. I have developed a website, which can be accessed on shooja.com . It is using zepto instead of jQuery, and GSAP for animations (Although I don't think these are related to the problem). The code is not compressed so it can be checked completely via web inspector. It appears perfectly on Firefox, Chrome, Safari on desktop and even IE. It is also OK on android browser. But on iPhone ( I have checked it on a 5 and a 5s ), it appears 180 degrees rotated and not scaled down. I can imagine the reason of scaling to be the meta tags, but the rotation doesn't make any sense. Any help is appreciated.




Edit Js and Html Files Through Browser - Client Side

I am trying to understand which files everybody can edit through the browser to understand what the risks of running some code in the client-side.
For example I saw in one site(In Chrome):


enter image description here


The gray file is read only file and the yellow one can be edited.
My questions are:

1.What's the difference between the yellow and the gray? why the gray is read only?
2. Is it still possible to edit the yellow one in other ways? Maybe not through the browser? Whats the options to edit files in the client side?
3.Which files can be edited and which not?(js,css,html,aspx... What's all the options)
4.Is there a way to know if someone change the html or js files and look at the changes he did? save logs of the changes or something like that?




JavaFX App Runtime Error on webpage but not on IDE

Basically my javafx application works fine on the IDE and on locally executed jar file but on the automatically generated .html page from netbeans it doesn't. I also get absolutely no indication as to what is wrong. This is the only message that I get when I click on "Click for details."

    Java Plug-in 11.101.2.13
Using JRE version 1.8.0_101-b13 Java HotSpot(TM) 64-Bit Server VM
User home directory = /home/jean
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------




Should I get into Android or Web development?

I'm trying to decide which path to choose. for the past week I've been trying to get a hold of web development, and honestly - i'm feeling overwhelmed. i used to think i'll be able to learn android and front-end development simultaneously, but it's too much. html, css, javascript, jquery, ajax, sass, less and not to mention design skills which i absolutely SUCK at. i love to program, and android feels like it has less design and more program elements to it. i wouldn't say i'm a newbie programmer, I've had experience with a lot of programming languages, Linux programming etc, but it was all for hobby. now i'm thinking about programming as a career and i'll be glad to hear your advice. which path is easier to find a job with? what about freelancing? thanks.




Three.js Loaders

I got the package file, 'three.js-dev' from threejs.org.

All loaders examples shown well.

I coded it to embody 'json loader' referred from 'examples' folder.

This is my 'main.html' codes to embody 'json loader', which places at 'three.js-dev' folder.

<script type="text/javascript" src="./build/three.js"></script>

<script type="text/javascript" src="./src/loaders/JSONLoader.js"></script>

<script src="./examples/js/controls/TrackballControls.js"></script>
<script src="./examples/js/Detector.js"></script>


<!-- _ BASE STYLE -->
<style>
    body {
        /* set margin to 0 and overflow to hidden, to go fullscreen */
        margin: 0;
        overflow: hidden;
    }
</style>

Upper code shows js source locations.

// World Variable
//////
//  //
//////

// DOCUMENT VARIABLE
var SCREEN_WIDTH = window.innerWidth;
var SCREEN_HEIGHT = window.innerHeight;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;

var mouseX = 0, mouseY = 0;

var container;

// THREE VARIABLE
var camera;
var scene;
var renderer;

var model;



// Initiate
//////
//  //
//////

init();
animate();



// init function
//////
//  //
/////////
////// //
/////////
function init() {



    container = document.getElementById( 'WebGL-output' );

    camera = new THREE.PerspectiveCamera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
    camera.position.z = 500;

    scene = new THREE.Scene();


    // LIGHTS

    var ambient = new THREE.AmbientLight( 0x221100 );
    scene.add( ambient );



    // LOADER
    //////
    //  //
    //////
    // var loader = new THREE.JSONLoader();

    // loader.load( './models/teapot-claraio.json', museumCallback );


    // BEGIN Clara.io JSON loader code
    var objectLoader = new THREE.ObjectLoader();
    objectLoader.load("models/teapot-claraio.json", function ( obj ) {
        scene.add( obj );
    } );
    // END Clara.io JSON loader code



    // RENDERER
    //////
    //  //
    //////
    renderer = new THREE.WebGLRenderer();
    renderer.setClearColor( 0xffffff );
    renderer.setPixelRatio( window.devicePixelRatio );
    renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
    renderer.domElement.style.position = "relative";

    container.appendChild( renderer.domElement );







    // MOUSE MOVE
    document.addEventListener( 'mousemove', onDocumentMouseMove, false );

    // RESIZE
    window.addEventListener( 'resize', onWindowResize, false );

}



function museumCallback( geometry,  materials ){
    var material = new THREE.MeshFaceMaterial( materials );
    model = new THREE.Mesh( geometry, material );
    model.scale.set (1,1,1);
    model.position.set (0,0,0);
    scene.add( model );            
}

function onWindowResize() {

    windowHalfX = window.innerWidth / 2;
    windowHalfY = window.innerHeight / 2;

    camera.aspect = window.innerWidth / window.innerHeight;
    camera.updateProjectionMatrix();

    renderer.setSize( window.innerWidth, window.innerHeight );
    // if ( canvasRenderer ) canvasRenderer.setSize( window.innerWidth, window.innerHeight );

}

function onDocumentMouseMove(event) {

    mouseX = ( event.clientX - windowHalfX );
    mouseY = ( event.clientY - windowHalfY );

}

function animate() {

    requestAnimationFrame( animate );
    render();

}

function render() {

    camera.position.x += ( mouseX - camera.position.x ) * .05;
    camera.position.y += ( - mouseY - camera.position.y ) * .05;

    camera.lookAt( scene.position );

    renderer.render( scene, camera );

}

`

And browser resulted the error at console tab.

JSONLoader.js:1 Uncaught SyntaxError: Unexpected token import

other error at source tab.

Uncaught SyntaxError: Unexpected token import

I thought, is there issues about 'javascript import'?

So I searched it, and found this. https!!://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/import

and I replaced './Loader' by "./Loader".

But the error remains.

Is anyone who have wonder wisdom about this issue? Help!




What is a Web Framework?

can somebody explain me, what a Web Framework is? In a tutorial I am supposed to use express (node.js), which is a web framework. But before I was just using PHP in order to responde to HTTP-GET/-POST requests. So why do I need express for?