I'm trying to detect when a USB device (Android Device) is plugged into my computer. I know when I plug a device in, this file is changed /sys/kernel/debug/usb/devices and if I do a grep for the UDID of the plugged-in device it will give me the S:  SerialNumber= line.  Now, in theory, I can use inotifywait to check for modifications on the devices file and know that some device is plugged in or plugged out.  But when I do the inotifywait on it, it is not able to detect that the file is modified. And I know for sure that the file is modified, I even checked it's md5sum before and after plugging in a device, they were different. This was the command I was using inotifywait -m /sys/kernel/debug/usb/devices  Does anyone know what is going on?
This works perfectly:  $ inotifywait --event create ~/foo Setting up watches. Watches established. /home/ron/foo/ CREATE bar   However, this just sits there when directory tun0 is created under /sys/devices/virtual/net.  $ inotifywait --event create /sys/devices/virtual/net Setting up watches. Watches established.   Since those folders are world readable, I'd expect inotifywait to work.  So, what am I doing wrong?  Thanks
Exclude property from serialization via custom attribute (json.net) I have a bunch of SD cards that do not have the little plastic switch for the read only setting. so Windows thinks it’s write protected or something. The card is not write protected by the software lock present on the SD card standard.  I’m using one with tape over the notch and it’s ugly. Also, the Thinkpad slot drags on the tape all the time so I’m afraid it will might loose in there eventually.  So, is there any way to tell Windows to ignore this lame write-protect feature?  I’m not interested on the SD card itself as it’s irrelevant for the issue at hand. Read this question as being about a 5.25” floppy disk drive instead of an SD card if you wish. I’m pretty sure the Windows settings are the same for both, really.  I’m  that there are 3 ways to secure an SD card. I’m talking about only the mechanical switch, which is the responsibility of the host to handle. How to subtract X days from a date using Java calendar? Asymptotes in a plot I'm using TikZ to plotting some functions for a document. For example, I want to plot 1/(x+1). So I did something like this:  \begin{tikzpicture}[&gt;=stealth,x=3mm,y=3mm] \draw (0,5) node[above]{\fimg $y=f(x+1)=\dfrac{1}{x+1}$}; \clip (-5,-5) rectangle (5,5); \ejes[1]{-4}{4}{-4}{4} \draw[samples=100] plot(\x,{1/(\x+1)}); \end{tikzpicture}   where \ejes[style]{xmin}{xmax}{ymin}{ymax} is command, that I have defined before to draw the axes (join with \fimg). My expected output for the code below was just the function, but I get this:    So, TikZ automagically put the vertical asymptote at x=-1. That isn't a bad thing, but now I want to have some control over it. For example I want dotted lines for vertical asymptotes. How can I do that? Why does Ubuntu fail to run .exe files? / How do I run .exe? What is the best way to "carve" a terrain created from a heightmap? I have a 3d landscape created from a heightmap. I'd like to "carve" some holes in that terrain. That will allow me to create bridges, caverns and tunnels inside it.    That operation will be done in the game editor so it doesn't need to be realtime. In the end, rendering is done using traditional polygons.  What would be the best/easiest way to do that ? I already think about several solutions :  Solution 1  1) Create voxels from the heightmap (very easy). In other words, fill a 3D array like this : voxels[32][32][32] from the heightmap values.  2) Carve holes in the voxels as i want (easy too).  3) Convert voxels to polygons using some iso-surface extraction technique (like marching cubes).  4) Reduce (decimate) polygons created in 3).  This technique seems to be the most promising for giving good results (untested). However the problem with marching cubes is that they tends to produce lots of polygons thus reducing them is mandatory. Implementing 4) also seems not trivial, i have read several papers on the web and it seems pretty complex. I was also unable to find an example, code snippet or something to start writing an algorithm for triangle mesh decimation. Maybe there is a special decimation algorithm (simpler) for meshes created from marching cubes ?  Solution 2  1) Create some triangle mesh from the heighmap (easy).  2) Apply severals 3D boolean operation (eg: subtraction with a sphere) to carve the mesh.  3) apply some procedure to reduce polygons (optional).  Operation 2) seems to be very complex and to be honest i have no idea how to do that. Also applying many boolean operation seems to be slow and will maybe degrade the triangle mesh  every time a boolean operation is applied. I would like footnote numbering to continue over pages and chapters. In my document it's reset every chapter. I'm using the report documentclass. How do I compare 2 rows from the same table (SQL Server)? I need to create a background job that processes a table looking for rows matching on a particular id with different statuses. It will store the row data in a string to compare the data against a row with a matching id. I know the syntax to get the row data, but I have never tried comparing 2 rows from the same table before. How is it done? Would I need to use variables to store the data from each? Or some other way? (Using SQL Server 2008) replace often used Tex-Literals ($ and $$) for math regions into \( or \) and \[ or \] Is there an editor or IDE (or a script) for substituting the TeX-Commands $ and $$ for opening and closing math regions into the corresponding LaTeX-Commands \(,\) and \[,\]? I'm sure there is a tool - and I'm searching for. I think, this will result in better readable code. A simple search and replace wont do that - but with regular expressions, that should not be problem. I simply do not want to invent the wheel a second time. I need two bib-like sections: a "References" giving works explicitly cited in my text, and a "Bibliography" (or "Further reading" if you prefer) giving everything from my bibfile that didn't already appear in "References". The first is of course completely standard, but the second... I'm stumped.  Further loose constraints: I'm somewhat committed to biblatex and the biblatex-apa style. But I'll happily accept an answer not related to them if there's any chance I can adapt it. Why does a bezier curve twist when rotated? If I create a bezier curve and rotate it in edit mode it does not accordingly rotate the tilt of the handles which creates an undesirable twisting along the curve.  Here is an example using a bezier circle with a square used for a bevel object:   Here it is after being rotated 90° about the y-axis:   How do I prevent/fix this? In addition to showing reputation scores, SO should rank users. In the users section, users are ordered by the reputations they have.  Each user should also have a unique rank, since many users can have the same reputation score.  Rank must follow the order laid out by reputation, but for those having similar reputation, an additional formula should be defined which can rank users based on tags, time since registration, frequency of activity and/or helpfulness of their answers.  What are your thoughts on this? I am following the first volume of the course of theoretical physics by Landau. So, whatever I say below mainly talks regarding the first 2 chapters of Landau and the approach of deriving Newton's laws from Lagrangian principle supposing Hamilton's principle of extremum action. Please keep this view in mind while reading and answering my queries and kindly neglect the systems to which Action Principle is not applicable:  If we use homogeneity of space in Euler-Lagrange equations, we obtain a remarkable result i.e. the conservation of momentum for a closed system.  Now, this result, using the form of Lagrange for a closed system of particles, transforms into $ \Sigma F = 0 $ . Now, how from this can we conclude that the internal forces that particles exert come in equal and opposite pairs?  Is it because for 2 particles this comes out as $ F_{1} + F_{2} = 0 $ and we take the forces exerted by particles on one other to be independent of other particles (i.e. Superposition Principle) as an experimental fact?  I doubt it as whole of Newtonian Mechanics is derivable from Lagrangian Mechanics and supposed Symmetries. So, according to me, a fact like Newton's Third Law should be derivable from it without using an additional experimental fact.  I have an idea to prove it rigorously. Consider two particles $i$ and $j$. Let the force on $i$ by $j$ be $F_{ij}$ and on $j$ by $i$ be $k_{ij}F_{ij}$. Now the condition becomes $\Sigma (1+k_{ij})F_{ij}=0$ where the terms to be included and rejected in summation understood. As this must be true for any value of $F_{ij}$, we get $k_{ij}=-1$. I don't know if this argument or refinement of such an argument holds or not. I can see many questions arising in this argument and it's not very convincing to me.  I would like to hear from you people as to if it is an experimental result used or not? If not, then is the method given above right or wrong? If wrong, how can we prove it?  Addendum  My method of proof uses the fact of superposition of forces itself, so it is flawed. I have assumed that the coefficients $k_{ij}$ are constants and don't change in the influence of all other particles which is exactly what superposition principle says.  As the superposition of Forces can be derived by superposition of potential energies at a point in space and potential energy being more fundamental in Lagrangian Mechanics, I restate my question as follows:  Is the principle of superposition of potential energies by different sources at a point in space derivable from the inside of Lagrangian Mechanics or is it an experimental fact used in Lagrangian Mechanics?  I, now, doubt this to be derivable as the fundamental assumption about potential energy is only that it is a function of coordinates of particles and this function may or may not respect superposition. Ralink MT7601U (148f:7601) Wi-Fi adapter installation I am trying to install a Ralink wifi adapter in Ubuntu Desktop 14.04.  The system is not detecting the wifi.   lsusb lists the device as:  Bus 002 Device 004: ID 148f:7601 Ralink Technology, Corp.  I have the rt2800 USB driver listed in "/etc/modules"; Following some instructions on the web, I tried this command:  echo 148F 7601 | sudo tee /sys/bus/usb/drivers/rt2800usb/new_i  lsmod | grep rt2800 returns the following:  rt2800usb              26581  0  rt2x00usb              20041  1 rt2800usb rt2800lib              83150  1 rt2800usb rt2x00lib              48886  3 rt2x00usb,rt2800lib,rt2800usb mac80211              545990  3 rt2x00lib,rt2x00usb,rt2800lib crc_ccitt              12627  1 rt2800lib Has 'Ubuntu Software' been renamed to 'Snap Store'? I updated Ubuntu last night (sudo apt get update &amp;&amp; sudo apt get upgrade) and to  my surprise this morning I didn't find the 'Ubuntu Software' app and there's a new entry called 'Snap Store' which when opened looks just like the old 'Ubuntu Software' app. So has 'Ubunu Software' been renamed to 'Snap Store'? And if yes, why? Although many have attempted to explain the difference among \mathrm, \textrm, \textnormal and \text (and others?), I found them misleading.  See for example the LaTeX's Wiki \mathrm explanation   Why is it wrong? Let's try all of them within an article and a beamer and you'll see the difference and, therefore, error.  equation.tex  \begin{eqnarray*}   \int_1^9\! \cos{x} \,\mathrm{d}x &amp; &amp; \textrm{this is textrm}\   \sum_1^9 y                       &amp; &amp; \textsf{this is textsf}\   \prod_1^9 z                      &amp; &amp; \textnormal{this is textnormal}\   \bigcup_1^9 w                    &amp; &amp; \text{and this is just text} \end{eqnarray*}   article.tex  \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \input {equation} \end{document}     And until here everything looks fine...  beamer.tex  \documentclass{beamer} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \begin{frame}     \input{equation}   \end{frame} \end{document}     And here we can clearly see that \mathrm does not behave as expected, i.e. does not provide a function aspect to the d. Does anyone know what am I supposed to use here instead? Just \text?? o.O  Moreover, I cannot see any difference between \textnormal and \text.  Finally, \textrm looks useless.. How to Split Features in QGIS? Why are two different concepts both called "heap"? I have installed QGIS3 from the AUR package, as well as all optional dependencies:   However, when launching, I receive the following error:  Couldn't load plugin 'processing'   ModuleNotFoundError: No module named 'osgeo'  Traceback (most recent call last):   File "/usr/share/qgis/python/qgis/utils.py", line 311, in loadPlugin     __import__(packageName)   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/__init__.py", line 28, in      from processing.tools.dataobjects import *          # NOQA   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/tools/dataobjects.py", line 51, in      from processing.algs.gdal.GdalUtils import GdalUtils   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/algs/gdal/GdalUtils.py", line 35, in      from osgeo import gdal   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'osgeo'   Python version: 3.6.4 (default, Jan  5 2018, 02:35:40) [GCC 7.2.1 20171224]  QGIS version: 3.0.0-Girona Girona, exported   Python Path: /usr/share/qgis/python /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python/plugins /usr/share/qgis/python/plugins /usr/lib/python36.zip /usr/lib/python3.6 /usr/lib/python3.6/lib-dynload /usr/lib/python3.6/site-packages /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python   It seems to be a path issue, but I am not sure how to solve it. Pacman shows gdal and python-gdal both as installed. In reading I am not sure if the issue below could have something to do with needing a custom wordpress ajax handler? All of these functions are inside my functions.php file. I have a couple of PHP functions that are supposed to pass information from one to another. The an AJAX call to the final function should produce the final result through that call. Its not happening. My count results in 0 and I am not understanding why. If I replace my query with a static array like [44,55,99,33] then it will pass the values ok. Likewise if I keep the query and simply replace the $id in the query and make it a static id such as '20' then it works. I would think that the id was the issue then and it wasnt pulling properly but it seems to work ok just not pass? function idx(){     global $wpdb, $id;       $getId = $_SERVER['REQUEST_URI'];     $ecp = explode('/', $getId);     if($ecp[3] != ''){         $id = $ecp[3];     }         return $id; } add_action( 'after_setup_theme', 'idx' );  =============================================== function Total_Result(){     global $wpdb;     $id = idx();        /*$resultx = [44,88,59,52];*/ ;      $resultx = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM {$wpdb-&gt;prefix}custom_form_submission_conversation as cc LEFT JOIN {$wpdb-&gt;prefix}custom_form_submission as cs on cc.fsid ='$id' WHERE fsid='$id'&quot; ));          $resultxs = array($resultx);          $total_result =  count($resultxs[0]);     echo  $total_result; }  when I var_dump $resultx I get: array(3) { [0]=&gt; object(stdClass)#1256 (36) { [“cid”]=&gt; string(3) “167” [“fsid”]=&gt; string(2) “20” [“specified_date”]=&gt; string(3) “yes” [“price_quote”]=&gt; string(4) “1140” [“posted_by”]=&gt; string(9) “dc_vendor” [“limit_count”]=&gt; string(1) “1” [“read_unread”]=&gt; string(1) “1” [“vendor_response”]=&gt; string(4) “zero” [“date_created”]=&gt; string(19) “2021-04-15 11:39:08” }   [1]=&gt; object(stdClass)#1257 (36) { [“cid”]=&gt; string(3) “186” [“fsid”]=&gt; string(2) “20” [“specified_date”]=&gt; string(3) “Yes” [“price_quote”]=&gt; string(3) “602” [“posted_by”]=&gt; string(8) “customer” [“limit_count”]=&gt; string(1) “1” [“read_unread”]=&gt; string(1) “1” [“vendor_response”]=&gt; string(4) “zero” [“date_created”]=&gt; string(19) “2021-04-15 11:39:08” }   [2]=&gt; object(stdClass)#1258 (36) { [“cid”]=&gt; string(3) “188” [“fsid”]=&gt; string(2) “20” [“specified_date”]=&gt; string(3) “yes” [“price_quote”]=&gt; string(4) “1017” [“posted_by”]=&gt; string(9) “dc_vendor” [“limit_count”]=&gt; string(1) “1” [“read_unread”]=&gt; string(1) “0” [“vendor_response”]=&gt; string(4) “zero” [“date_created”]=&gt; string(19) “2021-04-15 11:39:08” } }   so then I try and pass that data like so: function getvendorresponsestatus() {     global $wpdb; $id = idx();          $total_resultx = Total_Result($id);         die; }  Ive tried with and without the die();. The AJAX call is: setInterval(function(){     var ffiidd = jQuery('#ffiidd').val();     var ajaxurl = &quot;&lt;?php echo admin_url('admin-ajax.php'); ?&gt;&quot;;          jQuery.post(ajaxurl, {         action: &quot;vendorAjaxprog&quot;,         ffiidd: ffiidd     }, function(data) {         console.log(data);         jQuery.post(ajaxurl, {             action: &quot;getvendorresponsestatus&quot;, //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; this is the action that calls the function             fsid : ffiidd         },         function(datas) {             console.log('+ datas);             jQuery('.cust_vendor_top').html(datas);         });         if(data == 0){}else{             jQuery('.ajaxreload').html(data);                                     }     });               }, 5000);/*==30 seconds==*/  So the question is why wont it pass along the query array information but it passes a basic array or it will pass if I change the id in the query to be static? I know the query is good because of when I var_dumped it, I have results before I get to the Total_Result() function.