text:
I am running more than 500 WordPress website in my shared server, Frequently I am getting attacks on admin-ajax.php, wp-cron.php, xmlrpc.php and wp-login.php files. Due to that our server load is getting more than 100.

Is there is any way to avoid the spamming request to this respective file.

Currently I am blocking those file in .htaccess, Apart of from this I need any alternative solution.

## I’m trying to use sp_ineachdb, please can anyone see where I’m getting it wrong?

Can anyone help please? I can’t seem to find where I’m missing it. I’m trying to loop through the user databases in my SQL Server instance to delete all the existing users. I’m using the stored proc dbo.sp_ineachdb. For each database, I get an error that the cursor already exists. My code is pasted below. Thank you.

DECLARE @sql AS VARCHAR(4000) SET @sql =

‘USE [‘ + DB_NAME() +’] DECLARE @UserName nvarchar(256) DECLARE csrUser CURSOR FOR SELECT [name] FROM sys.database_principals WHERE principal_id > 4 AND is_fixed_role < 1 ORDER BY [name]

OPEN csrUser FETCH NEXT FROM csrUser INTO @UserName WHILE @@FETCH_STATUS <> -1 BEGIN BEGIN TRY EXEC sp_revokedbaccess @UserName END TRY BEGIN CATCH ROLLBACK END CATCH FETCH NEXT FROM csrUser INTO @UserName END

CLOSE csrUser DEALLOCATE csrUser’

EXEC dbo.sp_ineachdb @command = @sql

## How can I get the Text component from TextMeshPro ? I’m getting null exception

At the top of the screen :

``public GameObject uiSceneText; private TextMeshPro textMeshPro; ``

Then in the script at some point :

``uiSceneText.SetActive(true);  if (textMeshPro.text != "")     textMeshPro.text = ""; ``

The exception error null is on the textMeshPro on the line :

``if (textMeshPro.text != "") ``

textMeshPro is null.

This screenshot shows the TextMeshPro in the Hierarchy :

and I see that the Scene Image object and its child Scene Text both are enabled true.

I want to get the text and add replace a new text with the text already in the Text but the textMeshPro is null.

The complete script :

``using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  public class PlayerSpaceshipAreaColliding : MonoBehaviour {     public float rotationSpeed;     public float movingSpeed;     public float secondsToRotate;     public GameObject uiSceneText;      private float timeElapsed = 0;     private float lerpDuration = 3;     private float startValue = 1;     private float endValue = 0;     private float valueToLerp = 0;     private Animator playerAnimator;     private bool exitSpaceShipSurroundingArea = false;     private bool slowd = true;     private TextMeshPro textMeshPro;      // Start is called before the first frame update     void Start()     {         textMeshPro = uiSceneText.GetComponent<TextMeshPro>();          playerAnimator = GetComponent<Animator>();     }      // Update is called once per frame     void Update()     {         if (exitSpaceShipSurroundingArea)         {             if (slowd)                 SlowDown();              if (playerAnimator.GetFloat("Forward") == 0)             {                 slowd = false;                  LockController.PlayerLockState(false);                  uiSceneText.SetActive(true);                  if (textMeshPro.text != "")                     textMeshPro.text = "";                  textMeshPro.text = "Here I will add the new text.";                              }              if (slowd == false)             {                              }         }     }      private void OnTriggerEnter(Collider other)     {         if (other.name == "CrashLandedShipUpDown")         {             exitSpaceShipSurroundingArea = false;             Debug.Log("Entered Spaceship Area !");         }     }      private void OnTriggerExit(Collider other)     {         if (other.name == "CrashLandedShipUpDown")         {             exitSpaceShipSurroundingArea = true;             Debug.Log("Exited Spaceship Area !");         }     }      private void SlowDown()     {         if (timeElapsed < lerpDuration)         {             valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);             playerAnimator.SetFloat("Forward", valueToLerp);             timeElapsed += Time.deltaTime;         }          playerAnimator.SetFloat("Forward", valueToLerp);         valueToLerp = 0;     } } ``

## Getting Back Int WP Dev – Best Approach for custom post widgets (drag/drop)

At one point I was a fairly solid WP dev (at least I thought I was), but have not done a lot with the platform in about 6 years.

An old work friend has a job and was asking me to help out. I downloaded WP today and boy, was I shocked at the changes.

Here is what I am trying to do.

The project my friend has designed is pretty straightforward, outside of the home page.

On the HP, he wants to have dedicated areas where the client can drag and drop posts from various categories, BUT they all have custom layouts – ie in one section a post widget looks different than another, additionally, inside that section there needs to be some conditional logic – ie if the post has no image, don’t have the image tag etc.

Based on what I am seeing I should be using something like elementor, But, unless I am mistaken, even though customizable, the actual widgets or elements are limited in terms of fine tuning the contents – ie, you can manipulate them a bit, but ultimately they only can be customized so much.

To illustrate: Here is an example from his design:

All items here are standard posts, albeit in different categories.

What he would be looking to do is have a template where these posts can be dragged in. And be styled according to the section.

Back when I was building WP, it would have been a little more rigid, the sections would be hardcoded into the HP template and I would pull the posts in based on a query result (most recent, have a custom field checked etc etc). However, it would have been fool-proof and the content would simply flow.

I know the Gutenberg block editor allegedly will eventually allow this I would ideally be able to build a template with editable areas that the user could just drag items onto, BUT THEY NEED TO LOOK LIKE THEY DO IN EACH SECTION! Ie, could I build a template with those areas hardcoded in, and then have the user drag/remove custom post widgets into each, one at a time? Based on what I am seeing with the current state of the block editor, this is not doable.

Questions:

Can this be achieved with Elementor, Divi, or any of the other new editor tools – ie a completely custom single post element?

Ideally, can this be done with the current block editor – seems like it is still a bit off.

One more thing to add: this is not a new site, I actually built the original version in 2013, and it currently has 4k posts, so we’re kind of stuck wp here.

## why Alexa rank is deteriorating while the visitor is getting better [closed]

My website has more visitors than before. But its Alexa rank is already much worse. where is problem?

## Error message getting

I am getting an error message:

``During evaluation of In[1032]:=      ClearAll::wrsym: Symbol T is Protected. ``

The code they mention is:

``ClearAll["Global$$`$$*"] ``

Hello, I’ve subscribed to one of the verified list providers and they sync files via Dropbox. And I have the issue that GSA cant catch up with the updated files automatically. I have to manual via context menu trigger a new import from global site list – then it starts to push them. But I assume that this should be automatically after the DP sync appeared.

Did anyone face such an issue?

## Getting Mathematica to solve a system of two second order nonlinear ordinary differential equations

I tried solving a system of two second order nonlinear ordinary differential equations using the DSolve command. First, I tried like this:

``eqns = {A''[x] == 2/B[x]*A'[x]*B'[x],     B''[x] + 1/B[x]*(A'[x])^2 - 1/B[x]*(B'[x])^2 == 0}; sol = DSolve[eqns, {A, B}, x] ``

However, as Mathematica didn’t (couldn’t?) solve this, I transformed it into a system of four first order equations:

``eqns = {c'[x] == 2/B[x]*c[x]*d[x],     d'[x] + 1/B[x]*(c[x])^2 - 1/B[x]*(d[x])^2 == 0, c[x] == A'[x],     d[x] == B'[x], c[0] == 1, d[0] == 1, A[0] == 1, B[0] == 1}; sol = DSolve[eqns, {A, B, c, d}, x] ``

This still doesn’t work. Weirdly enough, I don’t even get an error message.

I only included the boundary conditions thinking that they may be helpful, but they aren’t part of my original problem.

Your help would be greatly appreciated:)

## Need help improving my Flow Field and Unit Avoidance code so that the units can properly surround a unit instead of getting stuck

My setup is like this. Every update my movement system moves all of the units on the field. They use some Boid logic to avoid eachother, and a flow field that directs them towards each other. This is the result. https://imgur.com/a/CaUpfT7

My general setup is to calculate 2 flow fields, one for each player. From every field on the map (32×32 fields) I calculate the vector that points towards the closest enemy. Now this is a fine approach but I’d like to somehow take into consideration obstacles somehow (without another round of for loops)? Or should I handle that in my movement system avoidance? I was maybe thinking of doing A* once a unit is close enough to the enemy but all of these systems together seem rather hacky and overkill.

There are no obstacles currently, maybe a spell will generate it in the future. For now there are only units on the battleground without terrain or obstacles (besides units fighting eachother)

Here is some code. Firstly how I create the flowfields (kinda costly, will look into a way to optimize it further, don’t really need every single tile, can probably merge 2 or 3 together)

``func (g *Grid) Update() {     g.entityPositions[0] = g.entityPositions[0][:0]     g.entityPositions[1] = g.entityPositions[1][:0]     entities := g.world.GetEntityManager().GetEntities()     posComps := g.world.GetObjectPool().Components["PositionComponent"]      for _, ent := range entities {         g.entityPositions[ent.PlayerTag] = append(g.entityPositions[ent.PlayerTag], posComps[ent.Index].(components.PositionComponent).Position)     }      for x := 0; x <= g.MaxWidth/FlowTileSize; x++ {         for y := 0; y <= g.MaxHeight/FlowTileSize; y++ {              curPosVector := engine.Vector{X: float32(x * 32), Y: float32(y * 32)}             // find closest tile to this one for both players             minDist := float32(100000.0)             minIndx := -1             for indx, pos := range g.entityPositions[0] {                 d := engine.GetDistanceIncludingDiagonal(pos, curPosVector)                 if d < minDist {                     minIndx = indx                     minDist = d                 }             }              //  fmt.Printf("CurPos : %v, enemyPos : %v,  direction %v \n", curPosVector, g.entityPositions[0][minIndx], g.entityPositions[0][minIndx].Subtract(curPosVector).Normalize())             g.flowTiles[1][x][y].Direction = g.entityPositions[0][minIndx].Subtract(curPosVector).Normalize()              minDist1 := float32(100000.0)             minIndx1 := -1             for indx, pos := range g.entityPositions[1] {                 d := engine.GetDistanceIncludingDiagonal(pos, curPosVector)                 if d < minDist1 {                     minIndx1 = indx                     minDist1 = d                 }             }              g.flowTiles[0][x][y].Direction = g.entityPositions[1][minIndx1].Subtract(curPosVector).Normalize()         }     } }  ``

And my movement code. A lot of code but just basic allignnment cohesion/ separation. With added 2 look ahead vectors to steer away from the collision.

``        desiredDirection := world.Grid.GetDesiredDirectionAt(positionComp.Position, tag)         direction := movementComp.Direction         maxSpeed = movementComp.MovementSpeed          //Avoidance         nearbyEntities := helper.GetNearbyEntities(100, world, index)          avoidance := engine.Zero()         avoidance = avoidance.Add(alignment(world, nearbyEntities, direction).MultiplyScalar(alignmentCoef))         avoidance = avoidance.Add(cohesion(world, nearbyEntities, direction, positionComp.Position).MultiplyScalar(cohesionCoef))         avoidance = avoidance.Add(separation(world, nearbyEntities, direction, positionComp.Position).MultiplyScalar(separationCoef))           //Checking ahead of us whether or not we'll encounter something         lookAheadVectorLong := direction.Add(desiredDirection).MultiplyScalar(maxSpeed * 2.5)         lookAheadVectorShort := direction.Add(desiredDirection).MultiplyScalar(maxSpeed)         maxAvoidanceForce := float32(1.0)          checkPosShort := positionComp.Position.Add(lookAheadVectorShort)         checkPosLong := positionComp.Position.Add(lookAheadVectorLong)          collidedIndexShort := world.Grid.IsPositionFree(index, checkPosShort, positionComp.BoundingBox)         collidedIndexLong := world.Grid.IsPositionFree(index, checkPosLong, positionComp.BoundingBox)          if collidedIndexShort != -1 {             direction = engine.Zero()             avoidance = checkPosShort.Subtract(world.ObjectPool.Components["PositionComponent"][collidedIndexShort].(components.PositionComponent).Position).Normalize()             avoidance = avoidance.MultiplyScalar(maxAvoidanceForce * 1.5)         } else if collidedIndexLong != -1 {             direction = direction.MultiplyScalar(breakingForce)             avoidance = checkPosShort.Subtract(world.ObjectPool.Components["PositionComponent"][collidedIndexLong].(components.PositionComponent).Position).Normalize()             avoidance = avoidance.MultiplyScalar(maxAvoidanceForce * 1.2)         }          direction = desiredDirection         direction = direction.Add(avoidance).Normalize()          positionComp.Position = positionComp.Position.Add(direction.MultiplyScalar(maxSpeed))          positionComp.Position.X = engine.Constraint(positionComp.Position.X, 0, 799)         positionComp.Position.Y = engine.Constraint(positionComp.Position.Y, 0, 511)          movementComp.Direction = direction.Normalize()          world.ObjectPool.Components["PositionComponent"][index] = positionComp         world.ObjectPool.Components["MovementComponent"][index] = movementComp          fmt.Printf("I %d am at %v\n", index, positionComp.Position)     }  }  func limit(p engine.Vector, lim float32) engine.Vector {     if p.X > lim {         p.X = lim     } else if p.X < -lim {         p.X = -lim     }     if p.Y > lim {         p.Y = lim     } else if p.Y < -lim {         p.Y = -lim     }     return p } func alignment(world *game.World, siblings []int, velocity engine.Vector) engine.Vector {     avg := engine.Vector{X: 0, Y: 0}     total := float32(0.0)      for _, siblingIndex := range siblings {         avg = avg.Add(world.ObjectPool.Components["MovementComponent"][siblingIndex].(components.MovementComponent).Direction)         total++     }     if total > 0 {         avg = avg.DivideScalar(total)         avg = avg.Normalize().MultiplyScalar(maxSpeed)         avg = avg.Subtract(velocity)         avg = limit(avg, maxForce)         return avg     }     return engine.Vector{X: 0.0, Y: 0.0}  }  func cohesion(world *game.World, siblings []int, velocity engine.Vector, position engine.Vector) engine.Vector {     avg := engine.Vector{X: 0, Y: 0}     total := float32(0)      for _, siblingindex := range siblings {          avg = avg.Add(world.ObjectPool.Components["PositionComponent"][siblingIndex].(components.PositionComponent).Position)         total++      }     if total > 0 {         avg = avg.MultiplyScalar(1.0 / total * cohesionCoef)         avg = avg.Subtract(position)         avg = avg.Normalize().MultiplyScalar(maxSpeed)         avg = avg.Subtract(velocity)         avg = limit(avg, maxForce)         return avg     }     return engine.Vector{X: 0.0, Y: 0.0} }  func separation(world *game.World, siblings []int, velocity engine.Vector, position engine.Vector) engine.Vector {     avg := engine.Vector{X: 0, Y: 0}     total := float32(0)      for _, siblingIndex := range siblings {         siblingPos := world.ObjectPool.Components["PositionComponent"][siblingIndex].(components.PositionComponent).Position         d := position.Distance(siblingPos)         if d < desiredSeperation {             diff := position.Subtract(siblingPos)             diff = diff.Normalize()             diff = diff.DivideScalar(d)             avg = avg.Add(diff)             total++         }     }     if total > 0 {         avg.DivideScalar(total)     }      if total > 0 {         avg = avg.MultiplyScalar(1.0 / total * separationCoef)         avg = avg.Normalize().MultiplyScalar(maxSpeed)         avg = avg.Subtract(velocity)         avg = limit(avg, maxForce)     }     return avg } ``

What I am trying to achieve is:

Units not mashing into each other and just positioning themselves in a free spot around their target.

What are my problems :

1. Make the flow field direct them away from collision rather than just towards closest unit.
2. Make it work with the current system without adding too many nested loops and awful checks.
3. I am doing the avoidance correctly? I have a desired direction that I get from the flow field (that directs me towards closest enemy), then I add avoidance to it to avoid any other units in the area.

My units move really well up untill the point of collision/ going to a spot next to a target. I am not sure how to implemenent that behaviour yet.

(This is my forth iteration of the movement system. I went from pure boid, to grid based, to A*, to this. So I tried a lot of variations and this going surrounding behaviour has been bugging me every time.)

Custom engine (server) written in Golang and then dispatched to Godot for the visuals. Performance is not my concern, but this is a server, so I am more mindful of that, I could probably brute force it but I’d rather hear some better take on it.

Any suggestion/article/ video is greatly appreciated !!

Edit: Thinking about it, flow field is currently useless. I can basically just have a vector pointing to the closest enemy for each unit… Would be less costly as well. But the problem of them clumping and not knowing how to surround still stands.

## Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection

So I’m putting a plugin together that will allow me to connect multiple client sites with an online service.

I can get the service vendors snippet to load, but once you interact with it, that’s where things get tricky and it refuses to load an (I guess) iframe… …it’s pretty poorly documented.

`Refused to load https://www.service-domain.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy.`

That’s the console log error I was receiving.

So I jumped back into my plugin and added the following:

``function bbti_send_headers() {     header( "Content-Security-Policy: frame-ancestors https://www.service-domain.com/; frame-src https://www.service-domain.com/;" ); } add_action( 'send_headers', 'bbti_send_headers' ); ``

Now, when I reload the page I’m still getting the same error `Refused to load https://www.service-domain.com/... etc...`

However, if I look at the network panel and check the page’s headers this is what I get:

``HTTP/1.1 200 OK Content-Encoding: gzip Content-Security-Policy: frame-ancestors https://www.service-domain.com/; frame-src https://www.service-domain.com/; ``

So the header is there but still getting the same error from the script.

Anyone know what it is I missed?


text:
# Sparse coding

### How to quickly make big things out of short lists of small things.

.

Linear expansion with dictionaries of basis functions, with respect to which you wish your representation to be sparse; i.e. in the statistical case, basis-sparse regression. But even outside statistics, you wish simply to approximate some data compactly. My focus here is on the noisy-observation case, although the same results are recycled enough throughout the field.

Note that there are two ways you can get your representation to be sparse;

• you know that your signal happens to be compressible, in the sense that under some transform its coefficient vector is mostly zeros, even in a plain old orthogonal basis expansion.

• you are using a redundant dictionary such that you won't need most of it to represent even a dense signal.

I should break these two notions apart here. For now, I'm especially interested in adaptive bases.

This is merely a bunch of links to important articles at the moment; I should do a little exposition one day.

Decomposition of stuff by matching pursuit, wavelets, curvelets, chirplets, framelets, shearlets, camelhairbrushlets, content-specific basis dictionaries, designed or learned. Mammals visual cortexes seem to use something like this, if you squint right at the evidence.

To discuss:

• connection to mixture models.

• Sampling complexity versus approximation complexity

• am especially interested in approaches where we learn the transform or the basis dictionary unsupervised

## Resources

Baraniuk's lab has a comprehensive, but not usefully annotated, selection of articles in this field, which I include more to demonstrate the virtue of a literature review by showing the pathology of its absence, rather than as a useful starting point.

## Classics: Wavelet bases

Very popoular practical intro is Torrence and Comp.

TBD

## Learnable codings

I want to generalise or extend this idea, ideally in some shift-invariant way (see below.)

Oldhausen and Field (OlFi96a) kicked this area off by arguing sparse coding tricks are revealing of what the brain does.

For a walk through of one version of this, see Theano example of dictionary learning by Daniel LaCombe, who bases his version on NCBK11, HyHH09 and HLLB15.

See MBPS09 for some a summary of methods to 2009 in basis learning.

Question: how do you do this in a big data / offline setting?

Analytical sparsifying transforms such as Wavelets and DCT have been widely used in compression standards. Recently, the data-driven learning of sparse models such as the synthesis dictionary model have become popular especially in applications such as denoising, inpainting, compressed sensing, etc. Our group’s research at the University of Illinois focuses on the data-driven adaptation of the alternative sparsifying transform model, which offers numerous advantages over the synthesis dictionary model.

We have proposed several methods for batch learning of square or overcomplete sparsifying transforms from data. We have also investigated specific structures for these transforms such as double sparsity, union-of-transforms, and filter bank structures, which enable their efficient learning or usage. Apart from batch transform learning, our group has investigated methods for online learning of sparsifying transforms, which are particularly useful for big data or real-time applications.

Huh.

### Shift-invariant codings

I would like to find a general way of doing this in a phase/shift-robust fashion, although doing this naively can be computationally expensive outside of certain convenient bases.

(Sorry, that's not very clear; I need to return to this section to polish it up.)

It can be better if you know you have have constraints, say, a convex combination (e.g. mixtures) or positive definite bases. (e.g. in kernel methods)

One method is “Shift Invariant Sparse coding”, ( BlDa04) and there are various versions out there. (GRKN07 etc) One way is to include multiple shifted copies of your atoms, another is to actually shift them in a separate optimisation stage. Both these get annoying in the time domain for various reasons.

Affine tight framelets (DHRS03) and their presumably less-computationally-tractable, more flexible cousins, shearlets also sound interesting here. For reasons I do not yet understand I am told they can naturally be used on sundry graphs and manifolds, not just lattices, is traditional in DSP. I saw Xiaosheng Zhuang present these (see, e.g. HaZZ16 and WaZh16, where WaZh16 demonstrates a Fast Framelet Transform which is supposedly as computationally as cheap as the FFT.)

I have some ideas I call learning gamelan which relate to this.

TBD.

## Implementations

This boils down to clever optimisation to make the calculations tractable.

• the wavelet toolkits.

• scipy's wavelet transform has no frills and little coherent explanation, but it goes

• pywavelets does various fancy wavelets and seems to be a standard for python.

• Matlab's Wavelet toolbox seems to be the reference.

• scikit-learn dictionary learning version here

• also pydbm

• Fancy easy GPU wavelet implementation, PyTorchWavelets.

• SPORCO

SParse Optimization Research COde (SPORCO) is an open-source Python package for solving optimization problems with sparsity-inducing regularization, consisting primarily of sparse coding and dictionary learning, for both standard and convolutional forms of sparse representation. In the current version, all optimization problems are solved within the Alternating Direction Method of Multipliers (ADMM) framework. SPORCO was developed for applications in signal and image processing, but is also expected to be useful for problems in computer vision, statistics, and machine learning.

• Sparse-filtering: Unsupervised feature learning based on sparse-filtering

This implements the method described Jiquan Ngiam, Pang Wei Koh, Zhenghao Chen, Sonia Bhaskar, Andrew Y. Ng: Sparse Filtering. NIPS 2011: 1125-1133 and is based on the Matlab code provided in the supplementary material

• spams does a variety of sparse codings, although non of them accepting pluggable models. Nonetheless it does some neat things fast. (see optimisation)

format: plain


text:
OpenGL Near clipping problems

Recommended Posts

I've made a terrain renderer, however I got some nearclipping problems when you're really close to the surface of the terrain. I've tried playing with the near value of gluPerspective but never got any good results. Right now I have 1 opengl unit as 1 meter(approx. 3 feet), should I instead use 1 unit as 1 decimeter(0.1meters) instead?

Share on other sites
OpenGL doesn't care at all about absolute measures, so changing unit to real world mappings won't make any difference what so ever.

The problem you have is, as I understand it, that basically you can see through the ground where the surface intersects the near clip plane. Not really much you can do easily except for restricting how close to the ground the viewpoint can be. Maybe you shouldn't allow the user to go as close as (s)he may want to, but stop just before the problem occurs.

Share on other sites
Are you sure OpenGL doesn't care at all about absolute measures?
If the landscape is larger in comparison to the camera then you should be able to get closer before you begin to clip through it..or is my logic gone wrong?

~ since when you scale, you scale everything including the height of the player.

Share on other sites
Maybe it's too restricted, but i sometimes use the extension

GL_NV_depth_clamp

to avoid near and far clipping. give it a try if you have the oportunity.

Share on other sites
Quote:
 Original post by Brother BobOpenGL doesn't care at all about absolute measures, so changing unit to real world mappings won't make any difference what so ever.The problem you have is, as I understand it, that basically you can see through the ground where the surface intersects the near clip plane. Not really much you can do easily except for restricting how close to the ground the viewpoint can be. Maybe you shouldn't allow the user to go as close as (s)he may want to, but stop just before the problem occurs.

Well I think it does I mean, for example, right now I got my camera 1.7 units above ground, however if I would increase the scale on the terrain by 10 times, the camera would be 17 units above ground, and then I should be able to have the near clipping plane at 1.0 and even further away without ever seeing any clipping. I'm pretty sure of this, however I'm not sure if this is the right way to go.

Share on other sites
Quote:
 Original post by stevenmarkyAre you sure OpenGL doesn't care at all about absolute measures?If the landscape is larger in comparison to the camera then you should be able to get closer before you begin to clip through it..or is my logic gone wrong?~ since when you scale, you scale everything including the height of the player.

Since you scale everything, you also scale the near and far clip plane distances. You can't get closer unit-wise, because the clip plane will clip further away by the same amount you scaled the scene.

Quote:
Original post by angry
Quote:
 Original post by Brother BobOpenGL doesn't care at all about absolute measures, so changing unit to real world mappings won't make any difference what so ever.The problem you have is, as I understand it, that basically you can see through the ground where the surface intersects the near clip plane. Not really much you can do easily except for restricting how close to the ground the viewpoint can be. Maybe you shouldn't allow the user to go as close as (s)he may want to, but stop just before the problem occurs.

Well I think it does I mean, for example, right now I got my camera 1.7 units above ground, however if I would increase the scale on the terrain by 10 times, the camera would be 17 units above ground, and then I should be able to have the near clipping plane at 1.0 and even further away without ever seeing any clipping. I'm pretty sure of this, however I'm not sure if this is the right way to go.

If scaling the scene 10 times and having the near clip plane at 1.0 solves your problem, then so does not scaling the scene and having the clip plane at 0.1. Try it. There's no difference at all. All OpenGL cares about are the relative proportions between things.

Share on other sites
In general, though, it's good to have your clip plane at least 0.5 meters out from the camera, in physical space (more is better). This is to avoid ugly Z fighting artifacts.

Typically, what you'll want to do with a camera is to create a collission ball around the camera, that is slightly larger than the clip distance. That way, you know that the camera will never come close enough to geometry to clip it. Then make the ball (and distance) as large as gameplay and level design will let you.

Create an account

Register a new account

• Partner Spotlight

• Forum Statistics

• Total Topics
627682
• Total Posts
2978615
• Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 13
• 12
• 10
• 12
• 22


text:
# A plastic ball falls on a floor with momentum p and then rebounds vertically. The process is repeated a number of times till the ball stops. If the coefficient of restitution is e, then what is the total momentum imparted by the plastic ball to the floor?

Q: A plastic ball falls on a floor with momentum p and then rebounds vertically. The process is repeated a number of times till the ball stops. If the coefficient of restitution is e, then what is the total momentum imparted by the plastic ball to the floor ?

(a) $p \frac{1 + e}{1-e}$

(b) $p \frac{e – 1}{e}$

(c) $p \frac{1 – e}{1 + e}$

(d) $p \frac{ e}{e – 1}$

Ans: (a)


text:
# Numerical solutions of partial differential equations

I'm studying mathematical physics and working on numerical solutions of partial differential equations. I am having trouble understanding the way we solve partial dif. equations, e.g.,

$\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2}+\frac{2}{x}.\frac{\partial u}{\partial x}$

$\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2} \dots$

I mean for first and second order partial derivatives we use backward, forward or central difference formulas. In some solutions for a partial derivative like $\frac{\partial u}{\partial x}$ it is written by using forward difference and sometimes by using central difference formula. How do we decide which formula we should use? Do we decide by looking at the boundary conditions, e.g, Dirichlet, Neumann,$\dots$? Finally, I try to solve problems with $0$ intuiton, can you enlighten me about what and how we do, please?

The advection term, $\frac{\partial u}{\partial x}$ is always tricky part to solve PDE in a numerical way. It has a certain direction as you said.

There are many techniques to treat this term. Instead of explaining all things, I give you a link that has good notation and explanation.

Randall's lecture note in UW

As to the question "How do we decide which formula we should use [to approximate a derivative]?", first think of what a finite difference (FD) scheme does: It approximates the derivative of a function, $f$, at a certain point, $x_k$, on a discrete mesh by a weighted sum of function values at neighbouring points, $f(x_k), \, f(x_{k\pm 1}), \, f(x_{k\pm 2}), \dots$. Thus, to choose a FD scheme we must consider what function values we have available. This is generally different at different points on the mesh. For example, at the left boundary point $x_L$ of a 1D domain we only have access to information that is located further to the right, i.e. $f(x_L), \, f(x_{L+1}), \dots$. Here it may be suitable to use a forward difference formula. The converse is true at the right boundary point, $x_R$, and a backward formula may be the right choice.
Similar situations arise if there is some interface present in the domain, or if the solution has a discontinuity at a critical point, $x_c$, and we don't want to use information from one side of $x_c$ to approximate the derivative at a point on the other side.


text:
# Abstract:

On bounded or unbounded intervals of the real line, we introduce classes of regular statistical families, called Johnson families because they are obtained using generalized Johnson transforms. We study in a rigorous manner the formerly introduced concept of core function of a distribution from a Johnson family, which is a modification of the well known score function and which in a one-to-one manner represents the distribution. Further, we study Johnson parametrized families obtained by Johnson transforms of location and scale families, where the location is replaced by a new parameter called Johnson location. We show that Johnson parametrized families contain many important statistical models. One form appropriately normalized $L_2$ distance of core functions of arbitrary distributions from Johnson families is used to define a core divergence of distributions. The core divergence of distributions from parametrized Johnson families is studied as a special case.


text:
# But it works on my PC!

### The random thoughts of Richard Fennell on technology and software development

If you are using basic PowerShell scripts as opposed to DSC with Release Management there are a few gotcha’s I have found.

## You cannot pass parameters

Lets look at a sample script that we would like to run via Release Manager

param(    $param1 ) write-verbose -verbose "Start"write-verbose -verbose "Got var1 [$var1]"write-verbose -verbose "Got param1 [$param1]"write-verbose -verbose "End" In Release Manager we have the following vNext workflow You can see we are setting two custom values which we intend to use within our script, one is a script parameter (Param1), the other one is just a global variable (Var1). If we do a deployment we get the log Copying recursively from \\store\drops\rm\4583e318-abb2-4f21-9289-9cb0264a3542\152 to C:\Windows\DtlDownloads\ISS vNext Drops succeeded.StartGot var1 [XXXvar1]Got param1 []End You can see the problem,$var1 is set, $param1 is not. Took me a while to get my head around this, the problem is the RM activity’s PSSCriptPath is just that a script path, not a command line that will be executed. Unlike the PowerShell activities in the vNext build tools you don’t have a pair of settings, one for the path to the script and another for the arguments. Here we have no ways to set the command line arguments. Note: The PSConfigurationPath is just for DSC configurations as discussed elsewhere. So in effect the Param1 is not set, as we did not call test -param1 “some value” This means there is no point using parameters in the script you wish to use with RM vNext. But wait, I bet you are thinking ‘I want to run my script externally to Release Manager to test it, and using parameters with validation rules is best practice, I don’t want to loose that advantage The best workaround I have found is to use a wrapper script that takes the variable and makes them parameters, something like this $folder = Split-Path -Parent $MyInvocation.MyCommand.Definition&$folder\test.ps1 -param1 $param1 Another Gotcha Note that I need to find the path the wrapper script is running in and use it to build the path to my actual script. If I don’t do this I get that the test.ps1 script can’t be found. After altering my pipeline to use the wrapper and rerunning the deployment I get the log file I wanted Copying recursively from \\store\drops\rm\4583e318-abb2-4f21-9289-9cb0264a3542\160 to C:\Windows\DtlDownloads\ISS vNext Drops succeeded.StartGot var1 [XXXvar1]Got param1 [XXXparam1]End  This is all a bit ugly, but works. Looking forward this appears to not be too much of an issue. The next version of Release Management as shown at Build is based around the vNext TFS build tooling which seems to always allow you to pass true PowerShell command line arguments. So this problem should go away in the not too distant future. ## Don’t write to the console The other big problem is any script that writes or reads from the console. Usually this means a write-host call in a script that causes an error along the lines A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows. +At C:\Windows\DtlDownloads\ISS vNext Drops\scripts\test.ps1:7 char:1+ Write-Host "hello 1" -ForegroundColor red But also watch out for any CLS calls, that has caught me out. I have found the it can be hard to track down the offending lines, especially if there are PowerShell modules loading modules. The best recommendation is to just use write-verbose and write-error. • write-error if your script has errored. This will let RM know the script has failed, thus failing the deployment – just what we want • write-verbose for any logging Any other form of PowerShell output will not be passed to RM, be warned! You might also notice in my sample script that I am passing the –verbose argument to the write-verbose command, again you have to have this maximal level of logging on for the messages to make it out to the RM logs. Probably a better solution, if you think you might vary the level of logging, is to change the script to set the$VerbosePreference

param(    $param1 )$VerbosePreference ='Continue' # equiv to -verbose
write-verbose "Start"write-verbose "Got var1 [$var1]"write-verbose "Got param1 [$param1]"write-verbose "End"

So hopefully a few pointers to make your deployments a bit smoother

With the release of Visual Studio 2015 there are some significant changes to Visual Studio and TFS licensing, you can find the details of Brian Harry’s blog. These changes can make a serious change in what you need to purchase for different roles, so it could well be worth a look.

If you are providing a path to a custom test adaptor such as nUnit or Chutzpah for a TFS/VSO vNext build e.g. $(Build.SourcesDirectory)\packages, make sure you have no leading whitespace in the data entry form. If you do have a space you will see an error log like this as the adaptor cannot be found as the command line generated is malformed 2015-07-13T16:11:32.8986514Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\VSTest\1.0.16\VSTest.ps1 2015-07-13T16:11:33.0727047Z ##[debug]Calling Invoke-VSTest for all test assemblies 2015-07-13T16:11:33.0756512Z Working folder: C:\a\0549426d 2015-07-13T16:11:33.0777083Z Executing C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\a\0549426d\UnitTestDemo\WebApp.Tests\Scripts\mycode.tests.js" /TestAdapterPath: C:\a\0549426d\UnitTestDemo\Chutzpah /logger:trx 2015-07-13T16:11:34.3495987Z Microsoft (R) Test Execution Command Line Tool Version 12.0.30723.0 2015-07-13T16:11:34.3505995Z Copyright (c) Microsoft Corporation. All rights reserved. 2015-07-13T16:11:34.3896000Z ##[error]Error: The /TestAdapterPath parameter requires a value, which is path of a location containing custom test adapters. Example: /TestAdapterPath:c:\MyCustomAdapters 2015-07-13T16:11:36.5808275Z ##[error]Error: The test source file "C:\a\0549426d\UnitTestDemo\Chutzpah" provided was not found. 2015-07-13T16:11:37.0004574Z ##[error]VSTest Test Run failed with exit code: 1 2015-07-13T16:11:37.0094570Z ##[warning]No results found to publish. I have been doing some work on vNext Release Management; I managed to waste a good hour today with a stupid error. In vNext process templates you provide a username and password to be used as the Powershell remoting credentials (in the red box below) My Powershell script also took a parameter username, so this was provided as a custom configuration too (the green box). This was the issue. Not unsurprisingly having two parameters with the same name is a problem. You might get away with it if they are the same value (I did on one stage, which caused more confusion), but if they differ (as mine did in my production stage) the last one set wins, which meant my remote Powershell returned the error System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Permission denied while trying to connect to the target machine Gadila.blackmarble.co.uk on the port:5985 via power shell remoting. Easy to fix once you realise the problem, a logon failure is logged on the target machine in the event log. Just make sure you have unique parameters Many web sites are basically forms over data, so you need to deploy some DB schema and something like a MVC website. Even for this ’bread and butter’ work it is important to have an automated process to avoid human error. Hence the rise in use of release tools to run your DACPAC and MSDeploy packages. In the Microsoft space this might lead to the question of how Desired State Configuration (DSC) can help? I, and others, have posted in the past about how DSC can be used to achieve this type of deployment, but this can be complex and you have to ask is DSC the best way to manage DACPAC and MSDeploy packages? Or is DSC better suited to only the configuration of your infrastructure/OS features? You might ask why would you not want to use DSC, well the most common reason I see is that you need to provide deployment script to end clients who don’t use DSC, or you have just decided want basic PowerShell. Only you will be able to judge which is the best for your systems, but I thought it worth outlining an alternative way to do deployment of these package using Release Management vNext pipelines that does not make use of DSC. ## Background Let us assume we have a system with a SQL server and a IIS web server that have been added to the Release Management vNext environment. These already have SQL and IIS enabled, maybe you used DSC for that? The vNext release template allows you to run either DSC or PowerShell on the machines, we will ignore DSC, so what can you do if you want to use simple PowerShell scripts? ## Where do I put my Scripts? We will place the PowerShell scripts (and maybe any tools they call) under source control such that they end up in the build drops location, thus making it easy for Release Management to find them, and allowing the scripts (and tools) to be versioned. ## Deploying a DACPAC The script I have been using to deploy DACPACs is as follows # find the script folder$folder = Split-Path -parent $MyInvocation.MyCommand.DefinitionWrite-Verbose "Deploying DACPAC$SOURCEFILE using script in '$folder'"&$folder\sqlpackage.exe /Action:Publish /SourceFile:$folder\..\$SOURCEFILE /TargetServerName:$TARGETSERVERNAME /TargetDatabaseName:$TARGETDATABASENAME | Write-Verbose -Verbose

Note that:

1. First it finds the folder it is running in, this is the easiest way to find other resource I need
2. The only way any logging will end up in the Release Management logs is if is logged at the verbose level i.e. write-verbose “your message” –verbose
3. I have used a simple & my.exe to execute my command, but pass the output via the write-verbose cmdlet to make sure we see the results. The alternative would be to use invoke-process
4. SQLPACKAGE.EXE (and its associated DLLs) are located in the same SCRIPTS folder as the PowerShell script and are under source control. Of course you could make sure any tools you need are already installed on the target machine.

I pass the three parameters need for the strips as custom configuration

Remember that you don’t have to be the SQL server to run SQLPACKAGE.EXE, it can be run remotely (that is why in the screen shot above the ServerName is ISS IIS8 not SQL as you might expect)

## Deploying a MSDeploy Package

The script I use to deploy the WebDeploy package this is as follows

function Update-ParametersFile{    param    (        $paramFilePath,$paramsToReplace    )
write-verbose "Updating parameters file '$paramFilePath'" -verbose$content = get-content $paramFilePath$paramsToReplace.GetEnumerator() | % {        Write-Verbose "Replacing value for key '$($_.Key)'" -Verbose        $content =$content.Replace($_.Key,$_.Value)    }    set-content -Path $paramFilePath -Value$content
}
# the script folder$folder = Split-Path -parent$MyInvocation.MyCommand.Definitionwrite-verbose "Deploying Website '$package' using script in '$folder'" -verbose
Update-ParametersFile -paramFilePath "$folder\..\_PublishedWebsites\$($package)_Package\$package.SetParameters.xml" -paramsToReplace @{      "__DataContext__" = $datacontext "__SiteName__" =$siteName      "__Domain__" = $Domain "__AdminGroups__" =$AdminGroups}
write-verbose "Calling '$package.deploy.cmd'" -verbose& "$folder\..\_PublishedWebsites\$($package)_Package\$package.deploy.cmd" /Y | Write-Verbose -verbose Note that: 1. First I declare a function that I use to replace the contents of the package.setparameters.xml file, a key step in using binary promotion and WebDeploy 2. Again I finds the folder the script is running in so I can locate other resources 3. I then declare the parameters I need to replace and call the replacement function 4. Finally I call the package.deploy.cmd command, and pass the output via the write-verbose to pass the output to the Release Management logs This is called as follows ## Summary So I think these reusable scripts give a fairly easy way to make use of vNext Release Management pipelines. They can also easily be given to clients who just want to manually run something. With the help of the Release Management team at Microsoft I now have a working REST based automated TFS Build to Release Management pipeline. Previously we were using a TFS automated build and then manually triggering our agent based Release Management pipeline. When we moved to a vNext PS/DSC based RM pipeline I took the chance to automate the link using REST via a PowerShell script to trigger the initial deployment. However, I hit problem, first with a stupid 401 permission error and later with a much stranger 500 internal server error. ## Fixing the 401 error The first problem was that in the InitiateReleaseFromBuild.ps1 script defaults to a hardcoded username and password. You should really be using the current credentials. To do this make sure the lines around line60 in the script are as shown below (or enter valid credentials if you don’t want to use default credentials) $wc = New-Object System.Net.WebClient$wc.UseDefaultCredentials =$true# rmuser should be part rm users list and he should have permission to trigger the release.#$wc.Credentials = new-object System.Net.NetworkCredential("rmuser", "rmuserpassword", "rmuserdomain") ## Fixing the 500 error The 500 error was stranger. Turns out the issue was the registration of our TFS server in Release Management. Using the dialogs in the RM client we has registered our TFS server, this had generated the URL https://tfs.domain.com:443/tfs. If we ran the InitiateReleaseFromBuild.ps1 script with this URL set as a parameter we got the 500 error, the RM logs showed the workflow could not start. Eventually we realised it was because RM thought it could not access the TFS server. So the problem was that at some point between the script being run and the RM server processing the URL the :443 had been removed; presumably because this is the default for HTTPS and some layer was being ‘helpful’. This meant that the RM server was trying to string match the URL https://tfs.domain.com/tfs against https://tfs.domain.com:443/tfs which failed, hence the workflow failed. The fix was to edit the TFS registration in RM to remove the port number, leave the field empty (not that obvious as the dialog completes this field for you when you select HTTPS) Once this was done the URL matching worked and the release pipeline triggered as expected. Had a strange issue today while editing our standard TFS 2013 XAML build process template to add an optional post drop script block to allow a Release Management pipeline to be triggered via REST. Our standard template includes a block for enabling and disabling Typemock, after editing our template to add the new script block (nowhere near the Typemock section) our builds failed with the error TF215097: An error occurred while initializing a build for build definition \BM\ISS.Expenses.Main.CI: Exception Message: Cannot set unknown member 'TypeMock.TFS2013.TypeMockStart.DisableAutoLink'. (type XamlObjectWriterException) Exception Stack Trace: at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)  It took ages to find the issue, we hunted for badly formed XAML, but the issue turned out to be that when ever we opened the template in Visual Studio 2013 it added the highlighted property <If Condition="[UseTypemock = True]" DisplayName="If using Typemock" sap2010:WorkflowViewState.IdRef="If_8"> <If.Then> <Sequence DisplayName="Enabling Typemock" sap2010:WorkflowViewState.IdRef="Sequence_16"> <tt:TypeMockRegister AutoDeployDir="[TypemockAutoDeployDir]" Company="[TypemockCompany]" sap2010:WorkflowViewState.IdRef="TypeMockRegister_1" License="[TypemockLicense]" /> <tt:TypeMockStart DisableAutoLink="{x:Null}" EvaluationFolder="{x:Null}" Link="{x:Null}" LogLevel="{x:Null}" LogPath="{x:Null}" ProfilerLaunchedFirst="{x:Null}" Target="{x:Null}" Verbosity="{x:Null}" Version="{x:Null}" AutoDeployDir="[TypemockAutoDeployDir]" sap2010:WorkflowViewState.IdRef="TypeMockStart_1" /> </Sequence> </If.Then></If> It should have been <If Condition="[UseTypemock = True]" DisplayName="If using Typemock" sap2010:WorkflowViewState.IdRef="If_8"> <If.Then> <Sequence DisplayName="Enabling Typemock" sap2010:WorkflowViewState.IdRef="Sequence_16"> <tt:TypeMockRegister AutoDeployDir="[TypemockAutoDeployDir]" Company="[TypemockCompany]" sap2010:WorkflowViewState.IdRef="TypeMockRegister_1" License="[TypemockLicense]" /> <tt:TypeMockStart EvaluationFolder="{x:Null}" Link="{x:Null}" LogLevel="{x:Null}" LogPath="{x:Null}" ProfilerLaunchedFirst="{x:Null}" Target="{x:Null}" Verbosity="{x:Null}" Version="{x:Null}" AutoDeployDir="[TypemockAutoDeployDir]" sap2010:WorkflowViewState.IdRef="TypeMockStart_1" /> </Sequence> </If.Then></If> All I can assume is that this is due to some assembly mismatch between the Typemock DLLs linked to the XAML build process template and those on my development PC. The fix for now is to do the editing in a text editor, or at least checking the file to make sure the property has not been edited before it is checked in. When you using MSdeploy you should create a parameters.xml file that exposes your web.config settings at the time of installation. This enables good deployment habits, build the product one and then set system specific values using deployment tools. The problem is that this parameters.xml file is a pain to write, it is a series of XML blocks that contain XPath to find the entries to replace, typo’s are easy to introduce. A ripe candidate for automation, but I could not find a tool to do it, so I wrote one for Visual Studio 2013 and 2015. You can find the source on GitHub andthe actual VSIX package in the Visual Studio Gallery. So what does it do? Once it is installed, if you right click on a web.config file you will see a context menu option to generate a parameters.xml file, click it, if the file does not exist it will be generated and added to the current project. Entries will be made for all appSettings and any custom applicationSettings blocks found in the web.config. The actual web.config values will be replaced with __TAGS__ to be set via Release Management or your tool of choice. So the web.config file <configuration> <applicationSettings> <Service.Properties.Settings> <setting name="Directory1" serializeAs="String"> <value>C:\ABC1111</value> </setting> <setting name="Directory2" serializeAs="String"> <value>C:\abc2222</value> </setting> </Service.Properties.Settings> </applicationSettings> <appSettings> <add key="APPSETTING1" value="123" /> <add key="AppSetting2" value="456" /> </appSettings></configuration>  it generates the parameters.xml <parameters> <parameter name="APPSETTING1" description="Description for APPSETTING1" defaultvalue="__APPSETTING1__" tags=""> <parameterentry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='APPSETTING1']/@value" />  </parameter>
$scanner.Scan() write-host ("Succeeded [{0}]" -f$scanner.Succeeded)write-host ("Violation count [{0}]" -f $scanner.ViolationCount) See the GitHub site’s WIKI for the usage details. ### Step 3 – Create a vNext build PowerShell script So now we have the basic tools we need to run StyleCop from a TFS vNext build, but we do need a more complex script. The script you use is up to you, mine looks for .csproj files and runs StyleCop recursively from the directories containing the .csproj files. This means I can have a different setting.stylecop file for each project. In general I have more strict rules on production code than unit test e.g. for unit tests I am not bother about the XML method documentation, but for production code I make sure they are present and match the method parameters. Note: As the script just uses parameters and environment variable it is easy to test outside TFS build, a great improvement over the old build system ## Script to allow StyleCop to be run as part of the TFS vNext build#[CmdletBinding()]param( # We have to pass this boolean flag as string, we cast it before we use it # have to use 0 or 1, true or false [string]$TreatStyleCopViolationsErrorsAsWarnings = 'False')
# local test values, should be commented out in production#$Env:BUILD_STAGINGDIRECTORY = "C:\drops"#$Env:BUILD_SOURCESDIRECTORY = "C:\code\MySolution"
if(-not ($Env:BUILD_SOURCESDIRECTORY -and$Env:BUILD_STAGINGDIRECTORY)){    Write-Error "You must set the following environment variables"    Write-Error "to test this script interactively."    Write-Host '$Env:BUILD_SOURCESDIRECTORY - For example, enter something like:' Write-Host '$Env:BUILD_SOURCESDIRECTORY = "C:\code\MySolution"'    Write-Host '$Env:BUILD_STAGINGDIRECTORY - For example, enter something like:' Write-Host '$Env:BUILD_STAGINGDIRECTORY = "C:\drops"'    exit 1}
# pickup the build locations from the environment$stagingfolder =$Env:BUILD_STAGINGDIRECTORY$sourcefolder =$Env:BUILD_SOURCESDIRECTORY
# have to convert the string flag to a boolean$treatViolationsErrorsAsWarnings = [System.Convert]::ToBoolean($TreatStyleCopViolationsErrorsAsWarnings)
Write-Host ("Source folder ($Env) [{0}]" -f$sourcefolder) -ForegroundColor GreenWrite-Host ("Staging folder ($Env) [{0}]" -f$stagingfolder) -ForegroundColor GreenWrite-Host ("Treat violations as warnings (Param) [{0}]" -f $treatViolationsErrorsAsWarnings) -ForegroundColor Green # the overall results across all sub scans$overallSuccess = $true$projectsScanned = 0$totalViolations = 0 # load the StyleCop classes, this assumes that the StyleCop.DLL, StyleCop.Csharp.DLL,# StyleCop.Csharp.rules.DLL in the same folder as the StyleCopWrapper.dllAdd-Type -Path "StyleCop\StyleCopWrapper.dll"$scanner = new-object StyleCopWrapper.Wrapper
# Set the common scan options, $scanner.MaximumViolationCount = 1000$scanner.ShowOutput = $true$scanner.CacheResults = $false$scanner.ForceFullAnalysis = $true$scanner.AdditionalAddInPaths = @($pwd) # in in local path as we place stylecop.csharp.rules.dll here$scanner.TreatViolationsErrorsAsWarnings = $treatViolationsErrorsAsWarnings # look for .csproj filesforeach ($projfile in Get-ChildItem $sourcefolder -Filter *.csproj -Recurse){ write-host ("Processing the folder [{0}]" -f$projfile.Directory)
# find a set of rules closest to the .csproj file   $settings = Join-Path -path$projfile.Directory -childpath "settings.stylecop"   if (Test-Path $settings) { write-host "Using found settings.stylecop file same folder as .csproj file"$scanner.SettingsFile = $settings } else {$settings = Join-Path -path $sourcefolder -childpath "settings.stylecop" if (Test-Path$settings)       {            write-host "Using settings.stylecop file in solution folder"            $scanner.SettingsFile =$settings       } else        {            write-host "Cannot find a local settings.stylecop file, using default rules"            $scanner.SettingsFile = "." # we have to pass something as this is a required param } }$scanner.SourceFiles =  @($projfile.Directory)$scanner.XmlOutputFile = (join-path $stagingfolder$projfile.BaseName) +".stylecop.xml"   $scanner.LogFile = (join-path$stagingfolder $projfile.BaseName) +".stylecop.log" # Do the scan$scanner.Scan()
# Display the results    Write-Host ("n")    write-host ("Base foldert[{0}]" -f $projfile.Directory) -ForegroundColor Green write-host ("Settings t[{0}]" -f$scanner.SettingsFile) -ForegroundColor Green    write-host ("Succeeded t[{0}]" -f $scanner.Succeeded) -ForegroundColor Green write-host ("Violations t[{0}]" -f$scanner.ViolationCount) -ForegroundColor Green    Write-Host ("Log file t[{0}]" -f $scanner.LogFile) -ForegroundColor Green Write-Host ("XML resultst[{0}]" -f$scanner.XmlOutputFile) -ForegroundColor Green
$totalViolations +=$scanner.ViolationCount    $projectsScanned ++ if ($scanner.Succeeded -eq $false) { # any failure fails the whole run$overallSuccess = $false } } # the output summaryWrite-Host ("n")if ($overallSuccess -eq $false){ Write-Error ("StyleCop found [{0}] violations across [{1}] projects" -f$totalViolations, $projectsScanned)} elseif ($totalViolations -gt 0 -and $treatViolationsErrorsAsWarnings -eq$true){    Write-Warning ("StyleCop found [{0}] violations warnings across [{1}] projects" -f $totalViolations,$projectsScanned)} else{   Write-Host ("StyleCop found [{0}] violations warnings across [{1}] projects" -f $totalViolations,$projectsScanned) -ForegroundColor Green}

### Step 4 – Adding a the script to the repo

To use the script it needs (and any associated files) to be placed in your source control. In my case it meant I create a folder called StyleCop off the root of my TFS 2015 CTP’s Git repo and in it placed the following files

• PowerShell.ps1 – my script file
• StyleCop.dll – the main StyleCop assembly taken from c:\program files (x86)\StyleCop 4.7. By placing it here it means we don’t need to actually install StyleCop on the build machine
• StyleCop.csharp.dll – also from c:\program files (x86)\StyleCop 4.7
• StyleCop.csharp.rules.dll – also from c:\program files (x86)\StyleCop 4.7
• StyleCopWrapper.dll – the wrapper assembly from my GitHub site

### Step 5 – Adding the script to a build process

Once the script is in the repo adding a new step to a vNext build is easy.

• In a browser select the Build.vNext menu options
• The build explorer will be show, right click on the build you wish to add a step to and select edit
• Press the ‘Add build step’ button. The list of steps will be show, pick PowerShell

• As the script is in the repo we can reference it in the new step. in my case I set the script file name to

StyleCop/PowerShell.ps1
• My script takes one parameter, if we should treat StleCop violations as warnings, this is set as the script argument. Note I am using a build variable $(ViolationsAsWarnings) set to a string value ‘True’ or ‘False’, so I have one setting for the whole build script. Though a boolean parameter would be nice it seems I can only pass in strings as build variables, so I do the conversion to a boolean inside the script. -TreatStyleCopViolationsErrorsAsWarnings$(ViolationsAsWarnings)

### Step 6 - Running the build

My test solution has two projects, with different settings.stylecop files. Once the new step was added to my build I could queue a build, by altering \$(ViolationsAsWarnings)  variable I could make the build pass for fail.

The detailed StyleCop result are available in the build log and are also placed in the drops folder in an XML format.

Note: One strange behaviour is that when you test the script outside TFS build you get a .XML and .LOG file for each project scanned. In TFS build you only see the .XML file in the drops folder, this I think is because the .LOG has been redirected into the main TFS vNext build logs.

### Summary

So now I have a way to run StyleCop within a TFS vNext build.

Using these techniques there are no end of tools that can be wired into the build process, and I must say it is far easier than the TFS 2010, 2012, 2013 style workflow customisation.


text:
# Hiiii! as soon as you see this! answer it pleaseee16.What is the ( y) intercept of a line given: y= x - 6

###### Question:

16.What is the ( y) intercept of a line given: y= x - 6

### Write two separate sentences about gender and politics using commas.

Write two separate sentences about gender and politics using commas....

### Define Analogy, please! Thank you! :)

Define Analogy, please! Thank you! :)...

### If the circumference of a circle is 12.56 ft what is the diameter?

if the circumference of a circle is 12.56 ft what is the diameter?...

### Please Help Quick Consider the average speed of a runner who jogs around a track four times. The distance (400m) remains constant for each lap. However, each lap is run 5 seconds slower than the first. The time for each lap increases. The average speed for each lap ______________. This is an example of a(n) _____________ relationship. A) increases, direct B) decreases, direct C) increases, inverse D) decreases, inverse Note: If you have a question please do not ask it in the answer section

Please Help Quick Consider the average speed of a runner who jogs around a track four times. The distance (400m) remains constant for each lap. However, each lap is run 5 seconds slower than the first. The time for each lap increases. The average speed for each lap ______________. This is an example...

### My father is 47 years old. I am x years old. a.How old will my father be in y years’ time? b.How old will I be in y years’ time?

My father is 47 years old. I am x years old. a.How old will my father be in y years’ time? b.How old will I be in y years’ time?...

### Your original position in the family

your original position in the family...

### How do you solve 15.00 - 6.24

How do you solve 15.00 - 6.24...

### 4Complète avec les pronoms COD. a. Les baskets, vous.. trouvez dans un magasin de sport. b. Ce livre, vous ... commandez par Internet. C. Cet anorak, je .. adore. d. Cette chemise, tu ... trouves comment? e. Cette robe, tu ... habilles ce soir? f. Ces chaussettes, tu ... préfères de quelle couleur?

4Complète avec les pronoms COD. a. Les baskets, vous.. trouvez dans un magasin de sport. b. Ce livre, vous ... commandez par Internet. C. Cet anorak, je .. adore. d. Cette chemise, tu ... trouves comment? e. Cette robe, tu ... habilles ce soir? f. Ces chaussettes, tu ... préfères de quelle...

### A heterotrophic multicellular organism that does not have cell walls is called a(n) _______. A. animal B. plant C. virus D. bacteria User: A sponge can drop a piece of itself on to the floor of the ocean and the little piece then grows into a new individual. This is an example of _______. A. sexual reproduction B. excretion C. budding D. regeneration

A heterotrophic multicellular organism that does not have cell walls is called a(n) _______. A. animal B. plant C. virus D. bacteria User: A sponge can drop a piece of itself on to the floor of the ocean and the little piece then grows into a new individual. This is an example of _______. A. sexual ...

### Who led the United States Army against the frontiersmens’s during the whisky rebellion?

Who led the United States Army against the frontiersmens’s during the whisky rebellion?...

### Explain what "fear is a stimulus" means.

Explain what "fear is a stimulus" means....

### During May, Joliet Fabrics Corporation manufactured 600 units of a special multilayer fabric with the trade name Stylex. The following information from the Stylex production department also pertains to May. Direct material purchased: 19,000 yards at $1.48 per yard$ 28,120 Direct material used: 10,500 yards at $1.48 per yard 15,540 Direct labor: 3,100 hours at$9.25 per hour 28,675 The standard prime costs for one unit of Stylex are as follows: Direct material: 20 yards at $1.45 per yard$ 29.00

During May, Joliet Fabrics Corporation manufactured 600 units of a special multilayer fabric with the trade name Stylex. The following information from the Stylex production department also pertains to May. Direct material purchased: 19,000 yards at $1.48 per yard$ 28,120 Direct material used: 10,5...

### Given the diagram, below which statements are true? statement 1: Points Z, A, and X are collinear. statement 2: Points W, A, and Y are noncoplanar. statement 3: Rays WA and AY are on the line WY. statement 4: AW and AY are opposite rays on the line WY. 1. statement 1, 3 and 4 2. statements 1 and 2 3. statements 1 and 4 4. statements 1, 2, 3 and 4

Given the diagram, below which statements are true? statement 1: Points Z, A, and X are collinear. statement 2: Points W, A, and Y are noncoplanar. statement 3: Rays WA and AY are on the line WY. statement 4: AW and AY are opposite rays on the line WY. 1. statement 1, 3 and 4 2. statements 1 and 2 3...

### Θ is an acute angle and cosecant theta equals nine halves commacscθ= 9 2, find secant ((pi over 2) minus theta) .sec π 2−θ. do not use a calculator and express

Θ is an acute angle and cosecant theta equals nine halves commacscθ= 9 2, find secant ((pi over 2) minus theta) .sec π 2−θ. do not use a calculator and express...

### In the 1870s, the system of sharecropping failed to

In the 1870s, the system of sharecropping failed to...

### The speaker in Sonnet 73 is addressing his imminent death. T F

The speaker in Sonnet 73 is addressing his imminent death. T F...

### How many significant figures are there in the measurement 50,600 mg

How many significant figures are there in the measurement 50,600 mg...

### HURRY!!! Which functions have a y-intercept that is greater than the y-intercept of the function g(x) = |x + 3| + 4? Check three options. f(x) = –2 (x – 8)2 h(x) = –5 |x| + 10 j(x) = –4(x + 2)2 + 8

HURRY!!! Which functions have a y-intercept that is greater than the y-intercept of the function g(x) = |x + 3| + 4? Check three options. f(x) = –2 (x – 8)2 h(x) = –5 |x| + 10 j(x) = –4(x + 2)2 + 8...


text:
# How to find a close form expression in terms generating functions for the triple summation

Given $$\sum\limits_{i=0}^\infty a_i z^i=A(z)$$ and $$\sum\limits_{i=1}^\infty b_i z^i=B(z)$$ and $$\sum\limits_{i=0}^\infty c_i z^i=C(z)$$ Find $\sum\limits_{i=1}^\infty\sum\limits_{j=0}^\infty a_j \sum\limits_{k=1}^\infty b_kc_{k+j-i} z^i$ in terms of the generating functions $A(z),B(z),C(z)$.

-

Since $i=(j)+(k)-(j+k-i)$, the triple sum is $$\sum\limits_{\alpha,\beta,\gamma}a_\alpha b_\beta c_\gamma z^{\alpha+\beta-\gamma}=A(z)B(z)C(1/z).$$
Thank you for your help. Please see this also $\sum\limits_{i=0}^\infty a_i z^i=A(z)$ and $\sum\limits_{j=1}^\infty b_j z^j=B(z)$ and $\sum\limits_{k=0}^\infty c_k z^{-k}=C(1/z)$ Then $\sum\limits_{i=0}^\infty\sum\limits_{j=1}^\infty\sum\limits_{k=1}^\infty a_ib_jc_{i+j-k} z^k=$? –  Litun Feb 20 '13 at 6:40
Whether this expression is same as the previous one $A(z)B(z)C(1/z)$ –  Litun Feb 20 '13 at 8:13
As $A(z)B(z)=\sum\limits_{i=0}^{\infty}\sum\limits_{j=0}^{i}a_jb_{i-j}$ then what is the expression for $A(z)B(z)C(1/z)$ –  Litun Feb 20 '13 at 8:27


text:
# How to configure and use¶

## The COBRA Toolbox¶

### Introduction¶

A comprehensive code base such as the COBRA Toolbox evolves constantly. The open-source community is very active, and collaborators submit their contributions frequently. The more a change to code or bug fix is interlinked with existing functions, the higher the risk of a new addition breaking instantly code that is heavily used on a daily basis. In order to decrease this risk, a continuous integration setup interlinked with the version control system git has been set up. A git-tracked repository is essentially a folder with code or other documents of which all incremental changes are tracked by date and user.

Any incremental changes to the code are called commits. The main advantage of git over other version control systems is the availability of branches. In simple terms, a branch contains a sequence of incremental changes to the code. Consequently, a contribution generally consists of several commits on a branch.

Contributing to the COBRA Toolbox is straightforward. As a contributor to the COBRA Toolbox is likely more familiar with MATLAB than with the internal mechanics of git, the MATLAB.devTools have been developed specifically to contribute to a git-tracked repository located on the Github server. In Figure 6, an overview of the two online repositories as well as their local copies is given. There are two ways of using the COBRA Toolbox, which depends on the type of user. A regular user might only want to use the opencobra repository and enjoy stability (option A), whereas more advanced users might want to develop their own features and actively make contributions to the opencobra repository (option B).

• Option A The opencobra/cobratoolbox repository is a public repository that is read-only. Once the opencobra repository has been installed in the folder cobratoolbox, all branches (including master and develop) are available locally. In the local directory cobratoolbox folder, the user has read and write access, but cannot push eventual changes back to the opencobra repository. It is the default and stable master branch only that should be used. The local copy located in the cobratoolbox directory can be updated (both branches).
• Option B In order to make changes to the opencobra repository, or, in other words, contribute, you must obtain your own personal copy first. You must register on the Github website in order to obtain a username. First, click on the button FORK at the top right corner of the official opencobra/cobratoolbox repository website in order to create a personal copy (or fork) with write and read access of the opencobra repository. This copy is accessible under https://github.com/<username>/cobratoolbox, where <username> is your Github username. In the fork-cobratoolbox folder, other user specific branches may exist in addition to the master and develop branches.

After initialisation of the MATLAB.devTools, the user and developer may have two folders: a cobratoolbox folder with the stable master branch checked out, and a fork-cobratoolbox folder with the develop branch checked out. Detailed instructions for troubleshooting and/or contributing to the COBRA Toolbox using the terminal (or shell) are provided here.

After the official opencobra version of the COBRA Toolbox has been installed, it is possible to install the MATLAB.devTools from within MATLAB:

>> installDevTools

With this command, the directory MATLAB.devTools is created next to the cobratoolbox installation directory. The MATLAB.devTools can also be installed from the terminal (or shell):

\$ git clone git@github.com:opencobra/MATLAB.devTools

A working internet connection is required and git and curl must be installed. Installation instructions are provided on the main repository page of the MATLAB.devTools. A valid passphrase-less SSH key must be set in the Github account settings in order to contribute without entering a password while securely communicating with the Github server.

### Start a new contribution¶

The MATLAB.devTools are configured on the fly or whenever the configuration details are not present. The first time a user runs contribute, the personal repository (fork) is downloaded (cloned) into a new folder named fork-cobratoolbox at the location specified by the user. In this local folder, both master and develop branches exist, but it is the develop branch that is automatically selected (checked out). Any new contributions are derived from the develop branch. Initialising a contribution using the MATLAB.devTools is straightforward. In MATLAB, type:

>> contribute % then select procedure [1]

If the MATLAB.devTools are already configured, procedure [1] updates the fork (if necessary) and initialises a new branch with a name requested during the process. Once the contribution is initialised, files can be added, modified or deleted in the fork-cobratoolbox folder. A contribution is successfully initialised when the user is presented with a brief summary of configuration details. Instructions on how to proceed are also provided.

The location of the fork must be specified as the root directory. There will be a warning issued if the path already contains another git-tracked repository.

### Continue an existing contribution¶

An existing contribution can be continued after a while. This step is particularly important in order to retrieve all changes that have been made to the opencobra repository in the meantime.

>> contribute % then select procedure [2]

Procedure [2] pulls all changes from the opencobra repository, and rebases the existing contribution. In other words, existing commits are shifted forward and placed after all commits made on the develop branch of the opencobra repository.

Before attempting to continue working on an existing feature, make sure that you published your commits.

### Publish a contribution¶

Publishing a contribution means uploading the incremental code changes to the fork. The changes are available in public, but not yet available in the opencobra repository. A contribution may only be accepted in the official repository once a pull request has been submitted. It is not necessary to open a pull request if you want to simply upload your contribution to your fork.

>> contribute % then select procedure [3]

When running procedure [3], you have two options:

• Option A Simple contribution without opening a pull request: All changes to the code are individually listed and the user is asked explicitly which changes shall be added to the commit. Once all changes have been added, a commit message must be entered. Upon confirmation, the changes are pushed to the online fork automatically.
• Option B Publishing and opening a pull request: The procedure for submitting a pull request is the same as option (A) with the difference that when selecting to open a pull request, a link is provided that leads to a pre-configured website according to the contributing guidelines. The pull request is then one click away.

After following procedures [1] and [2], all changes should be published using procedure [3] before stopping to work on that contribution. When following procedure [3], the incremental changes are uploaded to the remote server. It is advised to publish often, and make small incremental changes to the code. There is no need for opening a pull request immediately (option A) if there are more changes to be made. A pull request may be opened at any time, even manually directly from the Github website.

### Deleting a contribution¶

If a contribution has been merged into the develop branch of the opencobra repository (accepted pull request), the contribution (branch) can be safely deleted both locally and remotely on the fork by running contribute and selecting procedure [4].

Note that deleting a contribution deletes all the changes that have been made on that branch. It is not possible to selectively delete a commit using the MATLAB.devTools. Instead, create a new branch by following procedure [1], and follow the instructions to cherry-pick (see Troubleshooting).

Make sure that your changes are either merged or saved locally if you need them. Once procedure [4] is concluded, all changes on the deleted branch are removed, both locally and remotely. No commits can be recovered.

It is sometimes useful to simply update the fork without starting a new contribution. The local fork can be updated using procedure [5] of the contribute menu.

>> contribute % then select procedure [5]

Before updating your fork, make sure that no changes are present in the local directory fork-cobratoolbox. You can do so by typing:

>> checkStatus

If there are changes listed, publish them by selecting procedure [3] of the contribute menu.

## COBRA.tutorials¶

If you want to use the MATLAB.devTools when contributing to the COBRA.tutorials, you can simply configure the MATLAB.devTools on-the-fly by typing:

>> contribute('opencobra/COBRA.tutorials')

In case of troubleshooting, please refer this <>__ section.

## Other repository¶

The MATLAB.devTools can only be used with publicly accessible repositories.

If you want to use the MATLAB.devTools with a repository other than the default repository, you may run:

>> contribute('userName/repositoryName')

where userName is the name on Github of the organization or the user, and repositoryName is the name of the repository. The URL of the repository would be https://github.com/userName/repositoryName. Please note that this command looks for a repository on github.com.


text:
## University Calculus: Early Transcendentals (3rd Edition)

$2 \pi$
We need to compute the surface area. $S= \int_{m}^{n} 2 \pi y \sqrt {1+(y')^2} \\=(2 \pi) \times \int_{1/2}^{3/2} \sqrt {2x-x^2} \times \sqrt {\dfrac{1}{2x-x^2}} \space dx\\=(2 \pi) \int_{1/2}^{3/2} x \space dx \\=2 \pi$