{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'PDF TO Markdown' && linkText !== 'PDF TO Markdown' ) { link.textContent = 'PDF TO Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== 'Voice Cloning' ) { link.textContent = 'Voice Cloning'; link.href = 'https://vibevoice.info/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'PDF TO Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\nThe problem with this approach is that code is embedded into HTML, but the very same code also needs to generate additional HTML and to generate SQL statements to query the database, entangling multiple layers of the application and making it difficult to read and maintain. The situation is even worse for Ajax applications, and the complexity grows with the number of pages (files) that make up the application.\nThe functionality of the above example can be expressed in web2py with two lines of Python code:\ndef index():\n return HTML(BODY(H1('Records'), db().select(db.contacts.ALL)))\n\nIn this simple example, the HTML page structure is represented programmatically by the HTML, BODY, and H1 objects; the database db is queried by the select command; finally, everything is serialized into HTML. Notice that db is not a keyword but a user defined variable. We will use this name consistently to refer to a database connection to avoid confusion.\nWeb frameworks are typically categorized as one of two types: A \"glued\" framework is built by assembling (gluing together) several third-party components. A \"full-stack\" framework is built by creating components designed specifically to be tightly integrated and work together.\nweb2py is a full-stack framework. Almost all of its components are built from scratch and are designed to work together, but they function just as well outside of the complete web2py framework. For example, the Database Abstraction Layer (DAL) or the template language can be used independently of the web2py framework by importing gluon.dal or gluon.template into your own Python applications. gluon is the name of the web2py module that contains system libraries. Some web2py libraries, such as building and processing forms from database tables, have dependencies on other portions of web2py. web2py can also work with third-party Python libraries, including other template languages and DALs, but they will not be as tightly integrated as the original components.\nModel-View-Controller\nweb2py encourages the developer to separate data representation (the model), data presentation (the view) and the application workflow (the controller). Let's consider again the previous example and see how to build a web2py application around it. Here is an example of the web2py MVC edit interface:\nThe typical workflow of a request in web2py is described in the following diagram:\nIn the diagram:\nThe Server can be the web2py built-in web server or a third-party server, such as Apache. The Server handles multi-threading.\n\"main\" is the main WSGI application. It performs all common tasks and wraps user applications. It deals with cookies, sessions, transactions, URL routing and reverse routing, and dispatching.\nIt can serve and stream static files if the web server is not doing it yet.\nThe Models, Views and Controller components make up the user application.\nMultiple applications can be hosted in the same web2py instance.\nThe dashed arrows represent communication with the database engine(s). The database queries can be written in raw SQL (discouraged) or by using the web2py Database Abstraction Layer (recommended), so that web2py application code is not dependent on the specific database engine.\nThe dispatcher maps the requested URL to a function call in the controller. The output of the function can be a string or a dictionary of symbols (a hash table). The data in the dictionary is rendered by a view. If the visitor requests an HTML page (the default), the dictionary is rendered into an HTML page. If the visitor requests the same page in XML, web2py tries to find a view that can render the dictionary in XML. The developer can create views to render pages in any of the already supported protocols (HTML, XML, JSON, RSS, CSV, and RTF) or in additional custom protocols.\nAll calls are wrapped into a transaction, and any uncaught exception causes the transaction to be rolled back. If the request succeeds, the transaction is committed.\nweb2py also handles sessions and session cookies automatically, and when a transaction is committed, the session is also stored, unless specified otherwise.\nIt is possible to register recurrent tasks (via cron) to run at scheduled times and/or after the completion of certain actions. In this way it is possible to run long and compute-intensive tasks in the background without slowing down navigation.\nHere is a minimal and complete MVC application, consisting of three files:\n\"db.py\" is the model:\ndb = DAL('sqlite://storage.sqlite')\ndb.define_table('contact',\n Field('name'),\n Field('phone'))\n\nIt connects to the database (in this example a SQLite database stored in the storage.sqlite file) and defines a table called contact. If the table does not exist, web2py creates it and, transparently and in the background, generates SQL code in the appropriate SQL dialect for the specific database engine used. The developer can see the generated SQL but does not need to change the code if the database back-end, which defaults to SQLite, is replaced with MySQL, PostgreSQL, MSSQL, FireBird, Oracle, DB2, Informix, Interbase, Ingres, and the Google App Engine (both SQL and NoSQL).\nOnce a table is defined and created, web2py also generates a fully functional web-based database administration interface, called appadmin, to access the database and the tables.\n\"default.py\" is the controller:\ndef contacts():\n grid=SQLFORM.grid(db.contact, user_signature=False)\n return locals()\n\nIn web2py, URLs are mapped to Python modules and function calls. In this case, the controller contains a single function (or \"action\") called contacts. An action may return a string (the returned web page) or a Python dictionary (a set of key:value pairs) or the set of local variables (as in this example). If the function returns a dictionary, it is passed to a view with the same name as the controller/function, which in turn renders the page. In this example, the function contacts generates a select/search/create/update/delete grid for table db.contact and returns the grid to the view.\n\"default/contacts.html\" is the view:\n{{extend 'layout.html'}}\n

Manage My Contacts

\n{{=grid}}\n\nThis view is called automatically by web2py after the associated controller function (action) is executed. The purpose of this view is to render the variables in the returned dictionary (in our case grid) into HTML. The view file is written in HTML, but it embeds Python code delimited by the special {{ and }} delimiters. This is quite different from the PHP code example, because the only code embedded into the HTML is \"presentation layer\" code. The \"layout.html\" file referenced at the top of the view is provided by web2py and constitutes the basic layout for all web2py applications. The layout file can easily be modified or replaced.\nWhy web2py\nweb2py is one of many web application frameworks, but it has compelling and unique features. web2py was originally developed as a teaching tool, with the following primary motivations:\nEasy for users to learn server-side web development without compromising functionality. For this reason, web2py requires no installation and no configuration, has no dependencies (except for the source code distribution, which requires Python 2.5 and its standard library modules), and exposes most of its functionality via a Web interface, including an Integrated Development Environment with Debugger and database interface.\nweb2py has been stable from day one because it follows a top-down design; i.e., its API was designed before it was implemented. Even as new functionality has been added, web2py has never broken backwards compatibility, and it will not break compatibility when additional functionality is added in the future.\nweb2py proactively addresses the most important security issues which plague many modern web applications, as determined by OWASP[owasp]below.\nweb2py is lightweight. Its core libraries, including the Database Abstraction Layer, the template language, and all the helpers amount to 1.4MB. The entire source code including sample applications and images amounts to 10.4MB.\nweb2py has a small footprint and is very fast. It uses the Rocket[rocket]WSGI web server developed by Timothy Farrell. It is as fast as Apache with mod_wsgi, and supports SSL and IPv6.\nweb2py uses Python syntax for models, controllers, and views, but does not import models and controllers (as all the other Python frameworks do) - instead it executes them. This means that apps can be installed, uninstalled, and modified without having to restart the web server (even in production), and different apps can coexist without their modules interfering with one another.\nweb2py uses a Database Abstraction Layer (DAL) instead of an Object Relational Mapper (ORM). From a conceptual point of view, this means that different database tables are mapped into different instances of one Tableclass and not into different classes, while records are mapped into instances of oneRowclass, not into instances of the corresponding table class. From a practical point of view, it means that SQL syntax maps almost one-to-one into DAL syntax, and there is no complex metaclass programming going on under the hood as in popular ORMs, which would add latency.\nHere is a screenshot of the main web2py admin interface:\nSecurity\nThe Open Web Application Security Project[owasp] (OWASP) is a free and open worldwide community focused on improving the security of application software.\nOWASP has listed the top ten security issues that put web applications at risk. That list is reproduced here, along with a description of how each issue is addressed by web2py:\ncross site scripting\"Cross Site Scripting (XSS): XSS flaws occur whenever an application takes user supplied data and sends it to a web browser without first validating or encoding that content. XSS allows attackers to execute scripts in the victim's browser which can hijack user sessions, deface web sites, possibly introduce worms, etc.\"web2py, by default, escapes all variables rendered in the view, preventing XSS.\ninjection flaws\"Injection Flaws: Injection flaws, particularly SQL injection, are common in web applications. Injection occurs when user-supplied data is sent to an interpreter as part of a command or query. The attacker's hostile data tricks the interpreter into executing unintended commands or changing data.\"web2py includes a Database Abstraction Layer that makes SQL injection impossible. Normally, SQL statements are not written by the developer. Instead, SQL is generated dynamically by the DAL, ensuring that all inserted data is properly escaped.\nmalicious file execution\"Malicious File Execution: Code vulnerable to remote file inclusion (RFI) allows attackers to include hostile code and data, resulting in devastating attacks, such as total server compromise.\"web2py allows only exposed functions to be executed, preventing malicious file execution. Imported functions are never exposed; only actions are exposed. web2py uses a Web-based administration interface which makes it very easy to keep track of what is exposed and what is not.\ninsecure object reference\"Insecure Direct Object Reference: A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, database record, or key, as a URL or form parameter. Attackers can manipulate those references to access other objects without authorization.\"web2py does not expose any internal objects; moreover, web2py validates all URLs, thus preventing directory traversal attacks. web2py also provides a simple mechanism to create forms that automatically validate all input values.\nCSRF\"Cross Site Request Forgery (CSRF): A CSRF attack forces a logged-on victim's browser to send a pre-authenticated request to a vulnerable web application, which then forces the victim's browser to perform a hostile action to the benefit of the attacker. CSRF can be as powerful as the web application that it attacks.\"web2py prevents CSRF as well as accidental double submission of forms by assigning a one-time random token to each form. Moreover web2py uses UUID for session cookie.\ninformation leakageimproper error handling\"Information Leakage and Improper Error Handling: Applications can unintentionally leak information about their configuration, internal workings, or violate privacy through a variety of application problems. Attackers use this weakness to steal sensitive data, or conduct more serious attacks.\"web2py includes a ticketing system. No error can result in code being exposed to the users. All errors are logged and a ticket is issued to the user that allows error tracking. But errors and source code are accessible only to the administrator.\n\"Broken Authentication and Session Management: Account credentials and session tokens are often not properly protected. Attackers compromise passwords, keys, or authentication tokens to assume other users' identities.\" web2py provides a built-in mechanism for administrator authentication, and it manages sessions independently for each application. The administrative interface also forces the use of secure session cookies when the client is not \"localhost\". For applications, it includes a powerful Role Based Access Control API.\ncryptographic store\"Insecure Cryptographic Storage: Web applications rarely use cryptographic functions properly to protect data and credentials. Attackers use weakly protected data to conduct identity theft and other crimes, such as credit card fraud.\"web2py uses the MD5 or the HMAC+SHA-512 hash algorithms to protect stored passwords. Other algorithms are also available.\nsecure communications\"Insecure Communications: Applications frequently fail to encrypt network traffic when it is necessary to protect sensitive communications.\"web2py includes the SSL-enabled[ssl]Rocket WSGI server, but it can also use Apache or Lighttpd and mod_ssl to provide SSL encryption of communications.\naccess restriction\"Failure to Restrict URL Access: Frequently an application only protects sensitive functionality by preventing the display of links or URLs to unauthorized users. Attackers can use this weakness to access and perform unauthorized operations by accessing those URLs directly.\"web2py maps URL requests to Python modules and functions. web2py provides a mechanism for declaring which functions are public and which require authentication and authorization. The included Role Based Access Control API allow developers to restrict access to any function based on login, group membership or group based permissions. The permissions are very granular and can be combined with database filters to allow, for example, to give access to specific tables and/or records. web2py also allows digitally signed URL and provides API to digitally sign Ajax callbacks.\nweb2py was reviewed for security and you can find the result of the review in ref.[pythonsecurity].\nIn the box\nYou can download web2py from the official web site:\nhttp://www.web2py.com\nweb2py is composed of the following components:\nlibraries: provide core functionality of web2py and are accessible programmatically.\nweb server: the Rocket WSGI web server.\nthe adminapplication: used to create, design, and manage other web2py applications.adminprovides a complete web-based Integrated Development Environment (IDE) for building web2py applications. It also includes other functionality, such as web-based testing and a web-based shell.\nthe examplesapplication: contains documentation and interactive examples.examplesis a clone of the official web2py.com web site, and includes epydoc documentation.\nthe welcomeapplication: the basic scaffolding template for any other application. By default it includes a pure CSS cascading menu and user authentication (discussed in Chapter 9).\nweb2py is distributed in source code, and in binary form for Microsoft Windows and for Mac OS X.\nThe source code distribution can be used in any platform where Python runs and includes the above-mentioned components. To run the source code, you need Python 2.5, 2.6 or 2.7 pre-installed on the system. You also need one of the supported database engines installed. For testing and light-demand applications, you can use the SQLite database, included with Python 2.7.\nThe binary versions of web2py (for Windows and Mac OS X) include a Python 2.7 interpreter and the SQLite database. Technically, these two are not components of web2py. Including them in the binary distributions enables you to run web2py out of the box.\nThe following image depicts the overall web2py structure:\nAt the bottom we find the interpreter. Moving up we find the web server (rocket), the libraries, and the applications. Each application consists for its own MVC design (models, controllers, views, modules, languages, databases, and static files). Each application includes it own database administration code (appadmin). Every web2py instance ships with three applications: welcome (the scaffolding app), admin (the web based IDE), and examples (copy of website and examples).\nAbout this book\nThis book includes the following chapters, besides this introduction:\nChapter 2 is a minimalist introduction to Python. It assumes knowledge of both procedural and object-oriented programming concepts such as loops, conditions, function calls and classes, and covers basic Python syntax. It also covers examples of Python modules that are used throughout the book. If you already know Python, you may skip Chapter 2.\nChapter 3 shows how to start web2py, discusses the administrative interface, and guides the reader through various examples of increasing complexity: an application that returns a string, a counter application, an image blog, and a full blown wiki application that allows image uploads and comments, provides authentication, authorization, web services and an RSS feed. While reading this chapter, you may need to refer to Chapter 2 for general Python syntax and to the following chapters for a more detailed reference about the functions that are used.\nChapter 4 covers more systematically the core structure and libraries: URL mapping, request, response, sessions, caching, scheduler, cron, internationalization and general workflow.\nChapter 5 is a reference for the template language used to build views. It shows how to embed Python code into HTML, and demonstrates the use of helpers (objects that can generate HTML).\nChapter 6 covers the Database Abstraction Layer, or DAL. The syntax of the DAL is presented through a series of examples.\nChapter 7 covers forms, form validation and form processing. FORM is the low level helper for form building. SQLFORM is the high level form builder. In Chapter 7 we also discuss Create/Read/Update/Delete (CRUD) API.\nChapter 8 covers communication features as retrieving and sending emails and SMSes.\nChapter 9 covers authentication, authorization and the extensible Role-Based Access Control mechanism available in web2py. Mail configuration and CAPTCHA are also discussed here, since they are used for authentication. In the third edition of the book we have added extensive coverage of integration with third-party authentication mechanisms such as OpenID, OAuth, Google, Facebook, LinkedIn, etc.\nChapter 10 is about creating web services in web2py. We provide examples of integration with the Google Web Toolkit via Pyjamas, and with Adobe Flash via PyAMF.\nChapter 11 is about web2py and jQuery recipes. web2py is designed mainly for server-side programming, but it includes jQuery, since we have found it to be the best open-source JavaScript library available for effects and Ajax. In this chapter, we discuss how to effectively use jQuery with web2py.\nChapter 12 discusses web2py components and plugins as a way to build modular applications. We provide an example of a plugin that implements many commonly used functionality, such as charting, comments, and tagging.\nChapter 13 is about production deployment of web2py applications. We specifically discuss the deployment on a LAMP web server (which we consider the main deployment alternative). We discuss alternative web servers, and configuration of the PostgreSQL database. We discuss running as a service on a Microsoft Windows environment, and deployment on some specific platforms including Google Applications Engine, Heroku, and PythonAnywhere. In this chapter, we also discuss security and scalability issues.\nChapter 14 contains a variety of other recipes to solve specific tasks, including upgrades, geocoding, pagination, the Twitter API, and more.\nChapter 15 has information and helping and contributing to the project, with topics such as making bug reports and contributing changes to the code.\nThis book only covers basic web2py functionalities and the API that ships with web2py. This book does not cover web2py appliances (i.e. ready made applications).\nYou can download web2py appliances from the corresponding web site [appliances].\nThis book has been written using the MARKMIN syntax See Chapter 5 and automatically converted to HTML, LaTeX and PDF.\nSupport\nThe main support channel is the usergroup[usergroup], with dozens of posts every day. Even if you're a newbie, don't hesitate to ask - we'll be pleased to help you. There is also a formal issue tracker system on http://code.google.com/p/web2py/issues . Last but not least, you can have professional support (see the web site for details).\nContribute\nAny help is really appreciated. You can help other users on the user group, or by directly submitting patches on the program (at the GitHub site https://github.com/web2py/web2py). Even if you find a typo on this book, or have an improvement on it, the best way to help is by patching the book itself (which is under the source folder of the repository at https://github.com/mdipierro/web2py-book). For more information on contributing, please see Chapter 15\nElements of style\nPEP8 [style] contains good style practices when programming with Python. You will find that web2py does not always follow these rules. This is not because of omissions or negligence; it is our belief that the users of web2py should follow these rules and we encourage it. We chose not to follow some of those rules when defining web2py helper objects in order to minimize the probability of name conflict with objects defined by the user.\nFor example, the class that represents a
is called DIV, while according to the Python style reference it should have been called Div. We believe that, for this specific example that using an all-upper-case \"DIV\" is a more natural choice. Moreover, this approach leaves programmers free to create a class called \"Div\" if they choose to do so. Our syntax also maps naturally into the DOM notation of most browsers (including, for example, Firefox).\nAccording to the Python style guide, all-upper-case strings should be used for constants and not variables. Continuing with our example, even considering that DIV is a class, it is a special class that should never be modified by the user because doing so would break other web2py applications. Hence, we believe this qualifies the DIV class as something that should be treated as a constant, further justifying our choice of notation.\nIn summary, the following conventions are followed:\nHTML helpers and validators are all upper case for the reasons discussed above (for example DIV,A,FORM,URL).\nThe translator object Tis upper case despite the fact that it is an instance of a class and not a class itself. Logically the translator object performs an action similar to the HTML helpers, it affects rendering part of the presentation. Also,Tneeds to be easy to locate in the code and must have a short name.\nDAL classes follow the Python style guide (first letter capitalized), for example Table,Field,Query,Row,Rows, etc.\nIn all other cases we believe we have followed, as much as possible, the Python Style Guide (PEP8). For example all instance objects are lower-case (request, response, session, cache), and all internal classes are capitalized.\nIn all the examples of this book, web2py keywords are shown in bold, while strings and comments are shown in italic.\nLicense\nweb2py is licensed under the LGPL version 3 License. The full text of the license is available in ref.[lgpl3].\nIn accordance with LGPL you may:\nredistribute web2py with your apps (including official web2py binary versions)\nrelease your applications which use official web2py libraries under any license you wish\nYet you must:\nmake clear in the documentation that your application uses web2py\nrelease any modification of the web2py libraries under the LGPLv3 license\nThe license includes the usual disclaimer:\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\nEarlier versions\nEarlier versions of web2py, 1.0.*-1.90.*, were released under the GPL2 license plus a commercial exception which, for practical purposes, was very similar to the current LGPLv3.\nThird party software distributed with web2py\nweb2py contains third party software under the gluon/contrib/ folder and various JavaScript and CSS files. These files are distributed with web2py under their original licenses, as stated in the files.\nAcknowledgments\nweb2py was originally developed by and copyrighted by Massimo Di Pierro. The first version (1.0) was released in October, 2007. Since then it has been adopted by many users, some of whom have also contributed bug reports, testing, debugging, patches, and proofreading of this book.\nSome of the major developers and contributors are, in alphabetical order by first name:\nAdam Bryzak, Adam Gojdas, Adrian Klaver, Alain Boulch, Alan Etkin, Alec Taylor, Alexandre Andrade, Alexey Nezhdanov, Alvaro Justen, Anand Vaidya, Anatoly Belyakov, Ander Arbelaiz, Anders Roos, Andrew Replogle, Andrew Willimott, Angelo Compagnucci, Angelo and Villas, Annet Vermeer, Anthony Bastardi, Anton Muecki, Antonio Ramos, Arun Rajeevan, Attila Csipa, Ben Goosman, Ben Reinhart, Benjamin, Bernd Rothert, Bill Ferret, Blomqvist, Boris Manojlovic, Branko Vukelic, Brent Zeiben, Brian Cottingham, Brian Harrison, Brian Meredyk, Bruno Rocha, CJ Lazell, Caleb Hattingh, Carlos Galindo, Carlos Hanson, Carsten Haese, Cedric Meyer, Charles Law, Charles Winebrinner, Chris Clark, Chris May, Chris Sanders, Christian Foster Howes, Christopher Smiga, Christopher Steel, Clavin Sim, Cliff Kachinske, Corne Dickens, Craig Younkins, Dan McGee, Dan Ragubba, Dane Wright, Danny Morgan, Daniel Gonz, Daniel Haag, Daniel Lin, Dave Stoll, David Adley, David Harrison, David Lin, David Marko, David Wagner, Denes Lengyel, Diaz Luis, Dirk Krause, Dominic Koenig, Doug Warren, Douglas Philips, Douglas Soares de Andrade, Douglas and Alan, Dustin Bensing, Elcio Ferreira, Eric Vicenti, Erwin Olario, Falko Krause, Farsheed Ashouri, Felipe Meirelles, Flavien Scheurer, Fran Boon, Francisco Gama, Fred Yanowski, Friedrich Weber, Gabriele Alberti, Gergely Kontra, Gergely Peli, Gerley Kontra, Gilson Filho, Glenn Caltech, Graham Dumpleton, Gregory Benjamin, Gustavo Di Pietro, Gyuris Szabolcs, Hamdy Abdel-Badeea, Hans C. v. Stockhausen, Hans Donner, Hans Murx, Huaiyu Wang, Ian Reinhart Geiser, Iceberg, Igor Gassko, Ismael Serratos, Jan Beilicke, Jay Kelkar, Jeff Bauer, Jesus Matrinez, Jim Karsten, Joachim Breitsprecher, Joakim Eriksson, Joe Barnhart, Joel Carrier, Joel Samuelsson, John Heenan, Jon Romero, Jonas Rundberg, Jonathan Benn, Jonathan Lundell, Jose Jachuf, Joseph Piron, Josh Goldfoot, Josh Jaques, Jose Vicente de Sousa, Jurgis Pralgauskis, Keith Yang, Kenji Hosoda, Kenneth Lundstr, Kirill Spitsin, Kyle Smith, Larry Weinberg, Limodou, Loren McGinnis, Louis DaPrato, Luca De Alfaro, Luca Zachetti, Lucas D'Avila, Madhukar R Pai, Manuele Presenti, Marc Abramowitz, Marcel Hellkamp, Marcel Leuthi, Marcello Della Longa, Margaret Greaney, Maria Mitica, Mariano Reingart, Marin Prajic, Marin Pranji, Marius van Niekerk, Mark Kirkwood, Mark Larsen, Mark Moore, Markus Gritsch, Mart Senecal, Martin Hufsky, Martin Mulone, Martin Weissenboeck, Mateusz Banach, Mathew Grabau, Mathieu Clabaut, Matt Doiron, Matthew Norris, Michael Fig, Michael Herman, Michael Howden, Michael Jursa, Michael Toomim, Michael Willis, Michele Comitini, Miguel Goncalves, Miguel Lopez, Mike Amy, Mike Dickun, Mike Ellis, Mike Pechkin, Milan Melena, Muhammet Aydin, Napoleon Moreno, Nathan Freeze, Niall Sweeny, Niccolo Polo, Nick Groenke, Nick Vargish, Nico de Groot, Nico Zanferrari, Nicolas Bruxer, Nik Klever, Olaf Ferger, Oliver Dain, Olivier Roch Vilato, Omi Chiba, Ondrej Such, Ont Rif, Oscar Benjamin, Osman Masood, Ovidio Marinho Falcao Neto, Pai, Panos Jee, Paolo Betti, Paolo Caruccio, Paolo Gasparello, Paolo Valleri, Patrick Breitenbach, Pearu Peterson, Peli Gergely, Pete Hunt, Peter Kirchner, Phyo Arkar Lwin, Pierre Thibault, Pieter Muller, Piotr Banasziewicz, Ramjee Ganti, Richard Gordon, Richard Ree, Robert Kooij, Robert Valentak, Roberto Perdomo, Robin Bhattacharyya, Roman Bataev, Ron McOuat, Ross Peoples, Ruijun Luo, Running Calm, Ryan Seto, Salomon Derossi, Sam Sheftel, Scott Roberts, Sebastian Ortiz, Sergey Podlesnyi, Sharriff Aina, Simone Bizzotto, Sriram Durbha, Sterling Hankins, Stuart Rackham, Telman Yusupov, Thadeus Burgess, Thomas Dallagnese, Tim Farrell, Tim Michelsen, Tim Richardson, Timothy Farrell, Tito Garrido, Tyrone Hattingh, Vasile Ermicioi, Vidul Nikolaev Petrov, Vidul Petrov, Vinicius Assef, Vladimir Donnikov, Vladyslav Kozlovsky, Vladyslav Kozlovskyy, Wang Huaiyu, Wen Gong, Wes James, Will Stevens, Yair Eshel, Yarko Tymciurak, Yoshiyuki Nakamura, Younghyun Jo, Zahariash.\nI am sure I forgot somebody, so I apologize.\nI particularly thank Anthony, Jonathan, Mariano, Bruno, Vladyslav, Martin, Nathan, Simone, Thadeus, Tim, Iceberg, Denes, Hans, Christian, Fran and Patrick for their major contributions to web2py and Anthony, Alvaro, Brian, Bruno, Denes, Dane Denny, Erwin, Felipe, Graham, Jonathan, Hans, Kyle, Mark, Margaret, Michele, Nico, Richard, Roberto, Robin, Roman, Scott, Shane, Sharriff, Sriram, Sterling, Stuart, Thadeus, Wen (and others) for proofreading various versions of this book. Their contribution was invaluable. If you find any errors in this book, they are exclusively my fault, probably introduced by a last-minute edit. I also thank Ryan Steffen of Wiley Custom Learning Solutions for help with publishing the first edition of this book.\nweb2py contains code from the following authors, whom I would like to thank:\nGuido van Rossum for Python[python], Peter Hunt, Richard Gordon, Timothy Farrell for the Rocket[rocket] web server, Christopher Dolivet for EditArea[editarea], Bob Ippolito for simplejson[simplejson], Simon Cusack and Grant Edwards for pyRTF[pyrtf], Dalke Scientific Software for pyRSS2Gen[pyrss2gen], Mark Pilgrim for feedparser[feedparser], Trent Mick for markdown2[markdown2], Allan Saddi for fcgi.py, Evan Martin for the Python memcache module[memcache], John Resig for jQuery[jquery].\nI thank Helmut Epp (provost of DePaul University), David Miller (Dean of the College of Computing and Digital Media of DePaul University), and Estia Eichten (Member of MetaCryption LLC), for their continuous trust and support.\nFinally, I wish to thank my wife, Claudia, and my son, Marco, for putting up with me during the many hours I have spent developing web2py, exchanging emails with users and collaborators, and writing this book. This book is dedicated to them.\ntop"}}},{"rowIdx":245,"cells":{"text":{"kind":"string","value":"Not sure why this error is appearing. I've searched around to no avail. I decided to take a punt at making my script run multi-threaded using the multiprocessing module, and if I remove that code the script runs fine.\nSo I ran the debugger and it also doesn't encounter any error with the multi-threading code, which seems a bit weird. But when I try to run the script just normally, it prints under 3.2.3:\nPython 3.2.3 (default, Apr 11 2012, 07:12:16) [MSC v.1500 64 bit (AMD64)]\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n[evaluate scratch.py]\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"C:\\Python32\\Lib\\multiprocessing\\forking.py\", line 369, in main\n self = load(from_parent)\nAttributeError: 'module' object has no attribute 'search_letters_in_words'\nTraceback (most recent call last):\n File \"C:\\Program Files (x86)\\Wing IDE 4.1\\src\\debug\\tserver\\_sandbox.py\", line 122, in \n File \"C:\\Python32\\Lib\\multiprocessing\\process.py\", line 132, in start\n self._popen = Popen(self)\n File \"C:\\Python32\\Lib\\multiprocessing\\forking.py\", line 269, in __init__\n to_child.close()\nbuiltins.IOError: [Errno 22] Invalid argument\n\nEdit: I switched over to 3.3 to see what happens and it unconsistently consistently throws one of these two tracebacks:\nPython 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)]\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n[evaluate scratch.py]\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"C:\\Python33\\Lib\\multiprocessing\\forking.py\", line 344, in main\n self = load(from_parent)\nAttributeError: 'module' object has no attribute 'search_letters_in_words'\nTraceback (most recent call last):\n File \"C:\\Program Files (x86)\\Wing IDE 4.1\\src\\debug\\tserver\\_sandbox.py\", line 122, in \n File \"C:\\Python33\\Lib\\multiprocessing\\process.py\", line 111, in start\n self._popen = Popen(self)\n File \"C:\\Python33\\Lib\\multiprocessing\\forking.py\", line 243, in __init__\n dump(process_obj, to_child, HIGHEST_PROTOCOL)\n File \"C:\\Python33\\Lib\\multiprocessing\\forking.py\", line 160, in dump\n ForkingPickler(file, protocol).dump(obj)\nbuiltins.BrokenPipeError: [Errno 32] Broken pipe\nPython 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)]\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n[evaluate scratch.py]\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"C:\\Python33\\Lib\\multiprocessing\\forking.py\", line 344, in main\n self = load(from_parent)\nAttributeError: 'module' object has no attribute 'search_letters_in_words'\n\nEdit #2 Added traceback when calling from the commandline:\nD:\\Python\\PythonRepo>scratch.py > d:\\download\\error.txt\nTraceback (most recent call last):\n File \"D:\\Python\\PythonRepo\\scratch.py\", line 122, in \n thread.start()\n File \"C:\\Python32\\Lib\\multiprocessing\\process.py\", line 131, in start\n from .forking import Popen\n File \"C:\\Python32\\Lib\\multiprocessing\\forking.py\", line 180, in \n import _subprocess\nImportError: No module named '_subprocess'\n\nHere's the multiprocessing code I've written so far. It could be (hah who am I kidding, probably is!)buggy but I'm not sure what's wrong as it looks correct (doesn't it always?).\nwordList = pickle.load( open( r'd:\\download\\allwords.pickle', 'rb')) #a list\ncombos = make_letter_combinations(3) # a list\nsplit = split_list_multi(combos) #2 item tuple with a dict and a number\nif __name__ == '__main__':\n multiprocessing.freeze_support()\n jobs = []\n for num in range(split[1]):\n listLetters = split[0][str(num)] #a list\n thread = multiprocessing.Process(target=search_letters_in_words, args=(listLetters,wordList))\n jobs.append(thread)\n thread.start()\n for j in jobs:\n j.join()\n\nEdit: Here's the search_letters_in_words_ function:\ndef search_letters_in_words(listOfLetters,wordlist):\n results = {}\n for letters in listOfLetters:\n results[letters] = [i for i in wordlist if letters in i]\n return results\n\nIf anyone could point out what I'm doing wrong I'd appreciate it!"}}},{"rowIdx":246,"cells":{"text":{"kind":"string","value":"gtk.RadioAction — an action that can be grouped so that only one can be active (new in PyGTK 2.4)\nclass gtk.RadioAction(gtk.ToggleAction):\n gtk.RadioAction(name, label, tooltip, stock_id, value)\n def set_group(group)\n def get_group()\n def set_current_value()\n def get_current_value()\n\n\"changed\"\ndef callback(\nThis object is available in PyGTK 2.4 and above.\ngtk.RadioAction(name, label, tooltip, stock_id, value)\n\nA unique name for the action\nThe label displayed in menu items and on buttons\nA tooltip for this action\nThe stock icon to display in widgets representing this action\nA unique integer value that get_current_value() should return if this action is selected.\na new gtk.RadioAction\nThis constructor is available in PyGTK 2.4 and above.\nCreates a new gtk.RadioActionobject suing the properties specified by: name,\nlabeltooltipstock_idvaluegtk.ActionGroupand set the accelerator for the action, call the gtk.ActionGroup.add_action_with_accel().\ndef set_group(group)\n\nanother gtk.RadioAction or None\nThis method is available in PyGTK 2.4 and above.\nThe set_group() method sets the radiogroup for the radio action to the same group as the gtk.RadioActionspecified by group i.e. the radio action joins thegroup.\nIn PyGTK 2.6.2 and above, if group is\nNone the radio action is removed from its currentgroup.\ndef get_group()\n\na list containing the radio actions in the group or None\nThis method is available in PyGTK 2.4 and above.\nThe get_group() method returns a listcontaining the group that the radio action belongs to orNone if the radio action is not part of a group.\ndef set_current_value()\n\nthe new value.\nThis method is available in PyGTK 2.10 and above.\nThe get_current_value() method sets the currently active group member to the member with value property current_value.\ndef get_current_value()\n\nThe value of the currently active group member\nThis method is available in PyGTK 2.4 and above.\nThe get_current_value() method returnsthe \"value\" property of the the currently active member of the group thatthe radio action belongs to.\ndef callback(radioaction, current, user_param1, ...)\n\nthe radioaction that received the signal\nthe currently active gtk.RadioAction in the group\nthe first user parameter (if any) specifiedwith the connect()\nadditional user parameters (if any)\nThis signal is available in GTK+ 2.4 and above.\nThe \"changed\" signal is emitted on every member of a radio group when the active member is changed. The signal gets emitted after the \"activate\" signals for the previous and current active members."}}},{"rowIdx":247,"cells":{"text":{"kind":"string","value":"Trudy\nRésolu ! Ouvrir fenêtre Dépôts\nBonjour, Je voudrais savoir comment ouvrir la fenêtre Dépots, si je ne l'ai pas dans Système-Aministration ... Merci pour vos réponses !\nDernière modification par Trudy (Le 04/12/2005, à 15:57)\nHors ligne\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nCa s'appel \"Gestionnaire de paquets synaptic\" dans le chemin que tu donnes.......;)\nHors ligne\njanno59\nRe : Résolu ! Ouvrir fenêtre Dépôts\ndans systeme>administration>gestionnaire de paquets Synaptic.\nPuis onglet categorie.\nSinon en console\nsudo gedit /etc/apt/sources.list\n\njean\nHors ligne\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nMerci ! Mais, je voulais ouvrir cette fenêtre parce que lorsque j'ai voulu ouvrir le Gestionnaire de fichiers, \"il\" me disait:\n\" Les problèmes suivants ont été rencontrés: E. Le type \"breesy\" est inconnu sur la ligne 3 dans la liste des /sources/etc/apt E. impossible de lire la liste des sources\nVous pouvez essayer de corriger ce problème en ouvrant la fenêtr'e des dépots !\nJ'ai fait ce que Jean tu me conseillais et sur la console, cela ouvre une fenêtre sources.list(etc/apt) - gedidt avec cela d'écrit:\n#deb cdrom:[Ubuntu 5.10 _Breezy Badger_ - Release i386 (20051012)]/\nbreezy main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\n## Uncomment the following two lines to add software from the 'universe'\n## repository.\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team, and may not be under a free licence. Please satisfy yourself as to\n## your rights to use the software. Also, please note that software in\n## universe WILL NOT receive any review or updates from the Ubuntu security\n## team.\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy universe\ndeb http://fr.archive.ubuntu.com/ubuntu breezy multiverse universe\nmain restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy multiverse\n## Uncomment the following two lines to add software from the 'backports'\n## repository.\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\n# deb http://fr.archive.ubuntu.com/ubuntu breezy-backports main\nrestricted universe multiverse\n# deb-src http://fr.archive.ubuntu.com/ubuntu breezy-backports main\nrestricted universe multiverse\n# PLF repositories, contains litigious packages, see\nhttp://wiki.ubuntu-fr.org/doc/plf\ndeb http://archive.ubuntu.com/ubuntu hoary main restricted multiverse universe\ndeb-src http://archive.ubuntu.com/ubuntu hoary main restricted\nmultiverse universe\ndeb http://archive.ubuntu.com/ubuntu hoary-updates main restricted\ndeb-src http://archive.ubuntu.com/ubuntu hoary-updates main restricted\ndeb http://security.ubuntu.com/ubuntu hoary-security main restricted universe\ndeb-src http://security.ubuntu.com/ubuntu hoary-security main\nrestricted universe\n## Freecontrib, funny packages by the Ubuntu PLF Team\ndeb ftp://ftp.free.fr/pub/Distributions_Linux/plf/ubuntu/plf/ breezy\nfree non-free\ndeb-src ftp://ftp.free.fr/pub/Distributions_Linux/plf/ubuntu/plf/\nbreezy free non-free\ndeb ftp://ftp.free.fr/pub/Distributions_Linux/plf/ubuntu/freecontrib/\nbreezy free non-free\ndeb-src ftp://ftp.free.fr/pub/Distributions_Linux/plf/ubuntu/freecontrib/\nbreezy free non-free\ndeb http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\ndeb-src http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\ndeb http://fr.archive.ubuntu.com/ubuntu/ breezy universe\nQue devrais je faire avec ça ?? Merci pour vos réponses ! !\nExcusez moi si le texte est long ! !\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nBonjour,\nSi tu es sous Hoary il te faut un sources.list avec les dépots Hoary\nSi tu es sous Breezy il te faut un sources.list avec les dépots Breezy\nTon sources.list est un mix des 2\nA+\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nMerci ! ! Mais je fais quoi et comment ??\nSois gentil de tout m'expliquer, je débute sur Ubuntu ! !\nMerci !\nEt sur le Terminal après que j'ai mis ce que Jean conseillait il est dit :\n\"(gedit:17907): GnomePrint-WARNING **: Could not create filter from description ' frgba': filter 'frgba' is unknown\n(gedit:17907): GnomePrintCupsPlugin-WARNING **: iconv does not support ppd character encoding: ISOLatin1, trying CSISOLatin1\ngaetane@linux:~$\nDernière modification par Trudy (Le 04/12/2005, à 12:17)\nHors ligne\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nTiens ,je te refiles le miens, se sera plus clair,on sais jamais si tu enlèeve des dépots qui fallait pas....\nAu fait, tu es bien en breezy ??? sinon il est pas valable !\n#deb cdrom:[Ubuntu 5.10 _Breezy Badger_ - Release i386 (20051012)]/ breezy main restricted\ndeb http://fr.archive.ubuntu.com/ubuntu breezy main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\n## Uncomment the following two lines to add software from the 'universe'\n## repository.\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team, and may not be under a free licence. Please satisfy yourself as to\n## your rights to use the software. Also, please note that software in\n## universe WILL NOT receive any review or updates from the Ubuntu security\n## team.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy universe\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy universe\ndeb http://fr.archive.ubuntu.com/ubuntu breezy multiverse\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy multiverse\n## Uncomment the following two lines to add software from the 'backports'\n## repository.\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\n# deb http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\n# deb-src http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\ndeb http://security.ubuntu.com/ubuntu breezy-security main restricted\ndeb-src http://security.ubuntu.com/ubuntu breezy-security main restricted\ndeb http://security.ubuntu.com/ubuntu breezy-security universe\ndeb-src http://security.ubuntu.com/ubuntu breezy-security universe\ndeb http://security.ubuntu.com/ubuntu breezy-security multiverse\ndeb-src http://security.ubuntu.com/ubuntu breezy-security multiverse\n## PLF repositories, contains litigious packages, see http://wiki.ubuntu-fr.org/doc/plf\ndeb http://antesis.freecontrib.org/mirrors/ubuntu/plf/ breezy free non-free\ndeb-src http://antesis.freecontrib.org/mirrors/ubuntu/plf/ breezy free non-free\n## Freecontrib, funny packages by the Ubuntu PLF Team\ndeb http://antesis.freecontrib.org/mirrors/ubuntu/freecontrib/ breezy free non-free\ndeb-src http://antesis.freecontrib.org/mirrors/ubuntu/freecontrib/ breezy free non-free\nHors ligne\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nMerci !\nComment je peux savoir si je suis sur breezy ?? Michel disait que mon \"source list\" est un mixe des deux ?? (Hoary et Breezy)!\nJe ne sais pas ce que c'est Breezy et Hoary !!!!\nHors ligne\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nQuand l'as tu installé ? as tu fais un apt-get dist-upgrade ? vas en console, et tape dedans uname -a et copie/colle le resultat ....\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nRe\nHoary est la version 5.04, Breezy la version 5.10 ( a.mm)\nQuel Kernel utilises-tu : 2.6.12-xx Brezy\nDans Applications ---> Outils Système as-tu Editeur de menu Applications ? Si oui, Breezy\nA+\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nVoilà le résultat !\nLinux linux 2.6.12-10-386 #1 Fri Nov 18 11:51:02 UTC 2005 i686 GNU/Linux\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nBreezy, on a posté presque en même temps\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nMichel, oui, j'ai editeur de Menu\nDonc je serais Breezy ! ?\nQu'est ce que c'est \"Kernel' ? Et Breezy et Hoary ?? Des variantes de Ubuntu ???\nDernière modification par Trudy (Le 04/12/2005, à 12:57)\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nPas des variantes, disons des versions d'Ubuntu. Il y a eu Warty, Hoary, Breezy Badger étant la dernière stable, sortie le 13/10/05.\nLa prochaine version sera la Dapper Drake qui est en unstable (testing on va dire) actuellement.\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nBon, je viens de copier coller ce que m'a donné Express ses sources.list.\nEt je retourne pour essayer d'ouvrir mon Gestionnaire de paquets Synaptic, et cela revient comme je vous l'ai mis ci dessus : les deux erreurs ! ! ??? Pourtant, cela devrait marcher, puisque je suis Breezy ! ! ????\nHors ligne\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nUne nouvelle version tous les 6 Mois, numérotés de cette façon ,le premier = l'année ! :\n4.10-->Warty\n5.04-->Hoary\n5.10-->Breezy\n6.04-->Dapper Drake (la prochaine version,actuellement \"unstable\")\nDernière modification par Express (Le 04/12/2005, à 13:10)\nHors ligne\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nSi tu as copier/coller ce que je t'ai fournis, il faut en suite ouvrir le gestionnaire comme tu le fais , mais en haut à gauche tu dois cliquer sur l'onglet \"recharger\" ou alors en console tu fais : sudo apt-get update\nDernière modification par Express (Le 04/12/2005, à 13:14)\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nCopy le sources.list que t'a donné Express\nsudo gedit /etc/apt/sources.list\nSelectionne tout dans ton sources.list colle le sources.list d'express, enregistre le.\nDans un terminal: sudo apt-get update\net après ça marchera\nA+\nDernière modification par michel2652 (Le 04/12/2005, à 14:14)\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nExpress, je te laisse on poste en double :):)\nA+\nExpress\nRe : Résolu ! Ouvrir fenêtre Dépôts\nExpress, je te laisse on poste en double :):)\nA+\n:( mais on n'est pas trops de deux .....\nHors ligne\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nJ'ai \"copié-collé\" ce que tu m'as fourni. J'ai ouvert le Gestionnaire de fichiers, j'ai cliqué sur \"Recharger\" : ces deux erreurs reviennent ! !\nPuis: Echec du téléchargement de tous les fichiers d'index\nLe dépot ne semble plus être disponible ou ne peut être contacté, à cause d'un problème de réseau (??) S'il reste un fichier d'index plus ancien, il sera utlisé, sinon le dépot sera ignoré !\n?????\nHors ligne\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nRebonjour ! !\nJ'ai fait, comme tout au début Jeano me le conseiollait: sudo gedit /etc/apt/sources.list\nLà dans la fenêtre qui s'est ouverte, j'ai tout effacé et copie ce que Express m'avait fourni ! !\nMaintenant, Michel, tu me dis d'écrire dans le Terminal : sudo gedit /etc/X11/xorg.conf Et c'est une toute autre fenêtre qui s'ouvre ! ! ??? dois faire la même chose dans celle ci: effacer ce qu'il y a et y mettre le texte d'Express ??? Ou ai je fait l'erreur ??\nHors ligne\nmichel2652\nRe : Résolu ! Ouvrir fenêtre Dépôts\nRe,\nsudo gedit\nCopy ce sources.list\ndeb http://fr.archive.ubuntu.com/ubuntu breezy universe main restricted multiverse\ndeb http://security.ubuntu.com/ubuntu breezy-security universe main restricted multiverse\ndeb http://archive.ubuntu.com/ubuntu/ breezy-updates main restricted universe multiverse\n#Backports\ndeb http://archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\ndeb http://ubuntu-backports.mirrormax.net/ breezy-extras main restricted universe multiverse\n#PLF\ndeb http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\ndeb-src http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\n\nFicheir ---> Enregistrer sous ---> Nom du fichier sources.list\nEnregistrer dans le dossier /etc/apt\nLe fichier existe déjà, remplacer\nConsole sudo apt-get update\nCa doit etre bon\nA+\nDernière modification par michel2652 (Le 04/12/2005, à 13:47)\nTrudy\nRe : Résolu ! Ouvrir fenêtre Dépôts\nMerci !! Mais dans le terminal vient: E: Le type « breezy » est inconnu sur la ligne 3 dans la liste des sources /etc/ apt/sources.list\nC'est peut être parce que je n'ai pas effacé ce qu'il y avait avant de copier coller ce que tu viens de me donner ???\nDernière modification par Trudy (Le 04/12/2005, à 13:56)\nHors ligne"}}},{"rowIdx":248,"cells":{"text":{"kind":"string","value":"doudoulolita\nFaire une animation sur la création de jeux vidéo libres\nDans le topic Création de jeu vidéo libre - Appel à candidatures, j'ai découvert le créateur de jeu de Ultimate Smash Friends, Tshirtman.\nVoici ce que je lui ai écrit:\nJe cherche un jeu que notre Espace Public Numérique pourrait proposer aux jeunes sur Linux, voire les inciter à participer au projet de développement. smile\nMais j'ai du mal à installer Ultimate smash friends chez moi sur Ubuntu Studio Jaunty... mad\nLe lien du paquet en .deb sur http://usf.tuxfamily.org/wiki/Download#Requirements ne fonctionne pas.\nJ'ai finalement trouvé le paquet en .deb sur cette page en suivant le lien indiqué au bas de la précédente (ouf !).\nMais à l'install avec Gdebi, il m'indique qu'il manque python-support.\nPourtant, j'ai vérifié que j'avais python (version 2.6, faut-il la version 2.3 ?) et j'ai installé python-pygame juste avant.\npython-support est bien installé (j'ai vérifié dans synaptic), alors ?\nC'est le genre de problème qui n'incitera pas les jeunes à se mettre sous Linux, ça, le moindre effort leur est insupportable, les pauvres chéris... cool\nLa page d'Ultimate-smash-friends destinée aux développeurs fait un peu peur ! Je dois avouer que moi qui aime dessiner (en utilisant Gimp, Inkscape mais je tate aussi de la 3D avec Blender), j'aimerais participer à titre individuel, mais je n'y comprends goutte !\nLa discussion s'est poursuivie sur Ultimate Smash Friends: un smash bros like en python\nComme le sujet semblait intéresser plusieurs personnes, je propose de continuer la conversation sur la façon de mener cette animation ici.\nVoici où m'avait menée ma réflexion:\nAnimation: programmation\nTrouver une animation permettant d'aborder les notions de base de la programmation, outre ses composantes graphiques, me paraît intéressant, à terme. cool\nEn tout cas, l'idée reste de travailler sous Linux et en logiciel libre. Donc XNA, on oublie, désolée LittleWhite. wink\nL'idée d'un saut pourraît être sympa si ce n'est pas trop complexe, mais on pourrait imaginer des animations progressives et variables suivant l'âge, le niveau et le degré de motivation des jeunes.\nOn a seulement 2 gamins qui pourraient comprendre et apprécier l'aspect mathématique de la programmation , tandis que les autres risquent d'être vite découragés.\nIl faudra plus graphique ou plus simple pour ceux-là (même moi, les fonctions Sinus et Cosinus, j'ai oublié et je n'aimais pas ça quand j'étais jeune! wink)\nMais je vois la possibilité d'animation par étapes de plus en plus complexes:\n1 - sous Tuxpaint, il y a un des jeux qui permet de réaliser une petite animation en faisant bouger le personnage.\n2 - Sous Kturtle, on fait la même chose mais en code pour déplacer la tortue.\n3 - Décomposition graphique du saut - Réalisation des images sur Gimp (ou un programme encore plus simple pour les 8-9 ans), Inkscape ou Blender.\n4 - Créer un gif animé placé sur un décor (en HTML avec CSS pour le background)\n5 - Afficher les images des étapes à l'aide d'une boucle (PHP ?)\n6 - Présenter le langage de programmation contenu dans USF et comment ça fonctionne (moteur de jeu et tout ce que je ne connais pas encore...).\n7 - Lire et tenter de comprendre une partie de code dans USF correspondant à un saut.\nInitiation au Python:\nIl y a peut-être plus simple que le saut, pour démarrer ?\nVoici les étapes possibles si on veut en arriver là:\n1 - Faire glisser le personnage suivant un seul axe.\n2 - Puis sur 2 axes (on glisse sur l'axe Y, on saute tout droit sur l'axe Z et on retombe).\n3 - Ensuite, on utilise 2 images pour la marche, ou 1 pour le glissement axe Y et 1 autre pour le saut axe Z\n4 - Montrer les courbes sinusoïdale d'un vrai saut dans Blender, etc...\nJe ne sais pas si Kturtle permet d'initier à ces courbes, mais ce serait peut-être plus simple qu'avec Python, non ?\nPython\nJe n'ai pas encore mis les mains et la tête dans Python mais je viens de prendre quelques bouquins à la bibliothèque sur le sujet. Je ne connais pour l'instant que des bribes de PHP et me contente d'essais simples (Mod'imprim ou, encore en phase test Multitours).\nJe n'ai meme pas encore utilisé pour mes essais une base MySQL, je vais me lancer bientôt (je connais un peu vu qu'on va parfois trafiquer directement dans notre base de donnée au boulot, pour quelques corrections).\nJ'espère que j'y arriverai en python, et si moi j'y arrive, tout le monde peut y arriver ! tongue\nFaire un jeu texte avec des enfants et des ados me semble impossible dans notre EPN, Tshirtman. Les notres sont difficiles à motiver. mad\nJouer, jouer, jouer, d'accord de leur côté, mais participer à une vraie animation construite et sur une certaine durée c'est beaucoup plus difficile pour notre public. sad\nKturtle\nJ'ai trouvé moi aussi de mon côté des programmes pour enfants permettant d'apprendre ou tout au moins d'aborder la programmation, basés sur le langage Logo.\nKturtle a effectivement l'avantage d'être très facile à installer (dispo dans les sources de Kubuntu et d'Ubuntu). J'ai plus de mal avec Xlogo ou Tangara.\nC'est peut-être un point de départ avant de passer à + compliqué. Mais on m'a dit que Logo était un peu dépassé, dans le genre langage de programmation très accessible. Qu'en pensez-vous ?\nProblèmes d'installation\nJe confirme que le paquet .deb que m'a proposé Tshirtman ne veut pas s'installer avec Gdebi sur ma Ubuntu Studio Jaunty. Il y a des dépendances brisées me dit-il.\nJ'essaierai plus tard l'autre solution, mais avec les gamins, faudra bien sûr que ce soit simple à installer, sous Linux comme sous Windows.\nNotez que chez nous, les gamins n'ont pas forcément Vista quand ils ont leur propre ordi car ils récupèrent souvent de vieux ordis sous XP ou pire encore. On n'en a aucun qui ait installé Linux pour l'instant, il n'y a qu'à notre EPN qu'ils le voient tourner, et le manque de jeux de haute qualité les fait tiquer.\nC'est justement là l'intérêt de travailler un jeu libre avec eux, en plus de chercher d'autres jeux libres plus perfectionnés peut-etre, mais moins faciles d'accès que USF pour des animations sur la programmation et/ou le design de jeux.\nEn tout cas, ça n'empêche pas de commencer des animations avant que le jeu soit parfait et facile à installer sur toutes les plateformes et versions, puisque nous les animateurs, on peut s'embêter avec une install plus compliquée.\nOn expliquera que pour l'installer chez eux (pour ceux qui ont un ordi), il faudra attendre un peu que les programmeurs bossent encore.\nMes collègues ont été mis tout récemment sur le coup, lors d'une réunion et je leur ai envoyé les liens seulement hier, donc c'est encore jeune comme projet.\nDernière modification par doudoulolita (Le 24/04/2010, à 17:09)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nbump\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nle problème c'est que l'approche de la boucle est fondamentalement fausse, elle n'a pas de sens dans la réalité d'un jeu vidéo, donc il ne faut pas la présenter à mon avis, ni toute autre solution aussi fausse, avoir expliqué le concept de la boucle de jeu permettrait normalement aux enfants d'en trouver une meilleur (ou moins fausse) directement, autant ne pas les embrouiller.\nBon, je reprendrai les étapes après avoir lu un peu sur la conception de jeux et la programmation, pour ne pas faire d'erreurs.\nMais dans les exemples de Kturtle, j'ai vu un truc qui me semble ressembler:\ninitialiserépète 3 [ avance 100 tournegauche 120]\nEst-ce que ce n'est pas une sorte de boucle ?\nDernière modification par doudoulolita (Le 24/04/2010, à 17:21)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nVoici le code que j'ai fait lors d'un essai avec Turtle:\ninitialise\ntaillecanevas 300,300\ncouleurcanevas 125,10,125\nlèvecrayon\nva 150,120\nrépète 18 {\nbaissecrayon\navance 10\nlèvecrayon\navance 10\ntournedroite 20\n}\nattends 1\nva 20,20\nécris \"J'ai fait tourner la tortue\"\ntournedroite 90\navance 200\nattends 1\nva 60,170\nattends 1\nrépète 18 {\nbaissecrayon\navance 10\nlèvecrayon\navance 10\ntournedroite 20\n}\nva 150,250\ntournegauche 90\nécris \"et de 2 !\"\ntournedroite 90\navance 100\nattends 1\nmessage \"C'est fini !\"\ninitialise\ntaillecanevas 300,300\ncouleurcanevas 125,10,125\ncentre\n\nC'est dommage que l'on ne puisse pas enregistrer sous forme de gif animé et que j'aie du mal à ouvrir le fichier .turtle à partir de l'explorateur.\nCe qui est super, c'est que la doc en ligne est en français et très simple à comprendre.\nIl y a quelques différences en fonction des versions: contrairement à ce quei est écrit sur la doc, je ne peux pas enregistrer comme page html mais comme une image en png.\nMais c'est déjà sympa si on pense à supprimer les dernières lignes du code bas du code (depuis message jusqu'à centre)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJe viens de commencer à apprendre Python en suivant le début du livre \"Initiation à la programmation avec Pyton et C++\" de Yves Bailly, éditions Pearson (2008).\nSur la capture d'écran ci-dessous, on voit le fichier dans l'explorateur de fichiers, l'éditeur de texte (kate) où on a écrit le programme qu'on a enregistré sous le nom python1.py et la console (toute noire toute triste, pour l'instant ) où on lance l'interpéteur python puis notre fichier python1.py par cette ligne de commande:\npython python1.py\nLe résultat s'affiche juste en dessous, dans la console, après avoir appuyé sur la touche \"Entrée\" du clavier.\nFinalement, ça commence assez facilement (d'autant que je connais déjà certains principes grâce à PHP). Il n'y a rien à installer sous Ubuntu car Python est inclus.\nLe résultat peut même être un peu graphique comme on le voit ici, en utilisant tirets et astérisques, entre autres signes.\nL'important est de bien écrire les lignes de code dans l'éditeur de texte, d'enregistrer puis de lancer la commande python python1.py dans la console + touche entrée pour voir le résultat.\nENCODAGE\nLa première ligne indique l'encodage utilisé, ici utf-8\nCHAÎNE\nAu début, j'ai utilisé des chaines, c.à.d des suites de caractères qu'on met entre guillemets ou entre apostrophes:\nex: \"Bonjour, Tshirtman !\"\nINSTRUCTION print\nPour que cette chaîne s'affiche, on utilise l'instruction print\nprint \"Bonjour, Tshirtman !\"\n\nVARIABLES\nle jeu est la première variable. On la définit par:\njeu_1 = \"Ultimate Smash Friends\"\nPour afficher le nom de jeu, je pourrai écrire:\nprint jeu_1\n\nLe résultat sera:Ultimate Smash Friends\nSi je remplace \"Ultimate Smash Friends\" par \"Kturtle\" dans la définition de la variable jeu_1, le résultat sera:Kturtle\nLes personnages sont les autres variables. On les définit par:\nperso_1 = \"BiX\"perso_2 = \"Blob\"\nPour afficher le nom des 2 personnages, je pourrai écrire:\nprint perso_1\nprint perso_2\n\nLe résultat sera BiXBlob\nCONCATÉNATION\nJe peux mettre tout ça à la suite les uns des autres en utilisant le signe +\nprint \"les personnages de \" + jeu_1 + \" sont \" + perso_1 + \" et \" + perso_2\n\nrésultat:les personnages de Ultimate Smash Friends sont BiX et Blob\nSÉPARATEUR EN TIRETS\nMon programme python1.py est assez complexe car il définit aussi une fonction permettant de faire des lignes de séparation en astériques et en tirets.\nJe ne donnerai pas ici tous les détails, trop complexes pour démarrer.\nMais voici comment réaliser une ligne composée de tirets uniquement (ou d'astérisques ou tout autre signe); c'est assez simple.\nPour compliquer et parvenir à mon résultat (c'est possible, même sans définir de fonction), vous devrez réfléchir un peu !\nLe principe, c'est de multiplier le tiret par le nombre de fois qu'on veut voir ce tiret apparaître.\nLe tiret est en fait une chaine d'1 seul caractère, donc on doit la mettre entre apostrophes au lieu de guillemets.\nsoit: '-'\nEnsuite, on utilise * pour effectuer la multiplication.\nPuis on met un chiffre assez grand pour que la ligne de tirets soit assez longue. 80 tirets, c'est pas mal, non ?\nLe code sera donc:\nprint '-'*80\n\nSi on veut changer ce chiffre de 80 par un autre facilement, le mieux serait de le transformer en variable nommée nb_tirets\nEXERCICE\nDéfinissez la variable nb_tirets qui représentera le nombre de tirets composant la ligne.\nImaginez la manière de coder pour faire une ligne de 20 tirets, en changeant juste la valeur de la variable.\nPuis faites une ligne de 20 astérisques.\nPuis concaténez (= aditionnez) les deux.\nRépétez 3 fois (on peut multiplier le code précédent par 3 en le mettant entre parenthèses).\nBon codage !\nDernière modification par doudoulolita (Le 25/04/2010, à 13:39)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nLe code est encore bien compliqué car je ne sais pas encore lister automatiquement mes personnages, mais j'utilise des fonctions définies en haut du code, que j'appelle ensuite au sein du programme.\nIl y a un petit problème d'encodage des accents quand je regarde ma page de code dans Firefox, mais chez moi, ça fonctionne comme il faut.\nTout ça ne bouge pas beaucoup, mais le côté graphique est amené progressivement.\nSi on veut faire une ligne de tirets en pouvant changer ensuite le nombre, on met ce nombre comme variable:\nnb_tirets = 80\nprint '-'*nb_tirets\n\nJe rappelle que le tiret doit être mis entre apostrophes puisqu'il s'agit d'une chaine d'un seul caractère.\nIl suffira de changer le chiffre 80 par un autre pour avoir une ligne plus courte ou plus longue.\nFONCTION\nMais on peut être amené à réutiliser plusieurs fois ce bout de code, en changeant à chaque fois le nombre de tirets, ce qui oblige à redéfinir la variable à chaque fois et à recopier tout ce code, pas évident !\nSi on accumule plusieurs instructions pour un même objet et qu'on a besoin plusieurs fois du même bout de code, une fonction sera vraiment très utile. Le programme fera appel à elle chaque fois qu'il en aura besoin puis reviendra dans le cours normal des instructions.\nOn va donc définir une fonction pour ce bout de code dessinant une ligne composée d'un nombre précis de tirets successifs, ce qui permettra de l'appeler ensuite quand on veut:\ndef Tirets(nb_tirets):\n chaine_tirets = '-'*nb_tirets\n return chaine_tirets\n\nNe pas oublier les 2 points après la parenthèse donnant l'argument de la fonction (c.à.d nb_tirets) et les tabulations avant chaine_tirets et return. Ce sont ces indentations (faites avec la touche Tab, dans Kate) qui indiquent que l'on est en train de définir la fonction.\nL'instruction return permet de faire un calcul, par exemple, sans l'afficher tout de suite.\nQuant on appelle cette fonction Tirets au sein du programme, on note entre parenthèses le nombre de tirets désiré. On doit mettre l'instruction print dans le programme avant le nom de la fonction car l'instruction return, présente dans la fonction, n'affiche rien. Cela donnera 80 tirets puis 30 tirets:\nprint Tirets(80)\nprint Tirets(30)\n\nSUGGÉRER UN ROCHER\nUn rocher est constitué du tiret vertical | (touche 6 + AltGr) au début et à la fin, et d'un nombre variable de tirets (touche 6, sans autre touche). La façon de réaliser un rocher est définie dans la fonction Rocher(nb_tirets).\ndef Rocher(nb_tirets):\n chaine_tirets = '|' + '-'*nb_tirets + '|'\n return chaine_tirets\n\nJe rappelle de nouveau que le tiret et le tiret vertical doivent être mis entre apostrophes puisqu'il s'agit pour chacun d'une chaine d'un seul caractère.\nIl faudra bien sûr appeler la fonction Rocher par l'instruction print Rocher(10) ou print Rocher(5) au sein du code en indiquant le nombre de tirets désirés (dans notre exemple: 10 ou 5) comme argument.\nESPACER LES ROCHERS\nEntre les rochers, il y a des espaces successifs appelés par la fonction Vide, avec en argument le nombre d'espaces (touche espace du clavier, tout bêtement).\ndef Vide(nb_espace):\n chaine_vide = ' '*nb_espace\n return chaine_vide\n\nCette fonction est même plus simple que pour réaliser un rocher ! Il faut juste penser à mettre un espace entre les apostrophes de la chaine.\nLa 1ère ligne de rochers comprend donc des vides de taille différente et des rochers de taille différente.\nprint Vide (3) + Rocher(5) + Vide(10) + Rocher(10) + 2*(Vide(5) + Rocher(5)) + \"\\n\"\n\nOn note que la succession d'un vide de 5 espaces et d'un rocher de 5 tirets est appelée 2 fois (en multipliant le contenu de la parenthèse par 2) comme ci-dessous:\n- Succession d'un vide de 5 espaces et d'un rocher de 5 tirets:\nprint Vide(5) + Rocher(5)\n\n- La même chose appelée 2 fois:\nprint 2*(Vide(5) + Rocher(5))\n\n2ème LIGNE DE ROCHERS\nPour la 2ème ligne de rochers, au lieu de changer la taille des vides \"à la main\", j'ai additionné le chiffre avec un autre au sein de la parenthèse de la fonction Vide, ou soustrait un nombre d'espaces au premier chiffre.\n- 1er vide de la 1ère ligne, de 3 espaces:\nprint Vide (3)\n\n- 1er vide de la 2ème ligne, de 3 espaces supplémentaires, soit 6 espaces:\nprint Vide (3+3)\n\n- 2ème vide de la 1ère ligne, de 10 espaces. Note : Pour cet exemple, l'instruction print ne se met que si vous faites l'essai isolé, sinon il faut concaténer avec le symbole + la ligne de code précédente avec celle-ci :\nprint Vide(10)\n\n- 2ème vide de la 2ème ligne, de 7 espaces en moins, soit 3 espaces restants:\nprint Vide(10-7)\n\nIl semble logique de ne pas changer la taille des rochers.\nSYMBOLISER LES PERSONNAGES\nAu-dessus des rochers, on a fait une ligne où chaque personnage est représenté par une lettre, rappelant sa forme dans le jeu.\nBiX = O Blob = A Stick = I\nIl y a des vides appelés par la fonction Vide entre les personnages (leur lettre) et un saut de ligne noté \"\\n\" à la fin de la ligne, code que vous avez remarqué seul dans le fichier à d'autres endroits, concaténé en fin de lignes.\nprint Vide(5) + perso_1 + Vide(15) + perso_2 + Vide(8) + perso_3 + \"\\n\"\nprint \"\\n\"\n\nDernière modification par doudoulolita (Le 25/04/2010, à 13:27)\nHors ligne\npsychederic\nRe : Faire une animation sur la création de jeux vidéo libres\nSi vous savez programmer , vous pouvez faire des programmes dans lequel, il n'y a plus besoin de programmer. (laissons la programmation à ceux que ca interresse des huluberlus comme nous, qui ne serons jamais la majorité de la population : point)\nPourquoi pas : a la fois du mba vers lua, et du devellopement tout graphique ( comme le jeu spore par exemple et le tout avec les avantages du libre , et d'une base de donnée de ressource libre)\nPar exemple, dans un premier temps utiliser syntensity, ou refaire un \"jeu complet\" mugen like avec paintown, c'est peut être ce que cherche les gens : et c'est à leur portée.\n( je note aussi qu'il manque aussi une partie scenario, que j'essairai de compléter )\nhttp://doc.ubuntu-fr.org/developpement_de_jeux_video\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\n@doudoulolita: eh ben! sacré démarrage heureux de voir que je t'inspire, j'ai un peu survolé tes explications, tu semble prendre les choses dans le bon sens bonne continuation\n@psychedric: bizarrement les tentatives pourtant souvent réalisées par des programmeurs très compétends, de créations de langages tout graphiques, n'ont rien donné de très utilisable, en effet, exprimer la même chose avec des boutons et des graphiques qu'avec des mots clées et des suites d'ordres, s'avère être contre productif, il est vrai que la majeur partie de la population ne sera jamais développeur, mais ça ne vient pas du langage utilisé, en fait, il semble qu'on puisse aisément déterminer qui sera potentiellement programmeur et qui ne le sera pas, par un simple test, avant même d'avoir enseigné les bases… ça peut paraitre élitiste, mais c'est malheureusement le cas, enfin être formé à la programmation semble être absoluement insuffisant pour s'assurer d'être un vrai développeur…\nhttp://www.codinghorror.com/blog/archives/000635.html\nhttp://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html\n(et dans les deux, une bonne myriade de liens très instructifs)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nMerci pour les liens que j'irai voir prochainement.\nDans mon optique, il ne s'agit pas que tous les jeunes et toutes les personnes à qui nous proposerions une telle animation deviennent de vrais développeurs.\nLe but du jeu est juste d'aborder, de faire découvrir la programmation pour que les jeunes comprennent de quoi il s'agit, et qu'ils puissent voir si ça leur plaît vraiment (au cas où ils rêvent de créer des jeux vidéos).\nIl y a aussi la partie graphique, dans un jeu vidéo qui peut être abordée en participant au développement d'un jeu comme Ultimate Smash Friends\n<- Sorlo\nAujourd'hui, j'ai montré Ultimate Smash Friends et mon personnage Sorlo à mon neveu qui vient tout juste d'avoir 11 ans et cela lui a donné envie d'en créer un lui aussi.\nMon neveu dessine plutôt bien et à plein d'idées. Il adore utiliser ma tablette graphique et commence à s'habituer à Gimp (il a Photoshop sur Mac, chez lui, mais il n'y fait pas beaucoup d'ordi). Aujourd'hui, il a griffonné quelques croquis très sympas et il ne parvenait plus à s'arrêter tellement ses idées fusaient !\nComme quoi, un gamin motivé peut partir dans des directions très intéressantes et même s'il ne va pas jusqu'au bout dans la mise au propre, ses idées peuvent être reprises par les adultes s'il est d'accord.\nC'est sans doute plus complexe pour aborder la programmation, mais les petits logiciels comme Kturtle qui permettent de s'y initier sont déjà bien pour les plus jeunes, et quelques essais permettent de voir si on veut s'y coller ou pas quand on est plus âgé.\nL'idéal serait d'avoir à un moment un vrai développeur qui vienne faire une intervention, mais il doit être en mesure de se mettre à la portée des jeunes, ce qui n'est pas si facile.\nCe qui semble évident pour un adulte peut en effet paraître totalement incompréhensible à un enfant.\nMême en bases informatique, on voit aussi des adultes peiner devant des choses qui nous semblent aller de soi.\nL'autre jour, une dame d'environ 60 ans me disait que pour elle, le clic droit ne voulait pas dire cliquer avec le bouton droit mais cliquer en allant tout droit ! Elle s'était même disputée avec son fils à ce sujet...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nProblème pour installer Syntensity sous Ubuntu Jaunty!\nJe vais chercher d'autres choses, j'ai vu aussi la possibilité de faire de la programmation en python avec Blender.\nMais je dois bien sûr trouver quelque chose de simple en vue de mon projet d'animation.\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPour MyPaint, on ne peut pas installer le paquet mypaint comme indiqué dans les pré-requis de la doc d'Ubuntu (lien mort et pas trouvé dans les dépots)\nUne fois l'install' effectuée, il s'ouvre mais me signale une erreur de programmation. Je ferme cette fenêtre, histoire de lui clouer le bec, et j'essaie de dessiner un peu mais la fenêtre d'erreur revient toutes les 10 secondes...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nEn langage python, pour que le joueur puisse entrer une donnée, voici le code à taper dans un simple éditeur de texte :\nprint \"Joueur n°1, tapez votre pseudo: \",\npseudo1 = raw_input()\nprint \"Bienvenue à\", pseudo1, \"dans Ultimate Smash Friends, vous êtes le joueur n° 1 !\"\n\nL'instruction print permet l'affichage de la chaîne de caractère de la 1ère ligne. On se rappelle que ces chaines sont mises entre guillemets.\nraw_input() permettra d'entrer la donnée pseudo1 dans le programme pour l'utiliser par la suite.\nNous l'afficherons dans une phrase grâce à la 3ème ligne. Celle-ci insèrera cette donnée pseudo1 entre 2 chaines de caractères (toujours entre guillemets, souvenez-vous !).\nLa virgule derrière la question, dans le code, permet que votre réponse reste sur la même ligne que la question. Idem pour les virgules avant et après pseudo1\nEnregistrez sous le nom de progpseudo.py dans un dossier nommé programmes. Remplacez par le nom de votre propre programme et de votre propre dossier s'il est différent, bien sûr\nOuvrez la console (Konsole ou Terminal).\nPlacez vous dans le bon dossier grâce à la commande cd suivie du chemin du dossier (change directory = changer de répertoire). Ex:\ncd /home/laurence/programmes\n\nTapez sur la touche Entrée du clavier pour entrer dans le répertoire demandé.\nEcrivez ce code à la suite dans la console pour appeler votre super programme:\npython progpseudo.py\nTapez sur la touche Entrée pour lancer le programme.\nLa console affiche alors la 1ère ligne, à laquelle vous devez répondre.\nRépondez puis validez avec la touche Entrée.\nLa console affichera ensuite votre réponse à l'intérieur de la phrase appelée par la 3ème ligne de code.\nCette image montre à la fois le code écrit dans l'éditeur de texte et le résultat dans la console. N'oubliez pas que je n'ai tapé mon nom qu'une fois dans la console et nulle part dans le code !\nSi vous copiez-collez ces 3 lignes de codes en dessous des précédentes et que vous remplacez le chiffre 1 par le chiffre 2, vous pourrez aussi demander son pseudo au joueur n°2 et l'afficher pareillement. Essayez !\nDemandez ensuite le prénom des 2 joueurs puis arrangez-vous pour l'afficher dans une phrase du type:Le pseudo de Laurence est Doudoulolita tandis que le surnom de Jean est Patouille.\nN'hésitez pas à inventer d'autres questions et d'autres phrases pour vous amuser.\nDernière modification par doudoulolita (Le 18/05/2010, à 00:40)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nprint \"Joueur n°1, combien de points de vie avez-vous ?\",\nnb_points1 = int(raw_input())\nprint \"Joueur n°2, combien de points de vie avez-vous ?\",\nnb_points2 = int(raw_input())\nprint \"Au début du jeu,\", pseudo1, \"a\", nb_points1, \"points de vie,\", pseudo2, \"en a\", nb_points2, \".\"\nprint \"Il y a\", \\\n nb_points1 + nb_points2, \\\n \"points de vie en tout.\"\n\nint(raw_input()) permet d'entrer un chiffre que l'on pourra réutiliser dans un calcul, comme ici avec nb_points1 + nb_points2. Notez qu'il y a 2 parenthèses fermantes à la fin, une pour fermer raw_input, une pour fermer int. Mais n'oubliez pas d'ouvrir les parenthèses avant de les fermer !\nOn note les \\ avant et après le calcul, et les espaces pour indenter les 2 dernières lignes (c'est à dire les décaler vers la droite). Ne pas utiliser la touche Tabulation car il me semble que ça pose problème.\nLe programme suivant se base sur cet exemple mais l'addition (ici: 5+6 = 11) est placée avant le nombre de points de chaque joueur. Il réutilise aussi le code appris précédemment.\nCliquez sur l'image de la console pour voir le code utilisé (écrit dans l'éditeur de texte, donc)\nBon, dans un jeu, on ne choisit pas soi-même ses points de vie, mais vous pouvez prendre un dé pour décider de votre réponse !\nQuant au nombre de joueurs, si vous le choisissez plus élevé que le nombre choisi par le programmeur pour l'instant (ici je n'en ai prévu que 2...), vous n'aurez pas de questions pour les joueurs 3, 4, etc.\nA vous de coder pour prévoir 4 joueurs, comme dans le vrai jeu d'Ultimate Smash Friends !\nDernière modification par doudoulolita (Le 20/07/2010, à 19:02)\nHors ligne\narturototo\nRe : Faire une animation sur la création de jeux vidéo libres\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaj'y voit plus claire maintenant mercie!!!!!!\nArtur MOUKHAMEDOV\n(11 ans)\nHors ligne\narturototo\nRe : Faire une animation sur la création de jeux vidéo libres\nje comprend bien mieu\nArtur MOUKHAMEDOV\n(11 ans)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nlol, t'as le même avatar que Kanor, je t'ai pris pour lui au début, comme il fait aussi du python ^^, mais ça m'étonnait qu'il ait appris un truc juste là .\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nMon premier atelier sera sur Blender les 19 et 20 juillet de 14 à 16h à l'Espace libre 13.1.\nAu programme: création d'une petite barque et intégration dans un fond en vue de créer un décor pour le jeu Ultimate Smash Friends.\nDeuxième atelier sur la programmation python (B.A.BA) les 22 et 23 juillet de 14 à 16h. Un mini-script python pour Blender trouvé sur Internet complétera quelques exercices en mode texte.\nDernière modification par doudoulolita (Le 12/07/2010, à 13:47)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nVoici une idée de ce que je souhaite réaliser avec les participants à mon atelier Blender du 19 et 20 juillet 2010 (pour adultes et jeunes à partir de 15 ans):\nLes participants réaliseront une barque sur Blender.\nElle est modélisée avec des extrusions, le modificateur Miroir et des redimensionnements utilisant le PET (Outil d'Edition Proportionnelle).\nIl faudra placer lampe et caméra pour voir la barque de profil.\nOn apprend aussi à utiliser le mode points, le mode arêtes et le mode faces, ainsi que l'outil Couteau (K), et à choisir un rendu en png avec un fond transparent (RGBA).\nEnfin, on ajoute à la barque un matériau marron et une texture bois.\nPuis, si on a le temps, les participants insèreront l'image rendue en plusieurs exemplaires avec Gimp sur une image de fond (trouvée sur internet). Ils ajouteront le personnage Sorlo pour se donner une idée de la taille que doit avoir la barque. On utilisera donc l'outil de recadrage, les calques et l'outil de redimensionnement.\nL'image de fond provient de http://commons.wikimedia.org/wiki/File: … rfeurs.jpg\nDernière modification par doudoulolita (Le 12/07/2010, à 13:56)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nOula, l'idée est intéressante mais assez perturbante du point de vue perspective ^^.\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nComme je l'ai marqué sur l'autre topic sur USF, je n'ai pas eu grand monde à mon animation.\nSur les 5/6 inscrits, seulement 2 se sont présentés, un jeune de 15 ans gentil mais qui croit que ça lui sera facile de devenir testeur de jeux, et un adulte qui s'intéressait en fait à la retouche photo sur Gimp.\nLe jeune a quand même commencé un petit iceberg en vue d'en faire un élement de décor pour USF, avec Blender; ma barque ne le motivait pas beaucoup (et pourtant, sur le plan didactique, il y avait plus à apprendre !)\nPour une animation de 2x2h, on ne peut de toute façon pas faire un truc très travaillé.\nJe voulais surtout leur apprendre à modéliser et texturer la barque et j'ai un peu vite fait l'insertion sur le fond, sans trop me prendre la tête dessus, j'avoue !\nL'idéal serait en fait de \"fabriquer la mer\" avec Blender ou en tout cas de mieux placer les barques sous la camera pour avoir une perspective correcte, effectivement (mais comment placer des repères fiables ?).\nIl faudrait aussi mettre quelques vagues en bas des barques pour les faire flotter en utilisant une copie du calque et un masque de calque.\nMais travailler sur un décor \"à plat\" (et non un truc en hauteur) n'était peut-être la meilleure idée pour un décor de jeu 2D.\nLe jeune qui a fait l'iceberg pendant l'animation voudra sans doute faire aussi la mer avec Blender ou avec Gimp et là, je dois dire que je n'ai pas encore étudié la question de la profondeur. On se retrouvera aussi avec un problème de perpective.\nEn fait, la question que je me posais avant de concevoir cette animation, c'était de savoir si je choisissais le thème du décor et que je l'imposais à tous (plus facile avec un groupe de personnes au-delà de 4 ou 5) ou si je partais des idées des participants, ce qui implique qu'ils se mettent d'accord et pour moi, de m'adapter à un truc qu'on n'a pas testé avant.\nDans l'un comme l'autre cas, j'ai fait une erreur en oubliant un des principes de base du jeu, qui fonctionne en 2D et dont le décor doit se travailler sur l'axe Z de Blender !\nJ'espère avoir un peu de monde Jeudi et vendredi pour la programmation, mais si besoin, je m'adapterai aux personnes présentes.\nDe toute façon, la préparation de ces ateliers m'a permis d'acquérir des petites bases sur Python et j'ai même fait un essai de Pygame grâce à des tutos sur le web, donc ce n'est pas du temps perdu.\nJe me suis aussi acheté le bouquin \"The blender Gamekit\", en anglais. A suivre...\nDernière modification par doudoulolita (Le 20/07/2010, à 18:56)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJe me suis amusée à faire encore d'autres petits essais en python en mode texte mais je voulais passer au côté graphique.\nDans le livre \"Initiation à la programmation\" d'Yves Bailly, qui m'a servi de base, les exemples sont donnés avec la bibliothèque Qt.\nJ'ai trouvé des tutos intéressants pour python avec Pygame (en anglais)\nJ'ai suivi les 2 premiers tutos, très simples, de pygame-tutorial et un autre pour apprendre à incorporer une image . Mon code n'est pas super mais ça affiche quelque chose !\nJe suppose qu'une fonction pour les rectangles serait bien ou même peut-être existe-t-il quelque chose de \"tout fait\" dans Pygame. Les chiffres entre parenthèses indiquent d'abord la couleur de la ligne en mode RVB, puis les coordonnées des points de début et de fin (en pixels).\nPour trouver les codes de couleurs, choisir une couleur dans le sélecteur de couleur de Gimp et noter les chiffres R,V et B indiqués sur la droite du sélecteur de couleur.\nCe que le livre d'Yves Bailly m'a fait comprendre, c'est que pour créer un jeu en python, par ex., il faut d'abord exprimer clairement les choses et définir objets et actions du jeu (en français, tout bêtement !).\nEn les exprimant clairement et de manière détaillée, on voit plus rapidement comment travailler et structurer le code qu'on fera par la suite.\nUn simple mouvement d'un des éléments du décor nécessite de définir les coordonnées de cet objet, de définir ses modalités de déplacement, d'indiquer ce qui provoque ce déplacement (touche de clavier, par ex); le fait qu'il ait une certaine vitesse implique le temps, et donc peut-être un chronomètre, etc!\nDernière modification par doudoulolita (Le 20/07/2010, à 19:16)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nCe que le livre d'Yves Bailly m'a fait comprendre, c'est que pour créer un jeu en python, par ex., il faut d'abord exprimer clairement les choses et définir objets et actions du jeu (en français, tout bêtement !).\nEn les exprimant clairement et de manière détaillée, on voit plus rapidement comment travailler et structurer le code qu'on fera par la suite.\ntout à fait, c'est vrai pour tout type de programmes, et les jeux ne font pas exceptions, mieux on sait ce qu'on veux faire (et ce n'est pas facile) plus on a de chance de le faire correctement!\nun jeune de 15 ans gentil mais qui croit que ça lui sera facile de devenir testeur de jeux,\nc'est facile, sauf si tu veux que ce soit un vrai métier…\nDernière modification par tshirtman (Le 20/07/2010, à 19:34)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPour un jeune, je pense que les logiciels libres et en particulier les jeux libres leur offrent une chance formidable de s'entraîner et de vérifier leur motivation au cas où ils souhaiteraient faire de leur passion un métier.\nTester, développer, c'est quand même plus facile dans ce cadre qu'au sein d'une entreprise très fermée, non ?\nLe problème de certains ados, c'est qu'ils pensent que pour être testeur, il suffit juste de jouer et que ce sera des jeux qui les passionnent alors qu'un simple tour sur les forums au sujet de ce métier (ou de cette activité, si on préfère) montre le contraire.\nMais que les ados rêvent, c'est normal. Après, s'ils veulent vraiment réaliser leur rêve, il leur faudra se confronter à la réalité et prouver leur motivation pour pouvoir vivre de leur passion.\nJe dis ça alors qu'ado, je rêvais d'être styliste chez Jean-Paul Gaultier, et que je me suis retrouvée quelques années plus tard simple patronnière dans le Sentier (ceux qui connaissent Paris savent dans quelles conditions on y travaille le plus souvent)...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJ'ai oublié de dire ici que je n'ai pas eu beaucoup plus de monde pour l'atelier programmation. Un adulte qui pensait qu'il s'agissait de faire des bases de données (et dans son cas, un simple tableur comme calc devait lui suffire, à mon avis), le jeune qui était là pour Blender et deux autres plus jeunes encore.\nLes jeunes ont eu du mal à s'intéresser à Ultimate Smash Friends et à python !\nCelui de 15 ans m'a montré RPG maker dont pour ma part je ne raffole pas mais qui a amusé les autres pour créer des décors très facilement.\nLe côté programmation des persos sur RPGmaker n'est pas si évident que ça en a l'air, j'ai eu ensuite du mal à reproduire ce que m'avait montré le jeune, qui pourtant semblait super simple.\nCe que je n'aime pas dans ce programme, c'est le côté \"déjà tout fait\" que les jeunes, eux, aiment beaucoup.\nCe qui est plutôt pratique, c'est la simplicité de création des décors qui peut plaire aux plus jeunes pour les amener ensuite vers plus de programmation avec les personnages.\nJe ne sais pas si ce type de jeu permettant de créer un jeu existe en logiciel libre et a ce côté facile et convivial qu'aiment les jeunes.\nJusqu'ici nos recherches en matière de jeux intéressants sont un peu stériles. J'ai voulu mettre Yo frankie sur les ordis du boulot et ça ne fonctionne pas alors que chez moi ça marche.\nC'est sans doute nos ordis du boulot qui pèchent quelque part. J'ai en effet Ubuntu Lucid Lynx comme au boulot mais ma config est supérieure.\nDernière modification par doudoulolita (Le 19/08/2010, à 07:29)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPar hasard, tout récemment, j'ai découvert le jeu Plee the bear mais pour contribuer, c'est encore plus difficile car c'est en python C++.\nLes tutoriels sont par contre très bien documentés et le jeu présente une cohérence intéressante et un mini scénario.:)\nA titre perso je vais continuer à apprendre python et pygame. Je verrai plus tard si je peux réunir des jeunes adultes et des ados motivés pour un autre atelier.\nDernière modification par doudoulolita (Le 19/08/2010, à 07:31)\nHors ligne"}}},{"rowIdx":249,"cells":{"text":{"kind":"string","value":"tutorial do web.py 0.2\nComeçando\nEntão você sabe Python e quer fazer um site. O web.py fornece o código que torna essa uma tarefa fácil.\nSe você quiser fazer o tutorial inteiro, você precisará destes programas: Python, web.py, flup, psycopg2 e Postgres (ou um banco de dados equivalente e adaptador correspondente para Python). Para detalhes, veja webpy.org.\nSe você já tem um projeto web.py, dê uma olhada na página de atualização (em inglês) para informações sobre migração.\nVamos começar.\nTratamento de URLs\nA parte mais importante de qualquer site é a estrutura de suas URLs. Suas URLs não são simplesmente aquela coisa que os visitantes vêem e mandam para seus amigos; elas também criam um modelo mental de como seu site funciona. Em sites populares como o del.icio.us, as URLs são até uma parte da interface com o usuário. O web.py faz com que criar boas URLs seja fácil.\nPara começar sua aplicação com web.py, abra um novo arquivo de texto (vamos chamá-lo de 'codigo.py') e digite:\nimport web\n\nIsso serve para importar o módulo do web.py.\nAgora precisamos dizer ao web.py qual será nossa estrutura de URLs. Vamos começar com algo simples:\nurls = ( '/', 'index' )\nA primeira parte é uma expressão regular que corresponde a uma URL, como /, /ajuda/faq, /item/(\\d+), etc. (\\d+ corresponde a uma seqüência de dígitos. Os parênteses pedem que aquela parte da correspondência seja \"capturada\" para ser usada mais tarde.) A segunda parte é o nome de uma classe para a qual a requisição HTTP deve ser enviada, como index, view, welcomes.hello (este último corresponde à classe hello do módulo welcomes), ou get_\\1. \\1 é substituído pela primeira captura feita pela sua expressão regular; as capturas que sobrarem são passadas para a sua função.\nEssa linha diz que queremos que a URL / (i.é., a página inicial) seja tratada pela classe chamada index.\nAgora precisamos escrever a classe index. Apesar de a maioria das pessoas não perceber enquanto navega por aí, seu navegador usa uma linguagem conhecida como HTTP para comunicar-se com a internet. Os detalhes não são importantes, mas o princípio básico é que os visitantes da Web pedem aos servidores web que realizem certas funções (como GET ou POST) em URLs (como / ou /foo?f=1).\nGET é a função com a qual estamos todos acostumados: é a usada para pedir o texto de uma página da web. Quando você digita harvard.edu no seu navegador, ele literalmente pede ao servidor web de Harvard GET /. A segunda mais famosa, POST, é comumente usada ao enviar certos tipos de formulários, como um pedido para comprar algo. Você usar POST sempre que o envio de um pedido faz alguma coisa (como cobrar de seu cartão de crédito e processar um pedido). Isso é crucial, pois URLs do tipo GET podem ser transmitidas por aí e indexadas por mecanismos de busca -- você quer isso para a maioria das suas página, mas com certeza não para coisas como processar pedidos (imagine se o Google tentasse comprar tudo no seu site!).\nNo nosso código para o web.py, a distinção entre os dois é clara:\nclass index:\n def GET(self):\n print \"Olá, mundo!\"\n\nEssa função GET será chamada pelo web.py sempre que alguém fizer um pedido GET para a URL /.\nOk, agora só falta terminar com uma linha que manda o web.py começar a servir as páginas da web:\nif __name__ == \"__main__\": web.run(urls, globals())\n\nIsso manda o web.py servir as URLs que listamos acima, procurando as classes no nome de espaços global para o arquivo atual.\nPerceba que, embora eu esteja falando bastante, nós só temos umas cinco linhas de código. É só isso que você precisa para fazer uma aplicação completa com o web.py. Se você for até sua linha de comando e digitar:\n$ python codigo.pyLaunching server: http://0.0.0.0:8080/\nVocê terá sua aplicação web.py executando um servidor web de verdade no seu computador. Visite essa URL e você deverá ver \"Olá, mundo!\" (Você pode adicionar um endereço IP/porta depois de \"codigo.py\" para controlar onde o web.py executa o servidor. Você também pode fazê-lo rodar um servidor fastcgi ou scgi.)\nNota: Você pode especificar o número de porta a usar pela linha de comando desta maneira, se não puder ou não quiser usar o padrão:\n$ python codigo.py 1234\nDesenvolvimento\nO web.py também tem algumas ferramentas para nos ajudar com a depuração. Antes do 'if name' na última linha, adicione:\nweb.webapi.internalerror = web.debugerror\n\nIsso lhe fornecerá mensagens de erro mais úteis, quando for o caso. Coloque também na última linha web.reloader, de modo que ela se torne:\nif __name__ == \"__main__\": web.run(urls, globals(), web.reloader)\n\nIsso diz ao web.py que use o \"middleware\" web.reloader (middleware é uma função intermediária que adiciona certos recursos ao seu servidor web), que recarrega seus arquivos assim que você os edita, de modo que você pode imediatamente ver as alterações no seu navegador. (Contudo, para algumas alterações mais drásticas, você ainda precisará reiniciar o servidor.) Você provavelmente deverá tirar isso ao deixar seu site público, mas é um recurso excelente durante o desenvolvimento. Também há o web.profiler, que, no final de cada página, fornece informações sobre quanto tempo cada função tomou, de modo que você possa tornar seu código mais rápido.\nTemplating\nEscrever HTML de dentro do Python pode tornar-se um empecilho; é muito mais divertido escrever código Python de dentro do HTML. Por sorte, o web.py torna isso bastante fácil.\nNota: Versões antigas do web.py usavam Cheetah templates. Você é, é claro, livre para usar esse ou qualquer outro software com o web.py, mas ele não é mais suportado oficialmente.\nVamos criar um novo diretório para nossos templates (vamos chamá-lo de templates). Dentro dele, crie um novo arquivo cujo nome termine em HTML (vamos chamá-lo de index.html). Agora, dentro dele, você pode escrever código HTML normal:\nOlá, mundo!\nOu você pode usar a linguagem de templates do web.py para adicionar código ao seu HTML:\n$def with (nome)\n$if nome:\n Eu só queria dizer olá para $nome.\n$else:\n Olá, mundo!\n\nNota: Atualmente, é necessário usar quatro espaços para a indentação.\nComo você pode ver, os templates parecem-se bastante com arquivos Python, exceto pela instrução def with no começo (ela diz com que parâmetros o template é chamado) e os $s colocados na frente de qualquer código. Atualmente, o template.py requer que a instrução $def seja a primeira linha do arquivo. Além disso, note que o web.py \"escapa\" as variáveis que forem usadas -- de modo que se, por alguma razão, o valor da variável nome conntém algum código HTML, ela será devidamente \"escapada\" e aparecerá como texto puro. Se você não deseja esse comportamento, use $:nome em vez de $nome.\nAgora volte ao codigo.py. Abaixo da primeira linha, insira:\nrender = web.template.render('templates/')\n\nIsso manda o web.py procurar por templates no seu diretório templates. Então altere a função index.GET para:\nnome = 'João'\nprint render.index(nome)\n\n('index' é o nome do template, e 'nome' é o parâmetro passado para ele)\nVisite seu site e ele deverá dizer olá para o João.\nDica para o desenvolvimento: Adicione cache=False ao final da sua chamada a render para que o web.py recarregue seus templates toda vez que você entrar na sua página.\nAgora mude sua URL para:\n'/(.*)', 'index'\ne troque a definição de index.GET para:\ndef GET(self, nome):\n\ne apague a linha que define nome. Visite / e a página deverá dizer olá ao mundo. Visite /José e ela deverá dizer olá ao José.\nSe você quer aprender mais sobre os templates do web.py, visite a página do templetor (em inglês).\nBancos de dados\nAcima da sua linha web.run, adicione:\nweb.config.db_parameters = dict(dbn='postgres', user='nome_do_usuario', pw='senha', db='nome_do_banco_de_dados')\n\n(Modifique isto -- especialmente nome_do_usuario, senha, and nome_do_banco_de_dados -- para os valores correspondentes à sua configuração. Usuários do MySQL também devem trocar dbn por mysql.)\nCrie uma tabela simples no seu banco de dados:\nCREATE TABLE todo (\n id serial primary key,\n title text,\n created timestamp default now(),\n done boolean default 'f' );\n\nE uma linha inicial:\nINSERT INTO todo (title) VALUES ('Aprender web.py');\n\nVoltando ao codigo.py, modifique a função index.GET para:\ndef GET(self):\n todos = web.select('todo')\n print render.index(todos)\n\ne modifique o tratador de URLs de volta para simplesmente /.\nEdite o index.html de modo que ele se torne:\n$def with (todos)\n
    \n$for todo in todos:\n
  • $todo.title
\n\nVisite novamente seu site, e você deverá ver uma tarefa na lista: \"Aprender web.py\". Parabéns! Você fez uma aplicação completa que lê dados de um banco de dados. Agora vamos também gravar dados no banco de dados.\nNo final de index.html, insira:\n

\nE modifique sua lista de URLs para que fique assim:\n'/', 'index','/add', 'add'\n(Você deve ser muito cuidadoso com essas vírgulas. Se você as omitir, o Python juntará as strings e verá '/index/addadd' no lugar da sua lista de URLs!)\nAgora adicione outra classe:\nclass add:\n def POST(self):\n i = web.input()\n n = web.insert('todo', title=i.title)\n web.seeother('/')\n\n(Viu como estamos usando o método POST para isso?)\nweb.input lhe dá acesso às variáveis que o usuário enviou através de um formulário. Para obter dados de elementos com nomes idênticos em formato de lista (por exemplo, uma série de caixas de verificação com o atributo name=\"nome\"), use:\npost_data=web.input(nome=[])\n\nweb.insert insere valores na tabela todo do banco de dados e lhe devolve o ID da nova linha. seeother redireciona os usuários para esse ID.\nRapidinhas: web.transact() inicia uma transação. web.commit() confirma a transação e armazena os dados; web.rollback() desfaz as alterações. web.update funciona como web.insert, recebendo (em vez de devolver) um ID (ou uma string com uma sentença WHERE) após o nome da tabela.\nweb.input, web.query e outras funções do web.py devolvem \"Objetos de armazenamento\", que são como dicionários mas também permitem que você use d.foo além de d['foo']. Isso realmente deixa certos códigos mais limpos.\nVocê pode encontrar todos os detalhes sobre essas e todas as outras funções do web.py na documentação (em inglês).\nIsso termina o tutorial por enquanto. Dê uma olhada na documentação para ver o monte de coisas legais que você pode fazer com o web.py."}}},{"rowIdx":250,"cells":{"text":{"kind":"string","value":"mac-gyver31\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nEn fait ce post est plutôt tournée vers l'intégration d'un ordi dans un domaine windows 2003 dans le cadre d'un serveur LTSP.\nUn serveur LTSP ?? Tu veux dire Linux Terminal Server Project ?\nT'es sûr ? Car je ne vois pas bien le rapport, et c'est la première vois que je vois cette chose évoquée dans les posts de cette discussion\nIl est temps d'enlever les fenêtres, et de construire un monde ouvert.\nHors ligne\nflorian_boy\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nBonjour,\nJe suis entrain d'installer un machine Ubuntu 10.4 et je voulais l'intégrer dans mon domaine AD.\nJ'ai repris en intégral le script proposé en 1er page, modifié les nom de domaine, tenté de modifié le AD-vol.conf, mais là, j'ai pas tout capté ...\nJ'ai lancé le script comme expliqué, il n'y a pas eu de bug ou autre mais à la fin, lors du test d'identification au domaine, j'ai ceci :\nError: Lsass Error [code 0x00080047]\n40290 (0x9D62) LW_ERROR_LDAP_TIMEOUT - Unknown error\n\nAprès avoir redémarré l'ordi, j'ai remarqué qu'il n'y avais pas de dossier LIkewise dans mon \"home\" et qu'il m'avait été imposible d'ouvrir un session avec un compte AD\nSi quelqu'un a une idée, merci ...\nUn autre truc, ce ne sont pas des dossier personnel que je veux monter dans le fichier AD-vol.conf, mais des partitions présente sur le serveur, chaque personne ayant sa propre partition, alors si quelqu'un peux m'aider à bien définir les volumes à monter ou bien m'expliquer les codes de ce fichier, ce serai super.\nMerci\nCordialement,\nHors ligne\nGaelephant\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nScript testé (et approuvé) dans le cadre d'une jonction \"simple\" d'un poste client Ubuntu 12.04 à un AD (win 2003).\nSachant que je galérais dans la modification à la main des fichiers de conf krb5 et smb, ce script m'a débloqué.\nPlus qu'à le détailler/modifier pour l'adapter plus précisément à mes besoins, mais sur le principe, exécuté tel quel, il fonctionne parfaitement, du moins sur la partie \"se loguer avec les identifiants de la base AD\", ce qui est déjà un bon point de départ.\nHors ligne\nGaelephant\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nScript testé (et approuvé) dans le cadre d'une jonction \"simple\" d'un poste client Ubuntu 12.04 à un AD (win 2003).\nSachant que je galérais dans la modification à la main des fichiers de conf krb5 et smb, ce script m'a débloqué.\nPlus qu'à le détailler/modifier pour l'adapter plus précisément à mes besoins, mais sur le principe, exécuté tel quel, il fonctionne parfaitement, du moins sur la partie \"se loguer avec les identifiants de la base AD\", ce qui est déjà un bon point de départ.\nHistoire de préciser tout de même :\nLe but final est de virer le Win2003 d'un serveur de fichier pour le remplacer par un linux (vraisemblablement Ubuntu).\nMais le DC resterait (pour le moment du moins) sous Win2003. Débutant sous linux, avant le lancer le grand chambardement, je souhaite faire quelques essais. J'ai donc commenté toutes les lignes faisant référence aux partages, puisque pour le moment, souhaitant avancer tranquillement par étapes, je ne m'intéresse qu'à la jonction d'un poste linux à l'AD. Histoire d'être sûr qu'au moins ça soit réalisable facilement et rapidement avant d'aller fouiller plus loin. D'autant plus qu'au final, les partages ne devront pas \"être accessible depuis un linux\", mais \"être accessible depuis un windows tout en étant hébergé par un linux\". Meme si l'un n'empêche pas l'autre, j'vais y aller doucement.\nScript testé sur Ubuntu 12.04 client, tel quel, sans modification : fonctionne directement.\nCela dit, pas de dossier /etc/gdm/ chez moi (Unity oblige), du coup j'ai viré les lignes concernant gdm, et j'ai rajouté les lignes\nallow-guest=false\ngreeter-hide-users=true\n\nau fichier /etc/lightdm/lightdm.conf. Je pense que ça doit facilement se rajouter au script.\nAu reboot de la machine, écran de connexion où il faut entrer identifiant puis mdp pour se logguer. Les identifiants locaux fonctionnent, les identifiants réseaux également, et ce sans avoir à rajouter un \"DOMAIN\\\" avant le login. Bref, complètement transparent pour l'utilisateur.\nScript testé sur Ubuntu 12.04 server tel quel, sans modification : échec à l'installation de likewise.\nJ'ai résolu le problème en modifiant dans le script la partie apt-get concernant likewise et en mettant à la place un simple\nsudo dpkg -i ./likewise-open_6.1.0.406-0ubuntu5_i386.deb\n\nen ayant au préalable téléchargé le .deb à la main (j'ai malencontreusement oublié de noter l'url où je l'ai choppé) et placé dans le même répertoire que le script. Ensuite, l'installation se déroule sans le moindre soucis.\nMais au reboot et à la connexion, ça n'est pas la même histoire :\n- identifiant_local / pass : ça marche\n- identifiant_réseau / pass : erreur (j'ai plus le message exact en tête, mais même message que lorsqu'on tape un mauvais password)\n- identifiant@domain / pass : idem\n- DOMAIN\\identifiant / pass : erreur : ACCESS DENIED\nLe access denied est je pense plutôt bon signe : il ne trouve pas d'erreur dans le duo log/pass, il n'arrive juste pas à ouvrir une session.\nAvec comme question principale : il n'arrive pas à ouvrir une session, ou bien il pourrait y arriver mais refuse de le faire parce que \"quelque chose\" le lui interdit (par exemple, au pif, une ligne foireuse sur un fichier de conf planqué quelque part qui dise qu'il n'y a que la personne qui a installé l'os qui peut s'y connecter).\nEncore en train de fouiller dans les fichiers de log voir où il peut bien y avoir une erreur, sans trouver pour le moment.Comme c'est le seul moyen qui me vienne à l'esprit pour tester si la jonction du poste à l'AD est bien effective, c'est gênant.\nD'un autre côté, étant vraiment un gros débutant dans le monde linux, j'ai très bien pu foirer quelque part.\nA noter qu'avant de tester ce script, et ce sur les deux OS, version classique et version server, j'avais déjà bidouillé les fichiers de conf de samba et de kerberos, suivi quelques tentatives de tuto sur le net sans succès, et donc je ne me suis pas particulièrement inquiété du fait que contrairement à annoncé, il ne m'a pas été demandé lors de l'installation les serveurs et royaumes kerberos.\nD'autant plus que ça a fonctionné directement sur la version \"client\". Histoire d'exclure la possibilité que l'ancien fichier krb5.conf du server soit la cause du problème, j'ai directement copié à la place celui du client avant de faire mes tests.\nEt ça m'embêterait beaucoup d'avoir à refaire une réinstallation complète de l'OS, vu que j'ai dégagé l'iso et que j'ai un débit foireux pour la retélécharger.\nEn espérant que ce retour d'expérience serve, par exemple à une amélioration du script\nHors ligne\nDivad\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nSalut,\nC'est vrai que pour tester, il vaut mieux partir d'un OS nouveau et fraichement à jour que de quelque chose bidouillé surtout concernant kerberos. Je ne comprends pas toujours ce que je fais et trouver une erreur d'une ancienne bidouille c'est pas gagné.\nConcernant 12.04, je n'ai fait aucun test. Cependant, dans le script il y a ces deux lignes :\nadd-apt-repository ppa:likewise-open/likewise-open-ppa\napt-key adv --keyserver keyserver.ubuntu.com --recv-keys AAFDD5DB\n\nCela fait appel à un dépot externe car dans les dépôts de la 10.4 il y avait un likewise bugué que le ppa corrigeait. Je pense que dans la 12.04 ce bug doit être corrigé et le ppa plus nécessaire, voire même dépassé pouvant peut-etre causer des problèmes d'identification. Je pense donc qu'il faudrait que tu testes en enlevant ces deux lignes du script et partir sur une base clean avec le dépôt officiel de 12.04.\nA propos de la connexion, as-tu essayé le test de connexion inclus dans le script ?\nHors ligne\nGaelephant\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nConcernant 12.04, je n'ai fait aucun test. Cependant, dans le script il y a ces deux lignes :\nadd-apt-repository ppa:likewise-open/likewise-open-ppa\napt-key adv --keyserver keyserver.ubuntu.com --recv-keys AAFDD5DB\n\nCela fait appel à un dépot externe car dans les dépôts de la 10.4 il y avait un likewise bugué que le ppa corrigeait. Je pense que dans la 12.04 ce bug doit être corrigé et le ppa plus nécessaire, voire même dépassé pouvant peut-etre causer des problèmes d'identification. Je pense donc qu'il faudrait que tu testes en enlevant ces deux lignes du script et partir sur une base clean avec le dépôt officiel de 12.04.\nJustement, je test sur deux versions de 12.04, la classique et la server.\nJ'avais déjà essayé d'installer likewise depuis les dépôts offi sur la version client, en essayant de suivre pas à pas un tuto, mais sans succès : des erreurs à l'installation, ça foirait à un moment où un autre, j'avais laissé tombé.\nSur la \"classique\", ces deux lignes de ton script ne posent aucun problème, et tout fonctionne parfaitement, ça installe depuis les dépots indiqué, tout roule.\nSur la \"server\", l'installation de likewise pose soucis. Le même script, les mêmes lignes, une erreur ou les mots dpkg, --configure et likewise apparaissaient sur la même ligne.\nDu coup j'ai récupéré le .deb depuis \"https://launchpad.net/ubuntu/+source/likewise-open\" (vive l'historique du navigateur pour retrouver l'adresse), et là l'installation se passe correctement.\nA propos de la connexion, as-tu essayé le test de connexion inclus dans le script ?\nOui, testé, et affichant un magnifique succès et me recommandant de redémarrer.\nD'ailleurs, pour preuve que la connexion est possible, si j'essaye de co un utilisateur n'existant pas, l'erreur est \"login incorrect\", alors qu'avec un utilisateur réseau existant, l'erreur est \"access is denied\". De plus, un \"getent passwd\" me donne le même résultat sur la version \"client\" (dont la jonction à l'AD est effective et réussie) et sur la version server (où là j'ai des \"access is denied\").\nJ'ai fait le tour des fichiers que j'avais modifié de façon indépendante sur le client et sur le server pour traquer les différences, sans avoir trouvé pour le moment. Bah, si je ne trouve pas, effectivement, réinstaller directement au propre la version server reste possible. Mais ça serait tellement plus agréable de comprendre pourquoi là ça ne fonctionne pas comme attendu.\nAccessoirement, j'ai récupéré la fin du auth.log, qui concerne ma tentative de connexion avec le compte Admin du réseau :\nsrvtest login[902]: pam_winbind(login:auth): getting password (0x00000388)\nsrvtest login[902]: pam_winbind(login:auth): pam_get_item returned a password\nsrvtest login[902]: pam_winbind(login:auth): request wbcLogonUser failed: WBC_ERR_AUTH_ERROR, PAM error: PAM_SYSTEM_ERR (4), NTSTATUS: NTSTATUS_ACCESS_DENIED, Error message was: Access denied\nsrvtest login[902]: pam_winbind(login:auth): internal module error (retval = PAM_SYSTEM_ERR(4), user = 'DOMAINE\\Administrateur\")\nsrvtest login[902]: pam_winbind(login:auth): FAILED LOGIN (1) on '/dev/tty3' FOR 'DOMAINE\\Administrateur', Authentification failure\n\nCe qui me laisse supposer que c'est du côté de /etc/pam.d/system-auth et du fichier pam_winbind.so qu'il va falloir chercher.\nHors ligne\nDivad\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nhum, il y a peut-être un problème dans la configuration des fichiers. Dans tous les cas, je pense que le mieux est de repartir sur une installation propre. Car même si tu corriges une erreur et que cela marche, tu ne seras jamais sûr que la correction soit bonne étant donné que d'autres bidouilles ont pu affecter le système. Et si le problème persiste après réinstallation, au moins tu repars sur qqch de sain et propre. Travailler en production sur un Os bidouillé n'est jamais bon, d'autant plus pour un serveur. Il vaut mieux savoir de A à Z ce qu'on y a fait, cela facilitera la maintenance ultérieure.\npar rapport à likewise, le message \"dpkg, --configure et likewise \" confirme qu'il y a eu un problème lors de l'installation du ppa. Et le deb que tu récupères est celui du dépôt officiel. ( d’ailleurs quelle version as-tu prise ?)\nJe suis désolé pour l'iso parti à la poubelle, mais je te conseille de :\n- récupérer l'iso !\n- réinstaller au propre\n- tester le script en entrant bien les noms de domain, et en supprimant les deux lignes mentionnées ci-dessus\n- bidouiller si besoin\n- garder l'iso ( ça peut resservir parfois !)\nHors ligne\nGaelephant\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\npar rapport à likewise, le message \"dpkg, --configure et likewise \" confirme qu'il y a eu un problème lors de l'installation du ppa. Et le deb que tu récupères est celui du dépôt officiel. ( d’ailleurs quelle version as-tu prise ?)\nC'est \"amusant\" de voir que le likewise proposé par ton script fonctionne sur le client, mais pas sur le serveur, et que la version \"dépot officiel\" ne fonctionne pas sur le client, mais semble fonctionner au poil sur le serveur. Enfin amusant. Façon de parler.\nJ'ai pris le paquet \"likewise-open_6.1.0.406-0ubuntu5_i386.deb\" dans la liste dispo sous \"Precise Pangolin\". vu que la machine sur laquelle je fais mes tests est une vieille bête.\nC'est reparti pour une install propre, alors. Je reviendrais donner des nouvelles.\nHors ligne\nGaelephant\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nDe retour après test sur Ubuntu server 12.04.1, à partir d'une install neuve, propre, et juste après mise à jour.\nToujours sur la partie \"jonction à l'AD\".\nRéussite\nA part un léger détail, ton script indique que\nLors de l'installation, il vous sera demandé :\n- Royaume Realm Kerberos par defaut : ex : DOMAINE\n- Serveur Kerberos du Royaume : ex : 192.168.0.010 nomduserveur\n- Serveur administratif du royaume Kerberos : ex : nomduserveur\nHors, lors de l'exécution du script, le seul moment où il m'a été demandé quelque chose, c'est lors de la phase de test, l'identifiant, le nom de domaine et le pass. Ce qui n'a pas empêché de déboucher sur un SUCCESS (que j'avais déjà eu lors de mes tests précédents cela dit).\nDifférence notable avec mes précédents tests : pas besoin de se logguer sous la forme DOMAIN\\user, entrer le nom d'un utilisateur réseau non créé sur la machine fonctionne directement.\nTout ça pour dire que si tu réactualises ton script avec une version du paquet likewise \"à jour\", toute la partie \"jonction à l'AD\" fonctionne sur ubuntu 12.04, client comme server.\nPlus qu'à fouiller sur la partie \"partage\" pour voir ce que je vais en faire\nEncore bravo, proposer un truc qui marche et qui facilite la vie, c'est méritoire !\nHors ligne\nDivad\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nSuper ! Comme quoi, une bonne installation enlève pas mal de problème !\nJ'ai mis à jour le premier poste en disant d'effacer les lignes mentionnées pour 12.04\nJe pense que d'ici quelques mois, il va falloir que je me replonge là dedans ( 10.4 devient vieux! ) Je remettrai le script à jour.\nMerci à toi aussi de faire profiter de ton travail !!\nHors ligne\nNathaly01\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nBonjour,\nD'abord, merci pour votre travail et le script que vous nous proposé ...\nJ'ai utilisé le script sur Ubuntu 12.04.2 et j'avais auparavant modifié le fichier /etc/lightdm/lightdm.conf en rajoutant cette ligne : greeter-show-manual-login=true\nLe script s'est déroulé parfaitement, succès.\nSeulement il y a quelques problèmes. Avec les compte AD, ubuntu utilise l'Anglais pour le nom des dossiers ainsi que pour les menus alors que tout devrait être en français.\nEn plus, lorsque je monte une partition/dossier (partage) du serveur 2003 sur laquelle j'ai tout les droit, et bien là, j'ai juste le droit de lire.\nPourtant dans l'observateur d'événement, sécurité, je retrouve bien mes ouvertures de session AD depuis le poste ubuntu en \"succès\", mais les droits sur les dossiers ne sont pas pris en compte ...\nAvez vous une idée du pourquoi ??\nMerci\nHors ligne\nNathaly01\nRe : Client Ubuntu + Active Directory et partage avec Windows serveur 2003\nBonsoir,\nJ'ai résolu mon problème de droit dans les partages, en faite, j'avais fait une grosse bêtise dans les autorisations !!!\nMais j'arrive vraiment pas à résoudre mon problème de la langue du système ...\ncomptes locaux ==> en Français\ncomptes AD ==> en Anglais\nJ'ai tentée d'avoir le choix de la langue à l'ouverture de session grâce à \"lightdm-gtk-greeter\", mais sa ne fonctionne pas.\nEn espérant avoir une réponse ...\nMerci\nPS : Je viens de voir que je n'ai plus accès à mon imprimante réseau ni à mon scaner et ce, sur tous les comptes, autan locaux que comptes AD ...\nDernière modification par Nathaly01 (Le 06/06/2013, à 00:07)\nHors ligne"}}},{"rowIdx":251,"cells":{"text":{"kind":"string","value":"malbo\n[Tuto] identifier si on est dans un système UEFI ou Bios\nATTENTION : CETTE MÉTHODE D’IDENTIFICATION EST OBSOLÈTE : IL FAUT UTILISER LA PROCÉDURE DE LA DOC : http://doc.ubuntu-fr.org/efi#identifier … n_mode_efi\nLe problème se pose pour des PC achetés en 2011 (et +) pour ceux qui souhaitent faire cohabiter Windows préinstallé et Ubuntu dans leur PC.\nIl y a plusieurs façon d'installer Ubuntu et, suivant le support d'installation (live-CD, une clé USB, autre...), il est possible qu'on ne sache pas si on s'apprête à installer dans un système Bios (classique) ou dans un système UEFI (successeur du Bios). Pour compliquer la chose, certaines carte-mères disposent d'un machin qui est compatible des deux modes et qui propose au choix à l'utilisateur de voir un live-CD en environnement Bios (souvent nommé \"Legacy Bios\") ou bien en environnement UEFI. Oui, ça sent bien le pâté.\nJ'indique ci-dessous le moyen de vérifier ce qu'il en est avant de se lancer dans l'installation proprement dite. A signaler : j'ai pompé la méthode de l'expert srs5694 du forum anglais : http://ubuntuforums.org/showpost.php?p= … ostcount=4\nDepuis la session live de Ubuntu 11.10 (essai sans installer), passer cette commande dans un terminal (il y a une commande alternative proposée dans le post #26 par YannUbuntu) :Attention : cette commande pour déterminer si on est en session EFI (ou pas) est obsolète pour Ubuntu 12.10. Il faut utiliser la procédure de la doc : http://doc.ubuntu-fr.org/efi#identifier … n_mode_efi\ndmesg | grep EFI\nCette commande ne présente aucun danger : elle demande d'afficher dans le terminal toutes les lignes qui mentionnent \"EFI\" dans le fichier log du démarrage de Ubuntu.\n------------------------------------------------------------------------------------------------------------------------------------------------------CAS 1 : SI UBUNTU EST ACTUELLEMENT DÉMARRÉ EN SESSION LIVE DANS UN SYSTÈME BIOS CLASSIQUE\nvoici le résultat que vous obtenez :\ndmesg | grep EFI\n[ 1.241248] EFI Variables Facility v0.08 2004-May-17\n\nOu encore ce genre de lignes (s'il s'agit d'un PC récent équipé d'un système UEFI) :\ndmesg | grep EFI\n[ 0.000000] ACPI: UEFI 00000000bafe7000 0003E (v01 DELL QA09 00000002 PTL 00000002)\n[ 0.000000] ACPI: UEFI 00000000bafe6000 00042 (v01 PTL COMBUF 00000001 PTL 00000001)\n[ 0.000000] ACPI: UEFI 00000000bafe5000 00256 (v01 DELL QA09 00000002 PTL 00000002)\n\nBien que le terme \"UEFI\" soit mentionné, le PC est démarré en mode \"Bios\" classique (et pas en mode EFI) à condition qu'il n'y ait pas plusieurs lignes comportant \"EFI: mem\" qui précèdent les lignes \"ACPI: UEFI\" (si on a la présence de lignes \"EFI: mem\", on est dans le CAS 2 ci-après)\n------------------------------------------------------------------------------------------------------------------------------------------------------\nCAS 2 : SI UBUNTU EST ACTUELLEMENT DÉMARRÉ EN SESSION LIVE DANS UN SYSTÈME UEFI :\nVoici le genre de résultat, avec plusieurs lignes comportant \"EFI: mem\" (c'est le mapping de la mémoire) :Attention : cette commande pour déterminer si on est en session EFI (ou pas) est obsolète pour Ubuntu 12.10. Il faut utiliser la procédure de la doc : http://doc.ubuntu-fr.org/efi#identifier … n_mode_efi\ndmesg | grep EFI\n[ 0.000000] EFI v2.10 by VBOX 64\n[ 0.000000] Kernel-defined memdesc doesn't match the one from EFI!\n[ 0.000000] EFI: mem00: type=7, attr=0xf, range=[0x0000000000000000-0x00000000000a0000) (0MB)\n[ 0.000000] EFI: mem01: type=2, attr=0xf, range=[0x0000000000100000-0x000000000056e000) (4MB)\n[ 0.000000] EFI: mem02: type=7, attr=0xf, range=[0x000000000056e000-0x000000000f9d9000) (244MB)\n[ 0.000000] EFI: mem03: type=2, attr=0xf, range=[0x000000000f9d9000-0x000000001f000000) (246MB)\n[ 0.000000] EFI: mem04: type=3, attr=0xf, range=[0x000000001f000000-0x000000001f00e000) (0MB)\n[ 0.000000] EFI: mem05: type=7, attr=0xf, range=[0x000000001f00e000-0x00000000365ae000) (373MB)\n[ 0.000000] EFI: mem06: type=2, attr=0xf, range=[0x00000000365ae000-0x00000000372cf000) (13MB)\n[ 0.000000] EFI: mem07: type=7, attr=0xf, range=[0x00000000372cf000-0x000000003d8bc000) (101MB)\n[ 0.000000] EFI: mem08: type=4, attr=0xf, range=[0x000000003d8bc000-0x000000003dc9f000) (3MB)\n[ 0.000000] EFI: mem09: type=7, attr=0xf, range=[0x000000003dc9f000-0x000000003dcb0000) (0MB)\n[ 0.000000] EFI: mem10: type=4, attr=0xf, range=[0x000000003dcb0000-0x000000003dcca000) (0MB)\n[ 0.000000] EFI: mem11: type=7, attr=0xf, range=[0x000000003dcca000-0x000000003dcda000) (0MB)\n[ 0.000000] EFI: mem12: type=4, attr=0xf, range=[0x000000003dcda000-0x000000003dcf6000) (0MB)\n[ 0.000000] EFI: mem13: type=7, attr=0xf, range=[0x000000003dcf6000-0x000000003dd4d000) (0MB)\n[ 0.000000] EFI: mem14: type=4, attr=0xf, range=[0x000000003dd4d000-0x000000003de05000) (0MB)\n[ 0.000000] EFI: mem15: type=7, attr=0xf, range=[0x000000003de05000-0x000000003de50000) (0MB)\n[ 0.000000] EFI: mem16: type=1, attr=0xf, range=[0x000000003de50000-0x000000003de70000) (0MB)\n[ 0.000000] EFI: mem17: type=4, attr=0xf, range=[0x000000003de70000-0x000000003de71000) (0MB)\n[ 0.000000] EFI: mem18: type=7, attr=0xf, range=[0x000000003de71000-0x000000003de95000) (0MB)\n[ 0.000000] EFI: mem19: type=2, attr=0xf, range=[0x000000003de95000-0x000000003de9b000) (0MB)\n[ 0.000000] EFI: mem20: type=4, attr=0xf, range=[0x000000003de9b000-0x000000003dea1000) (0MB)\n[ 0.000000] EFI: mem21: type=7, attr=0xf, range=[0x000000003dea1000-0x000000003dea4000) (0MB)\n[ 0.000000] EFI: mem22: type=2, attr=0xf, range=[0x000000003dea4000-0x000000003dea7000) (0MB)\n[ 0.000000] EFI: mem23: type=4, attr=0xf, range=[0x000000003dea7000-0x000000003deb1000) (0MB)\n[ 0.000000] EFI: mem24: type=2, attr=0xf, range=[0x000000003deb1000-0x000000003deba000) (0MB)\n[ 0.000000] EFI: mem25: type=7, attr=0xf, range=[0x000000003deba000-0x000000003debb000) (0MB)\n[ 0.000000] EFI: mem26: type=4, attr=0xf, range=[0x000000003debb000-0x000000003e7e7000) (9MB)\n[ 0.000000] EFI: mem27: type=3, attr=0xf, range=[0x000000003e7e7000-0x000000003e951000) (1MB)\n[ 0.000000] EFI: mem28: type=4, attr=0xf, range=[0x000000003e951000-0x000000003e952000) (0MB)\n[ 0.000000] EFI: mem29: type=3, attr=0xf, range=[0x000000003e952000-0x000000003e9d3000) (0MB)\n[ 0.000000] EFI: mem30: type=5, attr=0x800000000000000f, range=[0x000000003e9d3000-0x000000003e9f6000) (0MB)\n[ 0.000000] EFI: mem31: type=3, attr=0xf, range=[0x000000003e9f6000-0x000000003ea20000) (0MB)\n[ 0.000000] EFI: mem32: type=5, attr=0x800000000000000f, range=[0x000000003ea20000-0x000000003ea35000) (0MB)\n[ 0.000000] EFI: mem33: type=0, attr=0xf, range=[0x000000003ea35000-0x000000003ea36000) (0MB)\n[ 0.000000] EFI: mem34: type=4, attr=0xf, range=[0x000000003ea36000-0x000000003eed3000) (4MB)\n[ 0.000000] EFI: mem35: type=3, attr=0xf, range=[0x000000003eed3000-0x000000003eede000) (0MB)\n[ 0.000000] EFI: mem36: type=4, attr=0xf, range=[0x000000003eede000-0x000000003f83f000) (9MB)\n[ 0.000000] EFI: mem37: type=7, attr=0xf, range=[0x000000003f83f000-0x000000003f843000) (0MB)\n[ 0.000000] EFI: mem38: type=3, attr=0xf, range=[0x000000003f843000-0x000000003f8be000) (0MB)\n[ 0.000000] EFI: mem39: type=5, attr=0x800000000000000f, range=[0x000000003f8be000-0x000000003f8cc000) (0MB)\n[ 0.000000] EFI: mem40: type=3, attr=0xf, range=[0x000000003f8cc000-0x000000003f913000) (0MB)\n[ 0.000000] EFI: mem41: type=5, attr=0x800000000000000f, range=[0x000000003f913000-0x000000003f922000) (0MB)\n[ 0.000000] EFI: mem42: type=3, attr=0xf, range=[0x000000003f922000-0x000000003f92f000) (0MB)\n[ 0.000000] EFI: mem43: type=5, attr=0x800000000000000f, range=[0x000000003f92f000-0x000000003f933000) (0MB)\n[ 0.000000] EFI: mem44: type=5, attr=0x800000000000000f, range=[0x000000003f933000-0x000000003f94f000) (0MB)\n[ 0.000000] EFI: mem45: type=6, attr=0x800000000000000f, range=[0x000000003f94f000-0x000000003f985000) (0MB)\n[ 0.000000] EFI: mem46: type=6, attr=0x800000000000000f, range=[0x000000003f985000-0x000000003f99f000) (0MB)\n[ 0.000000] EFI: mem47: type=9, attr=0xf, range=[0x000000003f99f000-0x000000003f9b5000) (0MB)\n[ 0.000000] EFI: mem48: type=9, attr=0xf, range=[0x000000003f9b5000-0x000000003f9bb000) (0MB)\n[ 0.000000] EFI: mem49: type=10, attr=0xf, range=[0x000000003f9bb000-0x000000003f9bc000) (0MB)\n[ 0.000000] EFI: mem50: type=10, attr=0xf, range=[0x000000003f9bc000-0x000000003f9bf000) (0MB)\n[ 0.000000] EFI: mem51: type=4, attr=0xf, range=[0x000000003f9bf000-0x000000003fee0000) (5MB)\n[ 0.000000] EFI: mem52: type=6, attr=0x800000000000000f, range=[0x000000003fee0000-0x000000003ff00000) (0MB)\n[ 0.666999] fb0: EFI VGA frame buffer device\n[ 1.083445] EFI Variables Facility v0.08 2004-May-17\n\nA signaler : quand on est dans ce CAS 2, le live CD Ubuntu ne démarre pas comme habituellement. Il propose un menu Grub comme sur cette vue :\n---------------------------------------------------------------------------------------------------------------------------------------------------------------\nQU'EST-CE QU'ON EN FAIT ?\nSi vous êtes dans le CAS 1, vous vous apprêtez à installer Ubuntu de façon classique. C'est sympa ? Pas forcément parce que ça dépend des goûts et des habitudes : si Windows est préinstallé en mode UEFI et que vous installez Ubuntu en mode Bios, il faudra passer par le \"Bios\" ( ou ce qui en tient lieu sur votre PC) pour passer par Ubuntu ou par Windows (pas de menu Grub proposant le dual-boot). C'est ce qui est arrivé à Ayu qui n'apprécie pas cette situation : http://forum.ubuntu-fr.org/viewtopic.php?id=738321\nSi vous êtes dans le CAS 2, vous vous apprêtez à installer en mode UEFI. Je ne sais pas bien à l'heure actuelle (j'apprends) si le dual-boot géré par Grub sera possible dans tous les cas. Je veux dire qu'il faudra peut-être passer par le \"Bios\" pour certaines config ( ce qui n'est pas non plus une tragédie : il me semble que ces nouveaux \"Bios\" sont faits pour être vus et utilisés fréquemment alors que le vieux Bios était peu visité par le quidam ). Ce que je sais, c'est que la doc suivante ne vous concerne plus (vous allez utiliser grub-efi, pas grub-pc) : http://doc.ubuntu-fr.org/grub-pc\nEt pleins d'autres doc du site - relatives au Bios - sont obsolètes pour vous. C'est le progrès.\nDernière modification par malbo (Le 30/10/2012, à 12:40)\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nazdep\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonjour,\nAvec mon portable Asus, le livecd francophone 12.04 Desktop 64bits ne reconnait pas l'uefi, j'ai du utilisé le cd ubuntu.com.\nHors ligne\nYannUbuntu\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonjour,\nAvec mon portable Asus, le livecd francophone 12.04 Desktop 64bits ne reconnait pas l'uefi, j'ai du utilisé le cd ubuntu.com.\nBonjour\nPouvez-vous indiquer le résultat de \"dmesg | grep EFI\" saisi dans chacun des live-CD svp ?\nHors ligne\nazdep\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonjour,\nen fait j'ai rebooter sur chacun des livecd, et la chose est plus subtile que je le pensais.\nAvec le livecd francophe :\nJ'appuie sur ECHAP au démarrage pour avoir le bootmenu, dans la liste apparait entre autre P2:MASHITA........., que je sélectionne.\nLe résultat de dmesg | grep EFI :\n[ 4.832430] EFI Variables Facility v0.08 2004-May-17\n\nAvec le livecd \"original\" :\nJ'appuie sur ECHAP au démarrage pour avoir le bootmenu, dans la liste apparait entre\n- P2:MASHITA...... et\n- UEFI P2:MASHITA.....\nsi je sélectionne le premier j'ai la même réponse à la commande dmesg.\nPar contre si je sélectionne le second j'ai :\n[ 0.000000] EFI v2.31 by American Megatrends\n[ 0.000000] Kernel-defined memdesc doesn't match the one from EFI!\n[ 0.000000] EFI: mem00: type=3, attr=0xf, range=[0x0000000000000000-0x0000000000008000) (0MB)\n[ 0.000000] EFI: mem01: type=7, attr=0xf, range=[0x0000000000008000-0x000000000004e000) (0MB)\n[ 0.000000] EFI: mem02: type=4, attr=0xf, range=[0x000000000004e000-0x0000000000060000) (0MB)\n[ 0.000000] EFI: mem03: type=3, attr=0xf, range=[0x0000000000060000-0x000000000009f000) (0MB)\n[ 0.000000] EFI: mem04: type=6, attr=0x800000000000000f, range=[0x000000000009f000-0x00000000000a0000) (0MB)\n[ 0.000000] EFI: mem05: type=2, attr=0xf, range=[0x0000000000100000-0x00000000005b9000) (4MB)\n[ 0.000000] EFI: mem06: type=7, attr=0xf, range=[0x00000000005b9000-0x0000000001000000) (10MB)\n[ 0.000000] EFI: mem07: type=2, attr=0xf, range=[0x0000000001000000-0x0000000001100000) (1MB)\n[ 0.000000] EFI: mem08: type=7, attr=0xf, range=[0x0000000001100000-0x0000000008000000) (111MB)\n[ 0.000000] EFI: mem09: type=4, attr=0xf, range=[0x0000000008000000-0x0000000008837000) (8MB)\n[ 0.000000] EFI: mem10: type=3, attr=0xf, range=[0x0000000008837000-0x0000000008839000) (0MB)\n[ 0.000000] EFI: mem11: type=4, attr=0xf, range=[0x0000000008839000-0x0000000008882000) (0MB)\n[ 0.000000] EFI: mem12: type=3, attr=0xf, range=[0x0000000008882000-0x0000000008886000) (0MB)\n[ 0.000000] EFI: mem13: type=4, attr=0xf, range=[0x0000000008886000-0x000000000888b000) (0MB)\n[ 0.000000] EFI: mem14: type=3, attr=0xf, range=[0x000000000888b000-0x000000000888c000) (0MB)\n[ 0.000000] EFI: mem15: type=4, attr=0xf, range=[0x000000000888c000-0x000000000888e000) (0MB)\n[ 0.000000] EFI: mem16: type=3, attr=0xf, range=[0x000000000888e000-0x000000000888f000) (0MB)\n[ 0.000000] EFI: mem17: type=4, attr=0xf, range=[0x000000000888f000-0x0000000008892000) (0MB)\n[ 0.000000] EFI: mem18: type=3, attr=0xf, range=[0x0000000008892000-0x00000000088a2000) (0MB)\n[ 0.000000] EFI: mem19: type=4, attr=0xf, range=[0x00000000088a2000-0x0000000008ca5000) (4MB)\n[ 0.000000] EFI: mem20: type=3, attr=0xf, range=[0x0000000008ca5000-0x0000000008ca6000) (0MB)\n[ 0.000000] EFI: mem21: type=4, attr=0xf, range=[0x0000000008ca6000-0x0000000008caa000) (0MB)\n[ 0.000000] EFI: mem22: type=3, attr=0xf, range=[0x0000000008caa000-0x0000000008cab000) (0MB)\n[ 0.000000] EFI: mem23: type=4, attr=0xf, range=[0x0000000008cab000-0x0000000008cb0000) (0MB)\n[ 0.000000] EFI: mem24: type=3, attr=0xf, range=[0x0000000008cb0000-0x0000000008cb1000) (0MB)\n[ 0.000000] EFI: mem25: type=4, attr=0xf, range=[0x0000000008cb1000-0x0000000008cb2000) (0MB)\n[ 0.000000] EFI: mem26: type=3, attr=0xf, range=[0x0000000008cb2000-0x0000000008cb5000) (0MB)\n[ 0.000000] EFI: mem27: type=4, attr=0xf, range=[0x0000000008cb5000-0x0000000008cb7000) (0MB)\n[ 0.000000] EFI: mem28: type=3, attr=0xf, range=[0x0000000008cb7000-0x0000000008cb8000) (0MB)\n[ 0.000000] EFI: mem29: type=4, attr=0xf, range=[0x0000000008cb8000-0x0000000008cc4000) (0MB)\n[ 0.000000] EFI: mem30: type=3, attr=0xf, range=[0x0000000008cc4000-0x0000000008cc8000) (0MB)\n[ 0.000000] EFI: mem31: type=4, attr=0xf, range=[0x0000000008cc8000-0x0000000008cc9000) (0MB)\n[ 0.000000] EFI: mem32: type=3, attr=0xf, range=[0x0000000008cc9000-0x0000000008cca000) (0MB)\n[ 0.000000] EFI: mem33: type=4, attr=0xf, range=[0x0000000008cca000-0x0000000008cd6000) (0MB)\n[ 0.000000] EFI: mem34: type=3, attr=0xf, range=[0x0000000008cd6000-0x0000000008cd9000) (0MB)\n[ 0.000000] EFI: mem35: type=4, attr=0xf, range=[0x0000000008cd9000-0x0000000008cda000) (0MB)\n[ 0.000000] EFI: mem36: type=3, attr=0xf, range=[0x0000000008cda000-0x0000000008cdc000) (0MB)\n[ 0.000000] EFI: mem37: type=4, attr=0xf, range=[0x0000000008cdc000-0x0000000008cde000) (0MB)\n[ 0.000000] EFI: mem38: type=3, attr=0xf, range=[0x0000000008cde000-0x0000000008cdf000) (0MB)\n[ 0.000000] EFI: mem39: type=4, attr=0xf, range=[0x0000000008cdf000-0x0000000008cee000) (0MB)\n[ 0.000000] EFI: mem40: type=3, attr=0xf, range=[0x0000000008cee000-0x0000000008cef000) (0MB)\n[ 0.000000] EFI: mem41: type=4, attr=0xf, range=[0x0000000008cef000-0x0000000008cf7000) (0MB)\n[ 0.000000] EFI: mem42: type=3, attr=0xf, range=[0x0000000008cf7000-0x0000000008cfb000) (0MB)\n[ 0.000000] EFI: mem43: type=4, attr=0xf, range=[0x0000000008cfb000-0x0000000008d03000) (0MB)\n[ 0.000000] EFI: mem44: type=3, attr=0xf, range=[0x0000000008d03000-0x0000000008d06000) (0MB)\n[ 0.000000] EFI: mem45: type=4, attr=0xf, range=[0x0000000008d06000-0x0000000008d0b000) (0MB)\n[ 0.000000] EFI: mem46: type=3, attr=0xf, range=[0x0000000008d0b000-0x0000000008d0c000) (0MB)\n[ 0.000000] EFI: mem47: type=4, attr=0xf, range=[0x0000000008d0c000-0x0000000008d0e000) (0MB)\n[ 0.000000] EFI: mem48: type=3, attr=0xf, range=[0x0000000008d0e000-0x0000000008d12000) (0MB)\n[ 0.000000] EFI: mem49: type=4, attr=0xf, range=[0x0000000008d12000-0x0000000008d76000) (0MB)\n[ 0.000000] EFI: mem50: type=3, attr=0xf, range=[0x0000000008d76000-0x0000000008d77000) (0MB)\n[ 0.000000] EFI: mem51: type=4, attr=0xf, range=[0x0000000008d77000-0x0000000008d78000) (0MB)\n[ 0.000000] EFI: mem52: type=3, attr=0xf, range=[0x0000000008d78000-0x0000000008d79000) (0MB)\n[ 0.000000] EFI: mem53: type=4, attr=0xf, range=[0x0000000008d79000-0x0000000008d83000) (0MB)\n[ 0.000000] EFI: mem54: type=3, attr=0xf, range=[0x0000000008d83000-0x0000000008d88000) (0MB)\n[ 0.000000] EFI: mem55: type=4, attr=0xf, range=[0x0000000008d88000-0x0000000008d9e000) (0MB)\n[ 0.000000] EFI: mem56: type=3, attr=0xf, range=[0x0000000008d9e000-0x0000000008d9f000) (0MB)\n[ 0.000000] EFI: mem57: type=4, attr=0xf, range=[0x0000000008d9f000-0x0000000008da1000) (0MB)\n[ 0.000000] EFI: mem58: type=3, attr=0xf, range=[0x0000000008da1000-0x0000000008dab000) (0MB)\n[ 0.000000] EFI: mem59: type=4, attr=0xf, range=[0x0000000008dab000-0x0000000008dba000) (0MB)\n[ 0.000000] EFI: mem60: type=3, attr=0xf, range=[0x0000000008dba000-0x0000000008dbe000) (0MB)\n[ 0.000000] EFI: mem61: type=4, attr=0xf, range=[0x0000000008dbe000-0x0000000008dc8000) (0MB)\n[ 0.000000] EFI: mem62: type=3, attr=0xf, range=[0x0000000008dc8000-0x0000000008dc9000) (0MB)\n[ 0.000000] EFI: mem63: type=4, attr=0xf, range=[0x0000000008dc9000-0x0000000008dcd000) (0MB)\n[ 0.000000] EFI: mem64: type=3, attr=0xf, range=[0x0000000008dcd000-0x0000000008dd3000) (0MB)\n[ 0.000000] EFI: mem65: type=4, attr=0xf, range=[0x0000000008dd3000-0x0000000008ddd000) (0MB)\n[ 0.000000] EFI: mem66: type=3, attr=0xf, range=[0x0000000008ddd000-0x0000000008de2000) (0MB)\n[ 0.000000] EFI: mem67: type=4, attr=0xf, range=[0x0000000008de2000-0x0000000008de6000) (0MB)\n[ 0.000000] EFI: mem68: type=3, attr=0xf, range=[0x0000000008de6000-0x0000000008dea000) (0MB)\n[ 0.000000] EFI: mem69: type=4, attr=0xf, range=[0x0000000008dea000-0x0000000008df1000) (0MB)\n[ 0.000000] EFI: mem70: type=3, attr=0xf, range=[0x0000000008df1000-0x0000000008df3000) (0MB)\n[ 0.000000] EFI: mem71: type=4, attr=0xf, range=[0x0000000008df3000-0x0000000008df4000) (0MB)\n[ 0.000000] EFI: mem72: type=3, attr=0xf, range=[0x0000000008df4000-0x0000000008dfa000) (0MB)\n[ 0.000000] EFI: mem73: type=4, attr=0xf, range=[0x0000000008dfa000-0x0000000008dfb000) (0MB)\n[ 0.000000] EFI: mem74: type=3, attr=0xf, range=[0x0000000008dfb000-0x0000000008dfd000) (0MB)\n[ 0.000000] EFI: mem75: type=4, attr=0xf, range=[0x0000000008dfd000-0x0000000008e07000) (0MB)\n[ 0.000000] EFI: mem76: type=3, attr=0xf, range=[0x0000000008e07000-0x0000000008e0c000) (0MB)\n[ 0.000000] EFI: mem77: type=4, attr=0xf, range=[0x0000000008e0c000-0x0000000008e0d000) (0MB)\n[ 0.000000] EFI: mem78: type=3, attr=0xf, range=[0x0000000008e0d000-0x0000000008e0e000) (0MB)\n[ 0.000000] EFI: mem79: type=4, attr=0xf, range=[0x0000000008e0e000-0x0000000008e0f000) (0MB)\n[ 0.000000] EFI: mem80: type=3, attr=0xf, range=[0x0000000008e0f000-0x0000000008e11000) (0MB)\n[ 0.000000] EFI: mem81: type=4, attr=0xf, range=[0x0000000008e11000-0x0000000008e14000) (0MB)\n[ 0.000000] EFI: mem82: type=3, attr=0xf, range=[0x0000000008e14000-0x0000000008e15000) (0MB)\n[ 0.000000] EFI: mem83: type=4, attr=0xf, range=[0x0000000008e15000-0x0000000008e1a000) (0MB)\n[ 0.000000] EFI: mem84: type=3, attr=0xf, range=[0x0000000008e1a000-0x0000000008e1c000) (0MB)\n[ 0.000000] EFI: mem85: type=4, attr=0xf, range=[0x0000000008e1c000-0x0000000008e21000) (0MB)\n[ 0.000000] EFI: mem86: type=3, attr=0xf, range=[0x0000000008e21000-0x0000000008e22000) (0MB)\n[ 0.000000] EFI: mem87: type=4, attr=0xf, range=[0x0000000008e22000-0x0000000008e30000) (0MB)\n[ 0.000000] EFI: mem88: type=3, attr=0xf, range=[0x0000000008e30000-0x0000000008e33000) (0MB)\n[ 0.000000] EFI: mem89: type=4, attr=0xf, range=[0x0000000008e33000-0x0000000008e44000) (0MB)\n[ 0.000000] EFI: mem90: type=3, attr=0xf, range=[0x0000000008e44000-0x0000000008e4e000) (0MB)\n[ 0.000000] EFI: mem91: type=4, attr=0xf, range=[0x0000000008e4e000-0x0000000008e51000) (0MB)\n[ 0.000000] EFI: mem92: type=3, attr=0xf, range=[0x0000000008e51000-0x0000000008e54000) (0MB)\n[ 0.000000] EFI: mem93: type=4, attr=0xf, range=[0x0000000008e54000-0x0000000008e5f000) (0MB)\n[ 0.000000] EFI: mem94: type=3, attr=0xf, range=[0x0000000008e5f000-0x0000000008e61000) (0MB)\n[ 0.000000] EFI: mem95: type=4, attr=0xf, range=[0x0000000008e61000-0x0000000008e62000) (0MB)\n[ 0.000000] EFI: mem96: type=3, attr=0xf, range=[0x0000000008e62000-0x0000000008e67000) (0MB)\n[ 0.000000] EFI: mem97: type=4, attr=0xf, range=[0x0000000008e67000-0x0000000008e76000) (0MB)\n[ 0.000000] EFI: mem98: type=3, attr=0xf, range=[0x0000000008e76000-0x0000000008e7c000) (0MB)\n[ 0.000000] EFI: mem99: type=4, attr=0xf, range=[0x0000000008e7c000-0x0000000008e86000) (0MB)\n[ 0.000000] EFI: mem100: type=3, attr=0xf, range=[0x0000000008e86000-0x0000000008e89000) (0MB)\n[ 0.000000] EFI: mem101: type=4, attr=0xf, range=[0x0000000008e89000-0x0000000008e91000) (0MB)\n[ 0.000000] EFI: mem102: type=3, attr=0xf, range=[0x0000000008e91000-0x0000000008e95000) (0MB)\n[ 0.000000] EFI: mem103: type=4, attr=0xf, range=[0x0000000008e95000-0x0000000008eae000) (0MB)\n[ 0.000000] EFI: mem104: type=3, attr=0xf, range=[0x0000000008eae000-0x0000000008eaf000) (0MB)\n[ 0.000000] EFI: mem105: type=4, attr=0xf, range=[0x0000000008eaf000-0x0000000008eb4000) (0MB)\n[ 0.000000] EFI: mem106: type=3, attr=0xf, range=[0x0000000008eb4000-0x0000000008ec7000) (0MB)\n[ 0.000000] EFI: mem107: type=4, attr=0xf, range=[0x0000000008ec7000-0x0000000008ecd000) (0MB)\n[ 0.000000] EFI: mem108: type=3, attr=0xf, range=[0x0000000008ecd000-0x0000000008ed0000) (0MB)\n[ 0.000000] EFI: mem109: type=4, attr=0xf, range=[0x0000000008ed0000-0x0000000008ed6000) (0MB)\n[ 0.000000] EFI: mem110: type=3, attr=0xf, range=[0x0000000008ed6000-0x0000000008ed8000) (0MB)\n[ 0.000000] EFI: mem111: type=4, attr=0xf, range=[0x0000000008ed8000-0x0000000008ed9000) (0MB)\n[ 0.000000] EFI: mem112: type=3, attr=0xf, range=[0x0000000008ed9000-0x0000000008edc000) (0MB)\n[ 0.000000] EFI: mem113: type=4, attr=0xf, range=[0x0000000008edc000-0x0000000008ef5000) (0MB)\n[ 0.000000] EFI: mem114: type=3, attr=0xf, range=[0x0000000008ef5000-0x0000000008ef6000) (0MB)\n[ 0.000000] EFI: mem115: type=4, attr=0xf, range=[0x0000000008ef6000-0x0000000008f00000) (0MB)\n[ 0.000000] EFI: mem116: type=3, attr=0xf, range=[0x0000000008f00000-0x0000000008f04000) (0MB)\n[ 0.000000] EFI: mem117: type=4, attr=0xf, range=[0x0000000008f04000-0x0000000008f07000) (0MB)\n[ 0.000000] EFI: mem118: type=3, attr=0xf, range=[0x0000000008f07000-0x0000000008f1b000) (0MB)\n[ 0.000000] EFI: mem119: type=4, attr=0xf, range=[0x0000000008f1b000-0x0000000008f28000) (0MB)\n[ 0.000000] EFI: mem120: type=3, attr=0xf, range=[0x0000000008f28000-0x0000000008f30000) (0MB)\n[ 0.000000] EFI: mem121: type=4, attr=0xf, range=[0x0000000008f30000-0x0000000008f32000) (0MB)\n[ 0.000000] EFI: mem122: type=3, attr=0xf, range=[0x0000000008f32000-0x0000000008f34000) (0MB)\n[ 0.000000] EFI: mem123: type=4, attr=0xf, range=[0x0000000008f34000-0x0000000008f37000) (0MB)\n[ 0.000000] EFI: mem124: type=3, attr=0xf, range=[0x0000000008f37000-0x0000000008f4c000) (0MB)\n[ 0.000000] EFI: mem125: type=4, attr=0xf, range=[0x0000000008f4c000-0x0000000008f54000) (0MB)\n[ 0.000000] EFI: mem126: type=3, attr=0xf, range=[0x0000000008f54000-0x0000000008f59000) (0MB)\n[ 0.000000] EFI: mem127: type=4, attr=0xf, range=[0x0000000008f59000-0x0000000008f5a000) (0MB)\n[ 0.000000] EFI: mem128: type=3, attr=0xf, range=[0x0000000008f5a000-0x0000000008f60000) (0MB)\n[ 0.000000] EFI: mem129: type=4, attr=0xf, range=[0x0000000008f60000-0x0000000008f66000) (0MB)\n[ 0.000000] EFI: mem130: type=3, attr=0xf, range=[0x0000000008f66000-0x0000000008f6d000) (0MB)\n[ 0.000000] EFI: mem131: type=4, attr=0xf, range=[0x0000000008f6d000-0x0000000008f78000) (0MB)\n[ 0.000000] EFI: mem132: type=3, attr=0xf, range=[0x0000000008f78000-0x0000000008f7a000) (0MB)\n[ 0.000000] EFI: mem133: type=4, attr=0xf, range=[0x0000000008f7a000-0x0000000008f7c000) (0MB)\n[ 0.000000] EFI: mem134: type=3, attr=0xf, range=[0x0000000008f7c000-0x0000000008f81000) (0MB)\n[ 0.000000] EFI: mem135: type=4, attr=0xf, range=[0x0000000008f81000-0x0000000008f93000) (0MB)\n[ 0.000000] EFI: mem136: type=3, attr=0xf, range=[0x0000000008f93000-0x0000000008f97000) (0MB)\n[ 0.000000] EFI: mem137: type=4, attr=0xf, range=[0x0000000008f97000-0x0000000008f9c000) (0MB)\n[ 0.000000] EFI: mem138: type=3, attr=0xf, range=[0x0000000008f9c000-0x0000000008fa8000) (0MB)\n[ 0.000000] EFI: mem139: type=4, attr=0xf, range=[0x0000000008fa8000-0x0000000008fae000) (0MB)\n[ 0.000000] EFI: mem140: type=3, attr=0xf, range=[0x0000000008fae000-0x0000000008fb7000) (0MB)\n[ 0.000000] EFI: mem141: type=4, attr=0xf, range=[0x0000000008fb7000-0x0000000008fbb000) (0MB)\n[ 0.000000] EFI: mem142: type=3, attr=0xf, range=[0x0000000008fbb000-0x0000000008fbc000) (0MB)\n[ 0.000000] EFI: mem143: type=4, attr=0xf, range=[0x0000000008fbc000-0x0000000008fd9000) (0MB)\n[ 0.000000] EFI: mem144: type=3, attr=0xf, range=[0x0000000008fd9000-0x0000000008fdb000) (0MB)\n[ 0.000000] EFI: mem145: type=4, attr=0xf, range=[0x0000000008fdb000-0x0000000008fdc000) (0MB)\n[ 0.000000] EFI: mem146: type=3, attr=0xf, range=[0x0000000008fdc000-0x0000000008fdd000) (0MB)\n[ 0.000000] EFI: mem147: type=4, attr=0xf, range=[0x0000000008fdd000-0x0000000008fe6000) (0MB)\n[ 0.000000] EFI: mem148: type=3, attr=0xf, range=[0x0000000008fe6000-0x0000000008fff000) (0MB)\n[ 0.000000] EFI: mem149: type=4, attr=0xf, range=[0x0000000008fff000-0x0000000009028000) (0MB)\n[ 0.000000] EFI: mem150: type=3, attr=0xf, range=[0x0000000009028000-0x000000000902f000) (0MB)\n[ 0.000000] EFI: mem151: type=4, attr=0xf, range=[0x000000000902f000-0x0000000009030000) (0MB)\n[ 0.000000] EFI: mem152: type=3, attr=0xf, range=[0x0000000009030000-0x0000000009079000) (0MB)\n[ 0.000000] EFI: mem153: type=4, attr=0xf, range=[0x0000000009079000-0x000000000907b000) (0MB)\n[ 0.000000] EFI: mem154: type=3, attr=0xf, range=[0x000000000907b000-0x00000000090a4000) (0MB)\n[ 0.000000] EFI: mem155: type=4, attr=0xf, range=[0x00000000090a4000-0x00000000090a5000) (0MB)\n[ 0.000000] EFI: mem156: type=3, attr=0xf, range=[0x00000000090a5000-0x00000000090af000) (0MB)\n[ 0.000000] EFI: mem157: type=4, attr=0xf, range=[0x00000000090af000-0x00000000090b3000) (0MB)\n[ 0.000000] EFI: mem158: type=3, attr=0xf, range=[0x00000000090b3000-0x00000000090d5000) (0MB)\n[ 0.000000] EFI: mem159: type=4, attr=0xf, range=[0x00000000090d5000-0x00000000090d8000) (0MB)\n[ 0.000000] EFI: mem160: type=3, attr=0xf, range=[0x00000000090d8000-0x0000000009101000) (0MB)\n[ 0.000000] EFI: mem161: type=4, attr=0xf, range=[0x0000000009101000-0x0000000009102000) (0MB)\n[ 0.000000] EFI: mem162: type=3, attr=0xf, range=[0x0000000009102000-0x0000000009118000) (0MB)\n[ 0.000000] EFI: mem163: type=4, attr=0xf, range=[0x0000000009118000-0x0000000009129000) (0MB)\n[ 0.000000] EFI: mem164: type=3, attr=0xf, range=[0x0000000009129000-0x000000000912a000) (0MB)\n[ 0.000000] EFI: mem165: type=4, attr=0xf, range=[0x000000000912a000-0x000000000912b000) (0MB)\n[ 0.000000] EFI: mem166: type=3, attr=0xf, range=[0x000000000912b000-0x000000000913e000) (0MB)\n[ 0.000000] EFI: mem167: type=4, attr=0xf, range=[0x000000000913e000-0x0000000009146000) (0MB)\n[ 0.000000] EFI: mem168: type=3, attr=0xf, range=[0x0000000009146000-0x0000000009150000) (0MB)\n[ 0.000000] EFI: mem169: type=4, attr=0xf, range=[0x0000000009150000-0x0000000009154000) (0MB)\n[ 0.000000] EFI: mem170: type=3, attr=0xf, range=[0x0000000009154000-0x00000000091dc000) (0MB)\n[ 0.000000] EFI: mem171: type=4, attr=0xf, range=[0x00000000091dc000-0x00000000091de000) (0MB)\n[ 0.000000] EFI: mem172: type=3, attr=0xf, range=[0x00000000091de000-0x00000000091df000) (0MB)\n[ 0.000000] EFI: mem173: type=4, attr=0xf, range=[0x00000000091df000-0x00000000091e2000) (0MB)\n[ 0.000000] EFI: mem174: type=3, attr=0xf, range=[0x00000000091e2000-0x00000000091e3000) (0MB)\n[ 0.000000] EFI: mem175: type=4, attr=0xf, range=[0x00000000091e3000-0x00000000091f6000) (0MB)\n[ 0.000000] EFI: mem176: type=3, attr=0xf, range=[0x00000000091f6000-0x00000000091fc000) (0MB)\n[ 0.000000] EFI: mem177: type=4, attr=0xf, range=[0x00000000091fc000-0x00000000091fd000) (0MB)\n[ 0.000000] EFI: mem178: type=3, attr=0xf, range=[0x00000000091fd000-0x00000000091ff000) (0MB)\n[ 0.000000] EFI: mem179: type=4, attr=0xf, range=[0x00000000091ff000-0x0000000009204000) (0MB)\n[ 0.000000] EFI: mem180: type=3, attr=0xf, range=[0x0000000009204000-0x000000000920a000) (0MB)\n[ 0.000000] EFI: mem181: type=4, attr=0xf, range=[0x000000000920a000-0x0000000009242000) (0MB)\n[ 0.000000] EFI: mem182: type=3, attr=0xf, range=[0x0000000009242000-0x0000000009248000) (0MB)\n[ 0.000000] EFI: mem183: type=4, attr=0xf, range=[0x0000000009248000-0x000000000924f000) (0MB)\n[ 0.000000] EFI: mem184: type=3, attr=0xf, range=[0x000000000924f000-0x0000000009262000) (0MB)\n[ 0.000000] EFI: mem185: type=4, attr=0xf, range=[0x0000000009262000-0x000000000928d000) (0MB)\n[ 0.000000] EFI: mem186: type=3, attr=0xf, range=[0x000000000928d000-0x000000000928f000) (0MB)\n[ 0.000000] EFI: mem187: type=4, attr=0xf, range=[0x000000000928f000-0x0000000009291000) (0MB)\n[ 0.000000] EFI: mem188: type=3, attr=0xf, range=[0x0000000009291000-0x0000000009293000) (0MB)\n[ 0.000000] EFI: mem189: type=4, attr=0xf, range=[0x0000000009293000-0x000000000929a000) (0MB)\n[ 0.000000] EFI: mem190: type=3, attr=0xf, range=[0x000000000929a000-0x00000000092a7000) (0MB)\n[ 0.000000] EFI: mem191: type=4, attr=0xf, range=[0x00000000092a7000-0x00000000092b5000) (0MB)\n[ 0.000000] EFI: mem192: type=3, attr=0xf, range=[0x00000000092b5000-0x00000000092e3000) (0MB)\n[ 0.000000] EFI: mem193: type=4, attr=0xf, range=[0x00000000092e3000-0x00000000092ec000) (0MB)\n[ 0.000000] EFI: mem194: type=3, attr=0xf, range=[0x00000000092ec000-0x00000000092ef000) (0MB)\n[ 0.000000] EFI: mem195: type=4, attr=0xf, range=[0x00000000092ef000-0x0000000012b46000) (152MB)\n[ 0.000000] EFI: mem196: type=7, attr=0xf, range=[0x0000000012b46000-0x0000000012b4a000) (0MB)\n[ 0.000000] EFI: mem197: type=2, attr=0xf, range=[0x0000000012b4a000-0x0000000012b4c000) (0MB)\n[ 0.000000] EFI: mem198: type=7, attr=0xf, range=[0x0000000012b4c000-0x0000000012d14000) (1MB)\n[ 0.000000] EFI: mem199: type=4, attr=0xf, range=[0x0000000012d14000-0x0000000012d18000) (0MB)\n[ 0.000000] EFI: mem200: type=7, attr=0xf, range=[0x0000000012d18000-0x0000000012d20000) (0MB)\n[ 0.000000] EFI: mem201: type=4, attr=0xf, range=[0x0000000012d20000-0x0000000012d55000) (0MB)\n[ 0.000000] EFI: mem202: type=7, attr=0xf, range=[0x0000000012d55000-0x0000000012dbd000) (0MB)\n[ 0.000000] EFI: mem203: type=1, attr=0xf, range=[0x0000000012dbd000-0x0000000012e25000) (0MB)\n[ 0.000000] EFI: mem204: type=7, attr=0xf, range=[0x0000000012e25000-0x0000000012e40000) (0MB)\n[ 0.000000] EFI: mem205: type=4, attr=0xf, range=[0x0000000012e40000-0x0000000012fbc000) (1MB)\n[ 0.000000] EFI: mem206: type=3, attr=0xf, range=[0x0000000012fbc000-0x0000000012fbd000) (0MB)\n[ 0.000000] EFI: mem207: type=4, attr=0xf, range=[0x0000000012fbd000-0x0000000012fc0000) (0MB)\n[ 0.000000] EFI: mem208: type=3, attr=0xf, range=[0x0000000012fc0000-0x0000000012fc3000) (0MB)\n[ 0.000000] EFI: mem209: type=4, attr=0xf, range=[0x0000000012fc3000-0x0000000013142000) (1MB)\n[ 0.000000] EFI: mem210: type=3, attr=0xf, range=[0x0000000013142000-0x0000000013152000) (0MB)\n[ 0.000000] EFI: mem211: type=4, attr=0xf, range=[0x0000000013152000-0x0000000013198000) (0MB)\n[ 0.000000] EFI: mem212: type=3, attr=0xf, range=[0x0000000013198000-0x000000001319c000) (0MB)\n[ 0.000000] EFI: mem213: type=4, attr=0xf, range=[0x000000001319c000-0x000000001342d000) (2MB)\n[ 0.000000] EFI: mem214: type=7, attr=0xf, range=[0x000000001342d000-0x0000000013462000) (0MB)\n[ 0.000000] EFI: mem215: type=4, attr=0xf, range=[0x0000000013462000-0x0000000013542000) (0MB)\n[ 0.000000] EFI: mem216: type=7, attr=0xf, range=[0x0000000013542000-0x000000001355f000) (0MB)\n[ 0.000000] EFI: mem217: type=4, attr=0xf, range=[0x000000001355f000-0x0000000013a07000) (4MB)\n[ 0.000000] EFI: mem218: type=7, attr=0xf, range=[0x0000000013a07000-0x0000000020000000) (197MB)\n[ 0.000000] EFI: mem219: type=0, attr=0xf, range=[0x0000000020000000-0x0000000020200000) (2MB)\n[ 0.000000] EFI: mem220: type=7, attr=0xf, range=[0x0000000020200000-0x0000000036352000) (353MB)\n[ 0.000000] EFI: mem221: type=2, attr=0xf, range=[0x0000000036352000-0x00000000371a1000) (14MB)\n[ 0.000000] EFI: mem222: type=7, attr=0xf, range=[0x00000000371a1000-0x0000000040004000) (142MB)\n[ 0.000000] EFI: mem223: type=0, attr=0xf, range=[0x0000000040004000-0x0000000040005000) (0MB)\n[ 0.000000] EFI: mem224: type=7, attr=0xf, range=[0x0000000040005000-0x00000000999d9000) (1433MB)\n[ 0.000000] EFI: mem225: type=2, attr=0xf, range=[0x00000000999d9000-0x00000000c8eab000) (756MB)\n[ 0.000000] EFI: mem226: type=5, attr=0x800000000000000f, range=[0x00000000c8eab000-0x00000000c8ead000) (0MB)\n[ 0.000000] EFI: mem227: type=0, attr=0xf, range=[0x00000000c8ead000-0x00000000c8fc0000) (1MB)\n[ 0.000000] EFI: mem228: type=5, attr=0x800000000000000f, range=[0x00000000c8fc0000-0x00000000c8fd9000) (0MB)\n[ 0.000000] EFI: mem229: type=6, attr=0x800000000000000f, range=[0x00000000c8fd9000-0x00000000c8fe6000) (0MB)\n[ 0.000000] EFI: mem230: type=5, attr=0x800000000000000f, range=[0x00000000c8fe6000-0x00000000c9022000) (0MB)\n[ 0.000000] EFI: mem231: type=6, attr=0x800000000000000f, range=[0x00000000c9022000-0x00000000c9082000) (0MB)\n[ 0.000000] EFI: mem232: type=5, attr=0x800000000000000f, range=[0x00000000c9082000-0x00000000c9099000) (0MB)\n[ 0.000000] EFI: mem233: type=6, attr=0x800000000000000f, range=[0x00000000c9099000-0x00000000c90a8000) (0MB)\n[ 0.000000] EFI: mem234: type=6, attr=0x800000000000000f, range=[0x00000000c90a8000-0x00000000c90c3000) (0MB)\n[ 0.000000] EFI: mem235: type=0, attr=0xf, range=[0x00000000c90c3000-0x00000000c910a000) (0MB)\n[ 0.000000] EFI: mem236: type=0, attr=0xf, range=[0x00000000c910a000-0x00000000c911a000) (0MB)\n[ 0.000000] EFI: mem237: type=10, attr=0xf, range=[0x00000000c911a000-0x00000000c953b000) (4MB)\n[ 0.000000] EFI: mem238: type=0, attr=0xf, range=[0x00000000c953b000-0x00000000c9558000) (0MB)\n[ 0.000000] EFI: mem239: type=0, attr=0xf, range=[0x00000000c9558000-0x00000000c955e000) (0MB)\n[ 0.000000] EFI: mem240: type=0, attr=0xf, range=[0x00000000c955e000-0x00000000c95c3000) (0MB)\n[ 0.000000] EFI: mem241: type=10, attr=0xf, range=[0x00000000c95c3000-0x00000000c9751000) (1MB)\n[ 0.000000] EFI: mem242: type=10, attr=0xf, range=[0x00000000c9751000-0x00000000c980d000) (0MB)\n[ 0.000000] EFI: mem243: type=10, attr=0xf, range=[0x00000000c980d000-0x00000000c981e000) (0MB)\n[ 0.000000] EFI: mem244: type=10, attr=0xf, range=[0x00000000c981e000-0x00000000c9828000) (0MB)\n[ 0.000000] EFI: mem245: type=10, attr=0xf, range=[0x00000000c9828000-0x00000000c982c000) (0MB)\n[ 0.000000] EFI: mem246: type=10, attr=0xf, range=[0x00000000c982c000-0x00000000c9843000) (0MB)\n[ 0.000000] EFI: mem247: type=9, attr=0xf, range=[0x00000000c9843000-0x00000000c9847000) (0MB)\n[ 0.000000] EFI: mem248: type=9, attr=0xf, range=[0x00000000c9847000-0x00000000c9848000) (0MB)\n[ 0.000000] EFI: mem249: type=10, attr=0xf, range=[0x00000000c9848000-0x00000000c988b000) (0MB)\n[ 0.000000] EFI: mem250: type=4, attr=0xf, range=[0x00000000c988b000-0x00000000c99d0000) (1MB)\n[ 0.000000] EFI: mem251: type=3, attr=0xf, range=[0x00000000c99d0000-0x00000000c9c5e000) (2MB)\n[ 0.000000] EFI: mem252: type=4, attr=0xf, range=[0x00000000c9c5e000-0x00000000c9c6d000) (0MB)\n[ 0.000000] EFI: mem253: type=3, attr=0xf, range=[0x00000000c9c6d000-0x00000000c9c7f000) (0MB)\n[ 0.000000] EFI: mem254: type=4, attr=0xf, range=[0x00000000c9c7f000-0x00000000c9c80000) (0MB)\n[ 0.000000] EFI: mem255: type=3, attr=0xf, range=[0x00000000c9c80000-0x00000000c9c82000) (0MB)\n[ 0.000000] EFI: mem256: type=4, attr=0xf, range=[0x00000000c9c82000-0x00000000c9c89000) (0MB)\n[ 0.000000] EFI: mem257: type=6, attr=0x800000000000000f, range=[0x00000000c9c89000-0x00000000c9ff5000) (3MB)\n[ 0.000000] EFI: mem258: type=4, attr=0xf, range=[0x00000000c9ff5000-0x00000000ca000000) (0MB)\n[ 0.000000] EFI: mem259: type=7, attr=0xf, range=[0x0000000100000000-0x000000042fe00000) (13054MB)\n[ 0.000000] EFI: mem260: type=0, attr=0x8000000000000000, range=[0x00000000cb000000-0x00000000cf200000) (66MB)\n[ 0.000000] EFI: mem261: type=11, attr=0x8000000000000001, range=[0x00000000f8000000-0x00000000fc000000) (64MB)\n[ 0.000000] EFI: mem262: type=11, attr=0x8000000000000001, range=[0x00000000fec00000-0x00000000fec01000) (0MB)\n[ 0.000000] EFI: mem263: type=11, attr=0x8000000000000001, range=[0x00000000fed00000-0x00000000fed04000) (0MB)\n[ 0.000000] EFI: mem264: type=11, attr=0x8000000000000001, range=[0x00000000fed1c000-0x00000000fed20000) (0MB)\n[ 0.000000] EFI: mem265: type=11, attr=0x8000000000000001, range=[0x00000000fee00000-0x00000000fee01000) (0MB)\n[ 0.000000] EFI: mem266: type=11, attr=0x8000000000000001, range=[0x00000000ff000000-0x0000000100000000) (16MB)\n[ 4.414152] fb0: EFI VGA frame buffer device\n[ 4.860429] EFI Variables Facility v0.08 2004-May-17\n[ 7.499759] fb: conflicting fb hw usage inteldrmfb vs EFI VGA - removing generic driver\n\nEn résumé avec le cd francophone je n'ai pas de choix. Avec le cd original je peux soit booter en UEFI soit non. Par contre je ne sais pas pourquoi.\nDernière modification par azdep (Le 20/06/2012, à 18:28)\nHors ligne\nmalbo\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nJ'ai fait l'essai avec VirtualBox avec l'option EFI activée (case cochée \"Activer EFI (os spéciaux seulement)\" dans les options avancées).\n1) démarrage sur liveCD virtuel de la version officielle \"ubuntu-12.04-desktop-amd64.iso\"\nRésultat : le démarrage se fait automatiquement sur le liveCD virtuel avec apparition de l'écran caractéristique du démarrage en EFI (menu en noir et blanc avec le titre GNU GRUB...) : http://www.hostingpics.net/viewer.php?i … 132006.png\n2) démarrage sur le liveCD virtuel de la version francophone \"ubuntu-12.04-desktop-amd64-fr.iso\"\nRésultat : le liveCD n'est tout simplement pas reconnu, c'est à dire que la machine virtuelle démarre sur le disque dur (virtuel) alors qu'elle devrait démarrer sur le liveCD virtuel s'il était fonctionnel.\nC'est donc un résultat conforme à ce qui a été décrit par azdep dans le post #4, c'est à dire que le liveCD francophone n'est pas vu comme UEFI.\nDernière modification par malbo (Le 25/06/2012, à 11:35)\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nTsintao\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nCher Monsieur Malbo, pour faire suite à votre requête du lundi 25 juin à 13h17… ;-)\nJe confirme que la version française du CD d'installation de Ubuntu 12.04 ne permet pas de démarrage en UEFI. Et c'est bien naturel puisqu'il ne contient pas\n|…|-- efi| `-- boot| `-- bootx64.efi|…\n… contrairement à l'installeur «officiel».\nJ'ignore si c'est la seule condition pour que l'installeur puisse démarrer en UEFI, mais je suppose que la présence de cette arborescence, avec un *.efi au bout, est une condition sine qua non pour être détecté (et lancé) par le bootmanager UEFI (que ce soit celui du firmware ou pas).\n(mais je rapelle, au passage, qu'il n'est pas indispensable de démarrer le CD d'installation en UEFI pour pouvoir installer Ubuntu 12.04 sur un système UEFI [ni même pour en préparer un, d'ailleurs]. Cela requiert, toutefois, une bonne compréhension de l'EFI et quelques précautions pour éviter des pertes de données et de temps. Il n'est simplement pas possible de s'en remettre entièrement à l'installeur de Ubuntu 12.04 pour réaliser toutes les phases de l'installation automatiquement)\nDernière modification par Tsintao (Le 25/06/2012, à 17:29)\nHors ligne\nmalbo\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nMerci pour cette confirmation Tsintao.\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nTsintao\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nDe rien et merci à toi pour la série de fils consacrée au sujet (que j'avais loupée).\nHors ligne\nazdep\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonjour,\nmerci à Tsintao,\n(mais je rapelle, au passage, qu'il n'est pas indispensable de démarrer le CD d'installation en UEFI pour pouvoir installer Ubuntu 12.04 sur un système UEFI [ni même pour en préparer un, d'ailleurs]. Cela requiert, toutefois, une bonne compréhension de l'EFI et quelques précautions pour éviter des pertes de données et de temps. Il n'est simplement pas possible de s'en remettre entièrement à l'installeur de Ubuntu 12.04 pour réaliser toutes les phases de l'installation automatiquement)\nCe serait bien de décrire la procédure d'installation EFI sans démarrer le cd en UEFI, car j'ai essayé pas mal de manip pour faire un dual boot avec windows7 sur 2 disques durs, Ubuntu démarre presque dans tout les cas, mais souvent Windows ne repart pas, il suffit dans ce cas d'enlever le second disque sur lequel Ubuntu est installé.\nJe comprend bien qu'on ne peut pas s'en remettre qu'à l'installeur, mais c'est qu'en même dommage d'avoir un cd francophone moins disant que l'original. Il faut aussi penser que dans les utilisateurs d'Ubuntu il n'y a pas que des ingénieurs informaticiens.\nHors ligne\nTsintao\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nCe serait bien de décrire la procédure d'installation EFI sans démarrer le cd en UEFI\nSalut Azdep,\nLe fil de récapitulation de mon installation, avec rEFInd en tant que bootmanager et ELILO en tant que bootloader Linux, constitue, en lui même, un petit \"guide\" pour une installation de Ubuntu (ou autre distribution GNU/Linux) sur un système EFI avec Windows7 pré-installé. Et il est tout à fait possible de l'implémenter sans démarrer le CD d'installation en mode UEFI.\nJe rechigne à en faire un guide plus générique, parce que\nC'est une manière de faire, il y en a d'autres ;\nJe n'ai aucune certitude que cela fonctionnerait sur tous les firmware EFI ;\nIl faudrait que je donne tellement d'informations « génériques » que cela découragerait les utilisateurs visés (plutôt novices et/ou ne disposant pas d'assez de temps pour lire et intégrer le nécessaire vital).\nCela prend beaucoup de temps et cela m'engagerait vis-à-vis des utilisateurs qui me feraient confiance. Or, si j'oublie un détail par mégarde ou par ignorance, cela peut conduire à des pertes de données.\nPlusieurs fils, dont ceux de Malbo, traitent du sujet sur ce forum. C'est loin d'être idéal, les informations étant disséminées… mais tant que les distributions ne seront pas disponibles avec un installeur qui automatise tout le processus sur des bases saines, il n'y a pas de miracle : les gens devront procéder eux même à quelques phases de l'installation et, préalablement, lire un peu sur le sujet pour comprendre ce qu'ils font.\nMaintenant, si la demande est forte pour écrire une procédure limitée à rEFInd+ELILO mieux adaptée à un novice, j'envisagerai la possibilité ;-)\nDernière modification par Tsintao (Le 26/06/2012, à 11:31)\nHors ligne\nazdep\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBien sur Tsintao je comprend très bien ta réponse, et je sais le travail que demande ce genre de guide, c'est pour ca que la proposition de YannUbuntu de rajouter l'EFI dans le cd d'install. est surement plus simple. Ca en vaut d'autant plus le coup que la 12.04 est une LTS. Pendant mes essais et avant d'essayer le cd original, j'ai essayer le livecd Fedora et lui a fonctionner. Par acquis de conscience j'ai essayé le cd original qui heureusement à fonctionné, sinon j'aurai été un peu frustré\nDernière modification par azdep (Le 27/06/2012, à 08:17)\nHors ligne\nmalbo\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nc'est pour ça que la proposition de malbo de rajouter l'EFI dans le cd d'install. est surement plus simple.\nEn fait, c'est YannUbuntu qui a exprimé cela : http://forum.ubuntu-fr.org/viewtopic.ph … 1#p9746621\nCela dit je suis bien d'accord : ce serait inadmissible que le liveCD Francophone ne soit pas fonctionnel pour installer en EFI.\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nazdep\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nOups, j'ai corrigé la source !\nHors ligne\nkao_chen\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonjour, j'ai fait le souhait d'acheter une carte mère équipé en EFI sur ce post :\nhttp://forum.ubuntu-fr.org/viewtopic.ph … 1#p9842021\net on m'a conseillé de passer vous voir par ici.\nPour résumé, j'ai repéré une carte mère (GA-Z77X-D3H) qui m’intéresse mais j'ai vu qu'elle était équipé d'un EFI seulement, je voulais savoir si pour installer Ubuntu, uniquement (pas de dual boot Windows) je rencontrerai pas d'incompatibilité. D'après ce que j'ai lu ci dessus, ça devrait passer, notamment avec la version officielle. Si vous me le déconseillez vraiment, je trouverai une autre carte, sinon je tenterai ma chance.\nMerci d'avance,\nKao\nHors ligne\nmalbo\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nkao_chen,\nJe n'ai lu nulle part que des cartes mères UEFI soient incompatibles avec Ubuntu. Tu peux acheter n'importe quelle carte-mère soit UEFI/BIOS soit UEFI seulement.\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nkao_chen\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nOk cool merci,\nJ'avais lu qu'il pouvait y avoir des problèmes de compatibilité avec Grub2 mais il semble que cela ne concerne que l'activation de l'option secure boot\nhttp://www.clubic.com/linux-os/debian/u … rub-2.html\nHors ligne\nmalbo\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nDans ce post : http://forum.ubuntu-fr.org/viewtopic.ph … 1#p9478871\ntshirtman (qui semble très bien informé sur le sujet) répond \"non\" à la question \"est ce que dans quelques années tout les PC en vente auront des carte mere avec UEFI empêchant l'installation d'autre chose que windows ? Y compris les carte meres vendues séparément ?\"\nTu peux poster dans cette discussion pour te faire confirmer la chose dans ton cas particulier mais à mon avis, il n'y a pas de danger pour toi.\nDernière modification par malbo (Le 30/06/2012, à 09:07)\nMedionPC MT5 MED MT 162 / pentium IV / RAM 1Go / Radeon HD 3450 AGP / XP, HandyLinux et Xubuntu 14.04 32 bits\nAcer Aspire M5100-5F7N / Phenom Quad Core 9500 / ATI HD 2600 pro / RAM 4 Go / Win8, XP et Ubuntu 14.04\nHors ligne\nTsintao\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nLa réponse est effectivement \"non\". Par contre, les PC's pré-installés avec Win8 pourraient très prochainement commencer à poser de petits problèmes à ceux qui auraient l'audace de vouloir faire ce qu'ils veulent de leur ordinateur : Linux Torvalds on Windows 8, UEFI and Fedora.\n... Mais ça ne s'applique pas au cas de Kao_chen, grand bien lui fasse ^^\nHors ligne\npolyp\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonsoir,\navec Asus UX31A, le BIOS est..un BIOS, Cas 1 :\ndmesg | grep EFI\n[ 1.241248] EFI Variables Facility v0.08 2004-May-17\nMais, une fois l'installation (12.04 de ubuntu.com) faite (chargeur de démarrage sur /dev/sda, classique quoi!), la machine\nne redémarre plus.\n- Précision 1 : Après plusieurs essais infructueux (Debian Wheezy puis Ubuntu 12.04) j'ai fait un ménage un peu violent...et viré toutes les partitions Fat32 de quelques Mo à 300 Mo au début du disque.. (Oui, des fois on fait des choses idiotes..)\n- Précision 2: Ultrabook=SSD non extractible=Impossible de faire l'install depuis une autre machine.\nJe n'ai aucune envie de garder Windows, et peut donc me passer de tout mécanisme de compatibilité concernant le chargeur de démarrage.\nBref, j'ai l'impression d'être revenu en mode débutant...\nUne idée ?\nMerci d'avance.\nCdlt.\nHors ligne\nYannUbuntu\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nSi vous aviez Windows en EFI, il va probablement vous falloir recréer la partition EFI puis réinstaller grub-efi. Voir ce tuto de Malbo: http://forum.ubuntu-fr.org/viewtopic.ph … 1#p9866321\nHors ligne\npolyp\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nBonsoir,\nsauf que la re-création de la partition Windows/EFI (pas Windows lui-même) nécessite un retour atelier..\nJe vais voir ce que donne la suppression de la partition GPT et son remplacement par une partition MBR classique; c'est ma dernière cartouche.. ;-(\nMerci.\nHors ligne\nYannUbuntu\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nsauf que la re-création de la partition Windows/EFI (pas Windows lui-même) nécessite un retour atelier...\n- La partition EFI : non, vous pouvez créer une partition EFI avec gParted. (FAT32, >200Mo, début du disque, drapeau boot)\n- le fichier WIndows EFI: ça doit pouvoir se faire via le DVD Windows je pense, mais comme vous n'avez pas besoin de WIndows, ce n'est pas le problème.\nDernière modification par YannUbuntu (Le 05/07/2012, à 00:16)\nHors ligne\npolyp\nRe : [Tuto] identifier si on est dans un système UEFI ou Bios\nMerci pour toutes vos infos .\nJe suis en train de refaire la partition à la main en suivant http://forum.ubuntu-fr.org/viewtopic.ph … 1#p7281381\nEt....Ca marche !\nQuelques modifs :\n- il manque un mkdir /boot/efi\n- Lors de l'install le nom de l'hote change de ubuntu à xxxxx\necho \"127.0.0.1 xxxxx\" >> /etc/hosts\n- Par sécurité : cp -r /boot/efi/EFI/ubuntu /boot/efi/EFI/xxxxx\nMERCI. !!\nHors ligne"}}},{"rowIdx":252,"cells":{"text":{"kind":"string","value":"Getting Started with WSGI\nby Jason R. Briggs\n11/09/2006\nWhat is WSGI, and why should you care? WSGI, or the Web Server Gateway Interface, is a Python Enhancement Proposal (#333) authored by Philip Eby in an attempt to address the lack of standardization among Python web frameworks. Think of it as the servlet spec for the Python world, only simpler. Although the WSGI specification is primarily aimed at framework developers, you can also develop application components to it. One of the aims of PEP 333 is ease of implementation, which consequently carries through to the development of those components. For example, the \"Hello world\" example given in the WSGI specification could hardly be any simpler to implement:\ndef simple_app(environ, start_response):\n status = '200 OK'\n response_headers = [('Content-type','text/plain')]\n start_response(status, response_headers)\n return ['Hello world!\\n']\n\nWith the recent release of Python 2.5, the reference implementation of WSGI is available as a standard module (wsgiref), meaning that there is a direct path from developing application components to test and production environments. It's easy to imagine rapid development of components using wsgiref, then using something more scalable for testing and production. That said, WSGI doesn't provide many features you might expect or want for webapp development; for sessions, cookies, and the like, you'd also need a suitable web framework (of which there are many), or perhaps middleware or utilities to provide those services.\nAs to why you should care: if you're a low-level person who prefers to bolt on utilities and modules to keep your development effort as free of constraint as possible, WSGI will hold considerable attraction. Even if you prefer the benefits offered by higher-level frameworks, chances are they'll be built on top of WSGI, and it's always useful to know what happens behind the scenes.\nInstalling wsgiref\nFor those (like myself) running Python 2.4.x, the good news is that the wsgiref module will still function. wsgiref is available from the Python Subversion repository, or you can download it from the command line via:\nsvn co http://svn.python.org/projects/python/trunk/Lib/wsgiref\n\nCopy the wsgiref directory into the site-packages directory of your Python distribution (in my case, /usr/lib/python2.4/site-packages/) and check whether you can import the module. If so, you should be able to type import wsgiref in the Python console with no errors reported.\nTesting the \"Hello world\" application shown earlier requires a few extra lines of code (see test1.py):\nif __name__ == '__main__':\n from wsgiref import simple_server\n httpd = simple_server.make_server('', 8080, simple_app)\n try:\n httpd.serve_forever()\n except KeyboardInterrupt:\n pass\n\nThis uses simple_server (an implementation of the BaseHttpServer module) to provide basic web server facilities, and passes the name of the simple_app function as an argument to the make_server function. Run this program (python test1.py) and direct your browser to http://localhost:8080 to see it in action.\nAnd Using an Object...\nYou don't have to stick to simple functions for your applications--WSGI supports object instantiation for handling requests. To do so, create a class that implements the __init__ and __iter__ methods. For example, I've abstracted out some basic utilities in the following class. The __iter__ method checks for a do_ method matching the type of HTTP request (GET, PUT, etc.) and either calls that method to process, or sends an HTTP 405 in response. In addition, I've added a parse_fields method to parse the x-url-form-encoded parameters in the body of a request using the standard cgi module. Note that, for both object instantiation and simple method calls, the arguments (environ and start_response) are positional--the order is important, not the name.\nimport cgi\nclass BaseWSGI:\n def __init__(self, environ, start_response):\n self.environ = environ\n self.start = start_response\n def __iter__(self):\n method = 'do_%s' % self.environ['REQUEST_METHOD']\n if not hasattr(self, method):\n status = '405 Method Not Allowed'\n response_headers = [('Content-type','text/plain')]\n self.start(status, response_headers)\n yield 'Method Not Allowed'\n else:\n m = getattr(self, method)\n yield m()\n def parse_fields(self):\n s = self.environ['wsgi.input'].read(int(self.environ['CONTENT_LENGTH']))\n return cgi.parse_qs(s)\n\nI can then subclass BaseWSGI to create a simple number-guessing application (test2.py):\nimport random\nnumber = random.randint(1,100)\nclass Test(BaseWSGI):\n def __init__(self, environ, start_response):\n BaseWSGI.__init__(self, environ, start_response)\n self.message = ''\n def do_GET(self):\n status = '200 OK'\n response_headers = [('Content-type','text/html')]\n self.start(status, response_headers)\n return '''\n\n \n
\n

%s

\n

\n

\n
\n \n\n''' % self.message\n def do_POST(self):\n global number\n fields = self.parse_fields()\n if not fields.has_key('myparam'):\n self.message = 'You didn't guess'\n return self.do_GET()\n guess = int(fields['myparam'][0])\n if guess == number:\n self.message = 'You guessed correctly'\n number = random.randint(1,100)\n elif guess < number:\n self.message = 'Try again, the number is higher than your guess'\n else:\n self.message = 'Try again, the number is lower than your guess'\n return self.do_GET()\n\nYou may be thinking that all of this is somewhat like reinventing the wheel--which is true, to a point. However, the low-level nature of WSGI is designed to make implementing frameworks a straightforward process--and more standardized. If you don't want to reinvent the wheel from an application perspective, look to a higher-level web framework, but do read on for some alternatives."}}},{"rowIdx":253,"cells":{"text":{"kind":"string","value":"xbindkeys..\nsudo apt-get install xbindkeys\n\nXbindkeys is a very versatile program that lets you remap keys very easily. It uses a config file, my default located in your home directory, to change key bindings into certain commands.\nTo create a default config file you use the command:\nxbindkeys --defaults\nWhich prints the default config file. So if you want to create the file containing the default values you would use:\nxbindkeys --defaults > $HOME/.xbindkeysrc\nWhich prints the default values into a hidden file named .xbindkeysrc located in home (~).\nNow to actually change the bindings of keys we first need to know what the name or keysym of those keys is. xbindkeys allows us to use the -k handle to find the name of a key or key combination. Run:\nxbindkeys -k\nAnd press a key or key combination. Your output will look something similar to this (when pressing space):\n\"NoCommand\"\nm:0x10 + c:65\nMod2 + space\n\"No Command\" tells us that currently no command is associated with the Space key.\nm:0x10 + c:65\nMod2 + space \nIs the name of the key/key combination.\nthe config file..\nLets open up the config file you made earlier:\ngedit .xbindkeysrc \nHere is an excerpt from the default config file:\n#\n# A list of keys is in /usr/include/X11/keysym.h and in\n# /usr/include/X11/keysymdef.h\n# The XK_ is not needed.\n#\n# List of modifier:\n# Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),\n# Mod3 (CapsLock), Mod4, Mod5 (Scroll). \n#\n# The release modifier is not a standard X modifier, but you can \n# use it if you want to catch release events instead of press events\n# By defaults, xbindkeys does not pay attention with the modifiers\n# NumLock, CapsLock and ScrollLock.\n# Uncomment the lines above if you want to pay attention to them.\n#keystate_numlock = enable\n#keystate_capslock = enable\n#keystate_scrolllock= enable\n# Examples of commands:\n\"xbindkeys_show\" \n control+shift + q\n\nEvery line beginning with # is a comment and won't be read or run by xbindkeys.\nSo far the only line that isn't commented out is:\n\"xbindkeys_show\" \n control+shift + q\n\nThis excerpt shows the basic syntax of xbindkeys commands:\n\"Command to run (in quotes)\"\nkey to associate with command (no quotes)\n\nSo as you can see:\n\"xbindkeys_show\" \n control+shift + q\n\nRuns the command xbindkeys_show when you press Ctrl+Shift+q.\nbind keys to commands..\nNow lets try binding a few keys. I recommend clearing the entire default file so that it's blank. It contains preset key bindings you probably don't want.\nNow lets say you want to use Ctrl+b to open your browser. First you need to know what the name or keysym of Ctrl+b is. As mentioned earlier you can use xbindkeys -k to find the name of a key or keys, but there is an easier way. For simple combinations like Ctrl+b you can just use:\nControl+b\n\nA lot easier isn't it!\nNow find the command for your favorite browser:\nRemember the syntax from earlier? The xbindkeys command to launch Firefox (or your other favorite browser) when you press Ctrl+b is:\n\"firefox\"\nControl+b\n\nNow put that in your config file and save it. Now you might notice your command doesn't work yet, that's because xbindkeys isn't running. To start it just run xbindkeys from a terminal. Your Ctrl+b should now start your browser!\nbind keys to other keys..\nIf you want a key on your keyboard to call a different key on your keyboard, you will need an extra piece of software as xbindkeys does not support this on it's own. I know of two programs which we can use, xdotool and xte. I prefer xte so I'm going to use that.\nInstall it:\nsudo apt-get install xautomation\n\nThe syntax for xte is like this:\nxte 'command key/mousebutton/xyCoordinates'\n\nExamples:\nTo call a single key press: xte 'key keyName'\nTo call a key combination: xte 'keydown keyName' 'keydown secondKeyName' 'keyup keyName' 'keyup secondKeyName\nTo call a mouse button: xte 'mouseclick buttonNumber' (We'll discuss finding button numbers a little latter)\nTo move the mouse: xte 'mousemove xCoordinate yCoordinate'\nAnd more! Read man xte\nNow that you know the command for simulating key presses you can call it from your xbindkeys script, like this:\n\"xte 'key b'\"\nControl+b\n\nAs you might guess, this calls xte 'key b' when we press Ctrl+b, which would enter a b into any document you might be currently working on.\nI thing to note however is that xbindkeys and xte don't always work very well together. Sometimes you have to press the keys exactly at the same time to get output, other times it works just fine. This may or may not have to do with system configuration and/or hardware.. I'm not sure. See maggotbrain's answer for a more reliable way of binding keys to other keys.\nbind mouse buttons to commands..\nYou can also use xbindkeys to bind mouse buttons to commands (and thence keyboard shortcuts, see above). The basic format for mouse buttons should be familiar to you now:\n\" [command to run] \"\nb:n\nWhere [command to run] is the command you want to run and n the number of the mouse button you want to use for that command.\nIf you don't know the number of your mouse button you can use xev to find out what it is:\nxev | grep button\nThe output will be something like this:\nuser@host:~$ xev | grep button\n state 0x10, button 1, same_screen YES\n state 0x110, button 1, same_screen YES\n state 0x10, button 2, same_screen YES\n state 0x210, button 2, same_screen YES\n state 0x10, button 3, same_screen YES\n state 0x410, button 3, same_screen YES\nWhen I press each of my mouse buttons.\nFor example:\n\" firefox \"\nb:2\nLaunches firefox when I press my middle mouse button."}}},{"rowIdx":254,"cells":{"text":{"kind":"string","value":"FelixP\n[Résolu] Sources de Logiciels ne veut plus démarrer…\nSalut ! Je reposte mon problème car il semblerait que mon ancien post soit tombé dans les abîsses…\nLorsque je veux ouvrir la liste des sources de logiciels, j'obtiens une erreur…\nCe problème est apparu, je crois, après ajout du dépot permettant d'installer camllight, et d'autres personnes ont déjà eu le même problème, mais je n'ai pas compris comment le résoudre…\nSources de logiciels ne démarre pas dans Quantal [Résolu]\nVoici ce que j'ai en console :\nfelix@astrotux:~$ software-properties-gtk \ngpg: /tmp/tmp4xm_2e/trustdb.gpg: base de confiance créée\nTraceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py\", line 162, in packages_for_modalias\n cache_map = packages_for_modalias.cache_maps[apt_cache_hash]\nKeyError: 5193189\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/usr/bin/software-properties-gtk\", line 103, in \n app = SoftwarePropertiesGtk(datadir=options.data_dir, options=options, file=file)\n File \"/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py\", line 178, in __init__\n self.init_drivers()\n File \"/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py\", line 1097, in init_drivers\n self.devices = detect.system_device_drivers()\n File \"/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py\", line 415, in system_device_drivers\n for pkg, pkginfo in system_driver_packages(apt_cache).items():\n File \"/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py\", line 319, in system_driver_packages\n for p in packages_for_modalias(apt_cache, alias):\n File \"/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py\", line 164, in packages_for_modalias\n cache_map = _apt_cache_modalias_map(apt_cache)\n File \"/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py\", line 129, in _apt_cache_modalias_map\n m = package.candidate.record['Modaliases']\n File \"/usr/lib/python3/dist-packages/apt/package.py\", line 429, in record\n return Record(self._records.record)\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 491: invalid continuation byte\n\nPouvez-vous m'aider à résoudre ce problème ? Je vous en remercie d'avance !\nFélix\nDernière modification par FelixP (Le 02/12/2012, à 23:18)\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nVoilà le contenu de mon fichier !\n# deb cdrom:[Ubuntu 12.10 _Quantal Quetzal_ - Release amd64 (20121017.5)]/ quantal main restricted\n# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to\n# newer versions of the distribution.\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal main restricted\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates main restricted\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates main restricted\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team. Also, please note that software in universe WILL NOT receive any\n## review or updates from the Ubuntu security team.\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal universe\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal universe\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates universe\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates universe\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu \n## team, and may not be under a free licence. Please satisfy yourself as to \n## your rights to use the software. Also, please note that software in \n## multiverse WILL NOT receive any review or updates from the Ubuntu\n## security team.\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal multiverse\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal multiverse\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates multiverse\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-updates multiverse\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security main restricted\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security main restricted\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security universe\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security universe\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security multiverse\ndeb-src http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-security multiverse\n## Uncomment the following two lines to add software from Canonical's\n## 'partner' repository.\n## This software is not part of Ubuntu, but is offered by Canonical and the\n## respective vendors as a service to Ubuntu users.\ndeb http://archive.canonical.com/ubuntu quantal partner\ndeb-src http://archive.canonical.com/ubuntu quantal partner\n## This software is not part of Ubuntu, but is offered by third-party\n## developers who want to ship their latest software.\ndeb http://extras.ubuntu.com/ubuntu quantal main\ndeb-src http://extras.ubuntu.com/ubuntu quantal main\ndeb http://boisson.homeip.net/depot quantal divers\ndeb-src http://boisson.homeip.net/depot quantal divers\ndeb http://ftp.free.org/mirrors/archive.ubuntu.com/ubuntu/ quantal-proposed restricted main multiverse universe\n\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nD'accord, merci déjà ! Sinon, j'avais changé les sources pour mettre \"les plus rapides\" mais ce n'est hélas absolument pas le cas…\nComment puis-je rétablir les sources par défaut ?\nHors ligne\namj\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nAh c'est bon j'ai trouvé un générateur en ligne, il m'a fourni ceci :\n#############################################################\n################### OFFICIAL UBUNTU REPOS ###################\n#############################################################\n###### Ubuntu Main Repos\ndeb http://fr.archive.ubuntu.com/ubuntu/ quantal main restricted universe multiverse \ndeb-src http://fr.archive.ubuntu.com/ubuntu/ quantal main restricted universe multiverse \n###### Ubuntu Update Repos\ndeb http://fr.archive.ubuntu.com/ubuntu/ quantal-security main restricted universe multiverse \ndeb http://fr.archive.ubuntu.com/ubuntu/ quantal-updates main restricted universe multiverse \ndeb http://fr.archive.ubuntu.com/ubuntu/ quantal-proposed main restricted universe multiverse \ndeb http://fr.archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse \ndeb-src http://fr.archive.ubuntu.com/ubuntu/ quantal-security main restricted universe multiverse \ndeb-src http://fr.archive.ubuntu.com/ubuntu/ quantal-updates main restricted universe multiverse \ndeb-src http://fr.archive.ubuntu.com/ubuntu/ quantal-proposed main restricted universe multiverse \ndeb-src http://fr.archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse \n###### Ubuntu Partner Repo\ndeb http://archive.canonical.com/ubuntu quantal partner\n###### Ubuntu Extras Repo\ndeb http://extras.ubuntu.com/ubuntu quantal main\n##############################################################\n##################### UNOFFICIAL REPOS ######################\n##############################################################\n###### 3rd Party Binary Repos\n## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1378B444\ndeb http://ppa.launchpad.net/libreoffice/ppa/ubuntu quantal main # LibreOffice - http://www.documentfoundation.org/download/\n## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE\ndeb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu quantal main # Mozilla Daily Build Team - http://edge.launchpad.net/~ubuntu-mozilla-daily/+archive/ppa\n\net\nsudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1378B444\nsudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE\n\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nAh je n'avais pas vu votre réponse ! C'est parfait, merci beaucoup !\nHors ligne\namj\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\npeut-être aussi\nqui étais déjà dans vos sources\nDernière modification par amj (Le 12/11/2012, à 21:52)\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nCelle-là je n'en ai plus besoin… C'était pour camllight, un langage affreux qu'on nous oblige à utiliser en prépa…\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nBon, ça résoud pas mon problème initial mais c'est une bonne alternative ! Merci !\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nMerci ! Bonne soirée à vous !\nHors ligne\ntutoux\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nBonjour,\nça ressemble à ce que j'ai raconté ici :\nhttp://forum.ubuntu-fr.org/viewtopic.ph … #p11498311\npeut-être que la démarche indiquée marchera dans ton cas :\nhttp://ubuntuforums.org/archive/index.p … 02417.html\non y croit... :-)\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nEn fait j'ai constaté que si je n'ajoute pas le dépot\ndeb http://boisson.homeip.net/depot quantal divers\nje n'ai pas le problème et il apparait PENDANT l'install (hors dépot) du paquet camllight et disparait à la désinstall.\nJe vais demander au créateur du paquet demain car je le connais, de voir quel serait le problème.\nHors ligne\nfran.b\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nJ'ai supprimé tous les accents pour les paquets quantal. Mais c'est étonnant, c'est spécifique à quantal ce problème semble-t-il....Est ce que désormais le problème est résolu?\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nje testerai ce soir et vous dirai !\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nGénial ! L'installation hors dépot fonctionne à merveille ! Par contre l'ajout du dépôt provoque toujours le bug…\nHors ligne\nfran.b\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nBon, il faut comprendre.\nLe problème est dans le fichier /var/lib/apt/lists/boisson.homeip.net_ubuntu_dists_quantal_divers_binary-i386_Packages.\nQue contient-il?\nEst ce que le problème a lieu lors de\n# apt-get install camllight\nou bien à l'utilisation d'un synaptic quelconque (je pense à une erreur de software-properties-gtk)\nJe pense au bug https://bugs.launchpad.net/ubuntu/+sour … ug/1026066\nDernière modification par fran.b (Le 14/11/2012, à 23:13)\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nNon, c'est avant même update que le bug arrive, donc avant la création de /var/lib/apt/lists/boisson*\nEt il n'y a effectivement que software-properties-gtk qui bugue. Cette fenêtre :\nJe peux installer des logiciels sans problème.\nComme je disais il suffit que l'install arrive au choix \"nettoyer sites.el ?\", et je peux constater déjà l'apparition du bug.\nHors ligne\nfran.b\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nBon, c'est un problème spécifique à software-properties-gtk qui existait à l'époque de natty et qui semble resurgir. Peut être qu'en installant la version de precise?? Eventuellement ne édition à la main du fichier /var/lib/apt/lists/boisson.homeip.net_ubuntu_dists_quantal_divers_binary-i386_Packages en virant les accents devrait arranger les choses.\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nNon, ça ne fait rien… La seule façon de réparer le bug une fois la source ajoutée et update fait, est de supprimer le dépôt de la liste… J'ai fait une vidéo de capture d'écran, je vais essayer de l'uploader !\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nDésolé, je pense que c'est en flash… Mais je ne sais pas comment faire autrement !\nhttp://www.youtube.com/watch?v=gK6lq5Zu … e=youtu.be\nHors ligne\namj\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nDésolé, je pense que c'est en flash… Mais je ne sais pas comment faire autrement !\nhttp://www.youtube.com/watch?v=gK6lq5Zu … e=youtu.be\nnon je pense que youtube est en html5\nHors ligne\nFelixP\nRe : [Résolu] Sources de Logiciels ne veut plus démarrer…\nIl y a des vidéos dans les 2 formats… Ils sont en train «d'opérer le changement» ^^\nHors ligne"}}},{"rowIdx":255,"cells":{"text":{"kind":"string","value":"I'm trying to make a program in python which creates a fullscreen window and includes an image, but I don't really know how to do that. I've tried to read documentations on pygtk and I've searched in both goodle and stackoverflow, without any success. Here's my current code.\ndef __init__(self):\n pixbuf = gtk.gdk.pixbuf_new_from_file(\"test.png\")\n image = gtk.Image()\n self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)\n self.window.fullscreen()\n self.window.show()\n image.set_from_pixbuf(pixbuf)\n image.show()\n\nQuestion: how do I include an image in a window?"}}},{"rowIdx":256,"cells":{"text":{"kind":"string","value":"Let's say you have a static page called hello.html and you wish to turn it into a Blog. Here is one way to do it.\nFor the sake of the argument we will assume that the hello.html contains\nHello World Please say something here! \nHere is what you do:\n2) Choose an admin password and click on [start server]\n3) When the browser pops up (automatically) click on [administrative interface]\n4) Login with the password you have chosen before.\n5) At the bottom fill the form to create a new app, let's call it \"MyBlog\", and press [submit]\n6) Click on MyBlog [design]\n7) edit the controller default.py, delete everything in there are add,\ndef hello(): return dict()\n\n8) go back to [design] and create a view default/hello.html, paste your hello.html code in there.\n9) if your page contains links to static files, for example\n\nupload the files under \"static files\" and edit the hello.html so that links look like this\n\n\nAt this point you should be able to view the page by visiting clicking on hello under Controllers or visit\nhttp://127.0.0.1:8000/MyBlog/default/hello\n\nYou are already using web2py server and your page is no longer static.\n10) Go back to http://127.0.0.1:8000/admin/default/design/MyBlog\n11) Under [Models] create a new model called db and edit the newly created file db.py\ndb=SQLDB('sqlite://db.db')\n db.define_table('message',\n SQLField('title',requires=IS_NOT_EMPTY()),\n SQLField('author',requires=IS_NOT_EMPTY()),\n SQLField('email',requires=IS_EMAIL()),\n SQLField('body','text',requires=IS_NOT_EMPTY()))\n\n12) Go back to [design] and edit controller default.py\ndef hello():\n form=SQLFORM(db.message)\n if form.accepts(request.vars): response.flash='message posted'\n messages=db().select(db.message.ALL)\n return dict(form=form,messages=messages)\n\n13) Go back to [design] and edit the view hello.html and add the lines starting with {{\nHello World\n \n \n {{if response.flash:}}
{{=response.flash}}
{{pass}}\n {{='hello user '+request.env.remote_addr}}\n Please say something here!\n {{=form}}\n {{for message in messages:}}\n

{{=message.author}} says \"{{=message.body}}\"

\n {{pass}}\n \n \n\nDone! Your page turned into a blog that supports validation of input and prevents injection vulnerabilities by escaping all output. The blog entries are stored in the sqlite database (comes with web2py) but can use MySQL, Postgresql, or Oracle without changing the code.\nWhere is the SQL? web2py writes it for you. If you really want to see it, click on [sql.log] under [design]\nNow you can use the admin interface to manage the blog posts and pack this web2py app for deployment on any web2py installation, including on Google App Engine."}}},{"rowIdx":257,"cells":{"text":{"kind":"string","value":"Two of these statements run while the other fails with a syntax error. What am I doing wrong?\n>>> Timer('for i in xrange(10): oct(i)').repeat(3)\n[2.7091379165649414, 2.6934919357299805, 2.689150094985962]\n>>> Timer('n = [] ; n = [oct(i) for i in xrange(10)]').repeat(3)\n[4.0500171184539795, 3.6979520320892334, 3.701982021331787]\n>>> Timer('n = [] ; for i in xrange(10): n.append(oct(i))').repeat(3)\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/timeit.py\", line 136, in __init__\n code = compile(src, dummy_src_name, \"exec\")\n File \"\", line 6\n n = [] ; for i in xrange(10): n.append(oct(i))\n ^\nSyntaxError: invalid syntax\n"}}},{"rowIdx":258,"cells":{"text":{"kind":"string","value":"J.M.'s comment points you in the direction of why this doesn't work. Iterating $x^7$ 50 times (even if $k=0$) is $(x^7)^{50}$.\n(x^7^50)\n(* x^1798465042647412146620280340569649349251249 *)\nThat exceeds the maximum number representable in Mathematica:\nIn[1]:= $MaxNumber\nOut[1]= 5.297557459040040*10^323228467\n\nEven if we considered $x^2 + k$ instead of $x^7 + k$, it will still overflows.\nff[x0_, k_] := NestList[ #1^2 + k &, x0, 50]\nIn[10]:= ff[1., 0.1]\n During evaluation of In[10]:= General::ovfl: Overflow occurred in computation. >>\nOut[10]= {1., 1.1, 1.31, 1.8161, 3.39822, 11.6479, 135.773, 18434.5, \n 3.39832*10^8, 1.15486*10^17, 1.33369*10^34, 1.77873*10^68, \n 3.16389*10^136, 1.00102*10^273, 1.002046001003433*10^546, \n 1.004096188126972*10^1092, 1.008209155011116*10^2184, \n 1.016485700248229*10^4368, 1.033243178809133*10^8736, \n 1.067591466555603*10^17472, 1.139751539462343*10^34944, \n 1.299033571706781*10^69888, 1.687488220421276*10^139776, \n 2.847616494060564*10^279552, 8.108919697245777*10^559104, \n 6.575457865638055*10^1118209, 4.323664614278137*10^2236419, \n 1.869407569676091*10^4472839, 3.494684661562269*10^8945678, \n 1.221282088375859*10^17891357, 1.491529939387699*10^35782714, \n 2.224661560089872*10^71565428, 4.949119056941505*10^143130856, \n 2.449377943978157*10^286261713, Overflow[], Overflow[], Overflow[], \n Overflow[], Overflow[], Overflow[], Overflow[], Overflow[], \n Overflow[], Overflow[], Overflow[], Overflow[], Overflow[], \n Overflow[], Overflow[], Overflow[], Overflow[]}\n\nOf course, if you have a starting value $x0<1$, your original function is fine, and converges quickly.\nIn[12]:= ff7[x0_, k_] := NestList[ #1^7 + k &, x0, 50]\nIn[13]:= ff7[0.5, 0.1]\nOut[13]= {0.5, 0.107813, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, \\\n0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, \\\n0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, \\\n0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}\n\nPower values below 1 are also fine:\nIn[16]:= ff2[x0_, k_] := NestList[ #1^0.8 + k &, x0, 50]\nIn[17]:= ff2[1., 0.8]\nOut[17]= {1., 1.8, 2.40036, 2.81475, 3.08851, 3.2649, 3.37689, \\\n3.44736, 3.49147, 3.51898, 3.53611, 3.54676, 3.55338, 3.55748, \\\n3.56003, 3.56162, 3.5626, 3.56321, 3.56359, 3.56382, 3.56397, \\\n3.56406, 3.56411, 3.56415, 3.56417, 3.56418, 3.56419, 3.56419, \\\n3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, \\\n3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, \\\n3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642, 3.5642}\n\nBut in this case, I question why keeping the last ten iterations makes any sense. The function will have converged by then. It is behaviour of the first ten iterations that is more interesting."}}},{"rowIdx":259,"cells":{"text":{"kind":"string","value":"cocoubuntu\n[Resolu]duplicate sources.lits\nAprés un téléchargement de paquets , j'ai eu le message suivant : \" W : duplicate sources.list entry http://fr archive.ubuntu.com breezy/universe.Packages(/var/lib/apt/list/fr.archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages)\nJ'ai édité la sources.list ....synaptic n'avait plus les paquets ; j'ai enlevé ce que j'avais tapé\nJe viens d'aller avaec le nav de fichiers à /var/lib/apt/lists/ et j'ai eu ce qu'il fallait\nJ'ai selectionné ; j'ai fait copier ; je pensais pouvoir faire un coller : rien du tout\nIl ya une fonction dupliquer mais elle n'était pas accéssible ( en grisé )\nDonc je suis en panne pour dupliquer ?\nque faire ? merci\nDernière modification par cocoubuntu (Le 26/02/2006, à 21:40)\nHors ligne\ncocoubuntu\nRe : [Resolu]duplicate sources.lits\ndans le forum , j'ai trouvé des éléments sur cette question de \" duplicate \", ce serait une question de double adresse http:// Je suis uis allé dans le terminal pour éditer la sources.list ; mais il n'y a pas deux adresses identiques correspondants et concernant les Packages\nj'en suis donc au même point\nHors ligne\njanno59\nRe : [Resolu]duplicate sources.lits\nBonjour,\ncolle ton fichier ici .\njean\nHors ligne\nExpress\nRe : [Resolu]duplicate sources.lits\nPrends celui-là, il n'est pas exotic !!\n#deb cdrom:[Ubuntu 5.10 _Breezy Badger_ - Release i386 (20051012)]/ breezy main restricted\ndeb http://fr.archive.ubuntu.com/ubuntu breezy main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\n## Uncomment the following two lines to add software from the 'universe'\n## repository.\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team, and may not be under a free licence. Please satisfy yourself as to\n## your rights to use the software. Also, please note that software in\n## universe WILL NOT receive any review or updates from the Ubuntu security\n## team.\n deb http://fr.archive.ubuntu.com/ubuntu breezy universe\n deb-src http://fr.archive.ubuntu.com/ubuntu breezy universe\n deb http://fr.archive.ubuntu.com/ubuntu breezy multiverse\n deb-src http://fr.archive.ubuntu.com/ubuntu breezy multiverse\n## Uncomment the following two lines to add software from the 'backports'\n## repository.\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\n# deb http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\n# deb-src http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\ndeb http://security.ubuntu.com/ubuntu breezy-security main restricted\ndeb-src http://security.ubuntu.com/ubuntu breezy-security main restricted\n deb http://security.ubuntu.com/ubuntu breezy-security universe\n deb-src http://security.ubuntu.com/ubuntu breezy-security universe\n deb http://security.ubuntu.com/ubuntu breezy-security multiverse\n deb-src http://security.ubuntu.com/ubuntu breezy-security multiverse\n## PLF repositories, contains litigious packages, see http://wiki.ubuntu-fr.org/doc/plf\n#deb http://antesis.freecontrib.org/mirrors/ubuntu/plf/ breezy free non-free\n#deb-src http://antesis.freecontrib.org/mirrors/ubuntu/plf/ breezy free non-free\n## Freecontrib, funny packages by the Ubuntu PLF Team\ndeb http://antesis.freecontrib.org/mirrors/ubuntu/freecontrib/ breezy free non-free\ndeb-src http://antesis.freecontrib.org/mirrors/ubuntu/freecontrib/ breezy free non-free\n##PLF\ndeb http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\ndeb-src http://packages.freecontrib.org/ubuntu/plf/ breezy free non-free\n\nHors ligne\ncocoubuntu\nRe : [Resolu]duplicate sources.lits\nBonsoir ,\nvoilà ma sources.list\n#deb cdrom:[Ubuntu 5.10 _Breezy Badger_ - Release i386 (20051012)]/ breezy main restricted\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted universe multiverse\ndeb-src http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted\n## Uncomment the following two lines to add software from the 'universe'\n## repository.\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team, and may not be under a free licence. Please satisfy yourself as to\n## your rights to use the software. Also, please note that software in\n## universe WILL NOT receive any review or updates from the Ubuntu security\n## team.\ndeb http://fr.archive.ubuntu.com/ubuntu breezy universe main restricted multiverse\n deb-src http://fr.archive.ubuntu.com/ubuntu breezy universe\n## Uncomment the following two lines to add software from the 'backports'\n## repository.\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\n deb http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\n deb-src http://fr.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse\ndeb http://security.ubuntu.com/ubuntu breezy-security main restricted\ndeb-src http://security.ubuntu.com/ubuntu breezy-security main restricted\n deb http://security.ubuntu.com/ubuntu breezy-security universe\n deb-src http://security.ubuntu.com/ubuntu breezy-security universe\ndeb http://www.csd.uwo.ca/~mfgalizi/debian hoary unichrome\ndeb-src http://www.csd.uwo.ca/~mfgalizi/debian hoary unichrome\ndeb http://fr.archive.ubuntu.com/ubuntu/ breezy universe\n\nmerci pour l'aide\nHors ligne\njanno59\nRe : [Resolu]duplicate sources.lits\ncopie celui de Express , tout en sauvegardant le tien .\njean\nHors ligne\nAlexandreP\nRe : [Resolu]duplicate sources.lits\nL'erreur était ici:\ndeb\nhttp://fr.archive.ubuntu.com/ubuntu breezyuniversemain restricted multiverse\n[...]\ndeb\nhttp://fr.archive.ubuntu.com/ubuntu/ breezy universe\nAPT ne vérifie pas si deux lignes APT sont identiques, mais bien quels dépôts et branches sont à charger. Ici, la branche \"universe\" pour \"breezy\" sur le serveur \"http://fr.archive.ubuntu.com/ubuntu\" est demandé deux fois.\nDe toute façon, le message d'erreur retourné devrait lister quels dépôts sont listés en double, non?\n«La capacité d'apprendre est un don; La faculté d'apprendre est un talent; La volonté d'apprendre est un choix.» -Frank Herbert\n93,8% des gens sont capables d'inventer des statistiques sans fournir d'études à l'appui.\nHors ligne\nExpress\nRe : [Resolu]duplicate sources.lits\n...\nDe toute façon, le message d'erreur retourné devrait lister quels dépôts sont listés en double, non?\nNormalement oui !\nHors ligne\ncocoubuntu\nRe : [Resolu]duplicate sources.lits\ndonc , j'enléve , je supprime une des deux lignes ????\nMerci\nHors ligne\nAlexandreP\nRe : [Resolu]duplicate sources.lits\nOui, supprime la toute dernière ligne.\n«La capacité d'apprendre est un don; La faculté d'apprendre est un talent; La volonté d'apprendre est un choix.» -Frank Herbert\n93,8% des gens sont capables d'inventer des statistiques sans fournir d'études à l'appui.\nHors ligne\ncocoubuntu\nRe : [Resolu]duplicate sources.lits\nMerci\nMaintenant , je sais\nHors ligne\nBobbybionic\nRe : [Resolu]duplicate sources.lits\nBonjour\nTon problème est résolu, pense donc à l'indiquer dans le titre du topic (en revenant au premier message et en faisant \"modifier\").\nBonne continuation\nNon à la vente liée. Non au monopole Windows.\nTous ensemble, refusons les logiciels préinstallés et tournons nous vers le libre.\nhttp://bobbybionic.wordpress.com\nHors ligne"}}},{"rowIdx":260,"cells":{"text":{"kind":"string","value":"I found a recipe in English that mentions a \"pinch\" of something. English is not my first language, and Google shows that \"pinch\" has many meanings. Do I have to pinch it with my fingers, or can i find a suitable amount of milliliters to use?\nA 'pinch' is the amount of powder/whatever that can be trapped between one's thumb and fore finger.\nUsually if amounts are indicated in pinches it means that exactictude is not required, and you can follow, at least in part, individual taste. If measurements are critical, like in the amount of gelatin you need for a certain texture, or certain amounts in patisserie, you will find indications in grams or ounces.\nI wouldn't go crazy about finding a metric or imperial equivalent of the \"pinch\", also because the original recipe writer very likely did not mean it that way - you would just be obsessive, not precise.\nif you want to be technical about it, a pinch is 1/32 of a teaspoon, if that helps.\nI found this table of conversions:\nTad — 1/8th teaspoon\n Dash — 1/16th teaspoon (or less than 1/8th teaspoon)\n Pinch — 1/16th teaspoon (or 1/24th teaspoon)\nSmidgen (smidge, for short) — 1/32nd teaspoon (or 1/48th teaspoon)\n Drop — 1/60th teaspoon (or 1/80th teaspoon or 1/120th teaspoon)\n Hint — a trace\n"}}},{"rowIdx":261,"cells":{"text":{"kind":"string","value":"Update (May 2014): Please note that these instructions are outdated. while it is still possible (and in fact easier) to blog with the Notebook, the exact process has changed now that IPython has an official conversion framework. However, Blogger isn't the ideal platform for that (though it can be made to work). If you are interested in using the Notebook as a tool for technical blogging, I recommend looking at Jake van der Plas' Pelican support or Damián Avila's support in Nikola.\nUpdate: made full github repo for blog-as-notebooks, and updated instructions on how to more easily configure everything and use the newest nbconvert for a more streamlined workflow.\nSince the notebook was introduced with IPython 0.12, it has proved to be very popular, and we are seeing great adoption of the tool and the underlying file format in research and education. One persistent question we've had since the beginning (even prior to its official release) was whether it would be possible to easily write blog posts using the notebook. The combination of easy editing in markdown with the notebook's ability to contain code, figures and results, makes it an ideal platform for quick authoring of technical documents, so being able to post to a blog is a natural request.\nToday, in answering a query about this from a colleague, I decided to try again the status of our conversion pipeline, and I'm happy to report that with a bit of elbow-grease, at least on Blogger things work pretty well!\nThe purpose of this post is to quickly provide a set of instructions on how I got it to work, and to test things out. Please note: this requires code that isn't quite ready for prime-time and is still under heavy development, so expect some assembly.\nConverting your notebook to html with nbconvert\nThe first thing you will need is our nbconvert tool that converts notebooks across formats. The README file in the repo contains the requirements for nbconvert (basically python-markdown, pandoc, docutils from SVN and pygments).\nOnce you have nbconvert installed, you can convert your notebook to Blogger-friendly html with:\nnbconvert -f blogger-html your_notebook.ipynb\n\nThis will leave two files in your computer, one named your_notebook.html and one named your_noteboook_header.html; it might also create a directory called your_notebook_files if needed for ancillary files. The first file will contain the body of your post and can be pasted wholesale into the Blogger editing area. The second file contains the CSS and Javascript material needed for the notebook to display correctly, you should only need to use this once to configure your blogger setup (see below):\n# Only one notebook so far\n(master)longs[blog]> ls\n120907-Blogging with the IPython Notebook.ipynb fig/ old/\n# Now run the conversion:\n(master)longs[blog]> nbconvert.py -f blogger-html 120907-Blogging\\ with\\ the\\ IPython\\ Notebook.ipynb\n# This creates the header and html body files\n(master)longs[blog]> ls\n120907-Blogging with the IPython Notebook_header.html fig/\n120907-Blogging with the IPython Notebook.html old/\n120907-Blogging with the IPython Notebook.ipynb\n\nConfiguring your Blogger blog to accept notebooks\nThe notebook uses a lot of custom CSS for formatting input and output, as well as Javascript from MathJax to display mathematical notation. You will need all this CSS and the Javascript calls in your blog's configuration for your notebook-based posts to display correctly:\nOnce authenticated, go to your blog's overview page by clicking on its title.\nClick on templates (left column) and customize using the Advanced options.\nScroll down the middle column until you see an \"Add CSS\" option.\nCopy entire the contents of the _headerfile into the CSS box.\nThat's it, and you shouldn't need to do anything else as long as the CSS we use in the notebooks doesn't drastically change. This customization of your blog needs to be done only once.\nWhile you are at it, I recommend you change the width of your blog so that cells have enough space for clean display; in experimenting I found out that the default template was too narrow to properly display code cells, producing a lot of text wrapping that impaired readability. I ended up using a layout with a single column for all blog contents, putting the blog archive at the bottom. Otherwise, if I kept the right sidebar, code cells got too squished in the post area.\nI also had problems using some of the fancier templates available from 'Dynamic Views', in that I could never get inline math to render. But sticking to those from the Simple or 'Picture Window' categories worked fine and they still allow for a lot of customization.\nNote: if you change blog templates, Blogger does destroy your custom CSS, so you may need to repeat the above steps in that case.\nAdding the actual posts\nNow, whenever you want to write a new post as a notebook, simply convert the .ipynb file to blogger-html and copy its entire contents to the clipboard. Then go to the 'raw html' view of the post, remove anything Blogger may have put there by default, and paste. You should also click on the 'options' tab (right hand side) and select both Show HTML literally and Use
tag, else your paragraph breaks will look all wrong.\nThat's it!\nWhat can you put in?\nI will now add a few bits of code, plots, math, etc, to show which kinds of content can be put in and work out of the box. These are mostly bits copied from our example notebooks so the actual content doesn't matter, I'm just illustrating the kind of content that works.\n# Let's initialize pylab so we can plot later%pylab inline\nWith pylab loaded, the usual matplotlib operations work\nx = linspace(0, 2*pi)plot(x, sin(x), label=r'$\\sin(x)$')plot(x, cos(x), 'ro', label=r'$\\cos(x)$')title(r'Two familiar functions')legend()\nThe notebook, thanks to MathJax, has great LaTeX support, so that you can type inline math $(1,\\gamma,\\ldots, \\infty)$ as well as displayed equations:\n$$ e^{i \\pi}+1=0 $$\nbut by loading the sympy extension, it's easy showcase math output from Python computations, where we don't type the math expressions in text, and instead the results of code execution are displayed in mathematical format:\n%load_ext sympyprintingimport sympy as symfrom sympy import *x, y, z = sym.symbols(\"x y z\")\nFrom simple algebraic expressions\nRational(3,2)*pi + exp(I*x) / (x**2 + y)eq = ((x+y)**2 * (x+1))eqexpand(eq)\nTo calculus\ndiff(cos(x**2)**2 / (1+x), x)\nYou can easily include formatted text and code with markdown\nYou can italicize, boldface\nbuild\nlists\nand embed code meant for illustration instead of execution in Python:\ndef f(x):\n \"\"\"a docstring\"\"\"\n return x**2\n\nor other languages:\nif (i=0; i change partition table\n fdisk [options] -l list partition table(s)\n fdisk -s give partition size(s) in blocks\nOptions:\n -b sector size (512, 1024, 2048 or 4096)\n -c[=] compatible mode: 'dos' or 'nondos' (default)\n -h print this help text\n -u[=] display units: 'cylinders' or 'sectors' (default)\n -v print program version\n -C specify the number of cylinders\n -H specify the number of heads\n -S specify the number of sectors per track\nkrystoo@krystoo-3000-N200:~$ fdisk -l\nkrystoo@krystoo-3000-N200:~$ fsck.ext3 -y /dev/...\ne2fsck 1.42 (29-Nov-2011)\nfsck.ext3: Aucun fichier ou dossier de ce type lors de la tentative d'ouverture de /dev/...\nPériphérique peut-être inexistant ?\nkrystoo@krystoo-3000-N200:~$ sudo fsck\n[sudo] password for krystoo: \nfsck de util-linux 2.20.1\ne2fsck 1.42 (29-Nov-2011)\n/dev/sda1 est monté. \nAVERTISSEMENT !!! Le système de fichiers est monté. Si vous continuez\nvous ***ALLEZ*** causer des dommages ***SÉVÈRES*** au système de fichiers.\nSouhaitez-vous réellement continuer? oui\n/dev/sda1 : récupération du journal\nuiLors de l'effacement de l'i-noeud orphelin 6029324 (uid=1000, gid=1000, mode=0100600, taille=65536)\nDéfinition du compteur d'i-noeuds libres à 19300542 (était 19300546)\nDéfinition du compteur des blocs libres à 75946142 (était 75946200)\n/dev/sda1 : propre, 171842/19472384 fichiers, 1936738/77882880 blocs\nkrystoo@krystoo-3000-N200:~$ ui\nLe programme 'ui' n'est pas encore installé. Vous pouvez l'installer en tapant :\nsudo apt-get install userinfo\nkrystoo@krystoo-3000-N200:~$ sudo passwd root\nEntrez le nouveau mot de passe UNIX : \nRetapez le nouveau mot de passe UNIX : \npasswd : le mot de passe a été mis à jour avec succès\nkrystoo@krystoo-3000-N200:~$ $ cat /etc/fstab\n$ : commande introuvable\nkrystoo@krystoo-3000-N200:~$ cat /etc/fstab\n# /etc/fstab: static file system information.\n#\n# Use 'blkid' to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n# \nproc /proc proc nodev,noexec,nosuid 0 0\n# / was on /dev/sda1 during installation\nUUID=4e15f889-4999-4585-87d1-734e9e154d1c / ext4 errors=remount-ro 0 1\n# swap was on /dev/sda5 during installation\nUUID=c81e2e84-1fce-48de-925c-2c9dd726dfbd none swap sw 0 0\n\npour ls /var/lib/dpkg/info/linux-headers-*.list\n$ ls /var/lib/dpkg/info/linux-headers-*.list\n/var/lib/dpkg/info/linux-headers-3.2.0-29-generic.list\n/var/lib/dpkg/info/linux-headers-3.2.0-29.list\n/var/lib/dpkg/info/linux-headers-3.2.0-35-generic.list\n/var/lib/dpkg/info/linux-headers-3.2.0-35.list\n/var/lib/dpkg/info/linux-headers-generic.list\n\nUbuntu 14.04 lts - carte graph : Intel(R) 82865G Graphics Controller - Q45/Q43 Chipset Boosté à fond rame un poil sur les vidéos\n-- & -- Ubuntu 14.04 lts - Lenovo 3000-N200 -- & -- un PC ACER Aspire M1600-EB7Z sauvé de la poubelle, nettoyé et dépoussiéré qui avait aussi vista qui ramait par a coups et de façon aléatoire 1.20Ghz redevenu 1.60Ghz grâce à Ubuntu et maintenant fuse.\nHors ligne\ntiramiseb\nRe : Comment installer des mises à jour téléchargées ?\nQuand tu lis :\nAVERTISSEMENT !!! Le système de fichiers est monté. Si vous continuez\nvous ***ALLEZ*** causer des dommages ***SÉVÈRES*** au système de fichiers.\nSouhaitez-vous réellement continuer?\n... tu réponds \"oui\" ? Tu n'as vraiment pas peur...\nEt dans la documentation, le message suivant sur fond rouge :\nIl faut impérativement que votre partition soit démontée, c'est-à-dire non accessible, ce qui est le cas avec un live CD\n... ça t'a pas inquiété ?\nSi tu as un quelconque grave problème sur tes fichiers à cause de cela, toi seul pourra être tenu pour responsable étant donné que tu as ignoré les avertissements.\n----------\nBon, sinon, retournons à nos moutons...\nAvec ton \"ls\" on voit que je me suis gouré et que j'ai mis un \".\" au lieu d'un \"-\" dans le nom du fichier. Avec un peu de jugeotte, tu peux comprendre que la commande devrait être :\ncat /var/lib/dpkg/info/linux-headers-3.2.0-35.list\n\nNote bien que NOUS N'AVONS PAS BESOIN DU RETOUR COMPLET DE CETTE COMMANDE, C'EST UN ÉNORME FICHIER POUR LEQUEL ON N'A PAS BESOIN DU CONTENU. On a juste besoin de vérifier qu'\n, c'est à ça que tu dois faire attention.à la fin ça te donne une erreur d'entrée/sortie\nHors ligne\nkrystoo\nRe : Comment installer des mises à jour téléchargées ?\nOui tiramiseb, je sais hein puis encore débutant\nAlors ta commande me donne :\n... long listing ...\n/usr/src/linux-heacat: /var/lib/dpkg/info/linux-headers-3.2.0-35.list: Erreur d'entrée/sortie\n\nUbuntu 14.04 lts - carte graph : Intel(R) 82865G Graphics Controller - Q45/Q43 Chipset Boosté à fond rame un poil sur les vidéos\n-- & -- Ubuntu 14.04 lts - Lenovo 3000-N200 -- & -- un PC ACER Aspire M1600-EB7Z sauvé de la poubelle, nettoyé et dépoussiéré qui avait aussi vista qui ramait par a coups et de façon aléatoire 1.20Ghz redevenu 1.60Ghz grâce à Ubuntu et maintenant fuse.\nHors ligne\ntiramiseb\nRe : Comment installer des mises à jour téléchargées ?\nTente de redémarrer sur un LiveCD et de réparer le système de fichiers avec fsck...\nHors ligne\nkrystoo\nRe : Comment installer des mises à jour téléchargées ?\nOui j'ai éssayé, mais comment on répare ? Il y a choix de langue donc fr, éssayer ou installer. Après dans installer on remplace ou installe en parallèle et autre c'est pour repartitionner.\nUbuntu 14.04 lts - carte graph : Intel(R) 82865G Graphics Controller - Q45/Q43 Chipset Boosté à fond rame un poil sur les vidéos\n-- & -- Ubuntu 14.04 lts - Lenovo 3000-N200 -- & -- un PC ACER Aspire M1600-EB7Z sauvé de la poubelle, nettoyé et dépoussiéré qui avait aussi vista qui ramait par a coups et de façon aléatoire 1.20Ghz redevenu 1.60Ghz grâce à Ubuntu et maintenant fuse.\nHors ligne"}}},{"rowIdx":263,"cells":{"text":{"kind":"string","value":"In a recent python project where I was sending multiple messages per second of data over a basic socket, I had initially just grabbed the cPickle module to get the prototype proof-of-concept functioning properly. cPickle is awesome for easily serializing more complex python objects like custom classes, even though in my case I am only sending basic types.\nMy messages were dicts with some nested dicts, lists, floats, and string values. Roughly 500-1000 bytes. cPickle was doing just fine, but there came a point where I wanted to investigate the areas that could be tightened up. The first thing I realized was that I had forgotten to encode cPickle in the binary format (the default is ascii). That saved me quite a bit of time. But then I casually searched online to see if any json options might be better since my data is pretty primitive anyways.\nI found UltraJSON, which is a pure C json parsing library for python, and ran some tests. There are benchmarks on the project page for ujson, as well as other articles on the internet, but I just wanted to post up my own results using a mixed type data container. ujson came out extremely fast: faster than binary cPickle and msgpack, in the encoding test. Although in the decoding test, msgpack appeared to be fastest, followed by binary cPickle, and then ujson coming in 3rd\nThis test included the following:\nHere is my Python 2.7.2 test script using timeit for each encode and decode step.\n\"\"\"\nDependencies:\n pip install tabulate simplejson python-cjson ujson yajl msgpack-python\n\"\"\"\nfrom timeit import timeit \nfrom tabulate import tabulate\nsetup = '''d = {\n 'words': \"\"\"\n Lorem ipsum dolor sit amet, consectetur adipiscing \n elit. Mauris adipiscing adipiscing placerat. \n Vestibulum augue augue, \n pellentesque quis sollicitudin id, adipiscing.\n \"\"\",\n 'list': range(100),\n 'dict': dict((str(i),'a') for i in xrange(100)),\n 'int': 100,\n 'float': 100.123456\n}'''\nsetup_pickle = '%s ; import cPickle ; src = cPickle.dumps(d)' % setup\nsetup_pickle2 = '%s ; import cPickle ; src = cPickle.dumps(d, 2)' % setup\nsetup_json = '%s ; import json; src = json.dumps(d)' % setup\nsetup_msgpack = '%s ; src = msgpack.dumps(d)' % setup\ntests = [\n # (title, setup, enc_test, dec_test)\n ('pickle (ascii)', 'import pickle; %s' % setup_pickle, 'pickle.dumps(d, 0)', 'pickle.loads(src)'),\n ('pickle (binary)', 'import pickle; %s' % setup_pickle2, 'pickle.dumps(d, 2)', 'pickle.loads(src)'),\n ('cPickle (ascii)', 'import cPickle; %s' % setup_pickle, 'cPickle.dumps(d, 0)', 'cPickle.loads(src)'),\n ('cPickle (binary)', 'import cPickle; %s' % setup_pickle2, 'cPickle.dumps(d, 2)', 'cPickle.loads(src)'),\n ('json', 'import json; %s' % setup_json, 'json.dumps(d)', 'json.loads(src)'),\n ('simplejson-3.3.1', 'import simplejson; %s' % setup_json, 'simplejson.dumps(d)', 'simplejson.loads(src)'),\n ('python-cjson-1.0.5', 'import cjson; %s' % setup_json, 'cjson.encode(d)', 'cjson.decode(src)'),\n ('ujson-1.33', 'import ujson; %s' % setup_json, 'ujson.dumps(d)', 'ujson.loads(src)'),\n ('yajl 0.3.5', 'import yajl; %s' % setup_json, 'yajl.dumps(d)', 'yajl.loads(src)'),\n ('msgpack-python-0.3.0', 'import msgpack; %s' % setup_msgpack, 'msgpack.dumps(d)', 'msgpack.loads(src)'),\n]\nloops = 15000\nenc_table = []\ndec_table = []\nprint \"Running tests (%d loops each)\" % loops\nfor title, mod, enc, dec in tests:\n print title\n print \" [Encode]\", enc \n result = timeit(enc, mod, number=loops)\n enc_table.append([title, result])\n print \" [Decode]\", dec \n result = timeit(dec, mod, number=loops)\n dec_table.append([title, result])\nenc_table.sort(key=lambda x: x[1])\nenc_table.insert(0, ['Package', 'Seconds'])\ndec_table.sort(key=lambda x: x[1])\ndec_table.insert(0, ['Package', 'Seconds'])\nprint \"\\nEncoding Test (%d loops)\" % loops\nprint tabulate(enc_table, headers=\"firstrow\")\nprint \"\\nDecoding Test (%d loops)\" % loops\nprint tabulate(dec_table, headers=\"firstrow\")\n\"\"\"\nOUTPUT:\nRunning tests (15000 loops each)\npickle (ascii)\n [Encode] pickle.dumps(d, 0)\n [Decode] pickle.loads(src)\npickle (binary)\n [Encode] pickle.dumps(d, 2)\n [Decode] pickle.loads(src)\ncPickle (ascii)\n [Encode] cPickle.dumps(d, 0)\n [Decode] cPickle.loads(src)\ncPickle (binary)\n [Encode] cPickle.dumps(d, 2)\n [Decode] cPickle.loads(src)\njson\n [Encode] json.dumps(d)\n [Decode] json.loads(src)\nsimplejson-3.3.1\n [Encode] simplejson.dumps(d)\n [Decode] simplejson.loads(src)\npython-cjson-1.0.5\n [Encode] cjson.encode(d)\n [Decode] cjson.decode(src)\nujson-1.33\n [Encode] ujson.dumps(d)\n [Decode] ujson.loads(src)\nyajl 0.3.5\n [Encode] yajl.dumps(d)\n [Decode] yajl.loads(src)\nmsgpack-python-0.3.0\n [Encode] msgpack.dumps(d)\n [Decode] msgpack.loads(src)\nEncoding Test (15000 loops)\nPackage Seconds\n-------------------- ---------\nujson-1.33 0.232215\nmsgpack-python-0.3.0 0.241945\ncPickle (binary) 0.305273\nyajl 0.3.5 0.634148\npython-cjson-1.0.5 0.680604\njson 0.780438\nsimplejson-3.3.1 1.04763\ncPickle (ascii) 1.62062\npickle (ascii) 14.0497\npickle (binary) 15.4712\nDecoding Test (15000 loops)\nPackage Seconds\n-------------------- ---------\nmsgpack-python-0.3.0 0.240885\ncPickle (binary) 0.393152\nujson-1.33 0.396875\npython-cjson-1.0.5 0.694321\nyajl 0.3.5 0.748369\nsimplejson-3.3.1 0.780531\ncPickle (ascii) 1.38561\njson 1.65921\npickle (binary) 5.20554\npickle (ascii) 17.8767\n\"\"\"\n"}}},{"rowIdx":264,"cells":{"text":{"kind":"string","value":"Mathieu11\n[ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nEdit admin : le sommaire renvoyant vers les différents scripts se trouve désormais sur cette page de la documentation.\nLes nouveaux scripts peuvent donc être discutés ici, puis inclus dans le sommaire\nJ'ouvre ce sujet pour proposer a chacun de poster les scripts qu'il trouve utiles/pratiques ou de soumettre l'idee d'un script qui lui semblerait pratique.\nS'il était épinglé peut etre que ca permettrait un bon échange entre tout le monde et éviterai a certains de \"ré-inventer la roue\"...\nPour faciliter la lecture je vais faire un sommaire avec lien vers chaque script.\nDe meme je pense que pour faciliter cette lecture et la creation du sommaire chacun d'entre nous ne devrait placer qu'UN seul script par post (si ceux qui ont deja poste peuvent modifier je serais reconnaissant) et le poster sous une forme qui ressemble a ceci :\nhttp://doc.ubuntu-fr.org/scripts_utiles\nNB : Vous devez rendre ces scripts executables avant leur utilisation : Placez vous dans le dossier ou se situe le script, ouvrez un terminal et tapez\nchmod +x $nom_du_script\n(en remplacant $nom_du_script par le nom du script en question :P :D)\nDernière modification par xabilon (Le 03/11/2008, à 15:05)\nVostro 1400\nHors ligne\nmessi89\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nmerci mon frere pour le partage\nl'amour est comme les cookies..sa durée de vie doit être courte pour des raisons de sécurité\nHors ligne\nMathieu11\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nDe nada. Si jamais ca interesse du monde.\nVostro 1400\nHors ligne\njadoman\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nC'est une bonne idée, merci c'est bien cool. à+:cool:\nProcessor Intel dual-core E7400 2.80ghz.\nMemory 8 go crucial ddr2 dual-chanel Moniteur 23 pouces ASUS VH236 Résolution 1920*1080 pixels\nlinuxmint katya 64; ubuntu ultimate 3.4; sabayon; kubuntu 12.04\nnvidia gtx 560 gigabyte\nHors ligne\nKrevan\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\n4/ ENCODAGE VERS PSP\nVoilà le script que j'ai écrit pour encoder rapidement, en ligne de commande, des fichiers pour ma PSP.\nIl fonctionne grâce à FFMPEG, celui-ci est donc indispensable.\nTéléchargez le script [en cliquant ici] ou bien ouvrez créez un nouveau fichier et copiez-le à l'intérieur.\n#!/bin/sh\n# Version 0.3-1\n# Script sous licence GNU GPL\nsortant = entrant\"-psp\"\necho \" __ __\";\necho \" / / / FFMPEG\";\necho \" / / / /| Script Encodeur Express pour PSP\";\necho \"| / / / | Version 0.2-3\";\necho \"|/ / / /\";\necho \" /_/ /__ \";\n# Prompt demandant le format sortant désiré (mp4 ou avi).\necho ;\necho \"Choix du format vidéo sortant\"\necho \"1. MP4\";\necho \"2. AVI\"; \necho \"Merci d'entrer le numéro correspondant\";\necho -n \"> \"\nread format && \n# Prompt demandant le chemin des fichiers entrant et sortant.\necho ;\necho \"Choix de la vidéo à encoder\";\necho -n \"> \";\nread entrant &&\n# Simulation « inutile » (mais classe) de chargement. \necho ;\necho -n \"Lancement du script\";\nsleep 1;\necho -n .;\nsleep 1;\necho -n .;\nsleep 1;\necho .;\nsleep 1;\n# Condition vérifiant le format désiré et encode la vidéo en conséquence. \nif [ \"$format\" = \"1\" ]; then\n{\n\tffmpeg -i $entrant -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 480x272 output-psp.mp4;\n}\nelif [ \"$format\" = \"2\" ]; then\n{\n\tffmpeg -i $entrant -vcodec xvid -acodec mp3 -b 1000kb -s 480x272 output-psp.avi;\n}\nelse \n{\n\techo \"«$format» n'est pas une valeur correcte, vérifiez que vous avez bien tapé le chiffre correspondant au format désiré et relancez le programme.\"; \n\texit 0;\n}\nfi\n# Suppression des sources.\necho; \necho;\necho -n \"Voulez-vous supprimer le fichier source «$entrant» (O/N) ? \"\nread supprimer_sources &&\nif [ \"$supprimer_sources\" = \"O\" ] || [ \"supprimer_sources\" = \"o\" ]; then\n{\n\techo -n \"Suppression en cours... \";\t\n\trm $entrant;\n\techo \"OK\";\n}\nelse \n{\n\techo \"Le fichier source ne sera pas supprimé.\";\n}\nfi\n# Fin.\necho ;\necho \"Le script s'est correctement terminé. Il est tout de même conseillé de vérifier la vidéo.\"; \nsleep 3;\nexit 0;\n\nSi vous avez des doutes quand à l'installation du script voici la marche à suivre, $ signalant une nouvelle entrée (vous ne devez pas l'écrire).\n# Vérifiez que vos dépots Medibuntu soient activés.\n$ sudo apt-get install ffmpeg\n# Téléchargez et installez :\n$ wget http://sh-theque.eg2.fr/scripts/seep.tar.gz\n$ tar -zxvf seep.tar.gz\n$ mv seep .seep\n$ sudo chmod +x .seep\n# Executez le tout !\n$ ./.seep\n\nN'hésitez pas à me signaler vos problèmes.\nDernière modification par Krevan (Le 30/03/2008, à 20:43)\n« Ce n'est pas une miette de pain, c'est la moisson du monde entier qu'il faut à la race humaine, sans exploiteur et sans exploité. »\nLouise Michel\nHors ligne\nShrat\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nCdanslair vers lecteur mp3 chinois (.amv)\nIl y a surement moyen de coder ca plus proprement, j'ai un peu honte. M'enfin... à toutes fins utiles, je poste.\n#!/bin/bash\n#Tous les chemins de ce script sont absolus. Ce script ne fonctionne que dans un environnement bien précis.\nannee=`date \"+%Y\"`\nmois=`date \"+%m\"`\njour=`date \"+%d\"`\njoursemaine=`date \"+%u\"`\nheure=`date \"+%H\"`\nwe=0\nnegatif=0\n#On se débarasse du problème du week end\nif [ $joursemaine == 6 ]; then\n\t((jour = jour-1))\n\twe=1\nfi\nif [ $joursemaine == 7 ]; then\n\t((jour = jour-2))\n\twe=1\nfi\n#S'il est moins de 20h, il faut prendre la vidéo du jour d'avant\nif [[ $we == 0 && $heure < 20 ]]; then\n\tif [ $joursemaine == 1 ]; then\n\t\t((jour = jour-3))\n\telse\n\t\t((jour = jour-1))\n\tfi\nfi\n#Maintenant, on a le bon jour, prenant en compte l'heure et le week end. Problème : les bornes des mois.\nif [ $jour == -2 ]; then\n\tnegatif=1\n\t#Mois précédent de 31 jours\n\tif [ $mois == 01 ] || [ $mois == 02 ] || [ $mois == 04 ] || [ $mois == 06 ] || [ $mois == 08 ] || [ $mois == 09 ] || [ $mois == 11 ]; then\n\t\tjour=29\n\tfi\n\t#Mois précédent de 30 jours\n\tif [ $mois == 05 ] || [ $mois == 07 ] || [ $mois == 10 ] || [ $mois == 12 ]; then\n\t\tjour=28\n\tfi\n\t#Le mois précédant mars est février, et c'est lourd...\n\tif [ $mois == 03 ]; then\n\t\t#On vérifie si l'année est bissextile\n\t\tif [ $((annee%4)) == 0 ]; then\n\t\t\tjour=27\n\t\telse\n\t\t\tjour=26\n\t\tfi\n\tfi\nfi\nif [ $jour == -1 ]; then\n\tnegatif=1\n\t#Mois précédent de 31 jours\n\tif [ $mois == 01 ] || [ $mois == 02 ] || [ $mois == 04 ] || [ $mois == 06 ] || [ $mois == 08 ] || [ $mois == 09 ] || [ $mois == 11 ]; then\n\t\tjour=30\n\tfi\n\t#Mois précédent de 30 jours\n\tif [ $mois == 05 ] || [ $mois == 07 ] || [ $mois == 10 ] || [ $mois == 12 ]; then\n\t\tjour=29\n\tfi\n\t#Le mois précédant mars est février, et c'est lourd...\n\tif [ $mois == 03 ]; then\n\t\t#On vérifie si l'année est bissextile\n\t\tif [ $((annee%4)) == 0 ]; then\n\t\t\tjour=28\n\t\telse\n\t\t\tjour=27\n\t\tfi\n\tfi\nfi\nif [ $jour == 0 ]; then\n\tnegatif=1\n\t#Mois précédent de 31 jours\n\tif [ $mois == 01 ] || [ $mois == 02 ] || [ $mois == 04 ] || [ $mois == 06 ] || [ $mois == 08 ] || [ $mois == 09 ] || [ $mois == 11 ]; then\n\t\tjour=31\n\tfi\n\t#Mois précédent de 30 jours\n\tif [ $mois == 05 ] || [ $mois == 07 ] || [ $mois == 10 ] || [ $mois == 12 ]; then\n\t\tjour=30\n\tfi\n\t#Le mois précédant mars est février, et c'est lourd...\n\tif [ $mois == 03 ]; then\n\t\t#On vérifie si l'année est bissextile\n\t\tif [ $((annee%4)) == 0 ]; then\n\t\t\tjour=29\n\t\telse\n\t\t\tjour=28\n\t\tfi\n\tfi\nfi\nif [ $negatif == 1 ]; then\n\tif [ $mois == 01 ]; then\n\t\tmois=12\n\telse\n\t\t((mois = mois-1))\n\tfi\nfi\nmencoder mms://a533.v55778.c5577.e.vm.akamaistream.net/7/533/5577/42c40fe4/lacinq.download.akamai.com/5577/internet/cdanslair/cdanslair_$annee$mois$jour.wmv -ofps 25 -fps 25 -ovc copy -oac pcm -o /home/michael/Media/Podcasts/$annee$mois$jour.avi\ncd /home/michael/Applis/amv-codec-tools/AMVmuxer/ffmpeg && ./ffmpeg -i /home/michael/Media/Podcasts/$annee$mois$jour.avi -f amv -r 16 -s 160x120 -ac 1 -ar 22050 -y /home/michael/Media/Podcasts/$annee$mois$jour.amv\necho \"Fichiers vidéo généré! Youpi!!\"\n\nHors ligne\nDocPlenitude\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nVoilà un script pour compter le nombre d'image que j'ai dans Webilder, il suffit de le mettre dans le dossier ~/.webilder/ mais on peut s'en servir dans un autre dossier pour compter le nombre d'image dans le dossier et ces sous dossiers.\n#!/bin/bash\nnb_images_jpg=`find . -iname *.jpg -print | grep -v \"thumbnail\" | wc -l`\nnb_images_gif=`find . -iname *.gif -print | grep -v \"thumbnail\" | wc -l`\nnb_images_png=`find . -iname *.png -print | grep -v \"thumbnail\" | wc -l`\nnb_images=`expr $nb_images_jpg + $nb_images_gif + $nb_images_png` \nzenity --info --title=\"Nombre d'images dans le dossier\" --text=\"Il y a $nb_images images dans le dossier.\"\n\nIl compte le nombre d'image gif, jpg et png en ne comptant pas les miniatures et fais le total puis vous l'affiche.\n------------\nPour avoir une download-bar quand on télécharge en ligne de commande avec wget (bon celui là je l'ai fait à partir de morçals chipés sur le web).\n#!/bin/bash\nsed -u 's/\\([ 0-9]\\+K\\)[ \\.]*\\([0-9]\\+%\\) \\(.*\\)/\\2\\n#Transfert : \\1 (\\2) à \\3/' &1 | ~/bin/wget-download-bar\n\nDernière modification par DocPlenitude (Le 31/03/2008, à 00:21)\nHors ligne\nsoupaloignon\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nSympa ce post, bien vu\n==> Libérez les huitres du bassin d'Arcachon <==\nHors ligne\nOreste visari\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nShrat, comment faire pour que ton script télécharge les vidéos et les mettes dans le dossier /home/user/Vidéos/cDansLair ?\nCar j'ai essayer en remplaçant le chemin du lecteur par celui du dossier mais ça n'as rien donné, la console s'ouvre et ce ferme lorsque je lance le script.\nQuoi qu'il en soit merci pour vos scripts!\nElementary OS Luna - Acer Aspire S3\nHors ligne\nShrat\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nJe te fais ça Oreste. Pour l'instant j'ai du boulot mais je poste dans la semaine.\nHors ligne\nRas&#039;\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\ntrès sympa le todo list, enfin je sais pas si je m'en servirais comme ça mais un marque page discret à afficher en conky c'est une bonne idée !\nje poste les miens ce soir j'ai pas le temps là ^^\nMettre le nom en rouge et le but en gras est une bonne idée aussi pour améliorer la lecture\nEDIT : Bon du coup je poste ça maintenant\nROTATION D'IMAGEQuand on prend des photos verticales, il peut y avoir des problèmes avec les données EXIF.Ainsi la photo s'affiche dans le bon sens avec le visionneur d'image, mais s'affichera à l'horizontale avec d'autres applications (envoi sur blogspot par exemple). Le script permet de remettre toutes les photos d'un dossier dans le sens correct.\nJe l'ai mis en nautilus script pour faire ça d'un clique droit au moment de l'import des photos\nDépendances : On à besoin de la commande exifautotran dispo dans le paquet libjpeg-progs\n#!/bin/bash\n#\n# Rotation des images verticales d'un dossier dans leur sens original\n#\nfind $1 -type f -exec exifautotran '{}' \\;\nzenity --info --title \"fin du script\" --text \"les images ont correctement été modifiées\"\n\nENVOI D'UNE IMAGE SUR PIX.NOFRAGUn nautilus script pour envoyer une image sur pix.nofrag d'un click droit et récupérer le lien vers l'image dans le presse papier\nMerci à pmd pour ce script, pour le support voir ici : http://forum.ubuntu-fr.org/viewtopic.php?id=183632\n#!/bin/bash\n# Nom : pix.sh\n# But : Envoyer facilement des images sur pix.nofrag.\n# By pmd\n# Configuration\nFICHIER=$1\nMIMETYPE=$(file -bi \"$1\")\nURL=pix.nofrag.com\nMAX_TAILLE_FICHIER=2000000 #2Mo (fixé par pix.nofrag)\n# Verifier le fichier avant envoi\nTAILLE_FICHIER=$(stat -c%s \"$FICHIER\")\nif [ $TAILLE_FICHIER -gt $MAX_TAILLE_FICHIER ]; then\n {\n echo \"Erreur, le fichier $FICHIER est trop lourd ($TAILLE_FICHIER octets pour une limite de $MAX_TAILLE_FICHIER maximum).\"\n zenity --warning --text=\"Erreur, le fichier $FICHIER est trop lourd ($TAILLE_FICHIER octets pour une limite de $MAX_TAILLE_FICHIER maximum).\"\n exit 1\n }\nfi\n# Envoyer le fichier, et enregistrer la page résultat\nTEMPFILE=$(tempfile)\ncurl $URL -F monimage=@\"$FICHIER\" -F submit=Upload -H \"Expect:\" -o $TEMPFILE --progress-bar | zenity --progress --pulsate --auto-close --text=\"Envoi de $1 vers $URL ...\"\n# Analyser la page pour extraire les donnees\nVIEWPAGE=$(grep -oEm 1 '\\[url\\=([^]]*)' $TEMPFILE | sed 's/\\[url\\=//')\nIMAGE_BIG=$(grep -oEm 1 '\\[img\\]([^[]*)' $TEMPFILE | sed 's/\\[img\\]//')\nNB_IMG=$(grep -c '\\[img\\]' $TEMPFILE)\nif [ \"$NB_IMG\" -eq \"1\" ]; then # Si ya pas besoin de miniature\n {\n IMAGE_MINI=$IMAGE_BIG\n }\nelif [ \"$NB_IMG\" -ge \"2\" ] || [ \"$NB_IMG\" -le \"3\" ]; then # Si ya besoin de miniature\n {\n IMAGE_MINI=$(echo $VIEWPAGE | sed 's/\\.html//')\"t.jpg\"\n }\nelse\n {\n echo \"La disposition de présentation du code à changé dans pix.nofrag.\"\n zenity --warning --text=\"La disposition de présentation du code à changé dans pix.nofrag.\"\n exit 2\n }\nfi\nrm $TEMPFILE\n# Resultat de l'upload : le code a placer dans un forum\nBBCODE=\"[url=$VIEWPAGE][img]$IMAGE_MINI[/img][/url]\"\nZCODE=\"&lt;lien url=\\\"$VIEWPAGE\\\"&gt;&lt;image&gt;$IMAGE_MINI&lt;/image&gt;&lt;/lien&gt;\"\n# =\"$IMAGE_MINI\"\n# On affiche\necho \"Lien : $VIEWPAGE\"\nzenity --info --text=\"\nFichier : $1\nType : $MIMETYPE\nLien :\\n$VIEWPAGE\nImage :\\n$IMAGE_BIG\nMiniature :\\n$IMAGE_MINI\nBBCode :\\n$BBCODE\nZCode :\\n$ZCODE\"\n# On met le lien direct dans le presse papier\necho [url=$IMAGE_BIG][img]$IMAGE_MINI[/img][/url]|xclip\n\nTELECHARGER LES QUOTIDIENNES DE CANALComme son nom l'indique, ce script permet de télécharger les quotidiennes (et presques quotidiennes) de canal, c'est à dire :les guignolsle zappingle petit journal actu et peoplele sav des émissionsla boite à questionla météo de louisela chronique de chris esquerreetc...\nJe vous renvoi à ce lien vu que le script peut être souvent modifié : http://forum.ubuntu-fr.org/viewtopic.php?id=200149\nDernière modification par Raskal (Le 08/04/2008, à 10:24)\nHors ligne\nMathieu11\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nMerci a tous ceux qui participent Je vais tester ton script Canal+ Raskal ca a l'air super sympa.\nDernière modification par Mathieu11 (Le 31/03/2008, à 19:48)\nVostro 1400\nHors ligne\nZak Blayde\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nGénial, le coup de pixnofrag, je teste ce soir !\nHors ligne\nHors ligne\nMathieu11\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nLe script pour les envois vers pixnofrag ne fonctionne pas chez moi, je ne recois pas d'url pour l'image dans la boite de dialogue zenity qui s'affiche et je n'ai rien dans le presse-papiers... Quelqu'un sait pourquoi ?\nEdit : Il me manquait le paquet curl... dsl... ca marche now.\nJe propose de rajouter les noms des paquets necessaires pour chaque script si possible.\nDernière modification par Mathieu11 (Le 03/04/2008, à 15:54)\nVostro 1400\nHors ligne\ndjezair31\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nHello tous,\nj'ai du installer dernierement dotclear sur plusieurs machine ubuntu gutsy. Du coup, je poste le script d'installation. Attention, vous devez editer le script et modifier la ligne :\nROOTMYSQLPASSWD=\"dotclear\"\nDans le cas contraire, le script modifie le mot de passe root de MySQL\nUne fois le script executer rendez-vous à l'url\nhttp://localhost/dotclear/admin/install/\nEt voilou ça tourne\n#!/bin/bash\nif ! id | grep -q \"uid=0\"\nthen\n echo \"You must be root to run this script (try sudo)\"\n exit 1\nfi\n# Si vous avez deja un mot de passe root pour MySQL\n# Veuillez le renseigner ici.\nROOTMYSQLPASSWD=\"dotclear\"\nDC_DBUSER=\"dotclear\"\nDBPASSWORD=\"dotclear\"\nDC_DBNAME=\"dotclear\"\nreponse=no\nDOTCLEARVERSION=\"dotclear-2.0-beta7.tar.gz\"\nDOTCLEARTGZ=\"http://download.dotclear.net/latest/${DOTCLEARVERSION}\"\nWWWDIR=\"/var/www\"\nWWWAPPDIR=\"/var/www/dotclear\"\nshellout(){\n echo\n echo -n `date`\n echo -e \"\\033[1m $1\\033[0m\"\n echo \"Existing with ERROR\"\n echo\n exit 1;\n};\ntitle(){\necho\necho -e \"\\033[1m $1\\033[0m\"\necho\n}\necho\necho \"ATTENTION !!!\"\necho\necho \"Le mot de passe de l'utilisateur root mysql va etre modifier.\"\necho \"Le nouveau mot de passe sera : $ROOTMYSQLPASSWD\"\necho\necho \"Si MySQL possede deja un mot de passe root et que vous le connaissez\"\necho \"vous devez renseigner la variable ROOTMYSQLPASSWD en premiere ligne de ce script\"\necho\necho -n \"Voulez vous continuez (yes or no) : \"\nread reponse\necho\necho\nif [ ! $reponse = \"yes\" ]\nthen\n echo \"Existing\";\n exit 1;\nfi\n[ \"${reponse}\" = \"\" ] && exit\ntitle \"Verification des dépendances\"\napt-get install mysql-server mysql-client apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-auth-mysql libapache2-mod-fcgid libapache2-mod-php5 php5 php5-cgi php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin libpcre3-dev || shellout \"Erreur d'installation des paquets. Verifier vos dépots\"\napt-get install sysv-rc-conf\nupdate-rc.d apache2 defaults 90\nupdate-rc.d mysql defaults 90\ntitle \"Configuration du serveur MySQL\"\n/etc/init.d/mysql stop\nmysqld_safe --skip-grant-tables --skip-networking &\nsleep 5\nmysql mysql -e \"update user set password=password(\\\"${ROOTMYSQLPASSWD}\\\") where user=\\\"root\\\" and host=\\\"localhost\\\";\" || shellout \"Erreur 1 MySQL\"\nmysqladmin shutdown || shellout \"Erreur 2 Impossible d'arreter MySQL\"\n/etc/init.d/mysql start || shellout \"Erreur 3 Impossible de démarrer MySQL\"\n#mysql -u root -e \"DROP DATABASE ${DC_DBNAME}\" --password=\"$ROOTMYSQLPASSWD\"\nmysql -u root -e \"CREATE DATABASE ${DC_DBNAME}\" --password=\"$ROOTMYSQLPASSWD\" \n#mysql -u root -e \"CREATE USER ${DC_DBUSER}\" --password=\"$ROOTMYSQLPASSWD\" || shellout \"Echec Creation du user ${DC_DBUSER}\"\nmysql -u root mysql -e \"GRANT ALL PRIVILEGES ON ${DC_DBNAME}.* TO '${DC_DBUSER}'@'localhost' IDENTIFIED BY '${DBPASSWORD}'; FLUSH PRIVILEGES;\" --password=\"$ROOTMYSQLPASSWD\" \ntitle \"Telechargement de DotCLEAR : $DOTCLEARTGZ\"\nrm -f /tmp/$DOTCLEARVERSION\nwget $DOTCLEARTGZ -P /tmp/ || shellout \"Echec de telechargement du fichier $DOTCLEARTGZ\"\ntitle \"Decompression du fichier /tmp/$DOTCLEARVERSION\"\ntar zxvf /tmp/$DOTCLEARVERSION -C ${WWWDIR} | \\\n awk '{l++; if (l%1==0) {printf \".\"; fflush()}}'\necho\nchown -R www-data:www-data ${WWWDIR}/dotclear/\nchmod -R 0775 ${WWWDIR}/dotclear/\ntitle \"Configuration de DotCLEAR\"\ncp ${WWWDIR}/dotclear/inc/config.php.in ${WWWDIR}/dotclear/inc/config.php.in.orig\nsed -i \"s/define('DC_DBPASSWORD','');/define('DC_DBPASSWORD','$DBPASSWORD');/g\" ${WWWDIR}/dotclear/inc/config.php.in\nsed -i \"s/define('DC_DBNAME','');/define('DC_DBNAME','$DC_DBNAME');/g\" ${WWWDIR}/dotclear/inc/config.php.in\nsed -i \"s/define('DC_DBUSER','');/define('DC_DBUSER','$DC_DBUSER');/g\" ${WWWDIR}/dotclear/inc/config.php.in\nsed -i \"s/define('DC_MASTER_KEY','');/define('DC_MASTER_KEY','le train sifflera trois fois');/g\" ${WWWDIR}/dotclear/inc/config.php.in\nsed -i \"s/define('DC_DBDRIVER','');/define('DC_DBDRIVER','mysql');/g\" ${WWWDIR}/dotclear/inc/config.php.in\nsed -i \"s/define('DC_ADMIN_URL','');/define('DC_ADMIN_URL','\\/dotclear\\/config');/g\" ${WWWDIR}/dotclear/inc/config.php.in\ntitle \"Patch DotCLEAR\"\n# Correction de BUG Voir http://dev.dotclear.net/2.0/changeset/1543\ncat > ${WWWDIR}/dotclear/admin/install/patch.diff <t.jpg\nNB : curl était déjà installé (cf post de Mathieu11).\nHors ligne\nRas&#039;\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nil n'est pas de moi, il faut voir avec pmd, désolé j'avais oublié de le citer, j'ai corrigé mon post, j'y ai rajouté le lien : http://forum.ubuntu-fr.org/viewtopic.php?id=183632\nHors ligne\npmd\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nil n'est pas de moi, il faut voir avec pmd, désolé j'avais oublié de le citer, j'ai corrigé mon post, j'y ai rajouté le lien : http://forum.ubuntu-fr.org/viewtopic.php?id=183632\nRa merde, il renvoi l'ascenseur\nLonewolf : Passe là : http://forum.ubuntu-fr.org/viewtopic.php?id=183632\nEt essai en passant par la console Apparemment, l'url du fichier donné en argument n'est pas bonne\nHors ligne\nMukri\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nPrend celui la en python il est 2 fois plus rapide que le script bash\n#!/usr/bin/env python\nimport urllib, httplib, mimetypes, sys, re\ndef post_multipart(host, port, selector, fields, files):\n \"\"\"\n Post fields and files to an http host as multipart/form-data.\n fields is a sequence of (name, value) elements for regular form\nfields.\n files is a sequence of (name, filename, value) elements for data to\nbe uploaded as files\n Return the server's response page.\n \"\"\"\n content_type, body = encode_multipart_formdata(fields, files)\n h = httplib.HTTP(host, port)\n h.putrequest('POST', selector)\n h.putheader('content-type', content_type)\n h.putheader('content-length', str(len(body)))\n h.endheaders()\n h.send(body)\n errcode, errmsg, headers = h.getreply()\n return h.file.read()\ndef encode_multipart_formdata(fields, files):\n \"\"\"\n fields is a sequence of (name, value) elements for regular form\nfields.\n files is a sequence of (name, filename, value) elements for data to\nbe uploaded as files\n Return (content_type, body) ready for httplib.HTTP instance\n \"\"\"\n BOUNDARY = '---------------------------13049614110900'\n CRLF = '\\r\\n'\n L = []\n for (key, value) in fields:\n L.append('--' + BOUNDARY)\n L.append('Content-Disposition: form-data; name=\"%s\"' % key)\n L.append('')\n L.append(value)\n for (key, filename, value) in files:\n L.append('--' + BOUNDARY)\n L.append('Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"' % (key, filename))\n L.append('Content-Type: %s' % get_content_type(filename))\n L.append('')\n L.append(value)\n L.append('--' + BOUNDARY + '--')\n L.append('')\n body = CRLF.join(L)\n content_type = 'multipart/form-data; boundary=%s' % BOUNDARY\n return content_type, body\ndef get_content_type(filename):\n return mimetypes.guess_type(filename)[0] or 'application/octet-stream'\nparams = [('MAX_FILE_SIZE', '3145728'), ('refer',\n'http://reg.imageshack.us/v_images.php')]\nfiles = [('fileupload', sys.argv[1], open(sys.argv[1], 'rb').read())]\nopen(sys.argv[1]).read()\ntext1 = post_multipart('imageshack.us', 80, '/index.php', params, files)\nkeyword = re.compile(r\"(image to friends)+\")\nlines = str(text1).split('\\n')\nfor line in lines:\n if keyword.search (line):\n foo = line.split('\"')\n print foo[1]\n\nUSage:\n./imageshack.py image.jpg\nHors ligne\nRas&#039;\nRe : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)\nComme tu n'es pas le premier à qui ça arrive, http://forum.ubuntu-fr.org/viewtopic.php?id=78396\nCelà dit le script ne fonctionnait pas chez moi...\nHors ligne"}}},{"rowIdx":265,"cells":{"text":{"kind":"string","value":"lekokeliko\nTictactux jeu en Python\nJe tient a vous présenter ma grande réalisation :\nle Tictactux en python développé depuis la nuit du 24 decembre 2007\nmorpion like parametrable a souhait\nquelques précisions :\nversions antérieures :\n-1.07.29 beta test\n-1.07.30 détails des modifs plus bas (post 7)\n-1.07.31 modifications (post8)\n1.08.04 modifications (post17)\n2.08.07 on peut choisir\n3.08.09 new mode de jeu\n3.08.09 easter egg hhéé\n3.08.14 choix des couleurs\nversion ci dessous 3.08.16 sauvegarde des paramètres de jeu d'une partie à l'autre\nil faut installer le paquet python-tk\nsudo apt-get install python-tk\n\net télécharger le fichier Tictactux disponible ici : ~Tictactux~\nLes tutos qui m'ont servis :\n- http://www.ulg.ac.be/cifen/inforef/swi : celui ci est vraiment bien je trouve plein d'exemples concrets\n- http://diveintopython.org/ : meme genre que celui d'avant je m'en suis moins servis\n- http://www.pythonware.com/library/tkinter/introduction/ : site ou tout est détaillé (fonctions options utilisation...)\n- http://docs.python.org/ : encore un site avec plein de ressources\n- http://infohost.nmt.edu/tcc/help/pubs/tkinter/ : ici c'est tout Tkinter qui est détaillé on peu le trouver en pdf\nje me suis limité a ca pour ma doc sinon on doit pouvoir en trouver plein d'autres\nDernière modification par lekokeliko (Le 18/01/2008, à 03:13)\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nSalut,\nC'est un bon debut, mais je ferai quelques remarques:\n- Tu hardcodes toutes les valeurs, en particuliers la position des cases. Ca t'enleve beaucoup de flexibilite. Tu devrais avoir une variable globale largeur de case, qui te permet de tout recalculer (au besoin, tu recalcules ton tableau c, mais a partir de cette variable).\n- On peut continuer a jouer quand le jeu est fini (normal ?), et ca ajoute des points de victoires pour tout les coups suivants\n- La fenetre nouveau jeu ne se ferme pas quand on clique sur nouveau jeu, et le bouton quitter a un comportement de fermer.\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nouép\nc'est normal c'est la version -1\nserieusement :\n1 : j'ai pas compris toute ton explication mais je sais que j'ai fait ca un peu brutalement juste avec des fonctions sans objets et avec des variables globales dans tous les sens c'est pas génial mais je suis pas super balèze en objets mais c'est prevu pour la version 3 (si j'arive jusque la)\n2 : ce point la m'embete particulièrement je ne sais pas comment bloquer la fenetre principale tant que \"oui\" ou annuler n'ai été enfoncé (pour l'instant faut le prendre en compte et pas tricher )\n3 : j'ai pas trouver la fonction qui me permet d'associer plusieurs commandes a un boutton\nj'ai fait : bout=button (........,command= fenetre.destroy and dessingrille)\nsans succès et je l'ai ue nulle part dans les tutos que j'ai 4 5 tutos mais ce truc m'énerve et c'est une des choses que je vais corriger assez vite\nautre prob pas trop génant c'est l'actualisation des noms des joueurs et des scores il faut faire nouveau jeu pour voir le score final\ndétail sur les version :\n-1 developpement\n0 stable a deux joueurs fonctionne correctement (d'ici une semaine ce serait bien correction des problèmes cités au dessus)\n1 avec AI sur 9 cases et choix jeu solo ou duel\n2 je sais pas encore ??? choix des couleurs des options stupides\n3 réecriture du code en objet\n4 pourquoi pas (si je suis encore motivé) et que j'ai le temps) faire une grille variable mais on en est pas encore la\nsinon je me suis donné ca comme projet pour apprendre le python (depuis noel) et jouer avec les GUI c'est plus drole que du code en console ^^\nj'aimerai aboutir a quelque chose d'assez fini meme si c'est un jeu débile et que ca me soule de cliquer dans tous les sens pour tester\nvoila si j'arrive a la version 1 ou 2 je serait content puis pour le code objet je vais partir sur un autre projet (j'en aurais marre du morpion^^)\nmerci pour les remarques ca fait toujours avancer les choses\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nEn fait, en ne faisant pas d'objets, tu te compliques vraiment la vie...\nprobleme 1:\nImagine que je veuille jouer a ton jeu sur mon PDA, avec un minuscule ecran. Il me faudra des cases plus petites. Ou imagines que par un gout d'esthetiques, tu ne veuilles plus faire des cases carrees, mais rectangulaires... Avec ce que tu as fait, tu dois changger une centaine d'endroits dans ton code. Alors que si tu definis largeur et hauteur, et que apres, tu fais tous tes calculs a partir de la, c'est plus facile. Un exemple:\n#!/usr/bin/python\nfrom Tkinter import *\nfen = Tk()\ncan1 = Canvas(fen,height=300,width=300)\ncan1.pack()\nfor i in range(4):\n can1.create_line(0, i*100, 300, i*100,width=3)\n can1.create_line(i*100, 0, i*100, 300,width=3)\nfen.mainloop()\n\net\n#!/usr/bin/python\nfrom Tkinter import *\nCOTE_CARRES = 100\nTAILLE_GRILLE = 3\nfen = Tk()\ncan1 = Canvas(fen,height=TAILLE_GRILLE*COTE_CARRES,width=TAILLE_GRILLE*COTE_CARRES)\ncan1.pack()\nfor i in range(TAILLE_GRILLE+1):\n can1.create_line(0, i*COTE_CARRES, TAILLE_GRILLE*COTE_CARRES, i*COTE_CARRES,width=3)\n can1.create_line(i*COTE_CARRES, 0, i*COTE_CARRES, TAILLE_GRILLE*COTE_CARRES,width=3)\nfen.mainloop()\n\nCes deux codes font la meme chose, mais dans le deuxieme, je peux faire tres facilement des grilles 5*5 avec des carres de 200pxls de cote. Dans le premier cas, c'est plus difficile.\n2- Tu peux avoir une variable partie_en_cours que tu testes avant chaque operation\n3- Tu peux lancerune function que tu cree qui fait tes 2 actions a la suite.\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nJuste une petite remarque:\nSur un forum comme ca, quand on dit le mot tuto, c'est toujours bien de mettre les adresses en disant bien, bof, ou nul et sur quoi ils portent.\nCa peut aider les suivants.\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nmerci pour ton bout de code\nen fait je devrais dès maintenant changer mon code (ca devient de plus en plus galère a lire )\npour passer a un code juste avec des variables histoire que ce soit plus simple\nmerci pour tes exemples\n2 : j'avais pas pensé a ca (en fait je fait une overdose de python je peux plus penser) mais je l'appliquerai\n3 : j'ai essayer mais seulement pour la fonction quitter le soucis c'est que je ferme aussi les fenetres a propos et joueurs au cas ou elles serait ouvertes. Mais quand elles ne sont pas ouvertes j'ai une erreur comme quoi elles ne sont pas définies (normal) je reteste demain\npour ce soir -_- --->bed\nEDIT : bonne remarque pour les tutos je les rajouterais dans le premier post\nDernière modification par lekokeliko (Le 30/12/2007, à 03:50)\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nvoila voila on passe a la version -1.07.30\nj'hésite a passer en version 0 mais je vais globaliser mes variables\naujourd'hui ma version gere la fermeture des fenetres mais aussi l'acualisation des noms de joueurs et des scores également le fait de ne pas pouvoir jouer lorsque la fenetre joueurs ou fin est ouverte\nvoila en gros pour aujourd'hui\navis aux testeurs et améliorateurs de petites choses qui pourraient etre bien\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\naujourd'hui la version -1.07.31stable la derniere version de l'année\nmodification :\n-une partie du code a été réécrite avec des variables on peu donc choisir la taille des cases et le nombre (la grille de clics a pas été changée donc ca sert a rien mais ca va venir)\n-on peut remettre les scores a 0 grace a une jolie fenetre\nun petit screen pour la route\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nDepuis 4 jours il y a eu pas mal de changement au niveau du code :\n- création d'une fenetre grille ou on peu choisir la taille des cases en pixels (défaut 100)et le nombre de cases d'un coté de la grille (défaut 3, morpion classique a 9 cases)\n-la ou je bloque (2, 3 jours maintenant) c'est au niveau des conditions de victoires\ndans mes boucles je teste toutes les cases de la grille\n-les colonnes pas de soucis pas d'erreurs\n-les lignes un petit problème de ce style\ngrille vide grille avec le meme symbole\n000 001\n000 110 les cases contenant un 1 en bordures sont considérées\n000 000 comme alignés (un peu génant)\n-les diagonales ne fonctionnent que sur des grandes grilles en générant des erreurs car je test des cases qui n'éxistent pas (génant puisque l'erreur fait que le programme quitte la boucle de test donc pas de match nul )\nMais je desespère pas (encore) ca devrait fonctionner sous peu (j'espère)\nle code des conditions de test :\n#vérification d'alignement des ronds et carres\t\ndef finjeu():\n\tglobal j, c, numerocase, compteur, vicj1,vicj2,vainqueur\n\tprint c\n\t#check lignes\n\tfor i in range(grille_taille*grille_taille-2):\n\t\tif c[i][1]==c[i+1][1]==c[i+2][1]==0 :\n\t\t\t\tvainqueur=1\n\t\t\t\tvicj1+=1\n\t\t\t\tfenetrefin()\t\t\n\t\tif c[i][1]==c[i+1][1]==c[i+2][1]==1 :\n\t\t\t\tvainqueur=2\n\t\t\t\tvicj2+=1\n\t\t\t\tfenetrefin()\n\t#check colonnes\n\tfor k in range(grille_taille*grille_taille-2*grille_taille):\n\t\tif c[k][1]==c[k+1*grille_taille][1]==c[k+2*grille_taille][1]==0 :\n\t\t\t\tvainqueur=1\n\t\t\t\tvicj1+=1\n\t\t\t\tfenetrefin()\t\t\n\t\tif c[k][1]==c[k+1*grille_taille][1]==c[k+2*grille_taille][1]==1 :\n\t\t\t\tvainqueur=2\n\t\t\t\tvicj2+=1\n\t\t\t\tfenetrefin()\n\t#check diagonales\n\tfor l in range(grille_taille*grille_taille-2*grille_taille):\n\t\tprint l,grille_taille*grille_taille,grille_taille*grille_taille-2*grille_taille\n\t\tif c[l][1]==c[l+1*grille_taille+1][1]==c[l+2*grille_taille+2][1]==0 or c[l][1]==c[l+1*grille_taille-1][1]==c[l+2*grille_taille-2][1]==0:\n\t\t\t\tvainqueur=1\n\t\t\t\tvicj1+=1\n\t\t\t\tfenetrefin()\t\t\n\t\tif c[l][1]==c[l+1*grille_taille+1][1]==c[l+2*grille_taille+2][1]==1 or c[l][1]==c[l+1*grille_taille-1][1]==c[l+2*grille_taille-2][1]==1:\n\t\t\t\tvainqueur=2\n\t\t\t\tvicj2+=1\n\t\t\t\tfenetrefin()\n\t#check nul\n\tif compteur>=(grille_taille*grille_taille):\n\t\tvainqueur=0\n\t\tprint \"Match nul\",vainqueur\n\t\tfenetrefin()\n\nHors ligne\njolivier\nRe : Tictactux jeu en Python\nbonjour je voudrai savoir quel est le symbolle: en fin de fichier ???\nHors ligne\nlekokeliko\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nSalut,\nBon, desole de te l'annonce comme ca, mais tes tests sont tous faux... donc pas etonnant que ca marche pas.\nCe qui se passe, c'est que tu testes en dehors de la grille (pour une colonne, ca va carrement en dehors de la grille, pour une ligne, ca va dans la ligne suivante)\nTa boucle va de 0 a n^2-3 (en gros, de 0 a n^2), alors qu'il n'y a que n colonnes... Et il n'y a que 2 diagonales...\nIl faut savoir ce que tu consideres comme une victoire dans le cas ou tu as une grille 4*4... Pour moi, ca serait aligner 4 cases...\nje ferai donc comme ca:\nfor i in range(grille_taille):\n victoire_1_colonne=1\n victoire_2_colonne=1\n victoire_1_ligne=1\n victoire_2_ligne=1\n for j in range(grille_taille):\n victoire_1_colonne = victoire_1_colonne * (1-c[i*taille_grille+j][1])\n victoire_1_ligne = victoire_1_ligne * (1-c[j*taille_grille+i][1])\n victoire_2_colonne = victoire_2_colonne * (c[i*taille_grille+j][1])\n victoire_2_ligne = victoire_2_ligne * (c[j*taille_grille+i][1])\n Si ici l'une des 4 variable vaut 1, c'est une victoire\n\nDernière modification par best_friend_fr (Le 04/01/2008, à 21:00)\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\ny'a pas de mal a me l'anoncer comme ca\nmais mes tests de colonne sont justes\nc'est for i in range(grille_taille*grille_taille-2*grille_taille) j'enlève les deux dernières lignes et je teste toutes les cases restantes\npour les lignes je suis d'acord ca continue les tests sur la ligne suivante\nles diagonales ca fonctionne sauf que ca sort du tableau ...\nj'ai essayé ta solution avec et sans changement cette après midi mais ca me met la fenetre de fin \"joueur .. vainqueur \" dès que je place un symbole sur la grille (au premier clic)\n(je pense que ca viens de c[numérocase][1] qui est a 2 par defaut et a 0 pour joueur 1 et a 1 pour joueur 2 ) j'aime bien le principe qui permet d'aligner 4 symboles sur une grille de 4*4\nmais elle ne fonctionne pas pour les diagonales.\nensuite sur une grille de 8*8 on va plutot chercher a aligner 4, 5 symbols plutot que 8(qui trop gros)\nmerci\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nAh oui, je vois.\nOn a pas pris les memes definitions. Toi, tu considere toujours que tu dois aligner 3 cases.\nMais comprends bien que tu as toujours autant de lignes que de colonnes. DOnc que tes 2 boucles ne soient pas symetriques me choque.\nMon systeme ne marche pas parce que je n'ai pas pris en compte le 2.\nfor i in range(grille_taille):\n victoire_1_colonne=1\n victoire_2_colonne=1\n victoire_1_ligne=1\n victoire_2_ligne=1\n for j in range(grille_taille):\n victoire_1_colonne = victoire_1_colonne * (c[i*taille_grille+j][1]==0?1:0)\n victoire_1_ligne = victoire_1_ligne * (c[j*taille_grille+i][1]==0?1:0)\n victoire_2_colonne = victoire_2_colonne * (c[i*taille_grille+j][1]==1?1:0)\n victoire_2_ligne = victoire_2_ligne * (c[j*taille_grille+i][1]==1?1:0)\n Si ici l'une des 4 variable vaut 1, c'est une victoire\n\ndevrait marcher mieux\nDernière modification par best_friend_fr (Le 04/01/2008, à 23:52)\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\npourrais tu détailler ceci\nfor j in range(grille_taille):\nvictoire_1_colonne = victoire_1_colonne * (c[i*taille_grille+j][1]==0?1:0)\nvictoire_1_ligne = victoire_1_ligne * (c[j*tai-2*grille_taillelle_grille+i][1]==0?1:0)\nvictoire_2_colonne = victoire_2_colonne * (c[i*taille_grille+j][1]==1?1:0)\nvictoire_2_ligne = victoire_2_ligne * (c[j*taille_grille+i][1]==1?1:0)\nmerci\nmes deux boucles ne sont pas identiques car je ne test pas le meme nobre de cases et pas dans le meme sens\nen ligne je teste sur range(grile_taille * grille_taile - 2) j'enlève les deux dernières cases\nen colonne sur range(grille_taille*grille_taille-2*grille_taille) j'enlève les deux dernières lignes\nles deux boucles font la meme chose mais pas sur le meme nombre d'éléments\nmerci de ton aide ca fait plaisir\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nrange(grile_taille * grille_taile - 2) j'enlève les deux dernières cases\nC'est bien ton probleme...\nTu devrais enlever les 2 dernieres cases de chaque ligne\na?b:c\nca vaut b si a est vrai et c si a est faux\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nvoici la version finale la plus aboutie j'arrete le développement a ce stade sauf si des bugs sont rapportés je les corrigerais.\ndonc je vous laisse découvrir ce morpion disponible au premier post\nhave fun\nHors ligne\nbest_friend_fr\nRe : Tictactux jeu en Python\nSalut,\nJuste un petit truc... Avec tes regles, celui qui joue en premier sur une grille plus que 3*3 gagne super facilement (en alignant ses 3 premier pions)\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nc'est vrai mais j'ai eu pas mal de difficulté avec les diagonales donc j'ai forcé un peu la chose pour terminer plus rapidement pas le courage de tout calculer (c'est dommage plus tard peu etre ou une autre personne)\nje pourrais faire une autre fonction avec 4 ou 5 égalités mais ca rajoute une fonction identique a celle existant pour 3\nc'est une chose a revoir les conditions de victoires j'aurais bien ajouté une petite case nombre de symboles a aligner dans la fenetre grille\nen fait ce qui m'importait le plus dans le morpion c'était de réaliser une interface graphique fonctionelle et propre je pense en etre pas trop loin\nmerci a toi pour ton aide\nHors ligne\nherberts\nRe : Tictactux jeu en Python\nSalut lekokeliko, juste deux petites remarques.\nAvant ça, bravo, rien à dire sur le jeu.\nPar contre, dans le \"à propos\", \"3 symboles identiques\" serait mieux, ainsi que félicitation sans s. Voilà voilà , je pouvais quand même pas dire que c'est parfait, ça t'aurait fait trop plaisir\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nmerci herberts (t'inquiete pas tu réussira aussi )\nok je corrige pour le symbole mais pas pour felicitations car on peut faire plusieurs félicitations mais on ne peut faire qu'une remarque, suggestion commentaire a la fois\nheureusement que c'est pas parfait d'ailleur c'est même très naze je me suis rendu compte de ca best_friend_fr a raison j'ai essayer de jouer sérieusement sur une grille 4*4 et 5*5 puis très vite arrêté parce que trois symboles c'est vraiment pas assez sur une grande grille\ndonc je vais essayer de \"réparer\" mon erreur mais pas dit que je m'en sorte\nessayer de mettre une cases nombre de symboles a aligner est aussi une chose qui pourrait etre faite\nvoila pour les news\nHors ligne\nherberts\nRe : Tictactux jeu en Python\nBon, ok, autant pour moi à propos des félicitations\nEt pour t'en faire plein alors, j'attendrai qu'on puisse choisir les conditions de victoires\nHors ligne\ntrucutu\nRe : Tictactux jeu en Python\nAu niveau du code, si je ne me trompe pas:\n- l.1 : préférer la syntaxe\n#!/usr/bin/env python\n\n(portabilité)\n- Préférer des docstrings aux commentaires lors de la définition de fonction\nD'une manière générale, as tu parsé ton code avec pylint ?\n- ajouter une licence, puisque le code est diffusé\netc...\nVoilà quelques petits détails qui, sans avoir testé ton programme, pourraient apporter un certaine Valeur Ajoutée\nDernière modification par trucutu (Le 06/01/2008, à 05:53)\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\na trucutu je connait pas pylint la premiere ligne c'est fait (ca sert a quoi ?)\nmais je penserait a ces petits détails de mise en forme a la fin je me suis remotivé pour finir correctement ce morpion avec le choix du nombre d'objets a aligner ce sera plus cohérent\nmais c'est compliqué\nHors ligne\nlekokeliko\nRe : Tictactux jeu en Python\nnouvelle version la 2.08.07 on peut choisir le nombre d'objets a aligner et la taille de la grille\nje suis content pour le coup\ndemain je m'attaque au choix des couleurs (pff facile après ca)\namusez vous bien\nmes conditions de victoire sont un peu bourrin mais je vais essayer d'optimiser ca aussi\nHors ligne"}}},{"rowIdx":266,"cells":{"text":{"kind":"string","value":"#2201 Le 22/02/2013, à 08:17\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\nBonjour,\nje n'apporterai pas d'aide sur les scripts, mais juste pour dire que chez moi l'intégration avec XplanetFX fonctionne parfaitement. Il y a juste un délai de quelques secondes pendant lequel la météo disparaît juste après sa mise à jour : message \"mise à jour partielle effectuée en x secondes\", effacement de l'écran météo peu après et 4~5 s plus tard apparition des données actualisées.\nJe suis en train de préparer une maj importante de start-recmeteo et meteo qui résoudra le prob.\nIl faudra alors faire tourner recmeteo en \"standalone\" composition=\"\" dans le fichier de cfg et xplanet se chargera du reste comme maintenant pour avoir qu'un seul rafraichissement du fond ATTENTION ne le faites pas maintenant.\nSurveillez ma signature top départ à v 0.999 (bin c'est toujours ps fini)\nHors ligne\n#2202 Le 22/02/2013, à 10:05\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\n@Didier\nPour toi interessant ou pas ?\n### Vérification répertoire\nif not path.exists(repsauv):\n makedirs(repsauv)\n### Sauvegarde pid \npid = str(getpid())\nf = open(repsauv+'/recmeteo.pid', 'w')\nf.write(pid)\nf.close()\n\nHors ligne\n#2203 Le 22/02/2013, à 10:53\nragamatrix\nRe : [Conky] Alternative à weather.com (2)\nBon jpdipsy va encore se moquer...\nComment arrette-ton les scripts recmeteo ?\nj'ai essayé ça\n┌─( climatix ) - ( 3.2.0-38-generic ) - ( ~/Accuweather )\n└─> start-recmeteo.sh stop\n\nMais c'est pas bon\nMême pas honte\nHors ligne\n#2204 Le 22/02/2013, à 11:01\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\nBon jpdipsy va encore se moquer...\nComment arrette-ton les scripts recmeteo ?\nj'ai essayé ça\n┌─( climatix ) - ( 3.2.0-38-generic ) - ( ~/Accuweather )\n└─> start-recmeteo.sh stop\n\nMais c'est pas bon\nMême pas honte\nkill -9 $(ps x|grep \"[r]ecmeteo.py\" |cut -d ? -f1) pour le moment\nHors ligne\n#2205 Le 22/02/2013, à 11:45\nragamatrix\nRe : [Conky] Alternative à weather.com (2)\nragamatrix a écrit :\nBon jpdipsy va encore se moquer...\nComment arrette-ton les scripts recmeteo ?\nj'ai essayé ça\n┌─( climatix ) - ( 3.2.0-38-generic ) - ( ~/Accuweather )\n└─> start-recmeteo.sh stop\n\nMais c'est pas bon\nMême pas honte\nkill -9 $(ps x|grep \"[r]ecmeteo.py\" |cut -d ? -f1) pour le moment\nMerki !\nFouillouillou bin oui j'aurais pas trouver ça tout seul ! (PA P1)\nA pluche\nHors ligne\n#2206 Le 22/02/2013, à 11:45\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\n@ carpediem,\nsimplifie ce chemin\nChemin de travail = /tmp/MeteoLua2\nen\nChemin de travail = /tmp\nsa devrais régler ton soucis a ce que je vois dans ton retour terminal.\nJ'ai fait la modif mais ça marche toujours pas je cherche mais je ne comprend pas, apparemment les chemins sont correcte\nMerci de votre aide et de votre patience\ncarpediem\nDernière modification par carpediem (Le 22/02/2013, à 11:45)\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2207 Le 22/02/2013, à 12:19\nPhyllinux\nRe : [Conky] Alternative à weather.com (2)\n@ carpediem :\nAs tu regardé si tu avais le paquet qui semait la pagaille chez moi : python3-notify2\nCela a débloqué une situation un peu identique à la tienne\nThe ship is sinking normally...\nHors ligne\n#2208 Le 22/02/2013, à 12:22\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\n@ carpediem :\nAs tu regardé si tu avais le paquet qui semait la pagaille chez moi : python3-notify2\nCela a débloqué une situation un peu identique à la tienne\nEn effet il est bien installé\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2209 Le 22/02/2013, à 12:22\nDidier-T\nRe : [Conky] Alternative à weather.com (2)\n@Didier\nPour toi interessant ou pas ?\n### Vérification répertoire\nif not path.exists(repsauv):\n makedirs(repsauv)\n### Sauvegarde pid \npid = str(getpid())\nf = open(repsauv+'/recmeteo.pid', 'w')\nf.write(pid)\nf.close()\n\nen fait j'avais déjà regardé sa, mais je n'ai pas encore trouvé de façon d'exploité l'information avec conky, ou meteo.lua, le soucis viens du fait que pour fermer ces processus on les kill.\npour ton projet en bash, sa doit pouvoir se faire (a condition d'avoir un script d'extinction et qu'il soit utilisé).\nHors ligne\n#2210 Le 22/02/2013, à 12:23\n#2211 Le 22/02/2013, à 12:25\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\nVoici le retour terminal\ncarpediem ~$ conky -c /home/claude/Scripts/MeteoLua2/conkyrc-meteo\nConky: forked to background, pid is 21610\ncarpediem ~$ \nConky: desktop window (1e0017b) is subwindow of root window (62)\nConky: window type - override\nConky: drawing to created window (0x4e00001)\nConky: drawing to double buffer\nFontconfig warning: \"/etc/fonts/conf.d/50-user.conf\", line 9: reading configurations from ~/.fonts.conf is deprecated.\n version = v1.02\n web = http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\n Pévision Nb jours = 10 \n Pévision Matin = oui\n Pévision Après Midi = oui\n Pévision Soirée = oui\n Pévision Nuit = oui\n Prévision sur 8 heures = oui\n nbFoisHuit= 1\n Délais = 10\n Chemin de travail = /tmp\n Palier = 20\n Chemin de sauvegarde = /home/claude/Scripts/MeteoLua2/sauvegardes\n Chemin script = /home/claude/Scripts/MeteoLua2/Scripts \n Notification = oui\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\nConky: llua_do_call: function conky_Meteo_horsligne execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:368: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: No such file or directory\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\nConky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_QPluie execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:894: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_Humidite didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_HLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1009: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1013: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_HCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1021: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1025: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_CondMeteo didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:728: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_VentForce didn't return a string, result discarded\nConky: llua_getstring: function conky_Meteo_VentDirP didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value) \nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value) \ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type \n/usr/bin/python3: can't find '__main__' module in '/home/claude/Scripts/MeteoLua2/Scripts'\nlunaison Ok\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\nConky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_QPluie execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:894: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_Humidite didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_HLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1009: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1013: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_HCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1021: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1025: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_CondMeteo didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:728: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_VentForce didn't return a string, result discarded\nConky: llua_getstring: function conky_Meteo_VentDirP didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\nConky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_QPluie execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:894: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_Humidite didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_HLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1009: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1013: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_HCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1021: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1025: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_CondMeteo didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:728: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_VentForce didn't return a string, result discarded\nConky: llua_getstring: function conky_Meteo_VentDirP didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\ndate: /home/claude/Scripts/MeteoLua2/sauvegardes/CC: Aucun fichier ou dossier de ce type\nConky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_QPluie execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:894: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_Humidite didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_HLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1009: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MLeverSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1013: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_HCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1021: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_MCoucherSoleil execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:1025: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_CondMeteo didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:728: attempt to index field '?' (a nil value)\nConky: llua_getstring: function conky_Meteo_VentForce didn't return a string, result discarded\nConky: llua_getstring: function conky_Meteo_VentDirP didn't return a string, result discarded\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_IconeM execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:906: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:854: attempt to index field '?' (a nil value)\nConky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /home/claude/Scripts/MeteoLua2/Scripts/meteo.lua:941: attempt t\n\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2212 Le 22/02/2013, à 12:44\nDidier-T\nRe : [Conky] Alternative à weather.com (2)\n@ carpediem,\nessaye ceci, et donne le retour, merci.\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nnbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=oui\n\nHors ligne\n#2213 Le 22/02/2013, à 12:54\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\njpdipsy a écrit :\n@Didier\nPour toi interessant ou pas ?\n### Vérification répertoire\nif not path.exists(repsauv):\n makedirs(repsauv)\n### Sauvegarde pid \npid = str(getpid())\nf = open(repsauv+'/recmeteo.pid', 'w')\nf.write(pid)\nf.close()\n\nen fait j'avais déjà regardé sa, mais je n'ai pas encore trouvé de façon d'exploité l'information avec conky, ou meteo.lua, le soucis viens du fait que pour fermer ces processus on les kill.\npour ton projet en bash, sa doit pouvoir se faire (a condition d'avoir un script d'extinction et qu'il soit utilisé).\nvi\nkill -9 $(cat $repsauv/recmeteo.pid)\nedit : naturellement suivi de rm $repsauv/recmeteo.pid\nredit : et dans le pire des cas dans recmeteo tu peux mettre en place une verification qui lit le num du pid sauvegardé et tué l'ancien\nDernière modification par jpdipsy (Le 22/02/2013, à 13:06)\nHors ligne\n#2214 Le 22/02/2013, à 12:57\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\n@ carpediem,\nessaye ceci, et donne le retour, merci.\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nnbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=oui\n\ncarpediem ~$ python3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nTraceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 175, in activate_name_owner\n return self.get_name_owner(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 361, in get_name_owner\n 's', (bus_name,), **keywords)\n File \"/usr/lib/python3/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\ndbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.freedesktop.Notifications': no such name\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/home/claude/Scripts/MeteoLua2/Scripts/recmeteo.py\", line 317, in \n notify2.init('Recmeteo.py')\n File \"/usr/lib/python3/dist-packages/notify2.py\", line 96, in init\n '/org/freedesktop/Notifications')\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 241, in get_object\n follow_name_owner_changes=follow_name_owner_changes)\n File \"/usr/lib/python3/dist-packages/dbus/proxies.py\", line 248, in __init__\n self._named_service = conn.activate_name_owner(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 180, in activate_name_owner\n self.start_service_by_name(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 278, in start_service_by_name\n 'su', (bus_name, flags)))\n File \"/usr/lib/python3/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\ndbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files\ncarpediem ~$ nbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=oui\n\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2215 Le 22/02/2013, à 13:03\n#2216 Le 22/02/2013, à 13:26\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\n@Carpediem\nessai le meme lancement de recmeteo mais sans notify\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nnbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10\n\net fait voir le retour\nHors ligne\n#2217 Le 22/02/2013, à 14:20\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\n@Didier-T python3-dbus est intallé\n@Carpediem\nessai le meme lancement de recmeteo mais sans notify\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nnbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10\n\net fait voir le retour\ncarpediem ~$ python3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054\nTraceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 175, in activate_name_owner\n return self.get_name_owner(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 361, in get_name_owner\n 's', (bus_name,), **keywords)\n File \"/usr/lib/python3/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\ndbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.freedesktop.Notifications': no such name\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/home/claude/Scripts/MeteoLua2/Scripts/recmeteo.py\", line 317, in \n notify2.init('Recmeteo.py')\n File \"/usr/lib/python3/dist-packages/notify2.py\", line 96, in init\n '/org/freedesktop/Notifications')\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 241, in get_object\n follow_name_owner_changes=follow_name_owner_changes)\n File \"/usr/lib/python3/dist-packages/dbus/proxies.py\", line 248, in __init__\n self._named_service = conn.activate_name_owner(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 180, in activate_name_owner\n self.start_service_by_name(bus_name)\n File \"/usr/lib/python3/dist-packages/dbus/bus.py\", line 278, in start_service_by_name\n 'su', (bus_name, flags)))\n File \"/usr/lib/python3/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\ndbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files\ncarpediem ~$ nbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10\ncarpediem ~$\n\nDernière modification par carpediem (Le 22/02/2013, à 14:21)\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2218 Le 22/02/2013, à 14:28\nDidier-T\nRe : [Conky] Alternative à weather.com (2)\ncarpediem, il s'agit d'une seul ligne de commande, je vois que tu la coupe en deux.\npar contre on vas passer notify=non, comme la suggéré jpdipsy.\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054 nbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=non\n\nHors ligne\n#2219 Le 22/02/2013, à 14:40\nPhyllinux\nRe : [Conky] Alternative à weather.com (2)\n@ jpdipsy :\nHier, le script lancé par XPlanet ne se rafraîchissait pas, mais aujourd'hui, alors que je n'ai rien modifié, il ne se lance plus.\nPas d'affichage de la météo en surcouche dans le fond d'écran de XPlanet.\nEDIT :\nLe script start-recmeteo.sh lancé 'a la mano' fonctionne cependant, mais pas celui lié à XPlanet.\nDernière modification par Phyllinux (Le 22/02/2013, à 14:42)\nThe ship is sinking normally...\nHors ligne\n#2220 Le 22/02/2013, à 15:06\njpdipsy\nRe : [Conky] Alternative à weather.com (2)\n@ jpdipsy :\nHier, le script lancé par XPlanet ne se rafraîchissait pas, mais aujourd'hui, alors que je n'ai rien modifié, il ne se lance plus.\nPas d'affichage de la météo en surcouche dans le fond d'écran de XPlanet.\nEDIT :\nLe script start-recmeteo.sh lancé 'a la mano' fonctionne cependant, mais pas celui lié à XPlanet.\nJe sais j'ai mis le boxon dans les scripts moi ma bécane à flambée fais gaffe\nJe blague bien évidement je vous met les scripts en fin d'AM je pense\nHors ligne\n#2221 Le 22/02/2013, à 16:21\ncarpediem\nRe : [Conky] Alternative à weather.com (2)\ncarpediem, il s'agit d'une seul ligne de commande, je vois que tu la coupe en deux.\npar contre on vas passer notify=non, comme la suggéré jpdipsy.\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054 nbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=non\n\n@ jpdipsy, @Didier-T un grand MERCI mes conkys fonctionnent.\nEncore une petit souci pour le graphique de la pression et de la température qui ne fonctionne toujours pas.\nencore merci pour ce magnifique travaille\nCordialement\ncarpediem\n\"Carpe diem quam minimum credula postero\"\n(Cueille le jour présent, en te fiant le moins possible au lendemain.)\nHORACE\nHors ligne\n#2222 Le 22/02/2013, à 16:33\nPhyllinux\nRe : [Conky] Alternative à weather.com (2)\n@ jpdipsy :\nJe suis en train de travailler sur mon module à afficher.\nSur ton baromètre, je vois affiché (en bas) H.R. et un pourcentage. Je pense qu'il s'agit du taux d'humidité ?\nOr, dans ton module, je ne vois jamais comment est appelée cette valeur.\nOr, en ce qui me concerne, je fais afficher l'icône de la condition du moment, et du coup, je voudrais faire disparaître cet affichage H.R. : XX%. Où dois je supprimer cette partie de code.\nToujours sur le baromètre, comment changer la couleur de la flèche, qui est en bleu, et que je voudrais plutôt en noir. Car je ne vois nulle part dans ton script de partie sur la création du baromètre.\nMerci\nThe ship is sinking normally...\nHors ligne\n#2223 Le 22/02/2013, à 16:52\nragamatrix\nRe : [Conky] Alternative à weather.com (2)\n@ jpdipsy :\nJe suis en train de travailler sur mon module à afficher.\nSur ton baromètre, je vois affiché (en bas) H.R. et un pourcentage. Je pense qu'il s'agit du taux d'humidité ?\nOr, dans ton module, je ne vois jamais comment est appelée cette valeur.\nOr, en ce qui me concerne, je fais afficher l'icône de la condition du moment, et du coup, je voudrais faire disparaître cet affichage H.R. : XX%. Où dois je supprimer cette partie de code.\nToujours sur le baromètre, comment changer la couleur de la flèche, qui est en bleu, et que je voudrais plutôt en noir. Car je ne vois nulle part dans ton script de partie sur la création du baromètre.\nMerci\nSalut\nEn fait je crois qu'avec ce barometre les aiguilles changent de couleur en fonction de la tendance.\nPour HR humidité relative je crois que c'est dans le script meteo vers ligne:382\n#ajouter la tendance\nconvert $Barometre/base.png -background transparent -font $fonte -pointsize 45 -gravity South \\\n -stroke white -strokewidth 2 -annotate +0+110 \"H.R: $HR %\" \\\n -stroke none -fill blue -annotate +0+110 \"H.R: $HR %\" \\\n $reptemp/Barometre.png\ncomposite -compose Over -gravity Center $reptemp/aiguille_rot.png $reptemp/Barometre.png $reptemp/Barometre.png\nmogrify -resize $taille! $reptemp/Barometre.png\ncomposite -blend 0x$opacite null: $reptemp/Barometre.png -matte $reptemp/Barometre.png\n\nHors ligne\n#2224 Le 22/02/2013, à 17:02\nPhyllinux\nRe : [Conky] Alternative à weather.com (2)\nOK, merci pour ces infos.\nEn fait je ne cherchais que dans le script macomposition.sh, d'où le fait que je trouvais pas.\nPour la couleur de la flèche, je confirme car, de bleu, elle vient de passer à rouge toute seule !\nThe ship is sinking normally...\nHors ligne\n#2225 Le 22/02/2013, à 17:15\nDidier-T\nRe : [Conky] Alternative à weather.com (2)\nDidier-T a écrit :\ncarpediem, il s'agit d'une seul ligne de commande, je vois que tu la coupe en deux.\npar contre on vas passer notify=non, comme la suggéré jpdipsy.\npython3 ~/Scripts/MeteoLua2/Scripts/recmeteo.py repsauv=~/Scripts/MeteoLua2/sauvegardes adressWeb=http://www.accuweather.com/fr/fr/stiring-wendel/135054/weather-forecast/135054 nbJour=10 matin=oui apresmidi=oui soiree=oui nuit=oui huitHeures=oui nbFoisHuit=1 interval=10 notify=non\n\n@ jpdipsy, @Didier-Tun grandMERCImes conkys fonctionnent.\nEncore une petit souci pour le graphique de la pression et de la température qui ne fonctionne toujours pas.\nencore merci pour ce magnifique travaille\nCordialement\ncarpediem\nil faudrait que tu me re-fournisse tes scripts, la position a changé pour les données (la facon de les récupérer aussi)\nJe me demande si je vais pas virer la notification, trop de soucis, pour un intérêt limité (enfin a mon gout)\nHors ligne"}}},{"rowIdx":267,"cells":{"text":{"kind":"string","value":"doudoulolita\nFaire une animation sur la création de jeux vidéo libres\nDans le topic Création de jeu vidéo libre - Appel à candidatures, j'ai découvert le créateur de jeu de Ultimate Smash Friends, Tshirtman.\nVoici ce que je lui ai écrit:\nJe cherche un jeu que notre Espace Public Numérique pourrait proposer aux jeunes sur Linux, voire les inciter à participer au projet de développement. smile\nMais j'ai du mal à installer Ultimate smash friends chez moi sur Ubuntu Studio Jaunty... mad\nLe lien du paquet en .deb sur http://usf.tuxfamily.org/wiki/Download#Requirements ne fonctionne pas.\nJ'ai finalement trouvé le paquet en .deb sur cette page en suivant le lien indiqué au bas de la précédente (ouf !).\nMais à l'install avec Gdebi, il m'indique qu'il manque python-support.\nPourtant, j'ai vérifié que j'avais python (version 2.6, faut-il la version 2.3 ?) et j'ai installé python-pygame juste avant.\npython-support est bien installé (j'ai vérifié dans synaptic), alors ?\nC'est le genre de problème qui n'incitera pas les jeunes à se mettre sous Linux, ça, le moindre effort leur est insupportable, les pauvres chéris... cool\nLa page d'Ultimate-smash-friends destinée aux développeurs fait un peu peur ! Je dois avouer que moi qui aime dessiner (en utilisant Gimp, Inkscape mais je tate aussi de la 3D avec Blender), j'aimerais participer à titre individuel, mais je n'y comprends goutte !\nLa discussion s'est poursuivie sur Ultimate Smash Friends: un smash bros like en python\nComme le sujet semblait intéresser plusieurs personnes, je propose de continuer la conversation sur la façon de mener cette animation ici.\nVoici où m'avait menée ma réflexion:\nAnimation: programmation\nTrouver une animation permettant d'aborder les notions de base de la programmation, outre ses composantes graphiques, me paraît intéressant, à terme. cool\nEn tout cas, l'idée reste de travailler sous Linux et en logiciel libre. Donc XNA, on oublie, désolée LittleWhite. wink\nL'idée d'un saut pourraît être sympa si ce n'est pas trop complexe, mais on pourrait imaginer des animations progressives et variables suivant l'âge, le niveau et le degré de motivation des jeunes.\nOn a seulement 2 gamins qui pourraient comprendre et apprécier l'aspect mathématique de la programmation , tandis que les autres risquent d'être vite découragés.\nIl faudra plus graphique ou plus simple pour ceux-là (même moi, les fonctions Sinus et Cosinus, j'ai oublié et je n'aimais pas ça quand j'étais jeune! wink)\nMais je vois la possibilité d'animation par étapes de plus en plus complexes:\n1 - sous Tuxpaint, il y a un des jeux qui permet de réaliser une petite animation en faisant bouger le personnage.\n2 - Sous Kturtle, on fait la même chose mais en code pour déplacer la tortue.\n3 - Décomposition graphique du saut - Réalisation des images sur Gimp (ou un programme encore plus simple pour les 8-9 ans), Inkscape ou Blender.\n4 - Créer un gif animé placé sur un décor (en HTML avec CSS pour le background)\n5 - Afficher les images des étapes à l'aide d'une boucle (PHP ?)\n6 - Présenter le langage de programmation contenu dans USF et comment ça fonctionne (moteur de jeu et tout ce que je ne connais pas encore...).\n7 - Lire et tenter de comprendre une partie de code dans USF correspondant à un saut.\nInitiation au Python:\nIl y a peut-être plus simple que le saut, pour démarrer ?\nVoici les étapes possibles si on veut en arriver là:\n1 - Faire glisser le personnage suivant un seul axe.\n2 - Puis sur 2 axes (on glisse sur l'axe Y, on saute tout droit sur l'axe Z et on retombe).\n3 - Ensuite, on utilise 2 images pour la marche, ou 1 pour le glissement axe Y et 1 autre pour le saut axe Z\n4 - Montrer les courbes sinusoïdale d'un vrai saut dans Blender, etc...\nJe ne sais pas si Kturtle permet d'initier à ces courbes, mais ce serait peut-être plus simple qu'avec Python, non ?\nPython\nJe n'ai pas encore mis les mains et la tête dans Python mais je viens de prendre quelques bouquins à la bibliothèque sur le sujet. Je ne connais pour l'instant que des bribes de PHP et me contente d'essais simples (Mod'imprim ou, encore en phase test Multitours).\nJe n'ai meme pas encore utilisé pour mes essais une base MySQL, je vais me lancer bientôt (je connais un peu vu qu'on va parfois trafiquer directement dans notre base de donnée au boulot, pour quelques corrections).\nJ'espère que j'y arriverai en python, et si moi j'y arrive, tout le monde peut y arriver ! tongue\nFaire un jeu texte avec des enfants et des ados me semble impossible dans notre EPN, Tshirtman. Les notres sont difficiles à motiver. mad\nJouer, jouer, jouer, d'accord de leur côté, mais participer à une vraie animation construite et sur une certaine durée c'est beaucoup plus difficile pour notre public. sad\nKturtle\nJ'ai trouvé moi aussi de mon côté des programmes pour enfants permettant d'apprendre ou tout au moins d'aborder la programmation, basés sur le langage Logo.\nKturtle a effectivement l'avantage d'être très facile à installer (dispo dans les sources de Kubuntu et d'Ubuntu). J'ai plus de mal avec Xlogo ou Tangara.\nC'est peut-être un point de départ avant de passer à + compliqué. Mais on m'a dit que Logo était un peu dépassé, dans le genre langage de programmation très accessible. Qu'en pensez-vous ?\nProblèmes d'installation\nJe confirme que le paquet .deb que m'a proposé Tshirtman ne veut pas s'installer avec Gdebi sur ma Ubuntu Studio Jaunty. Il y a des dépendances brisées me dit-il.\nJ'essaierai plus tard l'autre solution, mais avec les gamins, faudra bien sûr que ce soit simple à installer, sous Linux comme sous Windows.\nNotez que chez nous, les gamins n'ont pas forcément Vista quand ils ont leur propre ordi car ils récupèrent souvent de vieux ordis sous XP ou pire encore. On n'en a aucun qui ait installé Linux pour l'instant, il n'y a qu'à notre EPN qu'ils le voient tourner, et le manque de jeux de haute qualité les fait tiquer.\nC'est justement là l'intérêt de travailler un jeu libre avec eux, en plus de chercher d'autres jeux libres plus perfectionnés peut-etre, mais moins faciles d'accès que USF pour des animations sur la programmation et/ou le design de jeux.\nEn tout cas, ça n'empêche pas de commencer des animations avant que le jeu soit parfait et facile à installer sur toutes les plateformes et versions, puisque nous les animateurs, on peut s'embêter avec une install plus compliquée.\nOn expliquera que pour l'installer chez eux (pour ceux qui ont un ordi), il faudra attendre un peu que les programmeurs bossent encore.\nMes collègues ont été mis tout récemment sur le coup, lors d'une réunion et je leur ai envoyé les liens seulement hier, donc c'est encore jeune comme projet.\nDernière modification par doudoulolita (Le 24/04/2010, à 17:09)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nbump\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nle problème c'est que l'approche de la boucle est fondamentalement fausse, elle n'a pas de sens dans la réalité d'un jeu vidéo, donc il ne faut pas la présenter à mon avis, ni toute autre solution aussi fausse, avoir expliqué le concept de la boucle de jeu permettrait normalement aux enfants d'en trouver une meilleur (ou moins fausse) directement, autant ne pas les embrouiller.\nBon, je reprendrai les étapes après avoir lu un peu sur la conception de jeux et la programmation, pour ne pas faire d'erreurs.\nMais dans les exemples de Kturtle, j'ai vu un truc qui me semble ressembler:\ninitialiserépète 3 [ avance 100 tournegauche 120]\nEst-ce que ce n'est pas une sorte de boucle ?\nDernière modification par doudoulolita (Le 24/04/2010, à 17:21)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nVoici le code que j'ai fait lors d'un essai avec Turtle:\ninitialise\ntaillecanevas 300,300\ncouleurcanevas 125,10,125\nlèvecrayon\nva 150,120\nrépète 18 {\nbaissecrayon\navance 10\nlèvecrayon\navance 10\ntournedroite 20\n}\nattends 1\nva 20,20\nécris \"J'ai fait tourner la tortue\"\ntournedroite 90\navance 200\nattends 1\nva 60,170\nattends 1\nrépète 18 {\nbaissecrayon\navance 10\nlèvecrayon\navance 10\ntournedroite 20\n}\nva 150,250\ntournegauche 90\nécris \"et de 2 !\"\ntournedroite 90\navance 100\nattends 1\nmessage \"C'est fini !\"\ninitialise\ntaillecanevas 300,300\ncouleurcanevas 125,10,125\ncentre\n\nC'est dommage que l'on ne puisse pas enregistrer sous forme de gif animé et que j'aie du mal à ouvrir le fichier .turtle à partir de l'explorateur.\nCe qui est super, c'est que la doc en ligne est en français et très simple à comprendre.\nIl y a quelques différences en fonction des versions: contrairement à ce quei est écrit sur la doc, je ne peux pas enregistrer comme page html mais comme une image en png.\nMais c'est déjà sympa si on pense à supprimer les dernières lignes du code bas du code (depuis message jusqu'à centre)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJe viens de commencer à apprendre Python en suivant le début du livre \"Initiation à la programmation avec Pyton et C++\" de Yves Bailly, éditions Pearson (2008).\nSur la capture d'écran ci-dessous, on voit le fichier dans l'explorateur de fichiers, l'éditeur de texte (kate) où on a écrit le programme qu'on a enregistré sous le nom python1.py et la console (toute noire toute triste, pour l'instant ) où on lance l'interpéteur python puis notre fichier python1.py par cette ligne de commande:\npython python1.py\nLe résultat s'affiche juste en dessous, dans la console, après avoir appuyé sur la touche \"Entrée\" du clavier.\nFinalement, ça commence assez facilement (d'autant que je connais déjà certains principes grâce à PHP). Il n'y a rien à installer sous Ubuntu car Python est inclus.\nLe résultat peut même être un peu graphique comme on le voit ici, en utilisant tirets et astérisques, entre autres signes.\nL'important est de bien écrire les lignes de code dans l'éditeur de texte, d'enregistrer puis de lancer la commande python python1.py dans la console + touche entrée pour voir le résultat.\nENCODAGE\nLa première ligne indique l'encodage utilisé, ici utf-8\nCHAÎNE\nAu début, j'ai utilisé des chaines, c.à.d des suites de caractères qu'on met entre guillemets ou entre apostrophes:\nex: \"Bonjour, Tshirtman !\"\nINSTRUCTION print\nPour que cette chaîne s'affiche, on utilise l'instruction print\nprint \"Bonjour, Tshirtman !\"\n\nVARIABLES\nle jeu est la première variable. On la définit par:\njeu_1 = \"Ultimate Smash Friends\"\nPour afficher le nom de jeu, je pourrai écrire:\nprint jeu_1\n\nLe résultat sera:Ultimate Smash Friends\nSi je remplace \"Ultimate Smash Friends\" par \"Kturtle\" dans la définition de la variable jeu_1, le résultat sera:Kturtle\nLes personnages sont les autres variables. On les définit par:\nperso_1 = \"BiX\"perso_2 = \"Blob\"\nPour afficher le nom des 2 personnages, je pourrai écrire:\nprint perso_1\nprint perso_2\n\nLe résultat sera BiXBlob\nCONCATÉNATION\nJe peux mettre tout ça à la suite les uns des autres en utilisant le signe +\nprint \"les personnages de \" + jeu_1 + \" sont \" + perso_1 + \" et \" + perso_2\n\nrésultat:les personnages de Ultimate Smash Friends sont BiX et Blob\nSÉPARATEUR EN TIRETS\nMon programme python1.py est assez complexe car il définit aussi une fonction permettant de faire des lignes de séparation en astériques et en tirets.\nJe ne donnerai pas ici tous les détails, trop complexes pour démarrer.\nMais voici comment réaliser une ligne composée de tirets uniquement (ou d'astérisques ou tout autre signe); c'est assez simple.\nPour compliquer et parvenir à mon résultat (c'est possible, même sans définir de fonction), vous devrez réfléchir un peu !\nLe principe, c'est de multiplier le tiret par le nombre de fois qu'on veut voir ce tiret apparaître.\nLe tiret est en fait une chaine d'1 seul caractère, donc on doit la mettre entre apostrophes au lieu de guillemets.\nsoit: '-'\nEnsuite, on utilise * pour effectuer la multiplication.\nPuis on met un chiffre assez grand pour que la ligne de tirets soit assez longue. 80 tirets, c'est pas mal, non ?\nLe code sera donc:\nprint '-'*80\n\nSi on veut changer ce chiffre de 80 par un autre facilement, le mieux serait de le transformer en variable nommée nb_tirets\nEXERCICE\nDéfinissez la variable nb_tirets qui représentera le nombre de tirets composant la ligne.\nImaginez la manière de coder pour faire une ligne de 20 tirets, en changeant juste la valeur de la variable.\nPuis faites une ligne de 20 astérisques.\nPuis concaténez (= aditionnez) les deux.\nRépétez 3 fois (on peut multiplier le code précédent par 3 en le mettant entre parenthèses).\nBon codage !\nDernière modification par doudoulolita (Le 25/04/2010, à 13:39)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nLe code est encore bien compliqué car je ne sais pas encore lister automatiquement mes personnages, mais j'utilise des fonctions définies en haut du code, que j'appelle ensuite au sein du programme.\nIl y a un petit problème d'encodage des accents quand je regarde ma page de code dans Firefox, mais chez moi, ça fonctionne comme il faut.\nTout ça ne bouge pas beaucoup, mais le côté graphique est amené progressivement.\nSi on veut faire une ligne de tirets en pouvant changer ensuite le nombre, on met ce nombre comme variable:\nnb_tirets = 80\nprint '-'*nb_tirets\n\nJe rappelle que le tiret doit être mis entre apostrophes puisqu'il s'agit d'une chaine d'un seul caractère.\nIl suffira de changer le chiffre 80 par un autre pour avoir une ligne plus courte ou plus longue.\nFONCTION\nMais on peut être amené à réutiliser plusieurs fois ce bout de code, en changeant à chaque fois le nombre de tirets, ce qui oblige à redéfinir la variable à chaque fois et à recopier tout ce code, pas évident !\nSi on accumule plusieurs instructions pour un même objet et qu'on a besoin plusieurs fois du même bout de code, une fonction sera vraiment très utile. Le programme fera appel à elle chaque fois qu'il en aura besoin puis reviendra dans le cours normal des instructions.\nOn va donc définir une fonction pour ce bout de code dessinant une ligne composée d'un nombre précis de tirets successifs, ce qui permettra de l'appeler ensuite quand on veut:\ndef Tirets(nb_tirets):\n chaine_tirets = '-'*nb_tirets\n return chaine_tirets\n\nNe pas oublier les 2 points après la parenthèse donnant l'argument de la fonction (c.à.d nb_tirets) et les tabulations avant chaine_tirets et return. Ce sont ces indentations (faites avec la touche Tab, dans Kate) qui indiquent que l'on est en train de définir la fonction.\nL'instruction return permet de faire un calcul, par exemple, sans l'afficher tout de suite.\nQuant on appelle cette fonction Tirets au sein du programme, on note entre parenthèses le nombre de tirets désiré. On doit mettre l'instruction print dans le programme avant le nom de la fonction car l'instruction return, présente dans la fonction, n'affiche rien. Cela donnera 80 tirets puis 30 tirets:\nprint Tirets(80)\nprint Tirets(30)\n\nSUGGÉRER UN ROCHER\nUn rocher est constitué du tiret vertical | (touche 6 + AltGr) au début et à la fin, et d'un nombre variable de tirets (touche 6, sans autre touche). La façon de réaliser un rocher est définie dans la fonction Rocher(nb_tirets).\ndef Rocher(nb_tirets):\n chaine_tirets = '|' + '-'*nb_tirets + '|'\n return chaine_tirets\n\nJe rappelle de nouveau que le tiret et le tiret vertical doivent être mis entre apostrophes puisqu'il s'agit pour chacun d'une chaine d'un seul caractère.\nIl faudra bien sûr appeler la fonction Rocher par l'instruction print Rocher(10) ou print Rocher(5) au sein du code en indiquant le nombre de tirets désirés (dans notre exemple: 10 ou 5) comme argument.\nESPACER LES ROCHERS\nEntre les rochers, il y a des espaces successifs appelés par la fonction Vide, avec en argument le nombre d'espaces (touche espace du clavier, tout bêtement).\ndef Vide(nb_espace):\n chaine_vide = ' '*nb_espace\n return chaine_vide\n\nCette fonction est même plus simple que pour réaliser un rocher ! Il faut juste penser à mettre un espace entre les apostrophes de la chaine.\nLa 1ère ligne de rochers comprend donc des vides de taille différente et des rochers de taille différente.\nprint Vide (3) + Rocher(5) + Vide(10) + Rocher(10) + 2*(Vide(5) + Rocher(5)) + \"\\n\"\n\nOn note que la succession d'un vide de 5 espaces et d'un rocher de 5 tirets est appelée 2 fois (en multipliant le contenu de la parenthèse par 2) comme ci-dessous:\n- Succession d'un vide de 5 espaces et d'un rocher de 5 tirets:\nprint Vide(5) + Rocher(5)\n\n- La même chose appelée 2 fois:\nprint 2*(Vide(5) + Rocher(5))\n\n2ème LIGNE DE ROCHERS\nPour la 2ème ligne de rochers, au lieu de changer la taille des vides \"à la main\", j'ai additionné le chiffre avec un autre au sein de la parenthèse de la fonction Vide, ou soustrait un nombre d'espaces au premier chiffre.\n- 1er vide de la 1ère ligne, de 3 espaces:\nprint Vide (3)\n\n- 1er vide de la 2ème ligne, de 3 espaces supplémentaires, soit 6 espaces:\nprint Vide (3+3)\n\n- 2ème vide de la 1ère ligne, de 10 espaces. Note : Pour cet exemple, l'instruction print ne se met que si vous faites l'essai isolé, sinon il faut concaténer avec le symbole + la ligne de code précédente avec celle-ci :\nprint Vide(10)\n\n- 2ème vide de la 2ème ligne, de 7 espaces en moins, soit 3 espaces restants:\nprint Vide(10-7)\n\nIl semble logique de ne pas changer la taille des rochers.\nSYMBOLISER LES PERSONNAGES\nAu-dessus des rochers, on a fait une ligne où chaque personnage est représenté par une lettre, rappelant sa forme dans le jeu.\nBiX = O Blob = A Stick = I\nIl y a des vides appelés par la fonction Vide entre les personnages (leur lettre) et un saut de ligne noté \"\\n\" à la fin de la ligne, code que vous avez remarqué seul dans le fichier à d'autres endroits, concaténé en fin de lignes.\nprint Vide(5) + perso_1 + Vide(15) + perso_2 + Vide(8) + perso_3 + \"\\n\"\nprint \"\\n\"\n\nDernière modification par doudoulolita (Le 25/04/2010, à 13:27)\nHors ligne\npsychederic\nRe : Faire une animation sur la création de jeux vidéo libres\nSi vous savez programmer , vous pouvez faire des programmes dans lequel, il n'y a plus besoin de programmer. (laissons la programmation à ceux que ca interresse des huluberlus comme nous, qui ne serons jamais la majorité de la population : point)\nPourquoi pas : a la fois du mba vers lua, et du devellopement tout graphique ( comme le jeu spore par exemple et le tout avec les avantages du libre , et d'une base de donnée de ressource libre)\nPar exemple, dans un premier temps utiliser syntensity, ou refaire un \"jeu complet\" mugen like avec paintown, c'est peut être ce que cherche les gens : et c'est à leur portée.\n( je note aussi qu'il manque aussi une partie scenario, que j'essairai de compléter )\nhttp://doc.ubuntu-fr.org/developpement_de_jeux_video\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\n@doudoulolita: eh ben! sacré démarrage heureux de voir que je t'inspire, j'ai un peu survolé tes explications, tu semble prendre les choses dans le bon sens bonne continuation\n@psychedric: bizarrement les tentatives pourtant souvent réalisées par des programmeurs très compétends, de créations de langages tout graphiques, n'ont rien donné de très utilisable, en effet, exprimer la même chose avec des boutons et des graphiques qu'avec des mots clées et des suites d'ordres, s'avère être contre productif, il est vrai que la majeur partie de la population ne sera jamais développeur, mais ça ne vient pas du langage utilisé, en fait, il semble qu'on puisse aisément déterminer qui sera potentiellement programmeur et qui ne le sera pas, par un simple test, avant même d'avoir enseigné les bases… ça peut paraitre élitiste, mais c'est malheureusement le cas, enfin être formé à la programmation semble être absoluement insuffisant pour s'assurer d'être un vrai développeur…\nhttp://www.codinghorror.com/blog/archives/000635.html\nhttp://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html\n(et dans les deux, une bonne myriade de liens très instructifs)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nMerci pour les liens que j'irai voir prochainement.\nDans mon optique, il ne s'agit pas que tous les jeunes et toutes les personnes à qui nous proposerions une telle animation deviennent de vrais développeurs.\nLe but du jeu est juste d'aborder, de faire découvrir la programmation pour que les jeunes comprennent de quoi il s'agit, et qu'ils puissent voir si ça leur plaît vraiment (au cas où ils rêvent de créer des jeux vidéos).\nIl y a aussi la partie graphique, dans un jeu vidéo qui peut être abordée en participant au développement d'un jeu comme Ultimate Smash Friends\n<- Sorlo\nAujourd'hui, j'ai montré Ultimate Smash Friends et mon personnage Sorlo à mon neveu qui vient tout juste d'avoir 11 ans et cela lui a donné envie d'en créer un lui aussi.\nMon neveu dessine plutôt bien et à plein d'idées. Il adore utiliser ma tablette graphique et commence à s'habituer à Gimp (il a Photoshop sur Mac, chez lui, mais il n'y fait pas beaucoup d'ordi). Aujourd'hui, il a griffonné quelques croquis très sympas et il ne parvenait plus à s'arrêter tellement ses idées fusaient !\nComme quoi, un gamin motivé peut partir dans des directions très intéressantes et même s'il ne va pas jusqu'au bout dans la mise au propre, ses idées peuvent être reprises par les adultes s'il est d'accord.\nC'est sans doute plus complexe pour aborder la programmation, mais les petits logiciels comme Kturtle qui permettent de s'y initier sont déjà bien pour les plus jeunes, et quelques essais permettent de voir si on veut s'y coller ou pas quand on est plus âgé.\nL'idéal serait d'avoir à un moment un vrai développeur qui vienne faire une intervention, mais il doit être en mesure de se mettre à la portée des jeunes, ce qui n'est pas si facile.\nCe qui semble évident pour un adulte peut en effet paraître totalement incompréhensible à un enfant.\nMême en bases informatique, on voit aussi des adultes peiner devant des choses qui nous semblent aller de soi.\nL'autre jour, une dame d'environ 60 ans me disait que pour elle, le clic droit ne voulait pas dire cliquer avec le bouton droit mais cliquer en allant tout droit ! Elle s'était même disputée avec son fils à ce sujet...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nProblème pour installer Syntensity sous Ubuntu Jaunty!\nJe vais chercher d'autres choses, j'ai vu aussi la possibilité de faire de la programmation en python avec Blender.\nMais je dois bien sûr trouver quelque chose de simple en vue de mon projet d'animation.\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPour MyPaint, on ne peut pas installer le paquet mypaint comme indiqué dans les pré-requis de la doc d'Ubuntu (lien mort et pas trouvé dans les dépots)\nUne fois l'install' effectuée, il s'ouvre mais me signale une erreur de programmation. Je ferme cette fenêtre, histoire de lui clouer le bec, et j'essaie de dessiner un peu mais la fenêtre d'erreur revient toutes les 10 secondes...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nEn langage python, pour que le joueur puisse entrer une donnée, voici le code à taper dans un simple éditeur de texte :\nprint \"Joueur n°1, tapez votre pseudo: \",\npseudo1 = raw_input()\nprint \"Bienvenue à\", pseudo1, \"dans Ultimate Smash Friends, vous êtes le joueur n° 1 !\"\n\nL'instruction print permet l'affichage de la chaîne de caractère de la 1ère ligne. On se rappelle que ces chaines sont mises entre guillemets.\nraw_input() permettra d'entrer la donnée pseudo1 dans le programme pour l'utiliser par la suite.\nNous l'afficherons dans une phrase grâce à la 3ème ligne. Celle-ci insèrera cette donnée pseudo1 entre 2 chaines de caractères (toujours entre guillemets, souvenez-vous !).\nLa virgule derrière la question, dans le code, permet que votre réponse reste sur la même ligne que la question. Idem pour les virgules avant et après pseudo1\nEnregistrez sous le nom de progpseudo.py dans un dossier nommé programmes. Remplacez par le nom de votre propre programme et de votre propre dossier s'il est différent, bien sûr\nOuvrez la console (Konsole ou Terminal).\nPlacez vous dans le bon dossier grâce à la commande cd suivie du chemin du dossier (change directory = changer de répertoire). Ex:\ncd /home/laurence/programmes\n\nTapez sur la touche Entrée du clavier pour entrer dans le répertoire demandé.\nEcrivez ce code à la suite dans la console pour appeler votre super programme:\npython progpseudo.py\nTapez sur la touche Entrée pour lancer le programme.\nLa console affiche alors la 1ère ligne, à laquelle vous devez répondre.\nRépondez puis validez avec la touche Entrée.\nLa console affichera ensuite votre réponse à l'intérieur de la phrase appelée par la 3ème ligne de code.\nCette image montre à la fois le code écrit dans l'éditeur de texte et le résultat dans la console. N'oubliez pas que je n'ai tapé mon nom qu'une fois dans la console et nulle part dans le code !\nSi vous copiez-collez ces 3 lignes de codes en dessous des précédentes et que vous remplacez le chiffre 1 par le chiffre 2, vous pourrez aussi demander son pseudo au joueur n°2 et l'afficher pareillement. Essayez !\nDemandez ensuite le prénom des 2 joueurs puis arrangez-vous pour l'afficher dans une phrase du type:Le pseudo de Laurence est Doudoulolita tandis que le surnom de Jean est Patouille.\nN'hésitez pas à inventer d'autres questions et d'autres phrases pour vous amuser.\nDernière modification par doudoulolita (Le 18/05/2010, à 00:40)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nprint \"Joueur n°1, combien de points de vie avez-vous ?\",\nnb_points1 = int(raw_input())\nprint \"Joueur n°2, combien de points de vie avez-vous ?\",\nnb_points2 = int(raw_input())\nprint \"Au début du jeu,\", pseudo1, \"a\", nb_points1, \"points de vie,\", pseudo2, \"en a\", nb_points2, \".\"\nprint \"Il y a\", \\\n nb_points1 + nb_points2, \\\n \"points de vie en tout.\"\n\nint(raw_input()) permet d'entrer un chiffre que l'on pourra réutiliser dans un calcul, comme ici avec nb_points1 + nb_points2. Notez qu'il y a 2 parenthèses fermantes à la fin, une pour fermer raw_input, une pour fermer int. Mais n'oubliez pas d'ouvrir les parenthèses avant de les fermer !\nOn note les \\ avant et après le calcul, et les espaces pour indenter les 2 dernières lignes (c'est à dire les décaler vers la droite). Ne pas utiliser la touche Tabulation car il me semble que ça pose problème.\nLe programme suivant se base sur cet exemple mais l'addition (ici: 5+6 = 11) est placée avant le nombre de points de chaque joueur. Il réutilise aussi le code appris précédemment.\nCliquez sur l'image de la console pour voir le code utilisé (écrit dans l'éditeur de texte, donc)\nBon, dans un jeu, on ne choisit pas soi-même ses points de vie, mais vous pouvez prendre un dé pour décider de votre réponse !\nQuant au nombre de joueurs, si vous le choisissez plus élevé que le nombre choisi par le programmeur pour l'instant (ici je n'en ai prévu que 2...), vous n'aurez pas de questions pour les joueurs 3, 4, etc.\nA vous de coder pour prévoir 4 joueurs, comme dans le vrai jeu d'Ultimate Smash Friends !\nDernière modification par doudoulolita (Le 20/07/2010, à 19:02)\nHors ligne\narturototo\nRe : Faire une animation sur la création de jeux vidéo libres\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaj'y voit plus claire maintenant mercie!!!!!!\nArtur MOUKHAMEDOV\n(11 ans)\nHors ligne\narturototo\nRe : Faire une animation sur la création de jeux vidéo libres\nje comprend bien mieu\nArtur MOUKHAMEDOV\n(11 ans)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nlol, t'as le même avatar que Kanor, je t'ai pris pour lui au début, comme il fait aussi du python ^^, mais ça m'étonnait qu'il ait appris un truc juste là .\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nMon premier atelier sera sur Blender les 19 et 20 juillet de 14 à 16h à l'Espace libre 13.1.\nAu programme: création d'une petite barque et intégration dans un fond en vue de créer un décor pour le jeu Ultimate Smash Friends.\nDeuxième atelier sur la programmation python (B.A.BA) les 22 et 23 juillet de 14 à 16h. Un mini-script python pour Blender trouvé sur Internet complétera quelques exercices en mode texte.\nDernière modification par doudoulolita (Le 12/07/2010, à 13:47)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nVoici une idée de ce que je souhaite réaliser avec les participants à mon atelier Blender du 19 et 20 juillet 2010 (pour adultes et jeunes à partir de 15 ans):\nLes participants réaliseront une barque sur Blender.\nElle est modélisée avec des extrusions, le modificateur Miroir et des redimensionnements utilisant le PET (Outil d'Edition Proportionnelle).\nIl faudra placer lampe et caméra pour voir la barque de profil.\nOn apprend aussi à utiliser le mode points, le mode arêtes et le mode faces, ainsi que l'outil Couteau (K), et à choisir un rendu en png avec un fond transparent (RGBA).\nEnfin, on ajoute à la barque un matériau marron et une texture bois.\nPuis, si on a le temps, les participants insèreront l'image rendue en plusieurs exemplaires avec Gimp sur une image de fond (trouvée sur internet). Ils ajouteront le personnage Sorlo pour se donner une idée de la taille que doit avoir la barque. On utilisera donc l'outil de recadrage, les calques et l'outil de redimensionnement.\nL'image de fond provient de http://commons.wikimedia.org/wiki/File: … rfeurs.jpg\nDernière modification par doudoulolita (Le 12/07/2010, à 13:56)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nOula, l'idée est intéressante mais assez perturbante du point de vue perspective ^^.\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nComme je l'ai marqué sur l'autre topic sur USF, je n'ai pas eu grand monde à mon animation.\nSur les 5/6 inscrits, seulement 2 se sont présentés, un jeune de 15 ans gentil mais qui croit que ça lui sera facile de devenir testeur de jeux, et un adulte qui s'intéressait en fait à la retouche photo sur Gimp.\nLe jeune a quand même commencé un petit iceberg en vue d'en faire un élement de décor pour USF, avec Blender; ma barque ne le motivait pas beaucoup (et pourtant, sur le plan didactique, il y avait plus à apprendre !)\nPour une animation de 2x2h, on ne peut de toute façon pas faire un truc très travaillé.\nJe voulais surtout leur apprendre à modéliser et texturer la barque et j'ai un peu vite fait l'insertion sur le fond, sans trop me prendre la tête dessus, j'avoue !\nL'idéal serait en fait de \"fabriquer la mer\" avec Blender ou en tout cas de mieux placer les barques sous la camera pour avoir une perspective correcte, effectivement (mais comment placer des repères fiables ?).\nIl faudrait aussi mettre quelques vagues en bas des barques pour les faire flotter en utilisant une copie du calque et un masque de calque.\nMais travailler sur un décor \"à plat\" (et non un truc en hauteur) n'était peut-être la meilleure idée pour un décor de jeu 2D.\nLe jeune qui a fait l'iceberg pendant l'animation voudra sans doute faire aussi la mer avec Blender ou avec Gimp et là, je dois dire que je n'ai pas encore étudié la question de la profondeur. On se retrouvera aussi avec un problème de perpective.\nEn fait, la question que je me posais avant de concevoir cette animation, c'était de savoir si je choisissais le thème du décor et que je l'imposais à tous (plus facile avec un groupe de personnes au-delà de 4 ou 5) ou si je partais des idées des participants, ce qui implique qu'ils se mettent d'accord et pour moi, de m'adapter à un truc qu'on n'a pas testé avant.\nDans l'un comme l'autre cas, j'ai fait une erreur en oubliant un des principes de base du jeu, qui fonctionne en 2D et dont le décor doit se travailler sur l'axe Z de Blender !\nJ'espère avoir un peu de monde Jeudi et vendredi pour la programmation, mais si besoin, je m'adapterai aux personnes présentes.\nDe toute façon, la préparation de ces ateliers m'a permis d'acquérir des petites bases sur Python et j'ai même fait un essai de Pygame grâce à des tutos sur le web, donc ce n'est pas du temps perdu.\nJe me suis aussi acheté le bouquin \"The blender Gamekit\", en anglais. A suivre...\nDernière modification par doudoulolita (Le 20/07/2010, à 18:56)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJe me suis amusée à faire encore d'autres petits essais en python en mode texte mais je voulais passer au côté graphique.\nDans le livre \"Initiation à la programmation\" d'Yves Bailly, qui m'a servi de base, les exemples sont donnés avec la bibliothèque Qt.\nJ'ai trouvé des tutos intéressants pour python avec Pygame (en anglais)\nJ'ai suivi les 2 premiers tutos, très simples, de pygame-tutorial et un autre pour apprendre à incorporer une image . Mon code n'est pas super mais ça affiche quelque chose !\nJe suppose qu'une fonction pour les rectangles serait bien ou même peut-être existe-t-il quelque chose de \"tout fait\" dans Pygame. Les chiffres entre parenthèses indiquent d'abord la couleur de la ligne en mode RVB, puis les coordonnées des points de début et de fin (en pixels).\nPour trouver les codes de couleurs, choisir une couleur dans le sélecteur de couleur de Gimp et noter les chiffres R,V et B indiqués sur la droite du sélecteur de couleur.\nCe que le livre d'Yves Bailly m'a fait comprendre, c'est que pour créer un jeu en python, par ex., il faut d'abord exprimer clairement les choses et définir objets et actions du jeu (en français, tout bêtement !).\nEn les exprimant clairement et de manière détaillée, on voit plus rapidement comment travailler et structurer le code qu'on fera par la suite.\nUn simple mouvement d'un des éléments du décor nécessite de définir les coordonnées de cet objet, de définir ses modalités de déplacement, d'indiquer ce qui provoque ce déplacement (touche de clavier, par ex); le fait qu'il ait une certaine vitesse implique le temps, et donc peut-être un chronomètre, etc!\nDernière modification par doudoulolita (Le 20/07/2010, à 19:16)\nHors ligne\ntshirtman\nRe : Faire une animation sur la création de jeux vidéo libres\nCe que le livre d'Yves Bailly m'a fait comprendre, c'est que pour créer un jeu en python, par ex., il faut d'abord exprimer clairement les choses et définir objets et actions du jeu (en français, tout bêtement !).\nEn les exprimant clairement et de manière détaillée, on voit plus rapidement comment travailler et structurer le code qu'on fera par la suite.\ntout à fait, c'est vrai pour tout type de programmes, et les jeux ne font pas exceptions, mieux on sait ce qu'on veux faire (et ce n'est pas facile) plus on a de chance de le faire correctement!\nun jeune de 15 ans gentil mais qui croit que ça lui sera facile de devenir testeur de jeux,\nc'est facile, sauf si tu veux que ce soit un vrai métier…\nDernière modification par tshirtman (Le 20/07/2010, à 19:34)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPour un jeune, je pense que les logiciels libres et en particulier les jeux libres leur offrent une chance formidable de s'entraîner et de vérifier leur motivation au cas où ils souhaiteraient faire de leur passion un métier.\nTester, développer, c'est quand même plus facile dans ce cadre qu'au sein d'une entreprise très fermée, non ?\nLe problème de certains ados, c'est qu'ils pensent que pour être testeur, il suffit juste de jouer et que ce sera des jeux qui les passionnent alors qu'un simple tour sur les forums au sujet de ce métier (ou de cette activité, si on préfère) montre le contraire.\nMais que les ados rêvent, c'est normal. Après, s'ils veulent vraiment réaliser leur rêve, il leur faudra se confronter à la réalité et prouver leur motivation pour pouvoir vivre de leur passion.\nJe dis ça alors qu'ado, je rêvais d'être styliste chez Jean-Paul Gaultier, et que je me suis retrouvée quelques années plus tard simple patronnière dans le Sentier (ceux qui connaissent Paris savent dans quelles conditions on y travaille le plus souvent)...\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nJ'ai oublié de dire ici que je n'ai pas eu beaucoup plus de monde pour l'atelier programmation. Un adulte qui pensait qu'il s'agissait de faire des bases de données (et dans son cas, un simple tableur comme calc devait lui suffire, à mon avis), le jeune qui était là pour Blender et deux autres plus jeunes encore.\nLes jeunes ont eu du mal à s'intéresser à Ultimate Smash Friends et à python !\nCelui de 15 ans m'a montré RPG maker dont pour ma part je ne raffole pas mais qui a amusé les autres pour créer des décors très facilement.\nLe côté programmation des persos sur RPGmaker n'est pas si évident que ça en a l'air, j'ai eu ensuite du mal à reproduire ce que m'avait montré le jeune, qui pourtant semblait super simple.\nCe que je n'aime pas dans ce programme, c'est le côté \"déjà tout fait\" que les jeunes, eux, aiment beaucoup.\nCe qui est plutôt pratique, c'est la simplicité de création des décors qui peut plaire aux plus jeunes pour les amener ensuite vers plus de programmation avec les personnages.\nJe ne sais pas si ce type de jeu permettant de créer un jeu existe en logiciel libre et a ce côté facile et convivial qu'aiment les jeunes.\nJusqu'ici nos recherches en matière de jeux intéressants sont un peu stériles. J'ai voulu mettre Yo frankie sur les ordis du boulot et ça ne fonctionne pas alors que chez moi ça marche.\nC'est sans doute nos ordis du boulot qui pèchent quelque part. J'ai en effet Ubuntu Lucid Lynx comme au boulot mais ma config est supérieure.\nDernière modification par doudoulolita (Le 19/08/2010, à 07:29)\nHors ligne\ndoudoulolita\nRe : Faire une animation sur la création de jeux vidéo libres\nPar hasard, tout récemment, j'ai découvert le jeu Plee the bear mais pour contribuer, c'est encore plus difficile car c'est en python C++.\nLes tutoriels sont par contre très bien documentés et le jeu présente une cohérence intéressante et un mini scénario.:)\nA titre perso je vais continuer à apprendre python et pygame. Je verrai plus tard si je peux réunir des jeunes adultes et des ados motivés pour un autre atelier.\nDernière modification par doudoulolita (Le 19/08/2010, à 07:31)\nHors ligne"}}},{"rowIdx":268,"cells":{"text":{"kind":"string","value":"Crossposted from blog.untrod.com\nAn Introduction to Pandas\nThis tutorial will get you started with Pandas - a data analysis library for Python that is great for data preparation, joining, and ultimately generating well-formed, tabular data that's easy to use in a variety of visualization tools or (as we will see here) machine learning applications. This tutorial assumes a solid understanding of core Python functionality, but nothing about machine learning or Pandas.\nGoals\nUsing data from NYC Open Data, build a unified, tabular dataset ready for use with machine learning algorithms to predict student SAT scores on a per school basis.\nLearn and use the Pandas data analysis package.\nLearn how data is typically prepared for machine learning algorithms (ingestion, cleaning, joining, feature generation).\nIn [8]:\nimport pandas as pd\n# Load the data\ndsProgReports = pd.read_csv('C:/data/NYC_Schools/School_Progress_Reports_-_All_Schools_-_2009-10.csv')\ndsDistrict = pd.read_csv('C:/data/NYC_Schools/School_District_Breakdowns.csv')\ndsClassSize = pd.read_csv('C:/data/NYC_Schools/2009-10_Class_Size_-_School-level_Detail.csv')\ndsAttendEnroll = pd.read_csv('C:/data/NYC_Schools/School_Attendance_and_Enrollment_Statistics_by_District__2010-11_.csv')[:-2] #last two rows are bad\ndsSATs = pd.read_csv('C:/data/NYC_Schools/SAT__College_Board__2010_School_Level_Results.csv') # Dependent\n\nIn [9]:\ndsSATs.info()\nOut[9]:\nInt64Index: 460 entries, 0 to 459 Data columns: DBN 460 non-null values School Name 460 non-null values Number of Test Takers 460 non-null values Critical Reading Mean 460 non-null values Mathematics Mean 460 non-null values Writing Mean 460 non-null values dtypes: object(6)\nOutline\nPandas has read the data files without issue. Next let's create a rough map of where we are going.\nWe have five datasets here, each with information about either schools or districts. We're going to need to join all of this information together into a tabular file, with one row for each school, joined with as much information we can gather about that school & its district, including our dependent variables, which will be the mean SAT scores for each school in 2010.\nDrilling down one level of detail, let's look at the dataset dsSATs, which contains the target variables:\nIn [10]:\ndsSATs.info()\n\nOut[10]:\nInt64Index: 460 entries, 0 to 459\nData columns:\nDBN 460 non-null values\nSchool Name 460 non-null values\nNumber of Test Takers 460 non-null values\nCritical Reading Mean 460 non-null values\nMathematics Mean 460 non-null values\nWriting Mean 460 non-null values\ndtypes: object(6)\n\nTarget Variable and Joining Strategy\nWe are going to build a dataset to predict Critical Reading Mean, Mathematics Mean, and Writing Mean for each school (identified by DBN).\nAfter digging around in Excel (or just taking my word for it) we identify the following join strategy (using SQL-esque pseudocode):\ndsSATS join dsClassSize on dsSATs['DBN'] = dsClassSize['SCHOOL CODE'] join dsProgReports on dsSATs['DBN'] = dsProgReports['DBN'] join dsDistrct on dsProgReports['DISTRICT'] = dsDistrict['JURISDICTION NAME'] join dsAttendEnroll on dsProgReports['DISTRICT'] = dsAttendEnroll['District']\nPrimary Keys - Schools\nBefore we can join these three datasets together, we need to normalize their primary keys. Below we see the mismatch between the way the DBN (school id) field is represented in the different datasets. We then write code to normalize the keys and correct this problem.\nIn [11]:\npd.DataFrame(data=[dsProgReports['DBN'].take(range(5)), dsSATs['DBN'].take(range(5)), dsClassSize['SCHOOL CODE'].take(range(5))])\n\nOut[11]:\n0 1 2 3 4\nDBN 01M015 01M019 01M020 01M034 01M063\nDBN 01M292 01M448 01M450 01M458 01M509\nSCHOOL CODE M015 M015 M015 M015 M015\nIn [12]:\n#Strip the first two characters off the DBNs so we can join to School Code\ndsProgReports.DBN = dsProgReports.DBN.map(lambda x: x[2:])\ndsSATs.DBN = dsSATs.DBN.map(lambda x: x[2:])\n#We can now see the keys match\npd.DataFrame(data=[dsProgReports['DBN'].take(range(5)), dsSATs['DBN'].take(range(5)), dsClassSize['SCHOOL CODE'].take(range(5))])\n\nOut [12]:\n0 1 2 3 4\nDBN M015 M019 M020 M034 M063\nDBN M292 M448 M450 M458 M509\nSCHOOL CODE M015 M015 M015 M015 M015\nPrimary Keys - Districts\nWe have a similar story with the district foreign keys. Again, we need to normalize the keys. The only additional complexity here is that dsProgReports['DISTRICT'] is typed numerically, whereas the other two district keys are typed as string. We do some type conversions following the key munging.\nIn [13]:\n#Show the key mismatchs\n#For variety's sake, using slicing ([:3]) syntax instead of .take()\npd.DataFrame(data=[dsProgReports['DISTRICT'][:3], dsDistrict['JURISDICTION NAME'][:3], dsAttendEnroll['District'][:3]])\n\nOut[13]:\n0 1 2\nDISTRICT 1 1 1\nJURISDICTION NAME CSD 01 Manhattan CSD 02 Manhattan CSD 03 Manhattan\nDistrict DISTRICT 01 DISTRICT 02 DISTRICT 03\nIn [14]:\n#Extract well-formed district key values\n#Note the astype(int) at the end of these lines to coerce the column to a numeric type\nimport re\ndsDistrict['JURISDICTION NAME'] = dsDistrict['JURISDICTION NAME'].map(lambda x: re.match( r'([A-Za-z]*\\s)([0-9]*)', x).group(2)).astype(int)\ndsAttendEnroll.District = dsAttendEnroll.District.map(lambda x: x[-2:]).astype(int)\n#We can now see the keys match\npd.DataFrame(data=[dsProgReports['DISTRICT'][:3], dsDistrict['JURISDICTION NAME'][:3], dsAttendEnroll['District'][:3]])\n\nOut[14]:\n0 1 2 DISTRICT 1 1 1 JURISDICTION NAME 1 2 3 District 1 2 3\nAdditional Cleanup\nAt this point we could do the joins, but there is messiness in the data still. First let's reindex the DataFrames so the semantics come out a bit cleaner. Pandas indexing is beyond the scope of this tutorial, but suffice it to say it makes these operations easier.\nIn [15]:\n#Reindexing\ndsProgReports = dsProgReports.set_index('DBN')\ndsDistrict = dsDistrict.set_index('JURISDICTION NAME')\ndsClassSize = dsClassSize.set_index('SCHOOL CODE')\ndsAttendEnroll = dsAttendEnroll.set_index('District')\ndsSATs = dsSATs.set_index('DBN')\n\nLet's take a look at one of our target variables. Right away we see the \"s\" value, which shouldn't be there.\nWe'll filter out the rows without data.\nIn [16]:\n#We can see the bad value\ndsSATs['Critical Reading Mean'].take(range(5))\n\nOut[16]:\nDBN M292 391 M448 394 M450 418 M458 385 M509 s Name: Critical Reading Mean\nIn [17]:\n#Now we filter it out\n#We create a boolean vector mask. Open question as to whether this semantically ideal...\nmask = dsSATs['Number of Test Takers'].map(lambda x: x != 's')\ndsSATs = dsSATs[mask]\n#Cast fields to integers. Ideally we should not need to be this explicit.\ndsSATs['Number of Test Takers'] = dsSATs['Number of Test Takers'].astype(int)\ndsSATs['Critical Reading Mean'] = dsSATs['Critical Reading Mean'].astype(int)\ndsSATs['Mathematics Mean'] = dsSATs['Mathematics Mean'].astype(int)\ndsSATs['Writing Mean'] = dsSATs['Writing Mean'].astype(int)\n#We can see those values are gone\ndsSATs['Critical Reading Mean'].take(range(5))\n\nOut[17]:\nDBN M292 391 M448 394 M450 418 M458 385 M515 314 Name: Critical Reading Mean Feature Construction\ndsClassSize will be a many-to-one join with dsSATs because dsClassSize contains multiple entries per school. We need to summarize and build features from this data in order to get one row per school that will join neatly to dsSATs.\nAdditionally, the data has an irregular format, consisting of a number of rows per school describing different class sizes, then a final row for that school which contains no data except for a number in the final column, SCHOOLWIDE PUPIL-TEACHER RATIO.\nWe need to extract the SCHOOLWIDE PUPIL-TEACHER RATIO rows, at which point we'll have a regular format and can build features via aggregate functions. We'll also drop any features that can't be easily summarized or aggregated and likely have no bearing on the SAT scores (like School Name).\nIn [18]:\n#The shape of the data\nprint dsClassSize.columns\nprint dsClassSize.take([0,1,10]).values\narray([BORO, CSD, SCHOOL NAME, GRADE , PROGRAM TYPE,\n CORE SUBJECT (MS CORE and 9-12 ONLY),\n CORE COURSE (MS CORE and 9-12 ONLY), SERVICE CATEGORY(K-9* ONLY),\n NUMBER OF CLASSES, TOTAL REGISTER, AVERAGE CLASS SIZE,\n SIZE OF SMALLEST CLASS, SIZE OF LARGEST CLASS, DATA SOURCE,\n SCHOOLWIDE PUPIL-TEACHER RATIO], dtype=object)\n[[M 1 P.S. 015 ROBERTO CLEMENTE 0K GEN ED - - - 1.0 21.0 21.0 21.0 21.0 ATS\n nan]\n [M 1 P.S. 015 ROBERTO CLEMENTE 0K CTT - - - 1.0 21.0 21.0 21.0 21.0 ATS\n nan]\n [M 1 P.S. 015 ROBERTO CLEMENTE nan nan nan nan nan nan nan nan nan nan nan\n 8.9]]\n\nIn [19]:\n#Extracting the Pupil-Teacher Ratio\n#Take the column\ndsPupilTeacher = dsClassSize.filter(['SCHOOLWIDE PUPIL-TEACHER RATIO'])\n#And filter out blank rows\nmask = dsPupilTeacher['SCHOOLWIDE PUPIL-TEACHER RATIO'].map(lambda x: x > 0)\ndsPupilTeacher = dsPupilTeacher[mask]\n#Then drop from the original dataset\ndsClassSize = dsClassSize.drop('SCHOOLWIDE PUPIL-TEACHER RATIO', axis=1)\n#Drop non-numeric fields\ndsClassSize = dsClassSize.drop(['BORO','CSD','SCHOOL NAME','GRADE ','PROGRAM TYPE',\\\n'CORE SUBJECT (MS CORE and 9-12 ONLY)','CORE COURSE (MS CORE and 9-12 ONLY)',\\\n'SERVICE CATEGORY(K-9* ONLY)','DATA SOURCE'], axis=1)\n#Build features from dsClassSize\n#In this case, we'll take the max, min, and mean\n#Semantically equivalent to select min(*), max(*), mean(*) from dsClassSize group by SCHOOL NAME\n#Note that SCHOOL NAME is not referenced explicitly below because it is the index of the dataframe\ngrouped = dsClassSize.groupby(level=0)\ndsClassSize = grouped.aggregate(np.max).\\\n join(grouped.aggregate(np.min), lsuffix=\".max\").\\\n join(grouped.aggregate(np.mean), lsuffix=\".min\", rsuffix=\".mean\").\\\n join(dsPupilTeacher)\nprint dsClassSize.columns\narray([NUMBER OF CLASSES.max, TOTAL REGISTER.max, AVERAGE CLASS SIZE.max,\n SIZE OF SMALLEST CLASS.max, SIZE OF LARGEST CLASS.max,\n NUMBER OF CLASSES.min, TOTAL REGISTER.min, AVERAGE CLASS SIZE.min,\n SIZE OF SMALLEST CLASS.min, SIZE OF LARGEST CLASS.min,\n NUMBER OF CLASSES.mean, TOTAL REGISTER.mean,\n AVERAGE CLASS SIZE.mean, SIZE OF SMALLEST CLASS.mean,\n SIZE OF LARGEST CLASS.mean, SCHOOLWIDE PUPIL-TEACHER RATIO], dtype=object)\n\nJoining\nOne final thing before we join - dsProgReports contains distinct rows for separate grade level blocks within one school. For instance one school (one DBN) might have two rows: one for middle school and one for high school. We'll just drop everything that isn't high school.\nAnd finally we can join our data. Note these are inner joins, so district data get joined to each school in that district.\nIn [20]:\nmask = dsProgReports['SCHOOL LEVEL*'].map(lambda x: x == 'High School')\ndsProgReports = dsProgReports[mask]\n\nIn [21]:\nfinal = dsSATs.join(dsClassSize).\\\njoin(dsProgReports).\\\nmerge(dsDistrict, left_on='DISTRICT', right_index=True).\\\nmerge(dsAttendEnroll, left_on='DISTRICT', right_index=True)\n\n(Even More) Additional Cleanup\nWe should be in a position to build a predictive model for our target variables right away but unfortunately there is still messy data floating around in the dataframe that machine learning algorithms will choke on. A pure feature matrix should have only numeric features, but we can see that isn't the case. However for many of these columns, the right approach is obvious once we've dug in.\nIn [22]:\nfinal.dtypes[final.dtypes.map(lambda x: x=='object')]\n\nOut[22]:\nSchool Name object\nSCHOOL object\nPRINCIPAL object\nPROGRESS REPORT TYPE object\nSCHOOL LEVEL* object\n2009-2010 OVERALL GRADE object\n2009-2010 ENVIRONMENT GRADE object\n2009-2010 PERFORMANCE GRADE object\n2009-2010 PROGRESS GRADE object\n2008-09 PROGRESS REPORT GRADE object\nYTD % Attendance (Avg) object\n\nIn [23]:\n#Just drop string columns.\n#In theory we could build features out of some of these, but it is impractical here\nfinal = final.drop(['School Name','SCHOOL','PRINCIPAL','SCHOOL LEVEL*','PROGRESS REPORT TYPE'],axis=1)\n#Remove % signs and convert to float\nfinal['YTD % Attendance (Avg)'] = final['YTD % Attendance (Avg)'].map(lambda x: x.replace(\"%\",\"\")).astype(float)\n#The last few columns we still have to deal with\nfinal.dtypes[final.dtypes.map(lambda x: x=='object')]\n\nCategorical Variables\nWe can see above that the remaining non-numeric field are grades . Intuitively, they might be important so we don't want to drop them, but in order to get a pure feature matrix we need numeric values. The approach we'll use here is to explode these into multiple boolean columns. Some machine learning libraries effectively do this for you under the covers, but when the cardinality of the categorical variable is relatively low, it's nice to be explicit about it.\nIn [24]:\ngradeCols = ['2009-2010 OVERALL GRADE','2009-2010 ENVIRONMENT GRADE','2009-2010 PERFORMANCE GRADE','2009-2010 PROGRESS GRADE','2008-09 PROGRESS REPORT GRADE']\ngrades = np.unique(final[gradeCols].values) #[nan, A, B, C, D, F]\nfor c in gradeCols:\n for g in grades:\n final = final.join(pd.Series(data=final\n.map(lambda x: 1 if x is g else 0), name=c + \"_is_\" + str(g))) \nfinal = final.drop(gradeCols, axis=1) \n#Uncomment to generate csv files \n#final.drop(['Critical Reading Mean','Mathematics Mean','Writing Mean'],axis=1).to_csv('C:/data/NYC_Schools/train.csv') \n#final.filter(['Critical Reading Mean','Mathematics Mean','Writing Mean']).to_csv('C:/data/NYC_Schools/target.csv')\n\nThat's it!\nWe now have a feature matrix that's trivial to use with any number of machine learning algorithms. Feel free to stop here and run the two lines of code below to get nice CSV files written to disk that you can easily use in Excel, Tableau, etc. Or run the larger block of code to see how easy it is to build a random forest model against this data, and look at which variables are most important.\nIn [25]:\n#Uncomment to generate csv files\n#final.drop(['Critical Reading Mean','Mathematics Mean','Writing Mean'],axis=1).to_csv('C:/data/NYC_Schools/train.csv')\n#final.filter(['Critical Reading Mean','Mathematics Mean','Writing Mean']).to_csv('C:/data/NYC_Schools/target.csv')\n\nIn [26]:\nfrom sklearn.ensemble import RandomForestRegressor\ntarget = final.filter(['Critical Reading Mean'])\n#We drop all three dependent variables because we don't want them used when trying to make a prediction.\ntrain = final.drop(['Critical Reading Mean','Writing Mean','Mathematics Mean'],axis=1)\nmodel = RandomForestRegressor(n_estimators=100, n_jobs=-1, compute_importances = True)\nmodel.fit(train, target)\npredictions = np.array(model.predict(train))\nrmse = math.sqrt(np.mean((np.array(target.values) - predictions)**2))\nimp = sorted(zip(train.columns, model.feature_importances_), key=lambda tup: tup[1], reverse=True)\nprint \"RMSE: \" + str(rmse)\nprint \"10 Most Important Variables:\" + str(imp[:10])\nRMSE: 80.13105688\n10 Most Important Variables:[('PEER INDEX*', 0.81424747874371173), ('TOTAL REGISTER.min', 0.060086333792196724), ('2009-2010 ENVIRONMENT CATEGORY SCORE', 0.023810405565050669), ('2009-2010 ADDITIONAL CREDIT', 0.021788425210174274), ('2009-2010 OVERALL SCORE', 0.019046860376900468), ('AVERAGE CLASS SIZE.mean', 0.0094882658926829649), ('2009-2010 PROGRESS CATEGORY SCORE', 0.0094678349064146652), ('AVERAGE CLASS SIZE.min', 0.0063723026953534942), ('2009-2010 OVERALL GRADE_is_nan', 0.0057710237481254567), ('Number of Test Takers', 0.0053660239780210584)]\n\nphoto by Stefan on Flickr"}}},{"rowIdx":269,"cells":{"text":{"kind":"string","value":"I'm trying to draw a simple \"X\" in the middle of a button. I've put in the following drawing code:\nwidth, height = self.size\n x, y = self.pos\n x1, x2 = x + int(width*0.3), x + int(width*0.7)\n y1, y2 = y + int(height*0.3), y + int(height*0.7)\n with self.canvas:\n Line(points=[x1, y1, x2, y2], width=1, cap='none')\n Line(points=[x2, y1, x1, y2], width=1, cap='none')\n self.canvas.ask_update()\n\nThe two diagonal lines, even though they're using the exact same integer coordinates, are not drawn the same. The upper-left to lower-right is drawn aliased, and the other is not. How can I make them consistent?\nI should mention that I'm testing with the Windows version of kivy and I haven't tried it on any other platform yet."}}},{"rowIdx":270,"cells":{"text":{"kind":"string","value":"This month we'll use NumPy and DISLIN to create, display, and manipulate a basic geometric image. At the heart of image manipulation are special matrices that can be used to create effects. You can use these effects separately or combine them for more complex operations. While the focus is on two-dimensional operations, the concepts extend to three (and more) dimensions. They are fundamental to many applications including computer games and computer-aided design (CAD) programs. They are the heart of linear algebra itself.\nLinear algebra is the math of shaped collections of numbers. The mathematics we are most familiar with deals with numbers called scalars. We use scalars in our lives to represent things like the amount in our bank account ($10.08), the speed we drive (65 miles per hour), or the time it takes for popcorn to pop in the microwave oven (3 minutes 40 seconds). Each of these values is a magnitude of some quantity that interests us. Often we use combinations of values to represent more complex information. For example, there is a difference between the speed of an object (say your car) and its velocity. One is simple magnitude (speed: how fast you are going); the other implies both speed and direction (velocity). Your speed cannot be negative, but your velocity could be. Think about your car moving in reverse. You are moving so you have speed, but the direction is \"backwards,\" giving you a negative velocity. Speed is a scalar value, but velocity is expressed as a vector, a combination of two numbers that imply both direction and magnitude. Assuming your car is driven on a flat road, only two numbers are needed to represent the direction of movement.\nConsidering the world as a flat plane, we can lay on it two reference directions. The arrows labeled x and y provide a reference for our vector .\nThe vector is defined as being four units in the x direction and 3 units in the y direction (units, in this case, being miles traveled.) So how do we get from the motion of a car to a vector of ? Well we would say that the velocity of the car is miles per hour. Which means that the car moved four miles in the x direction and three in the y in the last hour. The actual motion of the car is the length of the vector, computed via:\nThis is just the Pythagorean theorem, which seems to pop up everywhere! Continuing with the example, the car moved a total of five miles in the course of a single hour and as such went five miles per hour.\nIf we want to describe motion of objects that can move in more dimensions (say an airplane - which can move \"up\" and \"down\" as well), we have to use vectors with more elements (three for the airplane).\nVectors are used to represent many things -- the velocity of an automobile is but one real example. In general, the concept of a vector is abstract. You don't need to know what a vector represents in order to manipulate it, although knowing sometimes helps you understand what you are doing. The mathematics for manipulating vectors can be considered separately from the implementation of a particular problem.\nInstead of graphing velocity, we will use vectors to draw a basic image. We will then focus on the manipulation of this image via special matrices and matrix mathematics.\nTo see how this works, let's review some basic operations on vectors. The addition of two vectors can be shown graphically. It works as might be expected: Two vectors and add up to . Here is how it looks in a graph:\nNotice how the first vector starts from the origin (0,0). The second vector is then placed with its tail (the end with no arrow head) to the head of the first. The combination of the two is the same as a vector starting from the origin connecting to the head of the second one. Subtraction follows in a similar fashion, but reverses the direction of the second vector.\nGraphing addition like this, a collection of vectors (each representing a line) can be used to create basic images, a vector version of connect-the-dots. Although our example is simple in nature, many vectors can be combined to generate complex drawings.\nLet's try an example to illustrate what can be done. Following is a complete Python program that uses both the Numeric (NumPy) module as well as pxDislin. What is new from last month is the use of the dMultiLine function, which draws a line (vector) between points of x_list and y_list arguments. Essentially, the dMultiLine function is performing a vector addition operation. The function does not actually do the math, but it does graphically represent the operation. The points chosen trace out a simple box structure of a house centered on the plot axis.\nfrom pxDislin import *\nfrom Numeric import *\nplot = dPlot()\naxis = dAxis(-20,20,-20,20)\nplot.add_axis(axis)\nhouse_pts = array([[5,5,-5,-5,5,4,4,2,2,5,5,0,-5],\n [-5,5,5,-5,-5,-5,-1,-1,-5,-5,5,8,5]])\nhouse = dMultiLine(house_pts[0],house_pts[1])\nplot.add_object(house)\nplot.show()\n\nThe generated plot is:\nThe points that draw out the house are essentially a 2-by-13 matrix:\nwhere the x coordinates are in the top row and the y coordinates are the bottom row. Each column of the matrix may be taken as a 2-by-1 vector, and as such the matrix is a collection of 13 column vectors.\nMatrix multiplication is fundamental to image manipulation. It is a mapping function. We \"map\" a vector from one frame of reference to another. Looking back to the first article in our series, the multiplication of two matrices was shown to be\nLet's look at how this works for a 2-by-2 matrix multiplied by a 2-by-1 vector. Here is how we will reference the values in these matrices:\nThe result is a 2-by-1 vector transformed by matrix A. Expanding out the math below, notice the interaction between the terms: each value of the result is a combination of several values of the input.\nMatrix A is a transformation matrix, and its values, when mapped to vector b, transform it. The correct choice of our transformation matrix is fundamental to creating the right effect for our 2-by-13 house matrix.\nWhile we could manipulate each of the 2-by-1 vectors in our set of 13 individually, that would be sloppy. Linear algebra rescues us from the tedium. The matrix multiplication problem we looked at before readily extends to larger matrices. A 2-by-2 matrix multiplied by a 2-by-1 vector results in a 2-by-1 vector, but a 2-by-2 matrix multiplied by a 2-by-13 matrix results in another 2-by-13 matrix.\nIn essence each column of the original matrix is transformed by the matrix multiplication into the corresponding column of the result matrix. With matrix mathematics, we do the operation in one step!\nLet's add a transformation matrix to our example code before we generate the plot. To keep things simple, for the moment we'll use an identity matrix. Using an identity matrix is the equivalent of multiplying everything by 1 -- a kind of \"do nothing\" operation. However, it does provide us a way to make sure \"the math works,\" and the identity matrix is the basis for most transformation matrices.\nfrom pxDislin import *\nfrom Numeric import *\nplot = dPlot()\ntrans = array([[1,0],\n [0,1]])\naxis = dAxis(-20,20,-20,20)\nplot.add_axis(axis)\nhouse_pts_orig = array([[5,5,-5,-5,5,4,4,2,2,5,5,0,-5],\n [-5,5,5,-5,-5,-5,-1,-1,-5,-5,5,8,5]])\nhouse_pts = matrixmultiply(trans,house_pts_orig)\nhouse = dMultiLine(house_pts[0],house_pts[1])\nplot.add_object(house)\nplot.show()\n\nThe plot generated is the same as the first one shown.\nWe'll look at four basic transformations. From these simple operations, more complex functions can be constructed.\nA rotation matrix will allow us to spin the image clockwise or counterclockwise around the origin. This matrix makes use of the trigonometric functions sine and cosine. The trigonometric functions take as an argument an angle of rotation; positive angles will give a counterclockwise rotation, negative values a clockwise one. Angles are commonly measured on two scales. Most people are experienced with units of degrees -- a complete circle has 360 degrees. Computers measure angles in units of radians. To a computer, a circle has radians. We will convert degrees to radians by multiplying the degrees of our angle by pi divided by 180. That will give us the correct values for our matrix. The rotation matrix itself is defined as:\nwhere represents the angle of rotation we desire.\nAfter replacing the identity matrix in the example code with the following and running the code, we see the house is now rotated counterclockwise by 30 degrees.\nangle = 30 * pi/180\ntrans = array([[cos(angle), -sin(angle)],\n [sin(angle), cos(angle)]])\n\nUsing the rotation matrix, any point or collection of points can be easily rotated around the center point (0,0).\nReflection\nNext on the list of transformations is the reflection matrix. A reflection matrix will cause the image to be flipped, or reflected across an axis. An example of a reflection matrix that causes all the y values to be negated (thus flipping the image across the x axis) is:\nSwitching the rotation matrix with the reflection one generates the following:\nTry to figure the reflection matrix that negates only the x coordinates. Is there a matrix that negates both the x and y coordinates at the same time?\nScale\nAnother simple transformation is the scale matrix. The identity matrix can be modified to have values of other than one on the diagonal. As such, it becomes a scale matrix, changing only the size of the drawing. This matrix can be used to both scale up, a>1, and scale down, a<1 :\nShear\nThe last matrix we will explore is the \"shear\" matrix. This causes a shear motion in one particular dimension.\nThe result can be seen below for a shear matrix where k=2.\nApplying more than one transformation matrix can induce multiple actions. In addition, individual transformation matrices can be combined (via a matrix multiply) to form a complex action. Following is the result of combining a shear matrix with a reflection matrix.\nTry a few combinations of your own -- see what you can come up with.\nCurrently in our plots, the house is centered on the origin of the plot (0,0). Using vector operations, you can move the house away from the center via translation. This is accomplished by simply adding an offset vector to each of the columns in the matrix. Adding a vector of will move the drawing as shown:\nGive the combination of translation and transformation a try. What happens if you rotate a translated image?\nHopefully this only helped whet your appetite for using NumPy and learning more about linear algebra. While not shown here, extending these techniques to more dimensions (three being most common) can allow more interesting applications. In three dimensions, solid objects can be modeled and rotations and reflections can be generated around multiple axes, creating complex object motions. Such actions are fundamental to graphics drawing, modeling packages, and 3D gaming. While the mathematics of linear algebra may be abstract, they are used in common applications. NumPy helps implement these actions clearly, making this difficult topic easier to understand. If you want to play with more complex examples, consult almost any elementary text on linear algebra or books on graphics or image manipulation.\nNext month we will look past the basic NumPy functions to the additional modules provided in the standard package. Using these modules, more complex programs can be written for a wide variety of applications.\nEric Hagemann specializes in fast algorithms for crunching numbers on all varieties of computers from embedded to mainframe.\nRead more Numerically Python columns.\nDiscuss this article in the O'Reilly Network Python Forum.\nReturn to the Python DevCenter.\nCopyright © 2009 O'Reilly Media, Inc."}}},{"rowIdx":271,"cells":{"text":{"kind":"string","value":"I have a structure that looks like this:\n[ {'id': 4, 'children': None},\n {'id': 2, 'children': \n [ {'id': 1, 'children':\n [ {'id': 6, 'children': None},\n {'id': 5, 'children': None} ]\n },\n {'id': 7, 'children':\n [ {'id': 3, 'children': None} ]\n }\n ]\n }\n]\n\nI also have a list of selected IDs, [4, 5, 6, 7]. I want to traverse the list and for each object in the list, add a selected key with a value of 1 if it is selected, and 0 if it is not.\nCurrently I am doing this recursively with this function:\ndef mark_selected(tree, selected):\n for obj in tree:\n obj['selected'] = 1 if obj['id'] in selected else 0\n if obj['children'] is not None:\n obj['children'] = mark_selected(obj['children'], selected)\n return tree\n\nThis seems to work fine, but I was wondering if there was a more clever way to do this, possibly using list comprehension or generators.\nCan anyone come up with a more elegant solution for this?"}}},{"rowIdx":272,"cells":{"text":{"kind":"string","value":"melixgaro\nRe : Linkmanager : logiciel de gestion de ses URLs\nje m'inquiétais de ne rien voir venir... je patiente encore donc... Bon courage\nUtilisateur Linux depuis ~2007 : Mandriva 2007 => Ubuntu 8.04 => Ubuntu 8.10 => Opensuse 10 => Ubuntu 9.10 => Fedora 11 => Ubuntu 10.04 => Ubuntu 10.10 [la meilleure des ubuntu avant la cata unity] => Xubuntu 11.10 => Xubuntu 12.04 => Xubuntu 12.10 => Xubuntu 13.10\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nBon, ça prend forme!\nDésolé du temps pris : je suis un peu perfectionniste et je veux vraiment traiter certains soucis critiques avant de lancer une 1.0...\nEt surtout éviter au possible de maintenir des architectures bancales...\nDe +, je consacre un temps volontairement \"limité\" sur ce projet, en ayant d'autres en cours plus ou moins avancés/complexes.\nCa reste un soft pour mon usage que je mets gracieusement à la vue de tous.\nJ'ai donc mis mes derniers travaux sur une branche \"develop\" pour les plus téméraires.\nOn test ici :\nsudo pip3 install -e git+https://github.com/mothsART/linkmanager.git@5f9046ae297501892e95a779961f80fb3ad8d125#egg=linkmanager\n\nIl me reste principalement à :\n* rajouter des tests unitaires (et à corriger pas mal de tests qui ont sautés)\n* étoffer la partie \"serveur\"\n* permettre l'auto-complétion des tags dans le shell!\n* i18n : un peu de taf à ce niveau d'effectué mais ça reste encore inégal : du franglais par moment...\nSuite à ça, je pourrais sereinement penser à :\n* lancer la version 0.4 sur ppas/pypi\n* corriger le wiki en conséquence\n* refaire une campagne de pub\nQu'est-ce qui a changé ? (Liste non exhaustive)\n* ajout de la prise en charge de titres et d'URLS minimisés.\nComme évoqué, lors d'un ajout d'URL, une requête \"asynchrone\" va rechercher le titre d'une page web afin de la suggérer.\nl'URL est automatiquement minimisé à la fin de l'ajout d'un lien : via l'api d'un webservice.\nOn peut déjà choisir/changer son webservice en éditant les settings du soft mais prenez ça comme temporaire.\nMon objectif est de fournir un fichier de conf générique (/etc/linkmanager/settings.conf) et par utilisateur (/home/user/.config/linkmanager/settings.conf) selon les principes d'UNIX.\n* Justement, des variables de conf commencent à prendre place :\n* paramêtrage de la Base de donnée\n* minimizer\n* Options de la recherche : nombre maximum dans l'auto-suggestion de tags, nombre maximum de réponses\n* ajout de l'option \"verbose\" sur une recherche :\npermet d'avoir toutes les propriétés corresponds à un lien :\n$ linkm search -v\n6 liens au total trouvés :\n 1 ➤ http://ubuntu.com\n ├── title : The leading OS for PC, tablet, phone and cloud | Ubuntu\n ├── 5431572c-d859-46c2-87c8-5e1c0c1fa402\n ├── ordre de priorité : 10\n ├── tags : linux python shell ubuntu\n ├── description : Fr Ubuntu site\n └── create the 27 January 2014 at 17:37:19 and not updated yet.\n 2 ➤ https://www.404.io/404.html\n ├── 1afae9bb-8e71-46f7-aadb-701bb1353937\n ├── ordre de priorité : 10\n ├── tags :\n ├── description : no response\n └── create the 27 January 2014 at 17:37:19 and not updated yet.\n 3 ➤ https://www.docker.io\n ├── title : Homepage - Docker: the Linux container engine\n ├── ef91d3dd-35f5-40a6-9410-4a79db9175ef\n ├── ordre de priorité : 10\n ├── tags : container golang linux ubuntu\n ├── description : Container engine...\n └── create the 27 January 2014 at 17:37:19 and not updated yet.\n\n* un load de JSON est maintenant un peu plus \"intelligent\" : il permet de rechercher automatiquement les titres des pages, de minimizer à la volé les URLS etc.\nC'est du traitement asynchrone \"répartie\" (le nombre de tâches simultannées est par défaut de 5 car c'est à priori la meilleur config pour mon serveur mais ça peut être modifié dans les settings) donc optimisé pour être le plus rapide possible.\nCependant, j'imagine que ça peut vite devenir bloquant pour des grosses bases!\nIl faudrait rajouter une barre de progression sans doute, une option \"offline\" etc.\nEnfin, le load est un peu plus regardant de l'intégrité de votre base.\nIl déclenche par exemple des erreurs si dans vos fichiers json (je rappel qu'on peut très bien chargé plusieurs json d'un coup : linkm load fixture1.json fixture2.json fixture3.json) vous vous retrouvez plusieurs liens semblables présentant des propriétés différentes.\nMaintenant, la grosse évolution (celle qui vous a fait attendre) :\nUn serveur web qui se lance via :\n$ linkm wou$ link web\nça lance automatiquement la page sous firefox mais vous pouvez changer le navigateur soit dans les settings soit :\n$ linkm w chrome\nC'est vraiment minimaliste pour l'instant mais l'idée est là : la recherche de liens via des tags avec de l'auto-suggestion.\nTout est centré autours de la recherche est j'ai pris soin d'utiliser des libs solides : jquery, jquery-ui, _underscore, twitter-bootstrap.\nOn peut reprocher qu'il n'y a pas d'indentité graphique (on reconnait l'apparence de twitter-bootstrap à des kilomètres) mais j'ai vraiment pas l'envie de me concentrer sur ce point.\nCa doit à mon sens être sobre et fonctionnel.\nL'idée forte c'est \"tout sur une page\" : on est pas dans un site web mais plus dans de l'appli. (cqfd : bcp d'ajax)\nLes boutons sur la droite ne sont pas actifs mais prévisionnels :\n* un bouton \"édition\" : une fois activé, on peut rajouter des liens, et éditer ceux existants.\n* un bouton \"paramètres\" : changer pas mal d'options de settings en live et user-friendly.\nBon, je demande votre indulgence car c'est vraiment tout frais et y'a pleins de bugs potentiels :\npar exemple, le serveur ne fonctionne pas encore en mode off-line : j'utilise pour toutes les libs css/js des cdn pour booster un peu les choses mais il faudrait dans l'idéal livrer du static si c'est off.\nJ'aurais souhaité vous apporter une version demo mais j'ai essuyé quelques platres pour l'hébergement.\nAu départ, je me suis tourné vers \"Alwaysdata\" : avec leur offre gratuite, je pensais avoir tout à porté de main...\nC'est sans compter sur les dépendances : Alwaysdata propose python 3.1 et Flask ne tourne pas dessus... en plus, il faut compiler Redis.\nBref, pas du clé en main...\nJe suis en train d'étudier des solutions de VPS gratuit :\n* google app engine : n'utilise pas Redis donc obligation d'utiliser leur api Big data...\n* heroku : sans doute le meilleurs mais j'suis pour l'instant un peu perdu...\n* je viens de faire des demandes auprès d'autres VPS gratuits\nSi bien évidement, une âme charitable se propose d'héberger ou financer l'hébergement, ça serait le top.\nJe pense m'investir suffisement pour encore me soucier de ça.\nNéanmoins, je trouve que ça serais une superbe vitrine d'avoir un truc en live.\nMon avancement vient forcément avec de nouvelles idées :\nLa plus probante : possibilité de suggérés des tags automatiquements lorsque la racine du lien est reconnu.\nExemple :\ntous les sites commençant par https://www.youtube.com suggère automatiquement \"video\".\nIl faudrait que je rajoute une option pour ça.\nDans l'idéal : ça devrait être enregistré en base mais je pense sans doute inclure ça dans les settings. (trop de taf d'un coup sinon pour peu d'avantages immédiats)\nPS: je me suis aussi créé pas mal de petits outils dédiés afin d'améliorer ma productivité future sur le projet :\nPar exemple, 1 config Tmux afin de lancer 1 session pour les tests, 1 pour lancer le serveur web, 1 pour les tests unitaires, 1 pour l'accès ssh et 1 pour 1 accès sur le site en remote avec Midnight Commander. (pour passer des gros fichiers JSON par exemple)\nCa m'évite bcp de tâches répétitives!\nJ'attend vos retour avec attention.\nHors ligne\nWhite Angels\nRe : Linkmanager : logiciel de gestion de ses URLs\nJe testerais et te ferais un feedback dès que j'ai le temps !\nEn tout cas si tu as besoin d'un serveur je te prête le mien volontiers (j'ai un dédié chez online)\nOS : Ubuntu 14.04 Trusty Tahr || Nombre de convertis aux libres : 1 (peut-être une deuxième)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nPetite précision : si vous désirez tester à chaque fois la dernière version (cqfd : le dernier commit github) sans attendre des versions packagées :\nsudo pip3 install --upgrade -e git+https://github.com/mothsART/linkmanager.git@numero_du_commit#egg=linkmanager\n\nupgrade vous permet de forcer la dernière version si vous en avez déjà une d'installé et le numéro de commit, vous le trouverez facilement ici : https://github.com/mothsART/linkmanager/commits/develop\nBien à vous!\nHors ligne\nWhite Angels\nRe : Linkmanager : logiciel de gestion de ses URLs\nBonjour,\nAlors désolé, je n'ai pas eu beaucoup de temps ces derniers temps mais je viens de prendre 15 min pour tester la nouvelle version dans une virtualbox.\nPoint positif : l'interface web à l'aire de fonctionné\nPoint négatif : je ne peux plus rien faire ^^ (ajouter/rechercher des liens)\nvoici le message d'erreur quand je fais un linkm add :\nmorgan@morgan-VirtualBox:~$ linkm add \nGive one or several links (separate with spaces) : https://github.com/mothsART/linkmanager-lens\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 250, in connect\n sock = self._connect()\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 268, in _connect\n self.socket_timeout)\n File \"/usr/lib/python3.4/socket.py\", line 509, in create_connection\n raise err\n File \"/usr/lib/python3.4/socket.py\", line 500, in create_connection\n sock.connect(sa)\nConnectionRefusedError: [Errno 111] Connection refused\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.4/dist-packages/redis/client.py\", line 460, in execute_command\n connection.send_command(*args)\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 334, in send_command\n self.send_packed_command(self.pack_command(*args))\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 316, in send_packed_command\n self.connect()\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 253, in connect\n raise ConnectionError(self._error_message(e))\nredis.exceptions.ConnectionError: Error 111 connecting localhost:6379. Connection refused.\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 250, in connect\n sock = self._connect()\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 268, in _connect\n self.socket_timeout)\n File \"/usr/lib/python3.4/socket.py\", line 509, in create_connection\n raise err\n File \"/usr/lib/python3.4/socket.py\", line 500, in create_connection\n sock.connect(sa)\nConnectionRefusedError: [Errno 111] Connection refused\nDuring handling of the above exception, another exception occurred:\nTraceback (most recent call last):\n File \"/usr/local/bin/linkm\", line 12, in \n exec(compile(open(__file__).read(), __file__, 'exec'))\n File \"/home/morgan/src/linkmanager/linkm\", line 136, in \n Choices.call(args['choice'])(args['value'], verbose)\n File \"/home/morgan/src/linkmanager/linkmanager/tty.py\", line 171, in addlinks\n if db.link_exist(l):\n File \"/home/morgan/src/linkmanager/linkmanager/db/__init__.py\", line 174, in link_exist\n if not self._db.hexists('links_uuid', link):\n File \"/usr/local/lib/python3.4/dist-packages/redis/client.py\", line 1535, in hexists\n return self.execute_command('HEXISTS', name, key)\n File \"/usr/local/lib/python3.4/dist-packages/redis/client.py\", line 464, in execute_command\n connection.send_command(*args)\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 334, in send_command\n self.send_packed_command(self.pack_command(*args))\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 316, in send_packed_command\n self.connect()\n File \"/usr/local/lib/python3.4/dist-packages/redis/connection.py\", line 253, in connect\n raise ConnectionError(self._error_message(e))\nredis.exceptions.ConnectionError: Error 111 connecting localhost:6379. Connection refused.\n\nDernière modification par White Angels (Le 11/06/2014, à 09:49)\nOS : Ubuntu 14.04 Trusty Tahr || Nombre de convertis aux libres : 1 (peut-être une deuxième)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nLe problème d'une installation avec Pip c'est qu'il ne t'installes que les dépendances python et non le reste. (à la différence d'un PPA)\nIl faut installer la base de donnée Redis sur un environnement vierge sinon ça ne fonctionnera pas :\napt-get install redis-server\n\nPour le lancement du serveur, ça doit se faire en auto : linkmanager test si c'est lancé et le démarre dans le cas contraire.\nBon, je vais tenter d'avancer rapidement sur les points bloquants afin de produire une release PPA...\nHors ligne\nWhite Angels\nRe : Linkmanager : logiciel de gestion de ses URLs\nEffectivement, maintenant ça fonctionne beaucoup mieux\nBon voici quelques remarques après un test rapide :\nJe peux effectivement ajouté un lien :\nmorgan@morgan-VirtualBox:~$ linkm add\nGive one or several links (separate with spaces) : https://github.com/mothsART/linkmanager-lens\nhttps://github.com/mothsART/linkmanager-lens properties :\n tags (separate with spaces) : lens\n priority value (integer value between 1 and 10) : 10\n give a description : descr\n give a title : mothsART/linkmanager-lens · GitHub\nhttps://github.com/mothsART/linkmanager-lens b'http://urlmin.com/4qjwo'\n\nPourquoi est-ce qu'il me fourni une url raccourcis ? surtout si c'est pour ne pas l'utiliser après ...\nensuite, lorsque j’effectue une recherche :\nmorgan@morgan-VirtualBox:~$ linkm search lens\n1 links founded : \n https://github.com/mothsART/linkmanager-lens\n\nJe n'ai toujours pas le titre qui s'affiche, dommage\nQuand à l'interface web, j'ai une toute petite remarque :\nmorgan@morgan-VirtualBox:~$ linkm w\n * Running on http://127.0.0.1:7777/\n * Restarting with reloader\n127.0.0.1 - - [11/Jun/2014 11:34:37] \"GET / HTTP/1.1\" 200 -\n\nLe \"truc\" garde le focus de la console, c'est dommage ! Perso je voyais plutôt un truc comme apache ou tu fais \"linkm w start\" et il se lance plutôt que de mobiliser la console.\nSinon je n'ai pas compris comment on installe la lentille unity ...\nOS : Ubuntu 14.04 Trusty Tahr || Nombre de convertis aux libres : 1 (peut-être une deuxième)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nPour les raccourci urls et la recherche simple, je suis dac : je vais changer ça...\nPour l'interface web, je préfère ne pas daemonizer d'entrée : c'est pas vraiment un serveur comme apache à la base.\nJ'imagine que tu souhaiterais quelque chose de persistant : genre le serveur web dispo après un reboot?\nJe vais réfléchir à ça car je ne veux pas l'imposer : (genre une option de config) tous ne veulent pas ce service web en tâche de fond.\nEn attendant, fait\nnohup linkm w &\nJ'imagine que tu sais comment faire pour le lancer en auto au démarrage de ta bécanne?\net pour le killer\nkillall linkm\nHors ligne\nWhite Angels\nRe : Linkmanager : logiciel de gestion de ses URLs\nC'est pour cela que j'aurais bien vu une option start et stop.\nGenre :\nlinkm w(eb)\n\nlance le serveur comme il le fait actuellement\nlinkm w(eb) start\n\nlance le serveur de manière persistante\nPS : Par contre je n'ai toujours pas réussit à installé la lentille Unity\nDernière modification par White Angels (Le 11/06/2014, à 13:14)\nOS : Ubuntu 14.04 Trusty Tahr || Nombre de convertis aux libres : 1 (peut-être une deuxième)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nPour le serveur persistant, je vais voir ce que je peux faire mais je ne veux pas m'éparpiller.\nPour que les bugs soient loggés et que le serveur soit relancé en cas d'erreur, il faudrait que je mettes en place un soft comme \"supervisor\" : en somme, faire un vrai daemon.\nCette experience me permettra sans doute de mieux apréhender une version \"desktop\" persistante.\n(genre un paquet deb à part qui ajoute un lanceur avec son logo)\nPour la lentille Unity, tu l'as peut-être bien installé mais vu que l'API a changé, elle ne fonctionne tout simplement pas.\nUne fois la 0.4 sortie, je regarde pour la mettre à jour et en faire un .deb dans le ppa.\nJe me créerais une VM virtualbox pour la tester...\nHors ligne\nWhite Angels\nRe : Linkmanager : logiciel de gestion de ses URLs\nEst-ce que pour la 0.4 tu pourrais créer une sorte de base de donnée distante ?\nUn moyen de partager une bdd entre plusieurs appareilles, par exemple au taff lorsque j'ajoute un favoris je ne peux pas le retrouver chez moi ! ça serait bien si je pouvais partagé mes favoris entre mes appareilles !\nOS : Ubuntu 14.04 Trusty Tahr || Nombre de convertis aux libres : 1 (peut-être une deuxième)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nAprès un long temps de vide, voici enfin quelques news du projet :\nJ'ai pêché pas mal sur ma gestion du temps.\nUn gros remaniement qui m'a valu beaucoup de boulot et qui devrait simplifier la suite du dev :\nNiveau utilisateur, rien de bien transendant : une évolution naturel vers quelque chose de fonctionnel avec tous les intérêts (je l'espère) du web par rapport à de la ligne de commande.\nPour le coup, j'ai suivi la mode du \"flat design\" (pour la version web) plus par fainéantise que par réelle adhésion.\nL'avantage évident est de concentrer l'utilisateur uniquement sur les fonctionnalités.\nJ'ai pris soin de réfléchir à l'ergonomie :\n* le bouton \"edit mode\" permet de basculer d'un mode de lecture à celui d'écriture.\n* l'édition d'un lien et de ses propriétés passe par des validateurs avec des messages d'avertissement ou d'erreur si besoin.\n* l'édition des tags se fait plus naturellement avec la lib (tag-it) que j'ai légèrement monkey-patché pour l'occasion.\n* les icônes de twitter bootstrap ainsi que le code des couleurs ont été choisi avec attention.\nC'est pas forcément de bon goût mais c'est parlant.\n* HTML5/CSS3 avec ajout de petits effets CSS : je me suis amusé un peu mais ça reste de l'amateurisme.\nJ'ai pas forcément le bagage suffisant dans la partie intégration et ne vais pas m'embêter pour l'instant à tester d'autres navigateurs que firefox/chrome.\nDe l'aide en ce sens n'est pas de refus.\n* utilisation de flask-asset (http://flask-assets.readthedocs.org/en/latest/) :\nparce que je souhaitais faire du lazyloading avec du inlining sur du css et javascript...\nCeci n'est valable qu'en mode DEBUG=False bien évidement.\nBon, les optimisations sont encore douteuses sur le css, j'hésites sur l'utilisation de datauri etc. mais ça reste peu important pour le commun des mortelles.\n* Pour les tests unitaires, utilisation de \"fakeredis\" : évite d'utiliser une base poubelle pour les tests!!\nEn théorie, c'est génial... mais la réalité a été plus compliqué, arg.\nIl manquait l'implémentation d'une méthode \"type()\" dans Fakeredis : je l'ai donc patché puis effectué un Pull Request.\nEn attendant d'être intégré (ou pas), j'utilise la dépendance de mon dépôt github.\n* utilisation de la librairie _underscore.js (encore une dépendance) : ça m'a permis de concerver un code JS à peu prêt lisible...\n* prise en charge de \"l'auteur\" en tant que propriété : possibilité de le définir dans la configuration.\n* rajout de fichiers de configuration pour tous les utilisateurs : /etc/linkmanager.conf et spécifique à un utilisateur : ~/.config/linkmanager.conf. Ce dernier est créé si il n'existe pas (avec des valeurs par défaut) lors du lancement du soft par l'utilisateur en question.\n* rajout d'une option READ_ONLY : permet d'accéder à son webservice uniquement en lecture.\nPratique si on veut rendre publique ses liens sans qu'un tiers ne puissent en ajouter/modifier/supprimer.\nVu que c'est limite *énervant* à tester (une UI) et que je suis pas un gourou de javascript, j'imagine ne pas être excent de bugs...\nvotre relecture, utilisation et feedback n'en sera que plus appréciable!!\nPour mettre à jour:\nsudo pip3 install -e git+https://github.com/mothsART/linkmanager.git@5387d04d0bd256f84da514b4677a88590754a2c8#egg=linkmanager\n\nSi vous avez déjà une base de donnée auquel vous tenez, faites un :\nlinkm dump >| /tmp/linkmanager.json\nsudo pip3 install -e git+https://github.com/mothsART/linkmanager.git@5387d04d0bd256f84da514b4677a88590754a2c8#egg=linkmanager\nlinkm load /tmp/linkmanager.json\n\nCa devrait vous évitez une tonne de bugs bizarres.\nDernière grande ligne avant la 0.4 :\n* une auto-complétion des tags en mode ligne de commande\n* toutes les traductions à jour\n* Rajout de tests unitaires (dont un jsonschema pour les import/export : https://github.com/Julian/jsonschema) avec une meilleur couverture et éventuellement des tests sur la partie web\n* maj sur pypi et de mon ppa (je vais aussi mettre une option de mise à jour de sa base pour éviter de faire la manip proposé précédement)\n* paquet pour ArchLinux (j'ai 2 ordi sur 3 maintenant sous Arch)\n* maj de la doc\nDernière modification par moths-art (Le 14/09/2014, à 09:33)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nVoici ma Roadmap pour la 0.5 :\n* Linkmanager en mode \"server\":\nJ'ai pas mal réfléchi à la demande de \"WhiteAngels\" et ne voulais surtout pas me lancer tête baissé dans quelque chose de complexe.\nJe précise que mon intérêt est bien présent dans cette fonctionnalité car j'ai une rasperry-pi qui fait office de serveur local dans mon LAN et pouvoir partager mes liens facilement devient une nécessité.\nJe suis donc passé par une réflexion \"papier\".\nSans trop rentrer dans le détail, je vais utiliser git pour ce faire afin de gérer des situations cocasses dont principalement \"les conflits\".\nCa risque d'être coton a tester mais vu que je suis joueur...\n* mode offline avec caching des pages :\n* si la page a changé depuis son enregistrement, un diff sera possible\n* version web :\n* rajout de flux rss\n* multi-pages avec une option de configuration (ex: MAX_RESULTS_BY_PAGE = 10)\n* nuage de tags avec la possibilité d'en glisser/déposer.\n* possibilité d'avoir le favicon et un aperçu du site au survol.(imprim écran)\nRoadmap encore indéfini :\n* utilisation dans emacs : \"org-mode\" et \"web-mode\" principalement\n* la possibilité de changer la configuration de linkmanager dans l'interface web\n* Utilisation d'autres BDD que Redis\n* Benchmarks\n* Import/export avec Delicious et/ou evernote\n* plugin firefox/chrome\n* Doc exhaustive sur readthedocs.org\n* amélioration du manpage (et version en français)\n* mise en ligne d'une version démo on-line + site de présentation du projet (sans doute créé avec pelican: http://blog.getpelican.com/ donc sous forme de blog avec une version français/anglais)\n* maj de la doc sous ubuntu-fr\nMerci de vos contributions et de votre patience\nDernière modification par moths-art (Le 14/09/2014, à 09:33)\nHors ligne\nmoths-art\nRe : Linkmanager : logiciel de gestion de ses URLs\nLa version 0.4 est dispo sur pypi :\nComme annoncé, elle est fourni avec :\n* une auto-complétion des tags en cli\n* le soft en français (seulement en cli) et anglais\nConseil : mettez à jour votre installateur (pip) :\nsudo pip3 install --upgrade pip\n\npuis\nsudo pip3 install --upgrade linkmanager\n\nHors ligne"}}},{"rowIdx":273,"cells":{"text":{"kind":"string","value":"Consolidation, integration, refactoring, and migration are some of today's popular data center catchwords. All of these words reflect some kind of renewal or replacement process--the old is either substantially modified or thrown in the garbage and replaced with the new. However, in many cases, we are often stuck with old equipment and software. We must continue to extract more services from aging infrastructure and still make reasonable claim to them being manageable.\nJava Dynamic Management Kit (JDMK) is a framework for the creation of Java-based management software and legacy SNMP-based systems. It extends Java Management Extensions (JMX), which allows instrumented applications to remotely monitor resources throughout the network.\nOne of the files I'll use contains a list of managed objects, which can be referenced by JDMK code. The following listing is an excerpt from a generated Java file, called RFC1213_MIBOidTable.java (available in the sample code, in the Resources section below). This file is generated with reference to a specified standard MIB file.\n//Metadata definitions for managed objects of interest\nnew SnmpOidRecord(\"ifInOctets\", \"1.3.6.1.2.1.2.2.1.10\", \"C\"),\nnew SnmpOidRecord(\"ifLastChange\", \"1.3.6.1.2.1.2.2.1.9\", \"T\"),\nnew SnmpOidRecord(\"ifOperStatus\", \"1.3.6.1.2.1.2.2.1.8\", \"I\"),\nThe symbols in each\nSnmpOidRecord can be directly accessed by network management software. This is our interface into the managed network devices.\nLater, I'll look at ways in which JDMK can provide something of a management makeover for legacy devices. As we'll see, it's reasonably easy and inexpensive to produce entry-level management tools. Such tools may even help IT managers to gain a deeper understanding of the dynamics of their networks and the services that sit on top of them.\nOne other take-away for readers is the use of the adapter pattern as a means of accessing the JDMK API. This increases the level of abstraction in the way we use the standard APIs.\nImagine you've just been promoted to network manager with a staff of two. You're now responsible for all of the computing devices on a site with 200 people spread across four departments. Part of the task is also connection the corporate WAN, telephony system support, PC upgrades, application deployment, server support, etc. Basically, you've got to concentrate on everything!\nLet's assume Figure 1 is the hypothetical network for which you've become responsible.\nFigure 1. An enterprise network\nIn Figure 1, we see a schematic diagram of a single building with three floors. The devices on each floor are connected into a switch--in many cases, these individual links will each have bandwidth of 10Mbps and terminate in a wiring closet (not shown). The switches in turn are connected (via Links 1, 2, and 3) to a floor-level switch (F1 for floor 1, F2 for floor 2, and F3 for floor 3). In turn, each floor-level switch is connected by a high-speed link to a core switch. The latter might then be connected to a WAN link or a service provider network.\nLooking at Figure 1, we can immediately discern some possible problem areas. The following items represent single points of failure:\nRemember that a network is only ever as strong as its weakest link--this means that our network is vulnerable. It's the job of the network designer to try to balance service continuity against the cost of providing redundancy. In Figure 1, there are some weak points that might profit from a review! I'll focus on these by writing some JDMK code to help us see when problems have occurred and when problems might be just about to occur.\nRelated Reading\nAn important requirement in any IT manager's job is identifying the weak points in the network. This involves a careful combination of talking to your users and your predecessor (if possible) and instigating data collection. Every network has its very own folklore! Certain network links may periodically become overloaded; one or two routers or switches may be a little flaky; a server may be past its sell-by date, etc.\nA considerate predecessor might well pass on such vital information to you as you embark on your new job. Let's assume your predecessor is a kindly soul who wants to help you make an orderly transition into your new role. Further, let's assume that she tells you to \"Watch out for Link 1--it tends to become congested, and the folks on Floor 1 get a little angsty.\" This is important insider know-how, and we'll put it to use in the Java code later on.\nIn many cases, networks are held together by a fragile combination of scripts and insider know-how. What I hope to show in this article is that it is pretty straightforward to produce some JDMK tools that will assist you in holding your own against the network you manage. There is, of course, no real substitute for a well-designed and well-maintained network, but even in this rare case, our Java tools might provide some assistance.\nHP OpenView Network Node Manager (NNM) provides a widely used application that is found in both enterprise and service provider networks. It provides some useful features, including automatic discovery and mapping of network devices, receipt of notification messages, and the ability to add your own proprietary software. In short, NNM provides a GUI that allows you to see your network. If NNM is available to you, then it may prove invaluable in discovering and monitoring your network. If not, then don't despair!\nThe key to effective IT management is selective use of automated tools. If you have access to high-end application software, then use it. As we move into an era of autonomic computing, it will increasingly be the case that systems and software will execute some or all of their own management. Get aboard this bandwagon early by maximizing your use of software solutions in your IT management tasks!\nUsing JDMK, we can create software that both listens for events and pro-actively reads device status. In this article, I'll be focusing on the latter, just to illustrate the principles.\nTo begin with, I'll write a simple program that looks at a specific network link and tries to determine if it's prone to congestion. We do this by sampling and averaging some SNMP counters on an interface at one end of this link. These are standard objects that are maintained by the SNMP entity running on the device. Sometimes, the SNMP entity is not running by default--in this case, I'll assume the network manager (i.e., your predecessor!) has chosen to run SNMP on all of those devices where it is available. Let's now describe the simple requirements for the code.\nWe want to create some software that fulfils the following simple requirements:\nAn interface usually has an administrative state and an operational state. The administrative state is the one desired by the network manager; i.e., \"I want this interface to be up.\" The operational state is the actual state of the interface. Try to think about the operational state as the network's response to the requested state. If the administrative state is up and the operational state is down, then we know there's a problem.\nThe interface type I'll be using is Ethernet, specifically 10Mbps (or 10,000,000bps). I'll be retrieving a snapshot of the count of incoming bits received at an interface at one end of Link 1 in Figure 1. This will give us an instantaneous picture of the inward traffic level at that interface. Then, we'll wait a bit and retrieve the same counter value. The difference between these two values gives us the required utilization value. Let's have a look at some source code now.\nThe Java class I use is called RequestData. It contains a main() method and makes use of the following JDMK resources (among others):\nimport com.sun.management.snmp.SnmpDefinitions;\nimport com.sun.management.snmp.SnmpOid;\nimport com.sun.management.snmp.SnmpVarBindList;\nimport com.sun.management.snmp.manager.SnmpPeer;\n\nTo begin with, I initialize the SNMP Manager API. This allows us to access the generated table mentioned in the introduction.\nfinal SnmpOidTableSupport oidTable =\n\tnew RFC1213_MIBOidTable();\nSnmpOid.setSnmpOidTable(oidTable);\n\nNext, I create an SnmpPeer object. This represents the entity with which we will communicate. Note that this uses the port passed in as a command-line parameter.\nfinal SnmpPeer agent =\n\tnew SnmpPeer(host, Integer.parseInt(port));\n\nWe must now create a communications session with the remote entity. This requires us to specify SNMP community strings. These data elements are then associated with the agent.\nfinal SnmpParameters params =\n\tnew SnmpParameters(\"public\", \"private\");\nagent.setParams(params);\n\nWe're nearly there! We now have to build the session to manage the data request and then we're ready to create the data request list (or variable binding list).\nfinal SnmpSession session =\n\t\tnew SnmpSession(\"SyncManager session\");\nsession.setDefaultPeer(agent);\nfinal SnmpVarBindList list =\n\t\tnew SnmpVarBindList(\n\t\t\"SyncManager varbind list\");\n\nThe program is a single JDMK class that builds an SNMP request message. This message specifies four objects of interest, using the following code:\n// A description of the host device\nlist.addVarBind(\"sysDescr.0\");\n// The operational state of interface 1\nlist.addVarBind(\"ifOperStatus.1\");\n// The number of incoming octets on interface 1\nlist.addVarBind(\"ifInOctets.1\");\n// The speed of interface 1\nlist.addVarBind(\"ifSpeed.1\");\n\nOur four required objects are packed into an SNMP getRequest message and sent to the receiving entity as follows:\nSnmpRequest request =\n session.snmpGetRequest(null, list);\n\nWe now retrieve the same set of objects twice; the difference in time between the samples is found using this Java code:\n// Calculate the time between messages\nlong oldTime = date1.getTime();\nlong newTime = new Date().getTime();\nlong elapsed = (newTime - oldTime) / MS_DIVIDEND;\nprintln(\"Elapsed time in seconds \" + elapsed);\n\nIn this section, we get the most recent time and subtract a time value recorded just before the first retrieval. This gives us a rough estimate of the elapsed time between the data samples.\nWhen the returned data is displayed, we see the following major elements:\nValue : 25625, Object ID : 1.3.6.1.2.1.2.2.1.5.1 (Syntax : Gauge32)\nValue : 10000000\n>> Press Enter to resend the request.\nElapsed time in seconds 16\nValue : 26005, Object ID : 1.3.6.1.2.1.2.2.1.5.1 (Syntax : Gauge32)\nValue : 10000000\n\nThe three bold data items above represent the two values of the ifInOctets object taken at an interval of 16 seconds. The selected interface (which supports a speed of 10,000,000bps) has received 25625 octets (or bytes) at the time T1 and 26005 octets at the time T2. To determine the incoming link utilization, we apply the following formula:\nIncoming Link % Utilization = ((T2 octets - T1 octets) * 8 * 100) / (ifSpeed * Sample speed)\nPlugging in the values above gives us a utilization of (26005 - 25625) * 8 * 100/(10,000,000 * 16), or 0.0019 percent.\nClearly, the interface is very lightly loaded on the incoming side! A similar measurement can be made for the outgoing direction (using the ifOutOctets object instead). Then, both values can be summed to determine the overall loading. Obviously, care is required in drawing any conclusions from the figures (they are instantaneous snapshots of data that can change rapidly), but they do provide some minimal level of understanding of the loading on the interface.\nPlying this program with diligence and observing loading trends over a period of a day might lead us to understand why the outgoing network manager made the comment concerning Link 1. In any case, it means that you are beginning to learn about the secrets that the network holds in store! Extending this approach to other regions of the network should help in acquiring a broader understanding again.\nTo run the example program, you'll need to install JDMK. Free evaluation copies can be downloaded from Sun Microsystems, though these copies expire after 90 days. So don't be too leisurely about running this code! Alternatively, if you win a couple of lotteries, you might be tempted to purchase JDMK.\nIn either case, just follow the instructions in the examples\\current\\Snmp\\Manager\\ReadMe file and the example should compile and run successfully. I used JDMK version 5.1. Also, there's detail and further Java examples in my book, Network Management, MIBs & MPLS: Principles, Design & Implementation--no lottery win required!\nI strongly encourage using the adapter pattern to hide the complexity of the JDMK API. Really, JDMK isn't complex per se, but it is proprietary. For this reason, it's important to not litter your application code with calls into such an API. The adapter provides a useful model for achieving this noble design aim.\nThe adapter serves to insulate the application code from the details of the JDMK (or other) technology. Your code then calls into the adapter, rather than directly using the JDMK interface. So, if you later decide to change from JDMK and use another technology, any required changes to your code will have been minimized ahead of time.\nFurther details on the adapter pattern and its applications can be found in design pattern books, such as O'Reilly's Head First Design Patterns.\nSupporting legacy systems and equipment is difficult and unforgiving, particularly as IT budgets and staffing levels are squeezed. However, nothing is too much of a challenge for a game Java developer! Using some simple concepts from network management and SNMP, it's possible to quickly create some quite powerful JDMK-based software tools. These tools can be used to keep an eye on troublesome corners of your network, while you get on with more interesting tasks. They might also help you troubleshoot in times of difficulty.\nI've barely scratched the surface of what's possible with JDMK: you can employ notifications, create your own agents as well as managers, use browsers to access the management infrastructure, etc. However, perhaps more importantly, what we have seen on the one hand is the conceptual simplicity of network management, and on the other the potentially boundless complexity of running a network. Both endeavors must meet at a common boundary, and JDMK provides a fertile ground for this.\nStephen B. Morris is an independent writer/consultant based in Ireland.\nReturn to ONJava.com.\nCopyright © 2009 O'Reilly Media, Inc."}}},{"rowIdx":274,"cells":{"text":{"kind":"string","value":"michelk\nla lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonjour,\nAprès une mise à jour, la lecture de flux radio ne fonctionne plus (ubuntu 12.10 - rhythmbox). Lorsque je clique sur les noms des radios, celles-ci s'affichent avec un sens interdit. J'ai essayé de lancer rhythmbox à partir d'un terminal.\nVoici ce que j'obtiens:\nFontconfig warning: \"/etc/fonts/conf.d/50-user.conf\", line 9: reading configurations from ~/.fonts.conf is deprecated.\n** (rhythmbox:5591): WARNING **: GObject.get_data() and set_data() are deprecated. Use normal Python attributes instead\n(rhythmbox:5591): Rhythmbox-WARNING **: Could not open device /dev/radio0\n\nJ'ai aussi tenté un démarrage de rhythmbox avec la commande sudo. Quelques radios fonctionnent, mais la plupart affichent également un sens interdit. De plus les radios que j'ai installées n'apparaissent plus dans le menu\nQue puis-je faire?\nMerci pour vos réponses,\nM.\nHors ligne\nmichelk\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonjour,\nJe suis passé à la version 13.04 d'ubuntu, certaines radios fonctionnent mais la plupart ne s'ouvrent pas.\nCelles-ci par exemple ne fonctionnent pas:\nhttp://mp3.streampower.be/klaracontinuo-high\nhttp://www.static.rtbf.be/radio/musiq3/ … 3_128k.m3u\nEst-ce en rapport avec le type de fichier(la deuxième fonctionnait avant la mise à jour pourtant)?\nUne idée?\nHors ligne\nmichelk\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBon, toujours rien, je tente un p'tit UP?\nHors ligne\nphiloup44\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nSalut\nRegardes dans RHYTHMBOX > éditions > Greffons > Configurer les gréffons\nsi\n- Radio FM\nest activée ou non ...\npeut etre qu'une option a été décochée ... ??\nDernière modification par philoup44 (Le 06/05/2013, à 19:51)\nHors ligne\ncricriber\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonjour tout le monde,\nMême problème pour moi, pas de lecture ou si début de lecture plantage de rythmbox.\nHors ligne\nsono68200\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nChez moi pas de lecture non plus de radio sur la 13.04. Cela fonctionnait il y a quelques temps. Quand je double clic sur une radio, rien... Quand je séléctionne une radio puis clique sur play, il l'a met en pause, alors qu'elle ne s'est même pas lancée... Puis en recliquant reste sur pause... J'ai essayé Nostalgie, Rires & Chansons...\nMembre attitré de la brigade des S.Un peu zinzin sur les bords, sourire est mon quotidien.\nHors ligne\nismael54\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nIdem sous la 13.04 ! On va dire qu'à part lire de la musique rien ne marche malheureusement...\nPour les radios j'ai le même problème que sono68200 mais pour les podcasts aussi, la plupart du temps ça plante avant que j'ai fini de m'y abonner via l'interface, j'ai pu écouter quelques secondes mais il a planté pour x raison\nHors ligne\nguigui85\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nOk, à mon tour (sur le bon topic) et mêmes problèmes constatés depuis que je suis sur la 13.04, à la fois pour les radios et les podcasts. A mon sens, il y a des problèmes de greffons, voire de sources de logiciel qui ont été désactivés pour le passage à \"raring\". A voir comment ça évolue dans les jours ou semaines qui viennent ?\nLe plus dur, c'est de ne pas penser.\nHors ligne\nBob dit l'Âne\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonsoir\nJ'ai le même problème avec Rythmbox depuis la mise à niveau vers Raring.\nPar contre, ça marche très bien pour les flux radio avec VLC, Banshee ou encore Radio Tray.\nRevenons à Rythmbox. J'ai essayé dans un terminal et pour moi ça marche avec la commande \"sudo rythmbox\"\nAkoya MD 97860 P7612 Core 2 Duo T6500 NVIDIA Realtek RTL8191SE Wireless LAN GeForce G210M\nUbuntu 14.04 LTS (« The Trusty Tahr », le tahr sûr)\nLes paroles s'envolent, les écrits restent !\nHors ligne\nguigui85\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonjour,\nil fallait être un âne pour ne pas utiliser VLC et les innombrables radios fournies, idem pour les podcasts.\nA suivre pour Rhythmbox, donc. Mais ça devient moins urgent du coup, même si le tout en un, c'est plus pratique, quand ça marche....\nLe plus dur, c'est de ne pas penser.\nHors ligne\npcouderc\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nJe trouve irritant et pas professionnel qu'après un passage standard à la 13.04 mon fichier radio m3u ne marche plus. Bon je vais revenir à un bon vieux VLC, mais il me faut aller bidouiller ça tous les 6 mois, c'est pénible, on oublie la procédure en 6 mois.\nHors ligne\nzniavre\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nje lance la radio via le fichier .m3u, cela ne fonctionne pas (normal ?), je suis l'action par, alt+f2 'killall gvfsd-http' et hop la radio se lance (re-normal ?)\napparement bug connu depuis 2 ou 3 version d'ubuntu .\nVous pouvez y rajouter tout le fûmier que vous pouvez , pour un chêne centenaire ...faut cent ans.\nHors ligne\nptiprince\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nBonjour,\nPareil pour moi, plus de radios ... c'est triste quand même ....:(\nHors ligne\nptiprince\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nMoi aussi je n'ai plus accès aux radio ni last FM ... bref, comme si rhythmbox n'était plus relié au web (alors que Internet fonctionne très bien) ...\nHors ligne\nguigui85\nRe : la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox)\nPour ma part, tout refonctionne normalement depuis la 14.04 sans aucune intervention particulière, hormis les mises à jours.\nIl faut peut être voir les mises à jours des paquets synaptics qui sont, pour de bonnes raisons, désactivés ou \"nettoyés\" lors des changements de version.\nDernière modification par guigui85 (Le 27/07/2014, à 11:07)\nLe plus dur, c'est de ne pas penser.\nHors ligne"}}},{"rowIdx":275,"cells":{"text":{"kind":"string","value":"ZhangHuangbin wrote:\n*) You should remove it from Postfix, that's why you need this plugin for per-user restriction.\nCheck!\nIt works now. I just updated the plugin a little:\n\"\"\"Reject sender login mismatch (sender in mail header and SASL username).\"\"\"\nimport logging\nfrom libs import SMTP_ACTIONS\nREQUIRE_LOCAL_SENDER = False\nREQUIRE_LOCAL_RECIPIENT = False\nSENDER_SEARCH_ATTRLIST = []\nRECIPIENT_SEARCH_ATTRLIST = []\n# Allow sender login mismatch for below senders.\nALLOWED_SENDERS = ['some-email-address@here.com']\ndef restriction(**kwargs):\n # The sender appears in 'From:' header.\n sender = kwargs['sender']\n # Username used to perform SMTP auth\n sasl_username = kwargs['smtp_session_data'].get('sasl_username', '').lower()\n logging.debug('Sender: %s, SASL username: %s' % (sender, sasl_username))\n if sasl_username: # Is a outgoing email\n # Compare them\n if sender != sasl_username:\n if sasl_username in ALLOWED_SENDERS:\n return SMTP_ACTIONS['default']\n else:\n # Log message without reject.\n logging.info('Sender login mismatch.')\n # Reject without reason.\n #return SMTP_ACTIONS['reject']\n # Reject with reason.\n # There must be a space between smtp action and reason text.\n return SMTP_ACTIONS['reject'] + ' ' + 'Sender login mismatch.'\n return SMTP_ACTIONS['default']\n\nWithin the \"else\" tree, there was no return statement active.\nSo it always returned SMTP_ACTIONS['default'] even if it should have returned SMTP_ACTIONS['reject'].\nThank you very much! A very nice feature!\nBest,\nAchim"}}},{"rowIdx":276,"cells":{"text":{"kind":"string","value":"Download\nFREE PDF\nData mining is the extraction of implicit, previously unknown, and potentially useful information from data. It is applied in a wide range of domains and its techniques have become fundamental for several applications.\nThis Refcard is about the tools used in practical Data Mining for finding and describing structural patterns in data using Python. In recent years, Python has become more and more used for the development of data centric applications thanks to the support of a large scientific computing community and to the increasing number of libraries available for data analysis. In particular, we will see how to:\nEach topic will be covered by code examples based on four of the major Python libraries for data analysis and manipulation: numpy, matplotlib,sklearn and networkx.\nUsually, the first step of a data analysis consists of obtaining the data and loading the data into our work environment. We can easily download data using the following Python capability:\nimport urllib2\nurl = 'http://aima.cs.berkeley.edu/data/iris.csv'\nu = urllib2.urlopen(url)\nlocalFile = open('iris.csv'', 'w')\nlocalFile.write(u.read())\nlocalFile.close()\n\nIn the snippet above we used the library urllib2 to access a file on the website of the University of Berkley and saved it to the disk using the methods of the File object provided by the standard library. The file contains the iris dataset, which is a multivariate dataset that consists of 50 samples from each of three species of Iris flowers (Iris setosa, Iris virginica and Iris versicolor). Each sample has four features (or variables) that are the length and the width of sepal and petal, in centimeters.\nThe dataset is stored in the CSV (comma separated values) format. It is convenient to parse the CSV file and store the information that it contains using a more appropriate data structure. The dataset has 5 rows. The first 4 rows contain the values of the features while the last row represents the class of the samples. The CSV can be easily parsed using the function genfromtxt of the numpy library:\nfrom numpy import genfromtxt, zeros\n# read the first 4 columns\ndata = genfromtxt('iris.csv',delimiter=',',usecols=(0,1,2,3)) \n# read the fifth column\ntarget = genfromtxt('iris.csv',delimiter=',',usecols=(4),dtype=str)\n\nIn the example above we created a matrix with the features and a vector that contains the classes. We can confirm the size of our dataset looking at the shape of the data structures we loaded:\nprint data.shape\n(150, 4)\nprint target.shape\n(150,)\n\nWe can also know how many classes we have and their names:\nprint set(target) # build a collection of unique elements\nset(['setosa', 'versicolor', 'virginica'])\n\nAn important task when working with new data is to try to understand what information the data contains and how it is structured. Visualization helps us explore this information graphically in such a way to gain understanding and insight into the data.\nUsing the plotting capabilities of the pylab library (which is an interface to matplotlib) we can build a bi-dimensional scatter plot which enables us to analyze two dimensions of the dataset plotting the values of a feature against the values of another one:\nfrom pylab import plot, show\nplot(data[target=='setosa',0],data[target=='setosa',2],'bo')\nplot(data[target=='versicolor',0],data[target=='versicolor',2],'ro')\nplot(data[target=='virginica',0],data[target=='virginica',2],'go')\nshow()\n\nThis snippet uses the first and the third dimension (sepal length and sepal width) and the result is shown in the following figure:\nIn the graph we have 150 points and their color represents the class; the blue points represent the samples that belong to the specie setosa, the red ones represent versicolor and the green ones represent virginica.\nAnother common way to look at data is to plot the histogram of the single features. In this case, since the data is divided into three classes, we can compare the distributions of the feature we are examining for each class. With the following code we can plot the distribution of the first feature of our data (sepal length) for each class:\nfrom pylab import figure, subplot, hist, xlim, show\nxmin = min(data[:,0])\nxmax = max(data[:,0])\nfigure()\nsubplot(411) # distribution of the setosa class (1st, on the top)\nhist(data[target=='setosa',0],color='b',alpha=.7)\nxlim(xmin,xmax)\nsubplot(412) # distribution of the versicolor class (2nd)\nhist(data[target=='versicolor',0],color='r',alpha=.7)\nxlim(xmin,xmax)\nsubplot(413) # distribution of the virginica class (3rd)\nhist(data[target=='virginica',0],color='g',alpha=.7)\nxlim(xmin,xmax)\nsubplot(414) # global histogram (4th, on the bottom)\nhist(data[:,0],color='y',alpha=.7)\nxlim(xmin,xmax)\nshow()\n\nThe result should be as follows:\nLooking at the histograms above we can understand some characteristics that could help us to tell apart the data according to the classes we have. For example, we can observe that, on average, the Iris setosa flowers have a smaller sepal length compared to the Iris virginica.\nClassification is a data mining function that assigns samples in a dataset to target classes. The models that implement this function are called classifiers. There are two basic steps to using a classifier: training and classification. Training is the process of taking data that is known to belong to specified classes and creating a classifier on the basis of that known data. Classification is the process of taking a classifier built with such a training dataset and running it on unknown data to determine class membership for the unknown samples.\nThe library sklearn contains the implementation of many models for classification and in this section we will see how to use the Gaussian Naive Bayes in order to identify iris flowers as either setosa, versicolor or virginica using the dataset we loaded in the first section. To this end we convert the vector of strings that contain the class into integers:\nt = zeros(len(target))\nt[target == 'setosa'] = 1\nt[target == 'versicolor'] = 2\nt[target == 'virginica'] = 3\n\nNow we are ready to instantiate and train our classifier:\nfrom sklearn.naive_bayes import GaussianNB\nclassifier = GaussianNB()\nclassifier.fit(data,t) # training on the iris dataset\n\nThe classification can be done with the predict method and it is easy to test it with one of the sample:\nprint classifier.predict(data[0])\n[ 1.]\nprint t[0]\n1\n\nIn this case the predicted class is equal to the correct one (setosa), but it is important to evaluate the classifier on a wider range of samples and to test it with data not used in the training process. To this end we split the data into train set and test set, picking samples at random from the original dataset. We will use the first set to train the classifier and the second one to test the classifier. The function train_test_split can do this for us:\nfrom sklearn import cross_validation\ntrain, test, t_train, t_test = cross_validation.train_test_split(data, t, …\ntest_size=0.4, random_state=0)\n\nThe dataset have been split and the size of the test is 40% of the size of the original as specified with the parameter test_size. With this data we can again train the classifier and print its accuracy:\nclassifier.fit(train,t_train) # train\nprint classifier.score(test,t_test) # test\n0.93333333333333335\n\nIn this case we have 93% accuracy. The accuracy of a classifier is given by the number of correctly classified samples divided by the total number of samples classified. In other words, it means that it is the proportion of the total number of predictions that were correct.\nAnother tool to estimate the performance of a classifier is the confusion matrix. In this matrix each column represents the instances in a predicted class, while each row represents the instances in an actual class. Using the module metrics it is pretty easy to compute and print the matrix:\nfrom sklearn.metrics import confusion_matrix\nprint confusion_matrix(classifier.predict(test),t_test)\n[[16 0 0]\n[ 0 23 3]\n[ 0 0 18]]\n\nIn this confusion matrix we can see that all the Iris setosa and virginica flowers were classified correctly but, of the 26 actual Iris versicolor flowers, the system predicted that three were virginica. If we keep in mind that all the correct guesses are located in the diagonal of the table, it is easy to visually inspect the table for errors, since they are represented by the non-zero values outside of the diagonal.\nA function that gives us a complete report on the performance of the classifier is also available:\nfrom sklearn.metrics import classification_report\nprint classification_report(classifier.predict(test), t_test, target_names=['setosa', 'versicolor', 'virginica'])\n precision recall f1-score support\n setosa 1.00 1.00 1.00 16\nversicolor 1.00 0.85 0.92 27\n virginica 0.81 1.00 0.89 17\navg / total 0.95 0.93 0.93 60\n\nHere is a summary of the measures used by the report:\nThe support is just the number of elements of the given class used for the test. However, splitting the data, we reduce the number of samples that can be used for the training, and the results of the evaluation may depend on a particular random choice for the pair (train set, test set). To actually evaluate a classifier and compare it with other ones, we have to use a more sophisticated evaluation model like Cross Validation. The idea behind the model is simple: the data is split into train and test sets several consecutive times and the averaged value of the prediction scores obtained with the different sets is the evaluation of the classifier. This time, sklearn provides us a function to run the model:\nfrom sklearn.cross_validation import cross_val_score\n# cross validation with 6 iterations \nscores = cross_val_score(classifier, data, t, cv=6)\nprint scores\n[ 0.84 0.96 1. 1. 1. 0.96]\n\nAs we can see, the output of this implementation is a vector that contains the accuracy obtained with each iteration of the model. We can easily compute the mean accuracy as follows:\nfrom numpy import mean\nprint mean(scores)\n0.96\n\nOften we don't have labels attached to the data that tell us the class of the samples; we have to analyze the data in order to group them on the basis of a similarity criteria where groups (or clusters) are sets of similar samples. This kind of analysis is called unsupervised data analysis. One of the most famous clustering tools is the k-means algorithm, which we can run as follows:\nfrom sklearn.cluster import KMeans \nkmeans = KMeans(k=3, init='random') # initialization\nkmeans.fit(data) # actual execution\n\nThe snippet above runs the algorithm and groups the data in 3 clusters (as specified by the parameter k). Now we can use the model to assign each sample to one of the clusters:\nc = kmeans.predict(data)\n\nAnd we can evaluate the results of clustering, comparing it with the labels that we already have using the completeness and the homogeneity score:\nfrom sklearn.metrics import completeness_score, homogeneity_score\nprint completeness_score(t,c)\n0.7649861514489815\nprint homogeneity_score(t,c)\n0.7514854021988338\n\nThe completeness score approaches 1 when most of the data points that are members of a given class are elements of the same cluster while the homogeneity score approaches 1 when all the clusters contain almost only data points that are member of a single class.\nWe can also visualize the result of the clustering and compare the assignments with the real labels visually:\nfigure()\nsubplot(211) # top figure with the real classes\nplot(data[t==1,0],data[t==1,2],'bo')\nplot(data[t==2,0],data[t==2,2],'ro')\nplot(data[t==3,0],data[t==3,2],'go')\nsubplot(212) # bottom figure with classes assigned automatically\nplot(data[c==1,0],data[tt==1,2],'bo',alpha=.7)\nplot(data[c==2,0],data[tt==2,2],'go',alpha=.7)\nplot(data[c==0,0],data[tt==0,2],'mo',alpha=.7)\nshow()\n\nThe following graph shows the result:\nObserving the graph we see that the cluster in the bottom left corner has been completely indentified by k-means while the two clusters on the top have been identified with some errors.\nRegression is a method for investigating functional relationships among variables that can be used to make predictions. Consider the case where we have two variables, one is considered to be explanatory, and the other is considered to be a dependent. We want to describe the relationship between the variables using a model; when this relationship is expressed with a line we have the linear regression.\nIn order to apply the linear regression we build a synthetic dataset composed as described above:\nfrom numpy.random import rand\nx = rand(40,1) # explanatory variable\ny = x*x*x+rand(40,1)/5 # depentend variable\n\nNow we can use the LinearRegression model that we found in the module sklear.linear_model. This model calculates the best-fitting line for the observed data by minimizing the sum of the squares of the vertical deviations from each data point to the line. The usage is similar to the other models implemented in sklearn that we have seen before:\nfrom sklearn.linear_model import LinearRegression\nlinreg = LinearRegression()\nlinreg.fit(x,y)\n\nAnd we can plot this line over the actual data points to evaluate the result:\nfrom numpy import linspace, matrix\nxx = linspace(0,1,40)\nplot(x,y,'o',xx,linreg.predict(matrix(xx).T),'--r')\nshow()\n\nThe plot should be as follows:\nIn this graph we can observe that the line goes through the center of our data and enables us to identify the increasing trend.\nWe can also quantify how the model fits the original data using the mean squared error:\nfrom sklearn.metrics import mean_squared_error\nprint mean_squared_error(linreg.predict(x),y)\n0.01093512327489268\n\nThis metric measures the expected squared distance between the prediction and the true data. It is 0 when the prediction is perfect.\nWe study the correlation to understand whether and how strongly pairs of variables are related. This kind of analysis helps us in locating the critically important variables on which others depend. The best correlation measure is the Pearson product-moment correlation coefficient. It's obtained by dividing the covariance of the two variables by the product of their standard deviations. We can compute this index between each pair of variables for the iris dataset as follows:\nfrom numpy import corrcoef\ncorr = corrcoef(data.T) # .T gives the transpose\nprint corr\n[[ 1. -0.10936925 0.87175416 0.81795363]\n [-0.10936925 1. -0.4205161 -0.35654409]\n [ 0.87175416 -0.4205161 1. 0.9627571 ]\n [ 0.81795363 -0.35654409 0.9627571 1. ]]\n\nThe function corrcoef returns a symmetric matrix of correlation coefficients calculated from an input matrix in which rows are variables and columns are observations. Each element of the matrix represents the correlation between two variables.\nCorrelation is positive when the values increase together. It is negative when one value decreases as the other increases. In particular we have that 1 is a perfect positive correlation, 0 is no correlation and -1 is a perfect negative correlation.\nWhen the number of variables grows we can conveniently visualize the correlation matrix using a pseudocolor plot:\nfrom pylab import pcolor, colorbar, xticks, yticks\nfrom numpy import arrange\npcolor(corr)\ncolorbar() # add\n# arranging the names of the variables on the axis\nxticks(arange(0.5,4.5),['sepal length', 'sepal width', 'petal length', 'petal width'],rotation=-20)\nyticks(arange(0.5,4.5),['sepal length', 'sepal width', 'petal length', 'petal width'],rotation=-20)\nshow()\n\nThe following image shows the result:\nLooking at the color bar on the right of the figure, we can associate the color on the plot to a numerical value. In this case red is associated with high values of positive correlation and we can see that the strongest correlation in our dataset is between the variables \"petal width\" and \"petal length.\"\nIn the first section we saw how to visualize two dimensions of the iris dataset. With that method alone, we have a view of only a part of the dataset. Since the maximum number of dimensions that we can plot at the same time is 3, to have a global view of the data it's necessary to embed the whole data in a number of dimensions that we can visualize. This embedding process is called dimensionality reduction. One of the most famous techniques for dimensionality reduction is the Principal Component Analysis (PCA). This technique transforms the variables of our data into an equal or smaller number of uncorrelated variables called principal components (PCs).\nThis time, sklearn provides us all we need to perform our analysis:\nfrom sklearn.decomposition import PCA\npca = PCA(n_components=2)\n\nIn the snippet above we instantiated a PCA object which we can use to compute the first two PCs. The transform is computed as follows:\npcad = pca.fit_transform(data)\n\nAnd we can plot the result as usual:\nplot(pcad[target=='setosa',0],pcad[target=='setosa',1],'bo')\nplot(pcad[target=='versicolor',0],pcad[target=='versicolor',1],'ro')\nplot(pcad[target=='virginica',0],pcad[target=='virginica',1],'go')\nshow()\n\nThe result is as follows:\nWe notice that the figure above is similar to the one proposed in the first section, but this time the separation between the versicolor specie (in red) and the virginica specie (in green) is more clear.\nThe PCA projects the data into a space where the variance is maximized and we can determine how much information is stored in the PCs looking at the variance ratio:\nprint pca.explained_variance_ratio_\n[ 0.92461621 0.05301557]\n\nNow we know that the first PC accounts for 92% of the information of the original dataset while the second one accounts for the remaining 5%. We can also print how much information we lost during the transformation process:\nprint 1-sum(pca.explained_variance_ratio_)\n0.0223682249752\n\nIn this case we lost 2% of the information.\nAt this point, we can apply the inverse transformation to get the original data back:\ndata_inv = pca.inverse_transform(pcad)\n\nArguably, the inverse transformation doesn't give us exactly the original data due to the loss of information. We can estimate how much the result of the inverse is likely to the original data as follows:\nprint abs(sum(sum(data - data_inv)))\n2.8421709430404007e-14\n\nWe have that the difference between the original data and the approximation computed with the inverse transform is close to zero. It's interesting to note how much information we can preserve by varying the number of principal components:\nfor i in range(1,5):\n pca = PCA(n_components=i)\n pca.fit(data)\n print sum(pca.explained_variance_ratio_) * 100,'%'\n\nThe output of this snippet is the following:\n92.4616207174 %97.7631775025 %99.481691455 %100.0 %\nThe more PCs we use the more the information is preserved, but this analysis helps us to understand how many components we can use to save a certain amount of information. For example, from the output of the snippet above we can see that on the Iris dataset we can save almost 100% of the information just by using three PCs.\nOften, the data that we have to analyze is structured in the form of networks, for example our data could describe the friendships between a group of facebook users or the coauthorships of papers between scientists. Here, the objects to study are described by nodes and by edges that describe connections between them.\nIn this section we will see the basic steps for the analysis of this kind of data using networkx, which is a library that helps us in the creation, the manipulation and the study of the networks. In particular, we will see how to use a centrality measure in order to build a meaningful visualization of the data and how to find a group of nodes where the connections are dense.\nUsing networkx, we can easily import the most common formats used for the description of structured data:\nG = nx.read_gml('lesmiserables.gml',relabel=True)\n\nIn the code above we imported the coappearance network of characters in the novel Les Miserables, freely available at https://gephi.org/datasets/lesmiserables.gml.zip, in the GML format. We can also visualize the loaded network with the following command:\nnx.draw(G,node_size=0,edge_color='b',alpha=.2,font_size=7)\n\nThe result should be as follows:\nIn this network each node represents a character of the novel and the connection between two characters represents the coappearance in the same chapter. It's easy to see that the graph is not really helpful. Most of the details of the network are still hidden and it's impossible to understand which are the most important nodes. In order to gain some insights about our data we can study the degree of the nodes. The degree of a node is considered one of the simplest centrality measures and it consists of the number of connections a node has. We can summarize the degrees distribution of a network looking at its maximum, minimum, median, first quartile and third quartile:\ndeg = nx.degree(G)\nfrom numpy import percentile, mean, median\nprint min(deg.values())\nprint percentile(deg.values(),25) # computes the 1st quartile\nprint median(deg.values())\nprint percentile(deg.values(),75) # computes the 3rd quartile\nprint max(deg.values())10 \n1\n2.0\n6.0\n10.0\n36\n\nFrom this analysis we can decide to observe only the nodes with a degree higher than 10. In order to display only those nodes we can create a new graph with only the nodes that we want to visualize:\nGt = G.copy()\ndn = nx.degree(Gt)\nfor n in Gt.nodes():\n if dn[n] <= 10:\n Gt.remove_node(n)\nnx.draw(Gt,node_size=0,edge_color='b',alpha=.2,font_size=12)\n\nThe image below shows the result:\nThis time the graph is more readable. It makes us able to observe the most relevant characters and their relationships.\nIt is also interesting to study the network through the identification of its cliques. A clique is a group where a node is connected to all the other ones and a maximal clique is a clique that is not a subset of any other clique in the network. We can find the all maximal cliques of the our network as follows:\nfrom networkx import find_cliques\ncliques = list(find_cliques(G))\n\nAnd we can print the biggest clique with the following command:\nprint max(cliques, key=lambda l: len(l))\n[u'Joly', u'Gavroche', u'Bahorel', u'Enjolras', u'Courfeyrac', u'Bossuet', u'Combeferre', u'Feuilly', u'Prouvaire', u'Grantaire']\n\nWe can see that most of the names in the list are the same of the cluster of nodes on the right of the graph."}}},{"rowIdx":277,"cells":{"text":{"kind":"string","value":"I have a python script that I am using to create a list of all mxd files (with full pathing) in our Projects folder. The script then uses that to iterate through the list and do a findandreplaceworkspacepaths on each mxd per ESRI's how to. I am running into problems when I hit a corrupted mxd file. The have tried try/except and haven't gotten it to work. The ideal situation would be to write the corrupt filename to a file and move on so I can come back to them at the end. I'm very new with python scripting, any help would be greatly appreciated.\nimport arcpy, os, sys, traceback, time\noldpath = 'W:'\nnewpath = 'W:\\\\GIS'\ndef find(path,pattern):\n matches = []\n for r,d,f in os.walk(path):\n for files in f:\n if files.endswith(pattern):\n fpath = os.path.join(r,files)\n matches.append(fpath)\n print (fpath)\n return matches\nprint (\"Go: \")\nmxdlist = (find('C:\\\\gis','.mxd'))\nprint (mxdlist)\nprint (\"Starting Path Conversion\")\ntry:\n for mxdold in mxdlist:\n mxd = arcpy.mapping.MapDocument(mxdold)\n mxd.findAndReplaceWorkspacePaths(oldpath, newpath)\n time.sleep(6)\n mxd.save()\n time.sleep(6)\n print (mxdold)\n del mxd\n except arcpy.ExecuteError: \n arcpy.AddError(arcpy.GetMessages(2)) \n except: \n arcpy.AddError(\"Non-tool error occurred\")\n"}}},{"rowIdx":278,"cells":{"text":{"kind":"string","value":"According to the Python documentation it has to do with the accuracy of the time function in different operating systems:\nThe default timer function is platform\n dependent. On Windows, time.clock()\n has microsecond granularity but\n time.time()‘s granularity is 1/60th of\n a second; on Unix, time.clock() has\n 1/100th of a second granularity and\n time.time() is much more precise. On\n either platform, the default timer\n functions measure wall clock time, not\n the CPU time. This means that other\n processes running on the same computer\n may interfere with the timing ... On Unix, you can\n use time.clock() to measure CPU time.\nTo pull directly from timeit.py's code:\nif sys.platform == \"win32\":\n # On Windows, the best timer is time.clock()\n default_timer = time.clock\nelse:\n # On most other platforms the best timer is time.time()\n default_timer = time.time\n\nIn addition, it deals directly with setting up the runtime code for you. If you use time you have to do it yourself. This, of course saves you time\nTimeit's setup:\ndef inner(_it, _timer):\n #Your setup code\n %(setup)s\n _t0 = _timer()\n for _i in _it:\n #The code you want to time\n %(stmt)s\n _t1 = _timer()\n return _t1 - _t0\n"}}},{"rowIdx":279,"cells":{"text":{"kind":"string","value":"Save yourself having to go to an image sharing site with your browser. This script runs in a terminal, takes a file path as argument, uploads it to postimage.org and displays the url, BB code for forums and html for web pages, ready to copy/paste. It needs curl to be installed (from the repos).\n#!/bin/bash\n# imgupload.sh\n# upload image to postimage.org and print out url etc\n# If you plan to upload adult content change \"adult=no\" to \"adult=yes\"\ncurl -Ls -F \"upload[]=@$1\" -F \"adult=no\" http://postimage.org/ | awk '\nBEGIN {\n RS=\"\"\n}\nNR==1{next}\nNR>7{exit}\n{\n gsub(/<[^>]*>/,\"\",$1)\n sub(/^[^>]*>/,\"\",$1)\n gsub(\"\\\\&lt;\",\"<\",$1)\n gsub(\"\\\\&gt;\",\">\",$1)\n gsub(\"\\\\&quot;\",\"\\\"\",$1)\n gsub(/<[^>]*>/,\"\",$2)\n sub(/^[ \\t\\n]*/,\"\",$2)\n print(\"\\n\" $2 \": \" $1 \"\\n\")\n}'\nexit\n\nIt's handy to add a custom right-click action to Thunar with this. I use this command:\nurxvt -hold -e /home/john/scripts/imgupload.sh %f\n\nOf course change urxvt to your terminal. The -hold option is necessary so you have time to copy the url. Tick \"image files\" in the Appearance Conditions. If your image viewer has a \"send to external app\" type option you could put it there too.\nNote: this is a hack and will probably break next time postimage change their front page. (Please post if you find a problem.) At that time it will have to be rehacked, or maybe changed to imgur which has a proper api, but needs registration.\nLast edited by johnraff (2013-09-07 16:54:04)\nOffline\nThis is awesome, johnraff, I didn't know that curl has such useful capabilities.\nOffline\nOffline\n^ That should be fine; in this case, we want the script to match for \"&lt\" etc. and replace them with the appropriate bbs code. Awk just realizes that both \\ and & are used as escape characters in different cases, and wants to be sure we know what's going on.\nI'm a moderator here. How are we doing? Feedback is encouraged.\nOffline\nActually that ampersand-escaping thing is a known issue I should have remembered.\nIt came up 2 years ago with the \"recent files\" pipemenu:\nhttp://crunchbang.org/forums/viewtopic. … 28#p125728\nIt's a mawk vs gawk thing and adding a second backslash fixes it for both of them.\nGory details here:\nhttp://www.gnu.org/software/gawk/manual … ry-Details\nAnyway, I've edited the first post.\n@GekkoP I'm guessing you have gawk set as your default awk, right? Anyway thanks for catching that warning!\nOffline\nAnyway, I've edited the first post.\n@GekkoP I'm guessing you have gawk set as your default awk, right? Anyway thanks for catching that warning!\nHow do I check that? I'm curious now\nOffline\nmawk is smaller and faster but gawk has more features. (eg mawk doesn't understand POSIX character classes like [:alnum:].) mawk is the default on standard Debian I think.\nLast edited by johnraff (2013-09-07 16:50:49)\nOffline\nHere's a bigger and more featured script that works with imgur! It even allows you to have a DIRECT LINK to your image!\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport urllib2\nimport json\nfrom base64 import b64encode\nfrom getpass import getpass\nfrom urllib import urlencode\nfrom cookielib import CookieJar\nfrom os.path import expanduser, exists\nfrom pprint import pprint\nfrom collections import OrderedDict\nfrom argparse import ArgumentParser\nUSERNAME = \"\"\nPASSWORD = \"\"\nAPIKEY_AUTH = \"acfe292a432ded08e576f019fb4e34d104df16436\"\nAPIKEY_ANON = \"641ff5860e0a7e26e97e48d8ee80d162\"\nDEBUG = False\nclass ImgurError(Exception):\n pass\nclass Imgur(object):\n \"\"\"\n This class can be used to upload images and manage an account on imgur.com\n \"\"\"\n base = \"api.imgur.com\"\n connected = False\n urls = {\n # Anon\n \"upload\": \"/2/upload\",\n \"image\": \"/2/image/%s\",\n \"delete\": \"/2/delete/%s\",\n # Auth\n \"signin\": \"/2/signin\",\n \"account\": \"/2/account\",\n \"account_images\": \"/2/account/images\",\n \"account_image\": \"/2/account/images/%s\",\n \"account_images_count\": \"/2/account/images_count\",\n \"albums\": \"/2/account/albums\",\n \"album\": \"/2/account/albums/%s\",\n \"albums_count\": \"/2/account/albums_count\",\n \"albums_order\": \"/2/account/albums_order\",\n \"album_order\": \"/2/account/albums_order/%s\",\n # Other\n \"stats\": \"/2/stats\",\n \"credits\": \"/2/credits\",\n }\n def __init__(self, apikey_auth=None, apikey_anon=None, print_results=True):\n self.apikey_auth = apikey_auth\n self.apikey_anon = apikey_anon\n self.print_results = print_results\n self.cj = CookieJar()\n def _handle_response(fun):\n def new_f(self, *args, **kwargs):\n try:\n resp = fun(self, *args, **kwargs)\n except urllib2.HTTPError, err:\n raise ImgurError(err)\n else:\n if self.print_results:\n content = resp.read()\n try:\n #pprint(json.loads(content))\n json_print(json.loads(content))\n except:\n pprint(content)\n return resp\n return new_f\n def connection_required(fun):\n \"\"\" A decorator that checks if the user is authenticated \"\"\"\n def new_f(self, *args, **kwargs):\n if not self.connected:\n raise ImgurError(\"You must be connected to perform this\"\n \"operation\")\n return fun(self, *args, **kwargs)\n return new_f\n def connect(self, username=None, password=None):\n \"\"\"\n A cookie is created for the authentication\n \"\"\"\n response = self.request(\"POST\", \"signin\",\n username=username, password=password)\n debug(\"Connected.\")\n self.connected = True\n def _json(self, data):\n try:\n return json.loads(data)\n except ValueError:\n raise ImgurError(\"Invalid data\")\n @_handle_response\n @connection_required\n def _account(self):\n return self.request(\"GET\", \"account\")\n @_handle_response\n def _upload(self, filename, url, name, title, caption):\n if filename:\n with open(expanduser(filename), \"rb\") as f:\n img = b64encode(f.read())\n t = \"base64\"\n else:\n img = url\n t = \"url\"\n url = \"account_images\" if self.connected else \"upload\"\n return self.request(\"POST\", url, image=img,\n type=t, name=name, title=title, caption=caption)\n @_handle_response\n @connection_required\n def _imgedit(self, hash, title=\"\", caption=\"\"):\n url = self.urls[\"account_image\"] % hash\n return self.request(\"POST\", url=url, title=title, caption=caption)\n @_handle_response\n def _imginfos(self, hash):\n c = self.connected\n url = self.urls[\"account_image\" if c else \"image\"] % hash\n return self.request(\"GET\", url=url)\n @_handle_response\n def _imgdelete(self, hash):\n c = self.connected\n url = self.urls[\"account_image\" if c else \"delete\"] % hash\n return self.request(\"DELETE\", url=url)\n @_handle_response\n @connection_required\n def _imgcount(self):\n return self.request(\"GET\", \"account_images_count\")\n @_handle_response\n @connection_required\n def _list(self):\n return self.request(\"GET\", \"account_images\")\n @_handle_response\n @connection_required\n def _albums(self, title=\"\", description=\"\", privacy=\"\", layout=\"\",\n count=\"\", page=\"\", create=True):\n if create:\n return self.request(\"POST\", \"albums\", title=title,\n description=description, privacy=privacy, layout=layout)\n else:\n return self.request(\"GET\", \"albums\", count=count, page=page)\n @_handle_response\n @connection_required\n def _albmlist(self, album_id):\n url = self.urls[\"album\"] % album_id\n return self.request(\"GET\", url=url)\n @_handle_response\n @connection_required\n def _albmdelete(self, album_id):\n url = self.urls[\"album\"] % album_id\n return self.request(\"DELETE\", url=url)\n @_handle_response\n @connection_required\n def _albmedit(self, album_id, title=\"\", description=\"\", cover=\"\",\n privacy=\"\", layout=\"\", images=\"\", add_images=\"\", del_images=\"\"):\n url = self.urls[\"album\"] % album_id\n datas = {}\n for k in (\"url\", \"title\", \"description\", \"cover\", \"privacy\", \"layout\",\n \"images\", \"add_images\", \"del_images\"):\n datas[k] = locals()[k]\n return self.request(\"POST\", **datas)\n @_handle_response\n @connection_required\n def _albmcount(self):\n return self.request(\"GET\", \"albums_count\")\n @_handle_response\n @connection_required\n def _albmord(self, album_id, hashes):\n url = self.urls[\"album_order\"] % album_id\n return self.request(\"POST\", url=url, hashes=hashes)\n @_handle_response\n @connection_required\n def _albmords(self, album_ids):\n return self.request(\"POST\", \"albums_order\", album_ids=album_ids)\n @_handle_response\n def _limits(self):\n return self.request(\"GET\", \"credits\")\n def _stats(self, view):\n return self.request(\"GET\", \"stats\", view=view)\n def request(self, method, key=\"\", url=\"\", headers=None, **params):\n # Send an http request.\n # if key is set, use the url from self.urls[key]\n # else use 'url'\n if not headers:\n headers = {}\n url = \"http://\" + self.base + (self.urls[key] if key else url) + \".json\"\n params[\"key\"] = self.apikey_auth if self.connected else self.apikey_anon\n data = None\n if method in (\"POST\", \"DELETE\"):\n for k in params.keys():\n if not params[k]:\n del params[k]\n data = urlencode(params)\n elif method in (\"GET\", \"DELETE\"):\n url = \"%s?%s\" % (url, urlencode(params))\n opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))\n urllib2.install_opener(opener)\n debug(url, params)\n req = urllib2.Request(url, data, headers)\n if not method in (\"POST\", \"GET\"):\n req.get_method = lambda: method\n return urllib2.urlopen(req)\n def _get_json(self, fun_name, *args, **kwargs):\n return self._json(getattr(self, fun_name)(*args, **kwargs).read())\n def _infos(self, img):\n \"\"\" Print the infos of an image \"\"\"\n return dict_print(OrderedDict(img[\"image\"].items() +\n img[\"links\"].items()))\n def _liststr(self, datas):\n \"\"\" Converts a list into \"(foo,bar,baz)\" \"\"\"\n if isinstance(datas, (list, tuple)):\n datas = \"(%s)\" % (\",\".join(str(e) for e in datas))\n elif not datas.startswith(\"(\"):\n datas = \"(%s)\" % datas\n return datas\n def upload_image(self, image=\"\", name=\"\", title=\"\", caption=\"\", hashes=False):\n \"\"\"\n Upload an image\n 'image' can be a path or an url\n if hashes is True, return only the hashes\n \"\"\"\n url, file = \"\", \"\"\n if not exists(image):\n url = image\n else:\n file = image\n datas = self._get_json(\"_upload\", file, url, name, title, caption)\n infos = datas[\"images\" if self.connected else \"upload\"]\n if hashes:\n return \"Hash: %s\\nDelete: %s\" % (infos[\"image\"][\"hash\"],\n infos[\"image\"][\"deletehash\"])\n else:\n return self._infos(infos)\n def account(self):\n \"\"\" Get account infos \"\"\"\n datas = self._get_json(\"_account\")\n return dict_print(datas[\"account\"])\n def list_images(self):\n \"\"\" List all images in account \"\"\"\n datas = self._get_json(\"_list\")\n imgs = (self._infos(img) for img in datas[\"images\"])\n return \"\\n *** \\n\".join(imgs)\n def infos_image(self, hash):\n \"\"\" Retrieve informations from an image \"\"\"\n datas = self._get_json(\"_imginfos\", hash)\n return self._infos(datas[\"images\" if self.connected else \"image\"])\n def delete_image(self, hash):\n \"\"\" Delete an image \"\"\"\n datas = self._get_json(\"_imgdelete\", hash)\n return datas[\"images\"][\"message\"] if self.connected else \"\"\n def edit_image(self, hash, new_title=\"\", new_caption=\"\"):\n \"\"\" Edit an image \"\"\"\n datas = self._get_json(\"_imgedit\", hash, new_title, new_caption)\n return self._infos(datas[\"images\"])\n def count_images(self):\n \"\"\" Count all images in the account \"\"\"\n return self._get_json(\"_imgcount\")[\"images_count\"][\"count\"]\n def list_albums(self, count=30, page=1):\n \"\"\"\n List all albums in the account\n \"\"\"\n datas = self._get_json(\"_albums\", count=count, page=page,\n create=False)\n return \"\\n *** \\n\".join(dict_print(alb) for alb in datas[\"albums\"])\n def create_album(self, title=\"\", description=\"\", privacy=\"\", layout=\"\"):\n \"\"\"\n All values are optional.\n privacy: public/hidden/secret\n layout: blog/horizontal/vertical/grid\n \"\"\"\n datas = self._get_json(\"_albums\", title, description, privacy, layout)\n return dict_print(datas[\"albums\"])\n def list_album(self, album_id):\n \"\"\" List all images in an album \"\"\"\n datas = self._get_json(\"_albmlist\", album_id)\n imgs = (self._infos(img) for img in datas[\"albums\"])\n return \"\\n *** \\n\".join(imgs)\n def delete_album(self, album_id):\n \"\"\" Delete an album \"\"\"\n datas = self._get_json(\"_albmdelete\", album_id)\n return datas[\"albums\"][\"message\"]\n def edit_album(self, album_id, title=\"\", description=\"\", cover=\"\",\n privacy=\"\", layout=\"\", images=\"\", add_images=\"\", del_images=\"\"):\n \"\"\"\n Edit an album\n privacy: public/hidden/secret\n layout: blog/horizontal/vertical/grid\n cover: a hash of an image in the account\n 'images' replaces all images in the album\n images, add_images and del_images must be a list of hashes,\n or a string formatted like (hash1,hash2,...)\n \"\"\"\n for k in (\"images\", \"add_images\", \"del_images\"):\n locals()[k] = self._liststr(locals()[k])\n datas = self._get_json(\"_albmedit\", album_id, title, description,\n cover, privacy, layout, images, add_images, del_images)\n imgs = (self._infos(img) for img in datas[\"albums\"])\n return \"\\n *** \\n\".join(imgs)\n def count_albums(self):\n \"\"\" Return the number of albums. \"\"\"\n datas = self._get_json(\"_albmcount\")\n return datas[\"albums_count\"][\"count\"]\n def order_album(self, album_id, hashes):\n hashes = self._liststr(hashes)\n datas = self._get_json(\"_albmord\", album_id, hashes)\n return \"\\n *** \\n\".join(dict_print(alb) for alb in datas[\"albums_order\"])\n def order_albums(self, album_ids):\n album_ids = self._liststr(album_ids)\n datas = self._get_json(\"_albmords\", album_ids)\n imgs = (self._infos(img) for img in datas[\"albums_order\"])\n return \"\\n *** \\n\".join(imgs)\n def stats(self, view=\"month\"):\n \"\"\"\n View imgur's stats\n view: today|week|month\n \"\"\"\n return dict_print(self._get_json(\"_stats\", view)[\"stats\"])\ndef debug(*datas):\n if DEBUG:\n print \"DEBUG:\", \", \".join(str(d) for d in datas)\ndef json_print(data, tab=0):\n if isinstance(data, (list, tuple)):\n print\n for elem in data:\n json_print(elem, tab)\n print\n elif isinstance(data, dict):\n print\n for e, d in data.items():\n print \"\\t\"*tab, e,\n json_print(d, tab+1)\n else:\n print \"\\t\"*tab, data\ndef dict_print(data):\n def align(l, r, w=80):\n return \"%s: %s%s\" % (l, (w-len(l))* \" \", r)\n w = max(len(e) for e in data.keys())\n return \"\\n\".join(align(k, v, w) for k, v in data.items())\ndef main():\n i = Imgur(APIKEY_AUTH, APIKEY_ANON, False)\n # Parser definition\n parser = ArgumentParser(description=\"A command-line utility for imgur.com\")\n parser.add_argument(\"--user\")\n parser.add_argument(\"--password\")\n parser.add_argument(\"--ask-pass\", action=\"store_true\",\n help=\"Prompt for a password, so that it will never be displayed.\")\n parser.add_argument(\"--anon\", action=\"store_true\", default=False,\n help=\"Do not authenticate.\")\n sparsers = parser.add_subparsers(metavar=\"ACTION\", dest='sp_name', \n help=\"Use '%(prog)s action -h' for more help\")\n up_parser = sparsers.add_parser(\"upload\", help=\"Upload a file or an url\")\n up_parser.add_argument(\"image\", help=\"A path or an url\")\n up_parser.add_argument(\"-t\", \"--title\")\n up_parser.add_argument(\"-n\", \"--name\")\n up_parser.add_argument(\"-c\", \"--caption\")\n up_parser.add_argument(\"-s\", \"--hashes\", action=\"store_true\",\n help=\"Only print the hashes instead of all the informations\")\n imgd_parser = sparsers.add_parser(\"delete\", help=\"Delete an image\")\n imgd_parser.add_argument(\"hash\")\n imgi_parser = sparsers.add_parser(\"infos\", help=\"Get infos on the image\")\n imgi_parser.add_argument(\"hash\")\n imge_parser = sparsers.add_parser(\"edit\", help=\"Edit an image\")\n imge_parser.add_argument(\"hash\")\n imge_parser.add_argument(\"-t\", \"--title\")\n imge_parser.add_argument(\"-c\", \"--caption\")\n list_parser = sparsers.add_parser(\"list\", help=\"List all your images\")\n acc_parser = sparsers.add_parser(\"account\", help=\"Account infos\")\n albc_parser = sparsers.add_parser(\"create-album\", help=\"Create a new album\")\n albc_parser.add_argument(\"-t\", \"--title\")\n albc_parser.add_argument(\"-d\", \"--description\")\n albc_parser.add_argument(\"-p\", \"--privacy\", choices=[\"public\", \"hidden\",\n \"secret\"])\n albc_parser.add_argument(\"-l\", \"--layout\", choices=[\"blog\", \"horizontal\",\n \"vertical\", \"grid\"])\n albe_parser = sparsers.add_parser(\"edit-album\", help=\"Edit an album\")\n albe_parser.add_argument(\"album_id\")\n albe_parser.add_argument(\"-t\", \"--title\")\n albe_parser.add_argument(\"-d\", \"--description\")\n albe_parser.add_argument(\"-p\", \"--privacy\", choices=[\"public\", \"hidden\",\n \"secret\"])\n albe_parser.add_argument(\"-l\", \"--layout\", choices=[\"blog\", \"horizontal\",\n \"vertical\", \"grid\"])\n albe_parser.add_argument(\"-c\", \"--cover\", help=\"The hash of an image to use \"\n \"as cover for the album\", metavar=\"hash\")\n albe_parser.add_argument(\"-i\", \"--images\", metavar=\"hash1,hash2,..,hashN\",\n help=\"Replace all images in an album.\")\n albe_parser.add_argument(\"-a\", \"--add\", metavar=\"hash1,hash2,..,hashN\",\n help=\"Add images to the album.\")\n albe_parser.add_argument(\"-r\", \"--delete\", metavar=\"hash1,hash2,..,hashN\",\n help=\"Delete images from the album.\")\n albl_parser = sparsers.add_parser(\"list-albums\",\n help=\"List all albums.\")\n albl_parser.add_argument(\"-c\", \"--count\", help=\"The number of albums to return\")\n albl_parser.add_argument(\"-p\", \"--page\", help=\"The pages of albums to return\")\n albs_parser = sparsers.add_parser(\"list-album\",\n help=\"List all images in an album\")\n albs_parser.add_argument(\"album_id\")\n albco_parser = sparsers.add_parser(\"count-albums\",\n help=\"Get the number of albums\")\n albd_parser = sparsers.add_parser(\"delete-album\", help=\"Delete an album\")\n albd_parser.add_argument(\"album_id\")\n albos_parser = sparsers.add_parser(\"order-albums\", help=\"Order all albums in the account\")\n albos_parser.add_argument(\"album_ids\", metavar=\"id1,id2,...,idn\", help=\"The new list of album IDs\")\n albo_parser = sparsers.add_parser(\"order-album\", help=\"Order all images in an album\")\n albo_parser.add_argument(\"album_id\")\n albo_parser.add_argument(\"hashes\", metavar=\"hash1,hash2,...,hashn\", help=\"The new list of hashes\")\n stats_parser = sparsers.add_parser(\"stats\", help=\"Imgur statistics\")\n stats_parser.add_argument(\"-v\", \"--view\",\n choices=[\"today\", \"month\", \"week\"])\n # Authentification\n args = parser.parse_args()\n u, p, ap = args.user, args.password, args.ask_pass\n if u and not p:\n if ap:\n i.connect(u, getpass())\n else:\n i.connect(u, PASSWORD)\n elif p and not u:\n i.connect(USERNAME, p)\n elif u and p:\n i.connect(u, p)\n elif USERNAME and (not PASSWORD or ap) and not args.anon:\n i.connect(USERNAME, getpass())\n elif USERNAME and PASSWORD and not args.anon:\n i.connect(USERNAME, PASSWORD)\n # Preparation\n opts = vars(args)\n spname = args.sp_name\n del opts[\"user\"], opts[\"password\"], opts[\"anon\"], opts[\"ask_pass\"]\n if spname in (\"upload\", \"infos\", \"delete\", \"edit\", \"list\", \"count\"):\n fun_name = spname + \"_image\" if hasattr(Imgur,\n spname + \"_image\") else spname + \"_images\"\n elif spname.rstrip(\"s\").endswith(\"album\"):\n fun_name = spname.replace(\"-\", \"_\")\n else:\n fun_name = spname\n del opts[\"sp_name\"]\n fun = getattr(Imgur, fun_name)\n # And action.\n print fun(i, **opts)\nif __name__ == \"__main__\":\n main()\n\nand here is a mirror for the same script, just in case.\nI don't know where I took that script from.. hehe\nHow to use it?\n./thatscript.py upload 'pathtoimage'\nor\n./thatscript --help\nfor some help\nLast edited by sysaxed (2013-10-30 17:09:33)\nOffline\nAlso, here is you simplified script that gives just one link:\n#!/bin/bash\n# imgupload.sh\n# upload image to postimage.org and print out url etc\n# If you plan to upload adult content change \"adult=no\" to \"adult=yes\"\ncurl -Ls -F \"upload[]=@$1\" -F \"adult=no\" http://postimage.org/ | grep -Po 'id=\"code_1\".+\\Khttp[^<]+'\nexit\n\nNow, the trick is, you can pipe this link directly to your clipboard! (requires xclip)\n#!/bin/bash\n# imgupload.sh\n# upload image to postimage.org and print out url etc\n# requires xclip to be installed (apt-get install xclip)\n# If you plan to upload adult content change \"adult=no\" to \"adult=yes\"\ncurl -Ls -F \"upload[]=@$1\" -F \"adult=no\" http://postimage.org/ | grep -Po 'id=\"code_1\".+\\Khttp[^<]+' | xclip -selection clipboard\nexit\n\nIsn't that cool, huh?? Now you don't even need to run the terminal if you're executing it from thunar!\nThe same thing can be applied to the script I posted above:\n./imgur.py upload YOURIMAGE | grep -Po 'original:\\s*\\K.+' | xclip -selection clipboard\nLast edited by sysaxed (2013-10-30 17:52:49)\nOffline\nNOW HERE IS THE THING!\nShare a screenshot with your friends or coworkers!\n#!/bin/bash\n# Share a screenshot by selecting a part of the screen with your mouse\n# By Johnraff and Sysaxed\nfile=\"$(mktemp).png\"\nscrot -s \"$file\"\ncurl -Ls -F \"upload[]=@$file\" -F \"adult=no\" http://postimage.org/ | grep -Po 'id=\"code_1\".+\\Khttp[^<]+' | xclip -selection clipboard\n# or\n# imgur.py upload \"$file\" | grep -Po 'original:\\s*\\K.+' | xclip -selection clipboard\nrm \"$file\"\n\nRun this script, select an area of your desktop, paste the link to the chat or forum!\nYou can uncomment the imgur line and comment postimage.org line to use imgur instead. In that case you would have to place a script posted above to your PATH\nLast edited by sysaxed (2013-10-30 17:51:37)\nOffline"}}},{"rowIdx":280,"cells":{"text":{"kind":"string","value":"I'm assuming there isn't a word that contains every letter in the alphabet, so which word contains the most?\nExamples:\nantidisestablishmentarianism - 12 [antidseblhmr]\npsychotherapy - 12 [psychotherap]\nhandcraftsmanship - 13 [handcrftsmhip]\nAmong words in a certain word list I found:\nIt has ten words with 16, including:\nThere are several dozen with 15, including:\nand several hundred with 14 (including a few 14-letter words like 'pseudomythical', 'hydropneumatic' and 'ambidextrously').\nIn case anyone cares, this was done with Python, something like:\nF = open('words.list').readlines()\nfor i in range(len(F)):\n w = F[i].strip().lower()\n F[i] = (len(set(w)), w)\nF = sorted(F, reverse=True)\nfor i in range(len(F)): print F[i]\n\nA better word list (one that includes\nLlanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch clocks in at 18 distinct characters, but arguably a near-infinite number of 25-character answers exist, since organic chemistry nomenclature allows one to build valid hypothetical compound names of essentially arbitrary length, and the full alphabet less only J appears on the periodic table (though this does require one to refer to rutherfordium by its old placeholder name unnilquadium or arrogate a placeholder name for a transuranic element with an atomic number ending in 4 that hasn't been named yet, so it may only get us to 24 characters).\nThank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.\nWould you like to answer one of these unanswered questions instead?"}}},{"rowIdx":281,"cells":{"text":{"kind":"string","value":"Pylades\n/* Topic des codeurs couche-tard [1] */\nBienvenue dans le TdCCT 0x1.\nCeci est la suite de ce fil.\nVoici le rappel des règles du jeu, formulées par le message initial de samuncle :\nBienvenue dans ce nouveau topic psychédélique, ou le but est de coder le plus tard possible (oui, c’est bien connu, il est plus facile de coder la nuit).\nUn compteur viendra, chaque matin, poster le nouveau score, normalement à neuf heures et\nquarante-deuxminutes.\nVoici le barème en fonction de l’heure du dernier message posté :\n[21 h, 22 h[ → 1 point ;\n[22 h, 23 h[ → 2 points ;\n[23 h, 0 h[ → 3 points ;\n[0 h, 1 h[ → 4 points ;\n[1 h, 2 h[ → 5 points ;\n[2 h, 3 h[ → 6 points ;\n[3 h, 5 h[ → 10 points ;\nOn ne marque plus de points après cinq heures. Les points ne se cumulent pas si l’on poste toutes les heures.\nHistorique des précédents fils :\n• Topic des codeurs couche-tard [0] : du 14 avril 2010 au 12 juin 2010 (100 pages).\nAmusez-vous bien, et produisez-nous du beau code.\nDernière modification par Pylade (Le 15/07/2010, à 21:07)\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\nna kraïou\nRe : /* Topic des codeurs couche-tard [1] */\nР'tite G☢gole a écrit :\nTu payes combien ?\nMon éternelle admiration.\n(Et éventuellement un poème contant tes louanges.)\nTriste !\nIntégriste ! Comploteur ! Connard ! Fourbe ! Linuxeux ! Machiavélique ! Moche ! Branleur ! Grognon ! Prétentieux ! Frimeur ! /b/tard ! Futile ! Étudiant ! Médiéviste ! Perfide ! Debianeux ! Futur maître du monde ! Petit (quasi nanos gigantium humeris insidentes) ! Égoïste ! Nawakiste ! Mauvaise langue ! 34709 ! На краю ! Arrogant ! Suffisant ! Ingrat !\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs couche-tard [1] */\nOn a pas fait 100, la loose.\nSinon on pourrai ajouter un historique comme le TDCT, enfin jdçjdr.\nDernière modification par grim7reaper (Le 12/06/2010, à 22:42)\nHors ligne\nxapantu\nRe : /* Topic des codeurs couche-tard [1] */\nbah oui, c'est dommage, à 2-3 près....\nHors ligne\ngnuuat\nRe : /* Topic des codeurs couche-tard [1] */\nNouveau topic, nouveaux scores !\nBisouland : embrassez les tous !\nVolez les points d'amour de vos adversaires en les embrassant, dans ce jeu gratuit par navigateur !\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs couche-tard [1] */\n@xapantu : à un message près.\nElle l'a fait exprès, j'en suis sûr .\nDernière modification par grim7reaper (Le 12/06/2010, à 22:44)\nHors ligne\nPylades\nRe : /* Topic des codeurs couche-tard [1] */\nMais oui, je n’ai pas compris pourquoi la ’tite a fermé si tôt…\nFaudrait peut-être rouvrir temporairement histoire d’atteindre ces cent pages. Ou alors mettre ça sur le compte de la suppression des messages d’ilagas.\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\nPylades\nRe : /* Topic des codeurs couche-tard [1] */\nNouveau topic, nouveaux scores !\nTu rêves, j’espère !\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\nКຼزດ\nRe : /* Topic des codeurs couche-tard [1] */\nFaibles modos ne sachant pas utiliser les liens relatifs.\ndou\nHors ligne\nnesthib\nRe : /* Topic des codeurs couche-tard [1] */\nhey pourquoi c'est fermé l'ancien ?\n(m'en fous j'avais pas vu et l'ai posté sur la page 100 !)\nHors ligne\nPylades\nRe : /* Topic des codeurs couche-tard [1] */\nPylade a écrit :Р'tite G☢gole &#58;mad&#58; a écrit :\nTu payes combien ?\nMon éternelle admiration.\n(Et éventuellement un poème contant tes louanges.)\nBon, allons-y.\nDans entrailles du forumVivait une Р'tite G☢gole ,Nourrie à l’vokda et au rhum,Elle battait des chats au vol.\nPour fermer ou modérer,\nElle avait le clavier facile.\nMalheureusement (fait chier !)\nUne clôture ne fut difficile.\nAinsi, mourut l’TdCCT,\nLe premier, bien trop tôt,\nFut définitivement pété\nAvant les cent beaux écriteaux.\nDans entrailles du forum\nVivait une Р'tite G☢gole ,\nNourrie à l’vokda et au rhum,\nElle battait des chats au vol.\nDès lors, tombe l’TdCCT,\nGloire de Р'tite G☢gole .\nEt mon admiration éternelle, tu l’as maintenant.\n(Enfin, j’aurais encore plus apprécié si la page cent avait été atteinte.)\nIl va pas être long, le poème... genre tanka ?\nPerdu !\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\nnesthib\nRe : /* Topic des codeurs couche-tard [1] */\nbon sinon je vais inaugurer le nouveau fil par un petit morceau de code qui vous ravira tous. Il permet de déterminer qui sont les affreux doubles connectés sur le forum\n(dépendance : python-beautifulsoup)\n#!/usr/bin/env python\n# encoding : utf-8\nfrom urllib2 import urlopen\nfrom BeautifulSoup import BeautifulSoup\nurl = 'http://forum.ubuntu-fr.org'\npage = urlopen(url)\nsoup = BeautifulSoup(page)\nusers_raw = soup.findAll('dl','clearb')[0].findAll(\"a\")\nusers = [user.contents[0] for user in users_raw]\nunique = list(set(users))\nif len(users) > len(unique):\n for user in unique:\n users.remove(user)\n users = list(set(users))\n print(u'liste des affreux planteurs du forum :')\n for user in users:\n print(str(user))\nelse:\n print(u'Ca va, personne ne fait bugguer le forum !')\n\nHors ligne\nPylades\nRe : /* Topic des codeurs couche-tard [1] */\nhey pourquoi c'est fermé l'ancien ?\n(m'en fous j'avais pas vu et l'ai posté sur la page 100 !)\nTu aurais pu en profiter pour mettre un lien relatif…\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\nsamυncle\nRe : /* Topic des codeurs couche-tard [1] */\n\\o/ un nouveau topic\nHello world\nHors ligne\nhelly\nRe : /* Topic des codeurs couche-tard [1] */\nPage 1\nCe qui serait vraiment classe ça serait que ce soit la page 0\nDernière modification par helly (Le 12/06/2010, à 23:10)\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs couche-tard [1] */\nhey pourquoi c'est fermé l'ancien ?\n(m'en fous j'avais pas vu et l'ai posté sur la page 100 !)\nPrivilégié !\nBrûlons-le !\nRetirons lui des points !\nPffff, ça ne vaut pas PhœnixOS .\nRégalez-vous (si vous ne connaissez pas déjà).\nHors ligne\nhelly\nRe : /* Topic des codeurs couche-tard [1] */\nEn rapport avec ce que j'ai dit à propos du quotient (Qualité de codage)/(Qualité de web design)\nÇa doit être un super OS\nThis site Copyright © 2009-2010 PmBSD.\nEt ça se dit libre\nDernière modification par helly (Le 12/06/2010, à 23:26)\nHors ligne\nsamυncle\nRe : /* Topic des codeurs couche-tard [1] */\nHé il faut rajouter .:: dans le titre ::. comme dans l'ancien\nHello world\nHors ligne\nPylades\nRe : /* Topic des codeurs couche-tard [1] */\nEn tous cas, ce changement de fil fait le buzz.\n“Any if-statement is a goto. As are all structured loops.\n“And sometimes structure is good. When it’s good, you should use it.\n“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”\nLinus Torvalds – 12 janvier 2003\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs couche-tard [1] */\nSinon on pourrai ajouter un historique comme le TDCT, enfin jdçjdr.\nHors ligne\nnesthib\nRe : /* Topic des codeurs couche-tard [1] */\nHé il faut rajouter .:: dans le titre ::. comme dans l'ancien\nc'est fait\ngrim7reaper a écrit :\nSinon on pourrai ajouter un historique comme le TDCT, enfin jdçjdr.\nc'est fait\nHors ligne\nPPdM\nHors ligne"}}},{"rowIdx":282,"cells":{"text":{"kind":"string","value":"I'm trying to use FileChooserDialog to get a native gnome dialog box in a python script. After the script executes, my ipython -pylab prompt experiences a significant slow down. This problem also exists from a plain python prompt. I've isolated the problem to the dialog box. The following example (which has been posted elsewhere as a pygtk example) illustrates the issue:\nimport pygtk\npygtk.require('2.0')\nimport gtk\nclass FileChooserDialog:\n def __init__(self):\n filechooserdialog = gtk.FileChooserDialog(\"FileChooserDialog Example\", None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) \n response = filechooserdialog.run()\n if response == gtk.RESPONSE_OK:\n print \"Selected filepath: %s\" % filechooserdialog.get_filename()\n filechooserdialog.destroy()\nif __name__ == \"__main__\":\n FileChooserDialog()\n\nAfter running the script, my hard drive light seems to flash after any key is typed in from the keyboard - very strange behavior! I do not have the problem with deprecated gtk.FileSelection or any other gtk window objects.\nI'm currently running, python 2.6.5, gtk 2.21.1, pygtk 2.17.0 in ubuntu 10.04. In general this dialog seems to be flaky; I've also had some issues with the window not destroying itself when executed certain ways within scripts. Any help would be greatly appreciated!"}}},{"rowIdx":283,"cells":{"text":{"kind":"string","value":"Last night, I decided to take the plunge, and install Ubuntu as complimentary part to my dual boot system (with Windows 7). Unfortunately, the entire process has been a struggle uphill, namely with getting the bootloader configured properly.\nA short historical synopsis, for the full context of the situation:\nGenerated and installed Ubuntu 11.04 x64 off of a USB drive setup on a Windows 7 machine. I had trouble getting the installer to even boot, until I learned I couldn't use my USB3.0 port. Switched to the USB2.0 port, continued with the install.\nI have a 1TB HDD that I split in half for the purpose of dual booting: 500GB partition for Windows 7, and a 500GB for Ubuntu (excluding the boot/swap file partitions). The Ubuntu partition was installed with the ext4 filesystem, and installation completed without any apparent problems, and was prompted to reboot.\nUpon rebooting, I got dumped into the old Windows boot loader, which immediately fired up Windows. I played around with a utility called EasyBCD to attempt to add a Linux entry to my newly installed partition, to no avail.\nThen, I booted Ubuntu straight off the USB drive, and installed GRUB2 onto the boot partition following the steps outlined here. I also ran the step (\"update-grub\") to generate a new 'grub.cfg' file, which added an entry to my old 'Windows 7' bootloader, but not one for my new Ubuntu partition! When I rebooted, the GRUB2 bootloader started successfully, but my Ubuntu was still unable to be found/booted under the list of available operating systems.\nAnyone have any ideas how I should change/update this configuration such that it'll point to my new Ubuntu installation properly?\nSome useful information...\n\"fdisk -l\":\nDisk /dev/sdd: 1000.2 GB, 1000204886016 bytes\n255 heads, 63 sectors/track, 121601 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\nDisk identifier: 0xb209a592\nDevice Boot Start End Blocks Id System\n /dev/sdd1 * 1 13 102400 7 HPFS/NTFS\n Partition 1 does not end on cylinder boundary.\n /dev/sdd2 13 60555 486297600 7 HPFS/NTFS\n /dev/sdd3 60555 120143 478642176 83 Linux\n /dev/sdd4 120143 121602 11717633 5 Extended\n /dev/sdd5 120143 121602 11717632 82 Linux swap / Solaris\n\n\"grub.cfg\" entries:\n### BEGIN /etc/grub.d/30_os-prober ### menuentry \"Windows 7 (loader) (on /dev/sdd1)\" --class windows --class os { insmod part_msdos insmod ntfs set root='(/dev/sdd,msdos1)' search --no-floppy\n--fs-uuid --set=root 08BAB5B0BAB59B20 chainloader +1 }\n### END /etc/grub.d/30_os-prober ###\n### BEGIN /etc/grub.d/40_custom ###\n # This file provides an easy way to add custom menu entries. Simply type the\n # menu entries you want to add after this comment. Be careful not to change\n # the 'exec tail' line above.\n### END /etc/grub.d/40_custom ###\n\n\"boot_info_script output:\nBoot Info Script 0.60 from 17 May 2011\n============================= Boot Info Summary: ===============================\n => Windows is installed in the MBR of /dev/sda.\n => Windows is installed in the MBR of /dev/sdb.\n => Windows is installed in the MBR of /dev/sdc.\n => Grub2 (v1.99) is installed in the MBR of /dev/sdd and looks at sector 1 of \n the same hard drive for core.img. core.img is at this location and looks \n for (,msdos1)/grub on this drive.\n => Syslinux MBR (4.04 and higher) is installed in the MBR of /dev/sde.\nsda1: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows XP\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: \n Boot files: \nsdb1: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows Vista/7\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: \n Boot files: /bootmgr /Boot/BCD\nsdb2: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows Vista/7\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: Windows 7\n Boot files: /Windows/System32/winload.exe\nsdc1: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows XP\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: \n Boot files: \nsdd1: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows Vista/7\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: \n Boot files: /grub/grub.cfg /bootmgr /Boot/BCD /grub/core.img\nsdd2: __________________________________________________________________________\n File system: ntfs\n Boot sector type: Windows Vista/7\n Boot sector info: No errors found in the Boot Parameter Block.\n Operating System: Windows 7\n Boot files: /Windows/System32/winload.exe\nsdd3: __________________________________________________________________________\n File system: ext4\n Boot sector type: -\n Boot sector info: \n Operating System: Ubuntu 11.04\n Boot files: /boot/grub/grub.cfg /etc/fstab\nsdd4: __________________________________________________________________________\n File system: Extended Partition\n Boot sector type: -\n Boot sector info: \nsdd5: __________________________________________________________________________\n File system: swap\n Boot sector type: -\n Boot sector info: \nsde1: __________________________________________________________________________\n File system: vfat\n Boot sector type: SYSLINUX 4.04 2011-04-18\n Boot sector info: Syslinux looks at sector 8448 of /dev/sde1 for its \n second stage. SYSLINUX is installed in the directory. \n The integrity check of the ADV area failed. No errors \n found in the Boot Parameter Block.\n Operating System: \n Boot files: /boot/grub/grub.cfg /syslinux/syslinux.cfg /ldlinux.sys\n============================ Drive/Partition Info: =============================\nDrive: sda _____________________________________________________________________\nDisk /dev/sda: 1000.2 GB, 1000204886016 bytes\n255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nPartition Boot Start Sector End Sector # of Sectors Id System\n/dev/sda1 63 1,953,520,064 1,953,520,002 7 NTFS / exFAT / HPFS\nDrive: sdb _____________________________________________________________________\nDisk /dev/sdb: 250.1 GB, 250059350016 bytes\n255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nPartition Boot Start Sector End Sector # of Sectors Id System\n/dev/sdb1 2,048 206,847 204,800 7 NTFS / exFAT / HPFS\n/dev/sdb2 * 206,848 488,394,751 488,187,904 7 NTFS / exFAT / HPFS\nDrive: sdc _____________________________________________________________________\nDisk /dev/sdc: 1000.2 GB, 1000204886016 bytes\n255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nPartition Boot Start Sector End Sector # of Sectors Id System\n/dev/sdc1 63 1,953,520,064 1,953,520,002 7 NTFS / exFAT / HPFS\nDrive: sdd _____________________________________________________________________\nDisk /dev/sdd: 1000.2 GB, 1000204886016 bytes\n255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nPartition Boot Start Sector End Sector # of Sectors Id System\n/dev/sdd1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS\n/dev/sdd2 206,848 972,802,047 972,595,200 7 NTFS / exFAT / HPFS\n/dev/sdd3 972,802,048 1,930,086,399 957,284,352 83 Linux\n/dev/sdd4 1,930,088,446 1,953,523,711 23,435,266 5 Extended\n/dev/sdd5 1,930,088,448 1,953,523,711 23,435,264 82 Linux swap / Solaris\nDrive: sde _____________________________________________________________________\nDisk /dev/sde: 3926 MB, 3926949888 bytes\n16 heads, 16 sectors/track, 29960 cylinders, total 7669824 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nPartition Boot Start Sector End Sector # of Sectors Id System\n/dev/sde1 * 8,064 7,669,823 7,661,760 c W95 FAT32 (LBA)\n\"blkid\" output: ________________________________________________________________\nDevice UUID TYPE LABEL\n/dev/loop0 squashfs \n/dev/sda1 36BA3C8CBA3C4A9F ntfs Data Storage (Backup)\n/dev/sdb1 90A09285A0927188 ntfs System Reserved\n/dev/sdb2 88E09C67E09C5D6E ntfs Old OS HDD\n/dev/sdc1 1CEE7227EE71F8FA ntfs Data Storage\n/dev/sdd1 08BAB5B0BAB59B20 ntfs System Reserved\n/dev/sdd2 30EEC43AEEC3F65E ntfs Operating System\n/dev/sdd3 fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa ext4 \n/dev/sdd5 086c0085-650b-495f-b9e8-e7e637fac705 swap \n/dev/sde1 FC8F-97FE vfat PENDRIVE\n================================ Mount points: =================================\nDevice Mount_Point Type Options\n/dev/loop0 /rofs squashfs (ro,noatime)\n/dev/sde1 /cdrom vfat (ro,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)\n============================= sdd1/grub/grub.cfg: ==============================\n--------------------------------------------------------------------------------\n#\n# DO NOT EDIT THIS FILE\n#\n# It is automatically generated by grub-mkconfig using templates\n# from /etc/grub.d and settings from /etc/default/grub\n#\n### BEGIN /etc/grub.d/00_header ###\nif [ -s $prefix/grubenv ]; then\n set have_grubenv=true\n load_env\nfi\nset default=\"0\"\nif [ \"${prev_saved_entry}\" ]; then\n set saved_entry=\"${prev_saved_entry}\"\n save_env saved_entry\n set prev_saved_entry=\n save_env prev_saved_entry\n set boot_once=true\nfi\nfunction savedefault {\n if [ -z \"${boot_once}\" ]; then\n saved_entry=\"${chosen}\"\n save_env saved_entry\n fi\n}\nfunction recordfail {\n set recordfail=1\n if [ -n \"${have_grubenv}\" ]; then if [ -z \"${boot_once}\" ]; then save_env recordfail; fi; fi\n}\nfunction load_video {\n insmod vbe\n insmod vga\n insmod video_bochs\n insmod video_cirrus\n}\ninsmod part_msdos\ninsmod ext2\nset root='(/dev/sdd,msdos5)'\nsearch --no-floppy --fs-uuid --set=root 43000377-e88b-4373-975e-66146de829ce\nif loadfont /usr/share/grub/unicode.pf2 ; then\n set gfxmode=auto\n load_video\n insmod gfxterm\nfi\nterminal_output gfxterm\ninsmod part_msdos\ninsmod ntfs\nset root='(/dev/sdd,msdos1)'\nsearch --no-floppy --fs-uuid --set=root 08BAB5B0BAB59B20\nset locale_dir=($root)/grub/locale\nset lang=en_US\ninsmod gettext\nif [ \"${recordfail}\" = 1 ]; then\n set timeout=-1\nelse\n set timeout=10\nfi\n### END /etc/grub.d/00_header ###\n### BEGIN /etc/grub.d/05_debian_theme ###\nset menu_color_normal=white/black\nset menu_color_highlight=black/light-gray\nif background_color 44,0,30; then\n clear\nfi\n### END /etc/grub.d/05_debian_theme ###\n### BEGIN /etc/grub.d/10_linux ###\nif [ ${recordfail} != 1 ]; then\n if [ -e ${prefix}/gfxblacklist.txt ]; then\n if hwmatch ${prefix}/gfxblacklist.txt 3; then\n if [ ${match} = 0 ]; then\n set linux_gfx_mode=keep\n else\n set linux_gfx_mode=text\n fi\n else\n set linux_gfx_mode=text\n fi\n else\n set linux_gfx_mode=keep\n fi\nelse\n set linux_gfx_mode=text\nfi\nexport linux_gfx_mode\nif [ \"$linux_gfx_mode\" != \"text\" ]; then load_video; fi\n### END /etc/grub.d/10_linux ###\n### BEGIN /etc/grub.d/20_linux_xen ###\n### END /etc/grub.d/20_linux_xen ###\n### BEGIN /etc/grub.d/20_memtest86+ ###\n### END /etc/grub.d/20_memtest86+ ###\n### BEGIN /etc/grub.d/30_os-prober ###\n# menuentry \"Windows 7 (loader) (on /dev/sdb1)\" --class windows --class os {\n# insmod part_msdos\n# insmod ntfs\n# set root='(/dev/sdb,msdos1)'\n# search --no-floppy --fs-uuid --set=root 90A09285A0927188\n# chainloader +1\n# }\nmenuentry \"Windows 7 (loader) (on /dev/sdd1)\" --class windows --class os {\n insmod part_msdos\n insmod ntfs\n set root='(/dev/sdd,msdos1)'\n search --no-floppy --fs-uuid --set=root 08BAB5B0BAB59B20\n chainloader +1\n}\n### END /etc/grub.d/30_os-prober ###\n### BEGIN /etc/grub.d/40_custom ###\n# This file provides an easy way to add custom menu entries. Simply type the\n# menu entries you want to add after this comment. Be careful not to change\n# the 'exec tail' line above.\n### END /etc/grub.d/40_custom ###\n### BEGIN /etc/grub.d/41_custom ###\nif [ -f $prefix/custom.cfg ]; then\n source $prefix/custom.cfg;\nfi\n### END /etc/grub.d/41_custom ###\n--------------------------------------------------------------------------------\n=================== sdd1: Location of files loaded by Grub: ====================\n GiB - GB File Fragment(s)\n ?? = ?? grub/core.img 1\n ?? = ?? grub/grub.cfg 1\n=========================== sdd3/boot/grub/grub.cfg: ===========================\n--------------------------------------------------------------------------------\n#\n# DO NOT EDIT THIS FILE\n#\n# It is automatically generated by grub-mkconfig using templates\n# from /etc/grub.d and settings from /etc/default/grub\n#\n### BEGIN /etc/grub.d/00_header ###\nif [ -s $prefix/grubenv ]; then\n set have_grubenv=true\n load_env\nfi\nset default=\"0\"\nif [ \"${prev_saved_entry}\" ]; then\n set saved_entry=\"${prev_saved_entry}\"\n save_env saved_entry\n set prev_saved_entry=\n save_env prev_saved_entry\n set boot_once=true\nfi\nfunction savedefault {\n if [ -z \"${boot_once}\" ]; then\n saved_entry=\"${chosen}\"\n save_env saved_entry\n fi\n}\nfunction recordfail {\n set recordfail=1\n if [ -n \"${have_grubenv}\" ]; then if [ -z \"${boot_once}\" ]; then save_env recordfail; fi; fi\n}\nfunction load_video {\n insmod efi_gop\n insmod efi_uga\n insmod video_bochs\n insmod video_cirrus\n}\ninsmod part_msdos\ninsmod ext2\nset root='(/dev/sdd,msdos3)'\nsearch --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\nif loadfont /usr/share/grub/unicode.pf2 ; then\n set gfxmode=auto\n load_video\n insmod gfxterm\nfi\nterminal_output gfxterm\ninsmod part_msdos\ninsmod ext2\nset root='(/dev/sdd,msdos3)'\nsearch --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\nset locale_dir=($root)/boot/grub/locale\nset lang=en_US\ninsmod gettext\nif [ \"${recordfail}\" = 1 ]; then\n set timeout=-1\nelse\n set timeout=10\nfi\n### END /etc/grub.d/00_header ###\n### BEGIN /etc/grub.d/05_debian_theme ###\nset menu_color_normal=white/black\nset menu_color_highlight=black/light-gray\nif background_color 44,0,30; then\n clear\nfi\n### END /etc/grub.d/05_debian_theme ###\n### BEGIN /etc/grub.d/10_linux ###\nif [ ${recordfail} != 1 ]; then\n if [ -e ${prefix}/gfxblacklist.txt ]; then\n if hwmatch ${prefix}/gfxblacklist.txt 3; then\n if [ ${match} = 0 ]; then\n set linux_gfx_mode=keep\n else\n set linux_gfx_mode=text\n fi\n else\n set linux_gfx_mode=text\n fi\n else\n set linux_gfx_mode=keep\n fi\nelse\n set linux_gfx_mode=text\nfi\nexport linux_gfx_mode\nif [ \"$linux_gfx_mode\" != \"text\" ]; then load_video; fi\nmenuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {\n recordfail\n set gfxpayload=$linux_gfx_mode\n insmod part_msdos\n insmod ext2\n set root='(/dev/sdd,msdos3)'\n search --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\n linux /boot/vmlinuz-2.6.38-8-generic root=UUID=fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa ro quiet splash vt.handoff=7\n initrd /boot/initrd.img-2.6.38-8-generic\n}\nmenuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {\n recordfail\n set gfxpayload=$linux_gfx_mode\n insmod part_msdos\n insmod ext2\n set root='(/dev/sdd,msdos3)'\n search --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\n echo 'Loading Linux 2.6.38-8-generic ...'\n linux /boot/vmlinuz-2.6.38-8-generic root=UUID=fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa ro single \n echo 'Loading initial ramdisk ...'\n initrd /boot/initrd.img-2.6.38-8-generic\n}\n### END /etc/grub.d/10_linux ###\n### BEGIN /etc/grub.d/20_linux_xen ###\n### END /etc/grub.d/20_linux_xen ###\n### BEGIN /etc/grub.d/20_memtest86+ ###\nmenuentry \"Memory test (memtest86+)\" {\n insmod part_msdos\n insmod ext2\n set root='(/dev/sdd,msdos3)'\n search --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\n linux16 /boot/memtest86+.bin\n}\nmenuentry \"Memory test (memtest86+, serial console 115200)\" {\n insmod part_msdos\n insmod ext2\n set root='(/dev/sdd,msdos3)'\n search --no-floppy --fs-uuid --set=root fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa\n linux16 /boot/memtest86+.bin console=ttyS0,115200n8\n}\n### END /etc/grub.d/20_memtest86+ ###\n### BEGIN /etc/grub.d/30_os-prober ###\nmenuentry \"Windows 7 (loader) (on /dev/sdb1)\" --class windows --class os {\n insmod part_msdos\n insmod ntfs\n set root='(/dev/sdb,msdos1)'\n search --no-floppy --fs-uuid --set=root 90A09285A0927188\n chainloader +1\n}\nmenuentry \"Windows 7 (loader) (on /dev/sdd1)\" --class windows --class os {\n insmod part_msdos\n insmod ntfs\n set root='(/dev/sdd,msdos1)'\n search --no-floppy --fs-uuid --set=root 08BAB5B0BAB59B20\n chainloader +1\n}\n### END /etc/grub.d/30_os-prober ###\n### BEGIN /etc/grub.d/40_custom ###\n# This file provides an easy way to add custom menu entries. Simply type the\n# menu entries you want to add after this comment. Be careful not to change\n# the 'exec tail' line above.\n### END /etc/grub.d/40_custom ###\n### BEGIN /etc/grub.d/41_custom ###\nif [ -f $prefix/custom.cfg ]; then\n source $prefix/custom.cfg;\nfi\n### END /etc/grub.d/41_custom ###\n--------------------------------------------------------------------------------\n=============================== sdd3/etc/fstab: ================================\n--------------------------------------------------------------------------------\n# /etc/fstab: static file system information.\n#\n# Use 'blkid -o value -s UUID' to print the universally unique identifier\n# for a device; this may be used with UUID= as a more robust way to name\n# devices that works even if disks are added and removed. See fstab(5).\n#\n# \nproc /proc proc nodev,noexec,nosuid 0 0\n# / was on /dev/sdd3 during installation\nUUID=fb62baf1-e6a7-4e0d-ada2-2efb52ab12fa / ext4 errors=remount-ro 0 1\n# swap was on /dev/sdd5 during installation\nUUID=086c0085-650b-495f-b9e8-e7e637fac705 none swap sw 0 0\n--------------------------------------------------------------------------------\n=================== sdd3: Location of files loaded by Grub: ====================\n GiB - GB File Fragment(s)\n 476.025924683 = 511.128944640 boot/grub/grub.cfg 1\n 465.547851562 = 499.878199296 boot/initrd.img-2.6.38-8-generic 2\n 686.000980377 = 736.587943936 boot/vmlinuz-2.6.38-8-generic 1\n 465.547851562 = 499.878199296 initrd.img 2\n 686.000980377 = 736.587943936 vmlinuz 1\n=========================== sde1/boot/grub/grub.cfg: ===========================\n--------------------------------------------------------------------------------\nif loadfont /boot/grub/font.pf2 ; then\n set gfxmode=auto\n insmod efi_gop\n insmod efi_uga\n insmod gfxterm\n terminal_output gfxterm\nfi\nset menu_color_normal=white/black\nset menu_color_highlight=black/light-gray\nmenuentry \"Try Ubuntu without installing\" {\n set gfxpayload=keep\n linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --\n initrd /casper/initrd.lz\n}\nmenuentry \"Install Ubuntu\" {\n set gfxpayload=keep\n linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash --\n initrd /casper/initrd.lz\n}\nmenuentry \"Check disc for defects\" {\n set gfxpayload=keep\n linux /casper/vmlinuz boot=casper integrity-check quiet splash --\n initrd /casper/initrd.lz\n}\n--------------------------------------------------------------------------------\n========================= sde1/syslinux/syslinux.cfg: ==========================\n--------------------------------------------------------------------------------\n# D-I config version 2.0\ninclude menu.cfg\ndefault vesamenu.c32\nprompt 0\ntimeout 50\n# If you would like to use the new menu and be presented with the option to install or run from USB at startup, remove # from the following line. This line was commented out (by request of many) to allow the old menu to be presented and to enable booting straight into the Live Environment! \n# ui gfxboot bootlogo\n--------------------------------------------------------------------------------\n=================== sde1: Location of files loaded by Grub: ====================\n GiB - GB File Fragment(s)\n ?? = ?? boot/grub/grub.cfg 1\n================= sde1: Location of files loaded by Syslinux: ==================\n GiB - GB File Fragment(s)\n ?? = ?? ldlinux.sys 1\n ?? = ?? syslinux/gfxboot.c32 1\n ?? = ?? syslinux/syslinux.cfg 1\n ?? = ?? syslinux/vesamenu.c32 1\n============== sde1: Version of COM32(R) files used by Syslinux: ===============\n syslinux/gfxboot.c32 : COM32R module (v4.xx)\n syslinux/vesamenu.c32 : COM32R module (v4.xx)\n=============================== StdErr Messages: ===============================\nunlzma: Decoder error\n/home/ubuntu/Desktop/boot_info_script.sh: line 1579: [: 2.73495e+09: integer expression expected\n"}}},{"rowIdx":284,"cells":{"text":{"kind":"string","value":"Text\nLately there’s been a lot of discussion about whether Python 3 is working out or not, with many projects reluctant to move to Python 3, especially big, mature projects that are in the “if it’s not broken don’t touch it” phase.\nI still fully believe in Python 3, but this blog post is not about discussing 2-vs-3; I’d like to make my own modest contribution to the Python 3 cause by sharing with you my method of supporting both Python 2 and Python 3 which I use in my open-source project python_toolbox.\nWhen I originally read about the different ways to support both Python 2 and 3, I was appalled. There seemed to be 3 ways, and all 3 had properties that made me not want to even consider them.\nThe 3 approaches seem to be:\nsix.\nI’ve spent quite some time thinking which approach to take, and I’ve settled on the first approach. I’ve implemented it a few months ago, and it’s been working really well.\nmetaclass=MyType you need to specify six.with_metaclass(MyType), instead of using str you need to use six.text_type. That’s not what Python is about. It’s critical for me to have the code be as succinct as possible.\nHaving two separate codebases is the only solution that gives you full control of both codebases. You can tweak each codebase to fit the Python version it’s serving, and use its features in the most idiomatic way.\nNow the big question is, how do you deal with having two separate codebases? I gave this question some thought. The main problem seems to be this: If I’m adding a feature in the Python 2 version of the library, I want to have that feature in the Python 3 branch, (or vice versa) but I don’t want to type the code again, nor to copy-paste. That’s the crux of the problem, and if that’s solved, having 2 codebases becomes less of an issue. (It’s not like we’re trying to save on diskspace.)\nSo, when developing a feature for the Py2 version and having it appear in the Py3 version I have to do something like a merge between the two codebases, because the two codebases are different. Normally I would use git merge, but I can’t do that in this case because both codebases are in the same repo. (I considered using git submodules and having each codebase on a different submodule, but the path leading up to submodules is littered with the corpses of desperate developers who regretted ever touching them.)\nI came up with a solution that works great. All you’ll need is to get a merge program that supports 3-way merging (I use the excellent but proprietery Araxis Merge, but open source alternatives are available), and follow the instructions below. They’re a bit lengthy, but after you get used to it, you can do them quickly enough that it’s not a big toll on the development cycle.\nCreate a folder structure similar to mine:\npython_toolbox/ <--- Repo root\n source_py2/\n python_toolbox/\n __init__.py\n (All the source files, in their Python 2 version.)\n source_py3/\n python_toolbox/\n __init__.py\n (All the source files, in their Python 3 version.)\n setup.py\n README.markdown\n (All the usual files...)\n\nMy setup.py file contains this simple snippet:\nif sys.version_info[0] == 3:\n source_folder = 'source_py3'\n else:\n source_folder = 'source_py2'\n\nThen, the rest of the code in setup.py refers to source_folder instead of a hardcoded folder. This way a Python 2 user gets the Python 2 version installed, while a Python 3 user gets the Python 3 version installed. So far so good.\nNow you’re asking, how do you deal with the in-repo merge problem?\nFirst, before making the split to support Python 3, ensure that you’re starting from a commit where all the code works great and the test suite passes. Then, use 2to3 just one time to create a copy of your code that supports Python 3. Put that in source_py3, and put the original code in source_py2. Debug the test suite on the Python 3 version and edit it until all the tests pass. Fix your setup.py files to take the correct source folder using the snippet I gave above, and confirm that it works by creating a source distribution and installing it on empty virtualenvs of both Python 2 and Python 3.\nSo far so good; you now have a working version of your code that works for both Python versions. What you do at this point is create a Git branch called parity pointing to this commit. You push it to your Git remote, of course. You make the following rule, either with yourself in case of a single developer or with your fellow developers: You merge code to parity only if the Python 2 codebase and the Python 3 codebase are equivalent. Equivalent means that if a feature has been implemented in one, it was merged (more about how later) to the other. If a bug was fixed in one codebase, it was merged to the other. Never let anyone push code to the\nparity branch if that code doesn’t have parity between Python versions.\nNow, how do you actually do the merge? Say that on your development branch you’ve developed a new feature in the Python 3 codebase, and you want to merge it into the Python 2 version. (If you want to go the other way, just flip 2 and 3 in my explanation below.) What you do is this: First you ensure that you committed your change. Then, you create a local clone of your Git repo, with the parity branch checked out. (Do a git pull to be sure that you have the latest version.) Fire up your merge program and do the following three-way folder merge:\nsource_py3 folder in the clone, which has the parity branch checked out, without your new feature.source_py3 folder in the original git repo, which has the development branch checked out, and does include your new feature.source_py2 folder in the original git repo, which has the development branch checked out, but does not include your new feature because it’s the Python 2 folder.\nThe merge you’re doing can be verbally described as: “Take the difference between the old Python 3 codebase and the new Python 3 codebase, and apply it to the Python 2 codebase.” In practice, it’s done like so: You go over the list of files, looking for files which changed between column 1 and column 2. For each file like that, you open it for file merging. Your merge program will show the 3 different versions of the file, with differences between each two columns clearly marked. You put the caret on the middle column, and page through the differences. (Preferably using a keyboard shortcut like alt-down, consult your merge program documentation.)\nAs you go down the file, you’ll see three kinds of differences. Differences between column 1 and 2, between column 2 and 3, and between all columns.\nctrl-right. (This takes new code from the Python 3 codebase and copies it over to the Python 2 version.) Do take a brief look at the code you’re merging to ensure it’s Python 2 compatible.\nKeep going over all files like that, until you’ve finished with all of them. Save all the files. Then run the test suite on both Python versions, and if there are any bugs, fix them until the suite passes.\nCongratulations! You’ve achieved parity again. Commit your changes and push them to the parity branch. If you wish to make a PyPI release at this point, you’re good to go and your code will work on both Python versions.\nYou don’t have to do this process on every feature; you can do it once in a while, or every time before you merge changes to master.\nNotes:\nfix-foo-bug branch you can create a temporary fix-foo-bug-parity branch to use as your parity branch, so you won’t have to use the same parity branch for all branches.)\n———-\nThat’s it. The process is a bit complex, but in my opinion the results are worth it; you have 2 completely separate codebases, you don’t depend on either code generation or compatibility libraries, and you can enjoy writing Python 3 idiomatic code on the Python 3 codebase."}}},{"rowIdx":285,"cells":{"text":{"kind":"string","value":"I installed the KDE window manager on top of Ubuntu 11.10 and while I am using KDE, I do not get an elevation dialog when I try to perform tasks that require root privileges. Instead, the operations silently fail, unless I launch apps from a terminal, in which case I get errors like:\nTraceback (most recent call last):\n File \"/usr/lib/python2.7/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py\", line 649, in on_isv_source_toggled\n self.backend.ToggleSourceUse(str(source_entry))\n File \"/usr/lib/python2.7/dist-packages/dbus/proxies.py\", line 143, in __call__\n **keywords)\n File \"/usr/lib/python2.7/dist-packages/dbus/connection.py\", line 630, in call_blocking\n message, timeout)\ndbus.exceptions.DBusException: com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges\n\nOr from the muon package manager, an error dialog such as:\nDoes anyone know what I need to do to fix this, so that I get a proper dialog asking for elevation? Otherwise, I have to start each app that may need root privs with sudo from a terminal or gksudo.\nThanks"}}},{"rowIdx":286,"cells":{"text":{"kind":"string","value":"I prepared an example that shows how to compile a project like yours with just one SConstruct script (no subsidiary SConscripts) using the SCons VariantDir() function. I decided to do this in a separate answer so that it would be easier to read.\nThe VariantDir() function isnt documented very well, so the behavior you mention regarding the placement of the compiled object files isnt straight-forward to fix. The \"trick\" is to refer to all of your source files in the variant directory, not in your actual source directory, as can be seen below.\nHere is the structure of the source files in my project:\n$ tree .\n.\n├── SConstruct\n├── src1\n│   ├── class1.cc\n│   └── class1.h\n├── src2\n│   ├── class2.cc\n│   └── class2.h\n└── srcMain\n └── main.cc\nHere is the SConstruct:\nenv = Environment()\n# Set the include paths\nenv.Append(CPPPATH = ['src1', 'src2'])\n# Notice the source files are referred to in the build dir\n# If you dont do this, the compiled objects will be in the src dirs\nsrc1Sources = ['build/lib1/class1.cc']\nsrc2Sources = ['build/lib2/class2.cc']\nmainSources = ['build/mainApp/main.cc']\nenv.VariantDir(variant_dir = 'build/lib1', src_dir = 'src1', duplicate = 0)\nenv.VariantDir(variant_dir = 'build/lib2', src_dir = 'src2', duplicate = 0)\nenv.VariantDir(variant_dir = 'build/mainApp', src_dir = 'srcMain', duplicate = 0)\nlib1 = env.Library(target = 'build/lib1/src1', source = src1Sources)\nlib2 = env.Library(target = 'build/lib1/src2', source = src2Sources)\nenv.Program(target = 'build/mainApp/main', source = [mainSources, lib1, lib2])\n\nHere is the compilation output:\n$ scons\nscons: Reading SConscript files ...\nscons: done reading SConscript files.\nscons: Building targets ...\ng++ -o build/lib1/class1.o -c -Isrc1 -Isrc2 src1/class1.cc\nar rc build/lib1/libsrc1.a build/lib1/class1.o\nranlib build/lib1/libsrc1.a\ng++ -o build/lib2/class2.o -c -Isrc1 -Isrc2 src2/class2.cc\nar rc build/lib1/libsrc2.a build/lib2/class2.o\nranlib build/lib1/libsrc2.a\ng++ -o build/mainApp/main.o -c -Isrc1 -Isrc2 srcMain/main.cc\ng++ -o build/mainApp/main build/mainApp/main.o build/lib1/libsrc1.a build/lib1/libsrc2.a\nscons: done building targets.\n\nAnd here is the resulting project structure after compiling:\n$ tree .\n.\n├── build\n│   ├── lib1\n│   │   ├── class1.o\n│   │   ├── libsrc1.a\n│   │   └── libsrc2.a\n│   ├── lib2\n│   │   └── class2.o\n│   └── mainApp\n│   ├── main\n│   └── main.o\n├── SConstruct\n├── src1\n│   ├── class1.cc\n│   └── class1.h\n├── src2\n│   ├── class2.cc\n│   └── class2.h\n└── srcMain\n └── main.cc\nIt should be mentioned that a more straight-forward way to do this is with the SConscript() function, specifying the variant_dir, but if your requirements dont allow you to do so, this example will work. The SCons man page has more info about the VariantDir() function. There you will also find the following:\nNote that VariantDir() works most naturally with a subsidiary SConscript file."}}},{"rowIdx":287,"cells":{"text":{"kind":"string","value":"To add menu items to can write a Nautilus extension, like\nfrom gi.repository import Nautilus, GObject\nclass MyItemExtension(GObject.GObject, Nautilus.MenuProvider):\n def get_file_items(self, window, files):\n menuitem = Nautilus.MenuItem(name='MyItem::SomeItem', \n label='My Item', \n tip='my own item',\n icon='')\n menuitem.connect('activate', self.on_menu_item_clicked, files)\n return menuitem,\n def on_menu_item_clicked(self, item, files):\n print [f.get_name() for f in files]\n\nSave this into something like /usr/share/nautilus-python/extensions/myitem.py, install the package python-nautilus and restart Nautilus, for example by running nautilus -q; sleep 2; nautilus. Now you should see a new item \"My Item\" if you rightclick a file.\nAs far as I know there is no documented way to remove menu items.\nThe see API reference for some more information."}}},{"rowIdx":288,"cells":{"text":{"kind":"string","value":"I have two table posts & categories\npost_id | post_title | post_content | post_cat--------------------------------------------------1 Hello World welcome to my.. 1. .. .. ..\ncategories table\ncat_id | cat_name | cat_parent-----------------------------1 News NULL2 Sports 1. ... ..\nLet's say current category link for news is http://domain.com/category/1/\nMySQL statment\nSELECT posts.post_id,\n posts.post_id,\n posts.post_title,\n posts.post_content,\n posts.post_cat,\n categories.cat_id,\n categories.cat_name,\n categories.cat_parent\nFROM posts\n INNER JOIN categories\n ON posts.post_cat = categories.cat_id \n WHERE posts.post_cat = (int)$_GET['cat_id']\n\nSo we can get a result for post_cat = 1\nAccording to my current database structure, how do I remove the ID but change it to be a nice slug? Example :-\nMain category - http://domain.com/category/news/\nSub category - http://domain.com/category/news/sports/\n\nLet me know a clue how script will tell News is equal 1 on post_cat column?"}}},{"rowIdx":289,"cells":{"text":{"kind":"string","value":"I have a SQLAlchemy table class created using the Declarative method:\nmysqlengine = create_engine(dsn)\nsession = scoped_session(sessionmaker(bind=mysqlengine))\nBase = declarative_base()\nBase.metadata.bind = mysqlengine\nclass MyTable(Base):\n __table_args__ = {'autoload' : True}\n\nNow, when using this table within the code I would like to not have to use the session.add method in order to add each new record to the active session so instead of:\nrow = MyTable(1, 2, 3)\nsession.add(row)\nsession.commit()\n\nI would like to have:\nrow = MyTable(1, 2, 3)\nsession.commit()\n\nNow, I know of this question already: Possible to add an object to SQLAlchemy session without explicit session.add()?\nAnd, I realize you can force this behavior by doing the following:\nclass MyTable(Base):\n def __init__(self, *args, **kw):\n super(MyTable, self).__init__(*args, **kw)\n session.add(self)\n\nHowever, I do not want to bloat my code containing 30 tables with this method. I also know that Elixir ( http://elixir.ematia.de/trac/wiki ) does this so it must be possible in some sense."}}},{"rowIdx":290,"cells":{"text":{"kind":"string","value":"Already have GraphLab Create and want to get the latest version? Follow the upgrade instructions.\nJoin the beta! It is free and easy. Sign up and instantly receive a GraphLab Create product key for your individual use. We will also send you a confirmation email.\nAll fields are required.\nWelcome to the beta! Your product key has been generated. To make configuration easy, we have provided a shell command that will insert your product key in a GraphLab Create configuration file located in your home directory. Before running Python, paste the following code into your terminal window and execute. GraphLab Create will reference this file upon import.\n(mkdir -p ~/.graphlab && echo -e \"[Product]\\nproduct_key={key}\" > ~/.graphlab/config && echo \"Configuration file written\") || echo \"Configuration file not written\"\n\nSuccessful completion of this step will show \"Configuration file written\" in your terminal window. Now, proceed to Step 2.\nGraphLab Create is easy to install is easy to install.\nSupported operating systems:\nWhat do I need to do?\npython -V in terminal)\nYou can install Graphlab Create system-wide (recommended) or in a Python virtual environment (virtualenv).\nCopy and paste the following code into your terminal window and hit \"Enter\".\nsudo pip install graphlab-create==0.9.1\n\nIf you are unsure about installing or upgrading these libraries system-wide we recommend installation with virtualenv.\nInstalling with in a virtualenv contains the installation of GraphLab Create and allows you to customize this virtualenv with other Python packages you may want for your data science projects.\npip freeze. To install, execute sudo pip install virtualenv in your terminal before proceeding\nvirtualenv graphlab\n. graphlab/bin/activate\npip install graphlab-create==0.9.1\nResource: Learn how to use virtualenv\nNow you can start using GraphLab Create. Let's build a recommender. Copy and paste the following code into your Python console.\nimport graphlab as gl\nurl = 'http://s3.amazonaws.com/GraphLab-Datasets/movie_ratings/training_data.csv'\ndata = gl.SFrame.read_csv(url, column_type_hints={\"rating\":int})\ndata.show()\nmodel = gl.recommender.create(data, user_id=\"user\", item_id=\"movie\", target=\"rating\")\nresults = model.recommend(users=None, k=5)\n\nYou've just used the fundamentals of GraphLab Create! To learn more about this recommender see this notebook.\nGet started by visiting our Learn section where you will find our user guide, API documents, How To sample code, a syntax translator and more.\nThe Getting Started with GraphLab Create is a good IPython notebook for beginners. Download the code and have fun. It will give you a broad overview of how to use GraphLab Create. We’ll introduce the SFrame, a tabular structure ideal for data manipulation and feature building, and the Graph which is a structure ideal for sparse relationship data. We’ll also introduce our machine learning toolkits. Using these, you’ll ingest data, build a graph, and run a graphical model to generate an insight. Check out all of our notebooks!, there's a lot to see."}}},{"rowIdx":291,"cells":{"text":{"kind":"string","value":"I'm having a hard time finding a good, basic example of how to parse XML in python using Element Tree. From what I can find, this appears to be the easiest library to use for parsing XML. Here is a sample of the XML I'm working with:\n\n \n 01474500\n 99988\n \n 2009-09-24T15:15:55.271\n 2009-11-23T15:15:55.271\n \n \n \n \n 550\n 419\n 370\n .....\n \n \n\n\nI am able to do what I need, using a hard-coded method. But I need my code to be a bit more dynamic. Here is what worked:\ntree = ET.parse(sample.xml)\ndoc = tree.getroot()\ntimeseries = doc[1]\nvalues = timeseries[2]\nprint child.attrib['dateTime'], child.text\n#prints 2009-09-24T15:30:00.000-04:00, 550\n\nHere are a couple of things I've tried, none of them worked, reporting that they couldn't find timeSeries (or anything else I tried):\ntree = ET.parse(sample.xml)\ntree.find('timeSeries')\ntree = ET.parse(sample.xml)\ndoc = tree.getroot()\ndoc.find('timeSeries')\n\nBasically, I want to load the xml file, search for the timeSeries tag, and iterate through the value tags, returning the dateTime and the value of the tag itself; everything I'm doing in the above example, but not hard coding the sections of xml I'm interested in. Can anyone point me to some examples, or give me some suggestions on how to work through this? Thanks for your help\nUPDATE (11/24/09): Thanks for all the help. Using both of the below suggestions worked on the sample file I provided, however, they didn't work on the full file. Here is the error I get from the real file when I use Ed Carrel's method:\n(, AttributeError(\"'NoneType' object has no attribute 'attrib'\",), )\n\nI figured there was something in the real file it didn't like, so I incremently removed things until it worked. Here are the lines that I changed:\noriginally: changed to: originally: changed to: originally: changed to: \nRemoving the attributes that have 'xsi:...' fixed the problem. Is the 'xsi:...' not valid XML? It will be hard for me to remove these programmatically. Any suggested work arounds?\nHere is the full XML file: http://www.sendspace.com/file/lofcpt\nThanks again\nCasey\nUPDATE (11/24/11)\nWhen I originally asked this question, I was unaware of namespaces in XML. Now that I know what's going on, I don't have to remove the \"xsi\" attributes, which are the namespace declarations. I just include them in my xpath searches. See this page for more info on namespaces in lxml."}}},{"rowIdx":292,"cells":{"text":{"kind":"string","value":"McPeter\nRe : Un 'autre' générateur de sources.list en ligne\nJe viens de rectifier le soucis sur le nom du fichier bash.\nPar contre je ne vois aucun soucis à l'exécution :\\\npourrais tu me dire quel navigateur tu as utilisé et quel message d'erreur ça te renvoit ? (un copié/collé du message)\nle chmod +x est inutile là puisque qu'on utilise directement 'bash fichier' (plus simple poru le commun des mortels )\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nnoruas beep ?!\nHors ligne\nSoCko\nRe : Un 'autre' générateur de sources.list en ligne\nMerci à toi McPeter pour ce générateur. Très utile et ergonomique, on a un sources.list en une dizaine de secondes!\nHors ligne\ntripes_inn\nRe : Un 'autre' générateur de sources.list en ligne\nmerci je reinstalle tout et je suis bien content de ne pas avoir à tout retrouver.\nj'ai dù corriger le fichier pour que synaptic l'accepte.\nje joins l'original\n###############################################################################\n## UBUNTU LUCID LYNX - 10.04 - Date : 11/09/2010\n##\n## SOURCES.LIST GENERATOR Version 0.3-10.04\n## http://sources-list.ubuntu-fr-secours.org\n###############################################################################\n# deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release i386 (20100429)]/ lucid main restricted\n## DEPOTS PRINCIPAUX\ndeb http://archive.ubuntu.com/ubuntu lucid main\n# deb-src http://archive.ubuntu.com/ubuntu lucid main\n## DEPOTS RESTRICTED\ndeb http://archive.ubuntu.com/ubuntu lucid restricted\n# deb-src http://archive.ubuntu.com/ubuntu lucid restricted\n## DEPOTS UNIVERSE (logiciels libres)\ndeb http://archive.ubuntu.com/ubuntu lucid universe\n# deb-src http://archive.ubuntu.com/ubuntu lucid universe\n## DEPOTS MULTIVERSE (logiciels non-libres)\ndeb http://archive.ubuntu.com/ubuntu lucid multiverse\n# deb-src http://archive.ubuntu.com/ubuntu lucid multiverse\n## DEPOTS DE MISES A JOUR EN PRES VERSION\n# deb http://archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse\n# deb-src http://archive.ubuntu.com/ubuntu lucid-proposed\n## DEPOTS NON PRIS EN CHARGE\n# deb http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse\n# deb-src http://archive.ubuntu.com/ubuntu lucid-backports\n## DEPOTS DE MISES A JOUR DE SECURITE\ndeb http://archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse\n# deb-src http://archive.ubuntu.com/ubuntu lucid-security\n## DEPOTS DE MISES A JOUR IMPORTANTES\ndeb http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse\n# deb-src http://archive.ubuntu.com/ubuntu lucid-updates\n## DEPOTS COMMERCIAUX\ndeb http://archive.canonical.com/ubuntu lucid partner\n# deb-src http://archive.canonical.com/ubuntu lucid partner\ndeb http://archive.canonical.com/ubuntu lucid-security partner\n# deb-src http://archive.canonical.com/ubuntu lucid-security partner\ndeb http://\n\nj'ai supprimer\ndeb http://\nà la fin et c bon\nSamsung N145 plus\nubuntu 11.10 64 bits\nHors ligne\nalej\nRe : Un 'autre' générateur de sources.list en ligne\nEt en ne gardant que les lignes utiles, en synthèse, ça donne ça...\ndeb http://archive.ubuntu.com/ubuntu lucid main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse\ndeb http://archive.canonical.com/ubuntu lucid partner\ndeb http://archive.canonical.com/ubuntu lucid-security partner\n\nUn peu + digeste, non ?\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nTu as surtout loupé ton copié/collé ...\nle dépôt canonical c'est ça :\n## DEPOTS COMMERCIAUX\ndeb http://archive.canonical.com/ubuntu lucid partner\n# deb-src http://archive.canonical.com/ubuntu lucid partner\ndeb http://archive.canonical.com/ubuntu lucid-security partner\n# deb-src http://archive.canonical.com/ubuntu lucid-security partner\ndeb http://archive.canonical.com/ubuntu lucid-updates partner\n# deb-src http://archive.canonical.com/ubuntu lucid-updates partner\n\nDonc soit y'a eu un bug au téléchargement du sources.list soit tu t'es loupé au copié/collé ...\nmais c'est pas juste une histoire de \"supprimer la fin\".\nmerci je reinstalle tout et je suis bien content de ne pas avoir à tout retrouver.\nj'ai dù corriger le fichier pour que synaptic l'accepte.\nje joins l'original\n...\n## DEPOTS COMMERCIAUX\ndeb http://archive.canonical.com/ubuntu lucid partner\n# deb-src http://archive.canonical.com/ubuntu lucid partner\ndeb http://archive.canonical.com/ubuntu lucid-security partner\n# deb-src http://archive.canonical.com/ubuntu lucid-security partner\ndeb http://\n\nj'ai supprimer\ndeb http://\nà la fin et c bon\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nEt en ne gardant que les lignes utiles, en synthèse, ça donne ça...\ndeb http://archive.ubuntu.com/ubuntu lucid main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse\ndeb http://archive.canonical.com/ubuntu lucid partner\ndeb http://archive.canonical.com/ubuntu lucid-security partner\n\nUn peu + digeste, non ?\nPas compris l'intervention là :\\\nça vient faire quoi dans la choucroute ?\nHors ligne\njajaX\nRe : Un 'autre' générateur de sources.list en ligne\nsalut\nla mise à jour pour avoir un source.list pour la 10.10 est prévue pour quand ?\n@+ jajaX [Membre de Breizhtux : LUG de Saint Brieuc]ACER Aspire 8930G 904G50Bn & HP dv7 2230f sous Kubuntu 14.04 The Trusty Tahr (64 bits) & KDE SC 4.13.2/Amarok 2.8ACER Aspire 5612 WLMI & HP Compaq NX6310 sous kubuntu 14.04 The Trusty Tahr (32 bits) & KDE SC 4.13.2/Amarok 2.8\nHors ligne\nnoruas\nRe : Un 'autre' générateur de sources.list en ligne\nDésolé, j'étais parti faire un tour sur Arch ^^\nAu sujet de mon problème, j'ai essayé toutes les possibilités de ton générateur sur 5 machines, dont une m'appartenant, j'ai toujours eu des soucis.\nLa génération des scripts automatiques se fait chez moi (sources.list_autoFull ou sources.list_autoFiles), mais ne renvois que des erreurs lorsque j'arrive à l'étape 5... donc échec.\nJe suis donc obligé de me rabattre sur la génération d'un \"sources.list\" et d'un \"sources.list_key\", mais même là, j'ai des soucis.\nEn fait, j'ai le même problème que \"tripes_inn\", mon fichier \"sources.list\" n'est jamais généré complètement, il m'en manque plus de la moitié et il se termine en général par \"deb http://\"...\nPar contre, j'ai beau le régénérer plusieurs fois, ce n'est jamais à la même ligne que ça s'arrête, mais il n'est jamais complet.\nPour solutionner ça, je copie colle le sources.list affiché dans le récapitulatif dans le fichier qu'il était censé me générer.\nEnsuite, tout se passe à merveille.\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nOui j'ai malheureusement vu qu'il y avait un gros bug sur le script de génération\nJe vais donc reprendre tout ça proprement\nLa version 10.10 arrive bientôt\nHors ligne\nnoruas\nRe : Un 'autre' générateur de sources.list en ligne\nOui et avec la version 10.10 le dépot officiel EXTRAS.\nPS: après test sur ma Maverick fraichement installée, il n'y a que le dépot Exaile qui n'existe pas encore pour cette version d'Ubuntu, les autres sont déjà opérationels.\nDernière modification par noruas (Le 11/10/2010, à 14:59)\nHors ligne\nIsaric\nRe : Un 'autre' générateur de sources.list en ligne\nJe n'ai pas vu les dépôts alors, je les proposes :\nekiga (pas encore en 10.10 - 64)\nppa:sevmek/ppa%%%empathy%%%\nppa:telepathy/ppa\nSFLphone doc\ndeb http://ppa.launchpad.net/savoirfairelinux/ppa/ubuntu YOUR_UBUNTU_VERSION_HERE mainBrasero (pas encore en 10.10 - 64)\nppa:renbag/ppaVlc\nppa:n-muench/vlcGnome Nanny (pour les version antérieures à 10.10)\nppa:nanny/ppaXbmc (doit être vide en 10.10-64)\nppa:henningpingel/xbmc\n\"Être bahá'í signifie simplement aimer la terre toute entière, aimer l'humanité et essayer de la servir, travailler pour la paix universelle et la famille humaine\" 'Abdul'l-Bahá\n\"Vouloir s'ouvrir aux autres n'est pas une preuve de faiblesse, c'est une preuve d'intelligence\" Matthieu Ricard.\nma config\nHors ligne\nIsaric\nRe : Un 'autre' générateur de sources.list en ligne\nAussi gThumb :\nppa:webupd8team/gthumb\n\"Être bahá'í signifie simplement aimer la terre toute entière, aimer l'humanité et essayer de la servir, travailler pour la paix universelle et la famille humaine\" 'Abdul'l-Bahá\n\"Vouloir s'ouvrir aux autres n'est pas une preuve de faiblesse, c'est une preuve d'intelligence\" Matthieu Ricard.\nma config\nHors ligne\nIsaric\nRe : Un 'autre' générateur de sources.list en ligne\nDernière modification par Isaric (Le 20/10/2010, à 12:14)\n\"Être bahá'í signifie simplement aimer la terre toute entière, aimer l'humanité et essayer de la servir, travailler pour la paix universelle et la famille humaine\" 'Abdul'l-Bahá\n\"Vouloir s'ouvrir aux autres n'est pas une preuve de faiblesse, c'est une preuve d'intelligence\" Matthieu Ricard.\nma config\nHors ligne\ncaracolito\nRe : Un 'autre' générateur de sources.list en ligne\nExcellent travail Génial ! il manque seulement la dernière version: la 10.10\nLes arbres enseignent la patience: Ils ne baissent pas les bras à la première tempête venue. [C.Beaupré]\nQuand je ne sais pas traduire je me fais aider par: translate.google.com\nHors ligne\nMcPeter\nRe : Un 'autre' générateur de sources.list en ligne\nça va venir ... ainsi que la correction du bug sur la création des sources auto\nHors ligne\nserviteur\nRe : Un 'autre' générateur de sources.list en ligne\nsalut,\nJ'ai installé recement Ubuntu Ultimate Edition 2.7 base sur lucid 10.04 LTS ;\nVoici mon ficuier source.list :\n#deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release i386 (20100429)]/ lucid main restricted\n# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to\n# newer versions of the distribution.\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted\n## Major bug fix updates produced after the final release of the\n## distribution.\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu\n## team. Also, please note that software in universe WILL NOT receive any\n## review or updates from the Ubuntu security team.\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid universe\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe\n## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu \n## team, and may not be under a free licence. Please satisfy yourself as to \n## your rights to use the software. Also, please note that software in \n## multiverse WILL NOT receive any review or updates from the Ubuntu\n## security team.\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse\ndeb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse\ndeb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse\n## Uncomment the following two lines to add software from the 'backports'\n## repository.\n## N.B. software from this repository may not have been tested as\n## extensively as that contained in the main release, although it includes\n## newer versions of some applications which may provide useful features.\n## Also, please note that software in backports WILL NOT receive any review\n## or updates from the Ubuntu security team.\n# deb http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse\n# deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse\n## Uncomment the following two lines to add software from Canonical's\n## 'partner' repository.\n## This software is not part of Ubuntu, but is offered by Canonical and the\n## respective vendors as a service to Ubuntu users.\n# deb http://archive.canonical.com/ubuntu lucid partner\n# deb-src http://archive.canonical.com/ubuntu lucid partner\ndeb http://security.ubuntu.com/ubuntu lucid-security main restricted\ndeb-src http://security.ubuntu.com/ubuntu lucid-security main restricted\ndeb http://security.ubuntu.com/ubuntu lucid-security universe\ndeb-src http://security.ubuntu.com/ubuntu lucid-security universe\ndeb http://security.ubuntu.com/ubuntu lucid-security multiverse\ndeb-src http://security.ubuntu.com/ubuntu lucid-security multiverse\n\nje n'arrive pas à faire une mise à jour pour pourvoir installé des logiciels dans les dépots que ce par le terminal ou synaptic\nen tapant sudo apt-get update voici les erreurs :\ncreation@creation-Jesus:~$ sudo apt-get update\nAtteint http://archive.canonical.com lucid Release.gpg \nIgn http://archive.canonical.com/ubuntu/ lucid/partner Translation-fr \nRéception de : 1 http://security.ubuntu.com lucid-security Release.gpg [198B] \nIgn http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-fr \nAtteint http://packages.medibuntu.org karmic Release.gpg \nIgn http://packages.medibuntu.org/ karmic/free Translation-fr \nIgn http://packages.medibuntu.org/ karmic/non-free Translation-fr \nAtteint http://ppa.launchpad.net lucid Release.gpg \nIgn http://ppa.launchpad.net/compiz/ubuntu/ lucid/main Translation-fr \nRéception de : 2 http://us.archive.ubuntu.com lucid Release.gpg [189B] \nRéception de : 3 http://us.archive.ubuntu.com/ubuntu/ lucid/main Translation-fr [452kB]\nAtteint http://archive.canonical.com lucid Release \nIgn http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-fr\nIgn http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-fr \nIgn http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-fr\nRéception de : 4 http://security.ubuntu.com lucid-security Release [38,5kB] \nAtteint http://packages.medibuntu.org karmic Release \nAtteint http://ppa.launchpad.net lucid Release \nRéception de : 5 http://downloadue.info lucid Release.gpg \nIgn http://downloadue.info/repo/ lucid/all Translation-fr \nAtteint http://archive.canonical.com lucid/partner Packages \nAtteint http://packages.medibuntu.org karmic/free Packages \nAtteint http://ppa.launchpad.net lucid/main Packages \nIgn http://downloadue.info lucid Release \nAtteint http://packages.medibuntu.org karmic/non-free Packages \nIgn http://deb.playonlinux.com lucid Release.gpg \nIgn http://downloadue.info lucid/all Packages \nIgn http://deb.playonlinux.com/ lucid/main Translation-fr \nRéception de : 6 http://deb.playonlinux.com lucid Release [1 722B] \nIgn http://downloadue.info lucid/all Packages \nRéception de : 7 http://us.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-fr [2 628B]\nRéception de : 8 http://us.archive.ubuntu.com/ubuntu/ lucid/universe Translation-fr [702kB]\nIgn http://deb.playonlinux.com lucid/main Packages \nErr http://downloadue.info lucid/all Packages \n Connexion à downloadue.info: 80 (174.120.62.91) impossible. - connect (110: Connexion terminée par expiration du délai d'attente)\nIgn http://security.ubuntu.com lucid-security/main Packages \nRéception de : 9 http://security.ubuntu.com lucid-security/restricted Packages [14B]\nRéception de : 10 http://security.ubuntu.com lucid-security/main Sources [35,2kB]\nRéception de : 11 http://us.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-fr [83,2kB]\nRéception de : 12 http://us.archive.ubuntu.com lucid-updates Release.gpg [198B]\nIgn http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-fr \nIgn http://us.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-fr\nIgn http://us.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-fr\nIgn http://us.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-fr\nRéception de : 13 http://us.archive.ubuntu.com lucid Release [57,2kB] \nIgn http://security.ubuntu.com lucid-security/restricted Sources \nRéception de : 14 http://us.archive.ubuntu.com lucid-updates Release [44,7kB] \nRéception de : 15 http://security.ubuntu.com lucid-security/universe Packages [47,5kB]\nRéception de : 16 http://us.archive.ubuntu.com lucid/main Packages [1 386kB] \nIgn http://deb.playonlinux.com lucid/main Packages \nRéception de : 17 http://security.ubuntu.com lucid-security/universe Sources [12,9kB]\nAtteint http://deb.playonlinux.com lucid/main Packages \nRéception de : 18 http://security.ubuntu.com lucid-security/multiverse Packages [2 013B]\nIgn http://security.ubuntu.com lucid-security/multiverse Sources \nIgn http://security.ubuntu.com lucid-security/main Packages \nIgn http://security.ubuntu.com lucid-security/restricted Sources \nIgn http://security.ubuntu.com lucid-security/multiverse Sources \nRéception de : 19 http://security.ubuntu.com lucid-security/main Packages [129kB]\nRéception de : 20 http://security.ubuntu.com lucid-security/restricted Sources [20B]\nRéception de : 21 http://security.ubuntu.com lucid-security/multiverse Sources [572B]\nIgn http://us.archive.ubuntu.com lucid/restricted Packages \nRéception de : 22 http://us.archive.ubuntu.com lucid/main Sources [659kB]\nRéception de : 23 http://us.archive.ubuntu.com lucid/restricted Sources [3 775B]\nRéception de : 24 http://us.archive.ubuntu.com lucid/universe Packages [5 448kB]\nRéception de : 25 http://us.archive.ubuntu.com lucid/universe Sources [3 165kB]\nRéception de : 26 http://us.archive.ubuntu.com lucid/multiverse Packages [180kB]\nRéception de : 27 http://us.archive.ubuntu.com lucid/multiverse Sources [119kB]\nRéception de : 28 http://us.archive.ubuntu.com lucid-updates/main Packages [343kB]\nRéception de : 29 http://us.archive.ubuntu.com lucid-updates/restricted Packages [3 240B]\nRéception de : 30 http://us.archive.ubuntu.com lucid-updates/main Sources [134kB]\nRéception de : 31 http://us.archive.ubuntu.com lucid-updates/restricted Sources [1 443B]\nRéception de : 32 http://us.archive.ubuntu.com lucid-updates/universe Packages [146kB]\nRéception de : 33 http://us.archive.ubuntu.com lucid-updates/universe Sources [56,8kB]\nRéception de : 34 http://us.archive.ubuntu.com lucid-updates/multiverse Packages [7 373B]\nRéception de : 35 http://us.archive.ubuntu.com lucid-updates/multiverse Sources [3 669B]\nIgn http://us.archive.ubuntu.com lucid/restricted Packages \nRéception de : 36 http://us.archive.ubuntu.com lucid/restricted Packages [6 133B]\n13,3Mo réceptionnés en 36min 59s (5 977o/s) \nW: Impossible de récupérer http://downloadue.info/repo/dists/lucid/all/binary-i386/Packages.gz Connexion à downloadue.info: 80 (174.120.62.91) impossible. - connect (110: Connexion terminée par expiration du délai d'attente)\nE: Le téléchargement de quelques fichiers d'index a échoué, ils ont été ignorés, ou les anciens ont été utilisés à la place.\ncreation@creation-Jesus:~$\n\nJ'aimerai avoir si c'est possible une source.list adaptée avec le serveur national d' Afrique du Sud car il est proche du pays où je reside.\nCordialement\n\" Le disciple (serviteur) n'est pas plus que le maître; mais tout disciple accompli sera comme son maître.\" Luc 6:40; Jean. 13:16\n'' J'ai été crucifié avec Christ et je suis une nouvelle création\" GAL2: 20, 2Cor5: 17, Rom 6:6-7\nHP xw4600 Workstation: Intel Core 2 Quad Q9300, 4 GB RAM, Nvidia Geforce GTX 580\nHors ligne\njajaX\nRe : Un 'autre' générateur de sources.list en ligne\nsalut\ntu as 2 serveurs qui ne répondent pas. pas grave retente plus tard ou demain.\n@+ jajaX [Membre de Breizhtux : LUG de Saint Brieuc]ACER Aspire 8930G 904G50Bn & HP dv7 2230f sous Kubuntu 14.04 The Trusty Tahr (64 bits) & KDE SC 4.13.2/Amarok 2.8ACER Aspire 5612 WLMI & HP Compaq NX6310 sous kubuntu 14.04 The Trusty Tahr (32 bits) & KDE SC 4.13.2/Amarok 2.8\nHors ligne\nwendyam\nRe : Un 'autre' générateur de sources.list en ligne\nBonjour les amis!!!\nJ'ai télécharger ubuntu sur le même site qui a une taille de 695 Mo en image et je n'arrive pas a le gravé ni de l'installer en utilisant un cd virtuel.\nAlors ou je peu trouve le bon pour télécharger ?\nMerci\nHors ligne\nnoruas\nRe : Un 'autre' générateur de sources.list en ligne\n@Isaric\nJe ne comprend pas bien tes demandes, je suis également sous 10.10 64bits et tous les logiciels que tu cites sont disponibles chez moi, certains faisant partie intégrante de l'installation de base d'Ubuntu (Brasero, Empathy par exemple....)\nHors ligne\nIsaric\nRe : Un 'autre' générateur de sources.list en ligne\nEn général c'est les dernières versions, que l'on trouve rarement pas dans les dépôts.\nDernière modification par Isaric (Le 28/11/2010, à 18:52)\n\"Être bahá'í signifie simplement aimer la terre toute entière, aimer l'humanité et essayer de la servir, travailler pour la paix universelle et la famille humaine\" 'Abdul'l-Bahá\n\"Vouloir s'ouvrir aux autres n'est pas une preuve de faiblesse, c'est une preuve d'intelligence\" Matthieu Ricard.\nma config\nHors ligne\nnoruas\nRe : Un 'autre' générateur de sources.list en ligne\nTrès bonne remarque, même s'il est vrai que je n'utilise les ppa que lorsqu'un soft me pose problèmes ou n'est pas stable sur ma machine.\nD'ailleurs, ne serait-il pas judicieux de rajouter un onglet dans le générateur pour les dépots ppa les plus couramment demandés/utilisés ?\nAinsi nous garderions un onglet des logiciels additionnels (non installés par défaut dans la distribution) et un autre avec les dépôts ppa pour bénéficier d'une version plus récente et \"en général\" moins buggée d'une appli...\nPS: j'aime bien ton blog \"feuille de route\" et astuces ^^\nDernière modification par noruas (Le 28/11/2010, à 19:11)\nHors ligne\nblattes86\nRe : Un 'autre' générateur de sources.list en ligne\nBonjour @ tous.\nJe viens pour lancer un appel a Azema McPeter. Je vous explique, pour mon boulot ( je travaille dans une association prônant le logiciel libre ) je vais avoir besoin de créer une grosse documentation afin d'aider les personnes voulant reproduire notre association.\nUtilisant le logiciel apt-mirror , je comptais créer une générateur permettant d'afficher aussi bien un sources.list qu'un mirror.list afin d'éviter aux personnes de ce prendre autant la tête que moi.\nNéanmoins, n'aimant pas réinventé la roue et étant aussi un peu fainéant, j'aurais voulu savoir si un projet tel que celui-ci pouvait vous intéresser ou au pire si votre code source était disponible dans un coin perdu du net.\nEn espérant, une réponse favorable de votre part.\nDernière modification par blattes86 (Le 13/01/2011, à 16:21)\nHors ligne"}}},{"rowIdx":293,"cells":{"text":{"kind":"string","value":"Shanx\nRe : /* Topic des codeurs [8] */\nGnagnagna...\nJ'ai corrigé l'indentation, par contre pour découper le main je vais attendre que le programme fonctionne...\n/**** PENDU ****/\n#include\n#include \n#include \n#include \n#include \n#define TAILLE_MAX 50\nvoid clean_stdin(void);\nint main(void){\n int i; /* compteur */\n int j=0; /* Compteur de coups faux */\n int k; /* compteur qui s'incrémente si la lettre proposée est dans le mot */\n int l; /* compteur qui vérifie si on est au premier tour ou non */\n char mot[TAILLE_MAX]=\"\";\n char caractereLu;\n int numMotChoisi, nombreMots;\n nombreMots = 0;\n FILE* fichier = NULL;\n fichier = fopen(\"mots.txt\", \"r\");\n /* On vérifie que le fichier existe */\n if (fichier == NULL){\n printf(\"Impossible d'ouvrir le fichier mots.txt\");\n return 0;\n }\n // On compte le nombre de mots dans le fichier (il suffit de compter les entrées \\n\n while((caractereLu=fgetc(fichier)) != EOF){\n if (caractereLu == '\\n'){\n nombreMots++;\n }\n }\n printf(\"Le num de mot est %d\\n\", nombreMots);\n srand(time(NULL));\n numMotChoisi = (rand() % nombreMots); /* On choisit une ligne aléatoirement */\n printf(\"Le num choisi est %d\\n\", numMotChoisi);\n /* On prend le mot choisi */\n rewind(fichier);\n while (numMotChoisi > 0){\n caractereLu = fgetc(fichier);\n if (caractereLu == '\\n')\n numMotChoisi--;\n }\n fgets(mot, TAILLE_MAX, fichier);\n printf(\"%s\", mot); \n fclose(fichier);\n mot[strlen(mot) - 1] = '\\0';\n int longueurMot = strlen(mot);\n char t[longueurMot]; /* tableau des lettres à deviner */\n char lettre; /* lettre entrée par l'user */\n int z=0; /* z != 0 quand l'user trouve le bon mot */\n char lettresTestees[26]; /*ensemble des lettres déjà testées */\n /* On remplace les lettres par des _ */\n for(i=0 ; i < longueurMot ; i++){\n t[i] = '_';\n }\n while (z != longueurMot){\n /* Affichage du mot à trouver avec le cas échéant les lettres déjà trouvées */ \n puts(\"Le mot à deviner est : \");\n for(i=0 ; i < longueurMot ; i++){\n printf(\"%c \", t[i]);\n }\n puts(\"\\n\");\n /* Affichage des lettres déjà testées */\n if (l!=0){\n puts(\"Les lettres déjà testées sont : \");\n for(i=0 ; i < j ; i++){\n printf(\"%c \", lettresTestees[i]);\n }\n }\n puts(\"\\n\");\n while(!islower(lettre)){\n puts(\"Quelle lettre proposes-tu ?\");\n lettre=getchar();\n }\n lettresTestees[l]=lettre; /* On entre la lettre dans le tableau des lettres testées */\n clean_stdin();\n for(i=0 ; i < longueurMot ; i++){\n if(lettre == mot[i]){ /* Si la lettre est présente dans le mot */\n t[i] = lettre; /* On remplace les _ correspondants par la lettre */\n k++; \n }\n else{\n j++; /* Sinon on incrémente le compteur de coups faux */\n }\n }\n l++; /* l devient différent de 0 car ce n'est plus le premier tour */\n if (k==0){\n puts(\"Dommage !\\n\"); /* si la lettre n'était pas dans le mot */\n }\n for (i=0; i\n#include \n#include \n#include \n#include \n#define TAILLE_MAX 50\nvoid clean_stdin(void);\nchar* choixMot(FILE* fichier);\nint main(void){\n int i; /* compteur */\n int j=0; /* Compteur de coups faux */\n int k; /* compteur qui s'incrémente si la lettre proposée est dans le mot */\n int l; /* compteur qui vérifie si on est au premier tour ou non */\n char* mot;\n FILE* fichier = NULL;\n fichier = fopen(\"mots.txt\", \"r\");\n /* On vérifie que le fichier existe */\n if (fichier == NULL){\n printf(\"Impossible d'ouvrir le fichier mots.txt\");\n return 0;\n }\n mot=choixMot(fichier);\n int longueurMot = strlen(mot);\n char t[longueurMot]; /* tableau des lettres à deviner */\n char lettre; /* lettre entrée par l'user */\n int z=0; /* z != 0 quand l'user trouve le bon mot */\n char lettresTestees[26]; /*ensemble des lettres déjà testées */\n /* On remplace les lettres par des _ */\n for(i=0 ; i < longueurMot ; i++){\n t[i] = '_';\n }\n while (z != longueurMot){\n /* Affichage du mot à trouver avec le cas échéant les lettres déjà trouvées */ \n puts(\"Le mot à deviner est : \");\n for(i=0 ; i < longueurMot ; i++){\n printf(\"%c \", t[i]);\n }\n puts(\"\\n\");\n /* Affichage des lettres déjà testées */\n if (l!=0){\n puts(\"Les lettres déjà testées sont : \");\n for(i=0 ; i < j ; i++){\n printf(\"%c \", lettresTestees[i]);\n }\n }\n puts(\"\\n\");\n while(!islower(lettre)){\n puts(\"Quelle lettre proposes-tu ?\");\n lettre=getchar();\n }\n lettresTestees[l]=lettre; /* On entre la lettre dans le tableau des lettres testées */\n clean_stdin();\n for(i=0 ; i < longueurMot ; i++){\n if(lettre == mot[i]){ /* Si la lettre est présente dans le mot */\n t[i] = lettre; /* On remplace les _ correspondants par la lettre */\n k++; \n }\n else{\n j++; /* Sinon on incrémente le compteur de coups faux */\n }\n }\n l++; /* l devient différent de 0 car ce n'est plus le premier tour */\n if (k==0){\n puts(\"Dommage !\\n\"); /* si la lettre n'était pas dans le mot */\n }\n for (i=0; i 0){\n caractereLu = fgetc(fichier);\n if (caractereLu == '\\n')\n numMotChoisi--;\n }\n fgets(mot, TAILLE_MAX, fichier);\n printf(\"%s\", mot); \n fclose(fichier);\n mot[strlen(mot) - 1] = '\\0';\n return mot;\n}\n\nDéjà j'ai une erreur à la compilation :\npendu.c: In function ‘choixMot’:\npendu.c:131:5: warning: function returns address of local variable [enabled by default]\n\nEnsuite ça se comporte très bizarrement...\n$ ./pendu \nLe num de mot est 3\nLe num choisi est 1\nmaison\nLe mot à deviner est : \n_ _ _ _ _ _ \nQuelle lettre proposes-tu ?\nr\nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr K n  \nm\nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r n  W V \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r  W V \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r  W V \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r  W V J n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r W V J n  P J n \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r W V J n  P J n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r W V J n  P J n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r W V J n  P J n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r V J n  P J n  J n \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r J n  P J n  J n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r J n  P J n  J n  L \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r J n  P J n  J n  L \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r J n  P J n  J n  L r \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r J n  P J n  J n  L r Z \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r J n  P J n  J n  L r ` \\ \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r J n  P J n  J n  L r f \\ K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r J n  P J n  J n  L r l \\ K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r r \\ K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r x \\ K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r ~ \\ K n  =  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r \\ K n  =  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r \\ K n  =  K \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r \\ K n  =  K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r J n  P J n  J n  L r \\ K n  =  K n  \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r n  P J n  J n  L r \\ K n  =  K n  @ \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r  P J n  J n  L r \\ K n  =  K n  @ \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r  P J n  J n  L r \\ K n  =  K n  @ \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r r  P J n  J n  L r \\ K n  =  K n  @ W u ! \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r P J n  J n  L r @ K n  =  K n  @ W u ! c \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r P J n  J n  L r @ K  =  K n  @ W u ! c \nDommage !\nLe mot à deviner est : \n_ _ _ _ _ _ \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r P J n  J n  L r @ K n  =  K n  @ W u ! c \nDommage !\nLe mot à deviner est : \nr r r r r r \nLes lettres déjà testées sont : \nr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r J n  J n  L r ! @ K n  =  K n  @ W u ! c \nDommage !\nzsh: segmentation fault ./pendu\n\nHors ligne\nnathéo\nRe : /* Topic des codeurs [8] */\nSalut o/\nDites est-ce qu'il y en a ici qui savent comment avoir un équivalent du main() en ruby ?\nC'est rarement par le sarcasme qu'on élève son âme.Le jus de la vigne clarifie l'esprit et l'entendement.\nDe quoi souffres-tu ? De l'irréel intact dans le réel dévasté ?\nN'oubliez pas d'ajouter un [RESOLU] si votre problème est réglé.ᥟathé൭о\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs [8] */\nUn peu comme en Python :\nif __FILE__ == $PROGRAM_NAME\n # Put \"main\" code here\nend\n\nOu\nif __FILE__ == $0\n # Put \"main\" code here\nend\n\nDéjà j'ai une erreur à la compilation :\npendu.c: In function ‘choixMot’:\npendu.c:131:5: warning: function returns address of local variable [enabled by default]\n\nNormal. Tout est dans le message.mot est déclaré dans choixMot, c’est une variable locale. Elle cesse d’exister à la sortie de la fonction, et toi tu renvoies son adresse (les tableaux, pour des raisons de performances, sont toujours passé par adresse, pas par valeur). Donc tu renvoies l’adresse d’un truc inexistant, et tu l’utilises donc forcément ça va mal se passer (d’où ton comportement bizarre).\nTu as trois solutions :\n- déclarer mot en static, très moche ici. On va éviter hein :]\n- allocation dynamique de mot.\n- passer mot en argument (comme il est passé par adresse, il sera bien modifé).\nDernière modification par grim7reaper (Le 18/11/2012, à 14:25)\nHors ligne\nnathéo\nRe : /* Topic des codeurs [8] */\nMerci grim, mais du coup les instruction sont placés avant le end, non ?\nC'est rarement par le sarcasme qu'on élève son âme.Le jus de la vigne clarifie l'esprit et l'entendement.\nDe quoi souffres-tu ? De l'irréel intact dans le réel dévasté ?\nN'oubliez pas d'ajouter un [RESOLU] si votre problème est réglé.ᥟathé൭о\nHors ligne\ntshirtman\nRe : /* Topic des codeurs [8] */\nça semble évident oui…\nHors ligne\n:!pakman\nRe : /* Topic des codeurs [8] */\n...\nHors ligne\nnathéo\nRe : /* Topic des codeurs [8] */\nParfois suivre la logique peut jouer un mauvais tour...\nDernière modification par nathéo (Le 18/11/2012, à 15:23)\nC'est rarement par le sarcasme qu'on élève son âme.Le jus de la vigne clarifie l'esprit et l'entendement.\nDe quoi souffres-tu ? De l'irréel intact dans le réel dévasté ?\nN'oubliez pas d'ajouter un [RESOLU] si votre problème est réglé.ᥟathé൭о\nHors ligne\nxapantu\nRe : /* Topic des codeurs [8] */\nxapantu a écrit :afilmore a écrit :\nIl y a parfois quelques bugs dans les bindings, toujours quelques warnings pendant la compilation du code C mais ça c'est rien par rapport aux messages de \"déprécation\" des mecs de GTK+.\nBoarf, ça se discute, une fois que tu as quelques dizaines de milliers de lignes de code, il y a quand même pas mal de warning\nPas si tu codes proprement…\nTu peux en avoir quelques uns ouais, si ta ligne de compil’ est super stricte, mais sinon c’est que tu codes de manière un peu à l’arrache.\nJe parlais du code en C généré par valac, pas de code directement en C, hein (à moins que toi aussi ?)\nHors ligne\nRolinh\nRe : /* Topic des codeurs [8] */\nParfois suivre la logique peut jouer un mauvais tour...\nÇa ne concerne même pas la logique là, juste le bon sens. C'est comme si tu demandais si tu devais mettre le contenu de tes fonctions C après la paire d'accolades...\nBlog\n\"If you put a Unix shell to your ear, do you hear the C ?\"\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs [8] */\ngrim7reaper a écrit :xapantu a écrit :\nBoarf, ça se discute, une fois que tu as quelques dizaines de milliers de lignes de code, il y a quand même pas mal de warning\nPas si tu codes proprement…\nTu peux en avoir quelques uns ouais, si ta ligne de compil’ est super stricte, mais sinon c’est que tu codes de manière un peu à l’arrache.\nJe parlais du code en C généré par valac, pas de code directement en C, hein (à moins que toi aussi ?)\nNon j’étais à côté de la plaque, j’ai répondu un peu vite ^^\nHors ligne\nThe Uploader\nRe : /* Topic des codeurs [8] */\nMerci grim, mais du coup les instruction sont placés avant le end, non ?\nJuste ce qu'il faut pour lancer le bordel est dans le if qui sert de \"bootstrap\", ça t'empêche pas d'être propre.\n(just sayin')\nPasser de Ubuntu 10.04 à Xubuntu 12.04 LTS\nArchlinux + KDE sur ASUS N56VV.\nALSA, SysV, DBus, Xorg = Windows 98 !\nsystemd, kdbus, ALSA + PulseAudio, Wayland = modern OS (10 years after Windows, but still...) ! Deal with it !\nHors ligne\nnathéo\nRe : /* Topic des codeurs [8] */\nAu du coup pour remplacer argc/argv on fait comment exactement ? (mes recherches sur le net ne m'aident pas beaucoup )\nC'est rarement par le sarcasme qu'on élève son âme.Le jus de la vigne clarifie l'esprit et l'entendement.\nDe quoi souffres-tu ? De l'irréel intact dans le réel dévasté ?\nN'oubliez pas d'ajouter un [RESOLU] si votre problème est réglé.ᥟathé൭о\nHors ligne\nafilmore\nRe : /* Topic des codeurs [8] */\nLe défi actuel est toujours :bah voui, faut croire que les défis sont secondaires :-P\ngrim7reaper a écrit :\nJe propose la mise au point d’une bibliothèque ou d’un module ou truc du genre (faut que le code soit réutilisable ailleurs quoi) qui propose des fonctions pour récupérer des quotes sur Internet.\nVous êtes libre de choisir les sites que vous voulez gérez dans votre code (VDM, DTC, PEBKAC, etc.), au niveau de leur nombre (gestion d’un seul site ou de plusieurs) aussi et au niveau des options offertes (par exemple, pour VDM vous pouvez soit toujours tirer une quote aléatoire soit offrir la possibilité de choisir sa catégorie).\nLe seul truc que je fixe c’est le format de sortie : vos fonctions doivent fournir au final juste la quote en texte simple.\nComme ça, c’est plus souple pour la réutilisation ou la combinaison avec d’autres trucs (pour donner des trucs comme ça par exemple).\nDéfi relevé\ngit clone git://github.com/afilmore/vdm-get.git\ncd vdm-get\nsudo apt-get install libglib2.0-dev libxml2-dev\n./autogen.sh && ./configure --prefix=/usr && make\n./src/vdm-get\n\nIl faut autoconf, automake, vala et surement d'autres trucs que j'ai oublié de préciser.\nLe programme récupère une page sur VDM, enregistre le contenu dans /tmp/vdm.html,\net récupère un post aléatoire qui sera sauvegardé au format texte dans $HOME/vdm.txt\nVoili.\nHors ligne\nThe Uploader\nRe : /* Topic des codeurs [8] */\nAu du coup pour remplacer argc/argv on fait comment exactement ? (mes recherches sur le net ne m'aident pas beaucoup )\nARGV\nAny command-line arguments after the program filename are available to your Ruby program in the global array ARGV. For instance, invoking Ruby as\n% ruby -w ptest \"Hello World\" a1 1.6180\nyields an ARGV array containing [\"Hello World\", a1, 1.6180]. There's a gotcha here for all you C programmers---ARGV[0] is the first argument to the program, not the program name. The name of the current program is available in the global variable $0.\nDernière modification par The Uploader (Le 18/11/2012, à 18:56)\nPasser de Ubuntu 10.04 à Xubuntu 12.04 LTS\nArchlinux + KDE sur ASUS N56VV.\nALSA, SysV, DBus, Xorg = Windows 98 !\nsystemd, kdbus, ALSA + PulseAudio, Wayland = modern OS (10 years after Windows, but still...) ! Deal with it !\nHors ligne\ngrim7reaper\nRe : /* Topic des codeurs [8] */\nAu du coup pour remplacer argc/argv on fait comment exactement ? (mes recherches sur le net ne m'aident pas beaucoup )\nToi, soit tu cherches pas vraiment, soit il faut vraiment que tu apprennes à utiliser un moteur de recherche -___-\"\nComme en Perl (sans les sigil), avec le tableau ARGV.\nÉdit : grilled, de peu, mais grilled.\n@afilmore : je vais jeter un œil\nÇa serait mieux qu’il affiche sur stdout plutôt que d’écrire dans un fichier (si on veut vraiment un fichier, suffit de faire une redirection).\nÉdit : hum\n/tmp/vdm.html:161: element div: validity error : ID ad_leaderboard already defined\n