Daily Archives

Articles indexed Saturday June 9 2012

Page 3/15 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Just installed 12.04 and it freezes when I try logging in

    - by James
    I just installed Ubuntu 12.04 alongside Windows 7 on an Acer Aspire 1 with AMD Dual-Core C60, 4 GB RAM, and 320 GB HDD (100 GB partitioned for Ubuntu). After restarted my computer, I was able to log in fine but when I tried to log in again after shutting my netbook off, it began to freeze on the log in screen. The freezing occurs several seconds after I'm prompted to enter my password. Even if i enter the password before the freezing occurs, I end up getting stuck while it's loading or something. I'm new to Ubuntu so I have no idea what to do. Also, before it gets to the log in screen, it says something like this: NTFS5: No wubildr NTFS5: No wubildr NTFS5: error: "prefix" edit: it was wubildr, not unbilder. Also, the freezing seems to be inconsistent

    Read the article

  • How can I install bleachbit in Ubuntu 12.04 LTS?

    - by gunjan parashar
    I'm unable to install bleachbit on my laptop running Ubuntu 12.04. The Ubuntu Software Centre shows that the package is available from the Universe software source and I have the option to "use this source" but after that, it gets stuck while quering software sources. How can I fix this problem? It's occurred to me that perhaps this could be from software sources being deleted in my configuration. If so, can someone tell me the default list of software sources? plz help me out and sorry for my poor english

    Read the article

  • How can I permanently save a password-protected SSH key?

    - by pl1nk
    I am using Awesome Window Manager How can I permanently add private keys with password? Inspired by the answer here I have added the private keys in ~/.ssh/config Contents of ~/.ssh/config: IdentityFile 'private key full path' Permissions of ~/.ssh/config: 0700 But it doesn't work for me. If I manually add the key in every session, it works but I'm looking for a more elegant way (not in .bashrc)

    Read the article

  • 12.04 - How do I Fix Grub Error 15 on New Dual Boot Install

    - by Garth
    I just installed 12.04 to Dual Boot (separate partitions) with an existing Win 7. Upon reboot after install things freeze after Grub 1.5 with a Grub Error 15 message. Is there any easy way to fix this? (I am posting this from my second computer) UPDATE: I managed to boot into both 12.04 and Win7 using BIOS: Selected the disk with the Win7 'C' Partition: resulted in the same error message Rebooted, tried the disk with the Ubuntu Partitions: *Grub Menu loaded: Managed to boot 12.04, rebooted, used BIOS again: Managed to boot Win 7 So, I have access to my computer again (thru BIOS), but this has been a pretty crappy install experience. Garth I used the the Final release 12.04 Ubuntu install disk, reformatted all Linux partitions, and expected a simple clean install. Other than specifying the Ubuntu Partitions, I did a basic install of 12.04. No way I did do anything to get this crap error failure! I have no idea why my install resulted in a Grub-15 error. CLOSED - Answered my own Question: I burned a RescuTux Disk and used it to recover grub2 (simplest and easiest way for me. http://www.supergrubdisk.org/category/download/rescatuxdownloads/ Garth

    Read the article

  • Alternative to nofollow: custom 302 url shortener?

    - by Dogweather
    Here's the scenario: lots of blogging platforms make it tedious to insert nofollow into links within the post content. I.e., you need to edit the html, format it correctly, etc. I have a client who posts lots of content with links that should be nofollow'ed, and I thought of a novel way to handle this, since the blogging platform they're using makes it hard: I install a URL shortener web app on the client's domain. The shortener works as normal, except it redirects via 302 instead of 301. The pagerank will therefore stay at the shortener's domain, and not flow on to the target site. Part 2: In order to get the pagerank to collect meaningfully, say on the site's home page, the shortened URLs would be generated like this: /link?12345 instead of /link/12345. And then, the path /link would 301 to the home page. This way, the id is a param, not a path element. And thus, all the incoming shortened links are going to one path, which transfers pagerank to the home page. So that's my idea. I wanted to see if anybody could find problems with it. Thanks!

    Read the article

  • Parsing google site speed in analytics

    - by Kevin Burke
    I'm having a hard time making heads or tails of the Site Speed graphs in Google Analytics. Our site speed is fluctuating wildly from month to month, despite a large sample (the report is "based on 100,000's of visits) and a consistent web set up (static files served from an EC2 instance running nginx behind a load balancer). Here's our site speed, with each datapoint representing a week worth of data. Over this time period we modified our source and HTTP headers to increase our cache hits on static resources by 5x. Why would it fluctuate so much? Is there any way to get more reliable information from those graphs?

    Read the article

  • Optimization and Saving/Loading

    - by MrPlosion1243
    I'm developing a 2D tile based game and I have a few questions regarding it. First I would like to know if this is the correct way to structure my Tile class: namespace TileGame.Engine { public enum TileType { Air, Stone } class Tile { TileType type; bool collidable; static Tile air = new Tile(TileType.Air); static Tile stone = new Tile(TileType.Stone); public Tile(TileType type) { this.type = type; collidable = true; } } } With this method I just say world[y, x] = Tile.Stone and this seems right to me but I'm not a very experienced coder and would like assistance. Now the reason I doubt this so much is because I like everything to be as optimized as possible and there is a major flaw in this that I need help overcoming. It has to do with saving and loading... well more on loading actually. The way it's done relies on the principle of casting an enumeration into a byte which gives you the corresponding number where its declared in the enumeration. Each TileType is cast as a byte and written out to a file. So TileType.Air would appear as 0 and TileType.Stone would appear as 1 in the file (well in byte form obviously). Loading in the file is alot different though because I can't just loop through all the bytes in the file cast them as a TileType and assign it: for(int x = 0; x < size.X; x++) { for(int y = 0; y < size.Y; y+) { world[y, x].Type = (TileType)byteReader.ReadByte(); } } This just wont work presumably because I have to actually say world[y, x] = Tile.Stone as apposed to world[y, x].Type = TileType.Stone. In order to be able to say that I need a gigantic switch case statement (I only have 2 tiles but you could imagine what it would look like with hundreds): Tile tile; for(int x = 0; x < size.X; x++) { for(int y = 0; y < size.Y; y+) { switch(byteReader.ReadByte()){ case 0: tile = Tile.Air; break; case 1: tile = Tile.Stone; break; } world[y, x] = tile; } } Now you can see how unoptimized this is and I don't know what to do. I would really just like to cast the byte as a TileType and use that but as said before I have to say world[y, x] = Tile.whatever and TileType can't be used this way. So what should I do? I would imagine I need to restructure my Tile class to fit the requirements but I don't know how I would do that. Please help! Thanks.

    Read the article

  • Why does creating dynamic bodies in JBox2D freeze my app?

    - by Amplify91
    My game hangs/freezes when I create dynamic bullet objects with Box2D and I don't know why. I am making a game where the main character can shoot bullets by the user tapping on the screen. Each touch event spawns a new FireProjectileEvent that is handled properly by an event queue. So I know my problem is not trying to create a new body while the box2d world is locked. My bullets are then created and managed by an object pool class like this: public Projectile getProjectile(){ for(int i=0;i<mProjectiles.size();i++){ if(!mProjectiles.get(i).isActive){ return mProjectiles.get(i); } } return mSpriteFactory.createProjectile(); } mSpriteFactory.createProjectile() leads to the physics component of the Projectile class creating its box2d body. I have narrowed the issue down to this method and it looks like this: public void create(World world, float x, float y, Vec2 vertices[], boolean dynamic){ BodyDef bodyDef = new BodyDef(); if(dynamic){ bodyDef.type = BodyType.DYNAMIC; }else{ bodyDef.type = BodyType.STATIC; } bodyDef.position.set(x, y); mBody = world.createBody(bodyDef); PolygonShape dynamicBox = new PolygonShape(); dynamicBox.set(vertices, vertices.length); FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = dynamicBox; fixtureDef.density = 1.0f; fixtureDef.friction = 0.0f; mBody.createFixture(fixtureDef); mBody.setFixedRotation(true); } If the dynamic parameter is set to true my game freezes before crashing, but if it is false, it will create a projectile exactly how I want it just doesn't function properly (because a projectile is not a static object). Why does my program fail when I try to create a dynamic object at runtime but not when I create a static one? I have other dynamic objects (like my main character) that work fine. Any help would be greatly appreciated. This is a screenshot of a method profile I did: Especially notable is number 8. I'm just still unsure what I'm doing wrong. Other notes: I am using JBox2D 2.1.2.2. (Upgraded from 2.1.2.1 to try to fix this problem) When the application freezes, if I hit the back button, it appears to move my game backwards by one update tick. Very strange.

    Read the article

  • How do I manage dependencies for automated builds on my build server?

    - by Tom Pickles
    I'm trying to implement continuous integration into our day to day workings. In our team, we're moving from just building our code in Visual Studio on our workstations and deploying, to using MSBuild.exe and automating on our build server (which is Jenkins) without the use of Visual Studio. We have external dependencies to references such as Automap in our projects. Because the automap (for example) dll isn't on the build server, the msbuild execution fails, for obvious reasons. There are other dll's which I need to be part of the build, I'm just using automap as an example. So what's the best way to get any dependencies onto the build server as part of the automated build? I've seen references to using a 'lib' folder, but I don't really understand where I should be putting it (in my project, filesystem, SVN ...?), and how the build server will get to it. I've also read that NuGet can do something with dependencies, but my build server isn't connected to the internet, and I don't understand how I can get my build to pull a NuGet package I may have created, and how it works together. Edit: I'm using subversion and we cannot use TeamCity as we would have to buy it and there's zero chance of funding.

    Read the article

  • JQuery, Load() contents with plugins

    - by Galas
    I know this is not a completely new question, but none of the answers solved my problem... I have built a little menu that uses load() to load image galleries (as external html files) into a specified div ("content"). The said galleries make use of a JQuery plugin (SlideJS). Now I know that load() does not work for script tags and that I need to use $.getscript in the callback function in order to run the scripts, but it does not work. I have two .js files that need to be loaded: one is the plugin itself and another one is a smaller script with a preloader and the animations for the captions. I can't seem to merge them together; if I put them into the same document, the script won't run. So I tried just using $.getscript to load the two files. I tried using two callbacks as suggested in other answer (I know it's not ideal...): $("#proposal").click(function(){ $(this).addClass('selected'); $("a:not(:#proposal)").removeClass('selected'); $("#content").load("works/proposal/proposal.html", function(){ $.getScript("js/slide.js", function (){ $.getScript("js/slidepage.js"); }); }); }); and I tried a variable (read about it in some other faq, not sure if the syntax is correct) $("#proposal").click(function(){ $(this).addClass('selected'); $("a:not(:#proposal)").removeClass('selected'); $("#content").load("works/proposal/proposal.html", function(){ var scripts = ['js/slide.js','js/slidepage.js']; $.getScript(scripts); }); }); So none of these work. What am I doing wrong? I'm just starting on jquery and my js knowledge is very limited. Should I just merge the two .js files together using minify or something? One of them is already minified, but I've tried with a non-minified version and it does not work either. Can anyone suggest any other solution around this problem? I thought of just having the div embedded in the main document and just showing it on click, but I'll have at least 4 galleries with about 8 to 10 images each... its a lot of images to load in the main page, so I don't think its the best way. if you need me to post any more code, please ask! Thanks in advance for all your help!

    Read the article

  • git, SSH_ASKPASS on windows

    - by Martin Schreiber
    I am writing a graphical git frontend for Linux and Windows (MSEgit) based on MSEide+MSEgui. MSEgit has an internal console window which communicates with git by pipes. On Linux it uses a PTY so SSH asks for key unlocking passwords on the PTY. On Windows I wrote a small password entry application and set the SSH_ASKPASS environment variable accordingly. SSH calls the password application if git is started with CreateProcess() dwCreationFlags DETACHED_PROCESS set but the password entry window will not be focused, its taskbar icon flashes instead. SSH does not run the password application if FreeConsole() is called to be sure that there is no attached console to MSEgit and git is started without DETACHED_PROCESS but CREATE_NO_WINDOW instead. I assume a Windows equivalent of POSIX setsid() should be called. How can I force SSH to use SSH_ASKPASS without the DETACHED_PROCESS flag? If this is not possible, how can I ensure that the password entry window is focused?

    Read the article

  • Cakephp 1.3 Form Alignment?

    - by Sham Ali
    Hi Fellwos i am new at cakephp 1.3, i am trying to create a Edit User Form with Form Helper in Cakephp 1.3. i am unable to make a customize alignments of the form elements. for example echo $this-Form-create('Model', array('action' = 'edit_users','id' = 'UserForm')); echo $this-Form-input('First Name',array('style'='width:100px','label'='First Name:')); echo $this-Form-input('Last Name',array('style'='width:100px','label'='Last Name:')); echo $this-Form-input('Position',array('style'='width:100px','label'='Position:')); i want first two input fields in single line and 3rd input field in 2nd line, i have tried it with div false, but its not working. if anybody can help me, thanks in advance

    Read the article

  • Getting response status code 0 in SmartGWT webservice call using json

    - by Girish
    I have developed application using SmartGWT, now i need to call webservice using json to another application which is deployed in another server for submitting username and password. When i make a request with url and POST method, getting the response status code as 0 and response text as blank. Here is my code, public void sendRequest() throws Exception { // Get login json data to be sent to server. String strData = createLoginReqPacket(); String url = "some url"; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url); builder.setHeader("Content-Type", "application/json"); builder.setHeader("Content-Length", strData.length() + ""); Request response = builder.sendRequest(strData, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { int statusCode = response.getStatusCode(); System.out.println("Response code ----"+response.getStatusCode()+""); if (statusCode == Response.SC_OK) { String responseBody = response.getText(); System.out.println("Respose :" + responseBody); // do something with the response } else { GWT.log("Response error at server side ----",null); // do in case of server error } }// end of method. @Override public void onError(Request request, Throwable exception) { GWT.log("**** Error in service call ******",null); }// end of method. }); builder.send(); }// end of send request. Please anybody knows the solution?? Give some reference code or links for this. Thanks.

    Read the article

  • MSQL upgrade on Ubuntu - any heads ups?

    - by Rob Sedge
    I am needing to upgrade MYSQL on Ubuntu, it is a production server and naturally cautious. My many googles look to be essentially saying that I need to : 1) Backup my current mysql database and tables/data 2) Uninstall current mysql 3) Install new MYSQL 5+ 4) Restore Databases/ tables and data 5) Hope and Pray I got it right ?? Something doesn't seem right, sounds like a lot of down time and risk Am I missing something / or any simple solutions? Upgrading from mSQL 4 to 5 on Ubuntu 10 Many Thanks, Rob

    Read the article

  • How to read comma separated values from text file in JAVA?

    - by user1425223
    I have got this text file with latitude and longitude values of different points on a map. I want to store these coordinates into a mySQL database using hibernate. I want to know how can I split my string into latitudes and longitudes? What is the general way to do these type of things that is with other delimiters like space, tab etc.? File: 28.515046280572285,77.38258838653564 28.51430151808072,77.38336086273193 28.513566177802456,77.38413333892822 28.512830832397192,77.38490581512451 28.51208605426073,77.3856782913208 28.511341270865113,77.38645076751709 28.510530488025346,77.38720178604126 28.509615992924807,77.38790988922119 28.50875805732363,77.38862872123718 28.507994394490268,77.38943338394165 28.50728729434496,77.39038825035095 28.506674470385246,77.39145040512085 28.506174780521828,77.39260911941528 28.505665660113582,77.39376783370972 28.505156537248446,77.39492654800415 28.50466626846366,77.39608526229858 28.504175997400655,77.39724397659302 28.503685724059455,77.39840269088745 28.503195448440064,77.39956140518188 28.50276174118543,77.4007523059845 28.502309175192945,77.40194320678711 28.50185660725938,77.40313410758972 28.50140403738471,77.40432500839233 28.500951465568985,77.40551590919495 28.500498891812207,77.40670680999756 28.5000463161144,77.40789771080017 28.49959373847559,77.40908861160278 Code I am using to read from file: try { BufferedReader in = new BufferedReader(new FileReader("G:\\RoutePPAdvant2.txt")); String str; str = in.readLine(); while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } catch (IOException e) { System.out.println("File Read Error"); }

    Read the article

  • Get index values for an array to print in value attribute for radio buttons

    - by kexxcream
    Problem: To get the index values of an array to print accordingly in value attribute of radio buttons. The array $_SESSION['items']: Array ( [2] => Array ( [category] => 2 [question] => Array ( [6] => Källorna refereras separat [7] => Vissa försök till sammanbindning [8] => En del sammanfattningar [9] => Olika forskningslinjer jämförs och sammanfattas [10] => Kontraster, jämförelser, sammanfattningar; centrala likheter och skillnader framhävs ) [title] => Integration av källorna ) ) I have a PHP function that looks like this: function itemsLayout ($array) { for ($i = 1; $i <= count($array['question']); $i++) { $form .= '<input type="radio" name="'.$array['category'].'" id="'.$array['category'].'" value="INDEX VALUE FOR QUESTION ARRAY HERE">'; } return $form; } PHP code: I get the index by using the following: $key = key($_SESSION['items']); $current = $_SESSION['items'][$key]; And I print the first index by using: echo itemsLayout($current); Question: How do I get the index values 6, 7, 8, 9, 10 to print in the value attribute for each radio button?

    Read the article

  • generate an array from an array with conditions

    - by Aman
    Suppose i have an array $x = (31,12,13,25,18,10); I want to reduce this array in such a way that the value of each array element is 32. so after work my array will become $newx = (32,32,32,13); I have to generate this array in such a way the sum of array values is never greater than 32. so to create first value, i will reduce 1 from second index value i.e. 12, so the second value will become 11 and first index value will become 31+1 =32. This process should continue so that each array value becomes equal to 32.

    Read the article

  • Changing backgroundcolor in listview (expandable listview)

    - by Stofke
    I'm trying to dynamically change a backgroundcolor in a part of a listview, I have on example that works fine in a listview when I try to replicate it in another part with an expandable listview it fails This piece of code works and displays a different color if a student is online or not ... map.put(KEY_FIRSTNAME, temp.firstName); map.put(KEY_NAME, temp.name); map.put(KEY_EMAIL, temp.email); map.put(KEY_ISONLINE, temp.isOnLine); // change image if student is online or not Log.d("demo", "is on line= " + temp.isOnLine); if (temp.isOnLine.equalsIgnoreCase("1")) { map.put(KEY_IMAGE_ISONLINE, R.color.greenColor); } else { map.put(KEY_IMAGE_ISONLINE, R.color.greyColor); } listItem.add(map); } myListView = (ListView) findViewById(R.id.listViewTabLeerlingen); SimpleAdapter adapter = new SimpleAdapter(StudentTab.this, listItem, R.layout.list_item_student, new String[] { KEY_FIRSTNAME, KEY_NAME, KEY_IMAGE_ISONLINE }, new int[] { R.id.firstNameTextView, R.id.lastNameTextView, R.id.logo }); myListView.setAdapter(adapter); the xml that goes along with it <ImageView android:id="@+id/logo" android:layout_width="85dp" android:layout_height="match_parent" android:background="@color/greenColor" android:contentDescription="Image if student is online or not" android:src="@drawable/transparent_pixel" /> The above works fine however the following code (just part of the code) ... ArrayList<Map<String, Object>> children = new ArrayList<Map<String, Object>>(); for (int i = 0; i < _data.length(); i++) { try { JSONArray tmp = _data.getJSONArray(i); HashMap<String, Object> map = new HashMap<String, Object>(); // change image if student is online or not if (tmp.getString(3).equalsIgnoreCase("0")) { map.put(KEY_POINTS,R.color.redColor); }else{ map.put(KEY_POINTS,R.color.greenColor); } map.put(KEY_QUESTIONTEXT, tmp.getString(1)); map.put(KEY_ANSWER, tmp.getString(2)); children.add(map); } catch (JSONException e) { e.printStackTrace(); } childData.add(children); ... ... ArrayList<ArrayList<Map<String, Object>>> childData) { SimpleExpandableListAdapter listAdapter = new SimpleExpandableListAdapter( this, groupData, R.layout.list_item_results_students, new String[] { KEY_FIRSTNAME, KEY_NAME, KEY_ISJUIST }, new int[] { R.id.firstnameResults, R.id.nameResults, R.id.resultsTextView }, childData, R.layout.list_item_results_results, new String[] { KEY_QUESTIONTEXT, KEY_ANSWER, KEY_POINTS }, new int[] { R.id.questionTextView, R.id.answerTextTextView, R.id.score }); ExpandableListView myListView = (ExpandableListView) findViewById(R.id.listViewTabResultaten); myListView.setAdapter(listAdapter); with xml: <ImageView android:id="@+id/score" android:layout_width="16dp" android:layout_height="match_parent" android:background="@color/greenColor" android:contentDescription="Image if student has correct answer" android:src="@drawable/transparent_pixel" /> I will get this error: 06-09 10:35:21.490: E/AndroidRuntime(4406): java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView

    Read the article

  • C++: Calling class functions within a switch

    - by user1446002
    i've been trying to study for my finals by practicing classes and inheritance, this is what I've come up with so far for inheritance and such however I'm unsure how to fix the error occuring below. #include<iostream> #include<iomanip> #include<cmath> #include<string.h> using namespace std; //BASE CLASS DEFINITION class hero { protected: string name; string mainAttr; int xp; double hp; double mana; double armour; int range; double attkDmg; bool attkType; public: void dumpData(); void getName(); void getMainAttr(); void getAttkData(); void setAttkData(string); void setBasics(string, string, double, double, double); void levelUp(); }; //CLASS FUNCTIONS void hero::dumpData() { cout << "Name: " << name << endl; cout << "Main Attribute: " << mainAttr << endl; cout << "XP: " << xp << endl; cout << "HP: " << hp << endl; cout << "Mana: " << mana << endl; cout << "Armour: " << armour << endl; cout << "Attack Range: " << range << endl; cout << "Attack Damage: " << attkDmg << endl; cout << "Attack Type: " << attkType << endl << endl; } void hero::getName() { cout << "Name: " << name << endl; } void hero::getMainAttr() { cout << "Main Attribute: " << mainAttr << endl; } void hero::getAttkData() { cout << "Attack Range: " << range << endl; cout << "Attack Damage: " << attkDmg << endl; cout << "Attack Type: " << attkType << endl; } void hero::setAttkData(string attr) { int choice = 0; if (attr == "Strength") { choice = 1; } if (attr == "Agility") { choice = 2; } if (attr == "Intelligence") { choice = 3; } switch (choice) { case 1: range = 128; attkDmg = 80.0; attkType = 0; break; case 2: range = 350; attkDmg = 60.0; attkType = 0; break; case 3: range = 600; attkDmg = 35.0; attkType = 1; break; default: break; } } void hero::setBasics(string heroName, string attribute, double health, double mp, double armourVal) { name = heroName; mainAttr = attribute; hp = health; mana = mp; armour = armourVal; } void hero::levelUp() { xp = 0; hp = hp + (hp * 0.1); mana = mana + (mana * 0.1); armour = armour + ((armour*0.1) + 1); attkDmg = attkDmg + (attkDmg * 0.05); } //INHERITED CLASS DEFINITION class neutHero : protected hero { protected: string drops; int xpGain; public: int giveXP(int); void dropItems(); }; //INHERITED CLASS FUNCTIONS int neutHero::giveXP(int exp) { xp += exp; } void neutHero::dropItems() { cout << name << " has dropped the following items: " << endl; cout << drops << endl; } /* END OF OO! */ //FUNCTION PROTOTYPES void dispMenu(); int main() { int exit=0, choice=0, mainAttrChoice=0, heroCreated=0; double health, mp, armourVal; string heroName, attribute; do { dispMenu(); cin >> choice; switch (choice) { case 1: system("cls"); cout << "Please enter your hero name: "; cin >> heroName; cout << "\nPlease enter your primary attribute\n"; cout << "1. Strength\n" << "2. Agility\n" << "3. Intelligence\n"; cin >> mainAttrChoice; switch (mainAttrChoice) { case 1: attribute = "Strength"; health = 750; mp = 150; armourVal = 2; break; case 2: attribute = "Agility"; health = 550; mp = 200; armourVal = 6; break; case 3: attribute = "Intelligence"; health = 450; mp = 450; armourVal = 1; break; default: cout << "Choice invalid, please try again."; exit = 1; break; hero player; player.setBasics(heroName, attribute, health, mp, armourVal); player.setAttkData(attribute); heroCreated=1; system("cls"); cout << "Your hero has been created!\n\n"; player.dumpData(); system("pause"); break; } case 2: system("cls"); if (heroCreated == 1) { cout << "Your hero has been detailed below.\n\n"; **player.dumpData(); //ERROR OCCURS HERE !** system("pause"); } else { cout << "You have not created a hero please exit this prompt " "and press 1 on the menu to create a hero."; } break; case 3: system("cls"); cout << "Still Under Development"; system("pause"); break; case 4: system("cls"); exit = 1; break; default: cout << "Your command has not been recognised, please try again.\n"; system("pause"); break; } } while (exit != 1); system("pause"); return 0; } void dispMenu() { system("cls"); cout << "1. Create New Hero\n" "2. View Current Hero\n" "3. Fight Stuff\n" "4. Exit\n\n" "Enter your choice: "; } However upon compilation I get the following errors: 220 `player' undeclared (first use this function) Unsure exactly how to fix it as I've only recently started using OO approach. The error has a comment next to it above and is in case 2 in the main. Cheers guys.

    Read the article

  • display results of jquery in a label in asp.net

    - by Zoya
    I want to display result of this javascript in a label control on my asp.net page, instead of alert. how can i do so? <script type="text/javascript" language="Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <!-- Require EasyJQuery After JQuery --><script type="text/javascript" language="Javascript" src="http://api.easyjquery.com/easyjquery.js"></script> <script type="text/javascript" language="Javascript"> // 1. Your Data Here function my_callback(json) { alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY); } function my_callback2(json) { alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY + " City: " + json.cityName + " Region Name: " + json.regionName); } // 2. Setup Callback Function // EasyjQuery_Get_IP("my_callback"); // fastest version EasyjQuery_Get_IP("my_callback2","full"); // full version </script>

    Read the article

  • Bash alias and bash function with several arguments

    - by sanemat
    I want to use both bash alias and bash function with several arguments. I emulate svn sub commands. $ svngrep -nr 'Foo' . $ svn grep -nr 'Foo' . My expectation is both act as below: grep --exclude='*.svn-*' --exclude='entries' -nr 'Foo' . But actual, only alias ('svngrep') does well, function ('svn grep') causes invalid option error. How to write my .bashrc? #~/.bashrc alias svngrep="grep --exclude='*.svn-*' --exclude='entries'" svn() { if [[ $1 == grep ]] then local remains=$(echo $@ | sed -e 's/grep//') command "$svngrep $remains" else command svn "$@" fi }

    Read the article

  • Check if UINavigationItem title is truncated

    - by PartiallyFinite
    I want to check whether the title of a UINavigationItem is truncated. I set the title like this: self.navigationItem.title = whatever. I know I can check if the text in a UILabel is truncated like this: CGSize size = [label.text sizeWithFont:[UIFont fontWithName:@"myfont" size:18.0]]; if (size.width > label.bounds.size.width) { // set a shorter title } And I can even find the UINavigationItemView object in which the title is displayed like so: UIView *navItemView; for (UIView *view in self.navigationController.navigationBar.subviews) { if ([view isKindOfClass:NSClassFromString(@"UINavigationItemView")]) { navItemView = view; } } But I cannot apply this method to the navItemView because is always seems to have a width of exactly 58, which is much less than the title in it, so according to that, it would appear that the title is truncated, even when it isn't. So, my question comes down to this: How do I find the width of the title displayed in the UINavigationItem? UPDATE: I have found a solution to my problem, but it isn't exactly ideal, perfect, or reliable, so I am not marking it as an answer yet. If anyone has any better solutions, please share them.

    Read the article

  • Rails 3 Order By Count on has_many :through

    - by goo
    I have an application where I can list Items and add tags to each Item. The models Items and Tags are associated like this: class Item < ActiveRecord::Base has_many :taggings has_many :tags, :through => :taggings end class Tagging < ActiveRecord::Base belongs_to :item belongs_to :tag end class Tag < ActiveRecord::Base has_many :taggings has_many :items, :through => :taggings end So, this many-to-many relationship allows me to set n tags for each Item, and the same tag can be used several times. I'd like to list all tags ordered by the number of items associated with this tag. More used tags, shows first. Less used, last. How can I do that? Regards.

    Read the article

  • BigDecimal precision not persisted with javax.persistence annotations

    - by dkaczynski
    I am using the javax.persistence API and Hibernate to create annotations and persist entities and their attributes in an Oracle 11g Express database. I have the following attribute in an entity: @Column(precision = 12, scale = 9) private BigDecimal weightedScore; The goal is to persist a decimal value with a maximum of 12 digits and a maximum of 9 of those digits to the right of the decimal place. After calculating the weightedScore, the result is 0.1234, but once I commit the entity with the Oracle database, the value displays as 0.12. I can see this by either by using an EntityManager object to query the entry or by viewing it directly in the Oracle Application Express (Apex) interface in a web browser. How should I annotate my BigDecimal attribute so that the precision is persisted correctly? Note: We use an in-memory HSQL database to run our unit tests, and it does not experience the issue with the lack of precision, with or without the @Column annotation.

    Read the article

  • How to build a control programatically?

    - by W_K
    I have custom control written in Java. For the sake of simplicity lets assume that it looks like this: public class HelloworldControl extends UIComponentBase { @Override public void decode(FacesContext context) { String cid = this.getClientId(context); ... super.decode(context); } @Override public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.writeText("Hello world!", this); // I want a view!! } @Override public void encodeEnd(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); ... } public void restoreState(FacesContext context, Object state) { Object values[] = (Object[]) state; ... super.restoreState(context, values[0]); } public Object saveState(FacesContext context) { Object values[] = ... } } I would like to add programatically child control to it. For example I would like a child view control to render a view just under the Hellow world text. How can i do this? What is the standard procedure to build dynamically a control? To put it simply - I want programatically build a hierarchy of standard components and I want to attach it to my control.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >