Daily Archives

Articles indexed Thursday April 5 2012

Page 8/19 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Problem with javascript [migrated]

    - by Andres Orozco
    Well i have a problem, and i made this test code to show you my problem. HTML Code -- http://i.stack.imgur.com/7qlZx.png Javascript Code -- http://i.stack.imgur.com/DYvuq.png What i want to do here in this example is to change the styles of the id. But for some reason it doesn't work the bad news is that i have some problem to detect... problems on my code, so i don't know what happen and i really need your help. Thank's. Andres.

    Read the article

  • Android: how do I switch between game scenes in a game? Any tutorials?

    - by Flavio
    I am trying to create a simple game using the Android SDK without using AndEngine (or any other game engine). I have plenty of experience designing games from the past, but I'm having lots of trouble trying to use the Android SDK to make my game. By far my biggest hurdle right now is switching between views. That is, for example, going from the menu to the first level, etc. I am using a traditional model I learned (I think it's called a scene stack or something?) in which you push the current scene onto a stack and the game's main loop runs the top item of the stack. This model seems non-trivial to implement in the Android SDK, mostly because Android seems to be picky about which thread instantiates which view. My issue is that I want the first level to show up when you press a button on the main menu, but when I instantiate the first level (the level class extends SurfaceView and implements SurfaceHolder.Callback) I get a runtime error complaining that the thread that runs the main menu can't instantiate this class. Something about calling Looper.prepare(). I figured at this point I was probably doing things wrong. I'm not sure how to specifically phrase my issue into a question, so maybe I should leave it as either 1) Does anybody know a good way (or the 'proper' way) to switch between scenes in an Android game? or 2) Are there any tutorials out there which show how to create a game that doesn't take place entirely in one scene? (I have googled for a while to no avail... maybe someone else knows of one?) Thanks!

    Read the article

  • Rending 2D Tile World (With Player In The Middle)

    - by Mick
    What I have at the moment is a series of data structures I'm using, and I would like to render the world onto the screen (just the visible parts). I've actually already done this several times (lots of rewrites), but it's a bit buggy (rounding seems to make the screen jump ever so slightly every x tiles the player walks past). Basically I've been confusing myself heavily on what I feel should be a pretty simple problem... so here I am asking for some help! OK! So I have a 50x50 array holding the tiles of the world. I have the player position as 2 floats, x ([0, 49]) and y ([0, 49]) in that array. I have the application size exactly in pixels (x and y). I have an arbitrary TILE_SIZE static int (based on screen pixels). What I think is heavily confusing me is using a 2d orthogonal projection in opengl which maps (0,0) to the top left of the screen and (SCREEN_SIZE_X, SCREEN_SIZE_Y) to the bottom right of the screen. gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0, getActualWidth(), getActualHeight(), 0); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); The map tiles are set so that the (0,0) in the array is the bottom left. And the player has to be in the middle on the screen (SCREEN_SIZE_X/2, SCREEN_SIZE_Y/2). What I've been doing so far is trying to render 1-2 tiles more all around what would be displayed on the screen so that I don't have to worry about figuring out rendering half a tile from the top left, depending where the player is. It seems like such an easy problem but after spending about 40+hours on it rewriting it many times I think I'm at a point where I just can't think clearly anymore... Any help would be appreciated. It would be great if someone can provide some very basic pseudo code on keeping the player in the middle when your projection is mapped to screen coordinates and only rendering basically the tiles that you would be any be see. Thanks!

    Read the article

  • Loading files during run time

    - by NDraskovic
    I made a content pipeline extension (using this tutorial) in XNA 4.0 game. I altered some aspects, so it serves my need better, but the basic idea still applies. Now I want to go a step further and enable my game to be changed during run time. The file I am loading trough my content pipeline extension is very simple, it only contains decimal numbers, so I want to enable the user to change that file at will and reload it while the game is running (without recompiling as I had to do so far). This file is a very simplified version of level editor, meaning that it contains rows like: 1 1,5 1,78 -3,6 Here, the first number determines the object that will be drawn to the scene, and the other 3 numbers are coordinates where that object will be placed. So, how can I change the file that contains these numbers so that the game loads it and redraws the scene accordingly? Thanks

    Read the article

  • Are there any open source projects for car engine sound simulation?

    - by Petteri Hietavirta
    I have been thinking how to create realistic sound for a car. The main sound is the engine, then all kind of wind, road and suspension sounds. Are there any open source projects for the engine sound simulation? Simply pitching up the sample does not sound too great. The ideal would be to something that allows me to pick type of the engine (i.e. inline-4 vs v-8), add extras like turbo/supercharger whine and finally set the load and rpm. Edit: Something like http://www.sonory.org/examples.html

    Read the article

  • D3D9 Alpha Blending on the surfaces

    - by Indeera
    I have a surface (OffScreenPlain or RenderTarget with D3DFMT_A8R8G8B8) which I copy pixels (ARGB) to, from a third party function. Before pixel copying, Bits are accessed by LockRect. This surface is then StretchRect to the Backbuffer which is (D3DFMT_A8R8G8B8). Surface and Backbuffer are different dimensions. Filtering is set to D3DTEXF_NONE. Just after creating the d3d device I've set following RenderState settings D3DRS_ALPHABLENDENABLE -> TRUE D3DRS_BLENDOP -> D3DBLENDOP_ADD D3DRS_SRCBLEND -> D3DBLEND_SRCALPHA D3DRS_DESTBLEND -> D3DBLEND_INVSRCALPHA But I see no alpha blending happening. I've verified that alpha is specified in pixels. I've done a simple test by creating a vertex buffer and drawing a triangle (DrawPrimitive) which displays with alpha blending. In this test surface was StretchRect first and then DrawPrimitive, and the surface content displays without alpha blending and the triangle displays with alpha blending. What am I missing here? Thanks

    Read the article

  • How to create Executable Jar

    - by Siddharth
    When I try to create a jar file i found the following error, so please someone help me to out of this. Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: img/black_ring.png at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:137) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:55) at com.badlogic.gdx.graphics.Texture.load(Texture.java:175) at com.badlogic.gdx.graphics.Texture.create(Texture.java:159) at com.badlogic.gdx.graphics.Texture.(Texture.java:133) at com.badlogic.gdx.graphics.Texture.(Texture.java:122) at com.badlogic.runningball.UserBall.(UserBall.java:19) at com.badlogic.runningball.GameScreen.(GameScreen.java:25) at com.badlogic.runningball.RunningBall.create(RunningBall.java:12) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:126) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: img/black_ring.png (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:108) at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:364) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:156) at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:134) ... 10 more

    Read the article

  • b2Body moves without stopping

    - by SentineL
    I got a quite strange bug. It is difficult to explain it in two words, but i'll try to do this in short. My b2Body has restitution, friction, density, mass and collision group. I controlling my b2Body via setting linear velocity to it (called on every iteration): (void)moveToDirection:(CGPoint)direction onlyHorizontal:(BOOL)horizontal { b2Vec2 velocity = [controlledObject getBody]-GetLinearVelocity(); double horizontalSpeed = velocity.x + controlledObject.acceleration * direction.x; velocity.x = (float32) (abs((int) horizontalSpeed) < controlledObject.runSpeed ? horizontalSpeed : controlledObject.maxSpeed * direction.x); if (!horizontal) { velocity.y = velocity.y + controlledObject.runSpeed * direction.y; } [controlledObject getBody]->SetLinearVelocity(velocity); } My floor is static b2Body, it has as restitution, friction, density, mass and same collision group in some reason, I'm setting b2Body's friction of my Hero to zero when it is moving, and returning it to 1 when he stops. When I'm pushing run button, hero runs. when i'm releasing it, he stops. All of this works perfect. On jumping, I'm setting linear velocity to my Hero: (void)jump { b2Vec2 velocity = [controlledObject getBody]->GetLinearVelocity(); velocity.y = velocity.y + [[AppDel cfg] getHeroJumpVlelocity]; [controlledObject getBody]->SetLinearVelocity(velocity); } If I'll run, jump, and release run button, while he is in air, all will work fine. And here is my problem: If I'll run, jump, and continue running on landing (or when he goes from one static body to another: there is small fall, probably), Hero will start move, like he has no friction, but he has! I checked this via beakpoints: he has friction, but I can move left of right, and he will never stop, until i'll jump (or go from one static body to another), with unpressed running button. I allready tried: Set friction to body on every iteration double-check am I setting friction to right fixture. set Linear Damping to Hero: his move slows down on gugged moveing. A little more code: I have a sensor and body fixtures in my hero: (void) addBodyFixture { b2CircleShape dynamicBox; dynamicBox.m_radius = [[AppDel cfg] getHeroRadius]; b2FixtureDef bodyFixtureDef; bodyFixtureDef.shape = &dynamicBox; bodyFixtureDef.density = 1.0f; bodyFixtureDef.friction = [[AppDel cfg] getHeroFriction]; bodyFixtureDef.restitution = [[AppDel cfg] getHeroRestitution]; bodyFixtureDef.filter.categoryBits = 0x0001; bodyFixtureDef.filter.maskBits = 0x0001; bodyFixtureDef.filter.groupIndex = 0; bodyFixtureDef.userData = [NSNumber numberWithInt:FIXTURE_BODY]; [physicalBody addFixture:bodyFixtureDef]; } (void) addSensorFixture { b2CircleShape sensorBox; sensorBox.m_radius = [[AppDel cfg] getHeroRadius] * 0.95; sensorBox.m_p.Set(0, -[[AppDel cfg] getHeroRadius] / 10); b2FixtureDef sensor; sensor.shape = &sensorBox; sensor.filter.categoryBits = 0x0001; sensor.filter.maskBits = 0x0001; sensor.filter.groupIndex = 0; sensor.isSensor = YES; sensor.userData = [NSNumber numberWithInt:FIXTURE_SENSOR]; [physicalBody addFixture:sensor]; } Here I'm tracking is hero in air: void FixtureContactListener::BeginContact(b2Contact* contact) { // We need to copy out the data because the b2Contact passed in // is reused. Squirrel *squirrel = (Squirrel *)contact->GetFixtureB()->GetBody()->GetUserData(); if (squirrel) { [squirrel addContact]; } } void FixtureContactListener::EndContact(b2Contact* contact) { Squirrel *squirrel = (Squirrel *)contact->GetFixtureB()->GetBody()->GetUserData(); if (squirrel) { [squirrel removeContact]; } } here is Hero's logic on contacts: - (void) addContact { if (contactCount == 0) [self landing]; contactCount++; } - (void) removeContact { contactCount--; if (contactCount == 0) [self flying]; if (contactCount <0) contactCount = 0; } - (void)landing { inAir = NO; acceleration = [[AppDel cfg] getHeroRunAcceleration]; [sprite stopAllActions]; (running ? [sprite runAction:[self runAction]] : [sprite runAction:[self standAction]]); } - (void)flying { inAir = YES; acceleration = [[AppDel cfg] getHeroAirAcceleration]; [sprite stopAllActions]; [self flyAction]; } here is Hero's moving logic: - (void)stop { running = NO; if (!inAir) { [sprite stopAllActions]; [sprite runAction:[self standAction]]; } } - (void)left { [physicalBody setFriction:0]; if (!running && !inAir) { [sprite stopAllActions]; [sprite runAction:[self runAction]]; } running = YES; moveingDirection = NO; [bodyControls moveToDirection:CGPointMake(-1, 0) onlyHorizontal:YES]; } - (void)right { [physicalBody setFriction:0]; if (!running && !inAir) { [sprite stopAllActions]; [sprite runAction:[self runAction]]; } running = YES; moveingDirection = YES; [bodyControls moveToDirection:CGPointMake(1, 0) onlyHorizontal:YES]; } - (void)jump { if (!inAir) { [bodyControls jump]; } } and here is my update method (called on every iteration): - (void)update:(NSMutableDictionary *)buttons { if (!isDead) { [self updateWithButtonName:BUTTON_LEFT inButtons:buttons whenPressed:@selector(left) whenUnpressed:@selector(stop)]; [self updateWithButtonName:BUTTON_RIGHT inButtons:buttons whenPressed:@selector(right) whenUnpressed:@selector(stop)]; [self updateWithButtonName:BUTTON_UP inButtons:buttons whenPressed:@selector(jump) whenUnpressed:@selector(nothing)]; [self updateWithButtonName:BUTTON_DOWN inButtons:buttons whenPressed:@selector(nothing) whenUnpressed:@selector(nothing)]; [sprite setFlipX:(moveingDirection)]; } [self checkPosition]; if (!running) [physicalBody setFriction:[[AppDel cfg] getHeroFriction]]; else [physicalBody setFriction:0]; } - (void)updateWithButtonName:(NSString *)buttonName inButtons:(NSDictionary *)buttons whenPressed:(SEL)pressedSelector whenUnpressed:(SEL)unpressedSelector { NSNumber *buttonNumber = [buttons objectForKey:buttonName]; if (buttonNumber == nil) return; if ([buttonNumber boolValue]) [self performSelector:pressedSelector]; else [self performSelector:unpressedSelector]; } - (void)checkPosition { b2Body *body = [self getBody]; b2Vec2 position = body->GetPosition(); CGPoint inWorldPosition = [[AppDel cfg] worldMeterPointFromScreenPixel:CGPointMake(position.x * PTM_RATIO, position.y * PTM_RATIO)]; if (inWorldPosition.x < 0 || inWorldPosition.x > WORLD_WIDGH / PTM_RATIO || inWorldPosition.y <= 0) { [self kill]; } }

    Read the article

  • Why did the old 3D games have "jittery" graphics?

    - by dreta
    I've been playing MediEvil lately and it got me wondering, what causes some of the old 3D games have "flowing" graphics when moving? It's present in games like Final Fantasy VII, MediEvil, i remember Dungeon Keeper 2 having the same thing in zoom mode, however f.e. Quake 2 didn't have this "issue" and it's just as old. The resolution doesn't seem to be the problem, everything is rendered perfectly fine when you stand still. So is the game refreshing slowly or it's something to do with buffering?

    Read the article

  • Rotate a particle system

    - by Blueski
    Languages / Libraries in use: C++, OpenGL, GLUT Okay, here's the deal. I've got a particle system which shoots out alpha blended textures to produce a flame. The system only keeps track of very basic things such as, time alive, life, xyz and spread. The direction in which the flames are currently moving in is purely based on other things which are going on in my code ( I assume ). My goal however, is to attach the flame to the camera (DONE) and have the flame pointing in the direction my camera is facing (NOT WORKING). I've tried glRotate for both x,y,z and I can't get it to work properly. I'm currently using gluLookAt to move the camera, and get the flame to follow the XYZ of the camera by calling glTranslatef(camX, camY - offset, camZ); Any suggestions on how I can rotate the direction of the flame with the camera would be greatly appreciated. Heres an image of what I've got: http://i.imgur.com/YhV4w.png Notes: Crosshair depicts where camera is facing if I turn the camera, flame doesn't follow the crosshair Also asked here: http://stackoverflow.com/questions/9560396/rotate-a-particle-system but was referred here

    Read the article

  • c# eventhandling error

    - by bragin.www
    i have method private void getValues(object sender, EventArgs e) { int id = int.Parse(dgvTable.Rows[dgvTable.CurrentRow.Index].Cells[0].Value.ToString()); var values = from c in v.db.TotalDoc where c.TotalID == id select c.TotalAmount; dgvValues.DataSource = values; } and datagridview "dgvTable" error at this line dgvTable.CellClick += new EventHadler(getValues); error text is: No overload for 'getValues' matches delegate 'System.EventHandler' please help!

    Read the article

  • The Columns in table <table> do not match an existing primary key or unique constraint

    - by Sven
    I have 2 tables, Stores - storeId (int) and year (int(4)) both Primary Keys. fruit - fruitId - Primary Key and storeId. I need to create 1 to many relationship between the Store and Fruit (Foreign Key held within Fruit) how ever I always get shown the error - The Columns in table <table> do not match an existing primary key or unique constraint. The type's are both int and named the same. Any help would be appreciate in advance, many thanks.

    Read the article

  • Expandable columns in a datagrid

    - by Jobe
    Im working on a WPF-applications to present and correct large amounts of data. Im about to implement a datagrid containing data from 3 different sources that are populated from external services. To start with I will only populate the grid with data from one source, the master source. However, sometimes an automated validator will trigger a validation warning or error on one cell and the requirement states that the user should be able to view data from the additional 2 sources in columns next to the selected one. Something like this: Standard view: | col1 src1 | col2 src1 | col3 src1 | | | | | | |faulty | | | | | | User want to show data from source 2 and 3 next to the column "col2 src1" like this: | col1 src1 | col2 src1 | col2 src2 | col2 src3 | col3 src1 | | | | | | | | |corrected | | | | | | | | | | and then be able to correct the faulty formatted cell with data from the other 2 soruces, and then collapse the columns again. I am trying to use the mvvm pattern on this one so I have populated the DataGrid with a ListCollectionView so far. The list contains items with properties like this: MyRowItem {string col1, string col2, string col3} I will then have 2 additional collections with items of type like above but from 2 other sources. I have no idea how to implement this functionality and could use some help on the logics. What approach should I head for?

    Read the article

  • codeigniter cron job with http access

    - by user1313850
    Sorry if this is a duplicate question...I've searched around and found similar advice but nothing that helps my exact problem. And please excuse the noob questions, CRON is a new thing for me. I have a codeigniter script that scrapes the html DOM of another site and stores some of that in a database. I'd like to run this script at a regular interval. This has lead me to looking into cron jobs. The page I have is at myserver.com/index.php/update I realize I can run a cron job with curl and run this page. If I want to be a bit more secure I can put a string at the end like: myserver.com/index.php/update/asdfh2784fufds And check for that in my CI controller. This seems like it would be mostly secure, but doesn't seem like the "right" way to do things. I've looked into running CI from the command line, and can execute basic pages like: php index.php mycontroller But when I try to do: php index.php update It doesn't work. I suspect this is because it needs to use HTTP to scrape the DOM of the outside page. So, my question: How do I securely run a codeigniter script with a cron job that needs HTTP access?

    Read the article

  • HTML email formatting

    - by Paul
    I'm using the following for $headers: $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "From: " . $from . "\r\n"; $headers .= "Reply-To: ". $from . "\r\n"; $headers .= "CC: [email protected]\r\n"; My html looks fine in Gmail, however, it appears as raw html in outlook. Did I forget something in the header?

    Read the article

  • Error while applying overlay on a location on a Google map in Android

    - by Hiccup
    This is my Activity for getting Location: public class LocationActivity extends MapActivity{ Bundle bundle = new Bundle(); MapView mapView; MapController mc; GeoPoint p; ArrayList <String> address = new ArrayList<String>(); List<Address> addresses; private LocationManager locationManager; double lat, lng; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); mapView = (MapView) findViewById(R.id.mapView1); mapView.displayZoomControls(true); mc = mapView.getController(); LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); // criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); String strLocationProvider = lm.getBestProvider(criteria, true); //Location location = lm.getLastKnownLocation(strLocationProvider); Location location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); lat = (double) location.getLatitude(); lng = (double) location.getLongitude(); p = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6)); mc.animateTo(p); mc.setZoom(17); MapOverlay mapOverlay = new MapOverlay(); List<Overlay> listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); Geocoder gcd = new Geocoder(this, Locale.getDefault()); try { addresses = gcd.getFromLocation(lat,lng,1); if (addresses.size() > 0 && addresses != null) { address.add(addresses.get(0).getFeatureName()); address.add(addresses.get(0).getAdminArea()); address.add(addresses.get(0).getCountryName()); bundle.putStringArrayList("id1", address); } bundle.putDouble("lat", lat); bundle.putDouble("lon", lng); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); //---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(p, screenPts); //---add the marker--- Bitmap bmp = BitmapFactory.decodeResource( getResources(), R.drawable.logo); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null); return true; } @Override public boolean onTouchEvent(MotionEvent event, MapView mapView) { //---when user lifts his finger--- if (event.getAction() == 1) { Bundle bundle = new Bundle(); ArrayList <String> address = new ArrayList<String>(); GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Geocoder geoCoder = new Geocoder( getBaseContext(), Locale.getDefault()); try { List<Address> addresses = geoCoder.getFromLocation( p.getLatitudeE6() / 1E6, p.getLongitudeE6() / 1E6, 1); addOverLay(); MapOverlay mapOverlay = new MapOverlay(); Bitmap bmp = BitmapFactory.decodeResource( getResources(), R.drawable.crumbs_logo); List<Overlay> listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); String add = ""; if (addresses.size() > 0) { address.add(addresses.get(0).getFeatureName()); address.add(addresses.get(0).getLocality()); address.add(addresses.get(0).getAdminArea()); address.add(addresses.get(0).getCountryName()); bundle.putStringArrayList("id1", address); for(int i = 0; i <= addresses.size();i++) add += addresses.get(0).getAddressLine(i) + "\n"; } bundle.putDouble("lat", p.getLatitudeE6() / 1E6); bundle.putDouble("lon", p.getLongitudeE6() / 1E6); Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } return true; } else return false; } } public void onClick_mapButton(View v) { Intent intent = this.getIntent(); this.setResult(RESULT_OK, intent); intent.putExtras(bundle); finish(); } public void addOverLay() { MapOverlay mapOverlay = new MapOverlay(); List<Overlay> listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } public void FindLocation() { LocationManager locationManager = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { // updateLocation(location); Toast.makeText( LocationActivity.this, String.valueOf(lat) + "\n" + String.valueOf(lng), 5000) .show(); } public void onStatusChanged(String provider, int status, Bundle extras) { } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } }; locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); } } I face two problems here. One is that when I click (do a tap) on any location, the overlay is not changing to that place. Also, the app crashes when I am on the MapView page and I click on back button. What might be the error?

    Read the article

  • Best practices for displaying large number of images as thumbnails in c#

    - by andySF
    I got to a point where it's very difficult to get answers by debugging and tracing object, so i need some help. What I'm trying to do: A history form for my screen capture pet project. The history must list all images as thumbnails (ex: picasa). What I've done: I created a HistoryItem:UserControl. This history item has a few buttons, a check box, a label and a picture box. The buttons are for delete/edit/copy image. The check box is used for selecting one or more images and the label is for some info text. The picture box is getting the image from a public property that is a path and a method creates a proportional thumbnail to display it when the control has been loaded. This user control has two public events. One for deleting the image and one for bubbling the events for mouse enter and mouse leave trough all controls. For this I use EventBroadcastProvider. The bubbling is useful because wherever I move the mouse over the control, the buttons appear. The dispose method has been extended and I manually remove the events. All images are loaded by looping a xml file that contains the path of all images. For each image in this XML I create a new HitoryItem that is added (after a little coding to sort and limit the amount of images loaded) to a flow layout panel. The problem: When I lunch the history form, and the flow layout panel is populated with my HistoryItem custom control, my memory usage increases drastically.From 14Mb to around 100MB with 100 images loaded. By closing the history form and disposing whatever I could dispose and even trying to call GC.Collect() the memory increase remain. I search for any object that could not be disposed properly like an image or event but wherever I used them they are disposed. The problem seams to be from multiple sources. One is that the events for bubbling are not disposing properly, and the other is from the picture box itself. All of this i could see by commenting all the code to a limited version when only the custom control without any image processing and even events is loaded. Without the events the memory consumption is reduced by axiomatically 20%. So my real question is if this logic, flow layout panels and custom controls with picture boxes, is the best solution for displaying large amounts of images as thumbnails. Thank you!

    Read the article

  • String generation with regex criteria

    - by menjaraz
    I wonder wether it is feasible to implement an optimal string generator Class meeting the following requirements: Generation criteria using regex Lexicographical order enumeration. Count propetry Indexed access I don't feel comfortable with regular expression: I cannot come up with a starting piece of code but I just think of a naive implementation using a TList as a base class and use a filter (Regex) against "brute force" generated string. Thank you.

    Read the article

  • git push >> fatal: no configured push destination

    - by Marc
    I'm still going through some guides on RoR and i'm stuck here at "Deploying the demo app" I followed instructions: " With the completion of microposts resources, now is a good time to push the repository up to GitHub: " $ git add . $ git commit -a -m "Finish demo app" $ git push What happened wrong here was the push part.. it outputted this: $ git push fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using git remote add < name < url git push < name So i tried following the insturctions by doing this command: $git remote add demo_app 'www.github.com/levelone/demo_app' fatal: remote demo_app already exists. So i push: $git push demo_app fatal: 'www.github.com/levelone/demo_app' does not appear to be a git repository fatal: The remote end hung up unexpectedly What can i do here? Any help would be much appreciated. -Marc

    Read the article

  • ORDER BY job failed in the Pig script while running EmbeddedPig using Java

    - by C.c. Huang
    I have this following pig script, which works perfectly using grunt shell (stored the results to HDFS without any issues); however, the last job (ORDER BY) failed if I ran the same script using Java EmbeddedPig. If I replace the ORDER BY job by others, such as GROUP or FOREACH GENERATE, the whole script then succeeded in Java EmbeddedPig. So I think it's the ORDER BY which causes the issue. Anyone has any experience with this? Any help would be appreciated! The Pig script: REGISTER pig-udf-0.0.1-SNAPSHOT.jar; user_similarity = LOAD '/tmp/sample-sim-score-results-31/part-r-00000' USING PigStorage('\t') AS (user_id: chararray, sim_user_id: chararray, basic_sim_score: float, alt_sim_score: float); simplified_user_similarity = FOREACH user_similarity GENERATE $0 AS user_id, $1 AS sim_user_id, $2 AS sim_score; grouped_user_similarity = GROUP simplified_user_similarity BY user_id; ordered_user_similarity = FOREACH grouped_user_similarity { sorted = ORDER simplified_user_similarity BY sim_score DESC; top = LIMIT sorted 10; GENERATE group, top; }; top_influencers = FOREACH ordered_user_similarity GENERATE com.aol.grapevine.similarity.pig.udf.AssignPointsToTopInfluencer($1, 10); all_influence_scores = FOREACH top_influencers GENERATE FLATTEN($0); grouped_influence_scores = GROUP all_influence_scores BY bag_of_topSimUserTuples::user_id; influence_scores = FOREACH grouped_influence_scores GENERATE group AS user_id, SUM(all_influence_scores.bag_of_topSimUserTuples::points) AS influence_score; ordered_influence_scores = ORDER influence_scores BY influence_score DESC; STORE ordered_influence_scores INTO '/tmp/cc-test-results-1' USING PigStorage(); The error log from Pig: 12/04/05 10:00:56 INFO pigstats.ScriptState: Pig script settings are added to the job 12/04/05 10:00:56 INFO mapReduceLayer.JobControlCompiler: mapred.job.reduce.markreset.buffer.percent is not set, set to default 0.3 12/04/05 10:00:58 INFO mapReduceLayer.JobControlCompiler: Setting up single store job 12/04/05 10:00:58 INFO jvm.JvmMetrics: Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 12/04/05 10:00:58 INFO mapReduceLayer.MapReduceLauncher: 1 map-reduce job(s) waiting for submission. 12/04/05 10:00:58 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same. 12/04/05 10:00:58 INFO input.FileInputFormat: Total input paths to process : 1 12/04/05 10:00:58 INFO util.MapRedUtil: Total input paths to process : 1 12/04/05 10:00:58 INFO util.MapRedUtil: Total input paths (combined) to process : 1 12/04/05 10:00:58 INFO filecache.TrackerDistributedCacheManager: Creating tmp-1546565755 in /var/lib/hadoop-0.20/cache/cchuang/mapred/local/archive/4334795313006396107_361978491_57907159/localhost/tmp/temp1725960134-work-6955502337234509704 with rwxr-xr-x 12/04/05 10:00:58 INFO filecache.TrackerDistributedCacheManager: Cached hdfs://localhost/tmp/temp1725960134/tmp-1546565755#pigsample_854728855_1333645258470 as /var/lib/hadoop-0.20/cache/cchuang/mapred/local/archive/4334795313006396107_361978491_57907159/localhost/tmp/temp1725960134/tmp-1546565755 12/04/05 10:00:58 INFO filecache.TrackerDistributedCacheManager: Cached hdfs://localhost/tmp/temp1725960134/tmp-1546565755#pigsample_854728855_1333645258470 as /var/lib/hadoop-0.20/cache/cchuang/mapred/local/archive/4334795313006396107_361978491_57907159/localhost/tmp/temp1725960134/tmp-1546565755 12/04/05 10:00:58 WARN mapred.LocalJobRunner: LocalJobRunner does not support symlinking into current working dir. 12/04/05 10:00:58 INFO mapred.TaskRunner: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/local/archive/4334795313006396107_361978491_57907159/localhost/tmp/temp1725960134/tmp-1546565755 <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/pigsample_854728855_1333645258470 12/04/05 10:00:58 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/.job.jar.crc <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/.job.jar.crc 12/04/05 10:00:58 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/.job.split.crc <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/.job.split.crc 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/.job.splitmetainfo.crc <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/.job.splitmetainfo.crc 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/.job.xml.crc <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/.job.xml.crc 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/job.jar <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/job.jar 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/job.split <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/job.split 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/job.splitmetainfo <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/job.splitmetainfo 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Creating symlink: /var/lib/hadoop-0.20/cache/cchuang/mapred/staging/cchuang402164468/.staging/job_local_0004/job.xml <- /var/lib/hadoop-0.20/cache/cchuang/mapred/local/localRunner/job.xml 12/04/05 10:00:59 INFO mapred.Task: Using ResourceCalculatorPlugin : null 12/04/05 10:00:59 INFO mapred.MapTask: io.sort.mb = 100 12/04/05 10:00:59 INFO mapred.MapTask: data buffer = 79691776/99614720 12/04/05 10:00:59 INFO mapred.MapTask: record buffer = 262144/327680 12/04/05 10:00:59 WARN mapred.LocalJobRunner: job_local_0004 java.lang.RuntimeException: org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:/Users/cchuang/workspace/grapevine-rec/pigsample_854728855_1333645258470 at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.partitioners.WeightedRangePartitioner.setConf(WeightedRangePartitioner.java:139) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117) at org.apache.hadoop.mapred.MapTask$NewOutputCollector.<init>(MapTask.java:560) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:639) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:210) Caused by: org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:/Users/cchuang/workspace/grapevine-rec/pigsample_854728855_1333645258470 at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:231) at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigFileInputFormat.listStatus(PigFileInputFormat.java:37) at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getSplits(FileInputFormat.java:248) at org.apache.pig.impl.io.ReadToEndLoader.init(ReadToEndLoader.java:153) at org.apache.pig.impl.io.ReadToEndLoader.<init>(ReadToEndLoader.java:115) at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.partitioners.WeightedRangePartitioner.setConf(WeightedRangePartitioner.java:112) ... 6 more 12/04/05 10:00:59 INFO filecache.TrackerDistributedCacheManager: Deleted path /var/lib/hadoop-0.20/cache/cchuang/mapred/local/archive/4334795313006396107_361978491_57907159/localhost/tmp/temp1725960134/tmp-1546565755 12/04/05 10:00:59 INFO mapReduceLayer.MapReduceLauncher: HadoopJobId: job_local_0004 12/04/05 10:01:04 INFO mapReduceLayer.MapReduceLauncher: job job_local_0004 has failed! Stop running all dependent jobs 12/04/05 10:01:04 INFO mapReduceLayer.MapReduceLauncher: 100% complete 12/04/05 10:01:04 ERROR pigstats.PigStatsUtil: 1 map reduce job(s) failed! 12/04/05 10:01:04 INFO pigstats.PigStats: Script Statistics: HadoopVersion PigVersion UserId StartedAt FinishedAt Features 0.20.2-cdh3u3 0.8.1-cdh3u3 cchuang 2012-04-05 10:00:34 2012-04-05 10:01:04 GROUP_BY,ORDER_BY Some jobs have failed! Stop running all dependent jobs Job Stats (time in seconds): JobId Maps Reduces MaxMapTime MinMapTIme AvgMapTime MaxReduceTime MinReduceTime AvgReduceTime Alias Feature Outputs job_local_0001 0 0 0 0 0 0 0 0 all_influence_scores,grouped_user_similarity,simplified_user_similarity,user_similarity GROUP_BY job_local_0002 0 0 0 0 0 0 0 0 grouped_influence_scores,influence_scores GROUP_BY,COMBINER job_local_0003 0 0 0 0 0 0 0 0 ordered_influence_scores SAMPLER Failed Jobs: JobId Alias Feature Message Outputs job_local_0004 ordered_influence_scores ORDER_BY Message: Job failed! Error - NA /tmp/cc-test-results-1, Input(s): Successfully read 0 records from: "/tmp/sample-sim-score-results-31/part-r-00000" Output(s): Failed to produce result in "/tmp/cc-test-results-1" Counters: Total records written : 0 Total bytes written : 0 Spillable Memory Manager spill count : 0 Total bags proactively spilled: 0 Total records proactively spilled: 0 Job DAG: job_local_0001 -> job_local_0002, job_local_0002 -> job_local_0003, job_local_0003 -> job_local_0004, job_local_0004 12/04/05 10:01:04 INFO mapReduceLayer.MapReduceLauncher: Some jobs have failed! Stop running all dependent jobs

    Read the article

  • FTP/SFTP module for .NET

    - by Angrius
    I am designing an auto downloader using .NET and C#. I was wondering if there is a decent/robust FTP/SFTP module out there that I can use, preferably free of charge. EDIT: I probably should've noted that I am looking for answer from somebody who tried several and found one that works very well. I currently use .NET wrapper for libcurl for FTP and it does not behave right. For example when I connect to FTP site with Filezilla and provide a path, it finds directory just fine. With libcurl, i get a header for 404 page saying path cannot be found. I am guessing that Filezilla gets 'home' directory correctly, and libcurl puts me to the root (i tried no path, and i had no permissions to access that directory). But anyways, I just don't know enough about FTP itself, so I would like something that just works. Thanks!

    Read the article

  • Why is the GUID structure declared the way it is?

    - by alabamasucks
    In rpc.h, the GUID structure is declared as follows: typedef struct _GUID { DWORD Data1; WORD Data2; WORD Data3; BYTE Data[8]; } GUID; I understand Data1, Data2, and Data3. They define the first, second, and third sets of hex digits when writing out a GUID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX). What I never understood was why the last 2 groups were declared together in the same byte array. Wouldn't this have made more sense (and been easier to code against)? typedef struct _GUID { DWORD Data1; WORD Data2; WORD Data3; WORD Data4; BYTE Data5[6]; } GUID; Anyone know why it is declared this way?

    Read the article

  • Enum and Dictionary<Enum, Action>

    - by Selcuk
    I hope I can explain my problem in a way that it's clear for everyone. We need your suggestions on this. We have an Enum Type which has more than 15 constants defined. We receive a report from a web service and translate its one column into this Enum type. And based on what we receive from that web service, we run specific functions using Dictionary Why am I asking for ideas? Let's say 3 of these Enum contants meet specific functions in our Dictionary but the rest use the same function. So, is there a way to add them into our Dictionary in a better way rather than adding them one by one? I also want to keep this structure because when it's time, we might have specific functions in the future for the ones that I described as "the rest". To be more clear here's an example what we're trying to do: Enum: public enum Reason{ ReasonA, ReasonB, ReasonC, ReasonD, ReasonE, ReasonF, ReasonG, ReasonH, ReasonI, ReasonJ, ReasonK } Defining our Dictionary: public Dictionary<Reason, Action<CustomClassObj, string>> ReasonHandlers = new Dictionary<Reason, Action<CustomClassObj, string>>{ { Reason.ReasonA, HandleReasonA }, { Reason.ReasonB, HandleReasonB }, { Reason.ReasonC, HandleReasonC }, { Reason.ReasonD, HandleReasonGeneral }, { Reason.ReasonE, HandleReasonGeneral }, { Reason.ReasonF, HandleReasonGeneral }, { Reason.ReasonG, HandleReasonGeneral }, { Reason.ReasonH, HandleReasonGeneral }, { Reason.ReasonI, HandleReasonGeneral }, { Reason.ReasonJ, HandleReasonGeneral }, { Reason.ReasonK, HandleReasonGeneral } }; So basically what I'm asking is, is there a way to add Reason, Function pair more intelligently? Because as you can see after ReasonC, all other reasons use the same function. Thank you for your suggestions.

    Read the article

  • How do you get the ID of a control in ASP.NET

    - by James
    I am attempting to loop through an array of numbers, match them to the checkbox they they are associated with, and checkmark that box. My checkbox is set up like: <input type="checkbox" runat="server" id="someID" name="somename" value="1234" /> My code when the page loads currently looks like: foreach (string interest in interests_Var){ foreach (var c in Page.Controls) { } } interests_Var is my array containing different numbers. We'll assume one of them is 1234. While looping through the page controls, I want to compare the value of the control to my number. If it equals my number, I want to then apply the attribute checked="checked". I'm assuming I have to find the ID of the control I am using, then use that ID to add a new attribute. Or is there a way I can add the attribute using the c variable? I'm not dead set on this setup, so if you know a better way, I'm all ears. Thanks for any help and suggestions.

    Read the article

  • Why does my .NET 4 application know .NET 4 is not installed

    - by Tergiver
    I developed an application that targeted .NET 4 the other day and XCOPY-installed it to a Windows XP machine. I had told the owner of the machine that they would need to install .NET Framework 4 to run my app and he told me he did (not a reliable source). When I ran the application I was presented with a message box that said this app requires .NET Framework 4, would I like to install it? Clicking the Yes button took me to the Microsoft web site and a few clicks later .NET 4 was installed, and the application successfully launched. Now I normally don't develop applications that target the latest version of .NET, I always target the lowest version I can (what features do I really need?). So this was my first .NET 4 app (and I only targeted 4 because it used a library that did). In the past, XCOPY-installing .NET applications to a machine that didn't have the correct version of .NET installed resulted in the application simply crashing on startup with no useful information presented to the user. Was it built into my app because I targeted .NET X? Was it something already installed on the target machine? I love the feature, I just want to know precisely how to leverage it in the future.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >