Daily Archives

Articles indexed Friday December 31 2010

Page 15/30 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • keyboard works in the BIOS(except a), but not at the password screen(win 7, 64bit)

    - by christoffer svendsen
    The computer is a acer aspire 7720g laptop. When windows want me to input my password, the only keys working is caps lock, the numpad and the m key(and the m key works like a combined m and enter key). I did spill some water on the keyboard yesterday but the same thing happens with usb keyboards. I disabled the quick boot in the bios, making it go through every test at bootup, which resulted in continous beeping from the computer. Anyone know how to solve this?

    Read the article

  • LAN cable not connected, but it is

    - by Koen
    I have a Windows XP SP2 desktop PC. It connects to the internet with a LAN cable (there's a wireless router for my laptop in between). The problem should be software because: when i tried connecting the same LAN cable to my laptop it works when i plugin the LAN cable (onboard) the green light is on and the orange light flickers when i tried the other cable (that feeds the wireless router) i have the same problem it worked a few days ago, nothing specific changed I tried removing the ethernet card from the device manager, and windows automatically reinstalled it. What could cause this? What can I try?

    Read the article

  • What advantage does a 2400x600 dpi printer have over a 1200x1200 dpi printer?

    - by Cygon
    I've seen laser printers with a resolutions of 1200x1200 dpi and, strangely, 2400x600 dpi. As the measure is dots per inch, not Kdots on a page or something (where a higher vertical resolution might make sense because paper is rectangular, not square), I'm wondering what the uneven resolution is good for. Why print one square inch with 2400 dots vertically but only 600 horizontally? Does this look more detailed than 1200 by 1200 dots? Or is it better for textile printing or some other special case?

    Read the article

  • Accessing Windows 7 Printer from Ubuntu Linux via LPR/LPD or Samba

    - by nitbuntu
    Hi, I'm having difficulty printing from my Linux (Ubuntu 10.04) based PC to a printer connected to a Windows 7 machine. I was trying to connect using Samba (version 3.5.6) but this always brings up an authentication screen which never accepts any password I use. So I read somewhere that an alternative is to access the Windows printer via LPR/LPD. I added an LPR/LPD printer in Windows 7, but even within Windows 7, I am not able to print as the print que monitor shows as 'printer busy'. The printer in question is an Epson Stylus DX7400 and works fine when using the standard USB ports....but doesn't when I use with the LPR/LPD ports. I even opened up the TCP/IP port 515 in my McAfee firewall without any success. Any help with this would be highly appreciated. Additionally, does anyone have any idea how I can get Samba working for me?

    Read the article

  • gmail download by POP3 won't download all emails. How to reset all emails to not downloaded so that ALL will download?

    - by Rob
    I want to download emails from gmail using POP3 with Outlook Express. It downloads about 350 or so emails but doesn't download the remainder - there are over 2000 emails. The emails downloaded are not recent. I've tried disabling and re-enabling POP options in the settings in gmail itself but this doesn't fix the issue. Any ideas? Failing that I would use IMAP. I would try to then copy it locally on my machine to the standard POP Inbox folder in Outlook Express so that Express Archiver (a separate program) can then archive each email as a file with meaningful file names (e.g. subject, sender). I want to download email because I archive back it up with project work material it relates to, so it is all in one place.

    Read the article

  • 2010 Goals Review

    - by andyleonard
    Introduction Earlier this year, I responded to Tim Ford's ( Blog / Twitter ) tag (in a post about 2010 Resolutions and Themeword ) with 2010 Themeword and Goals . Let's see how I did. Resolutions 1. I need to take better care of Andy. On this, I failed. I took even worse care of myself than before. I have to address this in 2011. You can help by pinging me on Twitter ( @AndyLeonard ) every day in 2011 and ask me if I've exercised today. 2. I want to continue to serve the SQL Server community in several...(read more)

    Read the article

  • Virtualbox will run from 32bit installation CD but not 64bit.

    - by MetaDark
    I am trying to set up Windows in Virtual Box, so I don't need to reboot in the rare occasion that I actually need it. The problem is, Virtual Box doesn't preform any errors when I insert the 32bit installation CD but when I try to use the 64bit installation; What!? I am already using the installation disc! I've checked my BIOS to see if I have SVM (AMD's version of VT) disabled and all I see is "Enabled" I have a K9N6PGM2-V2 motherboard A Triple Core AMD Athlon II A Nvdia NForce 430 integrated graphics card 4GB of RAM An 80GB IDE And a 1TB SATA I don't think the last three specifications matter but just in case XP I am pretty sure the CD isn't broken ( I am going to make sure in just a moment ), what could be the cause to this problem? Edit: The 64bit installation CD is not broken, but I found out when trying to install from the 32bit version that it's trying to upgrade, not preform a fresh install - Odd.

    Read the article

  • Update transaction in SQL Server 2008 R2 from ASP.Net not working

    - by Amarus
    Hello! Even though I've been a stalker here for ages, this is the first post I'm making. Hopefully, it won't end here and more optimistically future posts might actually be me trying to give a hand to someone else, I do owe this community that much and more. Now, what I'm trying to do is simple and most probably the reason behind it not working is my own stupidity. However, I'm stumped here. I'm working on an ASP.Net website that interacts with an SQL Server 2008 R2 database. So far everything has been going okay but updating a row (or more) just won't work. I even tried copying and pasting code from this site and others but it's always the same thing. In short: No exception or errors are shown when the update command executes (it even gives the correct count of affected rows) but no changes are actually made on the database. Here's a simplified version of my code (the original had more commands and tons of parameters each, but even when it's like this it doesn't work): protected void btSubmit_Click(object sender, EventArgs e) { using (SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString)) { string commandString = "UPDATE [impoundLotAlpha].[dbo].[Vehicle]" + "SET [VehicleMake] = @VehicleMake" + " WHERE [ComplaintID] = @ComplaintID"; using (SqlCommand command = new SqlCommand(commandString, connection)) { SqlTransaction transaction = null; try { command.Connection.Open(); transaction = connection.BeginTransaction(IsolationLevel.Serializable); command.Transaction = transaction; SqlParameter complaintID = new SqlParameter("@complaintID", SqlDbType.Int); complaintID.Value = HttpContext.Current.Request.QueryString["complaintID"]; command.Parameters.Add(complaintID); SqlParameter VehicleMake = new SqlParameter("@VehicleMake", SqlDbType.VarChar, 20); VehicleMake.Value = tbVehicleMake.Text; command.Parameters.Add(VehicleMake); command.ExecuteNonQuery(); transaction.Commit(); } catch { transaction.Rollback(); throw; } finally { connection.Close(); } } } } I've tried this with the "SqlTransaction" stuff and without it and nothing changes. Also, since I'm doing multiple updates at once, I want to have them act as a single transaction. I've found that it can be either done like this or by use of the classes included in the System.Transactions namespace (CommittableTransaction, TransactionScope...). I tried all I could find but didn't get any different results. The connection string in web.config is as follows: <connectionStrings> <add name="ApplicationServices" connectionString="Data Source=localhost;Initial Catalog=ImpoundLotAlpha;Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings> So, tldr; version: What is the mistake that I did with that record update attempt? (Figured it out, check below if you're having a similar issue.) What is the best method to gather multiple update commands as a single transaction? Thanks in advance for any kind of help and/or suggestions! Edit: It seems that I was lacking some sleep yesterday cause this time it only took me 5 minutes to figure out my mistake. Apparently the update was working properly but I failed to notice that the textbox values were being overwritten in Page_Load. For some reason I had this part commented: if (IsPostBack) return; The second part of the question still stands. But should I post this as an answer to my own question or keep it like this?

    Read the article

  • PHP - login to a remote server, trough my own server, with HTTPS, cookies and proxy, and downloading the html

    - by Yunga Mohani
    Hello, so what i am trying to do is this: login to the other server with a PHP on my own server (either with my username and pass/or with my cookies) then have access to the page i want to display/download i want to write a PHP script that is located on my own server, that automatically does a login to another server, that uses HTTPS and a web form for login. after the login i have access to that page that i am trying to download. i dont know if it would be possible to login and download the html only with the cookies that i have in my browser through a previous login, or if i need to do the login in my php script through some https login method. can i do any of this with curl or fsocksopen or what would be the best way to realize this? thanks in advance!

    Read the article

  • Using TDD: "top down" vs. "bottom up"

    - by Christian Mustica
    Since I'm a TDD newbie, I'm currently developing a tiny C# console application in order to practice (because practice makes perfect, right?). I started by making a simple sketchup of how the application could be organized (class-wise) and started developing all domain classes that I could identify, one by one (test first, of course). In the end, the classes have to be integrated together in order to make the application runnable, i.e. placing necessary code in the Main method which calls the necessary logic. However, I don't see how I can do this last integration step in a "test first" manner. I suppose I wouldn't be having these issues had I used a "top down" approach. The question is: how would I do that? Should I have started by testing the Main() method? If anyone could give me some pointers, it will be much appreciated.

    Read the article

  • How perform USort() on an Array of Objects class definition as a method?

    - by user558724
    class Contact{ public $name; public $bgcolor; public $lgcolor; public $email; public $element; public function __construct($name, $bgcolor, $lgcolor, $email, $element) { $this->name = $name; $this->bgcolor = $bgcolor; $this->lgcolor = $lgcolor; $this->email = $email; $this->element = $element; } public static function sortByName(Contact $p1, Contact $p2) { return strcmp($p1->name, $p2->name); } } class ContactList implements Iterator, ArrayAccess { protected $_label; protected $_contacts = array(); public function __construct($label) { $this->_label = $label; } public function getLabel() { return $this->_label; } public function addContact(Contact $contact) { $this->_contacts[] = $contact; } public function current() { return current($this->_contacts); } public function key() { return key($this->_contacts); } public function next() { return next($this->_contacts); } public function rewind() { return reset($this->_contacts); } public function valid() { return current($this->_contacts); } public function offsetGet($offset) { return $this->_contacts[$offset]; } public function offsetSet($offset, $data) { if (!$data instanceof Contact) throw new InvalidArgumentException('Only Contact objects allowed in a ContactList'); if ($offset == '') { $this->_contacts[] = $data; } else { $this->_contacts[$offset] = $data; } } public function offsetUnset($offset) { unset($this->_contacts[$offset]); } public function offsetExists($offset) { return isset($this->_contacts[$offset]); } public function sort($attribute = 'name') { $sortFct = 'sortBy' . ucfirst(strtolower($attribute)); if (!in_array($sortFct, get_class_methods('Contact'))) { throw new Exception('contact->sort(): Can\'t sort by ' . $attribute); } usort($this->contact, 'ContactList::' . $sortFct); } } public function Sort($property, $asc=true) { // this is where sorting logic takes place $_pd = $this->_contact->getProperty($property); if ($_pd == null) { user_error('Property '.$property.' does not exist in class '.$this->_contact->getName(), E_WARNING); return; } // set sortDescriptor ContactList::$sortProperty = $_pd; // and apply sorting usort($this->_array, array('ContactList', ($asc?'USortAsc':'USortDesc'))); } function getItems(){ return $this->_array; } class SortableItem extends ContactList { static public $sortProperty; static function USortAsc($a, $b) { /*@var $_pd ReflectionProperty*/ /* $_pd = self::$sortProperty; if ($_pd !== null) { if ($_pd->getValue($a) === $_pd->getValue($b)) return 0; else return (($_pd->getValue($a) < $_pd->getValue($b))?-1:1); } return 0; } static function USortDesc($a, $b) { return -(self::USortAsc($a,$b)); } } This approach keeps giving me PHP Warnings: usort() [function.usort]: of all kinds which I can provide later as needed to comment out those methods and definitions in order to test and fix some minor bugs of our program. **$billy parameters are already defined. $all -> addContact($billy); // --> ended up adding each contact manually above $all->Sort('name',true); $items = $all->getItems(); foreach($items as $contact) { echo $contact->__toString(); } $all->sort(); The reason for using usort is to re-arrange the order alphabetically by name but somehow is either stating that the function comparison needs to be an array or another errors which obviously I have seemed to pass. Any help would be greatly appreciated, thanks in advance.

    Read the article

  • what are the various approaches for generating PDFs?

    - by andthereitgoes
    I have an idea for an app that would take some flash content which contains graphics and images like various geometric shapes and polygons and some random images and convert them to PDF. Also, since I envision this app to be used my multiple users I want this process to be quick and scalable. One possible solution I could think of is have a small flash client with the capability of assembling the above mentioned graphics and images. Generate some sort of XML, send it to a server running a Java process which could render the PDF using iText. I was wondering what are the other possible ways to do it or the best practices. Technology isn't an issue; open source or commercial. I am looking for ideas to make the process fast and scalable. Most importantly, I don't want the back end server side PDF render engine to constraint the flash client capabilities. I would appreciate if you could share your tech stack idea. Thanks a lot!

    Read the article

  • Call Generic method using runtime type and cast return object

    - by markpirvine
    I'm using reflection to call a generic method with a type determined at runtime. My code is as follows: Type tType = Type.GetType(pLoadOut.Type); MethodInfo method = typeof(ApiSerialiseHelper).GetMethod("Deserialise", new Type[] { typeof(string) }); MethodInfo generic = method.MakeGenericMethod(tType); generic.Invoke(obj, new object[] { pLoadOut.Data }); This works ok. However the generic.Invoke method returns an object, but what I would like is the type determined at runtime. Is this possible with this approach, or is there a better option? Mark

    Read the article

  • JSF - Prevent validationFailed when raising a WARN ValidatorException

    - by Sébastien Tromp
    Hello, I have a form which uses validators for its fields. These validators can send back either Severity.SEVERITY_ERROR or Severity.SEVERITY_WARN messages, as illustrated: if (!isInMainFamily) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "You should make sure to tag your competency in at least one main category", null); throw new ValidatorException(message); } However, SEVERITY_WARN messages are not blocking for me. They are just a way to tell the user they should correct their input, but won't prevent them from submitting the form and saving their data. However, it seems that throwing any kind of ValidatorException flags the FacesContext as "validationFailed", which then prevents the submission of the form. Is there a way to get around this? Or am I misunderstanding something? Thanks a lot for your help, Sébastien

    Read the article

  • svn commit problem, Cannot read 'd:\UC\db\txn-current': End of file found

    - by user369929
    Hi, I have a problem commiting to svn server, Here's what I got, File Can't read 'D:\SVNROOT\UC\db\txn-current'.: End of file found (It's traslation of Korean, so there's might be differ than what English error said..) In previously, I shut down transaction when update from svn, cause some file was so big, so I was shut down downloading for delete big files first, but after that, I got message about 'txn-current', does anybody can help me to solve this? thank you for regarding this

    Read the article

  • Create Oracle Cursor

    - by Mohammad
    Hi, I create a cursor like this: SQL> CREATE OR REPLACE PROCEDURE Update_STUD_FinAid ( AIDY_CODE IN VARCHAR2 ) IS 2 CURSOR PublicationC IS 3 SELECT SGBSTDN_USER_ID from SGBSTDN 4 WHERE SGBSTDN_TERM_CODE_EFF ='201030'; 5 BEGIN 6 close PublicationC; 7 8 OPEN PublicationC; 9 10 FOR PublicationR IN PublicationC 11 LOOP 12 DBMS_OUTPUT.PUT_LINE( PublicationR.SGBSTDN_USER_ID ); 13 END LOOP; 14 15 close PublicationC; 16 17 END; 18 / Procedure created. And then when I run the Procedure then I get this error: ERROR at line 1: ORA-06512: at line 2 Please advise. Thanks

    Read the article

  • mysql db connection

    - by Dragster
    hi there i have been searching the web for a connection between my android simulator and a mysql db. I've fount that you can't connect directly but via a webserver. The webserver wil handle my request from my android. I fount the following code on www.helloandroid.com But i don't understand. If i run this code on the simulator nothing happens. The screen stays black. Where does Log.i land. In the android screen or in the error log or somewhere else? Can somebody help me with this code? package app.android.ticket; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class fetchData extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //call the method to run the data retreival getServerData(); } public static final String KEY_121 = "http://www.jorisdek.nl/android/getAllPeopleBornAfter.php"; public fetchData() { Log.e("fetchData", "Initialized ServerLink "); } private void getServerData() { InputStream is = null; String result = ""; //the year data to send ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("year","1980")); //http post try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(KEY_121); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); }catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); } //convert response to string try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //parse json data try{ JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("log_tag","id: "+json_data.getInt("id")+ ", name: "+json_data.getString("name")+ ", sex: "+json_data.getInt("sex")+ ", birthyear: "+json_data.getInt("birthyear") ); } }catch(JSONException e){ Log.e("log_tag", "Error parsing data "+e.toString()); } } }

    Read the article

  • Multilingual best practices on SQL Server, EF and MVC combinations

    - by dengereli
    ASP.NET MVC, resource management is look like enough for application multlingual multiculture support. But I am wondering practices about data. User stories; User set culture as en-US and see all product items in English. User set culture as fr-FR and see all product items in French. User set culture as ru-RU and see all product items in Russian. User doesn't have right change culture settings and application never reach multilingual resources, it will use default language and culture.

    Read the article

  • How to debug macruby?

    - by Dan
    Hi, I've encountered an inconsistent bug with MacRuby and have no idea how to go about debugging this. If anyone could help would be great. I don't know if this is due to my own code or is it a bug in the MacRuby framework. I have a feeling it's my own code, something about over-retaining a piece of memory and hence the garbage collection failed. This is the error from Xcode. Thanks. CSV Wizard(30245,0x7fff704f7ca0) malloc: resurrection error for object 0x20199da20 while assigning {conservative-block}[196608](0x302360060)[117616] = Array[64](0x20199da20) garbage pointer stored into reachable memory, break on auto_zone_resurrection_error to debug CSV Wizard(30245,0x103781000) malloc: garbage block 0x20199da20(Array[64]) was over-retained during finalization, refcount = 1 This could be an unbalanced CFRetain(), or CFRetain() balanced with -release. Break on auto_zone_resurrection_error() to debug. CSV Wizard(30245,0x103781000) malloc: fatal resurrection error for garbage block 0x20199da20(Array[64]): over-retained during finalization, refcount = 1

    Read the article

  • Help with code optimization

    - by Ockonal
    Hello, I've written a little particle system for my 2d-application. Here is raining code: // HPP ----------------------------------- struct Data { float x, y, x_speed, y_speed; int timeout; Data(); }; std::vector<Data> mData; bool mFirstTime; void processDrops(float windPower, int i); // CPP ----------------------------------- Data::Data() : x(rand()%ScreenResolutionX), y(0) , x_speed(0), y_speed(0), timeout(rand()%130) { } void Rain::processDrops(float windPower, int i) { int posX = rand() % mWindowWidth; mData[i].x = posX; mData[i].x_speed = WindPower*0.1; // WindPower is float mData[i].y_speed = Gravity*0.1; // Gravity is 9.8 * 19.2 // If that is first time, process drops randomly with window height if (mFirstTime) { mData[i].timeout = 0; mData[i].y = rand() % mWindowHeight; } else { mData[i].timeout = rand() % 130; mData[i].y = 0; } } void update(float windPower, float elapsed) { // If this is first time - create array with new Data structure objects if (mFirstTime) { for (int i=0; i < mMaxObjects; ++i) { mData.push_back(Data()); processDrops(windPower, i); } mFirstTime = false; } for (int i=0; i < mMaxObjects; i++) { // Sleep until uptime > 0 (To make drops fall with randomly timeout) if (mData[i].timeout > 0) { mData[i].timeout--; } else { // Find new x/y positions mData[i].x += mData[i].x_speed * elapsed; mData[i].y += mData[i].y_speed * elapsed; // Find new speeds mData[i].x_speed += windPower * elapsed; mData[i].y_speed += Gravity * elapsed; // Drawing here ... // If drop has been falled out of the screen if (mData[i].y > mWindowHeight) processDrops(windPower, i); } } } So the main idea is: I have some structure which consist of drop position, speed. I have a function for processing drops at some index in the vector-array. Now if that's first time of running I'm making array with max size and process it in cycle. But this code works slower that all another I have. Please, help me to optimize it. I tried to replace all int with uint16_t but I think it doesn't matter.

    Read the article

  • Pointer to local variable

    - by Radek Šimko
    May I have any acces to local variable in different function? If may, how? void replaceNumberAndPrint(int array[3]) { printf("%i\n", array[1]); printf("%i\n", array[1]); } int * getArray() { int myArray[3] = {4, 65, 23}; return myArray; } int main() { replaceNumberAndPrint(getArray()); } The output of the piece of code above: 65 4202656 What am i doing wrong? What the "4202656" means?? Do I have to copy the whole array in the replaceNumberAndPrint() function to be able to access to it more than first times?

    Read the article

  • WPF (irc) chat log control

    - by user408952
    I'm trying to learn WPF and was thinking about creating a simple IRC client. The most complicated part is to create the chat log. I want it to look more or less like the one in mIRC: or irssi: The important parts are that the text should be selectable, lines should wrap and it should be able to handle quite large logs. The alternatives that I can come up with are: StackPanel inside a ScrollViewer where each line is a row ListView, since that seems more suitable for dynamic content/data binding. Create an own control that does the rendering on its own. Is there any WPF guru out there that has some ideas on which direction to take and where to start?

    Read the article

  • Objective C memory management question with NSArray

    - by Robert
    I am loading an array with floats like this: NSArray *arr= [NSArray arrayWithObjects: [NSNumber numberWithFloat:1.9], [NSNumber numberWithFloat:1.7], [NSNumber numberWithFloat:1.6], [NSNumber numberWithFloat:1.9],nil]; Now I know this is the correct way of doing it, however I am confused by the retail counts. Each Object is created by the [NSNumber numberWithFloat:] method. This gives the object a retain count of 1 dosnt it? - otherwise the object would be reclaimed The arrayWithObjects: method sends a retain message to each object. This means each object has a retain cont of 2. When the array is de-allocated each object is released leaving them with a retain count of 1. What have I missed?

    Read the article

  • Finding good heuristic for A* search

    - by Martin
    I'm trying to find the optimal solution for a little puzzle game called Twiddle (an applet with the game can be found here). The game has a 3x3 matrix with the number from 1 to 9. The goal is to bring the numbers in the correct order using the minimum amount of moves. In each move you can rotate a 2x2 square either clockwise or counterclockwise. I.e. if you have this state 6 3 9 8 7 5 1 2 4 and you rotate the upper left 2x2 square clockwise you get 8 6 9 7 3 5 1 2 4 I'm using a A* search to find the optimal solution. My f() is simply the number of rotations need. My heuristic function already leads to the optimal solution but I don't think it's the best one you can find. My current heuristic takes each corner, looks at the number at the corner and calculates the manhatten distance to the position this number will have in the solved state (which gives me the number of rotation needed to bring the number to this postion) and sums all these values. I.e. You take the above example: 6 3 9 8 7 5 1 2 4 and this end state 1 2 3 4 5 6 7 8 9 then the heuristic does the following 6 is currently at index 0 and should by at index 5: 3 rotations needed 9 is currently at index 2 and should by at index 8: 2 rotations needed 1 is currently at index 6 and should by at index 0: 2 rotations needed 4 is currently at index 8 and should by at index 3: 3 rotations needed h = 3 + 2 + 2 + 3 = 10 But there is the problem, that you rotate 4 elements at once. So there a rare cases where you can do two (ore more) of theses estimated rotations in one move. This means theses heuristic overestimates the distance to the solution. My current workaround is, to simply excluded one of the corners from the calculation which solves this problem at least for my test-cases. I've done no research if really solves the problem or if this heuristic still overestimates in same edge-cases. So my question is: What is the best heuristic you can come up with? (Disclaimer: This is for a university project, so this is a bit of homework. But I'm free to use any resource if can come up with, so it's okay to ask you guys. Also I will credit Stackoverflow for helping me ;) )

    Read the article

  • Connect MySQL database from Android

    - by Mistry Hardik
    hello people! well this is the code snippet i use to access the getUser.php to retrive user details from a MySQL database in my application: String result = ""; //the year data to send ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("uid","demo")); //http post try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://192.xxx.xx.xxx/getUser.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); }catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); } //convert response to string try{ InputStream is = null; BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //parse json data try{ JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("log_tag","id: "+json_data.getInt("id")+ ", name: "+json_data.getString("fname")+ ", sex: "+json_data.getInt("sex")+ ", birthyear: "+json_data.getInt("dob") ); } } catch(JSONException e){ Log.e("log_tag", "Error parsing data "+e.toString()); } } This snippet is taken from http://helloandroid.com Everything is configured fine: the MySQL Db, IIS with FASTCGi, PHP tools and drivers. even the script below when called from browser with url: http://192.xxx.xx.x.xxx/getUser.php?uid=demo works fine, But returns error in android with java.lang.NullPointerException and org.json.JSONEXCEPTION: End of input at character 0 <?php mysql_connect("myhost","username","pwd"); mysql_select_db("mydb"); $q=mysql_query("SELECT * FROM userinfo WHERE uid ='".$_REQUEST['uid']."'"); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); mysql_close(); ?> Can anybody help in this section? Regards, Mistry Hardik

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >