Search Results

Search found 2399 results on 96 pages for 'alex gosselin'.

Page 87/96 | < Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >

  • What is most efficient way of setting row to zeros for a sparce scipy matrix?

    - by Alex Reinking
    I'm trying to convert the following MATLAB code to Python and am having trouble finding a solution that works in any reasonable amount of time. M = diag(sum(a)) - a; where = vertcat(in, out); M(where,:) = 0; M(where,where) = 1; Here, a is a sparse matrix and where is a vector (as are in/out). The solution I have using Python is: M = scipy.sparse.diags([degs], [0]) - A where = numpy.hstack((inVs, outVs)).astype(int) M = scipy.sparse.lil_matrix(M) M[where, :] = 0 # This is the slowest line M[where, where] = 1 M = scipy.sparse.csc_matrix(M) But since A is 334863x334863, this takes like three minutes. If anyone has any suggestions on how to make this faster, please contribute them! For comparison, MATLAB does this same step imperceptibly fast. Thanks!

    Read the article

  • mysql connect error issue

    - by Alex
    I've php page which update Mysql Db. I don't understand why my following php code is saying that "Could not update marker. No database selected". Strange!! can you please tell me why it's showing error message. Thanks. Php code: <?php // database settings $db_username = 'root'; $db_password = ''; $db_name = 'parkool'; $db_host = 'localhost'; //mysqli $mysqli = new mysqli($db_host, $db_username, $db_password, $db_name); if (mysqli_connect_errno()) { header('HTTP/1.1 500 Error: Could not connect to db!'); exit(); } ################ Save & delete markers ################# if($_POST) //run only if there's a post data { //make sure request is comming from Ajax $xhr = $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; if (!$xhr){ header('HTTP/1.1 500 Error: Request must come from Ajax!'); exit(); } // get marker position and split it for database $mLatLang = explode(',',$_POST["latlang"]); $mLat = filter_var($mLatLang[0], FILTER_VALIDATE_FLOAT); $mLng = filter_var($mLatLang[1], FILTER_VALIDATE_FLOAT); $mName = filter_var($_POST["name"], FILTER_SANITIZE_STRING); $mAddress = filter_var($_POST["address"], FILTER_SANITIZE_STRING); $mId = filter_var($_POST["id"], FILTER_SANITIZE_STRING); /*$result = mysql_query("SELECT id FROM test.markers WHERE test.markers.lat=$mLat AND test.markers.lng=$mLng"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); $id=$row[0];*/ //$output = '<h1 class="marker-heading">'.$mId.'</h1><p>'.$mAddress.'</p>'; //exit($output); //Update Marker if(isset($_POST["update"]) && $_POST["update"]==true) { $results = mysql_query("UPDATE parkings SET latitude = '$mLat', longitude = '$mLng' WHERE locId = '94' "); if (!$results) { //header('HTTP/1.1 500 Error: Could not Update Markers! $mId'); echo "coudld not update marker." . mysql_error(); exit(); } exit("Done!"); } $output = '<h1 class="marker-heading">'.$mName.'</h1><p>'.$mAddress.'</p>'; exit($output); } ############### Continue generating Map XML ################# //Create a new DOMDocument object $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); //Create new element node $parnode = $dom->appendChild($node); //make the node show up // Select all the rows in the markers table $results = $mysqli->query("SELECT * FROM parkings WHERE 1"); if (!$results) { header('HTTP/1.1 500 Error: Could not get markers!'); exit(); } //set document header to text/xml header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while($obj = $results->fetch_object()) { $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("name",$obj->name); $newnode->setAttribute("locId",$obj->locId); $newnode->setAttribute("address", $obj->address); $newnode->setAttribute("latitude", $obj->latitude); $newnode->setAttribute("longitude", $obj->longitude); //$newnode->setAttribute("type", $obj->type); } echo $dom->saveXML();

    Read the article

  • DELETE and ACCESS

    - by Alex
    Where is the error in this statement? query = "DELETE TOP 10 FROM table WHERE field LIKE \"something*\"" I get an error on the query sytax. Thanks.

    Read the article

  • Ubuntu 10.10, taskbar

    - by Alex
    I launched system monitor to kill one program, which didn't responded on any mouse clicks, etc. But i occasionally killed another process. so, taskbar was killed. (it was in the bottom of the screen, in the top all is good) reboot didnt help o_O. Now I use Alt-Tab and alt-controll-arrows to switch between programs and desktops (it works). How to launch taskbar again? its very strange that reboot didnt help me.

    Read the article

  • Select <a> which is the second <a> on a page that contains the same href text? jQuery

    - by Alex
    Hello there, I'm working with a page that has several links that contain the same href text, and I need to select the second anchor element on the page that contains said href text. Here's a simplified version of the link structure of the page: <a href="same/link/to/stuff/">same link</a> <a href="same/link/to/stuff/">same link</a> How do I fashion my selector so that it only selects the second anchor in the above example? Currently I'm trying: $('a[href=same/link/to/stuff/] :eq(1)') but it is not working. Thanks!!

    Read the article

  • contents().find() not producing the same result as changing selector context? - jQuery

    - by Alex
    Hello all, I have a function that looks somewhat like this: function(domObj) { var currentObj = $(domObj); ... currentObj.contents().find(".ws").after("foobar"); } My problem is that the above method of using .contents().find() is not working. "foobar" never gets stuffed after the specified dom element, represented by the selector, .ws However if I do this: $(".ws", currentObj).after("foobar"); Then the string, "foobar" gets appended every time. My question: Are not these two methods supposed to be equivilant? How/what am I doing wrong in my use of .contents().find() so that it is not working? Thanks!

    Read the article

  • JQuery validation using is() and multiple CSS classes

    - by Alex
    Hi Folks, Trying to debug something that basically .trim()'s, .val()'s and .length's a textarea input as HTML below (truncated): <form id="Kontaktanfrage" method="post" action="tests/testform/"> ... <textarea cols="50" rows="8" id="el_12" name="FORM[Kontaktanfrage][el_12]" title="Ihre Nachricht: *" class="textarea required"></textarea> ... </form> JavaScript: function validateField(formId, fieldId) { if (fieldId) { var element = "form#"+formId+" input#"+fieldId; var fieldValue = jQuery.trim(jQuery(element).val()); var fieldLength = fieldValue.length; var fieldError = ""; if ($(element).is('.textarea.required') && fieldLength == 0) { fieldError = "error message"; } } } The above if check is never true. Using JQuery: 1.4.1. Having seen other examples online, I can't see what the difference should be. Feel free to test it in FireBug at (http://www.initiat.de/tests/testform/). Any help appreciated, can't see what I'm doing wrong.

    Read the article

  • How do I access the array submit() calls in the dom?

    - by Alex
    I want to grab all the inputs inside a form, in order to submit them. The point of this is to use jquery's ajax to submit a dynamically sized form. Surely there must be an array inside the dom somewhere which i can just do something like... docment.forms['form'].elements which only lists inputs for that form, meaning I can loop through them and grab their values to play around with?

    Read the article

  • What is the easiest way to set the value of an entire array?

    - by Alex
    My current project requires me to fill an array based upon some other values. I know there's the shortcut: int arr[4][4] = { {0,0,0,0} , {0,0,0,0} , {0,0,0,0} , {0,0,0,0} }; But in this case, I need to fill the array after its declaration. I currently have my code formatted like this: int arr[4][4]; if(someothervariable == 1){ arr = { {1,1,1,1}, {1,2,3,4}, {2,,3,4,5}, {3,4,5,6} }; } But it won't compile. Is there a way to make use of the mentioned shortcut in my case? If not, whats the best fix available? I'd appreciate a way to set it without explicitly assigning each element? ie: arr[0][0] = ...

    Read the article

  • CONCAT_WS rows in JOIN

    - by Alex Kiselev
    i have tables profiles (id, name, deleted) categories (id, name, deleted) profiles_categories (id, profile_id, category_id, , deleted) I have wrong query SELECT p.id, p.name CONCAT_WS(', ', c.name) AS keywords_categories FROM profiles p LEFT JOIN profiles_categories pc ON p.id = pc.profile_id LEFT JOIN categories c ON pc.id = c.id WHERE p.deleted = FALSE So, i want have result with all profiles with concan categories.name. Thanks

    Read the article

  • What would be the most efficient way to do this search (mysql or text)?

    - by alex
    Suppose I have 500 rows of data, each with a paragraph of text (like this paragraph). That's it.I want to do a search that is not only based on words. (%LIKE%, not FULL_TEXT) What would be faster? SELECT * FROM ...WHERE LIKE "%query%"; This would put load on the database server. Select all. Then, go through each one and do .find = 0 This would put load on the web server. This is a website, and people will be searching frequently.

    Read the article

  • No route matches [PUT] error in active_admin

    - by Alex
    in active_admin partials created a form input: <%= semantic_nested_form_for @item, :url => admin_items_path(@item) do |f| %> <fieldset class="inputs"> <ol> <%= f.input :category %></br> <%= f.input :title %> <%= f.input :photo1 %> <%= f.input :photo2 %> </ol> </fieldset> <%= f.fields_for :ItemColors do |i| %> <fieldset class="inputs"> <ol> <%= i.input :DetailColor %> <%= i.input :size, :input_html => { :size => "10" } %> <%= i.link_to_remove "remove" %> </ol> </fieldset> <% end %> <%= f.link_to_add "add", :ItemColors %> <%= f.actions %> <% end %> to create a new Item okay creates and throws On the New Item, but if I do update an existing item is routed to an error occurs while such a path exists: No route matches [PUT] "/admin/items.150" #150 is item_id rake routes: batch_action_admin_items POST /admin/items/batch_action(.:format) admin/items#batch_action admin_items GET /admin/items(.:format) admin/items#index POST /admin/items(.:format) admin/items#create new_admin_item GET /admin/items/new(.:format) admin/items#new edit_admin_item GET /admin/items/:id/edit(.:format) admin/items#edit admin_item GET /admin/items/:id(.:format) admin/items#show PUT /admin/items/:id(.:format) admin/items#update DELETE /admin/items/:id(.:format) admin/items#destroy help to solve this problem UPD I found the error, but not yet understood how to fix it the upgrade is a request: PUT "/admin/items" but should: PUT "/admin/items/some_id" any ideas?

    Read the article

  • Using addMouseListener() and paintComponent() for JPanel

    - by Alex
    This is a follow-up to my previous question. I've simplified things as much as I could, and it still doesn't work! Although the good thing I got around using getGraphics(). A detailed explanation on what goes wrong here is massively appreciated. My suspicion is that something's wrong with the the way I used addMouseListener() method here. import java.awt.Color; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; public class MainClass1{ private static PaintClass22 inst2 = new PaintClass22(); public static void main(String args[]){ JFrame frame1 = new JFrame(); frame1.add(inst2); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame1.setTitle("NewPaintToolbox"); frame1.setSize(200, 200); frame1.setLocationRelativeTo(null); frame1.setVisible(true); } } class PaintClass11 extends MouseAdapter{ int xvar; int yvar; static PaintClass22 inst1 = new PaintClass22(); public PaintClass11(){ inst1.addMouseListener(this); inst1.addMouseMotionListener(this); } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub xvar = arg0.getX(); yvar = arg0.getY(); inst1.return_paint(xvar, yvar); } } class PaintClass22 extends JPanel{ private static int varx; private static int vary; public void return_paint(int input1, int input2){ varx = input1; vary = input2; repaint(varx,vary,10,10); } public void paintComponent(Graphics g){ super.paintComponents(g); g.setColor(Color.RED); g.fillRect(varx, vary, 10, 10); } }

    Read the article

  • jquery - how to get number from a string with mixture of letters and number

    - by Alex
    How do I use JQuery to get number from the drop down select? <select aria-invalid="false" id="RatePercent" class="wpcf7-form-control wpcf7-select ratePercent" name="RatePercent"> <option value="">---</option> <option value="Floating-6.5%">Floating-6.5%</option> <option value="6 Months-5.65%">6 Months-5.65%</option> <option value="1 Year-5.85%">1 Year-5.85%</option> <option value="18 Months-5.99%">18 Months-5.99%</option> <option value="2 Years-6.19%">2 Years-6.19%</option> <option value="3 Years-6.85%">3 Years-6.85%</option> <option value="4 Years-7.19%">4 Years-7.19%</option> <option value="5 Years-7.40%">5 Years-7.40%</option> </select> If you choose 1 Year-5.85%, it returns '5.85', instead of '1 Year-5.85%'?

    Read the article

< Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >