Are bike saddles always removable from the saddle post?

Question: I want to buy a mountain bike soon and I've been doing a bunch or research. I noticed that some bike saddles can detach from the top of the saddle post, while others get removed with the whole post. There are a couple of things I want to know. Can all saddles be detached from the top of the saddle post? Are saddles that detach with the post of cheaper quality?
that's it, thank you
Comment: Would you provide a link to a picture of a saddle that seems not to detach from the post?
Comment: Basically all of the saddles I've seen detach from the seat post.  Are you thinking of seat posts with integrated clamps, vs the older cylindrical seatpost with a separate saddle clamp ?
Comment: Hey guys. I realized that i wasn't looking close at the saddles, and that they do actually detach. With a mix of a store employee telling me that I should detach the post in order to change the saddle. Thank you so much for responding, wishing you the best!
Comment: I've seen some very cheap bikes where the top of the seatpost was not your typical round knob but instead was flattened to allow the seat to be attached with a through-bolt.  But this would be very unusual on anything other than a cheap kid's bike.
Comment: @DanielRHicks Yeah I used to have that on my old bike when I was 12/13, so that makes sense. Thank you for clarifying !
Comment: I do have one bike with a custom bolted-on saddle - its a janky folding bike where weight/size savings have dominated.  And yes its dreadful, which shows how rare a bolted-on saddle is.   (an A-Bike )
Answer: Saddles are always removable from the seatpost or, in some cases, the seat mast. I am not aware of any arrangements where the saddle is made in one piece with a seatpost or equivalent part. Because saddles are extremely personal, and even a rider's own saddle preference can change over time, it seems unlikely that there are such construction arrangements - I suppose a weight weenie cyclist might be willing and able to make or commission a saddle without rails bonded to a carbon seatpost or seat mast topper, but that would be very niche application. It would also be pointless, because most high end stock rim brake bikes and even a number of disc brake bikes can be brought under the UCI weight limit.
That said, a very small number of bikes have a seat tube that extends up from the top tube, which I believe is called a seat mast. You would clamp your saddle in a seat mast topper, then mount that on the mast. You would cut the seat tube to the correct length, and the mast topper offers a small range of height adjustment in case you need to change your saddle height. Probably the most prominent example is the Giant TCR, pictured below.

The picture is from this Velonews Q&A session with Lennard Zinn, where he fields a couple of letters from readers who are trying to extend a mast that had been cut, or else to just get a bit more saddle height than their cut mast allowed for. This neatly illustrates the potential downside of the seatmast design.
To the original question: in this arrangement, I suppose you could just remove the seatmast topper along with the saddle. However, the saddle is manufactured separately from the topper - or else how would you change your saddle horizontal position?
Why on earth would anyone make such an item? It could be lighter than seat tube and seat post arrangement, although remember that the impact of small amounts of weight on cycling performance are negligible. Open Cycles uses a seat mast arrangement on its Open MIND bike, and their webpage says that it allows them to make the seat tube very thin, at about 25mm - recall that a thinner tube should have more compliance than a thicker one, which should increase comfort. Alternatively, Speedvagen is a small batch steel frame builder, and as best as I can determine, the seat mast arrangement is an aesthetic choice only, and it's one of their signature design elements.
A 2008 article from Road Bike Action discusses some of the potential advantages of seatmasts, but I believe some of the arguments are incorrect (e.g. aerodynamic seat tubes and posts are more widely available today, although the post tends to be proprietary to each frame). If my memory is correct, seatmasts may have had a brief bloom in popularity in the late 2000s and early 2010s, but clearly they have not become widely accepted.
Comment: Thank you for this in depth answer!!
Answer: There are in fact Carbon seatposts with the saddle as one molded piece.  Check out ControlTech for a good example.
Comment: Interesting - I can see three silver bolts going up into the saddle, so its clearly changeable, but has departed from the various common rail clamp systems to a literally-bolt-down design.  Good find of a halfway variation, and welcome to the site!
Comment: Integrated seat+post are also very common in bmx racing. Most bmx mini seats are permanently integrated with the seatpost.
Comment: @Criggie here's one that is definitely a solid piece: https://www.instagram.com/p/CHVhWpAnn17/
Comment: @PaulH that's a good answer all by itself.  Please post as an answer.


Can I find out the exact areas which each category covers?

Question: I have accessed a land use map and clipped the appropriate area I need to analyse. Is there a
way I can find the exact areas which each category covers?
Comment: I would use "ZonalGeometryAsTable" tool if you have this image classified with attribute table.To check if you have attribute table left click on lcm2007_25_gb.tif and go to attribute table.
Answer: 1. Tabulate areas
The more robust method of calculating areas is to use the Tabulate Areas geoprocessing tool within Spatial Analyst. This is intended to calculate a breakdown of areas for classified raster data for a series of zones. For example, if you need the area of each land cover class for each city or town within your study area. To get the total for everything, just pass in the polygon you used to clip your raster as the single zone.

The units of Tabulate Areas are linear unit of the raster's coordinate system

2. Raster attribute table
A less robust but marginally faster way of calculating total area for each land cover class is to look at the raster's attribute table. Right click on the layer in the Table of Contents, and click "Attribute Table". If that option is grayed out, then you'll need to run the Build Raster Attribute Table geoprocessing tool. The COUNT field in this table describes the number of cells with that value. You'll need to multiply this by the area of each cell to get the total area.
Comment: I have used the Tabulate Areas tool and have come up with the appropriate information. Do you know what unit this would be in? Pixels or actual areas?
Comment: @user36851 The units are actual areas, and correspond to the linear unit of the raster dataset's coordinate system. See the screenshot in my revised answer.
Comment: @user36851 Glad it worked! If you're all set, please mark this as answered.
Answer: Although you are dealing with an image and not a polygon layer for your land use classifications, a Planning Department would normally have this layer in a polygon format for future planned land uses.  My County has such a layer available for download.  If you had a Polygon land use layer, you can set up the symbology labels of your layer to show area using arcpy.  This script could be adapted to apply to any polygon layer for any single field unique value symbology classification, not just a land use layer.
I use a separator set of characters to split the base label from the area sum added by the script.  I just have to be sure the separator is not part of any base label.  That way the script can be run over and over with different selections or filters and replace the area values appended to the base labels.
For your map legend you probably would want to select the layer on the Legend dialog's Items page and check the setting to "Only show classes that are visible in the current map extent".  That way any unique category that only existed in the master layer and that did not actually exist in the current layer would be excluded from the legend.  The script below does respect feature definition queries and feature selections when accumulating the area of each category.  However, some additional modifications to the script would be required to make it actually only evaluate the areas of the polygons based on just the current visible extent if the features were not already selected.
Below is a sample script you can add to a script tool.  The script works even if you have grouped land use classifications:
# Name: ApplySymWithAreaLabels.py
# Purpose: apply the symbology from one layer to another and show area in labels

# Import system modules
import arcpy
from arcpy import env

#**** CUSTOMIZE THESE INPUT VARIABLES ****

# Set the current workspace
env.workspace = r"C:\Users\OWNER\Documents\ArcGIS"

# Assign a string for labeling area units.
areaUnitStr = "Acres"

# Assign a conversion factor for the area units.  Use 1.0 to use the layer's native units in float precision.
# Example conversions:
# Sq. m to Sq. km = 1.0 / 1000000.0 or 0.000001
# Sq. Ft. to Acre = 1.0 / 43560.0 or 0.0000229568411386593
# Sq. Ft. to Sq. Mi. = 1.0 / 27878400.0 or 0.000000035870064279155
areaUnitFactor = 1.0 / 43560.0

# Set the name of the layer in the map you want to symbolize
layerName = "Land Uses"

# Separator character(s) variable to split base label from area
# make sure the separator is not part of the actual base label
separator = ' - '

# Define a label template string.
# In particular set the number of decimal places for the second parameter
labelTemplate = '{0}' + separator + '{1:,.2f} {2}'

#**** SCRIPT BELOW SHOULD NOT NEED REVISION ****

# Point to the current active map
mxd = arcpy.mapping.MapDocument("current")

# Set layer to apply symbology to
lyr = arcpy.mapping.ListLayers(mxd, layerName)[0]

# Get the field that sets the symbology
valueField = lyr.symbology.valueField

# Get the list of unique land use categories in the layer
classValuesList = lyr.symbology.classValues

# Get the list of unique land use labels without area
classLabelsList = lyr.symbology.classLabels

valueDict = {}
# Assign all layer field classification values to a dictionary with the cumulative sum of their areas
with arcpy.da.SearchCursor(lyr, [valueField, "SHAPE@AREA"]) as searchRows:
    for searchRow in searchRows:
        keyValue = searchRow[0]
        if not keyValue in valueDict:
            # When keyValue is not in the dictionary insert it and store its area
            valueDict[keyValue] = searchRow[1]
        else:
            # When keyvalue is already in the dictionary cumulatively sum the area
            valueDict[keyValue] += searchRow[1]

# Create a class dictionary to track the cumulative sum of grouped classifications
labelsDict = {}
# iterate through all class values in the layer
for i in range(len(classValuesList)):
    classValue = classValuesList[i]
    classLabel = classLabelsList[i].split(separator)[0]
    if not classLabel in labelsDict:
        # Initialize the class dictionary with 0 area
        labelsDict[classLabel] = 0
    if classValue in valueDict:
        # cumulatively sum areas of actual individual layer classes into the grouped classifications
        labelsDict[classLabel] += valueDict[classValue]

    classLabelsList[i] = labelTemplate.format(classLabelsList[i].split(separator)[0], (labelsDict[classLabel] * areaUnitFactor), areaUnitStr)

# Assign the ordered labels to the classes
lyr.symbology.classLabels = classLabelsList

# Refresh the Table of Contents to reflect the change
arcpy.RefreshTOC()

# Refresh the Active View to reflect the change
arcpy.RefreshActiveView()

The script created the output below for my land use polygon layer.  It converted my native area units from Square Feet to Acres.  It would have handled any grouped classifications if I had set them up in the master layer.
You should save a master layer file to disk that has the layer symbols, labels (with out area values) and order set up the way you want it for all possible classes of land use categories as a backup to get the base labels.  Unfortunately the Apply Symbology From Layer tool does not respect the category order of the saved layer, so you have to use the manual Desktop Symbology Import option to get the symbols to have the order you saved in your master layer file.  Otherwise I would use that tool and not use the Desktop Import button.  Support the idea to respect the source layer order when using the Apply Symbology From Layer tool and the Redesign the Symbology Dialog in desktop to make the resorting process easier, since once you get above 10 symbols the current dialog is a pain to override the default sort order.

You may want to change the script to accept parameters so that you could use the script tool to let you choose your output layer, saved master symbol layer, and/or area unit type and conversion factor at runtime.  The script could easily be modified to get other statistics, like the sum of the length of each category for polylines or polygon perimeters, or the count of features for any of the geometry types.
Answer: I am not sure how much are you familial with R, but I think there is the best and very simple solution of your problem:
library(raster)                  # read "raster" library
setwd("D:/Data/....")            # set you working directory

r<-raster("your_raster.tif")     # import your category raster file

t<-freq(r)                       # Calculate your raster frequency table -
                                 # it means how many pixels belong to 1
                                 # category and save it in a table "t"

# hereafter you have to know the area of 1 pixel (following your exemple I suppose it is 1m2).
# Multiply that value with the number of pixels in each category - from the second culomn od your table t -> (t[,2])

my.area<-t[,2]*1                 # 1 = area of 1 pixel
my.area.fin <- cbind(t, my.area)

                                 # export table to .txt:
write.table(area_fin, file="area_by_category.txt", sep="\t")

If you will have any problem with this script, you can send me your image/exemple data and I will adapt the script.
Good luck ! :)


Facebook SDK on Android seems to be persisting old user data

Question: I'm trying to log a user into Facebook using the Android Facebook SDK.  We have a Facebook app set up, and it's working on one of our devices.  However, when I try to log in on my test device, it shows me a screen saying
[Application name] is misconfigured for Facebook login.  Press Okay to go back to the application without connecting it to Facebook.
This is confusing given that it works on another device, and I have set the application up to use both a debug key and a release key, but even weirder is the fact that at the bottom of the screen it says
You are logging into [Application name] as [developer who left the project a month ago].
[developer who left the project a month ago] left the project a month ago.  I have uninstalled and reinstalled this app many dozens of times in the intervening period.  How on earth is his login data being persisted across all these sessions?  How can I get rid of it?
Answer: If a user is logged into the official Facebook application, these settings will be used by the Facebook SDK for login.  I hadn't realized [developer who left the project a month ago] was still logged into the Facebook app.


White Raspberries after a frost

Question: My raspberries have turned white.  They were red, but we had a frost and now are white, are they still okay to eat?
Answer: They won't poison you, unless the white is actually a mould of some sort and you're sensitive to moulds, but they may not taste great - the cold has probably caused the whitening effect, and will likely have damaged the tissues/cells of the fruits.  If you are going to eat them, do it as soon as possible - they'll start deteriorating rapidly now they're frost damaged. it is a little odd though - I regularly freeze raspberries, and they aren't white once defrosted, but possibly this effect is because the berries are still on the bush and weren't frozen solid.
Comment: and in general, late fall raspberries are not so tasty (not bad taste, just very water like). @bamboo I think the "sunny" raspberries had time to get the color inside the berries. In this case I think the color was still only on the peel. [Not sure, but in grapes it is so].

White Raspberries after a frost


Plaid Integration on Salesforce site page

Question: I have a requirement to integrate with Plaid from a Salesforce Site page. Below is the snippet from their documentation that I am embedding to my site VF page:
<code>(async function() {

  const configs = {

    token: '{!link_token}',

    onSuccess: async function(public_token, metadata) {

      // The onSuccess function is called when the user has successfully
      // authenticated and selected an account to use.
      await fetch('/get_access_token', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ public_token: public_token }),
      });
    },
    onExit: async function(err, metadata) {
      // 2b. Gracefully handle the invalid link token error. A link token
      // can become invalidated if it expires, has already been used
      // for a link session, or is associated with too many invalid logins.
      if (err != null && err.error_code === 'INVALID_LINK_TOKEN') {
        linkHandler.destroy();
        linkHandler = Plaid.create({
          ...configs,
          token: await fetchLinkToken(),
        });
      }
      if (err != null) {
        // Handle any other types of errors.
      }
      // metadata contains information about the institution that the
      // user selected and the most recent API request IDs.
      // Storing this information can be helpful for support.
    },
  };

  var linkHandler = Plaid.create(configs);

  document.getElementById('j_id0:frm:link-button').onclick = function() {
    linkHandler.open();
  };
})();
</code>
Link token is generated by making a callout in my apex controller. The javascript uses the token to render a webpage from plaid in an iframe. At this point, the site page opens the iframe and immediately closes it. When I add this to a simple HTML the iframe renders correctly. I have added the iframe domain as a trusted domain for my site and set Clickjack Protection Level to 'Allow framing of site or community pages on external domains (Good protection)'. I even tested by setting it to 'Allow framing by any page (No protection)' but it still exhibits same behavior. Any thoughts on what could be going wrong?
Answer: Okay I figured the answer! It had to do with the default submit action of the commandbutton that was reloading the page. Changing to commandlink fixed it.


Does printing more money necessarily lead to inflation?

Question: Does printing more money necessarily lead to inflation? For instance, if the money supply increased, but the money just sat around and wasn't distributed to people, would that still cause inflation? It seems like prices only increase when the amount of money consumers have also increases. But if the money printed isn't given to the consumers, I can't see why prices would increase
Answer: No it is not necessary. First trivially if you print money on money printer and immediately from the printer you will shovel the money into huge pit and then cover the pit by tar it would have no effect on the economy whatsoever.
Next, less trivially inflation depends on not just money supply but also money demand. A simple model of money market equilibrium can be given by:
$$M/P=L(Y,i) \implies P=M/L(Y,i)$$
where $M$ is money supply, $P$ price level (positive change of which is inflation) and $L$ money demand that depends positively on real output $Y$ and negatively on the interest rates $i$.
No matter what the change of $M$ occurs as long as $Y$ or $i$ sufficiently change $L$ to offset change in price level there won't be inflation. Of course, while it is easy to increase money supply by extremely large amount, it is extremely hard to change productive capacity of an economy in real life. Most developed economies grow by 1-2% on average. Interest rate cannot be also chosen freely because there is effective lower bound under which it cannot fall, and while there is no upper bound, rising interest rate too high too quickly will negatively affect economy.
However, this not much to do with to whether the money are given to consumers or not. The money can be spent by the government, or they can be all invested, as long as the money circulate in the economy and don't just sit under the bed they will have some effect on price level. However, as mentioned above the effect could be offset by changes in other variables in the economy. Generally it simply does not matter where the money are spend (i.e. consumption, investment, government sending) although there might be special cases such as deep recessions for example.
Comment: @AnthonyFallone But everyone's income changes. For example, suppose the gov investment is building new road. Government will first have to buy all the equipment like shovels and what not, this increase in demand for shovels will lead to higher prices of shovels (i.e. inflation) and there will be also indirect effects. The shovel store owner will now have extra profit and from that sale that he or she can use to buy some other goods and services. In addition both government and shovel store owner will have to hire employees. Those employees will buy goods and services pushing up prices further
Comment: It is impossible to spend money on goods and services or investments without generating income for someone else.
Comment: Mind elaborating on how government investing the money would lead to inflation? If everyone else's money/income remains at the same level, I don't think it would make sense for prices to be raised considering the average person's amount of spendable cash didn't increase any
Comment: Got it. Thank you for explaining
Answer: This question is related to a very similar one asking if If no one knew about inflation, would inflation take place?.
Printing money is a more often than not a misnomer because most of the time central banks do not literally print money when they increase money supply. The FED for example isn't even in charge of printing physical money.
Most central banks buy securities, usually high quality liquid assets (mostly government bonds), and credit the amount to the reserves of the seller of the bond, which are big banks. If the banks literally would not do anything with this money, there would be no impact on inflation.
To some extent, that is also what happened in the last ~10 years, where the monetary base (what the central bank controls) increased significantly, but larger monetary aggregates did not change the growth trend much. This can be seen in the picture below from another answer which plots the monetary base, M1 and M2 (normalized to Dec 2005 = 100 for each series), and add shaded regions for the timing of the 3 phases of QE (details can be found in the link).

Largely for this reason (lack of it impact on real economy of traditional monetary policy), there were other ways created how banks can get liquidity, like the TLTRO programs in Europe for example. The amount (and interest rate) that banks can borrow is linked to their loans to non-financial corporations and households. This results in better transmission of monetary policy to the real economy.
That the terms for these existing TLTROs changed already twice is another issue that is not important here...
Comment: "Money printing" is used in a figurative way. But that's what the central bank does electronically when it buys government or other securities. It creates reserve money that is credited to the seller (and can be converted into broader money). At the same time, the CB's balance sheet expands.


Does PDF level compression implicitly cleans file of malware?

Question: Recently I've been looking into PDF files security, specifically about malware exploiting vulnerabilities in PDF readers. I thought about one thing - does compressing PDF file (for example, by using qpdf) create as to speak "new" file (assuming it was infected before with JS, pdf viewer exploits etc) clean of these problems?
Im asking because while Im somewhat aware creating new file (with Ghostscript for example) most likely would do that, but never really found out about simple compression of said file (GS doesn't do that as far as I know).
Comment: What "malware" you are talking about? Social engineering using PDF, embedded files (which need external activation to do harm), malware exploiting vulnerabilities in specific PDF readers, ... ?
Comment: Sorry for not being specific, I was asking about exploiting vulnerabilities in specific PDF readers.
Answer: PDF level compression is only about reducing the size of the content, not about removing content. So it depends if the vulnerability was triggered by the content no matter how encoded/compressed it was or if it was triggered only with a specific form of encoding/compression (or no compression). The latter is likely the more rare kind of vulnerability, so in most cases compression probably does not make the PDF file sufficiently clean.
Comment: Thanks for explaining it in such straight-forward way.


Code compliance for outdoor 20 amp receptacle?

Question: Looking to add a 20 amp receptacle on the outside of my house, on a separate circuit. I don't know what NEC codes to look out for. It will be on the outside wall of the house, if that helps. The code I am familiar with is using the correct gauge for a 20 amp circuit.
Answer: For an outdoor 20 ampere circuit, you'll need a

20 ampere breaker, obviously.
Minimum 12 AWG conductors.
GFCI protection either via a breaker, standalone device, or receptacle.
Weather-resistant type receptacle.
A weatherproof in-use receptacle cover (identified as "extra-duty").

If the box is not in the wall, you'll also need

A weatherproof enclosure.
Wet location rated protection of the wires via conduit, rated cable sheath, or other approved raceway.
Comment: Does LFMC count as Wet location rated protection, the house is brick so the box won't be in a wall.
Comment: Liquidtight Flexible Metal Conduit (Type LFMC) can be used in a wet location. However, it cannot be used where subject to physical damage. If it would be in danger from a weed whacker, you might not want to use it. It shouldn't be a problem, but you'll also want to make sure it's not exposed to temperatures in excess of the rating (*-30°C (-22°F) - 80°C (176°F)*).
Comment: so, are we talking sch 80 PVC then? weed wacker damage is possible, though unlikely lol.
Comment: If you have LFMC laying around, I'd check with the local building department to see what they think.  I can't see where you're installing it, so I can't say for sure from here.


Why can't I use a Live Photo as a wallpaper

Question: I've got an iPhone 6. I know it is capable to set a live photo as the device wallpaper. But I couldn't do it because it only gives me 'still' and 'perspective' as the options. So how can I set a live photo as a wallpaper?
Answer: iPhone 6 does not support live wallpapers. You need to use a jailbreak tweak like LiveWallEnabler to enable live wallpapers using long press on a device without 3D Touch hardware.

Why can’t I use a Live Photo as a wallpaper


Why does sandboxie require admin privileges when it runs a software installer that requires it?

Question: Shouldn't it just "emulate" the admin privileges like everything else? Why dose it actually require it? And is there any security problems with that?
Answer: This is a generic answer, since I haven't looked at sandboxie in most of a decade.

There are many software functions that can't be meaningfully sandboxed. Either they are things which inherently require high privileges (like installing drivers or otherwise interacting with the kernel) or they lose their value if sandboxed (a virus scanner that can't read most of the file system is a pretty worthless thing). There are also things which could, in theory, be done by a lower-privilege account or sandbox, but only of the OS is configured with non-default values to allow this (such as installing a Windows Service).
Some such things can be "emulated", but often doing so amounts to creating a miniaturized OS installation that can't interact with the host system. This can be useful for some sandboxing - it's essentially what a VM is, and can also be used with container systems such as Docker - but again that only works for software that doesn't need to interact with the host system at all.
Sandboxed processes frequently, at installation, need to perform some privileged operations. These might be simple things, like changing a file association to open with the new program (that can be done on a per-user basis if the installer is not sandboxed, but if you want it machine-wide the installer must run as Admin, and in any case it can't be emulated). They also can be relatively complex, like creating a new Windows account and installing a Windows service that automatically runs under it when certain conditions are met; depending on what the service does / what permissions it has and what conditions it starts under, this might technically be possible to emulate but it would be very complicated to detect an installer trying to do this and fake support for it.

As for security problems, there certainly can be, if the installer is malicious (e.g. a Trojan) or simply sloppy (perhaps it changes the ACLs on some directory to make it easier for the app to operate, but now other non-admin users can overwrite important files). Most commonly, though, sandboxie and software like it is intended to contain the damage from an exploit, rather than to contain known-malicious software, and the behavior with installers reflects this. Installers typically run only once for a short time, do not typically consume untrusted input (a browser consumes web content from Internet servers; a browser installer does not), and are often fairly simple programs. In other words, they have minimal attack surface.
Consequently, it is very unlikely that an attacker would be able to compromise an installer while it runs, so - so long as you trust its author to not be malicious - there is no need to limit what it can do. Limiting it anyway would break a lot of installers for very little gain. While sandboxie and similar are absolutely intended to be capable of containing malicious code, it is a very reasonable assumption to trust a vulnerable program's installer to not be malicious (if the user chose to run it), while still not trusting (and thus sandboxing) the installed program.


Best recovery for elementry os

Question: What is the best over-all recovery program/procedure
for elementary ?
(Is the a way to backup in a way that the instance (system + my files) is fully recovered ? from external disk)
Ilan
Answer: I have had success using Timeshift for the elementary os system files and Back in Time for my personal files. I go over my reasoning and the procedure I use in this video.

Best recovery for elementry os


Reserve fixed RAM memory region as a block device ( with a given start physical address)

Question: There have been a lot of questions about RAM Disks and I am aware of ramfs and tmpfs which allow the use of ram as a block device. However my interest is in using a fixed memory address range as a block device.
This arises from the necessity to use non-volatile RAM available in my system. I have 6GB of RAM available, and 8GB of non-volatile RAM present. The output of /proc/iomem gives me the following
100000000-17fffffff : System RAM
180000000-37fffffff : reserved
Here the region from 6GB to 14GB corresponds to the Non-volatile RAM region which is marked by the E820 BIOS memory map as reserved. My main intention is to use this NVRAM as a block device in linux. This is useful for testing NVRAM systems. Is there any linux command already present which would allow me to use this region as a block device, or do I have to write my own kernel device driver to facilitate the same?
Comment: Just curious, why would you want to do this?
Comment: It provides an easy way to test filesystems designed for Non-Volatile RAM on linux.
Comment: @qstack Did you ever get this working? I have a similar issue and would value any thoughts you have: https://unix.stackexchange.com/questions/634988/allocate-ram-block-device-faster-than-linux-kernel-can-normally-allocate-memory
Comment: I believe you already have a solution.
Answer: I am not an expert on device drivers, however here are some pointers for your R&D:

if memory is marked as "reserved", the OS cannot touch it; you will have to find a way to either have the BIOS mark it as available to the OS, or use direct low-level ioctls to control it
if Linux could see the memory, you still would not have an easy way to prevent Linux from using it as any other block of RAM; an attempt could be tried by marking such RAM as "bad" and then modifying the kernel to still make a special use out of it (please check kernel documentation regarding this, it has changed a lot since last time I hacked into it and it's evolving at a great speed)
considering the above as a preliminary (and non-definitive nor exhaustive) feasibility study, I would say writing your ramdisk blockdevice driver is the most sane option in your case, and perhaps you should contribute it back to Linux kernel and/or team up with people already trying this (perhaps a better place for this question is the Linux Kernel Mailing list, if you haven't yet posted there)

Some other relevant sources:

Current ramdisk driver
A somewhat old (2005) document about block drivers
A simple block driver for Linux Kernel 2.6.31 (careful: a lot has changed in time)
Answer: Before the introduction of tmpfs / initramfs there was ramdiskused to load the initrdimages, a pre-defined fixed size block devices, I think contiguous, at least on earlier implementations.
The block driver itself doesn't have parameters for the memory address, only the size, but the kernel used to load initrd images at a pre-defined address (by config) so a peek into main / init kernel code could help (I would be surprised if ramdisk aren't supported anymore for initrd but since initramfs is around, a lot of years now, never used ramdisk anymore).
The driver source was drivers/block/rd.c, if I see correctly now is drivers/block/brd.c .
Else, looking for ramdisk I found an implementation that looks interesting:
Disk on RAM — Playing with Block Drivers


How to show L is non-regular without pumping lemma?

Question: $L=\{(ab)^n : n\text{ is a natural number apart from }6\}$, I want to show L is non-regular by finding an infinite set of L-distinguishable words. Could you help me?
Answer: Well, you can't show that it is not regular, because it is regular.
Indeed, $L = (ab)^*\setminus \{(ab)^6\}$, and $(ab)^*$ is regular (concatenation + kleene star), and $\{(ab)^6\}$ is regular (because it is finite), and regular languages are closed under difference.


line bundles on smooth affine variety

Question: Let L be a line bundle on a smooth affine variety X (say, over complex numbers). Is it true that L always admits a FLAT algebraic connection?
Comment: Yes, a line bundle on a compact Kähler variety has a connection iff it has a
flat connection. This follows from the Hodge decomposition of de Rham
cohomology, the obstruction for finding a flat connection lies in
$H^1(X,\Omega^{\ge1})$ and the obstruction for finding a connection is its image
in $H^1(X,\Omega^1)$. By the Hodge decomposition (and the fact that the
obstruction is of type $(1,1)$), if the latter vanishes so does the former.
Comment: Is this motivated the Atiyah class, which lives in coherent cohomology and thus vanishes for affines?

The vanishing of this class implies the existence an algebraic connection. Moreover, one can compute the Chern classes in Dolbeault cohomology from the Atiyah class. If the variety is complete, so that Dolbeault cohomology is pretty close to de Rham cohomology, does the vanishing of the Atiyah class imply the vanishing of the rational Chern classes? or is something lost in the extension data?
Answer: No, any line bundle with a flat connection has a trivial rational Chern
class. Now, take any smooth connected projective variety $X$ for which the Chern classes of
line bundles form a group of rank $r$ larger than $1$. Removing an irreducible ample
divisor $D$ from $X$ gives a smooth affine variety for which the Chern classes
form a group of rank $r-1$. A specific example is $\mathbb P^1\times\mathbb P^1$
but there are lots of others of any dimension $>1$.
Comment: This is a standard argument (found in Hartshorne for instance): There is a section of $\mathcal O_X(D)$ which vanishes exactly at $D$ and hence gives a trivialisation of it in the complement. This (and its tensor powers) is the only line bundles killed and every line bundle on the complement extends to $X$.
Comment: Dear Torsten Ekedahl, could you please explain why the Chern classes group of the affine variety $X \setminus D$ is of rank $r-1$, because I don't really get it...
Answer: No, there is no reason for an an $O$-module, even locally free rank 1, to be a $D$-module.
Comment: For the edification of humanity?  I mean, what's the point of writing the answer otherwise?
Comment: Um, care to provide a counterexample? My intuition is the same as yours, but I couldn't come up with a counter-example on an affine variety (of course, there are lots on quasi-projective ones).
Comment: Why should I? It is obviously wrong and the guy is trying to prove something using it and he really should not:-)) And, anyway, Torsten has done it already and got my point for it...

line bundles on smooth affine variety


Isn't counting sort a better sorting algorithm for linked lists rather than merge sort?

Question: I have to analyze how every sorting algorithm's complexity would change if it had to sort a linked list and which of all of them is the most efficient. I find everywhere that merge sort is the most efficient one for linked lists, but I don't understand why counting sort isn't better. I think it would still be O(n). Am I missing something? Same with bucket sort and radix sort, would the complexity change with a linked list?
Comment: it was a question that appeared in a past final exam so I don't think they expect something so trivial like copy the linked list to an array.
Comment: If the sort is to be accomplished by rearranging the existing nodes -- neither changing their assigned values nor creating or destroying any -- then Counting Sort is not even an option.  It cannot do such a rearrangement.
Comment: The complexity of counting sort depends on the range of the integers to sort. Furthermore, what do you mean by sorting a linked list? We can copy a linked list of length $n$ into an array in $O(n)$ time, sort the array and then built back the sorted list in $O(n)$, so each algorithm can sort in the same complexity of standard arrays because linked lists are less powerful than arrays so we can't do better for sure.
Comment: @Zumikya Did the exam question give any indication of what measure of performance you were to consider? In terms of big oh complexity no comparison-based sort can do better than $\mathcal{O}(n \log n)$, and as Silvio pointed out you can usually convert between container representations within $\mathcal{O}(n)$; converting before and after is always going to be subsumed in the complexity of any algorithm that isn't sub-linear. So the the optimal big-oh complexity is always going to be the same on arrays or linked lists, which suggests they want a different measure than big-oh complexity.
Comment: @Zumikya Or do they want you to consider **non**-optimal implementations?
Comment: I've found that counting sort is usually faster than mergesort or quicksort as long as `k` (the absolute difference between the largest and smallest element) is within an order of magnitude of `n` (the length of the list).  Personally I would only use counting sort if `k` was within `2*n` and only if I really needed the extra runtime performance.
Answer: You are comparing apples and orange-colored bicycles here.
Merge Sort is a stable Comparison Sort. As such, it only requires that there must be a Total Preorder over the elements.
Comparison Sorts have a lower bound asymptotic worst-case step complexity of $\mathcal{O}(n\log{}n)$. Therefore, Merge Sort's asymptotic worst-case step complexity is as good as it gets for Comparison Sorts. There cannot be a Comparison Sort with a better asymptotic worst-case step complexity.
Counting Sort is a Non-Comparison Sort. Non-Comparison Sorts can be faster than Comparison Sorts, but they can only do this by exploiting some additional information or structure about the inputs that makes them less general than Comparison Sorts.
For example, Counting Sort can only sort small non-negative integers, but has an asymptotic worst-case step complexity of $\mathcal{O}(n + |r|)$, where $|r|$ is the size of the range of possible inputs. Merge Sort can sort elements drawn from an arbitrarily large range, such as integers, which is something Counting Sort cannot do.
Radix Sort can sort anything that can be ordered lexicographically. Its asymptotic worst-case step complexity is $\mathcal{O}(wn)$, where $w$ is the length of the sort key. Merge Sort can sort elements based on an arbitrarily large sort key, which is something Radix Sort cannot do.
Bucket Sort works by distributing the elements into buckets, then sorting those buckets using a Comparison Sort. The worst-case is when all elements end up in the same bucket, in which case Bucket Sort simply degrades to whatever sorting algorithm is used to sort the buckets. Since the sorting algorithm for the buckets is a Comparison Sort, its asymptotic worst-case step complexity cannot be better than $\mathcal{O}(n\log{}n)$, and thus neither can Bucket Sort's.
Typically, Bucket Sort is used with an Insertion Sort for sorting the buckets, which has an asymptotic worst-case step complexity of $\mathcal{O}(n^2)$.
In order to actually reap the benefits of Bucket Sort, a priori knowledge about the distribution of inputs is required.
In other words, unless you have some additional a priori knowledge about the elements of the linked list, you can only use Comparison Sorts, and Counting Sort, Radix Sort, Bucket Sort, and friends are not even an option.
Comment: Also note for readers: the famous $\mathcal{O}(n \log n)$ lower bound on comparison sorts is a bound on the number of **comparisons**. If you're sorting small things like machine-level integers, doubles, etc, then one comparison is a cheap constant step. But if you're sorting large variable-size things like strings or complex data structures, then one comparison is *itself* often involves a (variable) number of steps. When comparing comparison to non-comparison sorts; be careful that complexity bounds you're comparing are actually bounds on the same measure of "steps".
Comment: @Ben: If comparison is $\mathcal{O}(k)$ for some key size k, then the bound is $\mathcal{O}(kn \log n) < \mathcal{O}(kn \log kn)$, so it still works as a loose bound if you reinterpret $n$ as $kn$ (i.e. interpret $n$ as the total size of all keys, instead of the number of keys). This is not the conventional interpretation, but quantifying in terms of the total volume of data (ignoring the shape of that data) is not wholly unreasonable. Alas this does not work if your keys are nonlinear to compare, but I've never heard of such a comparison function.
Comment: I wouldn't say that radix sort can't sort arbitrarily large keys, it's rather that it requires some ability to split keys up into parts or "digits" (which must have the property that the order of keys with non-equal leading digits can be computed solely from the leading digits). Just about anything *can* be split up that way, but it's a different (and more complicated) requirement from just having an ordering function.
Comment: @Kevin: String compares hopefully have an early-out if they differ (although most sorts compare strings that are lexicographically close so the early-out might only be after the first word of a few bytes).  Anyway, worst-case for a given `k` is long identical prefixes, best case is uniform random distribution at each character position.  For many use-cases, I'd guess there are enough different prefixes to at least make the early passes do a lot of early outs.  So typical average case might be closer to `O(n log n)` than to `O( kn log kn)` (or to `O(kn log n)`?)
Comment: @JörgWMittag - The other thing Counting Sort can't do is sort structs that have data other than the sort key.  Such as linked-list nodes, as John Bollinger commented under the question.  Radix Sort could, perhaps even sorting pointers to list nodes and then rewriting their links later so they don't have to be destroyed and recreated.
Comment: Are there any sorted-dictionary data structures with O(1) insert and lookup?  You could histogram big integers or strings into a hash table in O(n) time with a normal hash table with amortized O(1) insert and lookup, but that doesn't let you retrieve the counts in sorted key order.  Python 3 at some point changed their Dictionary type to be a sorted dictionary, but IDK if that meant giving up the possibility of an O(1) implementation.
Answer: Counting sort is a very particular kind of sort which you can only apply in particular circumstances.

If the elements you're sorting are floating-point numbers instead of integers, counting sort doesn't work.
If the elements you're sorting take their values in a huge range with more possible elements than actual elements in the list, then counting sort is probably not worth it (and would have a high space complexity in addition to time complexity).
If the elements you're sorting are not numbers, but complex objects with one number field that you're sorting on, then counting sort doesn't make any sense (although bucket sort would be a possible generalisation for that case).

If you find yourself in a particular situation where counting sort can apply, sorting n integers taking value in range [1, k], then:

Merge sort has time complexity O(n log(n)) and space complexity O(n);
Counting sort has time complexity O(n + k) and space complexity O(n + k).

If you find yourself in this particular situation and if k and n are such that k ∈ O(n), then counting sort is more efficient than merge sort.
Answer: There is nothing wrong. Counting sort is definitely better in the sense of having a lower time complexity if the integers have a fixed range. And they very likely had a fixed range when you generated the data, even if you didn't realize it.
But remember what a lower time complexity means: It will eventually be faster than the algorithm with higher time complexity with a large enough n. Your n is just not large enough. It might be discouraging if you pick an n much smaller than the range, as counting sort may appear significantly worse. But just try again using an n so that you will wait for minutes for it to finish. There isn't anything that deep here.
Answer: A recursive bucket sort can have time complexity O(n*log(k)/log(n)).
The space needed is O(n).
Answer: I've found that counting sort is usually faster than mergesort or quicksort as long as k (the absolute difference between the largest and smallest element) is within an order of magnitude of n (the length of the list).  Personally I would only use counting sort if k was within 2*n, and only if I really needed the boost in runtime performance.  I've never been in a situation where I needed this.
Keep in mind that this would still take up quite a bit of extra space.
It is possible (though not advisable) to make counting sort work with non-integer types such as floating-point numbers, or even strings - but only if you're willing to write your own custom logic to map integers to non-integer values (ordinary hashing wouldn't work because it's not reversible).  Again, I can't see this as being useful in most real-world situations, and the space complexity would probably be horrible.
However, there are some hypothetical situations where counting sort/pigeonhole sort would be a no-brainer.  The most obvious would be if you knew ahead of time that the integers to be sorted were distinct and that, when sorted, they would compose a sequence of the form min, min+1, min+2...max.  In such a case, you would only need to compute the min and max and generate a list of integers within that range in a loop.
In fact, if you knew that min was 0 in this case, you wouldn't even need to compute max, or even look at the source list's elements at all; you could just output all integers from 0 to n-1 with a simple loop.


How to create a dynamic destination with BlazeDS

Question: looking for advice about how to structure the comms of a blazeds/flex game. What I'm trying to achieve is to have x no. of games occuring on the server each of which will contain 2 to 6 players. i think this will involve segmenting a feed, by creating a subtopic. eg game A gets filled with Player A + Player B, a dynamic destination gets created on the server side, and the new destination id gets returned to the clients. Not sure if I have that correct - to give some further background - the main server side code for a 2 player setup is here
Connecting multiple flex clients to a single java class
Cheers
Answer: Creating runtime remoting destinations in BlazeDS and LiveCycle Data Services


How to prevent Cookie-Bombs?

Question: Egor Homakov made a nice writeup (Cookie Bomb or let's break the Internet) on how to crash CDNs and other websites with cookies.
Although this is a user/browser-side DOS, I'm wondering how one would stop this on the server-side.
Answer: Most browsers have a limit on how many cookies they'll store for a single TLD.  So, if the server is configured to allow a sufficiently large request to include all these cookies, the requests won't be rejected anymore.  Apache has options like LimitRequestFields, LimitRequestFieldSize, etc.  Setting these sufficiently high should allow the request to be processed with all the attacker-added cookies, though at a memory and processing time cost.
Of course, if you control the entire domain, there's other mitigations possible,
since it requires that an attacker is able to author content that sets cookies on *.targetdomain.com, it is only possible to exploit with attacker-controlled content on that domain.  So if attackers are not allowed to create server-side scripts (i.e., anything that can send Set-Cookie) or craft JavaScript (that can set cookies via document.cookie) then you'd be vulnerable.  So clearly, the mitigation is not allowing users to create content on those domains.
Answer: You really can't.
The issue is that the cookies are client-side and there are only two methods to fix the problem: ignore/accept the cookies or delete them.
The former is probably easier than the latter, but I would not recommend it. There's a reason to keep cookies small -- they're not the full meal. (Why on earth would a server want to accept a half-megabyte cookie header...? Most web pages are only 2MB or so.) So, yes, you can ignore or accept whatever size header the client sends you, but that's bad practice.
You could delete the cookies with your own JS, but that's only possible if you know the cookie's name, domain, and path. And while you might be able to clear all the cookies for your domain, you'd run into two issues: (1) You'd remove all your other cookies, unless you had some really good JavaScript, and (2) you'd only remove cookies for your domain -- missing the other blocked sites.
edit: read David's answer because he mentions on not letting users write custom JS for your site which I skipped over.
Good reads: Maximum on http header values? and How can I delete all cookies with JavaScript?

How to prevent Cookie-Bombs?


How to share asp.net Session into WCF service

Question: Im using asp.net website with WCF service, having wsHttpBinding,Aspnet compatibility enabled, specified as Sessionmode -allowed, service behavior- isinitiated and client session cookie enabled. Its looking like Asp.Net session object and WCF Session( HTTPContext.Current.Session) work independently. How can I share Asp.net Session value to WCF Session and vise versa.
Answer: Instead of making your web service dependent on the hosting environment I would suggest you adding the needed parameter to the operation contract so that it is passed by the consumer which in your case is an ASP.NET application that will fetch it from the session.
Comment: Thank you for reply, but my special case needs a lot of Session value settings and its practicaly impossible through parameter
Comment: If your service is so tightly coupled to your application why creating it in the first place? For them to share the same session the service needs to be hosted in the same application pool and virtual directory as the application. Then you need to include the ASPSession_Id cookie along with the request and the service might be able to read session data but once again I would strongly discourage you from doing so. You may look at this post: http://www.sajay.com/post/2006/08/03/Using-a-Session-in-WCF-through-AspNetCompatibility.aspx
Comment: Yes, I gone through that, I have already implimented what he says and still  its not working. My issue is like I am converting an existing Webservice.asmx to WCF which has hell lot of session dependency.. for the moment I cant avoid that bcz existing applications are consuming it.. I appreciate if u have seen any such reference in net
Comment: Can we take Session values from SessionId if we share the asp.net session Id to WCF service  through any parameter???
Comment: No, it needs to be passed as cookie along the SOAP request.
Comment: ooopps, its cracking ..ofcourse microsoft might have made an alternative for existing systems :(  anyways, thank you for suggestions :)
Answer: in your service interface:
<code>[ServiceContract]
public interface IService
{
    [OperationContract]
    string GetSessionValue();

    [OperationContract]
    void SetSessionValue(string value);
}
</code>
in your svc:
<code>public class Service1 : IService
{
    public string GetSessionValue()
    {
        return "your value";
    }

    public void SetSessionValue(string value)
    {
        // your code here
    }
}
</code>
and finally consume that method from web code behind.
Comment: good , that is an idea, but I have hundreds of session values to get and set..setting these values for each service call not good, that is, to call a service method, I have to call these two methods every time..:(
Answer: I searched a lot but could not find a way. Only option I found is use cookie enabled service in same virtual directory. Better to keep it as RESTful service
Answer: Look at "Managing shared cookies in WCF"


Do snapshots of Encrypted Disk Images weaken security?

Question: I have read/write disk images encrypted with 128 AES using Mac's disk utility. If I snapshot the encrypted disk images daily (sometimes with changes other times without), and an attacker has access to these snapshots, will they be able to gain any parts of the plaintext? Will they be able to gain any metadata about the plaintext?
Comment: In general we're not so much Apple experts here; most of us would identify as cryptographers or cryptography enthusiasts. So it would help immensely if you would indicate the OS version that you are using and the algorithm & mode of operation used for the disk encryption (which must be somewhere in the documentation about the disk utility).
Comment: The OS version is Monterey 12.3.1, the algorithm and mode is XTS-AES-128.
Answer: Yes, snapshots of encrypted disk images weaken security. How much they do so depends on the exact algorithm, but it's impossible to have decent performance for disk encryption with perfect security if the adversary can make ciphertext snapshots: you'd have to reencrypt the whole disk all the time.
To have anywhere near decent performance, at a minimum, disk encryption doesn't re-encrypt data that hasn't changed. Therefore an adversary who obtains two ciphertext snapshots will know that certain parts of the data for sure haven't changed. Generally disk encryption has a granularity of sectors of a few hundred bytes to a few kilobytes. Figuring out what files have changed knowing what sectors have changed is typically hard, but it's not impossible.
To further improve performance (and secondarily storage density), disk encryption typically uses an algorithm with an implicit IV which is derived from the sector number. (If that isn't the case, the IV must be stored somewhere. So either the plaintext sectors are smaller than the disk sectors; or accessing a sector needs to access both the disk sector containing the ciphertext and the disk sector containing the IV.) Thus, when a sector is re-encrypted, the old ciphertext and the new ciphertext use the same key and IV, which reveals some information. How much information depends on the encryption mode.
With XTS, which is a popular choice, given two versions of the ciphertext of a sector, you can tell the length of the common prefix, up to the granularity of the block cipher block (i.e. 16 bytes for AES and all other block ciphers in current use). For example, if the old and new ciphertext start with 400 identical bytes, it means that the plaintext changed between the 400th and the 415th byte (and possibly more after that as well). (As encryption modes go, XTS is very robust in this respect — modes typically used for communication are a lot weaker, but they don't need to be strong since they use unique IVs.)
Comment: @AlexanderWatkins There is no *direct* data leakage. There can be indirect data leakage through [oracle attacks](https://en.wikipedia.org/wiki/Oracle_attack). For example, an adversary who can secretly dump your backups guesses that a sector contains `My password is swordfish`, then they fill your browser cache with `My password is a`, `My password is b`, etc. in the hope that the same sector will be overwritten with a cache file, and they can tell if the first letter of the password matches. It's pretty difficult to arrange any useful data leakage, but it's possible in principle.
Comment: @AlexanderWatkins The attacker injects plaintext, not ciphertext. For example by arranging for you to browse a web page (e.g. serving an ad) that gets written to the browser's cache.
Comment: If I understand correctly, there is no plaintext data leakage, and the metadata being leaked is the size of the data changes between snapshots (rounded to the nearest block cipher block size) and the size of the unchanged (prefix) amount. Is my understanding correct?
Comment: What do you mean by "fill your browser cache" and "the same sector will be overwritten with a cache file"? If I had a file with the text "My password is swordfish" that lined up with a sector, an attacker wouldn't be able to continuously guess values as they can't create their own ciphertexts to compare with the previous snapshots because they don't have the encryption key.


Divisibilty of binomial coefficients with equal base

Question: Is there any criteria for $k,m,n \in N$ such that
${n \choose k}$ diviides ${m \choose k}$.
Comment: Do you have any examples, other than the trivial ones for $k=1?$
Comment: @IgorRivin: for instance, if $n$ is odd then ${n\choose n-1}=n$ divides ${n+1\choose n-1}=n(n+1)/2$.
Comment: Aside from $k=1, n-1$, etc, it seems to me that for general $k$, it becomes lots of case study.
Answer: Let $P(n,k)=n(n-1)\cdots(n-k+1).$ We can ask the equivalent question of when $P(n,k)$ divides $P(m,k).$ This is completely determined by the value of $m \bmod {P(n,k)}.$
A sufficient condition is that $m\bmod q \in \{{0,1,2,\cdots,k-1\}}$ for each  prime power divisor $q=p^i$ of $P(n,k).$ This is also necessary except for $q=p^i$ with $i \gt 1$ and $p+1 \le k.$ For example $5^3$ divides $m(m-1)(m-2)(m-3)(m-4)$ exactly if $m \bmod 5^3 \in \{{0,1,2,3,4\}}$ but $5^3$ divides $m(m-1)(m-2)(m-3)(m-4)(m-5)$ exactly if $m \bmod 5^3 \in \{{1,2,3,4,0,5,25,30,50,55,75,80,100,105\}}.$
Some examples:
For $n=101$ and $k=3$ we need $101\cdot102\cdot103=2\cdot3\cdot17\cdot101\cdot103$ to divide $m(m-1)(m-2).$ For the primes $p=2,3$ this is automatic so we need $m(m-1)(m-2) \bmod p \in \{{0,1,2\}}$ for $p=17,101,103.$ This permits $27$ of the congruence classes mod $17\cdot101\cdot103=176851$ which is about $0.0025 \%.$
For $n=106$ and $k=3$ we need $104\cdot105\cdot106=2^43\cdot5\cdot7\cdot13\cdot53$ to divide $m(m-1)(m-2).$ So we need $m \bmod p \in \{{0,1,2\}}$ for $p=3,5,7,13,53$  as well as $m \bmod 16 \in \{{0,1,2,8,10\}}.$ This allows for $3^55=1215$ of the congruence classes mod $104\cdot105\cdot106 =1157520$ which is about $0.105 \%.$
It will be quite a bit more likely to have $\binom{m}{5}$ be a multiple of $\binom{n}{5}$ for $n=128$  than for $n=124$ or $n=133$ because $124\cdot125\cdot126\cdot127\cdot128$ is divisible by $2^{10},3^2$ and  $5^3.$
Comment: For your n=98 example you need more care. m can be odd and 1 mod 8 and the product then be a multiple of 8, but m being 3,5, or 7 mod 8 means the product is not divisible 8.  I missed your characterization and thought examples would be more rare.  Also the percentage values seem off. Could you be more explicit about the percentage values you present for your examples? Gerhard "Or Maybe Even Less Common" Paseman, 2016.10.05.
Comment: You are right. I took out that example and put in a better one.
Answer: I don't know of any criteria.  I have a suggestion that might point you to work of Erdos, Selfridge, and others on products of consecutive integers, but I have no specific references for you.
Let c(m,k) be the numerator of a common form of the binomial coefficient, namely $\prod^{k-1}_{i=0} m-i$. Your condition implies c(n,k) divides c(m,k) as well as that n choose k divides a product of a subset of k consecutive integers.  Now any two integers greater than k that are less than k apart are "mostly coprime", meaning that any factors they have in common are smaller than k.  If you have a somewhat smooth number like n choose k being a factor of the product of a subset of mostly coprime numbers, it seems much more likely that it is a factor of just one of the numbers of the subset than not.  Otherwise you have to break up n choose k into two or more mostly coprime factors f_i and arrange all the f_i to have multiples that fall into the same small interval.  While this division may be possible, I suspect it will be hard to arrange for three or more factors of n choose k.  I would start by characterizing those m,n,k,l in which n choose k divides m(m-l) with l less than k.  You may find that a criterion will be that n choose k has such a mostly coprime decomposition that "projects" into a small interval.
Gerhard "Takes Smooth With The Rough" Paseman, 2016.10.05.


2007 PT Cruiser

Question: I am.thinking.about buying a 2007 PT Cruiser. I need a reece hitch 2" receiver to accommodate my power lift and a scooter. Combined weight about 500 pounds.  Can this be installed on this vehicle and will it handle the weight
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Comment: Are you considering towing a trailer (which contains your power lift and scooter), or having the power lift and scooter mounted directly onto the car's trailer hitch?
Answer: As per @PAULTER2, the towing capacity of PT Cruiser maxes out at 1000lbs (with an otherwise empty vehicle). As a standard, the maximum tongue weight of the trailer hitch (vertical force applied on the receiver) cannot exceed 10% of the trailer weight*, which makes it about 100lbs. This makes PTCruiser inappropriate for the task at hand.
To be able to handle 250lbs off the hitch like you want, you need a vehicle that can tow at least 2500lbs or even more.
*Note: You may exceed that, but only to less than 15% and with a real trailer.
Reference to PTCruiser's towing specs: https://www.etrailer.com/question-359072.html
Answer: The towing capacity of your PT Cruiser is 1000lbs. It should be able to handle a combined weight (trailer and cargo) of 500lbs. As far as the hitch itself, you'd have to ask a Reece reseller if it will fit. If you can find one for it from Reece, it should be installable.
EDIT: As was rightfully pointed out, my answer did not give the full picture or answer the question fully.
While the towing capacity of the PT Cruiser is 1000lbs, the load capacity of it is the same (~1000lbs). Whether towed or carried, this is everything included. If you can get a hitch of significant strength to support the load of the scooter, it might work. As Enot points out, though, a hitch will only support so much.
What you really need to have is a purpose built platform which can support the weight of the scooter. As long as everything in the vehicle, including the scooter, scooter rack, passengers, fuel, and whatnot, does not exceed the 1000lbs, you'll be golden. If you weight 180lbs (just throwing a weight out there for example ... please don't take it personally!), plus another 200lbs for the rack, then throw in fuel for the car, a bag, any emergency supplies, etc, etc, etc ... you're going to come in close if not over the weight of what the capacity of the vehicle can handle. You need to be careful to measure what you're putting in there.
Comment: I think the question asks about hanging 500 pounds on the trailer hitch, not towing a trailer of that weight. I know little about PT Cruisers, but I'd be very apprehensive that such significant weight on a hitch would have bad or dangerous effects on the car's handling and safety.
Comment: @DavidSupportsMonica - Yup ... should have read the question closer. I'll see what I can do to update it.
Comment: @DavidSupportsMonica - Updated.
Comment: Much improved !
Answer: I think putting a 500# load several feet aft of the rear axle on such a small vehicle will not be safe, and is not a good idea. While the car might be able to tow a trailer of that weight, I understand your question as asking about putting the weight directly on the trailer hitch, similar to how bicycles are carried on hitch-mounted racks.
While 500# may be within the car's carrying capacity, the weight won't be distributed between front and rear tires and suspension, but will because of the hitch's position mostly be acting on the rear. Worse, because the weight is significantly aft of the rear tires, the weight pressing down will tend to lighten the load on the front tires, which in the PT turn, brake, and steer. The front tires' ability to do these tasks will be impaired by hanging a big weight off the back of the vehicle.
I am not an engineer, but I have worked with car and motorcycle suspensions for decades. I think this is a bad idea, and is just too much weight for a hitch-mounted carrier.

2007 PT Cruiser


Add svn comment (revision history) to (script) file

Question: Is it possible with Subversion to add the Revision History to a file with a svn property as with Id, Rev, Author? We would like to have the revision history automatically added to the beginning of a file.
Answer: Why? You already have all the information in SVN.
This will simply clutter your code files - do you really want people to scroll down several pages of this before starting to see code?
My advice it to leave your code files alone and if you need revision history, use your revision control tool (SVN) to get it.

Since this is a must, look at this blog post.
Comment: We want this 'feature' for script files. We want the user of the file to know the changes, and not have this info in a separate file.
Comment: @JohanKees - See [this](http://blogchuck.com/2007/02/adding-svn-information-to-file-headers/) blog post. I don't think it gives the whole history (I don't think that's possibly).
Comment: Although this adds a lot of info to the file, the comments are left out. Is it possible to add them?
Answer: It sound like you want to do something similar as the evil $log$ keyword in CVS. There's a reason why it was called evil, and why it was left out of Subversion with no plans to implement it.
I would highly recommend that you do this in your build system (Yes, I know these are shell scripts, and shell scripts aren't compiled, but a build system can be used for packaging). PUt this information into a release notes file, and not in your shell scripts.
If you really, really insist this must be done, you can use Ant to munge your shell scripts during packaging. You can put the dreaded $LOG$ keyword in your shell scripts, and when Ant does the packaging, it can replace $LOG$ with the Subversion history.


What is the armor in the RDJ Iron Man's outfit made of?

Question: What kind of material is the Robert Downey Jr. Iron Man's armor supposed to be made from? I know he crafted the prototype from the things he had on hand, but once he was able to build the next one(s) in his own lab, what hi-tech material did he use for the movie armor?
Comment: [Duh.](http://en.wikipedia.org/wiki/Iron)
Comment: LOL. They talked about this topic on David Letterman 4 hours after I posted this question.
Comment: For the Comic canon, you may find [this link](http://marvel.wikia.com/Iron_Man_Armor) useful -- he's had a number of different armors over the years, ranging from some (relatively) low tech early ones that needed machines to put on to an 'Liquid Metal' one that forms around him on command. Then, too, the base article on [Tony Stark](http://marvel.wikia.com/Anthony_Stark_%28Earth-616%29) may give you some valuable info.
Comment: Also, see the description for the Crystallized Armor: "Crystallized Iron Armor: The armor has evolved from a bulky iron suit to a highly complex matrix of molecularly-aligned fully crystallized ultra high carbon iron/steel hybrid alloy enhanced by magnetic fields over layers of other ultra hyper alloys like titanium alloy and or tungsten/vanadium alloys reinforced with carbon nanotubes creating a shell that is pliable, yet capable of amazingly high resilience and protection."
Answer: Cinematic Iron Man (Earth-199999) likely needs to use a variety of materials for his armors. His first suit was certainly made of scrap iron, but his later suits would need to be far lighter and stronger to be able to survive the stresses the were subjected to. He will need materials that are heat resistant, strong, resilient and stress tolerant but not all in the same measures.

The chest and dorsal regions, where he will take the bulk of damage because it has the widest surface area, will need to be the toughest part of the armor. He will be using titanium-nickel alloys with a touch of vibranium if he can get it. (to radically reduce impact damage). His flight surfaces (seen whenever he is maneuvering) will need to be even stronger since they will have to bear great stresses whenever he turns at high speeds and will likely be made of crystalline titanium (see below).

Since the suit has to be layered, inner layers will likely contain padding, ballistic mesh and other like materials to offer some level of cushion for the passenger. It is also theorized there must be some sort of antigravity and force field technology to reduce damage dealt to the suit. Otherwise, Stark should suffer far greater contusions from impacts and explosions. Though it is never mentioned it must be inferred since ancient armors had to pad the user to protect them from concussive force.

Areas requiring heat resistance will likely use carbon nano-tubes to channel heat away from the wearer. The bootjets, the repulsor areas and the chest unibeam cavity all likely use carbon-nanotubes materials. The material is brittle so it may end up being part of a coating to reduce heat buildup.

Likely the rest of the suit, the arms and legs will use crystallized titanium common to high velocity aircraft engines. Durable but expensive, capable of taking variances in temperature and surviving extreme stresses. Seeing how important limbs are, Stark would likely want the most protection possible without adding too much weight.

All the materials mentioned are known to exist on modern Earth as we know it. It is also possible materials and techniques as yet unknown are used in the design of the Iron Man armor since it is currently beyond our technical capability as yet to build or design.
Comment: Excellent answer, but you didn't include the *one* substance that we know is part of the suit: "use the gold-titanium alloy from the Seraphim tactical satellite".
Comment: On the last paragraph, I don't think vibranium fits that description ;P
Comment: Well, that's what his Daddy _said_, but if you had the hardest subatance on earth, and you were in the weapons business, would you give _all of it_ away?
Comment: Except vibranium, of course... (rubbing hands together...)
Comment: re gold is bad for armor: The [real stuff](http://www.torontocycles.com/Selling/Gold_Nitride_Titanium_Bolts.html) referred to as "gold titanium" does not contain gold. It is gold-ish colored Titanium Nitride and is a surface anodization process.
Comment: Because gold does not make for a good armor. It may make for an excellent conductor, so it might be used for some of the internal computational components. As an armor, it would be pretty but relatively useless. Let's call it a throw-away line and leave it at that.
Comment: It's impossible for him to have used vibranium, his daddy gave all the Earth's supply to Captain America for his shield.
Comment: He mentioned Gold-titanium alloy in the first Iron man film. "Use the gold titanium alloy from
the seraphim tactical satellite."
Comment: I don't know if "real Earth" materials is necessary, given that the power thing is fictional and that's also central to the plot and the character.  Maybe the material shell is just to form a force field and is not itself the source of material strength.
Comment: The only problem I have with Titanium Nitride as a possible "real world material" was they didn't CALL it that. As far as a force field being generated by the Iron Man armor, I can concur with that idea because otherwise it doesn't make sense how Stark can take the beating he can with an armor that does not use any kind of padding or underlayers which SHOULD mean the force of most blows should immediately be applied to Stark...
Answer: In Iron Man (2008) we hear him ask J.A.R.V.I.S. to build the suit out of "Gold-Titanium alloy". Relevant dialog:

Stark: Use the gold titanium alloy from the seraphim tactical satellite.
Comment: Speaking to Jarvis:
"Use the gold titanium alloy from the seraphim tactical satellite. That should ensure a fuselage integrity while while maintaining power-to-weight ratio. Got it?"
Comment: Welcome to scifi StackExchange! Can you elaborate on that, e.g. by providing a link to an IMDB quote or YouTube clip?
Answer: Over time, subsequent armors will have surely been made from different materials and composites depending on the purpose and required properties of the armor, but the Mark 2 and Mark 3 armors are at least primarily a gold titanium alloy.
From the first movie:

Tony Stark: [reading the newspaper] Iron Man. That's kind of catchy. It's got a nice ring to it. I mean it's not technically accurate. The suit's a gold titanium alloy, but it's kind of provocative, the imagery anyway.
Answer: I found the following information on the Marvel website, relating to the release of the upcoming Iron Man 2 film.
According to it, Iron Man's armor is made out of some combination of alloys, the most traditional solution being nitinol, titanium and nickel. It is extremely strong, has a high resistance to heat, and it even "heals" itself (if heated until it bends, it can be heated back into position).

Is the suit actually made of iron? Well, no, because iron is very
dense and heavy, it rusts and isn't nearly as hard as some of its own
alloys such as steel.  In the comics, the original Mark I cave-made
version of the suit probably had iron, or at least some iron
components. Unsurprisingly, this material is abandoned with haste once
back in the lab. Iron as a viable metal was discarded in the comics
less than a year after the character's creation, and that was the
60's. So what would Tony Stark really use?
The answer is likely a combination of materials. The most
"traditional" solution would be an alloy of titanium, nickel-titanium
(aka nitinol). It's traditional because it's an alloy and those have
been around for a very long time, but nitinol is still pretty special
stuff. It's strong, it's light (for a metal), it has a high resistance
to heat and it heals. Yes, it heals...sort of. Nitinol can be deformed
at one temperature then resume its original shape once heated above a
specific "transformation temperature." This property could come in
extremely handy when making repairs after being hit by many bullets,
as is often the case for Tony Stark while wearing the suit.
Other materials of note include carbon-carbon composite, which is a
type of carbon-fiber-reinforced graphite. It's extremely strong, but
brittle; however it can take a ton of heat. You know the nose-cone of
the space shuttle, which experiences temperatures in excess of 2300° F
during reentry? You better believe it's carbon-carbon. Tony's rocket
boots burn pretty hot, so he's possibly using carbon-carbon in there
somewhere.
The last material of note is what's called single-crystal titanium,
which is so cutting edge it's not on Wikipedia yet (i.e. your friends
will think you're really cool when you bring this one up). According
to Jacob Stump, an aerospace engineer and stress analyst at Northrop
Grumman, this is a custom grown piece of titanium which reduces the
number of imperfections, making it much stronger than other types of
titanium. It's starting to be used in military jet engines that are
susceptible to bird strikes. Hopefully Tony isn't hitting any birds,
but if he did, this material could take it.

That's the "real life and traditional" scenario. Look up Iron Man Armor in wikipedia. It has an extensive list of all the suits of Iron Man with the materials and purposes.
However, it only deals with the comic-book armor unless I missed something. I'm going to assume that you're talking about the armor from Iron Man and Iron Man 2? (Don't ask about 3, I haven't seen it yet)
I do believe that his suit is made out of a combination of the stuff that is used in Captain America's shield. It's not stated but some Marvel universe metal is used, that I know for sure.
The latter part was a bit speculative on my part and apologize for any errors or mistakes.
Comment: I've taken the liberty of adding the actual quote to your answer since the link was dead


Balm of the Summer Court fey energy dice usage limits

Question: If I'm a level 5 druid (Circle of Dreams, from Xanathar's Guide to Everything).  Am I limited to using two fey energy dice for my Balm of the Summer Court feature before having to take a long rest to use it again?
Comment: Welcome! You can take the [tour] as an introduction to the site and check the [help] if you need further guidance. Good luck and happy gaming!
Answer: You're limited to two dice per use, but five dice per long rest
There's rules in the feature about only using half your dice, but not in the context of a long rest:

At 2nd level, you become imbued with the blessings of the Summer Court. You are a font of energy that offers respite from injuries. You have a pool of fey energy represented by a number of d6s equal to your druid level.
As a bonus action, you can choose one creature you can see within 120 feet of you and spend a number of those dice equal to half your druid level or less. [...]
You regain all expended dice when you finish a long rest.
—Balm of the Summer Court, Xanathar's Guide to Everything, pg. 22

So at level 5, the druid would be permitted to spend 2.5 dice per use, which we round down to 2 because of the general rule about rounding:

There's one more general rule you need to know at the outset. Whenever you divide a number in the game, round down if you end up with a fraction, even if the fraction is one-half or greater.
—Round Down, Player's Handbook, pg. 7

So between Long Rests, a Druid could use this feature five times, spending 1 die each time, or three times with 2 dice for the first two and 1 for the last, or any other permutation they choose that obeys these restrictions.
Comment: Dammit you beat me to it.
Comment: Technically there's no need for any rounding in this case. You can leave it as "spend up to 2.5 dice", since the only numbers of dice less than or equal to 2.5 are 1 and 2. In this case the rounding rule gives you the same answer, so you could argue it's splitting semantic hairs, but even if the rounding rule said to round up, I would say this rule still limits a 5th level druid to 2 dice at a time.
Comment: @RyanThompson What you said makes no sense. Of course you have to round the number because you can't use half a die. Therefore you can only round it to 2 or 3 and since there is a rule for it the number would be 2 or fewer in this case. In your comment by saying it would be 1 or 2 or even 3 as you said it is still rounding to a whole number.
Answer: No
You currently have a pool of 5 d6s that you can use to heal people. Once you use all 5 you will need to take a long rest to use them again.
However, as a bonus action, you can only use a maximum of 2 of these dice. But that will still leave you with at least 3 to use before you need to take a long rest.
Comment: I recommend not calling them "hit dice", since that's a different concept in DnD 5e.
Comment: You've got the bones of a good answer here, but supporting it with rules citations would get my upvote :)


Isn't this patent basically talking about picture phone and a server capable of storing photos combined?

Question: Isn't this patent basically talking about picture phone and a server capable of storing photos combined? i mean both of these technologies are already known before this patent, then how were they able to get this patent??
Answer: It talks about taking pictures with your phone and uploading those to a server. It has been filed in 1997 and considering that the first camera phone was sold in 2000 in Japan, 3 years after the patent was filed and the same year it was published, I don't see where the issue lies in awarding this patent to Siemens.
Comment: At&T took out the first videophone in 1969 and Video conferencing has existed since the 70's and 80's. Due to high costs and insufficient bandwidth infrastructure, it never achieved public acceptance. In 2000, this technology became viable enough to be sold commercially and hence the first camera phone in Japan in 2000. The point being, the technology already existed!
Comment: If you read through the patent, you will see that it is about a mobile phone with digital camera. I would hardly call AT&T's videophone as mobile, and certainly it wasn't digital. It also lacked the other capabilities described in the patent, like adding tags and annotations using speech-to-text technology.


How can I isolate voltage reference from ICSPCLK programmer output

Question: In my application I use PIC16F676 microcontroler with the LM282 (https://www.onsemi.com/pub/Collateral/LM285-D.PDF) external voltage reference (for A/D converter) connected to the RA1 pin. This pin is also used during ICSP (Internal Circuit Serial Programming) as a ICSPCLK clock signal. How can I isolate this voltage reference from ICSPCLK programmer output and succesfully programing the chip?
Comment: jog my memory: What's the reference voltage that the LM282 offers, and what are the voltages that ICSPCLK takes?
Comment: The reference voltage of LM282 is 1.235V and voltage range for ICSPCLK is probably 0.2 VDD for low level and 0.8 VDD for high level. @anrieff answer solved my problem.
Comment: well, then, remove R1 when in programming mode (e.g. by turning on a transistor that is in series with R1 only when you need the reference voltage). For voltages << ref voltage, the LM282 will simply be a relatively good isolator, I guess
Answer: I don't think there's a good way to do it. My first suggestion would be to just add a jumper in front of the LM282:

simulate this circuit – Schematic created using CircuitLab
The jumper (or DIP-switch) should be closed during normal operations and open when programming.
If you absolutely cannot live with this requirement for manual intervention, you may throw in an op amp to avoid that node altogether:

simulate this circuit
This way your programmer will "fight" against the op-amp, but if the resistance (R2) is high enough, the programmer would "win". During normal operations, the op-amp just buffers the voltage reference. If you go that way, pick an op-amp that accepts inputs and outputs close to the rails - Rail-to-rail I/O.
Comment: Thank you very much for the answer. Solution using jumper will be probably good for my application.


How to kill a process in Linux if kill -9 has no effect

Question: I imagine that kill -9 still just sends a signal to a process. If the process is not behaving well, I would imagine that kill -9 would have no effect. Indeed, today for the first time I saw kill -9 have no effect when sent to a stuck ruby process. So here is my question: Is there some harsher way to kill a process?
Comment: You mention Ruby here, and I am curious what the pieces are that you are dealing with.  I was using Webrick and had a similar experience, I started using `Rack::Server.new` and the processes were handled correctly, and would thereafter respond to `control-c`.
Comment: vgoff, I will have to collect more information on the process. Let me get back to you on that.
Answer: You have to reboot the machine. If kill -9 doesn't kill a process, that means it is stuck in the kernel. Unless you can figure out what it's stuck on and unstick it, there's nothing you can do. The reason it's stuck is that it is waiting for something and the logic necessary to cleanly stop waiting simply doesn't exist.
(The above assumes the process has already been reparented to init. Otherwise, its parent may be keeping it around. You may have to kill its parent.)
Comment: +1 like the answer. What I have found is it's often stuck on waiting for a parent that's already dead. A zombie won't take up memory, but it can fill up the process table if you have 1000s and occupy ports it's bound to.
Comment: A zombie process shouldn't be able to occupy ports. When the process terminates, all its file descriptors should be closed even before it's reaped. At least, that's what I'd always assumed.
Comment: You may be right. I can't verify for certain, but at least it was (were) process(es) that couldn't be killed with kill -9 occupying a port.
Comment: FWIW, I had a stuck process that even had an open windows that wouldn't close (frozen). SIGPWR didn't help either, I had to reboot (Ubuntu 20.04 beta).
Answer: Every time I have a job that is stuck and signals 9 or 15 won't kill it, I send it signal 30 (SIGPWR) and almost every single time it will clear it out. I can't recall when sending the power outage signal didn't work.
Comment: Wow, it helped!
Comment: don't work for me, I mistakenly typed cat /**/* as root. And I can never kill it again
Answer: Yes there is, a reboot...
Normally though being unable to kill -9 a process is not such a problem since these processes are not doing much to hog your system, they're probably just zombies. The only time it necessitated me to reboot in order to get rid of it is when it was "occupying" a tcp port I needed to use.


what is best way to monitor IIS 6.0?

Question: monitoring can be include source ip, what is being served by iis, which work processor is being used, how much current load on IIS?
Answer: Performance counters will tell you about IIS load.  Run perfmon.exe to see them.
And IIS produces logs that are by default under C:\inetpub\logs\LogFiles\W3SVC1 showing every single file served, including requester's IP address and more.

what is best way to monitor IIS 6.0?


Can learning apocrypha count as Talmud Torah?

Question: According to this post, the apocrypha may be permissible to learn. Would learning it count as Talmud Torah?
Answer: No.  Doesn't "learning Torah" mean learning from specific holy books (and commentaries based on them), and not from other books?  Would that not specifically exclude books that were considered for inclusion by the Sanhedrin and rejected?  If not, what does it mean?
Comment: The Apocrypha were specifically examined and rejected.  How can anybody consider them Talmud Torah?
Comment: I thought Mussar was rooted in Torah and halacha, concentrating on expounding on the ethical commandments of Judaism.
Comment: So you wouldn't consider learning mussar Talmud Torah? Its not holy books, and if that is considered commentary on it, then why wouldn't the apocrypha?
Answer: Rabbi Ahron Lopiansky once told one of his talmidim that the only reason (or manner in which) they can learn apocrypha is if they understand that it is not Torah. One can reasonably infer from that: otherwise, it is completely forbidden and you are putting your olam haba on the line.


Disk Utility not finding disk

Question: I have an external drive that was dropped.  It doesn't mount anymore on my OS X box and Disk Utility doesn't see it. Is this the point where I'd need to bring it somewhere for expensive data recover?
Comment: Does the external drive power on when connected? If not, it must've been broken from the drop.
Try connecting it to another source to be sure.
Answer: Yep, if the platters were spinning when it was dropped, the heads may have crashed and recovery may be impossible. If the drive was powered down, it's more likely that a wire or solder joint (or circuit board) is broken.
It could be a cheap five minute fix, or a "throw it out and get a new one". Either way, someone will have to crack the case and take a look.

Disk Utility not finding disk


How to build tile server from Openstreetmap data for beginner?

Question: I am a beginner at GIS and I am developing a Java Application which needs a map. (The map would specifically be of just one city in the Philippines.) I have researched on different ways to do this and I have found that I will need a tile server to put the map because I need to be able to access this without the connection of the internet. I am a beginner and most of the tutorials I have seen have been complicated and have steps that I do not know how to do yet. Does anyone know of any tutorials or can help me start creating the tile server considering that I am a beginner at this?
Comment: Does it have to be in Java?
Answer: There is a very good web site for beginners about OpenStreetMap world focused on people coming from other mapping services that could fit your question: http://switch2osm.org/serving-tiles/
But if you want to create some tiles to be served offline something like http://www.maptiler.org/ but it's focused on raster data.
If I had to do this I would probably take a look on TileMill to create the design and produce a MBTiles file and then convert it to a TMS file structure to be consumed by an OpenLayers or Leaflet in offline mode.
Yes, it's quite complicated and lot of new (but exciting!) stuff, sorry.
Comment: Hello, thank you for replying. If I have downloaded all of the tiles that I need, how can I use them to be mapped in my Java Application? Sorry I am a beginner at this. The map will only be offline. I have used the Geotools library to put a map in my Java Application but it only consists of shapefiles. That is why I have thought of a tile server but an offline one.
Comment: I have no idea if there is a driver at GeoTools for a TMS structure, I would post a new question with a more precise description so folks can point you better.
Answer: For a single city, Tilemill and Tile Drawer are two great options: http://switch2osm.org/serving-tiles/using-an-all-in-one-solution/
Tilemill will get you an '.mbtiles' file, a SQLite3 database that contains all your rendered tiles. You'll also need to develop a custom stylesheet for the data.
Tile Drawer will do essentially everything for you, resulting in an EC2 server that you can use to do the actual rendering of your tiles. If you ssh into that server and run tilestache-seed.py for your area, you can get out a directory full of pre-rendered tile images that can be copied to wherever you need them.
Answer: Since you're a beginner, I'd suggest that you use the OpenGeo Suite. It comes with GeoServer ( map server ) and PostGIS ( spatial database ). It's an integrated package so you won't have to worry about integration yet. I suggest that you do the tutorials first and when you're confident enough, try your own data or OSM data. It has a shape file loader so it shouldn't be too hard. Good luck :)
Answer: If I understand correctly, you want to put the tiles on the same computer your Java app will run on. In that case you don't really need a tile Web server per se, you just need to prepare your Web map HTML and place it on a local disk together with map tiles. You can then access it using the file URI scheme.
One fairly easy way to generate tiles would be to follow the "Maperitive Tutorial: A Hiking Web Map In Ten Easy Steps".
Comment: Hello, thank you for replying. If I have downloaded all of the tiles that I need, how can I use them to be mapped in my Java Application? Sorry I am a beginner at this. The map will only be offline. I have used the Geotools library to put a map in my Java Application but it only consists of shapefiles. That is why I have thought of a tile server but an offline one.
Comment: I cannot help you much with Java, and it also very much depends on what you need to do with the map. You could take a look at JOSM's source code, it's open source OSM mapping app written in Java.


Add a delay before shooting bullet (UPBGE)

Question: When I mouse click the bullet fires automatically. Is there a way for the bullet to fire a second (or any set time) after the mouse click? I feel like other questions have addressed how to add delays between bullets but not before initial independent shots. Thanks!
Answer: there are numerous ways to implement delays, in this case for firearm firing. I will focus on the two easier methods: Logic Tics & Property Integers. The property type can be float too if you'd prefer.
Blender Math: 60 tics = 60 frames = 1 second
Example: Logic Tic

Example: Property (integer)

Download: Blend File
Unfortunately PasteAll.org is not accepting my blend file, either because it's a Blender +2.8x file or perhaps because it doesn't recognize new UPBGE source, so I've uploaded my blend to one of my Github repositories for commeridistribution.
https://github.com/RandomPandaStudios/BSE-Firing-Delay-Examples
Download: Revision
https://github.com/RandomPandaStudios/BSE-Firing-Delay-Examples/blob/main/UPBGE_03_Firing_Delay_Example_v2.blend
Comment: Done: https://github.com/RandomPandaStudios/BSE-Firing-Delay-Examples/blob/main/UPBGE_03_Firing_Delay_Example_v2.blend
Comment: Thanks for the suggestion but the file you sent is a default blend file when opened?
Comment: At the time of the upload, I was using the very latest UPBGE 0.3x release. Perhaps you need to update your UPBGE version? Additionally if you have a original Blender application set as your default program to open a blend file, you're going to need to either manually open my blend in your UPBGE 0.3 program or set your UPBGE 0.3 program as the default program for blend files.
Comment: Ok yes it works when opened on the newer UPBGE. I was actually asking about having a slight delay after clicking left mouse button, i.e. the bullet appears a split second after the button is clicked, but this is useful anyways so thanks.
Comment: You can easily implement this by using a boolean to keep track of whether the button has been clicked or not. Use this in combination with either of integer setups that I demonstrated in the blend file. I can create another blend example it if you want. But maybe best to create another question thread for that.
Comment: Could you create another blend file please? I think this may be useful for other people too. Thanks.


How to add a hyperlink to the body of a feeditem with apex code

Question: I want to add a hyperlink to the body of a feeditem with apex code. I tried to with class of EncodingUtil.urlEncode but it is not work. So I`d like to know how shall I do. Thx!
Comment: Welcome to SFSE, Leisure. Can you share what code you tried and what the result was?
Comment: Yes, follows are:
String sUrlRewrite = System.URL.getSalesforceBaseUrl().toExternalForm();
newItem = new FeedItem();
newItem.ParentId = targetAccountId;
newItem.Type = 'LinkPost';
newItem.Body = 'Case subject: ' + c.Subject
    + '\n Account Name: ' + map_accountId_account.get(c.AccountId).Name;
newItem.Title = c.Subject;
newItem.LinkUrl = sUrlRewrite + '/' + c.Id;
Answer: <code>      //Adding a Link post
               FeedItem post = new FeedItem();
               post.ParentId = oId; //eg. Opportunity id, custom object id..
               post.Body = 'Enter post text here';
               post.LinkUrl = 'http://www.someurl.com';
               insert post;
</code>
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_feeditem.htm
You can refer a field named "type" in Feeditem that decides the body.You have following choices
The type of FeedItem you can use is
    LinkPost—a URL posting on a feed
Comment: Thanks for your answer. My mate also had told me about this parameter, it is ok. Your are right!
Comment: If the answer answers your question its helpful if you mark it ticked and also upvote .Marking it as answer helps others while surfing