Showing posts with label playing. Show all posts
Showing posts with label playing. Show all posts

Wednesday, March 21, 2012

Playing with Named Sets

Hi,

Considering these data, which shows turnover per Salesmen/region

SalesMan1

SalesMan2

SalesMan3

SalesMan4

A

20

30

45

65

B

40

60

90

135

C

45

65

100

150

D

30

45

70

105

E

50

75

115

150

F

15

25

40

60

I created different named sets such as :

CREATE SET CURRENTCUBE.[Without F Region]

AS {EXCEPT([Region].[Region Code].[All].Children,

[Region].[Region Code].&[F])};

CREATE SET CURRENTCUBE.[SalesMan1]

AS {EXCEPT([Sales Force].[SalesMan].[All].Children,

[Sales Force].[SalesMan].&[SalesMan1])};

Using those named sets I would like to define a measure that will show the turnover for region A B C D E and SalesMan1 ...

SalesMan1

SalesMan2

SalesMan3

SalesMan4

A

20

0

0

0

B

40

0

0

0

C

45

0

0

0

D

30

0

0

0

E

50

0

0

0

F

0

0

0

0

I tryed different syntax

SUM(([Without F Region],[SalesMan1]),[Turnover])

SUM(Crossjoin([Without F Region],[SalesMan1]),[Turnover])

but I cannot get it work. The total is correct, but using dimension, the result is not splited.

SalesMan1

SalesMan2

SalesMan3

SalesMan4

A

185

185

185

185

B

185

185

185

185

C

185

185

185

185

D

185

185

185

185

E

185

185

185

185

F

185

185

185

185

Any idea ?

Regards

Ayzan

The problem is that the named sets are evaluated before the context is set in the query.

If you are using AS2005 you could force the context to be re-evaluated with the EXISTING statement

eg

SUM(Crossjoin(EXISTING [Without F Region], EXISTING [SalesMan1]),[Turnover])

|||

Thank you for your reply.

It works perfectly.

Regards

Ayzan

Playing with database mirroring

I started to play with mirroring with a fresh SQLServer 2005 but I can't get
it to work. This is the scenario:
server1.mydomain - Primary - Hosts "MyDatabase" - Primary Windows 2003
domain controller
server2.mydomain - Future mirror - Secondary Windows 2003 domain controller
server2.mydomain/secondary - a secondary instance for the witness (I don't
have a third machine to test)
1) I backup MyDatabase with SQL Management Studio (SMS).
2) I restore the database from the file (backup.bak) into server2 with
NORECOVERY (SMS shows "Recovering...")
3) From server1 I use the "Configure Security Wizard" to create endpoints in
ports 6000 for server1, 6000 for server2, 6001 for server2/secondary.
Endpoints are succesfully created.
4) All three servers use the same accout (MYDOMAIN\Administrator), used to
create the endpoints.
5) Then in SMS I click "Start Mirroring" and, after 10 sec. aprox, I get an
error "TCP://server1.mydomain.com:6000" could not be reached".
6) In server2, SMS now shows "In recovery" for Mydatabase, but mirroring is
not working. If I click "Start Mirroring" in server1 again, I get a "Neither
the partner nor the witness server instance for database MyDatabase is
available"
What is the problem? From Server1 I tried telneting server2:6000, and
server2:6001 and both connections are accepted. I also tried setting
encryption on/off but I can't fix the errors.
Any ideas? Thanks a lot!
Check the Surface Area configuration and make sure that each instance has
remote connections enabled.
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Kirsten" <noreply@.nospam.com> wrote in message
news:OXsjAkVFGHA.2036@.TK2MSFTNGP14.phx.gbl...
>I started to play with mirroring with a fresh SQLServer 2005 but I can't
>get it to work. This is the scenario:
> server1.mydomain - Primary - Hosts "MyDatabase" - Primary Windows 2003
> domain controller
> server2.mydomain - Future mirror - Secondary Windows 2003 domain
> controller
> server2.mydomain/secondary - a secondary instance for the witness (I don't
> have a third machine to test)
> 1) I backup MyDatabase with SQL Management Studio (SMS).
> 2) I restore the database from the file (backup.bak) into server2 with
> NORECOVERY (SMS shows "Recovering...")
> 3) From server1 I use the "Configure Security Wizard" to create endpoints
> in ports 6000 for server1, 6000 for server2, 6001 for server2/secondary.
> Endpoints are succesfully created.
> 4) All three servers use the same accout (MYDOMAIN\Administrator), used to
> create the endpoints.
> 5) Then in SMS I click "Start Mirroring" and, after 10 sec. aprox, I get
> an error "TCP://server1.mydomain.com:6000" could not be reached".
> 6) In server2, SMS now shows "In recovery" for Mydatabase, but mirroring
> is not working. If I click "Start Mirroring" in server1 again, I get a
> "Neither the partner nor the witness server instance for database
> MyDatabase is available"
> What is the problem? From Server1 I tried telneting server2:6000, and
> server2:6001 and both connections are accepted. I also tried setting
> encryption on/off but I can't fix the errors.
> Any ideas? Thanks a lot!
>
|||Remote connections are enabled. Other ideas?
Thanks a lot.
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:%23N5dhRWFGHA.3920@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Check the Surface Area configuration and make sure that each instance has
> remote connections enabled.
> --
> Mike
> Mentor
> Solid Quality Learning
> http://www.solidqualitylearning.com
>
> "Kirsten" <noreply@.nospam.com> wrote in message
> news:OXsjAkVFGHA.2036@.TK2MSFTNGP14.phx.gbl...
don't[vbcol=seagreen]
endpoints[vbcol=seagreen]
to
>
|||Done. Something was wrong with DNS. I tried with TCP://192.168.0.xxx
instead of name and it worked.
Cheers.
"Kirsten" <email@.emailnospam.com> escribi en el mensaje
news:u4H4zBYFGHA.1676@.TK2MSFTNGP09.phx.gbl...
> Remote connections are enabled. Other ideas?
> Thanks a lot.
> "Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
> news:%23N5dhRWFGHA.3920@.TK2MSFTNGP09.phx.gbl...
> don't
> endpoints
> to
>
sql

Playing MP3 from Database

(Crossposted to c.d.ms-sqlserver and m.p.asp.general. I think it's more
of an ASP question, but I'm hoping that maybe somebody on c.d.m has
encounterd the problem before.)

The Application

I'm working on a 3-tier client server application where MS SQL Server
2000 is the database tier, ASP (classic) on MS IIS is the business logic
tier, and Windows 2000 pro with IE6 is the presentation layer.

My application is a language learning environment and I have the need to
play sound files (encoded as MP3s) to the student. Traditionally we've
played some tricks with the html "bgsound" attribute to play the files.

As our application has grown, we've begun to run into problems keeping
the sound files organized. As they are in various languages, and we
don't keep native speakers of all those languages on staff, you can
imagine the problems if the sound file becomes "detached" from its
descriptive media. Especially when we have tens of thousands of these
things, so the names can't be all that descriptive.

The Problem

The obvious solution, to me, is to store the files as blobs in SQL
Server in a record that includes descriptive text, as well as where
(logically) the sound file belongs.

I'm familiar with storing and retrieving blobs, but the part I don't
know how to approach, is how to deliver the MP3 to the student via
classic ASP. In other words, I want to have a button on an HTML page
that when pressed by the student plays the associated MP3 file.

I'm presuming that as a first step I'll need to cache the MP3 file on
the server as some kind of tmp file. But then, what mechanism do I use
to get the client's browser to play the MP3 file?

Thank you,

-- Rick> I'm presuming that as a first step I'll need to cache the MP3 file on
> the server as some kind of tmp file.

Ugh. Doesn't that make it sound like, it makes more sense to keep the MP3
on the file system? How hard could it be to manage/mimic the folder
structure (hence keeping the files organized) through the database?|||"Guinness Mann" <GMann@.dublin.com> wrote in message
news:MPG.1a00749e932cba47989712@.news.newsguy.com.. .
> (Crossposted to c.d.ms-sqlserver and m.p.asp.general. I think it's more
> of an ASP question, but I'm hoping that maybe somebody on c.d.m has
> encounterd the problem before.)
>
> The Application
> I'm working on a 3-tier client server application where MS SQL Server
> 2000 is the database tier, ASP (classic) on MS IIS is the business logic
> tier, and Windows 2000 pro with IE6 is the presentation layer.
> My application is a language learning environment and I have the need to
> play sound files (encoded as MP3s) to the student. Traditionally we've
> played some tricks with the html "bgsound" attribute to play the files.
> As our application has grown, we've begun to run into problems keeping
> the sound files organized. As they are in various languages, and we
> don't keep native speakers of all those languages on staff, you can
> imagine the problems if the sound file becomes "detached" from its
> descriptive media. Especially when we have tens of thousands of these
> things, so the names can't be all that descriptive.
>
> The Problem
> The obvious solution, to me, is to store the files as blobs in SQL
> Server in a record that includes descriptive text, as well as where
> (logically) the sound file belongs.
> I'm familiar with storing and retrieving blobs, but the part I don't
> know how to approach, is how to deliver the MP3 to the student via
> classic ASP. In other words, I want to have a button on an HTML page
> that when pressed by the student plays the associated MP3 file.
> I'm presuming that as a first step I'll need to cache the MP3 file on
> the server as some kind of tmp file. But then, what mechanism do I use
> to get the client's browser to play the MP3 file?

As Aaron said, keep the files in the file system and just use the database
to manage a reference to them. Then use ASP/ADO and whatever logic you need
to lookup the correct file paths to Response.Write the bgsound HTML code
with paths to the appropriate files.

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsser...ty/centers/iis/|||Also, remember that the mp3 spec allows information to be written to the
header. You could always read this (of course, assuming the mp3's were
encoded with it) and incorporate it into some sort of housekeeping method to
refresh your database.

"Aaron Bertrand - MVP" <aaron@.TRASHaspfaq.com> wrote in message
news:%23MyMFnMmDHA.2080@.TK2MSFTNGP10.phx.gbl...
> > I'm presuming that as a first step I'll need to cache the MP3 file on
> > the server as some kind of tmp file.
> Ugh. Doesn't that make it sound like, it makes more sense to keep the MP3
> on the file system? How hard could it be to manage/mimic the folder
> structure (hence keeping the files organized) through the database?|||In article <#MyMFnMmDHA.2080@.TK2MSFTNGP10.phx.gbl>,
aaron@.TRASHaspfaq.com says...
> > I'm presuming that as a first step I'll need to cache
> > the MP3 file on the server as some kind of tmp file.
> Ugh. Doesn't that make it sound like, it makes more sense
> to keep the MP3 on the file system? How hard could it be
> to manage/mimic the folder structure (hence keeping the
> files organized) through the database?

And Tom Kaminski IIS MVP added...
> As Aaron said, keep the files in the file system and just
> use the database to manage a reference to them. Then use
> ASP/ADO and whatever logic you need to lookup the correct
> file paths to Response.Write the bgsound HTML code with
> paths to the appropriate files.

I'm not one to ask for advice and then ignore it, so that's probably
what I'll do. It's a really big problem, though. I have maybe 4,000 of
these small files per language, and 9 languages.

So with 36,000 files to keep track of, it's hard to find a naming
convention that makes it quick and easy to figure out where something
came from if it gets misplaced. I should mention that the production of
the MP3 files is done at a different time and place than the rest of the
work, so they end up getting moved a couple of times before they reach
their final resting place.

I was just thinking that if I included the script and the module, lesson
and language in a database table, that once I got them all matched up it
would be difficult to disconnect them again. Or at least easy to search
for, if misplaced.

Here's a typical question:

M01Q1L22A

(A telephone rings)

A: Hello, Mr. Smith speaking.
B: Good morning, may I speak to Mrs. Johnson?
A: I am sorry. Mary is not at home. Her sister, Jane is here.

Who does the caller want to speak to?

A. Mrs. Johnsons sister
B. Mr. Smith
C. Mrs. Mary Johnson
D. Miss Jane Baker

Answer: c

Thanks for your advice.

-- Rick|||> So with 36,000 files to keep track of, it's hard to find a naming
> convention that makes it quick and easy to figure out where something
> came from if it gets misplaced.

How does a file get misplaced? Take away manual human modifications, and
this should disappear as well. The files should be moved around by the
software, and this should be automated.

A|||In article <vpdom1oc3f6839@.corp.supernews.com>, mike@.micro-point.com
says...
> Also, remember that the mp3 spec allows information to be
> written to the header. You could always read this (of
> course, assuming the mp3's were encoded with it) and
> incorporate it into some sort of housekeeping method to
> refresh your database.

Hot damn! That's the brightest idea I've heard all month.

And Aaron said:
> How does a file get misplaced? Take away manual human
> modifications, and this should disappear as well.
> The files should be moved around by the software, and
> this should be automated.

Good point. If I make an application for the guy doing the sound
production to use, he can select the file for each question and the
program can move it to the right place. (And write the ID3 tags at the
same time -- just in case.) (And give it a normalized name...)

Thanks for all your help!

-- Rick|||"Guinness Mann" <GMann@.dublin.com> wrote in message
news:MPG.1a0093fb99b3c12a989714@.news.newsguy.com.. .
> I'm not one to ask for advice and then ignore it, so that's probably
> what I'll do. It's a really big problem, though. I have maybe 4,000 of
> these small files per language, and 9 languages.
> So with 36,000 files to keep track of, it's hard to find a naming
> convention that makes it quick and easy to figure out where something
> came from if it gets misplaced.

Perhaps using the conventions defined by the standards (ISO 639 and possibly
ISO 3166). For example:

ISO 639 defines the abbreviation for English to be "en" (or "eng" if you
want the 3-character version). French is "fr" (or "fre" or "fra"). You
could use this naming convention for your folders:

\mp3\en\ <English mp3s go here>
\mp3\fr\ <French mp3s go here
You could also apply this convention to the names of the mp3s.

en-someMp3File.mp3
fr-someMp3File.mp3

Whether you use this approach or not, choosing a naming convention and
sticking to it is important.

Hope this helps.
Regards,
Peter Foti

playing audio file inside the database!!

whats the preferred data type for audio file? and where does the sql server stores it?

Take a look at Using Large-Value Data Types topic in Books Online. You are probably looking for varbinary(max) to store the [audio file] data. The data istelf is stored in the user database.

Also look at TEXTIMAGE_ON option of CREATE TABLE. With it you can specify a particular filegroup where that data is stored.

HTH,
Boris.

playing audio file inside the database!!

whats the preferred data type for audio file? and where does the sql server stores it?

Take a look at Using Large-Value Data Types topic in Books Online. You are probably looking for varbinary(max) to store the [audio file] data. The data istelf is stored in the user database.

Also look at TEXTIMAGE_ON option of CREATE TABLE. With it you can specify a particular filegroup where that data is stored.

HTH,
Boris.

playing around views

hi
I just want to be sure there is no way to do it inside the DB:
I have a view which return 1000 numbers and amounts like this:
Number Amount
000 234
001 3456
... ...
999 464
I have only two very long columns. is it possible to re-arrange this into a
view to get something like this:
number amount number amount number amount
000 345 001 9861 002 865
003 4564 004 45 005 9865
thks.On Tue, 25 Jan 2005 09:05:03 -0800, Kenny M. wrote:

>I have a view which return 1000 numbers and amounts like this:
>Number Amount
>000 234
>001 3456
>... ...
>999 464
>I have only two very long columns. is it possible to re-arrange this into
a
>view to get something like this:
>number amount number amount number amount
> 000 345 001 9861 002 865
> 003 4564 004 45 005 9865
Hi Kenny,
This is a presentation task, typically done at the client. However, if you
really want to burden the server with it, try:
SELECT a.number, a.amount, b.number, b.amount, c.number, c.amount
FROM MyTable AS a
LEFT OUTER JOIN MyTable AS b
ON b.Number = a.Number + 1
LEFT OUTER JOIN MyTable AS c
ON c.Number = a.Number + 1
WHERE a.Number % 3 = 0
ORDER BY a.Number
(untested)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Why to stress your server trying to do this?. Use your client app / reportin
g
tool or programming language.
use northwind
go
select
identity(int, 0, 1) as number,
0 as amount
into
t
from
sysobjects as a cross join sysobjects as b
delete t where number > 999
update t set amount = power(2, number % 8)
select
*
from
(
select
number, amount
from
t
where
number % 3 = 0
) as a
left join
(
select
number, amount
from
t
where
number % 3 = 1
) as b
on a.number = b.number - 1
left join
(
select
number, amount
from
t
where
number % 3 = 2
) as c
on b.number = c.number - 1
drop table t
go
AMB
"Kenny M." wrote:

> hi
> I just want to be sure there is no way to do it inside the DB:
> I have a view which return 1000 numbers and amounts like this:
> Number Amount
> 000 234
> 001 3456
> ... ...
> 999 464
> I have only two very long columns. is it possible to re-arrange this into
a
> view to get something like this:
> number amount number amount number amount
> 000 345 001 9861 002 865
> 003 4564 004 45 005 9865
> thks.
>
>