Daily Archives

Articles indexed Sunday November 11 2012

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

  • Problem Installing Ubuntu 12.04 - [Errno 5]

    - by Rob Barker
    I'm trying to intall Ubuntu 12.04 to my brand new eBay purchased hard drive. Only got the drive today and already it's causing me problems. The seller is a proper proffesional company with 99.9% positive feedback, so it seems unlikely they would have sold me something rubbish. My old hard drive packed up last Tuesday and so i bought a new one to replace it. Because this was an entirely new drive i decided to install Ubuntu as there was no current operating system. My computer is an eMachines EM250 netbook. There's no disc drive so i am installing from a USB stick. The new operating system loads beautifully, and the desktop appears just as it should. When i click install i am taken to the installer which copies the files to about 35% and then displays this: [Errno 5] Input/output error This is often due to a faulty CD/DVD disk or drive, or a faulty hard disk. It may help to clean the CD/DVD, to burn the CD/DVD at a lower speed, to clean the CD/DVD drive lens (cleaning kits are often available from electronics suppliers), to check whether the hard disk is old and in need of replacement, or to move the system to a cooler environment. The hard drive can be heard constantly crackling. When i booted Ubuntu 12.04 from my old faulty hard drive as a test, i didn't even make it past the purple Ubuntu screen, so it can't be that bad. Any ideas? Message to the moderators. Please do not close this thread. I'm well aware there may be other threads on this, but i don't want it closing as the others do not provide the answer i am looking for. Thank you.

    Read the article

  • Jupiter does not start

    - by Prasil Koirala
    I am new to Ubuntu Currently using Ubuntu 12.04 LTS (Precise) I installed Jupiter using: sudo add-apt-repository ppa:webupd8team/jupiter sudo apt-get update sudo apt-get install jupiter Installation went fine. Searched for the application and tried to run it. But instead i was greeted with an error message claiming system error. What is the problem? Tried installing it again but no change. Please Help!

    Read the article

  • AMD E1-1200 Slow?

    - by Tim Rijckaert
    I recently installed Ubuntu 12.04 32bit with Gnome 3 on a Toshiba 850D-104 for a friend of mine. This friend only surfs the web, checks for emails and plays online flash games a lot I was chocked to see that the laptop was rather sluggish. I mean you get what you pay for, with this kind of processor (AMD E1-1200, dual-core 1.4Ghz), but it's a bit too much! It takes 10 seconds to just open up Chromium (1 tab!) not to mention when he plays a flash-game it's stuttery and becomes unplayable. What can I do? I already tried Lubuntu, but it's not that much faster. I checked the resources and the ram is only 300Mb from the 6Gig installed? The Graphics card is a AMD HD Radeon 7310 (and the FGLRX-driver is installed) Any solutions for a sluggish Flash experience on Ubuntu? Thanks

    Read the article

  • Website URL layout & structure for SEO & PR

    - by Junaid Saeed
    i have already mastered the skills of building a page to comply with SEO requirements. What i want to do is customize the URL based parameters for best SEO & PR. I run wallpapers blog wallz which provides different resolution desktop wallpapers I am thinking about expanding the site to provide wallpapers for multiple devices like iphone, android, pc etc etc My goal is to provide users ease by detecting their devices and directing them to the relative portion of site, keeping that in mind also keep my URLs in a SEO friendly manner. i have the following two options for my URL structure wallpapers.com \ iphone \ **or** iphone . wallpapers . com wallpapers.com \ galaxyS3 \ **or** galaxys3 . wallpapers . com subdomain or subfolders, which one is a better option, i will separate interfaces for ever subdomain\subfolder basing on the specific device. And after this the URL structure will be like wallpapers.com \ galaxyS3 \ Cars \ Ferrai 550 . html galaxys3.wallpapers.com \ Cars \ Ferrai 550 . html what is the better way for me to proceed in

    Read the article

  • HTML5 Audio: Which formats? Ditch Ogg Vorbis in favor of Ogg Opus? Is MP3 still needed?

    - by phoibos
    I'm currently working on a website which has to stream audio files. Since bandwidth is always an issue, the file size should be as small as possible. I wonder what audio formats I should provide. MP3 - Most common format but low quality, I don't know if it's even required, since AAC is well supported by the browsers incapable of playing free codecs MP4 AAC - Nice quality / small filesize, supported by Safari / Mobile Devices / IE9 / Flash / Chrome A free codec - well, until recently, there only was Ogg Vorbis, but Ogg Opus is standardized now and it's really good! Questions: Is it time yet to use Opus instead if Vorbis? Firefox supports Opus since version 15, and Opera has support on its roadmap - I guess Chrome will follow in the future too. Do I still have to provide an MP3 file?

    Read the article

  • Foundation CSS Framework, how to change triangle on accodion [migrated]

    - by CreateSean
    I'm using foundation framework for the first time and for the most part everything is going smoothly. I am however having some trouble with the accordion in that I need to change the open/close indicator triangle that is in use. You can see it in the docs here. I've looked through the css and found the section with the accordion on foundation.css at lines 709-719 but there is no image to change or adjust. I would like to change this icon to the one in my psd, but just can't figure out where. See attached screenshot for what needs to be changed. I know how to make changes, in this case I just can't find where to make the change.

    Read the article

  • Custom inventory items based on inheritance

    - by Bogdan Marginean
    So, here's the scenario: I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast. In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior. This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item? Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only. Development is done in C#, inside Unity 3.5. Thanks!

    Read the article

  • Opposite Force to Apply to a Collided Rigid Body?

    - by Milo
    I'm working on the physics for my GTA2-like game so I can learn more about game physics. The collision detection and resolution are working great. I'm now just unsure how to compute the force to apply to a body after it collides with a wall. My rigid body looks like this: /our simulation object class RigidBody extends Entity { //linear private Vector2D velocity = new Vector2D(); private Vector2D forces = new Vector2D(); private float mass; private Vector2D v = new Vector2D(); //angular private float angularVelocity; private float torque; private float inertia; //graphical private Vector2D halfSize = new Vector2D(); private Bitmap image; private Matrix mat = new Matrix(); private float[] Vector2Ds = new float[2]; private Vector2D tangent = new Vector2D(); private static Vector2D worldRelVec = new Vector2D(); private static Vector2D relWorldVec = new Vector2D(); private static Vector2D pointVelVec = new Vector2D(); private static Vector2D acceleration = new Vector2D(); public RigidBody() { //set these defaults so we don't get divide by zeros mass = 1.0f; inertia = 1.0f; setLayer(LAYER_OBJECTS); } protected void rectChanged() { if(getWorld() != null) { getWorld().updateDynamic(this); } } //intialize out parameters public void initialize(Vector2D halfSize, float mass, Bitmap bitmap) { //store physical parameters this.halfSize = halfSize; this.mass = mass; image = bitmap; inertia = (1.0f / 20.0f) * (halfSize.x * halfSize.x) * (halfSize.y * halfSize.y) * mass; RectF rect = new RectF(); float scalar = 10.0f; rect.left = (int)-halfSize.x * scalar; rect.top = (int)-halfSize.y * scalar; rect.right = rect.left + (int)(halfSize.x * 2.0f * scalar); rect.bottom = rect.top + (int)(halfSize.y * 2.0f * scalar); setRect(rect); } public void setLocation(Vector2D position, float angle) { getRect().set(position.x,position.y, getWidth(), getHeight(), angle); rectChanged(); } public Vector2D getPosition() { return getRect().getCenter(); } @Override public void update(float timeStep) { doUpdate(timeStep); } public void doUpdate(float timeStep) { //integrate physics //linear acceleration.x = forces.x / mass; acceleration.y = forces.y / mass; velocity.x += (acceleration.x * timeStep); velocity.y += (acceleration.y * timeStep); //velocity = Vector2D.add(velocity, Vector2D.scalarMultiply(acceleration, timeStep)); Vector2D c = getRect().getCenter(); v.x = getRect().getCenter().getX() + (velocity.x * timeStep); v.y = getRect().getCenter().getY() + (velocity.y * timeStep); setCenter(v.x, v.y); forces.x = 0; //clear forces forces.y = 0; //angular float angAcc = torque / inertia; angularVelocity += angAcc * timeStep; setAngle(getAngle() + angularVelocity * timeStep); torque = 0; //clear torque } //take a relative Vector2D and make it a world Vector2D public Vector2D relativeToWorld(Vector2D relative) { mat.reset(); Vector2Ds[0] = relative.x; Vector2Ds[1] = relative.y; mat.postRotate(JMath.radToDeg(getAngle())); mat.mapVectors(Vector2Ds); relWorldVec.x = Vector2Ds[0]; relWorldVec.y = Vector2Ds[1]; return relWorldVec; } //take a world Vector2D and make it a relative Vector2D public Vector2D worldToRelative(Vector2D world) { mat.reset(); Vector2Ds[0] = world.x; Vector2Ds[1] = world.y; mat.postRotate(JMath.radToDeg(-getAngle())); mat.mapVectors(Vector2Ds); worldRelVec.x = Vector2Ds[0]; worldRelVec.y = Vector2Ds[1]; return worldRelVec; } //velocity of a point on body public Vector2D pointVelocity(Vector2D worldOffset) { tangent.x = -worldOffset.y; tangent.y = worldOffset.x; pointVelVec.x = (tangent.x * angularVelocity) + velocity.x; pointVelVec.y = (tangent.y * angularVelocity) + velocity.y; return pointVelVec; } public void applyForce(Vector2D worldForce, Vector2D worldOffset) { //add linear force forces.x += worldForce.x; forces.y += worldForce.y; //add associated torque torque += Vector2D.cross(worldOffset, worldForce); } @Override public void draw( GraphicsContext c) { c.drawRotatedScaledBitmap(image, getPosition().x, getPosition().y, getWidth(), getHeight(), getAngle()); } public Vector2D getVelocity() { return velocity; } public void setVelocity(Vector2D velocity) { this.velocity = velocity; } } The way it is given force is by the applyForce method, this method considers angular torque. I'm just not sure how to come up with the vectors in the case where: RigidBody hits static entity RigidBody hits other RigidBody that may or may not be in motion. Would anyone know a way (without too complex math) that I could figure out the opposite force I need to apply to the car? I know the normal it is colliding with and how deep it collided. My main goal is so that say I hit a building from the side, well the car should not just stay there, it should slowly rotate out of it if I'm more than 45 degrees. Right now when I hit a wall I only change the velocity directly which does not consider angular force. Thanks!

    Read the article

  • How to had operation with character/items on binary with concrete operations on C++?

    - by Piperoman
    I have the next problem. A item can had a lot of states: NORMAL = 0000000 DRY = 0000001 HOT = 0000010 BURNING = 0000100 WET = 0001000 COLD = 0010000 FROZEN = 0100000 POISONED= 1000000 A item can had some states at same time but not all of them Is impossible to be dry and wet at same time. If you COLD a WET item, it turns into FROZEN. If you HOT a WET item, it turns into NORMAL A item can be BURNING and POISON Etc. I have try to set binary flags to states, and use AND to set operation to combine different states, checking before if is possible or not to do it, or change to another status. Exist a concrete patron to solve this problem efficiently without had a interminable switch that check every states with everynew states? It is relative easy to check 2 different states, but if exist a third state it is not trivial to do.

    Read the article

  • didSelectRowAtIndexPath being called after viewDidLoad of the called view

    - by Serguei Fedorov
    I am trying to pass variables over to the new view. I have the following code: appDelegate *dataCenter = (AppDelegate*)[[UIApplication sharedApplication] delegate]; dataCenter.myVariable = [array objectAtIndex:indexPath.row]; in the didSelectRowAtIndexPath of the calling view. However, the issue that I have is that this variable is empty in the vewDidLoad function of the next view, simply because it fired off BEFORE the didSelectRowAtIndexPath of the calling view. I am using storyboard to link the views together. Both are UITableView. If I hit back and then reselect the table element it is then set, granted that by the time I hit back and then selected again, the variable got set. Is there any way to for the order of execution? I really don't want to do UI view switching on the back end. Any help is greatly appreciated!

    Read the article

  • Select multi-select form from array

    - by Budove
    Here's the issue. I have a database column called pymnt_meth_pref, which contains a comma separated string of payment methods chosen from a multiselect form. <td>Payment Methods Used:<br /> <input type="checkbox" name="pyment_meth_pref[]" value="Cash">I can pay with cash.<br /> <input type="checkbox" name="pyment_meth_pref[]" value="Check">I can pay by check.<br /> <input type="checkbox" name="pyment_meth_pref[]" value="Credit Card">I can pay by credit card.<br /> <input type="checkbox" name="pyment_meth_pref[]" value="Paypal">I can pay with Paypal.<br /> </td> This array is posted to a variable and turned into a comma separated string if (isset($_POST['pyment_meth_pref'])) $pymntmethpref = implode(", ", $_POST['pyment_meth_pref']); if (isset($_POST['pyment_meth_acc'])) $pymntmethacc = implode(", ", $_POST['pyment_meth_acc']); This is then inserted into the database as a comma separated string. What I would like to do, is take this string and apply the values to the original form when the user goes back to the form as 'pre-selected' checkboxes, indicated that the user has already selected those values previously, and keeping those values in the database if they choose to edit any other information in the form. I'm assuming this would need to be done with javascript but if there is a way to do it with PHP I'd rather do it that way.

    Read the article

  • ListView getting deleted onbackpress

    - by adohertyd
    I have a listview in my mainactivity that makes a call to a database to populate it. When an item on the listview is clicked it starts a new activity showing the details of the item that was clicked. When the back button is pressed the listview is not displayed again. What could be the problem? This is the entirety of my mainactivity: public class MainActivity extends ListActivity { Button bAddMod; private ModuleDB db; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new ModuleDB(this); db.open(); fillList(); db.close(); bAddMod = (Button) findViewById(R.id.btnAddMod); bAddMod.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(MainActivity.this, AddModule.class); startActivity(i); } }); } private void fillList() { ListView lv = getListView(); Cursor curs = db.getData(); startManagingCursor(curs); MyCursorAdapter adapter = new MyCursorAdapter(getApplicationContext(), curs); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id){ Intent k = new Intent(MainActivity.this, ModuleDetails.class); k.putExtra("mod_id", id); startActivity(k); } }); } }

    Read the article

  • What is the differance between those two Strings in Java

    - by user1816808
    why when we declare string in java we can't use == to compare this string and always will turn to false while if we initialize the string from the beginning it will be true . for example : import java.util.Scanner; public class MyString { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); String s = input.nextLine(); if(s=="Hello") system.out.println("Hello"); String d = "Hello"; if(d=="Hello") system.out.println("Hello"); } } I need an explanation please ??

    Read the article

  • Where can I download an SBT 0.13 snapshot package?

    - by Ivan
    Being stuck with a scala 2.9 compiler bug I've decided to try moving to Scala 2.10 RC. As a part of the switch I was trying to install SBT 0.13 snapshot. The official web page lists a broken link: http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt//0.13.0-SNAPSHOT/sbt.tgz There is nothing about 0.13 in the directory, the link gives Error 404. Any ideas about where to get the file?

    Read the article

  • One input file to multiple output files

    - by user1265669
    I found some helpful stuff on this site but my input file is different from the examples already posted and I cannot make the leap in an efficient manner. My input file looks like this: sample_dude data1 data2 data3 data4 sample_lady data5 data6 data7 data8 sample_dude data9 data10 data11 data12 sample_child data13 data14 data15 data16 I want to create a separate file for each sample with all the data columns. For example, one file would be called sample_dude.txt and look like this: data1 data2 data3 data4 data9 data10 data11 data12 There is an unknown number of samples but always just four data columns. Any help greatly appreciated. Thank you. PS: I'm trying to do this in python.

    Read the article

  • calling same function on different buttons not loaded yet

    - by Jordan Faust
    I can not get this to work for every button and I cannot find anything explaining why. I guessing it is something small that I am missing $(document).ready(function() { // delete the selected row from the database $(document).on('click', '#business-area-delete-button', { model: "BusinessArea" }, deleteRow); $(document).on('click', '#business-type-delete-button', { model: "BusinessType" }, deleteRow); $(document).on('click', '#client-delete-button', { model: "Client" }, deleteRow); $(document).on('click', '#client-type-delete-button', { model: "ClientType" }, deleteRow); $(document).on('click', '#communication-channel-type', { model: "CommunicationChannelType" }, deleteRow); $(document).on('click', '#parameter-type-delete-button', { model: "ParameterType" }, deleteRow); $(document).on('click', '#validation-method-delete-button', { model: "ValidationMethod" }, deleteRow); } the event function deleteRow(event){ $.ajax( { type:'POST', data: { id: $(".delete-row").attr("id") }, url:"/mysite/admin/delete" + event.data.model, success:function(data,textStatus){ $('#main-content').html(data); }, error:function(XMLHttpRequest,textStatus,errorThrown){ jQuery('#alerts').html(XMLHttpRequest.responseText); }, complete:function(XMLHttpRequest,textStatus){ placeAlerts() } } ); return false }; This works only for a the button with id validation-method-delete-button. I use document and not the button its self because the button is contained in a template that is loaded later via ajax. I have this working for a similar function that is selecting a row in a table however I am not attempting to pass data in that scenario.

    Read the article

  • Splitting up input using regular expressions in Java

    - by Joe24
    I am making a program that lets a user input a chemical for example C9H11N02. When they enter that I want to split it up into pieces so I can have it like C9, H11, N, 02. When I have it like this I want to make changes to it so I can make it C10H12N203 and then put it back together. This is what I have done so far. using the regular expression I have used I can extract the integer value, but how would I go about get C10, H11 etc..? System.out.println("Enter Data"); Scanner k = new Scanner( System.in ); String input = k.nextLine(); String reg = "\\s\\s\\s"; String [] data; data = input.split( reg ); int m = Integer.parseInt( data[0] ); int n = Integer.parseInt( data[1] );

    Read the article

  • Find first item inside angular brackets after occurrence of other item, using RegEx, in C#

    - by Mihaela
    I have an xml-like text, in which I would like to find the item that occurs in the first occurrence of a certain pattern: typically: ... <PropertyGroup><name>true</name></PropertyGroup><PropertyGroup>.... .... Could also be ... <PropertyGroup> <name> true</name> </PropertyGroup> ... <PropertyGroup> ... In the above, I need to extract the "name". My initial assumption was that all occurrences were to be in one line, and I wrote my code using string properties, but it is very difficult o take in consideration every possibility, and only RegEx can save me. I just don't know how to write it... I Have started with something like this: Regex regex = new Regex("(?<=<PropertyGroup>#)<+"); Match matches = regex.Matches(Text)[0]; MessageBox.Show(matches.ToString()); I think this finds the first item after a <PropertyGroup>, but I don't know how to make it get the item within the angular brackets... (which may be after one or more newlines, and/or spaces). I know that there are utilities for parsing xml, but I am looking for something simple to insert in a c# program Can someone please help me ? Thank you very much.

    Read the article

  • How do I gather a class' css attributes given nothing but the className?

    - by user1128571
    For example I might have some css stuff that looks like this: .divType1 { position: absolute; width: 60px; height: 60px; left: 400px; top: 100px; border: 1px solid #89B; z-index: 0; } Now within Javascript I want to gather div class divType1' css attributes, but am provided only with the div class, so I can't do something of form ( pseudo-code ): selectDivWithClass( divType1 ).getCss(left). I could hack something by instantiating a div with class divType1 and grab its css attributes, and then destroy it, but is there a better way?

    Read the article

  • TextColor not showing when row backgroundcolor set

    - by RuAware
    if my row is colored red the text wont set to green and bold italic. When debugging I can see it telling the TextView to set each textViews setting. Thanks TableRow row = new TableRow(getContext()); row.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); String[] items = list.get(l).split(":"); for(int i=0; i < items.length; i++){ //see if i need to colour row if(items[i].startsWith("colorme_") == true) { if (items[i].substring(8).equals("red") == true) { row.setBackgroundColor(Color.RED); } } else { //create a temp textview then add to row TextView tempTV = new TextView(getContext()); tempTV.setText(items[i].toString()); //test against correct answers and colour text view green if correct if (correctAnswers != null && correctAnswers.size() > i) { if (correctAnswers.get(i).equals(items[i].toString()) == true) { tempTV.setTextColor(Color.GREEN); tempTV.setTypeface(null, Typeface.BOLD_ITALIC); } } row.addView(tempTV,lpTextView); } } //add the row tempTable.addView(row);

    Read the article

  • innter.HTML not working after submit button is clicked

    - by user1781453
    I am trying to get the innerHTML to change to what is in the end of the function "calculate" but nothing happens once I hit submit. Here is my code: Pizza Order Form .outp {border-style:solid;background-color:white; border-color:red;padding:1em; border-width: .5em;} .notes {font-size:smaller;font-style:italic;} p {margin-left: 15%; width: 65%;} textarea {resize : none;} </style> function calculate(){ var type; var newline=""; var sum=0; var toppings=""; if( document.getElementById("small").checked==true){ type="Small Pizza"; sum+=4; } if( document.getElementById("medium").checked==true){ type="Medium Pizza"; sum+=6; } if( document.getElementById("large").checked==true){ type="Large Pizza"; sum+=8; } if( document.getElementById("pepperoni").checked==true){ toppings=toppings+"pepperoni, "; sum+=0.75; } if( document.getElementById("olives").checked==true){ toppings=toppings+"olives, "; sum+=0.6; } if( document.getElementById("sausage").checked==true){ toppings=toppings+"sausage, "; sum+=0.75; } if( document.getElementById("peppers").checked==true){ toppings=toppings+"peppers, "; sum+=0.5; } if( document.getElementById("onions").checked==true){ toppings=toppings+"onions, "; sum+=0.5; } if( document.getElementById("cheese").checked==true){ toppings=toppings+"Cheese Only, "; } var length = toppings.length; toppings = toppings.slice(0,length-2); document.getElementById("opta").innerHTML = type+newline+"Toppings:"+newline+toppings+newline+"Price - $"+sum; } Joe's Pizza Palace On-line Order Form <p id = "op" class = "outp" > <b /> Select the size Pizza you want: &nbsp;&nbsp; <input type="radio" name = "size" id="small" value = "small"> Small - $4.00 <b /> <input type="radio" name = "size" id="medium" value = "medium"> Medium - $6.00 <b /> <input type="radio" name = "size" id="large" value = "large"> Large - $8.00 <b /> </p> <p id = "op1" class = "outp" > <b /> Select the toppings: &nbsp;&nbsp; <input type="checkbox" name = "size" id="pepperoni" value = "pepperoni"> Pepperoni ($0.75) <b /> <input type="checkbox" name = "size" id="olives" value = "olives"> Olives ($0.60) <b /> <input type="checkbox" name = "size" id="sausage" value = "sausage"> Sausage ($0.75) <b /> <br /> <input type="checkbox" name = "size" id="peppers" value = "peppers"> Peppers ($0.50) <b /> <input type="checkbox" name = "size" id="onions" value = "onions"> Onions ($0.50) <b /> <input type="checkbox" name = "size" id="cheese" value = "cheese"> Cheese Only <b /> To obtain the price of your order click on the price button below: <br /><br /> <input type="button" align = "left" onclick="calculate();" value="Price (Submit Button)"/> <input type="reset" align = "left" value="Clear Form"/> <br /><br /> <textarea class="outp3" id="opta" style="border-color:black;" rows="6" cols="40" > </textarea>

    Read the article

  • how am I supposed to call the function?

    - by user1816768
    I wrote a program which tells you knight's movement (chess). For example if I wanted to know all possible moves, I'd input: possibilites("F4") and I'd get ['D3', 'D5', 'E2', 'E6', 'G2', 'G6', 'H3', 'H5'] as a result, ok I did that, next, I had to write a function in which you input two fields and if those fields are legal, you'd get True and if they're not you'd get False(I had to use the previous function). For example: legal("F4","D3") >>>True code: def legal(field1,field2): c=possibilities(field1) if field1 and field2 in a: return True return False I'm having a problem with the following function which I have to write: I have to put in path of the knight and my function has to tell me if it's legal path, I'm obliged to use the previous function. for example: >>> legal_way(["F3", "E1", "G2", "H4", "F5"]) True >>> legal_way(["F3", "E1", "G3", "H5"]) False >>> legal_way(["B4"]) True I know I have to loop through the list and put first and second item on it in legal(field1,field2) and if it's false, everything is false, but if it's true I have to continue to the end, and this has to work also if I have only one field. I'm stuck, what to do? def legal_way(way): a=len(way) for i in range(0,a-2): if a==1: return true else if legal(way[i],way[i+1]: return True return False and I get True or index out of range

    Read the article

  • A pattern matching an expression that doesn't end with specific sequence

    - by patryk
    I need a regex pattern which matches such strings that DO NOT end with such a sequence: \.[A-z0-9]{2,} by which I mean the examined string must not have at its end a sequence of a dot and then two or more alphanumeric characters. For example, a string /home/patryk/www and also /home/patryk/www/ should match desired pattern and /home/patryk/images/DSC002.jpg should not. I suppose this has something to do with lookarounds (look aheads) but still I have no idea how to make it. Any help appreciated.

    Read the article

  • How to put a pre-existing sqlite file into <Application_Home>/Library/?

    - by Byron Cox
    My app uses Core Data. I have run the app in the simulator which has successfully created and populated the corresponding sqlite file. I now want to get this pre-existing sqlite file on to an actual device and be part of my app. I have located the simulator generated sqlite file at /Library/Application Support/iPhone Simulator/6.0/Applications/identifier/Documents/myapp.sqlite and dragged it into Xcode. This has added it to my application bundle but not in an appropriate directory (with the consequence that the sqlite file can be read but not written to). From reading about the file system I believe that the best place to put the sqlite file would be in a custom directory 'Database' under Application_Home/Library/. I don't seem to be able to do this within Xcode and despite searching I am unable to figure out how to do the following: (1) Create a sub-directory called 'Database' in Application_Home/Library/ ? (2) Transfer the sqlite file to my newly created 'Database' directory ? Many thanks to @Daij-Djan of his answer below. One other question: the path to the sqlite file will be used by the persistent store coordinator. Now depending on the size of the sqlite file it may take a while to copy or move. How can you ensure that the example code provided by @Daij-Djan has executed and finished before the persistent store coordinator tries to reference the sqlite file? Thanks for any help in advance.

    Read the article

  • How can i programmatically use aero snap features from C# code

    - by user1739957
    I have a simple question. How can I access aero snap programmatically from my C# code. Like, if I click a button "Snap Left", I want my program window to snap to the left, just like when its drug over there manually. I looked all over SO, but all the questions seem to be about aero snap not working with a form, and keeping it from snapping a form. Not programmatically snapping a form. I'm happy to use interloping. Thanks

    Read the article

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