Converting a 2d surface into a 3d volume

I have a 2d surface shown in the image below using ListPlot3D[]:

image It is generated with one line of code:

ListPlot3D[RandomVariate[UniformDistribution[], {10,10}]]     

Currently, it’s a ‘white noise’ surface, meaning the surface is more or less random between zero and one. I’d like to give this thickness (so I can ultimately 3d print it).

I’d like the remaining 5 sides to be flat, so that I’d end up with a "cube" with one surface jagged.

Is there an easy way to do this? Essentially just fill in everything below the surface?


Converting time zones

My SQL Server is located in US Mountain Standard Time where the Daylight Savings is not observed. My office is in US Central time zone. All schedules are kept in Central time by business.

I am trying to figure out how to allow business to enter job schedules in a table in Central time and convert those to Mountain, taking Daylight Savings into account.


Does this character concept involving never taking a long rest and converting spell slots to sorcery points (aka coffeelock) violate RAW?

Does the following, very cheesy character concept, violate any RAW? Please cite rules or official rulings in your answer. (Apart from RAW, I expect my DM to disallow or limit the concept, in the interest of balance. That is not part of my question.)

Elf. Multiclass: Sorcerer 2+ / Warlock 1+ / Bard 1

  • Never takes a long rest. Ever. See question, Must 5e elves take a long rest? Specifically, whether adventuring or not, she makes sure that every 8 hour block includes more than 2 hours of combat or strenuous activity, to ensure that no interpretation of long rest rules would allow a long rest to be automatically triggered.
  • Converts warlock spell slots into sorcery points. See @JeremyECrawford’s tweet.
  • Converts sorcery points into sorcery spell slots (or into spellcasting spell slots, once also multiclassing Bard) via Flexible Casting
  • Spell slots created from sorcery points disappear upon long rest, as per Flexible Casting and a tweet from @JeremyECrawford; therefore these created spell slots will not disappear until used, e.g. for a character taking no long rests
  • Spell slots created from sorcery points are in addition to, and not restoration of the sorcerer’s spell slots which refresh on a long rest. This is not 100% clear from RAW or clarifications. But:
    (a) Flexible Casting uses the phrase, “additional Spell Slots”;
    (b) the rule stating that created spell slots disappear on long rests is superfluous if created spell slots can only replace expended spell slots — to have meaning it must be possible to create spell slots which are not replacements;
    (c) flexible casting does not use the word “recover”, which is the word used for wizards’ Arcane Recovery
  • Restores warlock spell slots on a short rest, and repeats the cycle above, converting warlock spell slots to sorcery points to sorcerer (or spellcasting) spell slots
  • During periods of downtime, takes as many short rests per day as permissible, to build up a stockpile of created sorcerer spell slots
  • Stockpiling requires using bonus actions out of combat, discussed elsewhere
  • Stockpiling requires having short rests on downtime days, discussed in a comment below
  • While adventuring, during combat, uses created spell slots to cast spells, and/or uses flexible casting to convert those spell slots back into sorcery points
  • While adventuring, after combat, will use created spell slots with Bard spells to restore hits points, since restoring hit points via long rest is unavailable, and via hit dice is mostly unavailable

I’m pretty sure this is not RAI, but does it violate RAW in some way?

How do I approach towards an abstract production rule interpreter with this situation of converting XML to python or java class?

If I am asking in the wrong place, please forgive and direct me to a more suitable one

So I have a XML like this

<range>    unconstrained    <span>       <rttype>          String </range>  <range>    x type    <span>       <rttype>          int       <assert>          $   > 0 </range>  <range>    Simple class reference    <span>       <rttype>          SimpleClass </range>  <range>    Simple class set    <span>       <rttype>          ArrayList<SimpleClass> </range>  <class>   Simple class     <attribute>      x         <range>            x type   </attribute>    <attribute>      state   </attribute>    <action>      initializer      <guarantees>         x has been set to zero      </guarantees>      <pimaction>         .@a x @ = 0      </pimaction>   </action>    <action>      update x      <parameter>         new x         x type      <guarantees>         x has been set to new x      </guarantees>      <pimaction>         .@a x @ = @i new x @      </pimaction>   </action>    <state>      Exists   </state>    <state>      Doesn't exist   </state>    <event>      <<new>>   </event>    <event>      <<destroy>>   </event>    <event>      update   </event>    <transition>      Doesn't exist      <<new>>      Exists      <transitionaction>         initializer   </transition>    <transition>      Exists      <<destroy>>      Doesn't exist   </transition>    <transition>      Exists      update      Exists      <transitionaction>         update x   </transition> 

I have a Java compiler (let’s call this ToJavaCompiler) that will compile this into a Java class

And another Java compiler (let’s call this ToPythonCompiler) that will also compile this into a Python class.

class SimpleClass:      # State Enum Declaration     # see MMClass.ruleStateEnumDeclaration for implementation      SimpleClass_states = Enum("SimpleClass_states", "EXISTS DOESNTEXIST")      # Attribute instance variables     # see MMClass.ruleAttributeInstVarList for implementation      _x: int     _state: SimpleClass_states      # Class level attribute     # All class members accessor      SimpleClassSet: ClassVar[List[SimpleClass]] = []       # Constructor     # See MMClass.ruleConstructorOperation      # See constructEvent.ruleConstructorOperation     def __init__(self):         # requires         #    none         # guarantees         #    --> x has been set to zero and state == Exists         self._initializer()         self._state = SimpleClass.SimpleClass_states.EXISTS         SimpleClass.SimpleClassSet.append(self)      # Attribute getters      @property     def x(self) -> int:         # requires         #   none         # guarantees         #   returns the x         return self._x      @property     def state(self) -> SimpleClass_states:         # requires         #   none         # guarantees         #   returns the state         return self._state       # Pushed events      def destroy(self) -> None:         # requires         #    none         # guarantees         #   state was Exists --> state == Doesn't exist         if self._state == SimpleClass.SimpleClass_states.EXISTS:             self._state = SimpleClass.SimpleClass_states.DOESNTEXIST             SimpleClass.SimpleClassSet.remove(self)      def update(self, new_x: int) -> None:         # requires         #    none         # guarantees         #   state was Exists --> x has been set to new x         if self._state == SimpleClass.SimpleClass_states.EXISTS:             self._update_x(new_x)      # Private transition actions      def _initializer(self):         # requires         #   none         # guarantees         #   x has been set to zero         self._x = 0      def _update_x(self, new_x: int):         # requires         #   none         # guarantees         #   x has been set to new x         self._x = new_x 

THe thing is my production rule need access to instance variable data from the model object they are compiling.

For example to generate the instance variables declarations i need a production rule that’s written in Java code like this which require access to the underlying model itself at Context.model()

public void ruleAttributeInstVarList() {     // description     // this rule emits the set of (private) instance variable declarations, if any     //     // Class.#ATTRIBUTE_INST_VAR_LIST -->     // foreach anAttribute in class     // anAttribute.#DEFINE_INST_VAR     //     // requires     // none     // guarantees     // all attributes of this class have been declared as instance variable of the     // PIM Overlay run-time type     if (Context.model().isVerbose()) {         Context.codeOutput().indent();         Context.codeOutput().println("# Attribute instance variables");         Context.codeOutput().println("# see MMClass.ruleAttributeInstVarList for implementation");                  Context.codeOutput().println("");         if (!attributeSet.isEmpty()) {             for (Attribute anAttribute : attributeSet) {                 anAttribute.ruleDefineInstVarAsPrivate();             }         } else {             if (Context.model().isVerbose()) {                 Context.codeOutput().indent();                 Context.codeOutput().println("# none");             }         }         Context.codeOutput().indentLess();     } else {         for (Attribute anAttribute : attributeSet) {             anAttribute.ruleDefineInstVarAsPrivate();         }     }     Context.codeOutput().println("");     Context.codeOutput().println(""); } 

I wonder if there’s an easier way to add target languages or frameworks without creating separate codebases per target language.

For e.g. I now have a ToJavaCompiler and a ToPythonCompiler two separate codebases

So I am here asking if there’s a way I can create an abstract production rule interpreter that suits my needs. My aim is to ultimately produce model classes in the target language or framework (such as Django or Rails) with a single codebase that allows extensions for different target languages/frameworks

I am okay to move away from Java if there’s a better language that suits what I am trying to do.

Diamond shaped map: converting tile number to coordinates and back

I have a diamond shaped map that is deserialized/represented as follows:

   j  0  1  2  3  4  5  6  7 i  0     *  *  *  0  1  *  *  * 1     *  *  2  3  4  5  *  * 2     *  6  7  8  9 10 11  * 3    12 13 14 15 16 17 18 19 4    20 21 22 23 24 25 26 27 5     * 28 29 30 31 32 33  * 6     *  * 34 35 36 37  *  * 7     *  *  * 38 39  *  *  *  

I want to convert the tile number, to its coordinates (i, j) and back. I have managed to convert a coordinate to its tile number like so:

Given a map width and height n: if(i< (n/2):     number = i*(i+1) + j else:     number = (2*((n/2)*((n/2)+1))) - ((n-i)*(n-i+1))) + j  So: (0, 3) -> 0; (6, 2) -> 34; 

However, I cannot figure out to go back to the coordinates from the tile numbers, because I have trouble with distilling the i parameter from the tile number.

I have tried googling with terms like "diamond shaped map tile numbers coordinates convert", but no luck.

Can someone point me in the right direction?

Help converting a CFG to an APD

So I have this contest free grammar, and I’m having trouble when checking that there are more a’s than c’s, because I would have to check that the string I am processing is consumed in its entirety, but with the stack not empty, and I have no idea how to do that. The way we studied this in my class, I have no way of knowing if a string has been consumed.

$ $ \begin{align}S&\to AB | aSc\ A&\to aA | a\ B&\to bB | b\ \end{align}$ $

Maybe it’s easier to read the definition of the language: $ $ L = \{x \in L(a^∗b^∗c^∗) : |x|_a > |x|_c; |x|_b > 0; |x|_c ≥ 0\}$ $

This are the transitions I have so far: $ $ \delta(q_0, a , Z_0) = (q_0, A/Z_0)\ \delta(q_0, a, A) = (q_0, A/A)\ \delta(q_0, b, A) = (q_0, A)\ \delta(q_0, b, A) = (q_1, A)\ \delta(q_1, c, A) = (q_2, \epsilon)$ $ What I have up until here is, I read the a’s and push them on the stack, then when i read the first b I go to another state (because I have to make sure there is at least one a, otherwise I could do it in the same state) and keep the stack the same. When I read the first c I go to yet another state and start reading the c’s and popping the a’s in the stack. What I should do now is verify that the string has been consumed, while the stack still has a’s, but I can’t think of a way to do that because I have no way of knowing if the string I am processing has been consumed or not.

Conversion failed when converting the nvarchar value ‘A35’ to data type int

This is my stored procedure, that I am trying to execute.

Create Procedure CAMP_UpdateCaseProfileID as

update crcase

set crcase.UsrProfileNumber = CAMPProfileNumber.ProfileNumberCD ,crcase.UsrManufacturerID = CAMPProfileNumber.ManufacturerID ,crcase.UsrTapeModelID = CAMPProfileNumber.TapeModelID ,crcase.UsrSerialNbr = CAMPProfileNumber.SerialNbr ,crcase.UsrPRegNbr = CAMPProfileNumber.RegistrationNbr ,crcase.UsrCAMPLastActuals = current_timestamp

from CAMPProfileNumber

where crcase.UsrProfileNumber is not null and crcase.CompanyID = 2


After creating the procedure the error I am receiving is:

“Msg 245, Level 16, State 1, Procedure CAMP_UpdateCaseProfileID, Line 4 [Batch Start Line 2] Conversion failed when converting the nvarchar value ‘A35’ to data type int.”

Please Help!