Search Results

Search found 8 results on 1 pages for 'tirithen'.

Page 1/1 | 1 

  • udev rule group ownership not working

    - by Tirithen
    I have added a udev rule for my Arduino, but the symlink gets the ownership "root root" instead of "root dialout". $ cat /etc/udev/rules.d/47-Arduino.rules SUBSYSTEM=="usb", ATTR{idVendor}=="2341", ATTR{idProduct}=="0001", MODE="0666", SYMLINK+="arduino", GROUP="dialout" $ ls -la /dev/ar* lrwxrwxrwx 1 root root 15 sep 8 11:02 /dev/arduino -> bus/usb/003/007 $ ls -la /dev/bus/usb/003/007 crw-rw-r-- 1 root dialout 189, 262 sep 8 11:12 /dev/bus/usb/003/007 My user is a member of the group "dialout" but I still get permission denied error when I'm trying to communicate with the device. There are no problems when I'm using the "default" device "/etc/ttyACM3". $ ls -la /dev/ttyACM3 crw-rw---- 1 root dialout 166, 3 sep 8 11:12 /dev/ttyACM3 I have tried to restart both the udev service and reboot my computer. How can I fix this?

    Read the article

  • udev rule gives wrong group ownership

    - by Tirithen
    I have added a udev rule for my Arduino, but the symlink gets the ownership "root root" instead of "root dialout". $ cat /etc/udev/rules.d/47-Arduino.rules SUBSYSTEM=="usb", ATTR{idVendor}=="2341", ATTR{idProduct}=="0001", MODE="0666", SYMLINK+="arduino", GROUP="dialout" $ ls -la /dev/ar* lrwxrwxrwx 1 root root 15 sep 8 11:02 /dev/arduino -> bus/usb/003/007 $ ls -la /dev/bus/usb/003/007 crw-rw-r-- 1 root dialout 189, 262 sep 8 11:12 /dev/bus/usb/003/007 My user is a member of the group "dialout" but I still get "Permission Denied" error when I'm trying to communicate with the device. There are also no problems when I'm using the "default" device "/etc/ttyACM3". $ ls -la /dev/ttyACM3 crw-rw---- 1 root dialout 166, 3 sep 8 11:12 /dev/ttyACM3 I have tried to restart both the udev service and reboot my computer. How can I fix this?

    Read the article

  • MySQL stored procedure, handling multiple cursors and query results

    - by Tirithen
    How can I use two cursors in the same routine? If I remove the second cursor declaration and fetch loop everthing works fine. The routine is used for adding a friend in my webapp. It takes the id of the current user and the email of the friend we want to add as a friend, then it checks if the email has a corresponding user id and if no friend relation exists it will create one. Any other routine solution than this one would be great as well. DROP PROCEDURE IF EXISTS addNewFriend; DELIMITER // CREATE PROCEDURE addNewFriend(IN inUserId INT UNSIGNED, IN inFriendEmail VARCHAR(80)) BEGIN DECLARE tempFriendId INT UNSIGNED DEFAULT 0; DECLARE tempId INT UNSIGNED DEFAULT 0; DECLARE done INT DEFAULT 0; DECLARE cur CURSOR FOR SELECT id FROM users WHERE email = inFriendEmail; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cur; REPEAT FETCH cur INTO tempFriendId; UNTIL done = 1 END REPEAT; CLOSE cur; DECLARE cur CURSOR FOR SELECT user_id FROM users_friends WHERE user_id = tempFriendId OR friend_id = tempFriendId; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cur; REPEAT FETCH cur INTO tempId; UNTIL done = 1 END REPEAT; CLOSE cur; IF tempFriendId != 0 AND tempId != 0 THEN INSERT INTO users_friends (user_id, friend_id) VALUES(inUserId, tempFriendId); END IF; SELECT tempFriendId as friendId; END // DELIMITER ;

    Read the article

  • Can't bind string containing @ char with mysqli_stmt_bind_param

    - by Tirithen
    I have a problem with my database class. I have a method that takes one prepared statement and any number of parameters, binds them to the statement, executes the statement and formats the result into a multidimentional array. Everthing works fine until I try to include an email adress in one of the parameters. The email contains an @ character and that one seems to break everything. When I supply with parameters: $types = "ss" and $parameters = array("[email protected]", "testtest") I get the error: Warning: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given in ...db/Database.class.php on line 63 Here is the method: private function bindAndExecutePreparedStatement(&$statement, $parameters, $types) { if(!empty($parameters)) { call_user_func_array('mysqli_stmt_bind_param', array_merge(array($statement, $types), &$parameters)); /*foreach($parameters as $key => $value) { mysqli_stmt_bind_param($statement, 's', $value); }*/ } $result = array(); $statement->execute() or debugLog("Database error: ".$statement->error); $rows = array(); if($this->stmt_bind_assoc($statement, $row)) { while($statement->fetch()) { $copied_row = array(); foreach($row as $key => $value) { if($value !== null && mb_substr($value, 0, 1, "UTF-8") == NESTED) { // If value has a nested result inside $value = mb_substr($value, 1, mb_strlen($value, "UTF-8") - 1, "UTF-8"); $value = $this->parse_nested_result_value($value); } $copied_row[$ke<y] = $value; } $rows[] = $copied_row; } } // Generate result $result['rows'] = $rows; $result['insert_id'] = $statement->insert_id; $result['affected_rows'] = $statement->affected_rows; $result['error'] = $statement->error; return $result; } I have gotten one suggestion that: the array_merge is casting parameter to string in the merge change it to &$parameters so it remains a reference So I tried that (3rd line of the method), but it did not do any difference. How should I do? Is there a better way to do this without call_user_func_array?

    Read the article

  • PHP: Get instance of static class by string value

    - by Tirithen
    I'm working on a php web api that was handed to me with a lot of code that needs to be refactored. The ones that wrote the code wanted to include a static configuration class to an api resource and then get an instance of that class something like this: <?php $obj = "User"; $confObjectSuffix = "_conf"; $confObject = $obj.$confObjectSuffix; if ($confObject::inst()->checkMethod($method)) { ..... This gives the error "Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in ....." since $confObject is a string and not a object. I wrote some testcode: <?php $class = "User_conf"; echo "<pre>"; print_r($$class::Inst()); echo "</pre>"; class User_conf { private static $INSTANCE = null; public static function Inst() { if(User_conf::$INSTANCE === null) { User_conf::$INSTANCE = new User_conf(); } return User_conf::$INSTANCE; } } But can't get it to work with $$ either, is there some other way around this? I don't want to rewrite more than necessary.

    Read the article

  • How to make multiple queries with PHP prepared statements (Commands out of sync error)

    - by Tirithen
    I'm trying to run three MySQL queries from a PHP script, the first one works fine, but on the second one I get the "Commands out of sync; you can’t run this command now" error. I have managed to understand that I need to "empty" the resultset before preparing a new query but I can't seem to understand how. I thought that $statement-close; would do that for me. Here is the relevant part of the code: <?php $statement = $db_conn->prepare("CALL getSketches(?,?)"); // Prepare SQL routine to check if user is accepted $statement->bind_param("is", $user_id, $loaded_sketches); // Bind variables to send $statement->execute(); // Execute the query $statement->bind_result( // Set return varables $id, $name, $description, $visibility, $createdby_id, $createdby_name, $createdon, $permission ); $new_sketches_id = array(); while($statement->fetch()) { $result['newSketches'][$id] = array( "name" => $name, "description" => $description, "visibility" => $visibility, "createdById" => $createdby_id, "createdByName" => $createdby_name, "createdOn" => $createdon, "permission" => $permission ); $new_sketches_id[] = $id; } $statement->close; // Close satement $new_sketches_ids = implode(",", $new_sketches_id); // Get the new sketches elements $statement = $db_conn->prepare("CALL getElements(?,'',?,'00000000000000')"); // Prepare SQL routine to check if user is accepted // The script crashes here with $db_conn->error // "Commands out of sync; you can't run this command now" $statement->bind_param("si", $new_sketches_ids, $user_id); // Bind variables to send $statement->execute(); // Execute the query $statement->bind_result( // Set return varables $id, $user_id, $type, $attribute_d, $attribute_stroke, $attribute_strokeWidth, $sketch_id, $createdon ); while($statement->fetch()) { $result['newSketches'][$sketch_id]['newElements']["u".$user_id."e".$id] = array( "type" => $type, "d" => $attribute_d, "stroke" => $attribute_stroke, "strokeWidth" => $attribute_strokeWidth, ); } $statement->close; // Close satement ?> How can I make the second query without closing and reopening the entire database connection?

    Read the article

  • Regexp for selecting spaces between digits and decimal char

    - by Tirithen
    I want to remove spaces from strings where the space is preceeded by a digit or a "." and acceded by a digit or ".". I have strings like: "50 .10", "50 . 10", "50. 10" and I want them all to become "50.10" but with an unknown number of digits on either side. I'm trying with lookahead/lookbehind assertions like this: $row = str_replace("/(?<=[0-9]+$)\s*[.]\s*(?=[0-9]+$)/", "", $row); But it does not work...

    Read the article

  • How to store session values with Node.js and mongodb?

    - by Tirithen
    How do I get sessions working with Node.js, [email protected] and mongodb? I'm now trying to use connect-mongo like this: var config = require('../config'), express = require('express'), MongoStore = require('connect-mongo'), server = express.createServer(); server.configure(function() { server.use(express.logger()); server.use(express.methodOverride()); server.use(express.static(config.staticPath)); server.use(express.bodyParser()); server.use(express.cookieParser()); server.use(express.session({ store: new MongoStore({ db: config.db }), secret: config.salt })); }); server.configure('development', function() { server.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); server.configure('production', function() { server.use(express.errorHandler()); }); server.set('views', __dirname + '/../views'); server.set('view engine', 'jade'); server.listen(config.port); I'm then, in a server.get callback trying to use req.session.test = 'hello'; to store that value in the session, but it's not stored between the requests. It probobly takes something more that this to store session values, how? Is there a better documented module than connect-mongo?

    Read the article

1