Showing posts with label big loop My VS C#. Show all posts
Showing posts with label big loop My VS C#. Show all posts

Friday, April 24, 2015

Windows 10 Universal App ( UAP) Styles

As Raiford says, the Windows Universal Platform provides much more flexibility for responsive design than Universal Windows 8.1 does. Converged controls, API contracts, and new Xaml features such as adaptive triggers and RelativePanel make it much easier for a single Xaml file to target multiple device types in many cases. In others you'll still want to provide separate Xaml files for different devices.

Depending on your app's specific needs you may use different styles for different device sizes and capabilities even within the same executable.

For more details check out Build next week!

Windows 10 Universal App ( UAP) Styles

Thanks Raiford and Rob. But as per blogs, windows 10 has builtin capability to adjust based on screen size. But I don't see it happening. For example  : If there is text block of size 14 , it should be displayed as 14 in Windows tablet and same on phone. I see font become bigger in size in windows phone. How can I make use of adaptive triggers to set Phone style when application is running in phone. Do I need to change for each and every control in page using adaptive trigger. Is there any other way of resolving style. Like I wil have 2 style one for Windows and one for Phone. based on device, it should pickup style key from either Windows or windows phone. But I cant have 2 same keys in 2 Resource dictionary. is there simple way of setting style based on device and screen mode  sizes

Adaptive UX: Windows 10 provides the ability to use a single UI that can adapt from small to large screens. For developers with an existing Windows 8.1 app, you can quickly try this one out by (a) removing one of your UI projects (and going from three Visual Studio projects to one!) and (b) add the improved ViewStateManager to control how your UI adapts at runtime.

  • User controls: A number of our Windows 10 UI controls will determine, at runtime, how the customer is interacting with your app and render the appropriate user experience (e.g. on a laptop with a touch-screen, an app fly-out control will provide larger touch-targets if tapped with touch, as opposed to clicked with a mouse).

how to put SSML string into a seperate file

string Ssml =
    @"<speak version='1.0' " +
    "xmlns='http://ift.tt/1k6Kcb1' xml:lang='en-US'>" +
    "Hello <prosody contour='(0%,+80Hz) (10%,+80%) (40%,+80Hz)'>World</prosody> " + 
    "<break time='500ms' />" +
    "Goodbye <prosody rate='slow' contour='(0%,+20Hz) (10%,+30%) (40%,+10Hz)'>World</prosody>" +
    "</speak>";

how to reference it in c# if is in different file, i can do it in xaml but the syntax for  "<" is  different.

the above code is just inside  c#. a simple string literal assigned to string variable, is there any other way to do this.

I'm trying to learn speech synthesis for windows runtime but the is little to nothing documentation on the web. I alreaady tried that mva course. 

Is column visibility based on the first page of the result set or the entire result set?

I have tried, in vain, to play with the column visibility expression in my report. So where my Business Unit is "MC" or "FM", then I want to display column "HCFA Number"...otherwise hide it. If I run strictly for "MC" it works! If I run simply for "CO" it works! And doesn't show! But if I combine "CO" and "MC", it is hidden and I would expect it to be visible since "MC" is part of my entire report.

Here's the expression I came up with for Column Visibility...

=IIf((Fields!BUSINESS_UNIT.Value = "MC") OR
        (Fields!BUSINESS_UNIT.Value = "FM"),FALSE,TRUE)

Am I missing something here or just being dense late on a Friday???

Thanks for your review and am hopeful for a reply.

Trouble with Search using MSSQLFT and Like

I am using SPServices to run a search on a scope I have defined. When the page first loads, I run a query that retrieves all the items from the search scope using

var queryExtra = '';
var q = "SELECT Title,Path,Description,Write,Rank,Size,SiteTitle FROM SCOPE() WHERE ";
q += queryExtra + " (\"SCOPE\"='LC Engagement Sites') ORDER BY Rank";
                                   
var queryText = makeQuery(q);

$().SPServices({  
  operation: "Query",
  queryXml: queryText,  
  completefunc: function(xData, Status) { 

  })
})  
        

The function makeQuery turns the sql into the required xml.  When run, this works.

I also have a textbox that allows the user to show only ones where the title contains some text.  I have tried using like and contains to restrict the search but both return no results.

var queryExtra = getAll || title == "" ? "" : " Title like '%" + title + "%' AND ";

var queryExtra = getAll || title == "" ? "" : " CONTAINS(title,'" + title + "') and ";

The query ends up looking like this

SELECT Title,Path,Description,Write,Rank,Size,SiteTitle FROM SCOPE() WHERE  CONTAINS(title,'taiwan') and  ("SCOPE"='LC Engagement Sites') ORDER BY Rank

or 

SELECT Title,Path,Description,Write,Rank,Size,SiteTitle FROM SCOPE() WHERE  title LIKE '%taiwan%' and  ("SCOPE"='LC Engagement Sites') ORDER BY Rank

and the query packet looks like this

<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>
  <Query>
    <Context>
      <QueryText language='en-US' type='MSSQLFT'><!
        [CDATA[SELECT Title, Path, Description, Write, Rank, Size, SiteTitle 
        FROM SCOPE() 
        WHERE  CONTAINS(title,'taiwan') and  
         ("SCOPE"='LC Engagement Sites') ORDER BY Rank
        ]]>
      </QueryText>
    </Context>
    <IncludeSpecialTermResults>
      true
    </IncludeSpecialTermResults>
    <Range>
      <Count>1000</Count>
    </Range>
  </Query>
</QueryPacket>

Is there something I'm doing wrong? I've seen many examples that show that this is possible but so far no luck.

SPSiteDataQuery How to Paging?

Hi,

Yes, there is no such built-in function to handle pagination when using SPSiteDataQuery to retrieve data from multiple lists.

As a workaround, you can retrieve all the data back, then implement custom pagination on the retrieved result.

A similar thread with some useful ideas would be helpful:

http://ift.tt/1aYZITg

A demo about Paging using SPSiteDataQuery for your reference:

http://ift.tt/1EArfs5  

Thanks

TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

SPSiteDataQuery How to Paging?

Thanks!

update a gridview when contact form is closing

Hallo

Sorry for the late reply.

I checked the parameters with Breakpoints and all the correct values is in the where clause, and yes it is executing the method, but for some reason it is not populating the data table, if I step through the code no population is done on hte table and the gridview is not filled.

Is there anything that I must enable to click to update the Gridvew update from another form?

Regards,

Jacques.


labjac

update a gridview when contact form is closing

While you stepping into PopulateGridView method, please take the sql query of the code and execute in SQL with the same param passed and see if its returning result.

Fouad Roumieh

Convert rows to columns

>> I have a table with birth_date and test results, I am trying to pull the data from the table and convert rows columns, below is the table I am using. <<

Good SQL programmers would do this with a report writer, not with a query. You also have no key, so this is not a table at all! You also have no idea how to use ISO-11179 for data elements test_names, constraints or proper data types. A birth_date is a property of a patient, not a test. Want to include his shoe size, too? 

What is “id”? A patient? A magical generic thing from physical storage? If it is really an identifier, then it cannot be a numeric value! Basic data modeling defines this. 

CREATE TABLE Test_Results
(patient_id CHAR(10) NOT NULL
  REFERENCES Patients (patient_id),
 test_name VARCHAR(10) NOT NULL, 
 test_seq INTEGER NOT NULL
  CHECK(test_seq BETWEEN 1 and 5)
 test_results INTETGER NOT NULL
 CHECK(test_results >= 0),
 PRIMARY KEY (patient_id, test_name, test_seq)
);

Until we get valid DDL, it is not worth guessing at DML. 

--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL

Division by zero

Hi,

I need some help with my function in my report, thu function I currently use is the following:

Public Function CalcDivision(ByVal Numerator As Object, ByVal Denominator As object, ByVal DivideByZeroDefault As Object) As Object
If Denominator <> 0 Then
   Return Numerator/Denominator
Else
   Return DivideByZeroDefault
End If
End Function

=Code.CalcDivision(Fields!Sales_Refund.Value,Fields!Sales.Value,Nothing)

the problem is that it still return zero instead of nothing, which is the goal here, I have tried different variation but still returning zero

Any help is greatly appreciated

Thanks

Adding object

Should I have a constructor in the Student class to instantiate my five students ?

Adding object

Hi Toch,

I wasn't the one who suggested putting a Student[] property in the Course class ... that was Kyle. I just marked his reply as a Proposed Answer.

But, to answer your question, you've probably left out the creation/instantiation of the myStudents object:

// Instantiation of five students
Student[] myStudents = new Student[5];
myStudents[0].sFirstName = "Anders";  
// ... and so on

But, why don't you show us the code you've got now, if the above doesn't help you.


~~Bonnie DeWitt [C# MVP]

http://ift.tt/1bPbIRj

Classes that are not thread safe

Does a facility exist to implement thread specific storage in a class, or cause that class to fault if its reference is passed into more than one thread? How does one normally ensure/convey a class that is not thread safe to a consumer aside from doc strings?

Thanks!

Classes that are not thread safe

There is no specific way to convey that you class is not thread safe.  More than likely you should add it to the class summary tag. All you can do is convey the message.

Classes that are not thread safe

Ok, thanks for the confirmation. I assume there is no built in facility to provide thread specific fields without manually implementing something which is likely not worth the effort.

Thanks.

Classes that are not thread safe

Yes, there's a ThreadLocal<T> class.

In general way there's no way to cause a reference alone to be inaccessible by another thread, unless it's a ThreadLocal.  You'd have to intercept and deny a reference being passed to the wrong thread at the moment it is being passed.  You'll need to define your own logic to prevent it.

I would not trust any class to be "thread safe" unless it came with some kind of promise that it was.  Even then, I'd expect that promise to be fairly detailed and explicit.  In fact, I would hope (for performance reasons) that implementations are not trying to keep themselves "thread safe" (such as a List<T>, for example).

Classes that are not thread safe

Hi Wyck,
That actually answers my question about thread local storage. So, if I use ThreadLocal<T>(Func<T>) to initialize a field to a collection of some type for example, if the class implements IDisposable how does it get access to each threads copy of the field when disposing? Or better put, what is the pattern for dealing with tls when disposing?

Thanks!

Classes that are not thread safe

Hi Wyck,
That actually answers my question about thread local storage. So, if I use ThreadLocal<T>(Func<T>) to initialize a field to a collection of some type for example, if the class implements IDisposable how does it get access to each threads copy of the field when disposing? Or better put, what is the pattern for dealing with tls when disposing?

Thanks!

There's no change in the pattern. The TLS just holds a thread-local reference to an object.  All multithreaded issues with respect to disposal of that object still apply.  Take steps to ensure you know which thread is disposing the object.

Instead of Insert, Verify not inserting into identity column.

I am writing an Instead of Insert trigger. I would like to fire an error when inserting into an 'Identity' column.  Since UPDATE([ColumnName]) always returns TRUE for insert statements, is there an easy/fast way around this? I don't want to use: 

IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NULL))

here is my pseudo-code...

CREATE VIEW [org].[Assets]
WITH SCHEMABINDING
AS
SELECT
        [AS].[AS_ID],  -- Identity field in base table
        [AS].[Tag],
        [AS].[Name]
FROM [org].[AS_Assets_Rewind](DEFAULT, DEFAULT, DEFAULT)        [AS];
GO

CREATE TRIGGER [org].[Assets_Insert]
ON [org].[Assets]
INSTEAD OF INSERT
AS
BEGIN

        SET NOCOUNT ON;
        SET XACT_ABORT ON;

        -- How does this statment need to be written to throw the error?
        --      UPDATE([AS_ID]) always returns TRUE
        IF(UPDATE([AS_ID]))
                RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;

        -- Is there a faster/better method than this?
        IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NOT NULL))
                RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;

        -- Do Stuff

END;

-- Should error for inserting into [AS_ID] field (which is an identity field)
INSERT INTO [org].[Assets]([AS_ID], [Tag], [Name])
VALUES(1, 'f451', 'Paper burns'),
        (2, 'k505.928', 'Paper burns in Chemistry');

-- No error should occur
INSERT INTO [org].[Assets]([Tag], [Name])
VALUES('f451', 'Paper burns'),
        ('k505.928', 'Paper burns in Chemistry');