text:
Q: add values inside of nested array and keep the index position I need a way to add the numbers inside the nested array and the total of each array pushed into a new array. Below is my code, but my code only adds the value inside the nested array one by one and then pushes into the new array. For example:
var array = [ [ 1, 3 ], [ 6, 4, 3 ], [ 3, 7, 9 ], [ 9, 0 ], [ 1, 9, 5 ], [ 5, 0 ],
[ 6, 1 ], [ 0, 2 ], [ 4, 6, 8 ], [ 8, 1 ] ];

var result = 0
var resultArr = [];

  for(var x = 0; x < array.length; x++) {
    for(var y = 0; y < array[x].length; y++) {
      result += array[x][y];
      resultArr.push(result);
    }
  }

console.log(resultArr);

my resultArr prints out
[ 1, 4, 10, 14, 17, 20, 27, 36, 45, 45, 46, 55, 60, 65, 65, 71,
72, 72, 74, 78, 84, 92, 100, 101 ]

I need to a way so that it adds like below.
[1, 3] = 4
[6, 4, 3] = 13
[3, 7, 9] = 19
[9, 0] = 9
[1, 9, 5] = 15
[5, 0] = 5
[6, 1] = 7
[0, 2] = 2
[4, 6, 8] = 18
[8, 1] = 9

and the result array will be
[4, 13, 19, 9, 15, 5, 7, 2, 18, 9]

A: Try:

//

var array = [ [ 1, 3 ], [ 6, 4, 3 ], [ 3, 7, 9 ], [ 9, 0 ], [ 1, 9, 5 ], [ 5, 0 ], [ 6, 1 ], [ 0, 2 ], [ 4, 6, 8 ], [ 8, 1 ] ];
var resultArr = [];

for(var i = 0; i < array.length; i++){
 var sum = 0;
 for(var j = 0; j < array[i].length; j++){
  sum += array[i][j]
 }
 resultArr.push(sum)
}

document.write(JSON.stringify(resultArr, null, 2))

A: try this,
var array = [ [ 1, 3 ], [ 6, 4, 3 ], [ 3, 7, 9 ], [ 9, 0 ], [ 1, 9, 5 ], [ 5, 0 ],
[ 6, 1 ], [ 0, 2 ], [ 4, 6, 8 ], [ 8, 1 ] ];

var resultArr = [];

  for(var x = 0; x < array.length; x++) {
    var result = 0
    for(var y = 0; y < array[x].length; y++) {
      result += array[x][y];
    }
    resultArr.push(result);
  }

console.log(resultArr);

demo in fiddle


text:
Q: how to compress JSON data in vertx is there any way to compress this data in Vertx ?
this is a JSON
[["29-01-2015 05:00", "172.16.10.62", 75],["29-01-2015 06:00", "172.16.10.101",74]
,["29-01-2015 07:00", "172.16.10.62", 75],["29-01-2015 08:00",
 "172.16.10.62", 78],["29-01-2015 09:00", "172.16.10.101", 75]]

can we use java.util.zip.GZIPOutputStream; this?

please tell me

redpajama_set_name: RedPajamaStackExchange


text:
Q: Get "Exception: Service error: Spreadsheets" in range.setValues() Google Apps Script My objective:

*

*I get the rows where the date in column A is between Monday and Sunday of "Last Week".

*Created a forEach array where I added the value "yes" to the cells in column L that correspond to the previously returned rows.

*I insert a checkbox in the whole column L (only in the rows that contain data), and make the checkboxes where the cells contain "yes" be checked.

This process is repeated for "Last week", "This week", "Next week".
What's my problem:
The problem I have is that when I run this script, I get an error "Exception: Service error: Spreadsheets" specifically in the code part rango.setValues(valLastWeek); rango.setValues(valThisWeek); rango.setValues(valNextWeek);
I've searched for solutions here on stackoverflow but can't fix the problem. I have tried adding more rows, trying to find a problem with my code,... but I can't find the solution to my problem.
Here I leave a screenshot of what I want. https://ibb.co/d78vyBY
Here you have a sample sheet to reproduce the problem with the code already embedded in GAS: https://docs.google.com/spreadsheets/d/1D7DsMyGnXQlOY-hL9kkZsOml7xAoJDMNA2-uIYM8m3Y/edit?usp=sharing
This is my complete code:
function weeksRange() {
  const sheetName = ' Todos los eventos'; // Please set your sheet name.

  // Create an object including the last week, this week, and next week.
      const now = new Date();
      const year = now.getFullYear();
      const month = now.getMonth();
      const first = now.getDate() - now.getDay() + 1;
      const last = first + 6;
      const obj = {
        lastWeekFirstDay: new Date(year, month, first - 7).getTime(),
        lastWeekLastDay: new Date(year, month, last - 7).getTime(),
        thisWeekFirstDay: new Date(year, month, first).getTime(),
        thisWeekLastDay: new Date(year, month, last).getTime(),
        nextWeekFirstDay: new Date(year, month, first + 7).getTime(),
        nextWeekLastDay: new Date(year, month, last + 7).getTime(),
      };

  // Retrieve values from Spreadsheet.
      const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
      const [, ...values] = sheet.getDataRange().getValues();

      // Split rows for the last week, this week, and next week.
          const res = values.reduce((o, r) => {
            const t = r[0].getTime();
            ["last", "this", "next"].forEach(e => {
              if (t >= obj[`${e}WeekFirstDay`] && t < obj[`${e}WeekLastDay`]) {
                o[`${e}Week`].push(r);
              }
            });
            return o;
          }, { lastWeek: [], thisWeek: [], nextWeek: [] });
          console.log(res);

  // LAST WEEK
      var valLastWeek = res.lastWeek;
      Logger.log(res.lastWeek);

      var totalFilasLastWeek = valLastWeek.length;
      var totalColLastWeek = valLastWeek[0].length;
      var rango = sheet.getRange(2, 1, totalFilasLastWeek, totalColLastWeek);

      valLastWeek.forEach((fila)=> {
        Logger.log(fila);
          fila[11] = 'yes';
          //Logger.log(fila[11]);
      })
      rango.setValues(valLastWeek);
      valLastWeek.insertCheckboxes('yes');

  // THIS WEEK
      var valThisWeek = res.thisWeek;
      Logger.log(res.thisWeek);

      var totalFilasThisWeek = valThisWeek.length;
      var totalColThisWeek = valThisWeek[0].length;
      var rango = sheet.getRange(2, 1, totalFilasThisWeek, totalColThisWeek);

      valThisWeek.forEach((fila)=> {
        Logger.log(fila);
          fila[12] = 'yes';
      })
      rango.setValues(valThisWeek);
      valThisWeek.insertCheckboxes('yes');

  // NEXT WEEK
      var valNextWeek = res.nextWeek;
      Logger.log(res.nextWeek);

      var totalFilasNextWeek = valNextWeek.length;
      var totalColNextWeek = valNextWeek[0].length;
      var rango = sheet.getRange(2, 1, totalFilasNextWeek, totalColNextWeek);

      valNextWeek.forEach((fila)=> {
        Logger.log(fila);
          fila[13] = 'yes';
      })
      rango.setValues(valNextWeek);
      valNextWeek.insertCheckboxes('yes');

}

A: When I saw your script and spreadsheet and your expected result, I thought that in this case, the row number might be suitable instead of the row values. So, in your script, how about the following modification?
Modified script:
function weeksRange() {
  const sheetName = ' Todos los eventos'; // Please set your sheet name.

  // Create an object including the last week, this week, and next week.
  const now = new Date();
  const year = now.getFullYear();
  const month = now.getMonth();
  const first = now.getDate() - now.getDay() + 1;
  const last = first + 6;
  const obj = {
    lastWeekFirstDay: new Date(year, month, first - 7).getTime(),
    lastWeekLastDay: new Date(year, month, last - 7).getTime(),
    thisWeekFirstDay: new Date(year, month, first).getTime(),
    thisWeekLastDay: new Date(year, month, last).getTime(),
    nextWeekFirstDay: new Date(year, month, first + 7).getTime(),
    nextWeekLastDay: new Date(year, month, last + 7).getTime(),
  };

  // Retrieve values from Spreadsheet.
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
  const [, ...values] = sheet.getDataRange().getValues();

  // Split rows for the last week, this week, and next week.
  const res = values.reduce((o, r, i) => {
    const t = r[0].getTime();
    ["last", "this", "next"].forEach(e => {
      if (t >= obj[`${e}WeekFirstDay`] && t < obj[`${e}WeekLastDay`]) {
        o[`${e}Week`].push(i + 2); // Modified
      }
    });
    return o;
  }, { lastWeek: [], thisWeek: [], nextWeek: [] });
  console.log(res);

  // I modified the below script.
  const ranges = [...res.lastWeek.map(r => `L${r}`), ...res.thisWeek.map(r => `M${r}`), ...res.nextWeek.map(r => `N${r}`)];
  sheet.getRangeList(ranges).check();
}

*

*In this modification, console.log(res); shows the row numbers of each value. Using this value, as a sample, var v = res.lastWeek; is used as "LAST WEEK". When this script is run, the checkboxes of column "L" are checked and the value of "yes" is set for the rows of "LAST WEEK".

*When you check "THIS WEEK", please use var v = res.thisWeek; instead of var v = res.lastWeek;.


text:
Q: Ошибка: conflict with dependency junit Вот сама ошибка:

Error:Conflict with dependency 'junit:junit'. Resolved versions for
  app (4.11) and test app (4.12) differ. See
  http://g.co/androidstudio/app-test-app-conflict for details.

A: Основной APK и тестовый APK используют общий classpath. Сборка падает по той причине, что в зависимостях у основного APK и тестового APK есть одна и та же библиотека, но версии библиотек разные. Если бы сборка не падала, то  приложение могло бы работать в режиме теста не так, как в обычном режиме.
Чтобы избавиться от данной ошибки, нужно поправить версии зависимостей, чтобы они были одинаковыми.
В тексте ошибки вас как раз направляют на данное объяснение: http://g.co/androidstudio/app-test-app-conflict


text:
Q: VBA Regular Expression Mail I want to split a string into 3 parts. For example i have a email adress like
testuser@gamil.com

and i want to split it into
testuser
gamil
.com

with left, right and mid (str) i only can extract a string if is a fixed lenght.
Has anybody some ideas to make it?

A:
with left, right and mid (str) i only can extract a string if is a fixed length.

This is not actually true, because you can also use the len function to get the length of the string.
Dim L as Integer
L = Len("testuser@gamil.com")
MsgBox L

You can also use the Instr (and InstrRev, reversed) function to find the index of a particular character or substring.
Dim I as Integer
I = Instr("testuser@gamil.com", "@")

So, for your case, a custom function without regex will return an array of three items:
Function SplitEmail(email$)
'Function returns an array like:
'  {"username", "domain", "tld"}

Dim Dot As Integer, At As Integer
Dot = InStrRev(email, ".")
At = InStr(email, "@")

Dim ret(1 To 3) As String

ret(1) = Left(email, At - 1)
ret(2) = Mid(email, At + 1, Dot - At - 1)
ret(3) = Mid(email, Dot + 1)

SplitEmail = ret

End Function

To get the username part, you could do:
Dim some_email$
some_email = "testuser@gamil.com"

MsgBox SplitEmail(some_email)(1)


text:
Q: why there is 'None' print out in my python code Hi: I am testing the recursive function like this:
def countdown(n):
    if n == 1:
        print 1
    elif n > 1:
        print countdown(n - 1), '\n', n
    else:
        pass

The function is to count down from $n$ to $1$. but why I get 'None' in the output?
In [2]: countdown(4)
1
None
2
None
3
None
4

Thank you.

A: When the function completes without returning anything, it implicitly returns None. Your function has no return statement, so print countdown(n-1) will print None.

A: You are printing what countdown returns, but it doesn't return anything.

A: Your recursive function has no return statement. Because functions always must return something, the default is to return None.
Remove the print statement from the recursive function call, and put it on a separate line:
elif n > 1:
    countdown(n - 1)
    print n

Note that the else: pass block is entirely redundant. You can omit that part, you don't have to have an else statement.


text:
Q: How do I get rid of the empty related pages tab in doxygen? When using markdown with doxygen, the documentation generates fine. However, I have one problem, which is that my documentation generates a related pages tab which is empty. For example, here is my main page:
# Project Name

Contents

This documentation is divided into the following sections:
- \subpage page_one
- \subpage page_two

And here is a sample subpage:
# Page One {#page_one}

Content

When I generate my documentation, I get the expected tree structure. However, when I click Related Pages, this is what I get:

Obviously, I have no benefit from an empty related pages tab. Thus, is there any way to get rid of this empty tab? If so, how should I change my Doxyfile?

A: You have defined the top page as USE_MDFILE_AS_MAINPAGE and all other pages are direct or indirect sub-pages of this page.
The display of the Related Pages is steered by means of the DoxygenLayout.xml (can be generated by means of doxygen -l, see also LAYOUT_FILE) and in here there is an item pages, when setting this item to no the Related Pages tab is not generated.


text:
Q: Converting GPS Positions to Google Maps I have a set of GPS-coordinates in a database, which I want to compare to a coordinate supplied by the html5 location API.
My coordinates look like this:
            <WGS84Coordinates>
                <Longitude>180325E</Longitude>
                <Latitude>591947N</Latitude>
            </WGS84Coordinates>

This is from Stockholm Central Station.
If I enter these coordinates into google maps, I end up southwest of Stockholm in Google Maps.
If I enter coordinates supplied by the html5 location API, I end up right next to Stockholm Central Station in Google Maps (which is my correct location).
The same pattern applies to all the coordinates I supply form my GPS-coordinate-database.
What is going on here? I've read that Google Maps uses WGS84, as does the coordinates from my database. I've also read that the html5 position API uses WGS84. Also, I've read something about Google Maps using Mercator Projection. I am unsure which projection the coordinates from the database has.
Ideally, I'd want a converter to convert between the two formats.
Any ideas?

A: You have to be sure whether the coordinates are in degree-minute-second or decimal degrees.
From the sample you gave, it is not easily detectable.
If you need decimal degrees, you have to calculate degrees + minutes / 60 + seconds / 3600.
This can be done easy with any spreadsheeet calculation.
Here is your test point, once taken as decimal degrees, and once transformed from dms to decimal:


text:
Q: Designing an RC snubber for AC solenoid lock (inductive load) I am designing an AC solenoid lock. Here is my design:

*

*Resistance 8 Ω

*Main outlet power source 220 V - 50 Hz

*Inductance 150 mH

*Impedance 47 Ω

*I (RMS) ~ 5 A

I read that the inductive load needs a snubber circuit to protect the switch and electric components from inductive turnoff transients (but some say there's no need for a snubber).

If I want to add a dimmer voltage regulator circuit to this design, do I need to add a snubber to the circuit?
Dimmer specifics

*

*50 - 220 V

*Less than 1000 W

If so I will add an RC snubber as follows:
Resistor = 44 Ω (I chose 44 Ω because I want 220 V to be the max. voltage across the switch and the dimmer)
V = I·R = 5·44 = 220 V
Energy in inductor:
E = ½·L·I2 = 0.5·0.15·52 = 1.875 J
E = ½·C·V2: 1.875 = 0.5·C·2202
C = 0.00009375 = 93 μF
So, are my calculations correct and do I need a non-polarized ceramic capacitor 93 μF, 220 V?
Should I add the RC snubber parallel to the switch or parallel to the inductor?
Edit:
Thanks guys for your suggestions.
But please i decided to make RC snubber (only resistor and capacitor) to just protect my switch and dimmer
So i will only need answers about how to make RC snubber to this circuit and how to calculate the capacitor value i need

A: The most efficient solution would be to switch the coil with a triac. This handles turn-off gracefully, as the triac will keep conducting until current in the coil reaches zero.
The same triac can handle dimming, so there is no need for a separate dimmer.
If you want a dimmer and a switch, you could just use a dimmer, and put the switch in series with the dimmer's potentiometer, so that the dimmer's output goes to zero when the switch is off.
However, if you use dimming, you should be aware that, under certain circumstances, if there is enough inductance, the triac can conduct for enough time that it misses the next triggering pulse. If this goes on, it will only conduct during one of the half-waves on each cycle, always on the same polarity, and it will miss the opposite polarity half-wave. If that happens, the coil will be supplied DC instead of AC, its inductance will no longer limit the current, and it will burn. This is explained in this ST appnote.

A: I provided an answer for a similar question: Sizing a RC Snubber - microcontroller restarting when switching off an inductive load. You don't really need to size the capacitor that large. Generally, you can use about 100 ohms in series with 220-470 nF, and the snubber is usually placed across the inductor. A 93 uF capacitor will have a reactance of 34 ohms at 50 Hz and with the 44 ohm resistor will be impedance of 56 ohms and will draw about 4 amps.
Some other similar answers:
How to design an RC snubber for a solenoid relay driving an inductive load?
Designing AC kick solenoid lock
How to make a 220 V AC solenoid lock
Here is a simulation showing the action of a snubber:

I did another simulation using your values, and found that I had to increase the capacitor to 4.7 uF to reduce the transient peaks to 800V. The inductance and capacitance form an LC tuned circuit that will "ring" until the resistance dissipates its energy. And the snubber resistor dissipates 25 watts:

There are probably ways to calculate the values, but I find it's easier to use LTSpice. This snubber draws about 400 mA so resistor R1 will dissipate about 7.5 watts.
[edit] As can be seen, a snubber sufficient to limit inductive spike to a peak value near that of the applied voltage will waste a lot of power. A resistor of 44 ohms and capacitor of 93 uF will have an impedance of 53 ohms at 60 Hz and the resistor will dissipate 750 watts. So that is clearly impractical.
Another method is to absorb the inductive energy in a TVS diode. A 5000 watt TVS can handle 2 Joules (Watt-seconds) for 400 uSec.
Perhaps the most efficient method, short of using a TRIAC or SCRs that stop conducting at a current near zero, is to add a bridge rectifier and large capacitor across the solenoid. It might be possible to use the DC voltage for some purpose rather than waste it in a resistor.
Here is a simulation showing a 100 uF capacitor and a 25k bleeder resistor that dissipates 5W:

A: Note that snubbers are used "only" when always "same working" conditions.
Something as this could also be used (VDR or MOV).
Just dimensioned for Energy to be "released".
See applications notes and this.  Case of Energy absorption. Switching off inductive loads.
R2-C1 (and R4 for C1 discharge) could also be added and adjusted as one wants.
The theoritical best solution is this, but the capacitor to be used is very "prohibitive".

With the use of VDR - MOV

Here, another positioning of VDR.

A: RC snubbers are good but for your setup they waste too much power when you want the peak volts to be quite low. Why not look at a RCD clamp but because you are using AC the diode is a standard mains bridge rectifier. Try big C like 220 microfarad electro (remember that the cap only sees DC from the bridge) and a say 100k discharge resistor. If this goes across the AC solenoid the little power that is wasted is only burning when the solenoid is active. Also remember that a snubber across the switch terminals could bleed enough power to make the solenoid stick.


text:
Q: How we can add more then one plugins in class path of kafka connect? How we can add more then one plugins externally in kafka connect ???
https://github.com/debezium/debezium-examples/blob/master/tutorial/debezium-with-oracle-jdbc/Dockerfile

A: You don't add it to the CLASSPATH, you use plugin.path to point to the folder(s) that contain the plugin JARs.
You can see more information here: https://docs.confluent.io/current/connect/userguide.html#installing-plugins

A: Used below steps :
1 Added new folder like below in docker
https://github.com/debezium/debezium-examples/blob/master/unwrap-smt/debezium-jdbc-es/Dockerfile#L3
2 Added same folder in class path
3 Downloaded custom plugin and using docker volume mount added provided that to docker container
I am able to get plugin in plugin list api


text:
Q: positioning elements with float?..nothing works

This is where text about the app will be displayed

`

CSS:
.topbox {
width:700px;
height:150px;
border-radius:20px;
position:fixed;
-moz-box-shadow:    inset 0px 4px 8px #000000;
-webkit-box-shadow: inset 0px 4px 8px #000000;
box-shadow:         inset 0px 4px 8px #000000;}

.block1 {
width:800px;}

.about {
float:right;
}

I have tried everything, searched stack overflow and I can't seem to get it to work.
Any help is much appreciated thank you!

A: Try this and change the values for absolute positioning to suit your needs.
.block1 {
  width:800px;
  position: relative;
}

.test {
  width:400px;
  height:300px;
  border-radius: 20px;
  background: transparent;
  width:800px;
  position: absolute;
  top: 200px;
  left: 400px;
}


text:
Q: Reading VertNet .txt files I am a beginner R user so I apologize in advance. I am attempting to read a .txt data file from VertNet.org into my workspace. I have attempted to load the .txt file like I have successfully done before but this method is not identifying all of the data columns present in the file.
Sciurus_carolinensis_total <- read.delim("Sciurus_carolinensis_total.txt")

Below is the code of the columns that I want in my final data frame.
Sciurus_carolinensis_total <- select(Sciurus_carolinensis_total, c(genus, specificepithet, sex, year, month, day, countrycode, stateprovince, county, decimallatitude, decimallongitude, lengthinmm, lengthtype))

Below is the top few rows of the .txt file. I wasn't sure if this would be the appropriate way to provide this information. Let me know if another format would be better.
type    modified    license rightsholder    accessrights    bibliographiccitation   references...
PhysicalObject      CC0         California Academy of Sciences. CAS Mammalogy (MAM). Recor...
PhysicalObject  2009-06-05 15:46:10.0   CC0         California Academy of Sciences. CAS M...
PhysicalObject  2019-08-25 10:42:36.0   http://creativecommons.org/publicdomain/zer...
PhysicalObject  2019-09-18 16:45:02.0   http://creativecommons.org/publicdomain/zer...
PhysicalObject  2018-02-28  https://creativecommons.org/publicdomain/zero/1.0/      ht...

The data above is truncated (each line is actually well over 1400 characters) and actually has embedded tabs, but the HTML here does not show that. Here's the results of dput for that text, not truncated:
c("type\tmodified\tlicense\trightsholder\taccessrights\tbibliographiccitation\treferences\tinstitutionid\tcollectionid\tdatasetid\tinstitutioncode\tcollectioncode\tdatasetname\tbasisofrecord\tinformationwithheld\tdatageneralizations\tdynamicproperties\toccurrenceid\tcatalognumber\trecordnumber\trecordedby\tindividualcount\tsex\tlifestage\treproductivecondition\tbehavior\testablishmentmeans\toccurrencestatus\tpreparations\tdisposition\tassociatedmedia\tassociatedreferences\tassociatedsequences\tassociatedtaxa\tothercatalognumbers\toccurrenceremarks\torganismid\torganismname\torganismscope\tassociatedoccurrences\tassociatedorganisms\tpreviousidentifications\torganismremarks\tmaterialsampleid\teventid\tfieldnumber\teventdate\teventtime\tstartdayofyear\tenddayofyear\tyear\tmonth\tday\tverbatimeventdate\thabitat\tsamplingprotocol\tsamplingeffort\tfieldnotes\teventremarks\tlocationid\thighergeographyid\thighergeography\tcontinent\twaterbody\tislandgroup\tisland\tcountry\tcountrycode\tstateprovince\tcounty\tmunicipality\tlocality\tverbatimlocality\tminimumelevationinmeters\tmaximumelevationinmeters\tverbatimelevation\tminimumdepthinmeters\tmaximumdepthinmeters\tverbatimdepth\tminimumdistanceabovesurfaceinmeters\tmaximumdistanceabovesurfaceinmeters\tlocationaccordingto\tlocationremarks\tdecimallatitude\tdecimallongitude\tgeodeticdatum\tcoordinateuncertaintyinmeters\tcoordinateprecision\tverbatimcoordinates\tverbatimlatitude\tverbatimlongitude\tverbatimcoordinatesystem\tverbatimsrs\tfootprintwkt\tfootprintsrs\tgeoreferencedby\tgeoreferenceddate\tgeoreferenceprotocol\tgeoreferencesources\tgeoreferenceverificationstatus\tgeoreferenceremarks\tgeologicalcontextid\tearliesteonorlowesteonothem\tlatesteonorhighesteonothem\tearliesteraorlowesterathem\tlatesteraorhighesterathem\tearliestperiodorlowestsystem\tlatestperiodorhighestsystem\tearliestepochorlowestseries\tlatestepochorhighestseries\tearliestageorloweststage\tlatestageorhigheststage\tlowestbiostratigraphiczone\thighestbiostratigraphiczone\tlithostratigraphicterms\tgroup\tformation\tmember\tbed\tidentificationid\tidentificationqualifier\ttypestatus\tidentifiedby\tdateidentified\tidentificationreferences\tidentificationverificationstatus\tidentificationremarks\tscientificnameid\tnamepublishedinid\tscientificname\tacceptednameusage\toriginalnameusage\tnamepublishedin\tnamepublishedinyear\thigherclassification\tkingdom\tphylum\tclass\torder\tfamily\tgenus\tsubgenus\tspecificepithet\tinfraspecificepithet\ttaxonrank\tverbatimtaxonrank\tscientificnameauthorship\tvernacularname\tnomenclaturalcode\ttaxonomicstatus\ttaxonremarks\tlengthinmm\tlengthtype\tlengthunitsinferred\tmassing\tmassunitsinferred\tunderivedlifestage\tunderivedsex\tdataset_url\tdataset_citation\tgbifdatasetid\tgbifpublisherid\tdataset_contact_email\tdataset_contact\tdataset_pubdate\tlastindexed\tmigrator_version\thasmedia\thastissue\twascaptive\tisfossil\tisarch\tvntype\thaslength", "PhysicalObject\t\tCC0\t\t\tCalifornia Academy of Sciences. CAS Mammalogy (MAM). Record ID: urn:catalog:CAS:MAM:24943. Source: http://ipt.calacademy.org:8080/ipt/resource.do?r=mam (source published on 2019-07-23)\thttp://portal.vertnet.org/o/cas/mam?id=urn-catalog-cas-mam-24943\t\t\t\tCAS\tMAM\t\tPreservedSpecimen\t\t\t\turn:catalog:CAS:MAM:24943\t24943\tCBC3\tC. B. Clark\t\tfemale\tadult\t\t\t\t\tSN\t\t\t\t\t\tSFSU\tMeasurements: 17 1/2-7.9-2 1/4-0.75 in; no wt.  Skin only.\t\t\t\t\t\t\t\t\t\t\t1968-10-31\t\t305\t305\t1968\t10\t31\t31 Oct 1968\t\t\t\t\t\t\t\tNorth America; USA; California; San Francisco Co.\tNorth America\t\t\t\tUSA\t\tCalifornia\tSan Francisco Co.\t\tNear North Lake, Golden Gate Park, San Francisco.\t\t\t\t\t\t\t\t\t\t\t\t37.7700200000\t-122.5014300000\tNAD27\t241\t\t\t37.7700228000\t-122.5014321000\t\t\t\t\tKristina Yamamoto\t2002-12-01\tMaNIS georeferencing guidelines\tTerrain Navigator 5.03 USGS 1:24,000\tunverified\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tDouglas J. Long\t2000-05-26\t\t\t\t\t\tSciurus carolinensis pennsylvanicus\t\t\t\t\tAnimalia; Chordata; Mammalia; Rodentia; Sciuridae\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\tpennsylvanicus\t\t\t\t\t\t\t\t17\ttotal length\t1\t0.75\t1\tadult\tF\t\tCalifornia Academy of Sciences. CAS Mammalogy (MAM). Source: http://ipt.calacademy.org:8080/ipt/resource.do?r=mam (source published on 2019-07-23)\t6ce7290f-47f6-4046-8356-371f5b6749df\t66522820-055c-11d8-b84e-b8a03c50a862\tmflannery@calacademy.org\tMaureen Flannery\t2019-07-23\t2019-08-04\tno migrator\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2009-06-05 15:46:10.0\tCC0\t\t\tCalifornia Academy of Sciences. CAS Mammalogy (MAM). Record ID: urn:catalog:CAS:MAM:28420. Source: http://ipt.calacademy.org:8080/ipt/resource.do?r=mam (source published on 2019-07-23)\thttp://portal.vertnet.org/o/cas/mam?id=urn-catalog-cas-mam-28420\t\t\t\tCAS\tMAM\t\tPreservedSpecimen\t\t\tWeight=482.9 g.; Length=455.0 mm.\turn:catalog:CAS:MAM:28420\t28420\t\tUnknown\t\tfemale\tAdult\texternal characters\t\t\t\tTISSUE; SN\t\t\t\t\t\t\tWeight taken on 5 October 1995. Tail: 196.0 mm., HF: 60.0 mm., ear: 26.0 mm.\t\t\t\t\t\t\t\t\t\t\t1993-08-24\t\t236\t236\t1993\t8\t24\t24 August 1993\t\t\t\t\t\t\t\tNorth America; USA; California; San Mateo Co.\tNorth America\t\t\t\tUSA\t\tCalifornia\tSan Mateo Co.\t\tRedwood City\t\t\t\t\t\t\t\t\t\t\t\t37.4698300000\t-122.2227100000\tNAD27\t9469\t\t\t37.4698329000\t-122.2227144000\t\t\t\t\tJulian A. Kapoor\t2002-12-22\tMaNIS georeferencing guidelines\tTerrain Navigator 5.03 USGS 1:24,000\tunverified\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia; Chordata; Mammalia; Rodentia; Sciuridae\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\t\t\t\t\t\t\t\t455.0\ttotal length\t0\t482.9\t0\tAdult\tF\t\tCalifornia Academy of Sciences. CAS Mammalogy (MAM). Source: http://ipt.calacademy.org:8080/ipt/resource.do?r=mam (source published on 2019-07-23)\t6ce7290f-47f6-4046-8356-371f5b6749df\t66522820-055c-11d8-b84e-b8a03c50a862\tmflannery@calacademy.org\tMaureen Flannery\t2019-07-23\t2019-08-04\tno migrator\t0\t1\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2019-08-25 10:42:36.0\thttp://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tChicago Academy of Sciences. CHAS Mammalogy Collection (Arctos). Record ID: http://arctos.database.museum/guid/CHAS:Mamm:2019.1.74?seid=4307578. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=chas_mammals (source published on 2019-07-07)\thttp://arctos.database.museum/guid/CHAS:Mamm:2019.1.74\tCHAS\t113\t\tCHAS\tMammal specimens\t\tPreservedSpecimen\tmask part attribute location\t\tverbatim preservation date=2017-12-10 ; sex=male ; total length=504 mm; tail length=219 mm; weight=630 g; fat deposition=subcutaneous fat: heavy\thttp://arctos.database.museum/guid/CHAS:Mamm:2019.1.74?seid=4307578\tCHAS:Mamm:2019.1.74\t\tCollector(s): Steve Sullivan; Preparator(s): Yuqing Wang\t1\tmale\t\t\t\t\t\tskull; skin, study\t\t\t\t\t\tpreparator number=YW-02\t\thttp://arctos.database.museum/guid/CHAS:Mamm:2019.1.74\t\t\t\t\tSciurus carolinensis (accepted ID) identified by Yuqing Wang on 2017-12-10; method: student Remark: Eastern gray squirrel.\t\t\t\t\t2014-11-04\t\t308\t308\t2014\t11\t04\tNov 4 2014\t\t\t\t\t\t\t\tNorth America, United States, Illinois, Cook County\tNorth America\t\t\t\tUnited States\t\tIllinois\tCook County\t\tPeggy Notebaert Nature Museum, 2430 North Cannon Drive, Chicago\tPNNM, Chicago, Cook, IL\t\t\t\t\t\t\t\t\tSteve Sullivan\t\t41.926469\t-87.634817\tnot recorded\t131\t\t\t\t\t\t\t\t\tSteve Sullivan\t2014-11-04\tGeoLocate\tGeoLocate\tunverified\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tA\t\tYuqing Wang\t2017-12-10\t\tstudent\tEastern gray squirrel.\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia; Chordata; Mammalia; Rodentia; Sciuridae; Sciurinae;\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t504\ttotal length\t0\t630\t0\t\tmale\t\tChicago Academy of Sciences. CHAS Mammalogy Collection (Arctos). Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=chas_mammals (source published on 2019-07-07)\t4837d6b0-19fe-4fe4-9ddf-b62dd17a060e\tf2489500-dbab-4fbc-95ed-19eead127483\tdroberts@naturemuseum.org\tDawn Roberts\t2019-07-07\t2019-09-21\tno migrator\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2019-09-18 16:45:02.0\thttp://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tChicago Academy of Sciences. CHAS Mammalogy Collection (Arctos). Record ID: http://arctos.database.museum/guid/CHAS:Mamm:3720?seid=4235951. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=chas_mammals (source published on 2019-07-07)\thttp://arctos.database.museum/guid/CHAS:Mamm:3720\tCHAS\t113\t\tCHAS\tMammal specimens\t\tPreservedSpecimen\tmask part attribute location\t\tverbatim collector=E.V. Komarek ; sex=male ; unformatted measurements=TL: 435, T: 202, HF: 60, Et.: 363g ; total length=435 mm; tail length=202 mm; hind foot with claw=60 mm; weight=363 g\thttp://arctos.database.museum/guid/CHAS:Mamm:3720?seid=4235951\tCHAS:Mamm:3720\t\tCollector(s): Edwin V. Komarek\t1\tmale\t\t\t\t\t\tskull; skin, study\t\t\t\t\t\tUUID=149e86ee-2118-410f-8248-a0d859201335; secondary identifier=Scc-24\t\"INTERNAL NOTES: collection date listed as January 7, 1936 in Mammal Catalog Book (taped spine), but as \"January 1, 1936\" in 2nd Mammal Catalog Book, needs to be verified [A.King]. DATA HISTORY: Inventory catalogued/verified by Collections staff (2008-2010 inventory). Record last updated in Excel (prior to Arctos migration) by Dawn R. Roberts (2013-11-30). Date listed as entered in original FileMaker database: 1988-07-06.\"\thttp://arctos.database.museum/guid/CHAS:Mamm:3720\t\t\t\t\tSciurus carolinensis (accepted ID) identified by unknown; method: legacy Remark: Eastern Gray Squirrel.
Sciurus carolinensis carolinensis identified by unknown; method: legacy\t\t\t\t\t1936-01-01\t\t1\t1\t1936\t01\t01\t[transcribed directly into formatted date fields]\t\t\t\t\t\t\t\tNorth America, United States, Georgia, Charlton County\tNorth America\t\t\t\tUnited States\t\tGeorgia\tCharlton County\t\tChase Prairie, Okefenokee Swamp\tChase Prairie, Okefenokee Swamp, Georgia\t\t\t\t\t\t\t\t\tEdwin V. Komarek\tGeoreferenced by John Keating on 16 June 2015 [achinn 20 December 2018].\t30.816062\t-82.226234\tWorld Geodetic System 1984\t2435\t\t30.816062/-82.226234\t\t\tdecimal degrees\t\t\t\tEdwin V. Komarek\t1936-01-01\tGeoLocate\tGeoLocate\tunverified\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tA\t\tunknown\t\t\tlegacy\tEastern Gray Squirrel.\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia; Chordata; Mammalia; Rodentia; Sciuridae; Sciurinae;\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t435\ttotal length\t0\t363\t0\t\tmale\t\tChicago Academy of Sciences. CHAS Mammalogy Collection (Arctos). Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=chas_mammals (source published on 2019-07-07)\t4837d6b0-19fe-4fe4-9ddf-b62dd17a060e\tf2489500-dbab-4fbc-95ed-19eead127483\tdroberts@naturemuseum.org\tDawn Roberts\t2019-07-07\t2019-09-21\tno migrator\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 67dd2632-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=67dd2632-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"62\",\"stomach contents\":\"Masticated nut meats\",\"tail length in mm\":\"200\",\"total length in mm\":\"480\",\"weight\":\"515.3\",\"ear length from notch\":\"31\",\" left gonad length in mm\":\"26\",\" left gonad width in mm\":\"15\",\" right gonad length in mm\":\"26\",\" right gonad width in mm\":\"15\",\"weight unit\":\"g\" }\t67dd2632-537e-11e6-9649-a4a3446a4726\t16608\t\tDon Schoffler\t\tmale\t\tTestes scrotal\t\t\tpresent\tskeleton\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1993-03-25\t\t84\t84\t1993\t3\t25\t1993-03-25\t\t\t\t\tcollecting method: shot\t\t\tNorth America | United States | New York |  |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\t\t\tSchuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\tNorth America | United States | New York | Schuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\t\t\t\t\t\t\t\t\t\t\t42.276659\t-76.655259\tWGS84\t3225\t\t\t\t\t\t\t\t\tDBCreator\t\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t480\ttotal length\t0\t515.3\t1\t\tmale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 6806d370-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=6806d370-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"59\",\"tail length in mm\":\"163\",\"total length in mm\":\"440\",\"weight\":\"583.5\",\"ear length from notch\":\"26\",\"weight unit\":\"g\" }\t6806d370-537e-11e6-9649-a4a3446a4726\t21304\t\tEdward S. Thomas\t\tmale\tadult\tTestes scrotal 22 x 12 mm\t\t\tpresent\tstudy skin - 1; skeleton - 1; tissue (frozen) - 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t2010-04-06\t\t96\t96\t2010\t4\t6\t2010-04-06\t\t\t\t\t\t\t\tNorth America | United States | New York | Tompkins County |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\tTompkins\t\tDryden Township, Ellis Hollow\tNorth America | United States | New York | Tompkins County | Dryden Township, Ellis Hollow\t\t\t\t\t\t\t\t\t\t\t42.42766\t-76.38849\tWGS84\t2078\t\t\t\t\t\t\t\t\tDBCreator\t2007-06-13\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t440\ttotal length\t0\t583.5\t1\tadult\tmale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t1\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 6810ae67-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=6810ae67-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"64\",\"tail length in mm\":\"230\",\"total length in mm\":\"505\",\"weight\":\"580\",\"weight unit\":\"g\" }\t6810ae67-537e-11e6-9649-a4a3446a4726\t1832\t\tWilliam J. Hamilton Jr.\t\tmale\tadult\tTestes enlarged & descended\t\t\tpresent\tstudy skin - 1; skull - 1\t\t\t\t\t\t\tRec'd from W.J. Hamilton, Jr.\t\t\t\t\t\t\t\t\t\t\t1938-10-05\t\t278\t278\t1938\t10\t5\t1938-10-05\t\t\t\t\tcollecting method: killed by car\t\t\tNorth America | United States | New York | Tompkins County |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\tTompkins\t\tNewfield\tNorth America | United States | New York | Tompkins County | Newfield\t\t\t\t\t\t\t\t\t\t\t42.362018\t-76.590778\tnot recorded (forced WGS84)\t3036\t\t\t\t\t\t\t\t\t\t\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t505\ttotal length\t0\t580\t1\tadult\tmale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-03-20\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 681424b0-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=681424b0-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"71\",\"tail length in mm\":\"208\",\"total length in mm\":\"476\",\"weight\":\"455\",\"weight unit\":\"g\" }\t681424b0-537e-11e6-9649-a4a3446a4726\t3842\tWJHJ 2460\tWilliam J. Hamilton Jr.\t\tmale\tadult\tTestes small, not descended.\t\t\tpresent\tstudy skin - 1; skull - 1\t\t\t\t\t\t\tSkull broken but saved.  Fleas preserved.; Received from W.J. Hamilton, Jr.\t\t\t\t\t\t\t\t\t\t\t1947-01-28\t\t28\t28\t1947\t1\t28\t1947-01-28\t\t\t\t\t\t\t\tNorth America | United States | New York | Tompkins County |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\tTompkins\t\tIthaca Township, Cayuga Heights, Highland Road\tNorth America | United States | New York | Tompkins County | Ithaca Township, Cayuga Heights, Highland Road\t\t\t\t\t\t\t\t\t\t\t42.465699\t-76.490741\tWGS84\t1488\t\t\t\t\t\t\t\t\tDBCreator\t2009-08-26\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis leucotis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\tleucotis\tsubspecies\t\t\t\tICZN\t\t\t476\ttotal length\t0\t455\t1\tadult\tmale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 68340671-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=68340671-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"63\",\"tail length in mm\":\"210\",\"total length in mm\":\"405\",\"weight\":\"557\",\"ear length from notch\":\"18\",\" left gonad length in mm\":\"25\",\" left gonad width in mm\":\"15\",\" right gonad length in mm\":\"32\",\" right gonad width in mm\":\"15\",\"weight unit\":\"g\" }\t68340671-537e-11e6-9649-a4a3446a4726\t17452\t\tDon Schoffler\t\tmale\t\t\t\t\tpresent\tskeleton\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1993-03-25\t\t84\t84\t1993\t3\t25\t1993-03-25\t\t\t\t\tcollecting method: shot\t\t\tNorth America | United States | New York |  |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\t\t\tSchuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\tNorth America | United States | New York | Schuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\t\t\t\t\t\t\t\t\t\t\t42.276659\t-76.655259\tWGS84\t3225\t\t\t\t\t\t\t\t\tDBCreator\t\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t405\ttotal length\t0\t557\t1\t\tmale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 6834ab99-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=6834ab99-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"62\",\"tail length in mm\":\"220\",\"total length in mm\":\"465\",\"weight\":\"536\",\"ear length from notch\":\"32\",\"weight unit\":\"g\" }\t6834ab99-537e-11e6-9649-a4a3446a4726\t18586\t\tDora E. Worbs\t\tfemale\t\t\t\t\tpresent\tstudy skin - 1; skeleton - 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1995-11-02\t\t306\t306\t1995\t11\t2\t1995-11-02\t\t\t\t\tcollecting method: killed by cat\t\t\tNorth America | United States | New York | Tompkins County |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\tTompkins\t\tCaroline Township, White Church & Ridgeway Roads, ~4.3 km S Brooktondale\tNorth America | United States | New York | Tompkins County | Caroline Township, White Church & Ridgeway Roads, ~4.3 km S Brooktondale\t\t\t\t\t\t\t\t\t\t\t42.3443\t-76.3857\tWGS84\t112\t\t\t\t\t\t\t\t\tDBCreator\t2009-01-26\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t465\ttotal length\t0\t536\t1\t\tfemale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1", "PhysicalObject\t2018-02-28\thttps://creativecommons.org/publicdomain/zero/1.0/\t\thttp://vertnet.org/resources/norms.html\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Record ID: 68384b01-537e-11e6-9649-a4a3446a4726. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\thttp://portal.vertnet.org/o/cumv/mamm?id=68384b01-537e-11e6-9649-a4a3446a4726\thttp://grbio.org/cool/i64g-wjcr\thttp://grbio.org/cool/67hr-z96t\t\tCUMV\tMamm\t\tPreservedSpecimen\t\t\t{\"hind foot length with claw in mm\":\"70\",\"stomach contents\":\"Empty\",\"tail length in mm\":\"233\",\"total length in mm\":\"475\",\"weight\":\"512\",\"ear length from notch\":\"31\",\"weight unit\":\"g\" }\t68384b01-537e-11e6-9649-a4a3446a4726\t17444\t\tunknown\t\tfemale\t\tShrunken, abdominal\t\t\tpresent\tskeleton\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1994-03-23\t\t82\t82\t1994\t3\t23\t1994-03-23\t\t\t\t\tcollecting method: shot\t\t\tNorth America | United States | New York |  |  |  |  |\tNorth America\t\t\t\tUnited States\tUS\tNew York\t\t\tSchuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\tNorth America | United States | New York | Schuyler/Tompkins County, Cauyta Township, ~4.5 km ESE of Cayuta, Arnot Forest\t\t\t\t\t\t\t\t\t\t\t42.276659\t-76.655259\tWGS84\t3225\t\t\t\t\t\t\t\t\tDBCreator\t\t\t\trequires verification\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSciurus carolinensis\t\t\t\t\tAnimalia | Chordata | Mammalia | Rodentia | Sciuridae | Sciurus\tAnimalia\tChordata\tMammalia\tRodentia\tSciuridae\tSciurus\t\tcarolinensis\t\tspecies\t\t\t\tICZN\t\t\t475\ttotal length\t0\t512\t1\t\tfemale\t\tCornell University Museum of Vertebrates. CUMV Mammal Collection. Source: http://ipt.vertnet.org:8080/ipt/resource.do?r=cumv_mamm (source published on 2018-07-02)\t35720b3e-aded-4b83-b4f1-967f1d457d6a\tcf9ceb80-9f3d-11da-b791-b8a03c50a862\tcbd63@cornell.edu\tCasey Dillman\t2018-07-02\t2018-07-03\t2018-01-08\t0\t0\t0\t0\t0\tspecimen\t1")

Below is the code I used to load the .txt file and create the 13 column data frame.
setwd()

install.packages("tidyverse")
library(tidyverse)
install.packages("lubridate")
library(lubridate)
install.packages("cowplot")
library(cowplot)

Sciurus_carolinensis_total <- readr::read_tsv("Sciurus_carolinensis_total.txt") %>% select(genus, specificepithet, sex, year, month, day, countrycode, stateprovince, county, decimallatitude, decimallongitude, lengthinmm, lengthtype)

Thank you for the help. It was far more simple a solution than I thought.


text:
Q: Insert a value in a Mysql database using Python I am trying to insert values typed from me to a MySQL database. I am using python 3.4 and mysql.connector. Here is the part of the script:
Value = int(input("Type a number between 1 and 10: "))
cursor.execute("""INSERT INTO test VALUES ('Number', Value )""")

I am actually trying to find out how to get what i am inserting from my keyboard into the second field of the test table. As it is right now it gives me a SQL syntax error. Please help. Thanks in advance.

A: Use cursor.execute to bind Value into your query.
cursor.execute("INSERT INTO test VALUES ('Number', %s)", (Value,))

This is preferable over the other answers because it protects against SQL injection.

A: Use string formatting to provide the Value variable
cursor.execute("""INSERT INTO test VALUES ('Number', %s)""" % Value)


text:
Q: OpenLayers 3 supported formats What are the formats supported by OpenLayers 3?
I need open in OpenLayers a map with different colors, like the image below. So, which format should I export? I'm using QGIS and ArcMap to create the maps.

This map represents the Brazil population by regions (the darker the color, the greater the population). The data is coming from a shapefile where each row represents one different region (5570 regions in total).
Shapefile attribute table (example):

A: For small data sets you can use KML or GML formats. For larger data sets you had better to use WMTS/WMS/WFS server.


text:
Q: Criar um botao de mudar o preço Como eu faço para criar um botao, que ao clicar "pp" apareça o valor "r$70,00" e "p" apareça "r$100,00", "M" "r$150,00" e "G" "r$180,00"
Quero usar o html e o js,
Olhem como ta agora,
<select style="margin: 0 5% 0 13%;" name="service" required class="border-box-contact">
            <option value="" disabled selected>Tamanho</option>
            <option value = 1>PP (~1,2kg)</option>
            <option value = 2>P (~1,8kg)</option>
            <option value = 3>M (~2,5kg)</option>
            <option value = 4>G (~3,5kg)</option>

Nao estou conseguindo fzr funfar, alguem me help?

A: Cria um objeto com esses valores e depois escuta escolhas no select com .addEventListener('change', function() {. Assim podes saber o preço ligado a cada opção...
Um exemplo seria assim:

const precos = {
  1: '70,00',
  2: '100, 00',
  3: '150,00',
  4: '180,00'
};

const produtos = document.querySelector('select[name="service"]');
const mostradoPreco = document.querySelector('#preco span');

produtos.addEventListener('change', function() {
  mostradoPreco.textContent = precos[this.value];
});
<select style="margin: 0 5% 0 13%;" name="service" required class="border-box-contact">
  <option value="" disabled selected>Tamanho</option>
  <option value=1>PP (~1,2kg)</option>
  <option value=2>P (~1,8kg)</option>
  <option value=3>M (~2,5kg)</option>
  <option value=4>G (~3,5kg)</option>
</select>

Preço: R$

A: Não sei se é exatamente isso que precisa, mas fiz uso do jQuery com algumas funções, .change(); para que ao trocar o valor  do select ela seja executada. a .text(); par atualizar o span em questão com o valor;

$("#service").change(function() {
  var value = $(this).children("option:selected").val();
  if (value == 1) {
    $("#valor").text("Preço: R$ 70,00");
  } else if (value == 2) {
    $("#valor").text("Preço: R$ 100,00");
  } else if (value == 3) {
    $("#valor").text("Preço: R$ 150,00");
  } else if (value == 4) {
    $("#valor").text("Preço: R$ 180,00");
  }

});

<select id="service" style="margin: 0 5% 0 13%;" name="service" required class="border-box-contact">
  <option value="" disabled selected>Tamanho</option>
  <option value=1>PP (~1,2kg)</option>
  <option value=2>P (~1,8kg)</option>
  <option value=3>M (~2,5kg)</option>
  <option value=4>G (~3,5kg)</option>
</select>

Teste e veja se é isso que precisa.


text:
Q: Cannot update intel microcode using apt-get I'm using Debian Stretch, kernel 4.17.11  and when I run
sudo apt-get install intel-microcode

I get

Package intel-microcode is not available, but is referred to by another package.
  This may mean that the package is missing, has been obsoleted, or
  is only available from another source

A: You are not finding the package intel-microcode, because it is on the non-free repositories, that are not added by default on installation time.
You need to add it to your /etc/apt/sources.list
As in:
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free

Do not forget to run sudo apt update after adding the non-free repository and before running sudo apt install.

Package: intel-microcode (3.20180425.1~deb9u1) [non-free]
Processor microcode firmware for Intel CPUs
This package contains updated system processor microcode for Intel
  i686 and Intel X86-64 processors. Intel releases microcode updates to
  correct processor behavior as documented in the respective processor
  specification updates.
For AMD processors, please refer to the amd64-microcode package.


text:
Q: Export a table from SQL to a flat text file without using a wizard? I'm wondering is it possible to export a table from Microsoft SQl without having to use the Export Wizard? At the moment I find it a very time consuming process when having to export multiple files.

A: You can try this for configuration one time only
   EXEC [DataBase].dbo.sp_configure 'show advanced options', 1
   RECONFIGURE
   EXEC [DataBase].dbo.sp_configure 'xp_cmdshell', 1
   RECONFIGURE

Where [DataBase] is your Database name
Now for exporting data please try this
  EXEC xp_cmdshell 'bcp "SELECT * FROM [DataBase].dbo.[TABLE_NAME]" queryout "C:\exportfilename.txt" -T -c -t,'

Where [DataBase]  is your database name and [TABLE_NAME] is your table name.
You will get the exported data to the path C:\exportfilename.txt of your server.


text:
Q: SMTP to Gmail Authenticated Relay not working email stuck in queue I am following this document
http://kb.eclipseinc.com/kb/how-to-configure-iis-smtp-server-to-forward-emails-using-email-account/
and in places where it was talking about ports etc i used the information
Gmail SMTP server settings

*

*Gmail SMTP server name: smtp.gmail.com

*Gmail SMTP username: your Gmail address

*Gmail SMTP password: your password

*Gmail SMTP port: 465
I also enabled TLS
but mails sent just get stuck in queue
My Settings

A: Mails sent just get stuck in queue
You need to use port 587 with TLS.

*

*Gmail SMTP port (TLS): 587

*Gmail SMTP port (SSL): 465

Source What Are the Gmail SMTP Settings?

I'm getting an error message that my app is not secure

Someone just tried to sign in to your Google Account myaccount@gmail.com from an app that doesn't meet modern security standards.

You need to change a setting on your Gmail account.

*

*Login to Gmail

*Go to "My account"

*Select "Sign-in & security"

*Scroll to the bottom of the page

*Set "Allow less secure apps" to "ON"

Try to send your emails again.

Allowing less secure apps to access your account

Google may block sign-in attempts from some apps or devices that do
  not use modern security standards. Since these apps and devices are
  easier to break into, blocking them helps keep your account safe.
Some examples of apps that do not support the latest security
  standards include:

*

*The Mail app on your iPhone or iPad with iOS 6 or below

*The Mail app on your Windows phone preceding the 8.1 release

*Some Desktop mail clients like Microsoft Outlook and Mozilla Thunderbird

  Change account access for less secure apps
To help keep Google Apps users' accounts secure, we may block less
  secure apps from accessing Google Apps accounts. As a Google Apps
  user, you will see a "Password incorrect" error when trying to sign
  in. If this is the case, you have two options:

*

*Option 1: Upgrade to a more secure app that uses the most up to date security measures. All Google products, like Gmail, use the latest
  security measures.

*Option 2: Change your settings to allow less secure apps to access your account. We don't recommend this option because it might make it
  easier for someone to break into your account. If you want to allow
  access anyway, follow these steps:

*

*Go to the "Less secure apps" section in My Account.

*Next to "Access for less secure apps," select Turn on. (Note to Google Apps users: This setting is hidden if your administrator has
  locked less secure app account access.)

Source Allowing less secure apps to access your account

A: I may little late, experienced a similar issue, this was after May 30, 2022.
This feature is no longer supported as of May 30th, 2022. See Less secure apps & your Google Account.

Use an App Password
An App password is a 16-digit passcode that gives a non-Google app or device permission to access your Google Account. Learn more about how to sign in using App Passwords.


text:
Q: How to randomly select and open a notebook using CDFPlayer I have a lesson notebook for a class I am teaching. I'd like to separate the lesson content and the practice problems. Students are using the CDFPlayer program, not Mathematica.
I created a button that will open a specific notebook…
Button[
  "open",
  NotebookOpen[FileNameJoin[{NotebookDirectory[ButtonNotebook[]], "sample.nb"}]]]

and this works fine in the CDFPlayer.
However, selecting a "random" question from a list of files doesn't. Something in my code doesn't work in the free player. (The same code works fine in Mathematica)
This is what I tried:
Button[
  "open",
  NotebookOpen[RandomChoice[FileNames[{"*.nb"}, {NotebookDirectory[ButtonNotebook[]]}]]]]

I'm wondering if someone could offer a suggestion?   I'd like a button that when clicked,  will open a notebook from a folder of practice problems, and work in the CDFPlayer.
Any suggestions are appreciated.
I see (and appreciate) the feedback that the free CDFPlayer is NOT able to open files.  So that answers my question...

A: HI…  I found I could get this to work using a SUPPLIED list of questions.   I WILL know ahead of time how many questions there are,  so I didn't need to "fish" for the file names.
I just put the questions in a folder with nice sequential names,  Q1, Q2, Q3, etc. and used the following
(which works fine in the free CDFPlayer)
Button["open",
 NotebookOpen[
  FileNameJoin[{
    NotebookDirectory[EvaluationNotebook[]],
    "Data",
    "Questions",
    RandomChoice["Q " <> ToString[#] <> ".nb" & /@ Range[3]]}]]]


text:
Q: Prove a function that is nonnegative on a set then has a Riemann Sum that is greater than zero Hey I have been working with Riemann Integrals and I have never sees this anywhere, but it makes intuitive sense to me and I can't seem to prove it.
If you have a continuous function that is real valued (say $f$) on an interval, $[a,b]$. Then $f(x) \ge 0$ for all $x$ in $[a,b]$ then $\int_a^b f(x) \, dx >0 $.
Edit: I just realized this is only true if for some $x$ in the domain $f(x)>0$.

A: Suppose $f(x_0)>0$.  Let $\varepsilon=f(x_0)/2$.  By continuity, there is some $\delta>0$ such that for all $x\in[a,b]\cap(x_0-\delta,x_0+\delta)$, the value of $f(x)$ differs from that of $f(x_0)$ by less than $\varepsilon$.  And that implies $f(x)>f(x_0)/2>0$.  So $f(x)>0$ for all $x$ in some interval, and the integral of $f$ over the complement of that interval is $\ge 0$.


text:
Q: Less free space after securely erasing free space? I use a mid-13 13-inches Retina MBP 256gb with macOS Sierra 10.12.2.
I recently decided to securely erase free space using the following terminal command:
diskutil secureErase freespace 1 /Volumes/HD

After completing its task, I got 50GB of free space instead of the 80GB I had before the operation.
Could it be a remaining temporary file used by secureErase?

A: That's it. Do you have external SSD and FileVault enabled? Having SSD drive, Secure Erase and Erasing Free Space commands aren't needed for SSD drives 'cause a regular erase command makes it difficult to recover data from an SSD.
Also, if you don't include freespace word, diskutil will start securely erasing the entire disk, instead of just the free space! 1 means single-pass method run of random numbers.
diskutil secureErase freespace 1 /Volumes/SSD

Be careful with it. Securely erased means there's no chance you'll be able to recover the data.
Read this useful AD post: Why is a secure erase 'not necessary' for SSD ?


text:
Q: Adding a space before each capital letter in a selected set of lines in a yaml file using sed I want to write a regex for a shell script. It is used to match only this kind of lines in yml file. (lines with the tag summary: Example Summary)
summary: GetMembersSavedSearchesByMemberId

So What I want to do is add a space before each Uppercase letter and output like this
summary: Get Members Saved Searches By Member Id

I tried this regex
matchregex="summary[:][[:space:]].\([A-Z]\)"
replacement="summary: .\1"
sed -e "s/${matchregex}/${replacement}/g"

It is not working. What is the correct way of writing this?

A: Would you please try the following:
sed -E '/^summary:/ s/([a-z])([A-Z])/\1 \2/g'

Result:
summary: Get Members Saved Searches By Member Id

A: This might work for you (GNU sed):
sed 's/\B[[:upper:]]/ &/g' file

Globally insert a space inside a word where the following character is uppercase.


text:
Q: Minimum time interval not updating in requestLocationUpdates I am working on an android app which gives me location in every 5 minute interval. Now if user receive a phone call then i am updating 5 minutes to 5 seconds so that i can get the user location in every 5 seconds of interval till the time he is on call, so that i can calculate the speed of a person when he is on call. I am getting user location in every 5 minutes which is working fine but when i update this time to 5 seconds in CALL_STATE_OFFHOOK it is not updating the time to 5 seconds.Still i am getting location in 5 minutes.Please help
 @Override
public void onCallStateChanged(int state, String incomingNumber) {
    super.onCallStateChanged(state, incomingNumber);
    log.info("onCallStateChanged called");

    switch (state) {
    case TelephonyManager.CALL_STATE_IDLE:
        BackgroundService.LOCATION_INTERVAL = 300000;
        log.info("onCallStateChanged  CALL_STATE_IDLE():");
        //Toast.makeText(context, "Phone state Idle", Toast.LENGTH_LONG).show();
        break;
    case TelephonyManager.CALL_STATE_OFFHOOK:
        BackgroundService.LOCATION_INTERVAL = 5000;
        log.info("onCallStateChanged  CALL_STATE_OFFHOOK()");
        //Toast.makeText(context, "Phone state Off hook", Toast.LENGTH_LONG).show();
        break;
      case TelephonyManager.CALL_STATE_RINGING:
          log.info("call state ringing before");
         // BackgroundService.LOCATION_INTERVAL = 00000;
          log.info("call state ringing after");
        //Toast.makeText(context, "Phone state Ringing", Toast.LENGTH_LONG).show();
        break;
    default:
        break;
    }

}
@Override
public void onCreate() {
    this.isRunning = false;
    this.backgroundThread = new Thread(myTask);
    log.info("on create run");
}

private Runnable myTask = new Runnable() {
    public void run() {
        initializeLocationManager();
        try {
            mLocationManager.requestLocationUpdates(
                    LocationManager.NETWORK_PROVIDER, LOCATION_INTERVAL,
                    LOCATION_DISTANCE, mLocationListeners[1],
                    Looper.getMainLooper());
            log.info("Location Interval" +LOCATION_INTERVAL);
        } catch (java.lang.SecurityException ex) {
            log.info("fail to request location update, ignore");
            Log.i(TAG, "fail to request location update, ignore", ex);
        } catch (IllegalArgumentException ex) {
            Log.d(TAG,
                    "network provider does not exist, " + ex.getMessage());
        }
        try {
            mLocationManager.requestLocationUpdates(
                    LocationManager.GPS_PROVIDER, LOCATION_INTERVAL,
                    LOCATION_DISTANCE, mLocationListeners[0],
                    Looper.getMainLooper());
        } catch (java.lang.SecurityException ex) {
            Log.i(TAG, "fail to request location update, ignore", ex);
        } catch (IllegalArgumentException ex) {
            Log.d(TAG, "gps provider does not exist " + ex.getMessage());
        }
    }
};


text:
Q: Where is /etc/rc.local
I'm trying to follow this tutorial. I am working with an Ubuntu 14.04 instance on amazon EC2:
At the end of the tut, it discusses:
"The last step is to make it all happen automatically at system startup time.
Edit /etc/rc.local and add ..."
I want to activate an existing virtualenv automatically at startup , for which I would manually use the command
workon myenv

when I inspect the /etc directory, I see the above screenshot. Where is rc.local?
Edit 1 - I don't think its here:

A: You are seeing only directories, rc.local is a file. Please use the command line or any other method (in the GUI program you are using) to view files too, you will get rc.local along with all other files.


text: Q: Visual Studio Code Type Inference Linter Is there any way to get Tern-Lint like functionality in VSCode for type warnings without having to write Typings for all of my code? Its already detecting what the param types of arguments should be & inferring types, but no warnings are thrown when the detected types aren't obeyed in code.


text:
Q: Convert Pixels to Black and White I am used to programming in python and am trying to teach a friend how to program in c. I was able to teach him the basics but he has an exam coming up soon that I would love to be able to help him with, however I myself am having trouble converting some code from python to c.
One question he was given for example..
the program should read the greyscale pixel values from the pixelsIn.txt.file using a loop. The lines of the file are read in by the program. The body of the image contains the grey scale value of each body in the picture and the program should determine whether the  pixel value is equal to 110, if so,  the program should convert this pixel value to 225 (white) otherwise it should be converted back to  0 (black).

If I was to do that in python I would read in each line, split the line and then use a for loop to check if the number is 110 or not. However I am extremely unsure if this is how it would be done in C?
Sorry if I am being vague but I will answer any questions if I wasn't clear enough. Any help would be greatly appreciated.
For example in the following tiny image on the left, the letter H is encoded using the pixel value 110. This is
not very clear on the left hand image as the surrounding pixels have a greyscale value which is very close.
If the message pixel values are changed to 255 (white) and the non-message pixel values changed to 0
(black) the image on the right hand side then shows the hidden H clearly

A: I will consider that you already opened the image in FILE *image, read the header P2 of the image, saved its width to int width and height to int height and read the maximum intensity 255.
You will just need to iterate on each pixel of image using fscanf to read each integer. Here is a sample code in C:
int i, j, **matrix = malloc(height * sizeof(int *));
for (i = 0; i < height; i++) {
    matrix[i] = malloc(width * sizeof(int))
    for (j = 0; j < width; j++) {
        int pixel;
        fscanf(image, "%d", &pixel);
        matrix[i][j] = (pixel == 110) ? 255 : 0;
    }
}

After that, your changed image will be at matrix. You just have to save it.
Hope it helped.


text:
Q: Alarmmanager schedule the same pending intent to fire twice at the same time My intent was supposed to be fired once every 30 seconds. since I'm using Android 5.0 for testing, the alarm api schedules and fires it with other alarm events every 20-40s.
        pendingIntent= PendingIntent.getBroadcast(getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
        alarmManager = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
        alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME, 0, 30000, pendingIntent);

sometimes the 2 of the same pending intent is scheduled to fire at the same time. This happens once in about 5 minutes. How can I avoid this?


text:
Q: Space between items I've ran into this problem many times over the course of my career and have never given it much thought. My standards have risen to the point where I want a nicer solution. I'll use ES6 to demonstrate, but there is no need to limit answers to the same language. Here's the problem:
Given a list of words, each of which is conditionally printed, but a separator should be printed between each word (ie. before all but the first word).
I often encounter this problem with long chains of if statements where it is solved like so:
let something_printed = false;
if (condition1) {
   print(word1); // no space needed here
   something_printed = true;
}
if (condition2) {
   if (something_printed)
      print(' '); // but now a space is necessary
   print(word2);
   something_printed = true;
}
if (condition3) {
   if (something_printed)
      print(' '); // here too
   print(word3);
   something_printed = true;
}

Or in a loop:
let something_printed = false;
for (let [word, condition] of word_conditions) {
   if (condition)
      if (something_printed)
         print(' ');
   print(word);
   something_printed = true;
}

That extra conditional, just to print the separator, bugs me to no end. So I came up with the following (which can be adapted to either of the above examples):
let separator = ''; // separator is initially empty
for (let [word, condition] of word_conditions)
   if (condition) {
      print(separator + word);
      separator = ' '; // separator is a space here on out
   }

Which is the most succinct solution I have come up with and is what I have been doing for...quite a long time.
So here we have two loops, the first loop catches the first printed word, and the second handles all preceding words:
let words = word_conditions.keys();
let conditions = word_conditions.values();
let index;
for (index = 0; index < words.length; index++)
   if (conditions[index]) {
      print(words[index]);
      break;
   }
for (; index < words.length; index++)
   if (conditions[index])
      print(' ' + words[index]);

Ignoring the extra indexing, there is no wasted effort in the second loop, which is nice, but this is a more verbose solution, and it takes effort to ignore the extra indexing.
A two-pass approach seem like it might offer some hope, and is nice enough, but is not the most succinct, and pays a price in time and memory due to building an array for printed words:
let unconditional_words = [];
for (let [word, condition] of word_conditions)
   if (condition)
      unconditional_words.push(word);
print(unconditional_words.pop());
for (let word of unconditional_words)
   print(' ' + word);

Sure, this is quibbling, but I run into this all the time. There has to be a succinct and efficient implementation out there. I haven't explored a more functional approach, but feel like it could contain several better solutions than I've shown above.
Epilogue
I probably shouldn't have used Javascript for my examples as the platform I was thinking of doesn't really have the space to build an array and execute a join. (Think old microcontrollers.) However, the vast majority of work I do is not limited in this way. Where I can't spare the space, I'll stick with my third implementation above. On modern tech, join() is applicable, succinct, and efficient. As usual, leveraging someone else's hard work is the best way to go. Thanks Shadow.
So my first example with the ifs can use join() like so:
let words = [];
if (condition1)
   words.push(word1);
if (condition2)
   words.push(word2);
if (condition3)
   words.push(word3);
print(words.join(' '));

For the second example with the loop:
let words = [];
for (let [word, condition] of word_conditions)
   if (condition)
      words.push(word);
print(words.join(' '));

Which gives me brief, simple, and understandable solutions. Nice.

A: Sounds like you are looking for the join function.
In javascript (and ES6)
["First item", "Second item"].join(", ");

will return
"First item, Second item"

A: Using join is the built in way to do this in JavaScript.

var words = "Hello this is my sentence";
var comma = words.split(" ").join(", ");
console.log(comma);


text:
Q: wildfly: How to use encrypted password for a xa-datasource? I have a wildfly 8.2.0.Final running. I use two oracle datasources, one <datasource> and one <xa-datasource>. I want to have my DB passwords encrypted and managed to do that for the datasource using a security-domain but not for the xa-datasource.
I haven't found documentation or other postings with a solution for this problem.
Here is what I've done:
        <datasources>
            <datasource jta="false" jndi-name="java:/myproject/jdbc/datasources/jdbc" pool-name="my_JDBC_DS" enabled="true" use-ccm="false">
                <connection-url>jdbc:oracle:thin:@localhost:1521:DB</connection-url>
                <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                <driver>oracle</driver>
                <pool>
                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>50</max-pool-size>
                </pool>
                <security>
                    <security-domain>databaseSecure</security-domain>
                </security>
                <validation>
                    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                    <validate-on-match>true</validate-on-match>
                    <background-validation>false</background-validation>
                </validation>
            </datasource>
            <xa-datasource jndi-name="java:/myproject/jdbc/datasources/db_tx" pool-name="MYTXDS" enabled="true" use-ccm="false">
                <xa-datasource-property name="URL">
                    jdbc:oracle:thin:@localhost:1521:DB
                </xa-datasource-property>
                <xa-datasource-property name="User">
                    scott
                </xa-datasource-property>
                <xa-datasource-property name="Password">
                    tiger
                </xa-datasource-property>
                <driver>oracle</driver>
                <security>
                  <user-name>scott</user-name>
                    <password>tiger</password>
                </security>
                <xa-pool>
                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>50</max-pool-size>
                    <wrap-xa-resource>false</wrap-xa-resource>
                </xa-pool>
                <validation>
                    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                    <validate-on-match>true</validate-on-match>
                    <background-validation>false</background-validation>
                </validation>
                <statement>
                    <prepared-statement-cache-size>32</prepared-statement-cache-size>
                    <share-prepared-statements>true</share-prepared-statements>
                </statement>
            </xa-datasource>
            <drivers>
                <driver name="oracle" module="oracle">
                    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
...
            <security-domain name="databaseSecure" cache-type="default">
                <authentication>
                    <login-module code="org.picketbox.datasource.security.SecureIdentityLoginModule" flag="required">
                        <module-option name="username" value="scott"/>
                        <module-option name="password" value="-170dd0fbd8c13748"/>
                    </login-module>
                </authentication>
            </security-domain>

I've tried removing the xa-datasource-property entries for user and password and referring to the security-domain both nested in the security-tag and on the same level as the properties. Both attempts did not work, with the latter the wildfly exits early because of problems parsing the standalone.xml, with the latter the deployment fails.
To show the most promising attempt, this is how I tried to refer to the security-domain:
<xa-datasource jndi-name="java:/myproject/jdbc/datasources/db_tx" pool-name="MYTXDS" enabled="true" use-ccm="false">
            <xa-datasource-property name="URL">
                jdbc:oracle:thin:@localhost:1521:DB
            </xa-datasource-property>
            <driver>oracle</driver>
            <security>
              <security-domain>databaseSecure</security-domain>
            </security>
            <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
                <wrap-xa-resource>false</wrap-xa-resource>
            </xa-pool>
            <validation>
                <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                <validate-on-match>true</validate-on-match>
                <background-validation>false</background-validation>
            </validation>
            <statement>
                <prepared-statement-cache-size>32</prepared-statement-cache-size>
                <share-prepared-statements>true</share-prepared-statements>
            </statement>
        </xa-datasource>

Doing that the wildfly runs into a javax.resource.ResourceException: No matching credentials in Subject!
I've debugged into the code and although I'm missing the code for the last few classes in the call stack I see that the Subject actually has the credentials as properties but still the AccessController.doPrivilegedcall fails, leading to the above mentioned exception.
You see I'm kind of lost, any suggestions?

A: I figured it out what I did wrong (by debugging wildfly and staring hard at my working JBoss 4 config..).
In my security-domain configuration I had only set username and password. To make it work I needed to ad the "managedConnectionFactoryName" as well and declare a security-domain for each data source.
I now have the following configuration:
    <datasources>
        <datasource jta="false" jndi-name="java:/myproject/jdbc/datasources/jdbc" pool-name="my_JDBC_DS" enabled="true" use-ccm="false">
            <connection-url>jdbc:oracle:thin:@localhost:1521:DB</connection-url>
            <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
            <driver>oracle</driver>
            <pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
            </pool>
            <security>
                <security-domain>jdbcDatabaseSecure</security-domain>
            </security>
            <validation>
                <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                <validate-on-match>true</validate-on-match>
                <background-validation>false</background-validation>
            </validation>
        </datasource>
        <xa-datasource jndi-name="java:/myproject/jdbc/datasources/db_tx" pool-name="MYTXDS" enabled="true" use-ccm="false">
            <xa-datasource-property name="URL">
                jdbc:oracle:thin:@localhost:1521:DB
            </xa-datasource-property>
            <driver>oracle</driver>
            <security>
                <security-domain>txDatabaseSecure</security-domain>
            </security>
            <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
                <wrap-xa-resource>false</wrap-xa-resource>
            </xa-pool>
            <validation>
                <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                <validate-on-match>true</validate-on-match>
                <background-validation>false</background-validation>
            </validation>
            <statement>
                <prepared-statement-cache-size>32</prepared-statement-cache-size>
                <share-prepared-statements>true</share-prepared-statements>
            </statement>
        </xa-datasource>
        <drivers>
            <driver name="oracle" module="oracle">
                <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
            </driver>
        </drivers>
    </datasources>
    ...
        <security-domain name="jdbcDatabaseSecure" cache-type="default">
            <authentication>
                <login-module code="org.picketbox.datasource.security.SecureIdentityLoginModule" flag="required">
                    <module-option name="username" value="scott"/>
                    <module-option name="password" value="-170dd0fbd8c13748"/>
                    <module-option name = "managedConnectionFactoryName" value="jdbcDatabaseSecure" />
                </login-module>
            </authentication>
        </security-domain>
        <security-domain name="txDatabaseSecure" cache-type="default">
            <authentication>
                <login-module code="org.picketbox.datasource.security.SecureIdentityLoginModule" flag="required">
                    <module-option name="username" value="scott"/>
                    <module-option name="password" value="-170dd0fbd8c13748"/>
                    <module-option name = "managedConnectionFactoryName" value="txDatabaseSecure" />
                </login-module>
            </authentication>
        </security-domain>

And now it works.

A: I had the same issue when trying to configure xa-datasource with an encrypted security-domains. After struggling a while, I configured vault  encryption as described in this guide https://developer.jboss.org/wiki/JBossAS7SecuringPasswords and it works sucessfully with both datasources and xa-datasources.
Hope this helps.

A: i disabled caching of security-domain by removing cache-type="default" from security-domain in standalone.xml and it works for me
This happens where multiple datasources are defined backed by the same security domain,
- Either make separte security-domain for each datasource or
- if a security domain is to be used with multiple datasources then no caching should be enabled for that domain, this means that each time the PasswordCredential is obtained from the security domain it will be a new instance and do do this remove cache-type="default" from security-domain in standalone.xml
References:
https://community.appian.com/support/w/kb/299/kb-1074-cannot-open-connection-caused-by-javax-resource-resourceexception-no-matching-credentials-in-subject-error-thrown-during-jboss-startup
https://bugzilla.redhat.com/show_bug.cgi?id=1103684


text:
Q: change Font-family of sharepoint 2013 quick launch I need to change the style of Quick Launch title,
What's the class of the title's style of sharepoinnt 2013 Quick Launch to add my font-family
Any suggestions?

A: There appears to be two classes:

*

*.ms-core-list-menu

*.ms-core-navigation

They both can come into play depending on if you have manual or automatic left hand nav generation of links.
If you change .ms-core-navigation, it will also change the top bar links.


text:
Q: Error en import: module 'random' has no attribute 'randint' Estaba probando el código corregido de esta pregunta: Modificar variables globales . Y cuando intento ejecutarlo en la terminal me lanza un error que dice que el modulo random no tiene el atributo randint (lo cual no me parece tener ningún sentido):
random = random.randint(1,10)

AttributeError: module 'random' has no attribute 'randint'

Por si sirve de algo estoy ejecutándolo en una pc con Ubuntu Gnome con Anaconda instalado.

A: Es importante no crear un modulo llamado random.py en el mismo directorio donde esta el script (o en el directorio de trabajo actual en el caso del interprete interactivo) que intenta importar random.randint de  la stdlib. En general hay que intentar evitar nombrar nuestros script con nombres que puedan entrar en conflictos con la biblioteca estándar o con otras bibliotecas externas instaladas (como nombrar módulos con la palabra "django" cuando se trabaja con este framework).
Esto tiene que ver en que directorios y en qué orden se resuelven los imports. Cuando se importa un módulo (importe absoluto), por ejemplo usando:
>>> import random

El intérprete busca ese módulo en las siguientes localizaciones y por este orden:

*

*Módulos built-in.

*El directorio que contiene el script o el directorio actual si no se especifica ningún script (por ejemplo al ejecutar el interprete interactivo en la terminal).

*Búsqueda en el PYTHONPATH

*Ruta predeterminada dependiente de la instalación, por ejemplo /usr/local/lib/python.
No todos los módulos de la biblioteca estándar son módulos built-in (preconstruidos). Los módulos built-in están escritos en C y son compilados como parte del propio intérprete  Python, por lo tanto no tienen un archivo .py ni los vamos a encontrar por ningún lado. Estos módulos se pueden listar mediante:

>>> import sys
>>> sys.builtin_module_names

('_abc',
 '_ast',
 '_codecs',
 '_collections',
 '_functools',
 '_imp',
 '_io',
 '_locale',
 '_operator',
 '_signal',
 '_sre',
 '_stat',
 '_string',
 '_symtable',
 '_thread',
 '_tracemalloc',
 '_warnings',
 '_weakref',
 'atexit',
 'builtins',
 'errno',
 'faulthandler',
 'gc',
 'itertools',
 'marshal',
 'posix',
 'pwd',
 'sys',
 'time',
 'xxsubtype')

¿Entonces que ocurre aquí?. Pues que random no ésta entre los módulos buit-in aunque sea de la stdlib y como aclara la documentación:

Después de la inicialización, los programas de Python pueden modificar sys.path. El directorio que contiene el script que se está ejecutando se coloca al principio de la ruta de búsqueda, por delante de la ruta de biblioteca estándar. Esto significa que los scripts de ese directorio se cargarán en lugar de los módulos del mismo nombre de la stdlib. Esto es un error, a menos que el reemplazo esté pensado.

Esto también ocurre cuando se ejecuta un script que está dentro de un paquete, ya que Python no interpretará ese directorio como un paquete, agregando así el directorio de trabajo al PYTHONPATH igual que lo comentado antes.
Por lo tanto cualquier directorio o módulo que llamemos igual que a un módulo de la stdlib no built-in o de terceros instalado solapará a éstos. Solo los módulos builtin como sys están a salvo de ésto.

Nota: los módulos buit-in dependen de la instalación, no en todos los casos van a ser los mismos.

Observase que tendremos un error muy similar si nuestro script se llama igual que un paquete de terceros instalado que tratamos de importar.
Si por ejemplo tratamos de importar pandas con el típico import pandas as pd y nuestro script se llama pandas.py, el script se  importará a si mismo y no al paquete pandas dado que está antes en el orden como mencionamos arriba.
Si tratamos de usar from para importar una clase, función, paquete, etc en específico nos encontramos directamente con un error del tipo:
pandas.py
from pandas import DataFrame

ImportError: cannot import name 'DataFrame' from partially initialized
module 'pandas' (most likely due to a circular import)

debido al intento de importarse a si mismo del módulo.


text:
Q: Android Form Scrolling with Translucent Status Bar I am targeting SDK 21,  Min SDK 15, Testing on API 19 device (Android 4.4.4)
I have this code in my Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_launcher);

    setTranslucentStatus();

}

@TargetApi(Build.VERSION_CODES.KITKAT)
private void setTranslucentStatus() {
    getWindow()
            .addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}

It works, with one problem.  In the layout I have a ScrollView.  The ScrollView is not scrolling.   However, if I comment out the call to setTranslucentStatus() scrolling works just fine.
By the way, the theme is NoActionBar
Any clue as to why the ScrollView would refuse to scroll when the status bar is translucent?

A: I don't know if you already found a solution for that, but if you use ConstraintLayout should solve this annoying bug.
A sample layout would look like this
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<ScrollView
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </LinearLayout>

</ScrollView>

A: Just use the attribute of scroll view
--  scrollbars: none in scroll view it makes the scroll view to scroll with out scrollbars
 No need of translucent flag just remove it


text:
Q: How to set class atributes for all objects? What is a proper way to set an class atribute which is valid for all objects and the class itself?
My Code looks like this:
class Bacteria(Contour):
    min_bacteria_size = 22.56 * 10 ** -15

    def __init__(self, contour):
        super().__init__(contour.contour, contour.hierarchy)
        self.area = contour.area
        self.mean_gray = contour.mean_gray
        rect = cv2.minAreaRect(self.contour)
        self.center = rect[0]
        self.width = rect[1][0]
        self.height = rect[1][1]
        self.rotation = rect[2]

    @property
    def min_bacteria_size(self):
        return Bacteria.min_bacteria_size

    @min_bacteria_size.setter
    def min_bacteria_size(self, min_bacteria_size):
        # min_bacteria_size in fm²
        self.min_bacteria_size = min_bacteria_size * 10 ** -15

For min_bacteria_size there is default value, but it should be possible to change this value for all objects and the class itself. Since i want to set the variable min_bacteria_size in femto (10^-15) units i tried to use property setter but it doesn´t worked:
Bacteria.min_bacteria_size = 50
print(Bacteria.min_bacteria_size)
>> 50

A: I think you're looking for classmethod in python.
class A:
    a = 3

    @classmethod
    def set_a(cls, value):
        cls.a = value * 10  # or whatever calculation

    def update_a(self): # use in other functions as normal
        self.set_a(10)

a = A()
a.set_a(3) # use classmethod
print(A.a) # 30
a.update_a() # or normal
print(A.a) # 100

A: class SetSize:
    def __init__(self, storage_name):
        self.storage_name = storage_name

    def __set__(self, instance, value):
        instance.__dict__[self.storage_name] = value * 10 ** -15

class Bacteria(Contour):
   min_bacteria_size = SetSize('min_bacteria_size')

I couldn't test it but this idea would help you I think.

A: Your code is almost just right - just two points of confusion: the name of
the class attribute where the value is stored must not be the same name as the property itself.
The major problem with your code is that when you create the property, you overwrite the default class value. Then your setter sets the new value to the instance only (self.min_bacteria-size) - instead of the class (self.__class__.min_bacteria_size) - however, if it were written exactly like that, it would overwrite the property itself - so it could be used only once.
Then, there is a 3rdy point, if you will sometimes to see the value in raw meters (the number already multiplied by 10e-15) and sometimes the number in femtometers (the human friendly "50") - you should make BOTH numbers available when reading from the class instances (even if the raw pre-multiplied metric value is only used internally by the class).
So, one way to go is to have an ordinary class attribute which holds the raw value in meters, and a property that will scale and store that same attribute, to be consumed by the code that uses the class:
class Bacteria(Contour):
    min_bacteria_size_raw = 22.56 * 10e-15

    def __init__(self, contour):
        ...

    @property
    def min_bacteria_size(self):
        return self.__class__.min_bacteria_size_raw / 10e-15

    @min_bacteria_size.setter
    def min_bacteria_size(self, min_bacteria_size):
        # min_bacteria_size in fm²
        self.__class__.min_bacteria_size_raw = min_bacteria_size * 10e-15

And here is the class working (with a dummy "contour" class) on the interactive prompt:

In [9]: b = Bacteria(1)

In [10]: b.min_bacteria_size
Out[10]: 22.56

In [11]: b.min_bacteria_size = 50

In [12]: b.min_bacteria_size
Out[12]: 50.0

In [13]: b.min_bacteria_size_raw
Out[13]: 5e-13

# And checking a new instance:

In [14]: Bacteria(2).min_bacteria_size
Out[14]: 50.0

Note that te way properties work, you can't retrieve the transformed value from the class itself with Bacteria.min_bacteria_size: that will retrieve the property object itself. It is possible to create an object just like a property, but that will return the guarded value instead of itself when called on the class - but unless you really need this, or if you will want this for several classes and values, it would be overcomplicate the code. You can easily just invert the logic, and keep the class attribute value in fentometres, and use the property to get the multiplied meter value - that way the human friendly value is readl available as a simple class attribute, just like the multiplied value is in this implementation:

In [15]: Bacteria.min_bacteria_size
Out[15]: <property at 0x7fa61e469f40>

In [16]: Bacteria.min_bacteria_size_raw
Out[16]: 5e-13


text:
Q: Java - How can I ensure I run a single instance of a process in a clustered environment I have a jvm process that wakes a thread every X minutes.
If a condition is true -> it starts a job (JobA).
Another jvm process does almost the same but if the condition is true -
    it throws a message to a message broker which triggers the job in another server (JobB).
Now, to avoid SPOF problem I want to add another instance of this machine in my cloud.
But than I want  ensure I run a single instance of a JobA each time.
What are my options?

A: There are a number of patterns to solve this common problem. You need to choose based on your exact situation and depending on which factor has more weight in your case (performance, correctness, fail-tolerance, misfires allowed or not, etc). The two solution-groups are:

*

*The "Quartz" way: you can use a JDBCStore from the Quartz library which (partially) was designed for this very reason. It allows multiple nodes to communicate, and share state and workload between each other. This solution gives you a probably perfect solution at the cost of some extra coding and setting up a shared DB (9 tables I think) between the nodes.

*Alternatively your nodes can take care of the distribution itself: locking on a resource (single record in a DB for example) can be enough to decide who is in charge for that iteration of the execution. Sharing previous states however will require a bit more work.


text:
Q: How to convert MVC ViewModel with multiple List properties to JSON for passing to Angularjs Below is my MVC View model
public class UserViewModel
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int UserID { get; set; }
    public IEnumerable<Role> LstRole { get; set; }
}

I need to convert this to JSON in controller action method which emits JSON to angularjs function
Below is my action method in controller
public string GetAllUsers()
{
    objUserView.LstRole = objUserManager.GetAllRoles();
    objUserView.FirstName = "Test";
    objUserView.LastName = "Test 1";
    objUserView.UserID = 1;
    return JsonConvert.SerializeObject(objUserView.LstRole, Formatting.None, new JsonSerializerSettings()
    {
        NullValueHandling = NullValueHandling.Ignore,
        TypeNameHandling = TypeNameHandling.All
    });
}

When I run this action method it gives below error

Self referencing loop detected for property 'Role' with type 'System.Data.Entity.DynamicProxies.Role_EE4037A57E80F8AE5D8E070E7325B72D7AE3916C26C19F53CB6F5084B2181234'. Path '$valuesenter code here[1].UserMasters.$values[0]'.

Please assist

A: Add this ReferenceLoopHandling = ReferenceLoopHandling.Ignore to JsonSerializerSettings
like below
public string GetAllUsers()
{
    objUserView.LstRole = objUserManager.GetAllRoles();
    objUserView.FirstName = "Test";
    objUserView.LastName = "Test 1";
    objUserView.UserID = 1;
    return JsonConvert.SerializeObject(objUserView.LstRole, Formatting.None, new JsonSerializerSettings()
    {
        NullValueHandling = NullValueHandling.Ignore,
        TypeNameHandling = TypeNameHandling.All,
        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
    });

}

A: Did you try converting it on the view? Something like that may help: Convert view model data to json