Notebook fn + f1 to switch the display, so why would the letter p?
I use Dell notebook and Ubuntu 12.04. A few days ago fn+f1 suddenly type
letter p instead of switch display monitor.
Need your help please.
Monday, 30 September 2013
Why is one stack piece in the Stackoverflow logo slightly off=?iso-8859-1?Q?=3F_=96_meta.stackoverflow.com?=
Why is one stack piece in the Stackoverflow logo slightly off? –
meta.stackoverflow.com
I understand this question has already been asked but in this I have
expounded on the issue and explain more unsightly features of the
Stackoverflow logo. I'm not sure why but every time I visit ...
meta.stackoverflow.com
I understand this question has already been asked but in this I have
expounded on the issue and explain more unsightly features of the
Stackoverflow logo. I'm not sure why but every time I visit ...
How could I read a file with header and then save the final file with header again?
How could I read a file with header and then save the final file with
header again?
I'd like to read file1 with given header and then implement some
mathematical operations on , for example, the x and Imag columns. Finally
I want to save the final file with header again.
How could I do it?
File1:
#ID ra dec x y Umag Bmag Vmag Rmag
Imag
1.0 53.141 -27.7967 3491.37 4060.43 23.1612 23.7058 23.0223 22.5351
22.1785
2.0 53.140 -27.7956 3496.66 4076.57 24.1362 24.8441 25.0093 24.7304
24.5864
3.0 53.142 -27.8008 3471.25 3997.29 24.1729 25.3841 25.3501 25.1032
25.0042
4.0 53.138 -27.7891 3527.16 4175.46 24.4685 26.1972 26.1785 25.5567
25.3188
5.0 53.146 -27.8085 3424.83 3880.66 24.425 25.1966 25.2755 24.9514
24.3456
header again?
I'd like to read file1 with given header and then implement some
mathematical operations on , for example, the x and Imag columns. Finally
I want to save the final file with header again.
How could I do it?
File1:
#ID ra dec x y Umag Bmag Vmag Rmag
Imag
1.0 53.141 -27.7967 3491.37 4060.43 23.1612 23.7058 23.0223 22.5351
22.1785
2.0 53.140 -27.7956 3496.66 4076.57 24.1362 24.8441 25.0093 24.7304
24.5864
3.0 53.142 -27.8008 3471.25 3997.29 24.1729 25.3841 25.3501 25.1032
25.0042
4.0 53.138 -27.7891 3527.16 4175.46 24.4685 26.1972 26.1785 25.5567
25.3188
5.0 53.146 -27.8085 3424.83 3880.66 24.425 25.1966 25.2755 24.9514
24.3456
Force To Read HttpWebResponse.GetResponseStream() When Content-Length Is Zero
Force To Read HttpWebResponse.GetResponseStream() When Content-Length Is Zero
As title said.
Sometime an HTTP response from remote server includes Content-Length
header with zero value, but it still return HTTP body. The body can still
be obtained with jQuery in browser, but using
HttpWebResponse.GetResponseStream() can't read anything. How do I force to
read it? Thanks everyone.
Here's an example of HTTP response which I met.
HTTP/1.1 200 OK Connection: keep-alive Cache-Control: no-cache,no-store
Content-Type: text/plain Content-Length: 0 Date: Mon, 30 Sep 2013 09:34:21
GMT
As title said.
Sometime an HTTP response from remote server includes Content-Length
header with zero value, but it still return HTTP body. The body can still
be obtained with jQuery in browser, but using
HttpWebResponse.GetResponseStream() can't read anything. How do I force to
read it? Thanks everyone.
Here's an example of HTTP response which I met.
HTTP/1.1 200 OK Connection: keep-alive Cache-Control: no-cache,no-store
Content-Type: text/plain Content-Length: 0 Date: Mon, 30 Sep 2013 09:34:21
GMT
Sunday, 29 September 2013
JNDI resource lookup fails with Glassfish
JNDI resource lookup fails with Glassfish
Created a JNDI custom resource:
imageBasePath
java.lang.String
/home/user/NetBeansProjects/Builder/images
Tried looking it up as follows:
InitialContext ctx;
try {
ctx = new InitialContext();
Object o = ctx.lookup("imageBasePath");
} catch (NamingException ex) {
Logger.getLogger(blanketBean.class.getName()).log(Level.SEVERE, null,
ex);
}
It throws exception:
(javax.naming.CommunicationException) javax.naming.CommunicationException:
Communication exception for
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is
java.lang.IllegalArgumentException: type cannot be null]
What am I doing wrong?
Created a JNDI custom resource:
imageBasePath
java.lang.String
/home/user/NetBeansProjects/Builder/images
Tried looking it up as follows:
InitialContext ctx;
try {
ctx = new InitialContext();
Object o = ctx.lookup("imageBasePath");
} catch (NamingException ex) {
Logger.getLogger(blanketBean.class.getName()).log(Level.SEVERE, null,
ex);
}
It throws exception:
(javax.naming.CommunicationException) javax.naming.CommunicationException:
Communication exception for
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is
java.lang.IllegalArgumentException: type cannot be null]
What am I doing wrong?
In programming languages, what is typically the way used to represent binary values?
In programming languages, what is typically the way used to represent
binary values?
I'm not asking about a particular language, but just in general. I know
that, for example, #0x or simply 0x is put before the number, or an h is
placed after the number, to refer to hexadecimal.
Is there a similar "standard" for binary?
binary values?
I'm not asking about a particular language, but just in general. I know
that, for example, #0x or simply 0x is put before the number, or an h is
placed after the number, to refer to hexadecimal.
Is there a similar "standard" for binary?
Bitmap font glyph offset and x axis?
Bitmap font glyph offset and x axis?
I have a bitmapfont, created with the angel'scode bitmap generator. I have
a png with the texture and a .fnt with the information of the font
(texture coordinates, char width and height, offsets, advance, etc...).
That information is stored inside a struct called 'glyph'
I am rendering those glyphs with this code:
float x_cursor = 0.0f;
// Record each char of my string
for(int i=0; i < [mystring length];i++)
{
// Get the char id
int mychar = (int)[mystring characterAtIndex:i];
// Get the glyph information of the char to render
GlyphChar glyph;
if([GlpyhCharBuffer count] < (mychar-first_char)+1)
continue;
NSValue * valuegly = [GlpyhCharBuffer objectAtIndex:(mychar-first_char)];
if(valuegly == nil)
{
continue;
}
[valuegly getValue:&glyph];
// Start with the OpenGL Drawing
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
// Where to draw our char
float y_offsetpos = screen_point[1] + TOGLUNIT(glyph.y_offset) * -1.0f;
float x_glyphpos = screen_point[0] +
TOGLUNIT(x_cursor+(float)glyph.x_offset);
GLKMatrix4 model_modifier = GLKMatrix4MakeTranslation(x_glyphpos,
y_offsetpos, 0.0f);
float glyph_width = TOGLUNIT((float)glyph.char_width);
float glyph_height = TOGLUNIT((float)glyph.char_height);
// Move the cursor in the x axis for the following char
x_cursor += (float)glyph.x_advance;
// Create our model matrix, for scale and translate our char
GLKMatrix4 model_modifier = GLKMatrix4MakeTranslation(x_glyphpos,
y_offsetpos, 0.0f);
model_modifier = GLKMatrix4Scale(model_modifier, glyph_width,
glyph_height,0.0f);
GLuint uniform_dir = glGetUniformLocation(program, "model_matrix");
glUniformMatrix4fv(uniform_dir, 1, GL_FALSE, model_modifier.m);
glBindBuffer(GL_ARRAY_BUFFER, square_buff);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
glBindBuffer(GL_ARRAY_BUFFER, glyph.uvscoord);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
glBindTexture(tex_information.target, tex_information.name);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(0);
}
the X Axis is not working good, it gives a bad result:
I already tried with a lot of fonts, generated by the angel'scode and
stills giving the same error. How the X Aligning on a bitmap font works?
I have a bitmapfont, created with the angel'scode bitmap generator. I have
a png with the texture and a .fnt with the information of the font
(texture coordinates, char width and height, offsets, advance, etc...).
That information is stored inside a struct called 'glyph'
I am rendering those glyphs with this code:
float x_cursor = 0.0f;
// Record each char of my string
for(int i=0; i < [mystring length];i++)
{
// Get the char id
int mychar = (int)[mystring characterAtIndex:i];
// Get the glyph information of the char to render
GlyphChar glyph;
if([GlpyhCharBuffer count] < (mychar-first_char)+1)
continue;
NSValue * valuegly = [GlpyhCharBuffer objectAtIndex:(mychar-first_char)];
if(valuegly == nil)
{
continue;
}
[valuegly getValue:&glyph];
// Start with the OpenGL Drawing
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
// Where to draw our char
float y_offsetpos = screen_point[1] + TOGLUNIT(glyph.y_offset) * -1.0f;
float x_glyphpos = screen_point[0] +
TOGLUNIT(x_cursor+(float)glyph.x_offset);
GLKMatrix4 model_modifier = GLKMatrix4MakeTranslation(x_glyphpos,
y_offsetpos, 0.0f);
float glyph_width = TOGLUNIT((float)glyph.char_width);
float glyph_height = TOGLUNIT((float)glyph.char_height);
// Move the cursor in the x axis for the following char
x_cursor += (float)glyph.x_advance;
// Create our model matrix, for scale and translate our char
GLKMatrix4 model_modifier = GLKMatrix4MakeTranslation(x_glyphpos,
y_offsetpos, 0.0f);
model_modifier = GLKMatrix4Scale(model_modifier, glyph_width,
glyph_height,0.0f);
GLuint uniform_dir = glGetUniformLocation(program, "model_matrix");
glUniformMatrix4fv(uniform_dir, 1, GL_FALSE, model_modifier.m);
glBindBuffer(GL_ARRAY_BUFFER, square_buff);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
glBindBuffer(GL_ARRAY_BUFFER, glyph.uvscoord);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
glBindTexture(tex_information.target, tex_information.name);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(0);
}
the X Axis is not working good, it gives a bad result:
I already tried with a lot of fonts, generated by the angel'scode and
stills giving the same error. How the X Aligning on a bitmap font works?
Subscribe to:
Posts (Atom)