Place two-dimensional Graphics object into three-dimensional Graphics3D object

I have a labelled two-dimensional Polygon that I render with Graphics.

label = {RGBColor[1., 0.92, 0.61], Polygon[{{0, 0}, {4, 0}, {4, -1}, {0, -1}}]}; label = Graphics[{labels, Inset[Text["Some Label", BaseStyle -> {FontSize -> 40}], (1/2) {4, -1}]}]; 

Picture of the 2D labelled graphics

I want to place this object in a three-dimensional Graphics3D, such that the text also gets projected into the plane. So I want an image that looks like the following but with the code modified so that the text is also present

labels = {RGBColor[1., 0.92, 0.61], Polygon[{{0, 0, 0}, {4, 0, 0}, {4, -1, 0}, {0, -1, 0}}]}; object = {Blue, Cuboid[{0, 0, 0}, {4, 2, 3}]}; Graphics3D[{object, labels}, Boxed -> False] 

Picture of 3D graphics with cuboid object and 'label' (but missing text)

NullReferenceException in SPRequest: Object reference not set to an instance of an object

I have a custom SharePoint timer job definition for SharePoint 2010. In this timer job definition, I am creating the SPSite object (inside the using statement) and then iterating through every sub site using below loop.

foreach (SPWeb web in rootWeb.Webs){}

In side the loop, I am adding multiple items to a custom list. Randomly, item creation is failing with below errors in hive logs.

NullReferenceException in SPRequest: Object reference not set to an instance of an object. at Microsoft.SharePoint.Library.SPRequest.SetVar(String bstrUrl, String bstrName, String bstrValue)

NullReferenceException in SPRequest: Object reference not set to an instance of an object. at Microsoft.SharePoint.Library.SPRequest.ClearAllVars(String bstrUrl)

For every such Null Reference Exception for OWSTIMER.EXE, one or more below w3wp.exe exceptions are coming and I am not sure what is causing this but it seems like it is effecting my timer job code. Is it a good practice to create items in a loop like I have described above?

An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. Allocation Id: {6F311C83-F607-4B16-9173-67858B4CDB70} To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.

Thanks

Apply non-linear transformation to graphics object

I would like to define some simple geometric primitives (e.g. points and lines) and see what happens when I transform them by a non-linear transformation (in my case $ (x,y)\mapsto (\sqrt x,\sqrt y)$ ). The result should be an image showing $ \{(\sqrt x, \sqrt y)|(x,y)\in X\}$ , where $ X$ is some set I defined before, like union of points and lines.

===

I tried playing with TransformedRegion. I can apply it to a single line, but for example {Line[p1,p2],Line[p2,p3]} is not a correctly specified region. Also, putting TransformedRegion[Line[p1,p2],F] (for some defined function F) to Graphics does not work, since “TransformedRegion is not a Graphics primitive or directive“.

Copiar object en Grails

Supongamos que tengo esta clase de dominio:

class Profesor {    String name    int edad    static hasMany = [alumnos: Alumno] } 

Tenemos ya un registro de Profesor guardado en la BBDD y quiero clonarlo, hago lo siguiente:

def original = Profesor.findById(1) def copy = new Profesor(original.properties) copy.save(flush:true)  

Pero me da el siguiente error:

Found shared references to a collection: com.model.Profesor.alumnos 

Si al código anterior le añado la siguiente linea me guarda el profesor pero sin los alumnos

copy.alumnos= [] 

How to Steer a Moving Object Away From Another Object(s)

I’m working with C# in Unity, and I’m making a top-down space shooter game in which there are many different AI-controlled ships flying around. The problem is that these ships often fly on top of one another in passing, and sometimes even will fly the same route on top of one another if given the same waypoint. I want to add a system to steer my AI ships away from each other as well as other obstacles so that instead of overlapping one another when flying the same path they will fly side-by-side, and will also try to avoid things that pass in front of them.

My current system essentially works like this: The AI looks at all of the current objectives, points of interests, etc, and decides where it wants to be on the map (a coordinate). The AI then sends an input direction to the ship, which then applies acceleration in that direction and changes the velocity. Therefore, any solution to alter my ship’s pathing would need to alter this input direction somehow.

So my first idea was to check if there are any obstacles (ships, asteroids, structures, etc) within a radius of the ship, increasing this radius based on the ship’s velocity (higher velocity = larger “view” radius):

Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, ship.velocity.magnitude); 

If there is something nearby, calculate the direction to that collision, then calculate the opposite direction and scale it to the reciprocal, which also has the added effect of making the aversion stronger the shorter the distance to the collision is:

foreach (Collider2D hit in hits) {    Vector2 v = hit.ClosestPoint(transform.position) - (Vector2)transform.position;    v = (1 / v.magnitude) * -v.normalized; 

I would perform this for every nearby obstacle and add all of these together to get the avoidance vector:

   avoidanceVector += v;    continue; } 

Then I add the total avoidance vector to the AI’s input direction and normalize the result:

inputDirection += avoidanceVector; inputDirection.Normalize(); 

However, when i add this avoidance vector to my input direction, my ships exhibit a strange behavior where sometimes they will simply stop moving completely. commenting out the line where i add them together stops this behavior.

I’m really not sure what could be going wrong here, but I think it has to do with my approach altogether. Can anyone help me figure out a clean, simple way to make my ships steer away from other objects?

Can I make an object, so that when the characters touch it they are teleported somewhere else?

I want it so I can teleport characters to the top of a tower in D&D 5e. They will then battle their way down the tower. My idea is that they touch an object and it teleports them there. Is this a thing, or is there a better way of doing this?

I want to use this for an idea I have for a 1 off adventure: the party is told that farm animals are going missing. They find out it’s from a teleport masked as an item (I haven’t decided what item). They use the item to teleport to where they are going, find they are food for a tower of orcs. They fight the orcs and face a wizard at the end who made the teleport item.

Can deleting a non-inherited object more than once be exploited for code execution?

When assigning priority for a bug, we had an internal discussion whether in C++ deleting an object more than once can result in code execution if the pointer to object can be corrupted. For the objects having virtual destructor the answer seem to be obvious here.

However what is not obvious whether this could be exploited for code execution when a deleted object is either a standard type (i.e. long), an array, or an instance of a class which does not have virtual table.

Can this situation result in code execution on any existing popular implementations?

‘DeferredAttribute’ object is not callable django

I’m trying to solve this problem, but i can’t anyone can help me plz here’s my views.py :

from django.shortcuts import render from django.http import HttpResponse from .models import Product

def db(request): dat = ” p1 = Product(namee=’numberone’, pricee=500,Type=’m’) p1.save() dat = Product.namee() return HttpResponse(dat)