Search Results

Search found 44 results on 2 pages for '786'.

Page 1/2 | 1 2  | Next Page >

  • Why does my performance increase when touching the screen?

    - by Smills
    For some reason my FPS jumps up considerably when I move my mouse around on the screen (on the emulator) while holding the left mouse button. Normally my game is very laggy, but if I touch the screen (and as long as I am moving the mouse around while touching) it goes perfectly smooth. I have tried sleeping for 20ms in the onTouchEvent, but it doesn't appear to make any difference. Here is the code I use in my onTouchEvent: // events when touching the screen public boolean onTouchEvent(MotionEvent event) { int eventaction = event.getAction(); touchX=event.getX(); touchY=event.getY(); switch (eventaction) { case MotionEvent.ACTION_DOWN: { touch=true; } break; case MotionEvent.ACTION_MOVE: { } break; case MotionEvent.ACTION_UP: { touch=false; } break; } /*try { AscentThread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ return true; } In the logcat log, FPS is the current fps (average of the last 20 frames), touch is whether or not the screen is being touched (from onTouchEvent). What on earth is going on? Has anyone else had this odd behaviour before? Logcat log: 12-21 19:43:26.154: INFO/myActivity(786): FPS: 31.686569159606414 Touch: false 12-21 19:43:27.624: INFO/myActivity(786): FPS: 19.46310293212206 Touch: false 12-21 19:43:29.104: INFO/myActivity(786): FPS: 18.801202175690467 Touch: false 12-21 19:43:30.514: INFO/myActivity(786): FPS: 21.118295877408478 Touch: false 12-21 19:43:31.985: INFO/myActivity(786): FPS: 19.117397812958878 Touch: false 12-21 19:43:33.534: INFO/myActivity(786): FPS: 15.572571858239263 Touch: false 12-21 19:43:34.934: INFO/myActivity(786): FPS: 20.584119901503506 Touch: false 12-21 19:43:36.404: INFO/myActivity(786): FPS: 18.888025905454207 Touch: false 12-21 19:43:37.814: INFO/myActivity(786): FPS: 22.35722329083629 Touch: false 12-21 19:43:39.353: INFO/myActivity(786): FPS: 15.73604859775362 Touch: false 12-21 19:43:40.763: INFO/myActivity(786): FPS: 20.912449882754633 Touch: false 12-21 19:43:42.233: INFO/myActivity(786): FPS: 18.785278388997718 Touch: false 12-21 19:43:43.634: INFO/myActivity(786): FPS: 20.1357397209596 Touch: false 12-21 19:43:45.043: INFO/myActivity(786): FPS: 21.961138432007957 Touch: false 12-21 19:43:46.453: INFO/myActivity(786): FPS: 22.167196852834273 Touch: false 12-21 19:43:47.854: INFO/myActivity(786): FPS: 22.207318228024274 Touch: false 12-21 19:43:49.264: INFO/myActivity(786): FPS: 22.36980559230175 Touch: false 12-21 19:43:50.604: INFO/myActivity(786): FPS: 23.587638823252547 Touch: false 12-21 19:43:52.073: INFO/myActivity(786): FPS: 19.233902040593076 Touch: false 12-21 19:43:53.624: INFO/myActivity(786): FPS: 15.542190150440987 Touch: false 12-21 19:43:55.034: INFO/myActivity(786): FPS: 20.82290063974675 Touch: false 12-21 19:43:56.436: INFO/myActivity(786): FPS: 21.975282007207717 Touch: false 12-21 19:43:57.914: INFO/myActivity(786): FPS: 18.786927284103687 Touch: false 12-21 19:43:59.393: INFO/myActivity(786): FPS: 18.96879004217992 Touch: false 12-21 19:44:00.625: INFO/myActivity(786): FPS: 28.367566618064878 Touch: false 12-21 19:44:02.113: INFO/myActivity(786): FPS: 19.04441528684418 Touch: false 12-21 19:44:03.585: INFO/myActivity(786): FPS: 18.807837511809065 Touch: false 12-21 19:44:04.993: INFO/myActivity(786): FPS: 21.134330284993418 Touch: false 12-21 19:44:06.275: INFO/myActivity(786): FPS: 27.209688764079907 Touch: false 12-21 19:44:07.753: INFO/myActivity(786): FPS: 19.055894653261653 Touch: false 12-21 19:44:09.163: INFO/myActivity(786): FPS: 22.05422794901088 Touch: false 12-21 19:44:10.644: INFO/myActivity(786): FPS: 18.6956805300596 Touch: false 12-21 19:44:12.124: INFO/myActivity(786): FPS: 17.434180581311054 Touch: false 12-21 19:44:13.594: INFO/myActivity(786): FPS: 18.71932038510891 Touch: false 12-21 19:44:14.504: INFO/myActivity(786): FPS: 40.94571503868066 Touch: true 12-21 19:44:14.924: INFO/myActivity(786): FPS: 57.061200121138576 Touch: true 12-21 19:44:15.364: INFO/myActivity(786): FPS: 62.54377946377936 Touch: true 12-21 19:44:15.764: INFO/myActivity(786): FPS: 64.05005071818726 Touch: true 12-21 19:44:16.384: INFO/myActivity(786): FPS: 50.912951172948155 Touch: true 12-21 19:44:16.874: INFO/myActivity(786): FPS: 55.31242053078078 Touch: true 12-21 19:44:17.364: INFO/myActivity(786): FPS: 59.31625410615102 Touch: true 12-21 19:44:18.413: INFO/myActivity(786): FPS: 36.63504170925923 Touch: false 12-21 19:44:19.885: INFO/myActivity(786): FPS: 18.099130467755923 Touch: false 12-21 19:44:21.363: INFO/myActivity(786): FPS: 18.458978222946566 Touch: false 12-21 19:44:22.683: INFO/myActivity(786): FPS: 25.582179409330823 Touch: true 12-21 19:44:23.044: INFO/myActivity(786): FPS: 60.99865521942455 Touch: true 12-21 19:44:23.403: INFO/myActivity(786): FPS: 74.17873975470984 Touch: true 12-21 19:44:23.763: INFO/myActivity(786): FPS: 64.25663040460714 Touch: true 12-21 19:44:24.113: INFO/myActivity(786): FPS: 62.47483457826921 Touch: true 12-21 19:44:24.473: INFO/myActivity(786): FPS: 65.27969529547072 Touch: true 12-21 19:44:24.825: INFO/myActivity(786): FPS: 67.84743115273311 Touch: true 12-21 19:44:25.173: INFO/myActivity(786): FPS: 73.50854551357706 Touch: true 12-21 19:44:25.523: INFO/myActivity(786): FPS: 70.46432534585368 Touch: true 12-21 19:44:25.873: INFO/myActivity(786): FPS: 69.04076953445896 Touch: true

    Read the article

  • Android Mediaplayer: setDataSource issue for downloaded media file

    - by Erik
    I have an application that will record and play audio files. Some of the audio files are downloaded using simple standard http downloads using httpclient. It worked like a charm for a long time. Now all of a sudden I cannot play the files I download. It fails with this stack. I store the files on the SDCard and I experience the problem both on a handset and a USB connected device. I have checked that the downloaded file is cool on the server, and I can play it without any issues. These are the code snippets I use ( I know that recordingFile is a valid path for the file). // inside the activity class private void playRecording() throws IOException{ File recordingFile = new File(recordingFileName); FileInputStream recordingInputStream = new FileInputStream(recordingFile); audioMediaPlayer.playAudio(recordingInputStream); } Here is the media player code: // inside my media player class which handles the recordings public void playAudio(FileInputStream audioInputStream) throws IOException { mediaPlayer.reset(); mediaPlayer.setDataSource(audioInputStream.getFD()); mediaPlayer.prepare(); mediaPlayer.start(); } Here is the exception: E/MediaPlayerService( 555): offset error E/MediaPlayer( 786): Unable to to create media player W/System.err( 786): java.io.IOException: setDataSourceFD failed.: status=0x80000000 W/System.err( 786): at android.media.MediaPlayer.setDataSource(Native Method) W/System.err( 786): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:632) W/System.err( 786): at net.xxx.xxx.AudioMediaPlayer.playAudio(AudioMediaPlayer.java:69) W/System.err( 786): at net.xxx.xxx.Downloads.playRecording(Downloads.java:299) W/System.err( 786): at net.xxx.xxx.Downloads.access$0(Downloads.java:294) W/System.err( 786): at net.xxx.xxx.Downloads$1.onClick(Downloads.java:135) I have tried seeking some answer of the offset error, but not really clear what this issue might be. PS I download the file with this code: public FileOutputStream executeHttpGet(FileOutputStream fileOutputStream) throws ClientProtocolException, IOException{ try { // Execute HTTP Post Request httpResponse = httpClient.execute(httpPost, localContext); int status = httpResponse.getStatusLine().getStatusCode(); // we assume that the response body contains the error message if (status != HttpStatus.SC_OK) { ByteArrayOutputStream ostream = new ByteArrayOutputStream(); httpResponse.getEntity().writeTo(ostream); fileOutputStream = null; } else { InputStream content = httpResponse.getEntity().getContent(); byte[] buffer = new byte[1024]; int len = 0; while ( (len = content.read(buffer)) > 0 ) { fileOutputStream.write(buffer,0, len); } fileOutputStream.close(); content.close(); // this will also close the connection } } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); fileOutputStream = null; } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); fileOutputStream = null; } return fileOutputStream; }

    Read the article

  • How to rotate a sprite using multi-touch with AndEngine?

    - by 786
    I am new to Android game development. I am using AndEngine GLES-2. I have created a box with a sprite. This box is now draggable by using the code below. It works fine. But I want multi-touch on this: I want to rotate the sprite with two fingers on that box, and to keep it draggable. I've no idea how do do that, which way should I go? final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2; final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2; Box = new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) { public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2); float pValueX = pSceneTouchEvent.getX(); float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY(); float dx = pValueX - gun.getX(); float dy = pValueY - gun.getY(); double Radius = Math.atan2(dy,dx); double Angle = Radius * 360 ; Box.setRotation((float)Math.toDegrees(Angle)); return true; }

    Read the article

  • how to rotate a sprite using multi touch (andengine) in android?

    - by 786
    I am new to android game development. I am using andengine GLES-2. i have created sprite as a box. this box is now draggable by using this coding. it works fine. but i want multitouch on this which i want to rotate a sprite with 2 finger in that box and even it should be draggable. .... plz help someone by overwriting this code or by giving exact example of this doubt... i am trying this many days but no idea. final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2; final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2; Box= new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) { public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2); float pValueX = pSceneTouchEvent.getX(); float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY(); float dx = pValueX - gun.getX(); float dy = pValueY - gun.getY(); double Radius = Math.atan2(dy,dx); double Angle = Radius * 360 ; Box.setRotation((float)Math.toDegrees(Angle)); return true; } thanks

    Read the article

  • opengl problem works on droid but not droid eris and others.

    - by nathan
    This GlRenderer works fine on the moto droid, but does not work well at all on droid eris or other android phones does anyone know why? package com.ntu.way2fungames.spacehockeybase; import java.io.DataInputStream; import java.io.IOException; import java.nio.Buffer; import java.nio.FloatBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import com.ntu.way2fungames.LoadFloatArray; import com.ntu.way2fungames.OGLTriReader; import android.content.res.AssetManager; import android.content.res.Resources; import android.opengl.GLU; import android.opengl.GLSurfaceView.Renderer; import android.os.Handler; import android.os.Message; public class GlRenderer extends Thread implements Renderer { private float drawArray[]; private float yoff; private float yoff2; private long lastRenderTime; private float[] yoffs= new float[10]; int Width; int Height; private float[] pixelVerts = new float[] { +.0f,+.0f,2, +.5f,+.5f,0, +.5f,-.5f,0, +.0f,+.0f,2, +.5f,-.5f,0, -.5f,-.5f,0, +.0f,+.0f,2, -.5f,-.5f,0, -.5f,+.5f,0, +.0f,+.0f,2, -.5f,+.5f,0, +.5f,+.5f,0, }; @Override public void run() { } private float[] arenaWalls = new float[] { 8.00f,2.00f,1f,2f,2f,1f,2.00f,8.00f,1f,8.00f,2.00f,1f,2.00f,8.00f,1f,8.00f,8.00f,1f, 2.00f,8.00f,1f,2f,2f,1f,0.00f,0.00f,0f,2.00f,8.00f,1f,0.00f,0.00f,0f,0.00f,10.00f,0f, 8.00f,8.00f,1f,2.00f,8.00f,1f,0.00f,10.00f,0f,8.00f,8.00f,1f,0.00f,10.00f,0f,10.00f,10.00f,0f, 2f,2f,1f,8.00f,2.00f,1f,10.00f,0.00f,0f,2f,2f,1f,10.00f,0.00f,0f,0.00f,0.00f,0f, 8.00f,2.00f,1f,8.00f,8.00f,1f,10.00f,10.00f,0f,8.00f,2.00f,1f,10.00f,10.00f,0f,10.00f,0.00f,0f, 10.00f,10.00f,0f,0.00f,10.00f,0f,0.00f,0.00f,0f,10.00f,10.00f,0f,0.00f,0.00f,0f,10.00f,0.00f,0f, 8.00f,6.00f,1f,8.00f,4.00f,1f,122f,4.00f,1f,8.00f,6.00f,1f,122f,4.00f,1f,122f,6.00f,1f, 8.00f,6.00f,1f,122f,6.00f,1f,120f,7.00f,0f,8.00f,6.00f,1f,120f,7.00f,0f,10.00f,7.00f,0f, 122f,4.00f,1f,8.00f,4.00f,1f,10.00f,3.00f,0f,122f,4.00f,1f,10.00f,3.00f,0f,120f,3.00f,0f, 480f,10.00f,0f,470f,10.00f,0f,470f,0.00f,0f,480f,10.00f,0f,470f,0.00f,0f,480f,0.00f,0f, 478f,2.00f,1f,478f,8.00f,1f,480f,10.00f,0f,478f,2.00f,1f,480f,10.00f,0f,480f,0.00f,0f, 472f,2f,1f,478f,2.00f,1f,480f,0.00f,0f,472f,2f,1f,480f,0.00f,0f,470f,0.00f,0f, 478f,8.00f,1f,472f,8.00f,1f,470f,10.00f,0f,478f,8.00f,1f,470f,10.00f,0f,480f,10.00f,0f, 472f,8.00f,1f,472f,2f,1f,470f,0.00f,0f,472f,8.00f,1f,470f,0.00f,0f,470f,10.00f,0f, 478f,2.00f,1f,472f,2f,1f,472f,8.00f,1f,478f,2.00f,1f,472f,8.00f,1f,478f,8.00f,1f, 478f,846f,1f,472f,846f,1f,472f,852f,1f,478f,846f,1f,472f,852f,1f,478f,852f,1f, 472f,852f,1f,472f,846f,1f,470f,844f,0f,472f,852f,1f,470f,844f,0f,470f,854f,0f, 478f,852f,1f,472f,852f,1f,470f,854f,0f,478f,852f,1f,470f,854f,0f,480f,854f,0f, 472f,846f,1f,478f,846f,1f,480f,844f,0f,472f,846f,1f,480f,844f,0f,470f,844f,0f, 478f,846f,1f,478f,852f,1f,480f,854f,0f,478f,846f,1f,480f,854f,0f,480f,844f,0f, 480f,854f,0f,470f,854f,0f,470f,844f,0f,480f,854f,0f,470f,844f,0f,480f,844f,0f, 10.00f,854f,0f,0.00f,854f,0f,0.00f,844f,0f,10.00f,854f,0f,0.00f,844f,0f,10.00f,844f,0f, 8.00f,846f,1f,8.00f,852f,1f,10.00f,854f,0f,8.00f,846f,1f,10.00f,854f,0f,10.00f,844f,0f, 2f,846f,1f,8.00f,846f,1f,10.00f,844f,0f,2f,846f,1f,10.00f,844f,0f,0.00f,844f,0f, 8.00f,852f,1f,2.00f,852f,1f,0.00f,854f,0f,8.00f,852f,1f,0.00f,854f,0f,10.00f,854f,0f, 2.00f,852f,1f,2f,846f,1f,0.00f,844f,0f,2.00f,852f,1f,0.00f,844f,0f,0.00f,854f,0f, 8.00f,846f,1f,2f,846f,1f,2.00f,852f,1f,8.00f,846f,1f,2.00f,852f,1f,8.00f,852f,1f, 6f,846f,1f,4f,846f,1f,4f,8f,1f,6f,846f,1f,4f,8f,1f,6f,8f,1f, 6f,846f,1f,6f,8f,1f,7f,10f,0f,6f,846f,1f,7f,10f,0f,7f,844f,0f, 4f,8f,1f,4f,846f,1f,3f,844f,0f,4f,8f,1f,3f,844f,0f,3f,10f,0f, 474f,8f,1f,474f,846f,1f,473f,844f,0f,474f,8f,1f,473f,844f,0f,473f,10f,0f, 476f,846f,1f,476f,8f,1f,477f,10f,0f,476f,846f,1f,477f,10f,0f,477f,844f,0f, 476f,846f,1f,474f,846f,1f,474f,8f,1f,476f,846f,1f,474f,8f,1f,476f,8f,1f, 130f,10.00f,0f,120f,10.00f,0f,120f,0.00f,0f,130f,10.00f,0f,120f,0.00f,0f,130f,0.00f,0f, 128f,2.00f,1f,128f,8.00f,1f,130f,10.00f,0f,128f,2.00f,1f,130f,10.00f,0f,130f,0.00f,0f, 122f,2f,1f,128f,2.00f,1f,130f,0.00f,0f,122f,2f,1f,130f,0.00f,0f,120f,0.00f,0f, 128f,8.00f,1f,122f,8.00f,1f,120f,10.00f,0f,128f,8.00f,1f,120f,10.00f,0f,130f,10.00f,0f, 122f,8.00f,1f,122f,2f,1f,120f,0.00f,0f,122f,8.00f,1f,120f,0.00f,0f,120f,10.00f,0f, 128f,2.00f,1f,122f,2f,1f,122f,8.00f,1f,128f,2.00f,1f,122f,8.00f,1f,128f,8.00f,1f, 352f,8.00f,1f,358f,8.00f,1f,358f,2.00f,1f,352f,8.00f,1f,358f,2.00f,1f,352f,2.00f,1f, 358f,2.00f,1f,358f,8.00f,1f,360f,10.00f,0f,358f,2.00f,1f,360f,10.00f,0f,360f,0.00f,0f, 352f,2.00f,1f,358f,2.00f,1f,360f,0.00f,0f,352f,2.00f,1f,360f,0.00f,0f,350f,0.00f,0f, 358f,8.00f,1f,352f,8.00f,1f,350f,10.00f,0f,358f,8.00f,1f,350f,10.00f,0f,360f,10.00f,0f, 352f,8.00f,1f,352f,2.00f,1f,350f,0.00f,0f,352f,8.00f,1f,350f,0.00f,0f,350f,10.00f,0f, 350f,0.00f,0f,360f,0.00f,0f,360f,10.00f,0f,350f,0.00f,0f,360f,10.00f,0f,350f,10.00f,0f, 358f,6.00f,1f,472f,6.00f,1f,470f,7.00f,0f,358f,6.00f,1f,470f,7.00f,0f,360f,7.00f,0f, 472f,4.00f,1f,358f,4.00f,1f,360f,3.00f,0f,472f,4.00f,1f,360f,3.00f,0f,470f,3.00f,0f, 472f,4.00f,1f,472f,6.00f,1f,358f,6.00f,1f,472f,4.00f,1f,358f,6.00f,1f,358f,4.00f,1f, 472f,848f,1f,472f,850f,1f,358f,850f,1f,472f,848f,1f,358f,850f,1f,358f,848f,1f, 472f,848f,1f,358f,848f,1f,360f,847f,0f,472f,848f,1f,360f,847f,0f,470f,847f,0f, 358f,850f,1f,472f,850f,1f,470f,851f,0f,358f,850f,1f,470f,851f,0f,360f,851f,0f, 350f,844f,0f,360f,844f,0f,360f,854f,0f,350f,844f,0f,360f,854f,0f,350f,854f,0f, 352f,852f,1f,352f,846f,1f,350f,844f,0f,352f,852f,1f,350f,844f,0f,350f,854f,0f, 358f,852f,1f,352f,852f,1f,350f,854f,0f,358f,852f,1f,350f,854f,0f,360f,854f,0f, 352f,846f,1f,358f,846f,1f,360f,844f,0f,352f,846f,1f,360f,844f,0f,350f,844f,0f, 358f,846f,1f,358f,852f,1f,360f,854f,0f,358f,846f,1f,360f,854f,0f,360f,844f,0f, 352f,852f,1f,358f,852f,1f,358f,846f,1f,352f,852f,1f,358f,846f,1f,352f,846f,1f, 128f,846f,1f,122f,846f,1f,122f,852f,1f,128f,846f,1f,122f,852f,1f,128f,852f,1f, 122f,852f,1f,122f,846f,1f,120f,844f,0f,122f,852f,1f,120f,844f,0f,120f,854f,0f, 128f,852f,1f,122f,852f,1f,120f,854f,0f,128f,852f,1f,120f,854f,0f,130f,854f,0f, 122f,846f,1f,128f,846f,1f,130f,844f,0f,122f,846f,1f,130f,844f,0f,120f,844f,0f, 128f,846f,1f,128f,852f,1f,130f,854f,0f,128f,846f,1f,130f,854f,0f,130f,844f,0f, 130f,854f,0f,120f,854f,0f,120f,844f,0f,130f,854f,0f,120f,844f,0f,130f,844f,0f, 122f,848f,1f,8f,848f,1f,10f,847f,0f,122f,848f,1f,10f,847f,0f,120f,847f,0f, 8f,850f,1f,122f,850f,1f,120f,851f,0f,8f,850f,1f,120f,851f,0f,10f,851f,0f, 8f,850f,1f,8f,848f,1f,122f,848f,1f,8f,850f,1f,122f,848f,1f,122f,850f,1f, 10f,847f,0f,120f,847f,0f,124.96f,829.63f,-0.50f,10f,847f,0f,124.96f,829.63f,-0.50f,19.51f,829.63f,-0.50f, 130f,844f,0f,130f,854f,0f,134.55f,836.34f,-0.50f,130f,844f,0f,134.55f,836.34f,-0.50f,134.55f,826.76f,-0.50f, 350f,844f,0f,350f,854f,0f,345.45f,836.34f,-0.50f,350f,844f,0f,345.45f,836.34f,-0.50f,345.45f,826.76f,-0.50f, 360f,847f,0f,470f,847f,0f,460.49f,829.63f,-0.50f,360f,847f,0f,460.49f,829.63f,-0.50f,355.04f,829.63f,-0.50f, 470f,7.00f,0f,360f,7.00f,0f,355.04f,24.37f,-0.50f,470f,7.00f,0f,355.04f,24.37f,-0.50f,460.49f,24.37f,-0.50f, 350f,10.00f,0f,350f,0.00f,0f,345.45f,17.66f,-0.50f,350f,10.00f,0f,345.45f,17.66f,-0.50f,345.45f,27.24f,-0.50f, 130f,10.00f,0f,130f,0.00f,0f,134.55f,17.66f,-0.50f,130f,10.00f,0f,134.55f,17.66f,-0.50f,134.55f,27.24f,-0.50f, 473f,844f,0f,473f,10f,0f,463.36f,27.24f,-0.50f,473f,844f,0f,463.36f,27.24f,-0.50f,463.36f,826.76f,-0.50f, 7f,10f,0f,7f,844f,0f,16.64f,826.76f,-0.50f,7f,10f,0f,16.64f,826.76f,-0.50f,16.64f,27.24f,-0.50f, 120f,7.00f,0f,10.00f,7.00f,0f,19.51f,24.37f,-0.50f,120f,7.00f,0f,19.51f,24.37f,-0.50f,124.96f,24.37f,-0.50f, 120f,7.00f,0f,130f,10.00f,0f,134.55f,27.24f,-0.50f,120f,7.00f,0f,134.55f,27.24f,-0.50f,124.96f,24.37f,-0.50f, 10.00f,7.00f,0f,7f,10f,0f,16.64f,27.24f,-0.50f,10.00f,7.00f,0f,16.64f,27.24f,-0.50f,19.51f,24.37f,-0.50f, 350f,10.00f,0f,360f,7.00f,0f,355.04f,24.37f,-0.50f,350f,10.00f,0f,355.04f,24.37f,-0.50f,345.45f,27.24f,-0.50f, 473f,10f,0f,470f,7.00f,0f,460.49f,24.37f,-0.50f,473f,10f,0f,460.49f,24.37f,-0.50f,463.36f,27.24f,-0.50f, 473f,844f,0f,470f,847f,0f,460.49f,829.63f,-0.50f,473f,844f,0f,460.49f,829.63f,-0.50f,463.36f,826.76f,-0.50f, 360f,847f,0f,350f,844f,0f,345.45f,826.76f,-0.50f,360f,847f,0f,345.45f,826.76f,-0.50f,355.04f,829.63f,-0.50f, 130f,844f,0f,120f,847f,0f,124.96f,829.63f,-0.50f,130f,844f,0f,124.96f,829.63f,-0.50f,134.55f,826.76f,-0.50f, 7f,844f,0f,10f,847f,0f,19.51f,829.63f,-0.50f,7f,844f,0f,19.51f,829.63f,-0.50f,16.64f,826.76f,-0.50f, 19.51f,829.63f,-0.50f,124.96f,829.63f,-0.50f,136.47f,789.37f,-2f,19.51f,829.63f,-0.50f,136.47f,789.37f,-2f,41.56f,789.37f,-2f, 134.55f,826.76f,-0.50f,134.55f,836.34f,-0.50f,145.09f,795.41f,-2f,134.55f,826.76f,-0.50f,145.09f,795.41f,-2f,145.09f,786.78f,-2f, 345.45f,826.76f,-0.50f,345.45f,836.34f,-0.50f,334.91f,795.41f,-2f,345.45f,826.76f,-0.50f,334.91f,795.41f,-2f,334.91f,786.78f,-2f, 355.04f,829.63f,-0.50f,460.49f,829.63f,-0.50f,438.44f,789.37f,-2f,355.04f,829.63f,-0.50f,438.44f,789.37f,-2f,343.53f,789.37f,-2f, 460.49f,24.37f,-0.50f,355.04f,24.37f,-0.50f,343.53f,64.63f,-2f,460.49f,24.37f,-0.50f,343.53f,64.63f,-2f,438.44f,64.63f,-2f, 345.45f,27.24f,-0.50f,345.45f,17.66f,-0.50f,334.91f,58.59f,-2f,345.45f,27.24f,-0.50f,334.91f,58.59f,-2f,334.91f,67.22f,-2f, 134.55f,27.24f,-0.50f,134.55f,17.66f,-0.50f,145.09f,58.59f,-2f,134.55f,27.24f,-0.50f,145.09f,58.59f,-2f,145.09f,67.22f,-2f, 463.36f,826.76f,-0.50f,463.36f,27.24f,-0.50f,441.03f,67.22f,-2f,463.36f,826.76f,-0.50f,441.03f,67.22f,-2f,441.03f,786.78f,-2f, 16.64f,27.24f,-0.50f,16.64f,826.76f,-0.50f,38.97f,786.78f,-2f,16.64f,27.24f,-0.50f,38.97f,786.78f,-2f,38.97f,67.22f,-2f, 124.96f,24.37f,-0.50f,19.51f,24.37f,-0.50f,41.56f,64.63f,-2f,124.96f,24.37f,-0.50f,41.56f,64.63f,-2f,136.47f,64.63f,-2f, 124.96f,24.37f,-0.50f,134.55f,27.24f,-0.50f,145.09f,67.22f,-2f,124.96f,24.37f,-0.50f,145.09f,67.22f,-2f,136.47f,64.63f,-2f, 19.51f,24.37f,-0.50f,16.64f,27.24f,-0.50f,38.97f,67.22f,-2f,19.51f,24.37f,-0.50f,38.97f,67.22f,-2f,41.56f,64.63f,-2f, 345.45f,27.24f,-0.50f,355.04f,24.37f,-0.50f,343.53f,64.63f,-2f,345.45f,27.24f,-0.50f,343.53f,64.63f,-2f,334.91f,67.22f,-2f, 463.36f,27.24f,-0.50f,460.49f,24.37f,-0.50f,438.44f,64.63f,-2f,463.36f,27.24f,-0.50f,438.44f,64.63f,-2f,441.03f,67.22f,-2f, 463.36f,826.76f,-0.50f,460.49f,829.63f,-0.50f,438.44f,789.37f,-2f,463.36f,826.76f,-0.50f,438.44f,789.37f,-2f,441.03f,786.78f,-2f, 355.04f,829.63f,-0.50f,345.45f,826.76f,-0.50f,334.91f,786.78f,-2f,355.04f,829.63f,-0.50f,334.91f,786.78f,-2f,343.53f,789.37f,-2f, 134.55f,826.76f,-0.50f,124.96f,829.63f,-0.50f,136.47f,789.37f,-2f,134.55f,826.76f,-0.50f,136.47f,789.37f,-2f,145.09f,786.78f,-2f, 16.64f,826.76f,-0.50f,19.51f,829.63f,-0.50f,41.56f,789.37f,-2f,16.64f,826.76f,-0.50f,41.56f,789.37f,-2f,38.97f,786.78f,-2f, }; private float[] backgroundData = new float[] { // # ,Scale, Speed, 300 , 1.05f, .001f, 150 , 1.07f, .002f, 075 , 1.10f, .003f, 040 , 1.12f, .006f, 20 , 1.15f, .012f, 10 , 1.25f, .025f, 05 , 1.50f, .050f, 3 , 2.00f, .100f, 2 , 3.00f, .200f, }; private float[] triangleCoords = new float[] { 0, -25, 0, -.75f, -1, 0, +.75f, -1, 0, 0, +2, 0, -.99f, -1, 0, .99f, -1, 0, }; private float[] triangleColors = new float[] { 1.0f, 1.0f, 1.0f, 0.05f, 1.0f, 1.0f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.5f, }; private float[] drawArray2; private FloatBuffer drawBuffer2; private float[] colorArray2; private static FloatBuffer colorBuffer; private static FloatBuffer triangleBuffer; private static FloatBuffer quadBuffer; private static FloatBuffer drawBuffer; private float[] backgroundVerts; private FloatBuffer backgroundVertsWrapped; private float[] backgroundColors; private Buffer backgroundColorsWraped; private FloatBuffer backgroundColorsWrapped; private FloatBuffer arenaWallsWrapped; private FloatBuffer arenaColorsWrapped; private FloatBuffer arena2VertsWrapped; private FloatBuffer arena2ColorsWrapped; private long wallHitStartTime; private int wallHitDrawTime; private FloatBuffer pixelVertsWrapped; private float[] wallHit; private FloatBuffer pixelColorsWrapped; //private float[] pitVerts; private Resources lResources; private FloatBuffer pitVertsWrapped; private FloatBuffer pitColorsWrapped; private boolean arena2; private long lastStartTime; private long startTime; private int state=1; private long introEndTime; protected long introTotalTime =8000; protected long introStartTime; private boolean initDone= false; private static int stateIntro = 0; private static int stateGame = 1; public GlRenderer(spacehockey nspacehockey) { lResources = nspacehockey.getResources(); nspacehockey.SetHandlerToGLRenderer(new Handler() { @Override public void handleMessage(Message m) { if (m.what ==0){ wallHit = m.getData().getFloatArray("wall hit"); wallHitStartTime =System.currentTimeMillis(); wallHitDrawTime = 1000; }else if (m.what ==1){ //state = stateIntro; introEndTime= System.currentTimeMillis()+introTotalTime ; introStartTime = System.currentTimeMillis(); } }}); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glShadeModel(GL10.GL_SMOOTH); gl.glClearColor(.01f, .01f, .01f, .1f); gl.glClearDepthf(1.0f); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glDepthFunc(GL10.GL_LEQUAL); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); } private float SumOfStrideI(float[] data, int offset, int stride) { int sum= 0; for (int i=offset;i<data.length-1;i=i+stride){ sum = (int) (data[i]+sum); } return sum; } public void onDrawFrame(GL10 gl) { if (state== stateIntro){DrawIntro(gl);} if (state== stateGame){DrawGame(gl);} } private void DrawIntro(GL10 gl) { startTime = System.currentTimeMillis(); if (startTime< introEndTime){ float ptd = (float)(startTime- introStartTime)/(float)introTotalTime; float ptl = 1-ptd; gl.glClear(GL10.GL_COLOR_BUFFER_BIT);//dont move gl.glMatrixMode(GL10.GL_MODELVIEW); int setVertOff = 0; gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glColorPointer(4, GL10.GL_FLOAT, 0, backgroundColorsWrapped); for (int i = 0; i < backgroundData.length / 3; i = i + 1) { int setoff = i * 3; int setVertLen = (int) backgroundData[setoff]; yoffs[i] = (backgroundData[setoff + 2]*(90+(ptl*250))) + yoffs[i]; if (yoffs[i] > Height) {yoffs[i] = 0;} gl.glPushMatrix(); //gl.glTranslatef(0, -(Height/2), 0); //gl.glScalef(1f, 1f+(ptl*2), 1f); //gl.glTranslatef(0, +(Height/2), 0); gl.glTranslatef(0, yoffs[i], i+60); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, backgroundVertsWrapped); gl.glDrawArrays(GL10.GL_TRIANGLES, (setVertOff * 2 * 3) - 0, (setVertLen * 2 * 3) - 1); gl.glTranslatef(0, -Height, 0); gl.glDrawArrays(GL10.GL_TRIANGLES, (setVertOff * 2 * 3) - 0, (setVertLen * 2 * 3) - 1); setVertOff = (int) (setVertOff + setVertLen); gl.glPopMatrix(); } gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); }else{state = stateGame;} } private void DrawGame(GL10 gl) { lastStartTime = startTime; startTime = System.currentTimeMillis(); long moveTime = startTime-lastStartTime; gl.glClear(GL10.GL_COLOR_BUFFER_BIT);//dont move gl.glMatrixMode(GL10.GL_MODELVIEW); int setVertOff = 0; gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glColorPointer(4, GL10.GL_FLOAT, 0, backgroundColorsWrapped); for (int i = 0; i < backgroundData.length / 3; i = i + 1) { int setoff = i * 3; int setVertLen = (int) backgroundData[setoff]; yoffs[i] = (backgroundData[setoff + 2]*moveTime) + yoffs[i]; if (yoffs[i] > Height) {yoffs[i] = 0;} gl.glPushMatrix(); gl.glTranslatef(0, yoffs[i], i+60); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, backgroundVertsWrapped); gl.glDrawArrays(GL10.GL_TRIANGLES, (setVertOff * 6) - 0, (setVertLen *6) - 1); gl.glTranslatef(0, -Height, 0); gl.glDrawArrays(GL10.GL_TRIANGLES, (setVertOff * 6) - 0, (setVertLen *6) - 1); setVertOff = (int) (setVertOff + setVertLen); gl.glPopMatrix(); } //arena frame gl.glPushMatrix(); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, arenaWallsWrapped); gl.glColorPointer(4, GL10.GL_FLOAT, 0, arenaColorsWrapped); gl.glColor4f(.1f, .5f, 1f, 1f); gl.glTranslatef(0, 0, 50); gl.glDrawArrays(GL10.GL_TRIANGLES, 0, (int)(arenaWalls.length / 3)); gl.glPopMatrix(); //arena2 frame if (arena2 == true){ gl.glLoadIdentity(); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, pitVertsWrapped); gl.glColorPointer(4, GL10.GL_FLOAT, 0, pitColorsWrapped); gl.glTranslatef(0, -Height, 40); gl.glDrawArrays(GL10.GL_TRIANGLES, 0, (int)(pitVertsWrapped.capacity() / 3)); } if (wallHitStartTime != 0) { float timeRemaining = (wallHitStartTime + wallHitDrawTime)-System.currentTimeMillis(); if (timeRemaining>0) { gl.glPushMatrix(); float percentDone = 1-(timeRemaining/wallHitDrawTime); gl.glLoadIdentity(); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, pixelVertsWrapped); gl.glColorPointer(4, GL10.GL_FLOAT, 0, pixelColorsWrapped); gl.glTranslatef(wallHit[0], wallHit[1], 0); gl.glScalef(8, Height*percentDone, 0); gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 12); gl.glPopMatrix(); } else { wallHitStartTime = 0; } } gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); } public void init(GL10 gl) { if (arena2 == true) { AssetManager assetManager = lResources.getAssets(); try { // byte[] ba = {111,111}; DataInputStream Dis = new DataInputStream(assetManager .open("arena2.ogl")); pitVertsWrapped = LoadFloatArray.FromDataInputStream(Dis); pitColorsWrapped = MakeFakeLighting(pitVertsWrapped.array(), .25f, .50f, 1f, 200, .5f); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if ((Height != 854) || (Width != 480)) { arenaWalls = ScaleFloats(arenaWalls, Width / 480f, Height / 854f); } arenaWallsWrapped = FloatBuffer.wrap(arenaWalls); arenaColorsWrapped = MakeFakeLighting(arenaWalls, .03f, .16f, .33f, .33f, 3); pixelVertsWrapped = FloatBuffer.wrap(pixelVerts); pixelColorsWrapped = MakeFakeLighting(pixelVerts, .03f, .16f, .33f, .10f, 20); initDone=true; } public void onSurfaceChanged(GL10 gl, int nwidth, int nheight) { Width= nwidth; Height = nheight; // avoid division by zero if (Height == 0) Height = 1; // draw on the entire screen gl.glViewport(0, 0, Width, Height); // setup projection matrix gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrthof(0, Width, Height, 0, 100, -100); // gl.glOrthof(-nwidth*2, nwidth*2, nheight*2,-nheight*2, 100, -100); // GLU.gluPerspective(gl, 180.0f, (float)nwidth / (float)nheight, // 1000.0f, -1000.0f); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); System.gc(); if (initDone == false){ SetupStars(); init(gl); } } public void SetupStars(){ backgroundVerts = new float[(int) SumOfStrideI(backgroundData,0,3)*triangleCoords.length]; backgroundColors = new float[(int) SumOfStrideI(backgroundData,0,3)*triangleColors.length]; int iii=0; int vc=0; float ascale=1; for (int i=0;i<backgroundColors.length-1;i=i+1){ if (iii==0){ascale = (float) Math.random();} if (vc==3){ backgroundColors[i]= (float) (triangleColors[iii]*(ascale)); }else if(vc==2){ backgroundColors[i]= (float) (triangleColors[iii]-(Math.random()*.2)); }else{ backgroundColors[i]= (float) (triangleColors[iii]-(Math.random()*.3)); } iii=iii+1;if (iii> triangleColors.length-1){iii=0;} vc=vc+1; if (vc>3){vc=0;} } int ii=0; int i =0; int set =0; while(ii<backgroundVerts.length-1){ float scale = (float) backgroundData[(set*3)+1]; int length= (int) backgroundData[(set*3)]; for (i=0;i<length;i=i+1){ if (set ==0){ AddVertsToArray(ScaleFloats(triangleCoords, scale,scale*.25f), backgroundVerts, (float)(Math.random()*Width),(float) (Math.random()*Height), ii); }else{ AddVertsToArray(ScaleFloats(triangleCoords, scale), backgroundVerts, (float)(Math.random()*Width),(float) (Math.random()*Height), ii);} ii=ii+triangleCoords.length; } set=set+1; } backgroundVertsWrapped = FloatBuffer.wrap(backgroundVerts); backgroundColorsWrapped = FloatBuffer.wrap(backgroundColors); } public void AddVertsToArray(float[] sva,float[]dva,float ox,float oy,int start){ //x for (int i=0;i<sva.length;i=i+3){ if((start+i)<dva.length){dva[start+i]= sva[i]+ox;} } //y for (int i=1;i<sva.length;i=i+3){ if((start+i)<dva.length){dva[start+i]= sva[i]+oy;} } //z for (int i=2;i<sva.length;i=i+3){ if((start+i)<dva.length){dva[start+i]= sva[i];} } } public FloatBuffer MakeFakeLighting(float[] sa,float r, float g,float b,float a,float multby){ float[] da = new float[((sa.length/3)*4)]; int vertex=0; for (int i=0;i<sa.length;i=i+3){ if (sa[i+2]>=1){ da[(vertex*4)+0]= r*multby*sa[i+2]; da[(vertex*4)+1]= g*multby*sa[i+2]; da[(vertex*4)+2]= b*multby*sa[i+2]; da[(vertex*4)+3]= a*multby*sa[i+2]; }else if (sa[i+2]<=-1){ float divisor = (multby*(-sa[i+2])); da[(vertex*4)+0]= r / divisor; da[(vertex*4)+1]= g / divisor; da[(vertex*4)+2]= b / divisor; da[(vertex*4)+3]= a / divisor; }else{ da[(vertex*4)+0]= r; da[(vertex*4)+1]= g; da[(vertex*4)+2]= b; da[(vertex*4)+3]= a; } vertex = vertex+1; } return FloatBuffer.wrap(da); } public float[] ScaleFloats(float[] va,float s){ float[] reta= new float[va.length]; for (int i=0;i<va.length;i=i+1){ reta[i]=va[i]*s; } return reta; } public float[] ScaleFloats(float[] va,float sx,float sy){ float[] reta= new float[va.length]; int cnt = 0; for (int i=0;i<va.length;i=i+1){ if (cnt==0){reta[i]=va[i]*sx;} else if (cnt==1){reta[i]=va[i]*sy;} else if (cnt==2){reta[i]=va[i];} cnt = cnt +1;if (cnt>2){cnt=0;} } return reta; } }

    Read the article

  • Can't save screen resolution setting.

    - by Searock
    Hi, My screen resolution in windows and previous version of Ubuntu (9.04) was 1152 x 864. But in Ubuntu 10.04 it gives me an option of 1024 x 786 and 1360 x 786. I have some how managed to add 1152x684 resolution by using xrandr command. searock@searock-desktop:~$ cvt 1152 864 1152x864 59.96 Hz (CVT 1.00M3) hsync: 53.78 kHz; pclk: 81.75 MHz Modeline "1152x864_60.00" 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync searock@searock-desktop:~$ xrandr --newmode "1152x864_60.00" 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync searock@searock-desktop:~$ xrandr --addmode S-video 1152x864 xrandr: cannot find output "S-video" searock@searock-desktop:~$ xrandr Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096 VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 1360x768 59.8 1024x768 60.0* 800x600 60.3 56.2 848x480 60.0 640x480 59.9 59.9 1152x864_60.00 (0x124) 81.0MHz h: width 1152 start 1216 end 1336 total 1520 skew 0 clock 53.3KHz v: height 864 start 867 end 871 total 897 clock 59.4Hz searock@searock-desktop:~$ xrandr --addmode VGA1 1152x864_60.00 But the problem is when ever I restart my computer I get this message. Could not apply the stored configuration for the monitors. Could not find a suitable configuration of screens. And then it comes back to 1024 x 786 My graphic card details : Intel(R) 82945G Express Chipset Family. Is there any way I can fix this once for all ? Thanks. Edit 1 : rumtscho has suggested me to modify xorg.conf file. But I am not sure what HorizSync means? is it Horizontal frequency ? My monitor model is Acer v173. Here's my specification. So what should be HorizSync and VertRefresh ? Edit 2 : I have edited my Xorg.conf file as follows : Section "Monitor" Identifier "Configured Monitor" HorizSync 30-80 VertRefresh 55-75 EndSection then I added the resolution and restarted my computer and still I am facing the same problem. Is there something that I am missing? Edit 3 : For now I have edited /etc/gdm/Init/Default(gdm startup scripts) to include following xrandr commands, just below line initctl -q emit login-session-start DISPLAY_MANAGER=gdm xrandr --newmode "1152x864_60.00" 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync xrandr --addmode VGA1 1152x864_60.00<br/> xrandr -s 1152x864_60.00 This has solved my problem, but this commands have increased my computer's boot time. I think I will have to edit xorg file properly. Edit 4 : Instead of adding this files to gdm startup scripts I have created a shell script and added it to startup (System - Preference - Startup Applications) #!/bin/bash xrandr --newmode "1152x864_60.00" 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync xrandr --addmode VGA1 1152x864_60.00 xrandr -s 1152x864_60.00 And don't forget to add execution rights. (Right Click - Properties - Permission - Allow executing file as program)

    Read the article

  • php array count

    - by user295189
    I have a var dump of my sql query which return the following I wanna to count in the array below that how many rows of myID = 5 are there. How would I do that. I am using php. Thanks in advance array 0 = object(stdClass)[17] public 'myID' => string '5' (length=1) public 'data' => string '123' (length=3) 1 = object(stdClass)[18] public 'myID' => string '5' (length=1) public 'data' => string '123' (length=3) 2 = object(stdClass)[19] public 'relativeTypeID' => string '2' (length=1) public 'data' => string '256' (length=3) 3 = object(stdClass)[20] public 'myID' => string '4' (length=1) public 'data' => string '786' (length=3) object(stdClass)[21] public 'myID' => string '4' (length=1) public 'data' => string '786' (length=3)

    Read the article

  • Micorsoft office excel in ubuntu [duplicate]

    - by user204653
    This question already has an answer here: Is it possible to run Microsoft Office 2010? 9 answers some of my files are not working in libre office and require Microsoft office please help me in installing that, i have Ubuntu 12.04, 786 MB RAM, 3.0 GHZ pentium dual processor

    Read the article

  • how to get result from this data.

    - by Shantanu Gupta
    I want to compute result from this table. I want quantity 1 - quantity2 as another column in the table shown below. this table has more such records I am trying to query but not been able to get result. select * from v order by is_active desc, transaction_id desc PK_GUEST_ITEM_ID FK_GUEST_ID QUANTITY TRANSACTION_ID IS_ACTIVE ---------------- -------------------- ---------------------- -------------------- ----------- 12963 559 82000 795 1 12988 559 79000 794 0 12987 559 76000 793 0 12986 559 73000 792 0 12985 559 70000 791 0 12984 559 67000 790 0 12983 559 64000 789 0 12982 559 61000 788 0 12981 559 58000 787 0 12980 559 55000 786 0 12979 559 52000 785 0 12978 559 49000 784 0 12977 559 46000 783 0 12976 559 43000 782 0 I want another column that will contain the subtraction of two quantities . DESIRED RESULT SHOULD BE SOMETHING LIKE THIS PK_GUEST_ITEM_ID FK_GUEST_ID QUANTITY Result TRANSACTION_ID IS_ACTIVE ---------------- -------------------- ---------------------- -------------------- ----------- 12963 559 82000 3000 795 1 12988 559 79000 3000 794 0 12987 559 76000 3000 793 0 12986 559 73000 3000 792 0 12985 559 70000 3000 791 0 12984 559 67000 3000 790 0 12983 559 64000 3000 789 0 12982 559 61000 3000 788 0 12981 559 58000 3000 787 0 12980 559 55000 3000 786 0 12979 559 52000 3000 785 0 12978 559 49000 3000 784 0 12977 559 46000 3000 783 0 12976 559 43000 NULL 782 0

    Read the article

  • BIND9 / DNS Zone / Dedicated Server / Unique Reverse DNS

    - by user2832131
    I locate a dedicated server in a datacenter with no DNS Zone setup. Datacenter panel have 1 textfield only you can fill one Reverse DNS only. According with datacenter instructions here... [instructions]: http://www.wiki.hetzner.de/index.php/DNS-Reverse-DNS/en#How_can_I_assign_several_names_to_my_IP_address.2C_if_different_domains_are_hosted_on_my_server.3F How_can_I_assign_several_names_to_my_IP_address ...I need to install BIND9 in order to configure other records like CNAME and MX. Ok, I've installed BIND9, created a Master Zone. And following this example, I put it in the Zone File: [example]: http://wiki.hetzner.de/index.php/DNS_Zonendatei/en example $ttl 86400 @ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. ( 1383411730 14400 1800 604800 86400 ) @ IN NS ns1.first-ns.de. @ IN NS robotns2.second-ns.de. @ IN NS robotns3.second-ns.com. localhost IN A 127.0.0.1 @ IN A 144.86.786.651 www IN A 144.86.786.651 loopback IN CNAME localhost But when I point my domain to ns1.first-ns.de, DNS Register says "time out". Am I missing something? I created a Master zone. Should it be a Slave zone? named.conf: include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; include "/etc/bind/named.conf.default-zones"; named.conf.options: options { directory "/var/cache/bind"; dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; }; named.conf.local: zone "mydomain.com" { type master; file "/var/lib/bind/mydomain.com.hosts"; allow-update {any;}; allow-transfer {any;}; allow-query {any;}; }; named.conf.default-zones: zone "." { type hint; file "/etc/bind/db.root"; }; zone "localhost" { type master; file "/etc/bind/db.local"; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; }; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; }; Problem is that I'm moving my site, and can't update the new NS server due to a 'timeout' message when filling new datacenter NS. I'm filling: MASTER: ns1.first-ns.de SLAVE1: robotns2.second-ns.de SLAVE2: robotns3.second-ns.com

    Read the article

  • CentOS only detecting 50% of ram

    - by Devator
    I have 16GB ram in my machine. Before, free -m outputted the normal 16 GB ram, however now (after a reboot) it only detects 8 GB ram. Is one ram module damaged? grep -i memory /var/log/dmesg outputs Memory: 15621184k/16017200k available (2535k kernel code, 387120k reserved, 1748k data, 196k init). (Which looks like 16 GB to me). Free -m outputs: total used free shared buffers cached Mem: 7484 7415 68 0 6104 524 -/+ buffers/cache: 786 6697 Swap: 2055 0 2054 Anything I might be missing? Thanks in advance.

    Read the article

  • 4096 and 8192 block size read slower than write? by using lsi 9361-8i RAID10

    - by Min Hong Tan
    is it possible that 1024 and 2048 block size read speed is faster than 4096 and 8192 block? I'm using lsi 9361-8i with RAID 10 , with 8 x Kingston E50 250G. result: 1024 = Write: 2,251 MB/s Read: 2,625 MB/s 2048 = Write: 2,141 MB/s Read: 3,672 MB/s 4096 = Write: 2,147 MB/s Read: 231 MB/s 8192 = Write: 2,147 MB/s Read: 442 MB/s is there any possible? and below is the reading when i simply want to test out the RAID 10 function and disaster test by taking out one of the 250G harddisk. the result is different like below: Result: 1024 = Write: 825 MB/s Read: 1,139 MB/s 2048 = Write: 797 MB/s Read: 1,312 MB/s 4096 = Write: 911 MB/s Read: 1,342 MB/s 8192 = Write: 786 MB/s Read: 1,204 MB/s and the result for 4096 and 8192block are different? can any one explain to me is it normal? or I need to do some tuning/configuration? will it affect my host linux performance?

    Read the article

  • 500 Metro Style WP7 Icons

    - by Bil Simser
    I was inspired by The Noun Project, a project that offers up “Metro-style” icons in SVG format. The project is licensed under a public domain license and while it’s a great project, all of the content is in SVG format. Jon Galloway has a great post (from 2007) talking about the differences between SVG and XAML so I highly recommend that for some background. I thought it would be helpful to the WPF/Windows Phone 7/Silverlight community to provide the content in alternative formats for use in your applications. The Goods I’ve put together a package of the 500 icons (502 actually) in PNG, XAML and the original SVG format along with a couple of sample projects so you can see them in action. There’s a WPF desktop app: And a Windows Phone 7 app: Building It To get all the content first I wrote up a quick program to suck the original SVG files. Luckily they’re all in a common path just named 1.SVG, 2.SVG, and so on. Easy sleazy to grab the contents. Once I had 500 SVG files I used the latest copy of XamlTune, an open source CodePlex project that has a command line conversion tool to convert the directory of SVG files into XAML (the tool also created a PNG file of each SVG so that’s just icing on the cake). Conversions The conversion from SVG to XAML isn’t 100%. While you can just drop the content into a WPF app, it doesn’t work that way for WP7. There are just some small adjustments I made to each format so you’ll have to do the same. Follow the information below or refer to the sample applications. As a sample, here’s an icon we want to use: Here’s the original SVG file: <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="94.616px" viewBox="0 0 100 94.616" enable-background="new 0 0 100 94.616" xml:space="preserve"> <path d="M25.076,15.639c4.324,0.009,7.824-3.488,7.82-7.82C32.9,3.512,29.4,0.012,25.076,0c-4.313,0.012-7.814,3.512-7.821,7.819 C17.262,12.15,20.763,15.648,25.076,15.639L25.076,15.639z"/> <path d="M4.593,43.388h6.861l4.137-15.135h1.716L13.22,43.388h24.318l-4.389-15.135h1.817l2.32,7.415 c1.08,3.131,3.852,3.851,6.003,1.162l8.375-10.142c2.651-3.42-2.104-7.021-4.844-4.035l-4.993,5.952 c0.007,0.095-0.96-3.278-0.96-3.278c-1.135-3.978-4.918-7.903-10.595-7.922H19.576c-5.071,0.019-9.043,4.434-9.888,7.214 L4.593,43.388L4.593,43.388z"/> <polygon points="56.206,22.753 56.206,7.163 49.192,7.163 49.192,22.753 56.206,22.753 "/> <path d="M79.87,15.738c4.332-0.014,7.831-3.516,7.82-7.82c0.011-4.332-3.488-7.833-7.82-7.82c-4.306-0.013-7.806,3.488-7.821,7.82 C72.064,12.222,75.564,15.725,79.87,15.738L79.87,15.738z"/> <path d="M89.759,89.556v-43.19h5.751V22.804c0.007-3.079-2.757-5.448-6.71-5.449H70.436c-3.65,0.001-4.539,1.186-5.551,2.168 L49.597,37.889c-3.098,3.848,2.428,8.333,5.55,4.743L69.88,25.226v64.43c-0.019,6.475,9.06,6.686,9.081,0.201v-36.58h1.765v36.379 C80.748,96.109,89.772,96.13,89.759,89.556L89.759,89.556z"/> <polygon points="100,54.035 100,45.155 0,45.155 0,54.035 100,54.035 "/> </svg> Here’s the XAML that XamlTune created. It can be used in any WPF app without any changes: <Canvas Name="Layer_1" Width="100" Height="94.616" ClipToBounds="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M25.076,15.639C29.4,15.648 32.9,12.151 32.896,7.819 32.9,3.512 29.4,0.012 25.076,0 20.763,0.012 17.262,3.512 17.255,7.819 17.262,12.15 20.763,15.648 25.076,15.639L25.076,15.639z" /> </Path.Data> </Path> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M4.593,43.388L11.454,43.388 15.591,28.253 17.307,28.253 13.22,43.388 37.538,43.388 33.149,28.253 34.966,28.253 37.286,35.668C38.366,38.799,41.138,39.519,43.289,36.83L51.664,26.688C54.315,23.268,49.56,19.667,46.82,22.653L41.827,28.605C41.834,28.7 40.867,25.327 40.867,25.327 39.732,21.349 35.949,17.424 30.272,17.405L19.576,17.405C14.505,17.424,10.533,21.839,9.688,24.619L4.593,43.388 4.593,43.388z" /> </Path.Data> </Path> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M56.206,22.753L56.206,7.163 49.192,7.163 49.192,22.753 56.206,22.753z" /> </Path.Data> </Path> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M79.87,15.738C84.202,15.724 87.701,12.222 87.69,7.918 87.701,3.586 84.202,0.0849999999999991 79.87,0.097999999999999 75.564,0.084999999999999 72.064,3.586 72.049,7.918 72.064,12.222 75.564,15.725 79.87,15.738L79.87,15.738z" /> </Path.Data> </Path> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M89.759,89.556L89.759,46.366 95.51,46.366 95.51,22.804C95.517,19.725,92.753,17.356,88.8,17.355L70.436,17.355C66.786,17.356,65.897,18.541,64.885,19.523L49.597,37.889C46.499,41.737,52.025,46.222,55.147,42.632L69.88,25.226 69.88,89.656C69.861,96.131,78.94,96.342,78.961,89.857L78.961,53.277 80.726,53.277 80.726,89.656C80.748,96.109,89.772,96.13,89.759,89.556L89.759,89.556z" /> </Path.Data> </Path> <Path Fill="#FF000000"> <Path.Data> <PathGeometry FillRule="Nonzero" Figures="M100,54.035L100,45.155 0,45.155 0,54.035 100,54.035z" /> </Path.Data> </Path> </Canvas> The XAML works AS-IS in a WPF application but there are some changes I did to get it to work in a WP7 app. Here’s the modified XAML in a WP7 application: <Canvas Grid.Row="0" Grid.Column="0" Name="Icon_1" Width="100" Height="94.616"> <Path Fill="#FF000000" Data="M25.076,15.639C29.4,15.648 32.9,12.151 32.896,7.819 32.9,3.512 29.4,0.012 25.076,0 20.763,0.012 17.262,3.512 17.255,7.819 17.262,12.15 20.763,15.648 25.076,15.639L25.076,15.639z"> </Path> <Path Fill="#FF000000" Data="M4.593,43.388L11.454,43.388 15.591,28.253 17.307,28.253 13.22,43.388 37.538,43.388 33.149,28.253 34.966,28.253 37.286,35.668C38.366,38.799,41.138,39.519,43.289,36.83L51.664,26.688C54.315,23.268,49.56,19.667,46.82,22.653L41.827,28.605C41.834,28.7 40.867,25.327 40.867,25.327 39.732,21.349 35.949,17.424 30.272,17.405L19.576,17.405C14.505,17.424,10.533,21.839,9.688,24.619L4.593,43.388 4.593,43.388z"> </Path> <Path Fill="#FF000000" Data="M56.206,22.753L56.206,7.163 49.192,7.163 49.192,22.753 56.206,22.753z"> </Path> <Path Fill="#FF000000" Data="M79.87,15.738C84.202,15.724 87.701,12.222 87.69,7.918 87.701,3.586 84.202,0.0849999999999991 79.87,0.097999999999999 75.564,0.084999999999999 72.064,3.586 72.049,7.918 72.064,12.222 75.564,15.725 79.87,15.738L79.87,15.738z"> </Path> <Path Fill="#FF000000" Data="M89.759,89.556L89.759,46.366 95.51,46.366 95.51,22.804C95.517,19.725,92.753,17.356,88.8,17.355L70.436,17.355C66.786,17.356,65.897,18.541,64.885,19.523L49.597,37.889C46.499,41.737,52.025,46.222,55.147,42.632L69.88,25.226 69.88,89.656C69.861,96.131,78.94,96.342,78.961,89.857L78.961,53.277 80.726,53.277 80.726,89.656C80.748,96.109,89.772,96.13,89.759,89.556L89.759,89.556z"> </Path> <Path Fill="#FF000000" Data="M100,54.035L100,45.155 0,45.155 0,54.035 100,54.035z"> </Path> </Canvas> All I did was take the data portion and put it directly into a Data attribute on the Path. Note that while it does show up in the app (on the emulator or device) it wouldn’t show up in Visual Studio for me. Maybe some XAML guru out there can tell me why. You can just as easily use the PNG files in WP7 but if you want the crispness of vector graphics, go for the XAML version. Of course with XamlTune being open source you could always modify the output of that program to cater it to your app. If you do make a change that’s worthy please consider submitting a patch to the project so everyone can benefit. Hope this helps and happy programming! Resources and Links Sample Project and Icons XamlTune an open source project to convert SVG to XAML The Noun Project source of the original files Jon Galloways post on SVG and XAML StackOverflow question on converting SVG to XAML

    Read the article

  • Problems with Intel Video Resolution on Acer Laptop Wide Display

    - by ricstr
    I have an ACER Aspire 5332 laptop which I have just installed Ubuntu 12.04 x64, which is causing some issues with the video display on boot and video resolution. First and foremost, it will only boot past the purple screen if GRUB has been edited to replace 'quick splash' with 'nomodeset'. Secondly, once it has booted with the the 'nomodeset' option, it does not allow me to change the resolution higher or lower from 1024 x 786. Is it OK to use the 'nomodeset' for normal use? Will this compromise performance of other devices? The video card is an on-board one, integrated within the Intel GL40 chip-set. The display is a wide-screen LCD, and under Windows could operate under various resolutions. Ideally I would like it to operate on a resolution to fit the wide-screen display as it a bit stretched out at the moment, and less desktop space as I am used to. I believe the optimal resolution is 1366 x 768. Below is some information from the terminal which may be useful. ricstr@Aspire-5332:~$ lspci | grep -i VGA 00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 09) ricstr@Aspire-5332:~$ xrandr xrandr: Failed to get size of gamma for output default Screen 0: minimum 1024 x 768, current 1024 x 768, maximum 1024 x 768 default connected 1024x768+0+0 0mm x 0mm 1024x768 0.0*

    Read the article

  • preseeded installation keeps asking for confirmation while creating RAID-Partitions on certain hardware-platform

    - by Marc Shennon
    I am aware of the partman-md/confirm_nooverwrite thing, that was the solution to most of this problems in the past. The thing is, that the preseed-file works for almost all hardware-platforms I tested, but only for one (Primergy MX130) it keeps asking for confirmation, before writing the partition-layout to the disks. All machines I tested are running with two SATA Disks, nothing special. I'm not really sure, what information could be needed in order to investigate the cause of this behaviour, but I would of course be willing to provide more information, if someone has an idea. Relevant part of the preseed file is the following: d-i partman-auto/disk string /dev/sda /dev/sdb d-i partman-auto/method string raid d-i partman-md/confirm boolean true d-i partman-partitioning/confirm_write_new_label boolean true d-i partman-md/device_remove_md boolean true d-i partman/choose_partition select finish d-i partman-md/confirm_nooverwrite boolean true # Write the changes to disks? d-i partman/confirm boolean true d-i mdadm/boot_degraded boolean true # RECIPE # Next you need to specify the physical partitions that will be used. d-i partman-auto/expert_recipe string \ multiraid :: \ 500 10000 1000000000 raid $lvmignore{ }\ $primary{ } \ method{ raid } \ . \ 512 1000 786 raid $lvmignore{ }\ $primary{ } \ method{ raid } \ . \ 8192 10240 10240 raid $lvmignore{ }\ method{ raid } \ . # Parameters are: # <raidtype> <devcount> <sparecount> <fstype> <mountpoint> <devices> <sparedevices> d-i partman-auto-raid/recipe string \ 1 2 0 ext4 / /dev/sda1#/dev/sdb1 . \ 1 2 0 ext2 /boot /dev/sda2#/dev/sdb2 . \ 1 2 0 swap - /dev/sda5#/dev/sdb5 .

    Read the article

  • How to count each digit in a range of integers?

    - by Carlos Gutiérrez
    Imagine you sell those metallic digits used to number houses, locker doors, hotel rooms, etc. You need to find how many of each digit to ship when your customer needs to number doors/houses: 1 to 100 51 to 300 1 to 2,000 with zeros to the left The obvious solution is to do a loop from the first to the last number, convert the counter to a string with or without zeros to the left, extract each digit and use it as an index to increment an array of 10 integers. I wonder if there is a better way to solve this, without having to loop through the entire integers range. Solutions in any language or pseudocode are welcome. Edit: Answers review John at CashCommons and Wayne Conrad comment that my current approach is good and fast enough. Let me use a silly analogy: If you were given the task of counting the squares in a chess board in less than 1 minute, you could finish the task by counting the squares one by one, but a better solution is to count the sides and do a multiplication, because you later may be asked to count the tiles in a building. Alex Reisner points to a very interesting mathematical law that, unfortunately, doesn’t seem to be relevant to this problem. Andres suggests the same algorithm I’m using, but extracting digits with %10 operations instead of substrings. John at CashCommons and phord propose pre-calculating the digits required and storing them in a lookup table or, for raw speed, an array. This could be a good solution if we had an absolute, unmovable, set in stone, maximum integer value. I’ve never seen one of those. High-Performance Mark and strainer computed the needed digits for various ranges. The result for one millon seems to indicate there is a proportion, but the results for other number show different proportions. strainer found some formulas that may be used to count digit for number which are a power of ten. Robert Harvey had a very interesting experience posting the question at MathOverflow. One of the math guys wrote a solution using mathematical notation. Aaronaught developed and tested a solution using mathematics. After posting it he reviewed the formulas originated from Math Overflow and found a flaw in it (point to Stackoverflow :). noahlavine developed an algorithm and presented it in pseudocode. A new solution After reading all the answers, and doing some experiments, I found that for a range of integer from 1 to 10n-1: For digits 1 to 9, n*10(n-1) pieces are needed For digit 0, if not using leading zeros, n*10n-1 - ((10n-1) / 9) are needed For digit 0, if using leading zeros, n*10n-1 - n are needed The first formula was found by strainer (and probably by others), and I found the other two by trial and error (but they may be included in other answers). For example, if n = 6, range is 1 to 999,999: For digits 1 to 9 we need 6*105 = 600,000 of each one For digit 0, without leading zeros, we need 6*105 – (106-1)/9 = 600,000 - 111,111 = 488,889 For digit 0, with leading zeros, we need 6*105 – 6 = 599,994 These numbers can be checked using High-Performance Mark results. Using these formulas, I improved the original algorithm. It still loops from the first to the last number in the range of integers, but, if it finds a number which is a power of ten, it uses the formulas to add to the digits count the quantity for a full range of 1 to 9 or 1 to 99 or 1 to 999 etc. Here's the algorithm in pseudocode: integer First,Last //First and last number in the range integer Number //Current number in the loop integer Power //Power is the n in 10^n in the formulas integer Nines //Nines is the resut of 10^n - 1, 10^5 - 1 = 99999 integer Prefix //First digits in a number. For 14,200, prefix is 142 array 0..9 Digits //Will hold the count for all the digits FOR Number = First TO Last CALL TallyDigitsForOneNumber WITH Number,1 //Tally the count of each digit //in the number, increment by 1 //Start of optimization. Comments are for Number = 1,000 and Last = 8,000. Power = Zeros at the end of number //For 1,000, Power = 3 IF Power 0 //The number ends in 0 00 000 etc Nines = 10^Power-1 //Nines = 10^3 - 1 = 1000 - 1 = 999 IF Number+Nines <= Last //If 1,000+999 < 8,000, add a full set Digits[0-9] += Power*10^(Power-1) //Add 3*10^(3-1) = 300 to digits 0 to 9 Digits[0] -= -Power //Adjust digit 0 (leading zeros formula) Prefix = First digits of Number //For 1000, prefix is 1 CALL TallyDigitsForOneNumber WITH Prefix,Nines //Tally the count of each //digit in prefix, //increment by 999 Number += Nines //Increment the loop counter 999 cycles ENDIF ENDIF //End of optimization ENDFOR SUBROUTINE TallyDigitsForOneNumber PARAMS Number,Count REPEAT Digits [ Number % 10 ] += Count Number = Number / 10 UNTIL Number = 0 For example, for range 786 to 3,021, the counter will be incremented: By 1 from 786 to 790 (5 cycles) By 9 from 790 to 799 (1 cycle) By 1 from 799 to 800 By 99 from 800 to 899 By 1 from 899 to 900 By 99 from 900 to 999 By 1 from 999 to 1000 By 999 from 1000 to 1999 By 1 from 1999 to 2000 By 999 from 2000 to 2999 By 1 from 2999 to 3000 By 1 from 3000 to 3010 (10 cycles) By 9 from 3010 to 3019 (1 cycle) By 1 from 3019 to 3021 (2 cycles) Total: 28 cycles Without optimization: 2,235 cycles Note that this algorithm solves the problem without leading zeros. To use it with leading zeros, I used a hack: If range 700 to 1,000 with leading zeros is needed, use the algorithm for 10,700 to 11,000 and then substract 1,000 - 700 = 300 from the count of digit 1. Benchmark and Source code I tested the original approach, the same approach using %10 and the new solution for some large ranges, with these results: Original 104.78 seconds With %10 83.66 With Powers of Ten 0.07 A screenshot of the benchmark application: If you would like to see the full source code or run the benchmark, use these links: Complete Source code (in Clarion): http://sca.mx/ftp/countdigits.txt Compilable project and win32 exe: http://sca.mx/ftp/countdigits.zip Accepted answer noahlavine solution may be correct, but l just couldn’t follow the pseudo code, I think there are some details missing or not completely explained. Aaronaught solution seems to be correct, but the code is just too complex for my taste. I accepted strainer’s answer, because his line of thought guided me to develop this new solution.

    Read the article

  • How to get only one row for each distinct value in the column ?

    - by Chavdar
    Hi Everybody, I have a question about Access.If for example I have a table with the following data : NAME | ADDRESS John Taylor | 33 Dundas Ave. John Taylor | 55 Shane Ave. John Taylor | 786 Edward St. Ted Charles | 785 Bloor St. Ted Charles | 90 New York Ave. I want to get one record for each person no matter of the address.For example : NAME | ADDRESS John Taylor | 33 Dundas Ave. Ted Charles | 90 New York Ave. Can this be done with queries only ? I tried using DISTINCT, but when I am selecting both columns, the combination is allways unique so I get all the rows. Thank you !

    Read the article

  • What is the best way for converting phone numbers into international format (E.164) using Java?

    - by Vihung
    What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work correctly in all situations. Which Java framework/library/utility would you recommend to accomplish this? P.S. The 'phone number' could be anything identifiable by the general public - such as * (510) 786-0404 * 1-800-GOT-MILK * +44-(0)800-7310658 that last one is my favourite - it is how some people write their number in the UK and means that you should either use the +44 or you should use the 0. The E.164 format number should be all numeric, and use the full international country code (e.g.+44)

    Read the article

  • CentOS OpenVZ fail to boot after kernel update

    - by SkechBoy
    After upgrading to latest OpenVZ kernel CentOS server won't boot. When i try go boot the latest kernel server is stuck at this point: (note that images are taken from virtual kvm) http://i.stack.imgur.com/4lusz.jpg Then i try to start the server on some old kernels and than i get this error message: kernel panic - not syncing - attempted to kill init better shown on this image: http://i.stack.imgur.com/2SReF.jpg Here is some useful information fdisk -l WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sda: 2995.7 GB, 2995739688960 bytes 255 heads, 63 sectors/track, 364211 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0004c4e4 Device Boot Start End Blocks Id System /dev/sda1 1 523 4199044+ 82 Linux swap / Solaris /dev/sda2 524 785 2104515 83 Linux /dev/sda3 786 261869 2097157230 83 Linux /dev/sda4 261870 364211 822062115 83 Linux /etc/fstab proc /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 /dev/sda1 none swap sw 0 0 /dev/sda2 /boot ext3 defaults 0 0 /dev/sda3 / ext3 defaults 0 0 /dev/sda4 /home ext3 defaults 0 0 and grub config file: title OpenVZ (2.6.18-274.18.1.el5.028stab098.1) root (hd0,1) kernel /vmlinuz-2.6.18-274.18.1.el5.028stab098.1 ro root=/dev/sda3 vga=0x317 selinux=0 initrd /initrd-2.6.18-274.18.1.el5.028stab098.1.img title OpenVZ (2.6.18-274.7.1.el5.028stab095.1) root (hd0,1) kernel /vmlinuz-2.6.18-274.7.1.el5.028stab095.1 ro root=/dev/sda3 vga=0x317 selinux=0 initrd /initrd-2.6.18-274.7.1.el5.028stab095.1.img title OpenVZ (2.6.18-194.8.1.el5.028stab070.4) root (hd0,1) kernel /vmlinuz-2.6.18-194.8.1.el5.028stab070.4 ro root=/dev/sda3 vga=0x317 initrd /initrd-2.6.18-194.8.1.el5.028stab070.4.img Any help is greatly appreciated Thanks.

    Read the article

  • VMWare player - compiling server modules - Ubuntu 13.10

    - by user211976
    While running Ubuntu 13.04 whenever the Linux kernel had been updated, this used to make vmware player happy: sudo apt-get install linux-headers-$(uname -r) sudo vmware-modconfig --console --install-all Yesterday I upgraded to Ubuntu 13.10 and lo and behold, the above workaround does not work anymore: Unable to install all modules. See log for details. I assume by "See log" it means the files in /tmp/vmware-root/*log root@hugin:/tmp/vmware-root# ls -ltr /tmp/vmware-root/ totalt 16 -rw-r--r-- 1 root root 3815 nov 6 13:54 vmware-apploader-17267.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-17693.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-17742.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-18701.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-18750.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-19100.log -rw-r--r-- 1 root root 0 nov 6 13:54 vmware-vmis-19149.log -rw-r--r-- 1 root root 9250 nov 6 13:54 vmware-modconfig-17267.log root@hugin:/tmp/vmware-root# tail /tmp/vmware-root/vmware-modconfig-17267.log 2013-11-06T13:54:28.950+01:00| modconfig| I120: Copied Module.symvers from "/tmp/modconfig-wpDrtf/vmci-only/Module.symvers" to "/tmp/modconfig-wpDrtf/vsock-only/Module.symvers". 2013-11-06T13:54:28.950+01:00| modconfig| I120: Building module with command "/usr/bin/make -j8 -C /tmp/modconfig-wpDrtf/vsock-only auto-build HEADER_DIR=/lib/modules/3.11.0-12-generic/build/include CC=/usr/bin/gcc IS_GCC_3=no" 2013-11-06T13:54:31.048+01:00| modconfig| I120: Successfully built vsock. Module is currently at "/tmp/modconfig-wpDrtf/vsock.o". 2013-11-06T13:54:31.048+01:00| modconfig| I120: Found the vsock symvers file at "/tmp/modconfig-wpDrtf/vsock-only/Module.symvers". 2013-11-06T13:54:31.048+01:00| modconfig| I120: Installing vsock from /tmp/modconfig-wpDrtf/vsock.o to /lib/modules/3.11.0-12-generic/misc/vsock.ko. 2013-11-06T13:54:31.048+01:00| modconfig| I120: Registering file "/lib/modules/3.11.0-12-generic/misc/vsock.ko". 2013-11-06T13:54:31.400+01:00| modconfig| I120: "/usr/lib/vmware-installer/2.1.0/vmware-installer" exited with status 0. 2013-11-06T13:54:31.400+01:00| modconfig| I120: Registering file "/usr/lib/vmware/symvers/vsock-3.11.0-12-generic". 2013-11-06T13:54:31.764+01:00| modconfig| I120: "/usr/lib/vmware-installer/2.1.0vmware-installer" exited with status 0. 2013-11-06T13:54:31.786+01:00| modconfig| I120: We are now shutdown. Ready to die! root@hugin:/tmp/vmware-root# tail /tmp/vmware-root/vmware-apploader-17267.log 2013-11-06T13:54:20.911+01:00| appLoader| I120: libglib-2.0.so.0 <SYSTEM> 2013-11-06T13:54:20.911+01:00| appLoader| I120: libz.so.1 <SYSTEM> 2013-11-06T13:54:20.911+01:00| appLoader| I120: libvmware-modconfig-console.so <SHIPPED> 2013-11-06T13:54:20.912+01:00| appLoader| I120: Shipped glib version is 2.24 2013-11-06T13:54:20.912+01:00| appLoader| I120: System glib version is 2.38 2013-11-06T13:54:20.912+01:00| appLoader| I120: Using system version of glib. 2013-11-06T13:54:20.912+01:00| appLoader| I120: Loading system version of libgcc_s.so.1. 2013-11-06T13:54:20.912+01:00| appLoader| I120: Loading system version of libglib-2.0.so.0. 2013-11-06T13:54:20.912+01:00| appLoader| I120: Loading system version of libz.so.1. 2013-11-06T13:54:20.912+01:00| appLoader| I120: Loading shipped version of libxml2.so.2.

    Read the article

  • I can't understand this issue java.lang.IndexOutOfBoundsException.

    - by praveenb
    I've strange issue, that My application is working fine on some devices, But its crashing one of the client device(on Galaxy Nexus 4.1.1 v) at app starting screen. I get this stack trace from ACRA report. java.lang.IndexOutOfBoundsException at android.graphics.Paint.getTextRunAdvances(Paint.java:1731) at android.graphics.Paint.getTextRunAdvances(Paint.java:1704) at android.text.MeasuredText.addStyleRun(MeasuredText.java:164) at android.text.MeasuredText.addStyleRun(MeasuredText.java:204) at android.text.StaticLayout.generate(StaticLayout.java:281) at android.text.DynamicLayout.reflow(DynamicLayout.java:284) at android.text.DynamicLayout.(DynamicLayout.java:170) at android.widget.TextView.makeSingleLayout(TextView.java:5843) at android.widget.TextView.makeNewLayout(TextView.java:5741) at android.widget.TextView.onMeasure(TextView.java:6098) at android.view.View.measure(View.java:15172) at android.widget.LinearLayout.measureVertical(LinearLayout.java:833) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148) at android.view.View.measure(View.java:15172) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Im seeing above stack trace. I'm unable to understand the issue. Please help me on tacking the issue. Thank you.

    Read the article

  • Error in Implementing WS Security web service in WebLogic 10.3

    - by Chris
    Hi, I am trying to develop a JAX WS web service with WS-Security features in WebLogic 10.3. I have used the ant tasks WSDLC, JWSC and ClientGen to generate skeleton/stub for this web service. I have two keystores namely WSIdentity.jks and WSTrust.jks which contains the keys and certificates. One of the alias of WSIdentity.jks is "ws02p". The test client has the following code to invoke the web service: SecureSimpleService service = new SecureSimpleService(); SecureSimplePortType port = service.getSecureSimplePortType(); List credProviders = new ArrayList(); CredentialProvider cp = new ClientBSTCredentialProvider( "E:\\workspace\\SecureServiceWL103\\keystores\\WSIdentity.jks", "webservice", "ws01p","webservice"); credProviders.add(cp); string endpointURL="http://localhost:7001/SecureSimpleService/SecureSimpleService"; BindingProvider bp = (BindingProvider)port; Map requestContext = bp.getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL); requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST,credProviders); requestContext.put(WSSecurityContext.TRUST_MANAGER, new TrustManager() { public boolean certificateCallback(X509Certificate[] chain, int validateErr) { // Put some custom validation code in here. // Just return true for now return true; } }); SignResponse resp1 = new SignResponse(); resp1 = port.echoSignOnlyMessage("hello sign"); System.out.println("Result: " + resp1.getMessage()); When I trying to invoke this web servcie using this test client I am getting the error "Invalid signing policy" with the following stack trace: *[java] weblogic.wsee.security.wss.policy.SecurityPolicyArchitectureException: Invalid signing policy [java] at weblogic.wsee.security.wss.plan.SecurityPolicyBlueprintDesigner.verifyPolicy(SecurityPolicyBlueprintDesigner.java:786) [java] at weblogic.wsee.security.wss.plan.SecurityPolicyBlueprintDesigner.designOutboundBlueprint(SecurityPolicyBlueprintDesigner.java:136) Am I missing any configuration settings in WebLogic admin console or is it do with something else. Thanks in advance.

    Read the article

  • how can I parse and group/do stats on user agent strings?

    - by user151841
    I have a database that has the various user-agent strings of visitors to our site. I'd like to do a 'survey' of them to see what browsers our users are using, so that I can know what features I can use in future development. Is there a tool to parse and run statistics on user-agent strings, or a bunch of strings like this? Ideally, I'd like to see a hierarchical grouping of the stats. For instance: Opera/9.80 (Windows Mobile; WCE; Opera Mobi/WMD-50301; U; en) Presto/2.4.13 Version/10.00 Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/1280; U; en) Presto/2.2.0 Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.13918/812; U; en) Presto/2.2.0 Opera/9.64 (Macintosh; Intel Mac OS X; U; en) Presto/2.1.1 Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.13918/786; U; en) Presto/2.2.0 Opera/9.60 (J2ME/MIDP; Opera Mini/4.0.10992/432; U; en) Presto/2.2.0 I'd like to see 6 entries for Opera, broken down into 3 for 9.80, 1 for 9.64 and 2 for 9.60, and so forth for all browsers. Other dimensions, such as OS, would cross the boundaries of the browser version hierarchy, but it might be nice to see also.

    Read the article

  • ExceptionInInitializerError and UnsatisfiedLinkError

    - by Nemesis
    I downloaded the Getac Z710 Android tablet RFID library/jar from there web site. But after I called the init function: 05-19 19:23:45.315: E/AndroidRuntime(2469): FATAL EXCEPTION: main 05-19 19:23:45.315: E/AndroidRuntime(2469): java.lang.ExceptionInInitializerError 05-19 19:23:45.315: E/AndroidRuntime(2469): at com.getac.lib.rfidreader.RfidTagReaderAPI.InitRFIDReader(RfidTagReaderAPI.java:118) 05-19 19:23:45.315: E/AndroidRuntime(2469): at shipadmin.musterstation.no.MainActivity.onCreate(MainActivity.java:104) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.Activity.performCreate(Activity.java:5008) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.ActivityThread.access$600(ActivityThread.java:130) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.os.Handler.dispatchMessage(Handler.java:99) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.os.Looper.loop(Looper.java:137) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android.app.ActivityThread.main(ActivityThread.java:4745) 05-19 19:23:45.315: E/AndroidRuntime(2469): at java.lang.reflect.Method.invokeNative(Native Method) 05-19 19:23:45.315: E/AndroidRuntime(2469): at java.lang.reflect.Method.invoke(Method.java:511) 05-19 19:23:45.315: E/AndroidRuntime(2469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 05-19 19:23:45.315: E/AndroidRuntime(2469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 05-19 19:23:45.315: E/AndroidRuntime(2469): at dalvik.system.NativeStart.main(Native Method) 05-19 19:23:45.315: E/AndroidRuntime(2469): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load serial_port: findLibrary returned null 05-19 19:23:45.315: E/AndroidRuntime(2469): at java.lang.Runtime.loadLibrary(Runtime.java:365) 05-19 19:23:45.315: E/AndroidRuntime(2469): at java.lang.System.loadLibrary(System.java:538) 05-19 19:23:45.315: E/AndroidRuntime(2469): at android_serialport_api.SerialPort.<clinit>(SerialPort.java:69) 05-19 19:23:45.315: E/AndroidRuntime(2469): ... 16 more I tried other solutions for this, but still no luck. What would be the problem? They only have a limited documentation and support. TIA.

    Read the article

  • Weird exception: Cannot cast String to Boolean when using getBoolean

    - by La bla bla
    I'm getting a very weird error. I have 2 activities. On both I'm getting the SharedPreferences using MODE_PRIVATE (if it matters) by sp = getPreferences(MODE_PRIVATE); on each activity's onCreate() I'm calling sp.getBoolean(IntroActivity.SHOW_INTRO, true) On the IntroActivity this works fine. But when I'm trying in the main activity, I'm getting this 10-12 04:55:23.208: E/AndroidRuntime(11668): FATAL EXCEPTION: main 10-12 04:55:23.208: E/AndroidRuntime(11668): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:242) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.lablabla.parkme.ParkMeActivity$2.onClick(ParkMeActivity.java:194) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View.performClick(View.java:4084) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View$PerformClick.run(View.java:16966) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.handleCallback(Handler.java:615) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.dispatchMessage(Handler.java:92) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Looper.loop(Looper.java:137) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invokeNative(Native Method) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invoke(Method.java:511) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-12 04:55:23.208: E/AndroidRuntime(11668): at dalvik.system.NativeStart.main(Native Method) I made sure that I'm not putting a String somewhere in the middle with that same key Any ideas? Thanks! EDIT: some code: //onCreate() sp = getPreferences(MODE_PRIVATE); // other method boolean showIntro = sp.getBoolean(IntroActivity.SHOW_INTRO, true); // Exception is here showIntroCheckBox.setChecked(showIntro); If it matters, the code which throws the exception is inside a button's onClick

    Read the article

1 2  | Next Page >