Snowflake
An in-dev flat UI CSS styles suite for "TweetDeck"
I am using snowflake cloud datawarehouse, which is like teradata that hosts data. I am able run queries and get results on the web UI itself. But I do not know how can one export the results to a local PC so that we can report based on the data.
Please Help me. Thanks in advance
Source: (StackOverflow)
How to declare parameters in a snowflake Cloud computing query.
Here is the query in sql server
declare @id int
SET @id=1
select username from user where id=@id
How can we use this query in snowflake Cloud computing DB?
Source: (StackOverflow)
I am using the above library in my vb.net web app. The person who developed snowmaker said that you shouldn't create a new instance every time you want an ID, you should use a basic singleton.
I know what singletons are, but have never used them. I have come across this on stack overflow
Public NotInheritable Class MySingleton
Private Shared ReadOnly _instance As New Lazy(Of MySingleton)(Function() New
MySingleton(), System.Threading.LazyThreadSafetyMode.ExecutionAndPublication)
Private Sub New()
End Sub
Public Shared ReadOnly Property Instance() As MySingleton
Get
Return _instance.Value
End Get
End Property
End Class
Here is the code I'm using to generate the ID's
Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings("blobStorage").ConnectionString)
Dim ds As New BlobOptimisticDataStore(storageAccount, "container-name")
Dim generator = New UniqueIdGenerator(ds)
Dim ret = generator.NextId(table)
which works, but how do I incorporate that into the singleton class so that I only call it once from my web app?
Source: (StackOverflow)
I am trying to parse an AIXM5.1 xml file of size >50 MB using JAXB. I am able to unmarshal this xml within a minute itself. But, when I try to iterate through the java object and fetching values of the fields in XML it is taking huge time.
After analyzing I found that the xml has xlinks which internally refer to an xml fragment with in the same xml, like there are around 40000 xlink references are there. So everytime for finding the specific xml fragment which is referred in xlink I am trying to iterate through the whole object. which is taking time.
Sample xml fragment is as below
<aixm:geometryComponent>
<aixm:AirspaceGeometryComponent gml:id="ID_2903_1384156119164_17492"><aixm:operation>BASE</aixm:operation>
<aixm:theAirspaceVolume>
<aixm:AirspaceVolume gml:id="ID_2903_1384156119164_17493">
<aixm:upperLimit uom="FL">30</aixm:upperLimit><aixm:upperLimitReference>STD</aixm:upperLimitReference>
<aixm:lowerLimit uom="FT">GND</aixm:lowerLimit><aixm:lowerLimitReference>MSL</aixm:lowerLimitReference>
<aixm:contributorAirspace>
<aixm:AirspaceVolumeDependency gml:id="ID_2903_1384156119164_17494"><aixm:dependency>HORZ_PROJECTION</aixm:dependency>
**<aixm:theAirspace xlink:rel='nofollow' href="urn:uuid:1c49634e-62ea-4319-bf80-23f3912cef8e">**</aixm:theAirspace>
</aixm:AirspaceVolumeDependency>
</aixm:contributorAirspace>
</aixm:AirspaceVolume>
</aixm:theAirspaceVolume>
</aixm:AirspaceGeometryComponent>
</aixm:geometryComponent>
If you observe element has a xlink:href attribute it has uuid value through this uuid I have to find out the Airspace xml fragment with the matching uuid. Like this there are 40000+ references exist in the xml.
When I googled to resolve xlinks through JAXB I found that JXPath i an alternative. But I could not find the examples pertaining to JXPath with inherited classes.
Please guide me if anybody worked on it or suggest me any other technologies.
Looking forward for your help..
Source: (StackOverflow)
Here is the code that i tried for snow flakes. Everything seems ok but once the certain period of time that script get unresponsive means (It slow down the browser firefox).
I am not sure why this should happen.
How can i make it as responsive without cause anything to browser.
Here is FIDDLE
How can i make it responsive script which doesn't cause any.!
I think I made a mistake in looping the javascript function :(
Any Suggestion Would Be great.
Thanks
Javascript:
// window.setInterval(generateSnow, 0);
var windowHeight = jQuery(document).height();
var windowWidth = jQuery(window).width();
function generateSnow() {
for (i = 0; i < 4; i++) {
var snowTop = Math.floor(Math.random() * (windowHeight));
snowTop = 0;
var snowLeft = Math.floor(Math.random() * (windowWidth - 2));
var imageSize = Math.floor(Math.random() * 20);
jQuery('body').append(
jQuery('<div />')
.addClass('snow')
.css('top', snowTop)
.css('left', snowLeft)
.css('position', 'absolute')
.html('*')
);
}
}
function snowFalling() {
jQuery('.snow').each(function(key, value) {
if (parseInt(jQuery(this).css('top')) > windowHeight - 80) {
jQuery(this).remove();
}
var fallingSpeed = Math.floor(Math.random() * 5 + 1);
var movingDirection = Math.floor(Math.random() * 2);
var currentTop = parseInt(jQuery(this).css('top'));
var currentLeft = parseInt(jQuery(this).css('left'));
jQuery(this).css('top', currentTop + fallingSpeed);
if (movingDirection === 0) {
jQuery(this).css('bottom', currentLeft + fallingSpeed);
} else {
jQuery(this).css('bottom', currentLeft + -(fallingSpeed));
}
});
}
window.setInterval(snowFalling, 15);
window.setInterval(generateSnow, 1000);
Source: (StackOverflow)
I'm having a problem with this Python program. It's supposed to draw a Koch-Snowflake with n iterations. The code does compile but it won't draw a snowflake and I can't find my mistake.
I'd be very thankful if anyone could help me out with this!
from math import sqrt
from matplotlib import pyplot as plt
class vector:
def __init__(self,one,two):
self.x = one
self.y = two
def printV(self):
s = "(" + str(self.x) + "," + str(self.y) + ")"
print s
def __len__(self):
l = sqrt(self.x**2 + self.y**2)
return l
def kochSnowflakeImpl(p1,p2):
u = vector(p1.x + p2.x - p1.x, p1.y + p2.y - p1.y)
array = []
#calculate n1
n1 = vector(p1.x + 1.0/3.0 * u.x, p1.y + (1.0/3.0) * u.y)
#calculate n2
n2 = vector(p1.x + 2.0/3.0 * u.x,p1.y + 2.0/3.0 * u.y)
v = vector(n1.y + n2.y - n1.y, -(n1.x + n2.x - n1.x)) #is an orthogonal vector to u
#calculate n3
n3 = vector(n1.x + 0.5*u.x + sqrt(3.0)/2.0 * v.x, p1.y + 0.5*u.y + sqrt(3.0)/2.0* v.y)
array.append([n1.x,n1.y])
array.append([n2.x,n2.y])
array.append([n3.x,n3.y])
return n1,n2,n3,array
def kochSnowflake(level):
p1 = vector(0,0) #format: p = (x,y)
p2 = vector(1,0)
p3 = vector(0.5,sqrt(3)/2)
array = [[p1.x,p1.y],[p2.x,p2.y],[p3.x,p3.y],[p1.x,p1.y]]
while level > 0:
if level == 1:
n1,n2,n3,array1 = kochSnowflakeImpl(p1,p2)
n4,n5,n6,array2 = kochSnowflakeImpl(p2,p3)
n7,n8,n9,array3 = kochSnowflakeImpl(p3,p2)
for i in array1:
array.append(i)
for j in array2:
array.append(j)
for k in array3:
array.append(k)
else:
n1,n2,n3,array1 = kochSnowflakeImpl(p1,p2)
n11,n21,n31,array11 = kochSnowflakeImpl(n1,n3)
n12,n22,n32,array12 = kochSnowflakeImpl(n3,n2)
n4,n5,n6,array2 = kochSnowflakeImpl(p2,p3)
n41,n52,n61,array21 = kochSnowflakeImpl(n4,n6)
n42,n52,n62,array22 = kochSnowflakeImpl(n6,n5)
n7,n8,n9,array3 = kochSnowflakeImpl(p1,p3)
n71,n81,n91,array31 = kochSnowflakeImpl(n7,n9)
n72,n82,n92,array32 = kochSnowflakeImpl(n9,n8)
for i in array1:
array.append(i)
for i in array11:
array.append(i)
for i in array12:
array.append(i)
for j in array2:
array.append(j)
for j in array21:
array.append(j)
for j in array22:
array.append(j)
for k in array3:
array.append(k)
for k in array31:
array.append(k)
for k in array32:
array.append(k)
level -= 1
return array
if __name__=='__main__':
points = kochSnowflake(5)
x,y = zip(*points)
plt.plot(x, y)
plt.show()
Source: (StackOverflow)
I am using this free snow particle generator plug-in which works great:
Reference for plug-in: http://www.thepetedesign.com
Reference on my codepen: http://codepen.io/dada78/pen/ec9784f3dd4273160307328c4496787f
My question is, that in the plug-in instructions it says:"//If you want to change an option after initiating let_it_snow
plugin you can trigger the letItSnow.set
event passing two arguments in the second parameter array: ["optionName", "optionValue"]
like so:
`$("canvas").trigger("letItSnow.set", ["count", 200]);`
enter code here
Which I thought I did in my codepen. I can't figure out what I am doing wrong as it's not triggering the new values. Thanks!
Source: (StackOverflow)
I have a question in regards to star schema design, whether I need to use snowflake (which I read should be avoided).
I have the following three dimension tables:
- Main list dim. - contains list of people
- Sub lists dim. - contains all sorts of combinations from the main list
- Program dim. - identify lists of programs, each program could be connected to a sub list
Each row in the fact table will contain keys from the following three tables (and metrics), but the issue is this - some sub lists can be the exact list (in terms of list content) but pointing to different programs. So should I create in the sub list dimension repetition of the same content or should I use snow flake to connect between the sub lists and the programs?
Example - assuming my main list contain 100K records, and I have 3 programs A, B and C. Program A has 10K sub list so I will have 10K entries in the sub list dimension, however program B and C have the same sub list with 30K records, so should I create 60K entries, 30K per each??
Important to note that there are other attributes in the program DIM that differentiate between each program, and the fact data is at the program level.
Thanks!
Source: (StackOverflow)
I need a help. I faced with one problem which relates to the particle system in my live wallpaper. I don't know how to make snowflake fall downward more realistic, adding swinging motion. here the code
final int mParticleX = CAMERA_WIDTH/2;
final int mParticleY = 1;
final int mParticleWidth = CAMERA_WIDTH;
final int mParticleHeight = 1;
//Set the max and min rates that particles are generated per second
final int mParticleMinRate = 2;
final int mParticleMaxRate = 5;
//Set a variable for the max particles in the system.
final int mParticleMax = 100;
/* Create Particle System.
* Changed to BatchedSpriteParticleSystem to improve performance
* and reduce battery usage*/
final BatchedSpriteParticleSystem particleSystem = new BatchedSpriteParticleSystem
(new RectangleParticleEmitter(mParticleX, mParticleY, mParticleWidth, mParticleHeight),
mParticleMinRate, mParticleMaxRate, mParticleMax,
this.mSnowflakeTextureRegion, this.getVertexBufferObjectManager());
particleSystem.addParticleInitializer(new BlendFunctionParticleInitializer<UncoloredSprite>(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE));
// set initial velocity
this.mVelocityParticleInitializer = new VelocityParticleInitializer<UncoloredSprite>(-100, 100, 20, 190);
particleSystem.addParticleInitializer(this.mVelocityParticleInitializer);
// add gravity so the particles fall downward
particleSystem.addParticleInitializer(new GravityParticleInitializer<UncoloredSprite>());
// add acceleration so particles float
particleSystem.addParticleInitializer(new AccelerationParticleInitializer<UncoloredSprite>(-3, 3, -3, -5));
// add a rotation to particles
particleSystem.addParticleInitializer(new RotationParticleInitializer<UncoloredSprite>(0.0f, 360.0f));
OffCameraExpireParticleModifier<UncoloredSprite>offCameraExpireParticleModifier= new OffCameraExpireParticleModifier<UncoloredSprite>(mCamera);
particleSystem.addParticleModifier(offCameraExpireParticleModifier);
// change rotation of particles at various times
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(0.0f, 5.0f, 0.0f, -180.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(5.0f, 15.0f, -180.0f, 90.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(20.0f, 30.0f, 90.0f, 0.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(30.0f, 40.0f, 0.0f, -90.0f));
// add some fade in and fade out to the particles
particleSystem.addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(0.0f, 1.0f, 0.0f, 1.0f));
particleSystem.addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(6.0f, 10.0f, 1.0f, 0.0f));
// attach particle system to scene
this.mScene.attachChild(particleSystem);
createSceneCallback.onCreateSceneFinished(mScene);
Source: (StackOverflow)