Saturday, May 31, 2014

How to get the Parameters of a Parameterized Query from dm_exec_sql_text

Hi,


How can I get The values for each subsequent query that uses the cached plan can be gleaned from a SQL Trace or Extended Events trace of the individual BatchCompleted and RpcBatchCompleted events.


Can you please provide me a sample Query?


Thanks,


Rajib


How to get the Parameters of a Parameterized Query from dm_exec_sql_text

You would first need to set up a Trace or an Extended Events session to capture the actual query plan. Beware that this is extremely expensive, as it triggers all processes on the system to start generating this event, even if you filter for your own spid.


On my web site you find the tool sp_sqltrace, which you can use a starting point:

http://ift.tt/1oUcpRO





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

How to get the Parameters of a Parameterized Query from dm_exec_sql_text

Sorry, forgot to add the caveat that Trace may not be available in Azure. I believe X-Events are, but I am not in position to give a demo to set up an X-event session that captures the query plan. And, since it is resource consuming, it possible that this particular event is not available on Azure.


Then again, why you would retrieve the query plan only to get the actual parameters?





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

How to download pdf file in windows 8.1 store apps using C# and xaml?

Hi Aiman,


You can use Httpclient to download the file and use the storage api to save the file in local application folder;


var httpclient=new Httpclient(url:fileurl);


httpclient.getstreamAsyc();


Accessing reports from a legacy ASP web application

AFAIK web application generally use .rdlc (local reports) developed within application... Otherwise you need to use report viewer or call directly (url) report.


You can create a local user group on the host server and add all needed users into, then grant minimal security for that group in Report Manager..




Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


Right to left and Right Aligned Matrix


Hello


In a SSRS report i have a matrix whose LayoutDirection property is set to RTL (because it's in Hebrew). I created a column group So the number of the columns is variable (which is OK).


When I view the report, the order of the columns is correct (from right to left). But the problem is that the matrix grows to the right and is always aligned to the left. The report is RTL, so I need the way around, i.e. I want the matrix to be aligned to the right and grow to the left.


I couldn't find a way to fix it. Could you please help me to solve this problem?


Thanks.


Mohsen Kavyani





SQL Server is the Best!



Right to left and Right Aligned Matrix

some body , any body :-(




SQL Server is the Best!


Right to left and Right Aligned Matrix

I think you need to set a suitable value for location property particularly value for left property should be set based on report dimensions for moving matrix to right.


Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


how can transfer data from one form and it's owner

Neda,


Passing data between forms can be done a lot of different ways. I have written two blog posts on the subject that may give you some ideas:


http://ift.tt/1km5gds

http://ift.tt/1glQpvL


Hope it helps ...




~~Bonnie DeWitt [C# MVP]


http://ift.tt/1bPbIRj


Downloader Program stops half way

I have created program that will use a backgroundWorker to download a zip or rar and extract it to a direcotory, issue is - The progress bar stops near the middle - I check and only got 9,000 KB downloaded - The File on the server is over a Gig.


Here is the current code - Would love any help and improvements any one can give to me.



using SharpCompress;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Ionic.Zip;

namespace _1stCav_Updator
{
public partial class Main : Form
{
Stopwatch sw1 = new Stopwatch();

public Main()
{
InitializeComponent();

// Disable Buttons
btnFinish.Enabled = false;
btnStop.Enabled = false;
}

private void Form1_Load(object sender, EventArgs e)
{
string arma3Path = Properties.Settings.Default["ArmaPath"].ToString();
// Make sure they add arma path and saved
if (arma3Path != null)
{
// Error Message
string str = String.Format("Arma 3 Path was not detected.\n \nGo to Options and add your Arma 3 Directory.");
if (DialogResult.No != MessageBox.Show(str + "\nGo to Options Now?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
try
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else
{
// Do Nothing
}

// Debug Label
string armaPath;

// If arma3Path is not null
if (arma3Path != null)
{
armaPath = arma3Path.Substring(0, arma3Path.Length - "arma3.exe".Length);
lblArmaPath.Text = armaPath;
}
else
{
MessageBox.Show("Wait, This should be fixed.", "Error: 101", MessageBoxButtons.OK, MessageBoxIcon.Error);
armaPath = " "; // Added for 'Use of unassigned local variable'
}

}

private void btnOptions_Click(object sender, EventArgs e)
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}

//Delete File
static bool deleteFile(string f)
{
try
{
File.Delete(f);
return true;
}
catch (IOException)
{
return false;
}
}

private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
lblDownload.Text = "Download Mod Pack/Updates";
}

private void backgroundWorker1_RunWorkerComplete(object sender, RunWorkerCompletedEventArgs e)
{
btnFinish.Enabled = true;
lblDownload.Text = "Mod Pack Downloaded and Up to date";
}

private void btnFinish_Click(object sender, EventArgs e)
{
this.Close();
}

private void btnDownload_Click(object sender, EventArgs e)
{
// Call Background Worker1 to Download
//backgroundWorker1.RunWorkerAsync();

if (backgroundWorker1.IsBusy)
{
btnStop.Enabled = false;
btnDownload.Enabled = true;
}
else
{
backgroundWorker1.RunWorkerAsync();
btnDownload.Enabled = false;
btnStop.Enabled = true;
}
}

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
// Download Progress with background Worker
// backgroundWorker1.RunWorkerAsync();

// Define Server IP/url
string Server = "http://ift.tt/SsJ8m6;;
string arma3Path = Properties.Settings.Default["ArmaPath"].ToString();
string armaPath = arma3Path.Substring(0, arma3Path.Length - "arma3.exe".Length);
string lclVersion;

if (armaPath == "")
{
// Error Message
string str = String.Format("Arma 3 Path was not detected.\n \nGo to Options and add your Arma 3 Directory.");
if (DialogResult.No != MessageBox.Show(str + "\nGo to Options Now?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
try
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else
{
// Do Nothing
}

BackgroundWorker worker = sender as BackgroundWorker;
while (true)
{
if ((worker.CancellationPending == true))
{
e.Cancel = true;
break;
}
else
{
FileStream fs = null;
if (!File.Exists(armaPath + "version"))
{
using (fs = File.Create(armaPath + "version"))
{
// Blank Area - Do Nothing
}

// Create version
using (StreamWriter sw = new StreamWriter("version"))
{
sw.Write("0.0");
}
}

// Read Version
using (StreamReader reader = new StreamReader("version"))
{
lclVersion = reader.ReadLine();
}

decimal localVersion = decimal.Parse(lclVersion);

// Starting the Download/Update Process - Getting List
XDocument serverXML = XDocument.Load(@Server + "Updates.xml");

// Starting the Download/Update Process - Start
foreach (XElement update in serverXML.Descendants("update"))
{
string version = update.Element("version").Value;
string file = update.Element("file").Value;
decimal serverVersion = decimal.Parse(version);
string serverUrlToReadFileFrom = Server + file;
string serverFilePathToWriteTo = armaPath + file;

if (serverVersion > localVersion)
{
Uri url = new Uri(serverUrlToReadFileFrom);
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();


//Int64 iSize = response.ContentLength;

Int64 iSize = 2000;

Int64 iRunningByteTotal = 0;

using (System.Net.WebClient client = new System.Net.WebClient())
{
using (System.IO.Stream streamRemote = client.OpenRead(new Uri(serverUrlToReadFileFrom)))
{
// using (Stream streamLocal = new FileStream(serverUrlToReadFileFrom, FileMode.Create, FileAccess.Write, FileShare.None))
using (Stream streamLocal = new FileStream(serverFilePathToWriteTo, FileMode.Create, FileAccess.Write, FileShare.None))
{
int iByteSize = 0;
byte[] byteBuffer = new byte[iSize];
while ((iByteSize = streamRemote.Read(byteBuffer, 0, byteBuffer.Length)) > 0)
{
streamLocal.Write(byteBuffer, 0, iByteSize);
iRunningByteTotal += iByteSize;

double dIndex = (double)(iRunningByteTotal);
double dTotal = (double)byteBuffer.Length;
double dProgressPercentage = (dIndex / dTotal);
int iProgressPercentage = (int)(dProgressPercentage * 100);

// progressBar1.Maximum = byteBuffer.Length;

//lblSpeed.Text = string.Format("Speed: {0} kb/s", (iRunningByteTotal / 1024d / sw1.Elapsed.TotalSeconds).ToString("0.00"));
// lblPresent.Text = dProgressPercentage.ToString() + "%";
// lblDownloadTotal.Text = string.Format("Download: {0} MB's / {1} MB's", (iRunningByteTotal / 1024d / 1024d).ToString("0.00"), (iByteSize / 1024d / 1024d).ToString("0.00"));
backgroundWorker1.ReportProgress(iProgressPercentage);

int precent = (int)(((double)progressBar1.Value / (double)progressBar1.Maximum) * 100);
// lblPresent.Text = precent.ToString() + "%";
progressBar1.CreateGraphics().DrawString(precent.ToString() + "%", new Font("Arial", (float)8.25, FontStyle.Regular), Brushes.Black, new PointF(progressBar1.Width / 2 - 10, progressBar1.Height / 2 - 7));

}

streamLocal.Close();
}

streamRemote.Close();
}
}
}

// Start Unzipping
using (ZipFile zip = ZipFile.Read(armaPath + file))
//rar
{
foreach (ZipEntry zipFiles in zip)
{
//zipFiles.ExtractAll(arma3Path + "\\@1stCav\\", true);
//zipFiles.Extract(armaPath); // File Already Exsists
zipFiles.Extract(armaPath, ExtractExistingFileAction.OverwriteSilently);
}

}


WebClient webClient = new WebClient();
webClient.DownloadFile(Server + "version.txt", @armaPath + "version");


// Delete Zip File
// deleteFile(file); // Disable due to not wanting to delete file
}
}
}
}

private void btnStop_Click(object sender, EventArgs e)
{
if (backgroundWorker1.WorkerSupportsCancellation == true)
{
backgroundWorker1.CancelAsync();
btnDownload.Enabled = true;
btnStop.Enabled = false;
}
else
{
btnStop.Enabled = false;
}
}

private void btnDownloadBMod_Click(object sender, EventArgs e)
{

}
}
}


Downloader Program stops half way

Thanks - but anything more up to date?


Downloader Program stops half way

Hi LaocheXe,


Thank you for visiting MSDN forums.


Please don't post the whole project code here. To narrow down the issue, I recommend that you debug your code firstly, then post the code snippet with problems. Or just upload the whole project in OneDrive, then post the link of the project file so that we can easily test it. It's very hard for others to test your code without information about the controls and the logic of the code.


Thanks.




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


Downloader Program stops half way

Any one check it yet?

Help with schema to support tables where records exists for single entities over multiple years...

Do you need BusinessID and TaxYear as separate tables?


How about moving them to Business?




Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Adding A Custom Class To A Form From Toolbox Crashes VS

Hello,


I did one check via "Attach to process" and caught a stack overflow exception which give you a starting point to begin working thru the issue.





Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.


how to send key strokes to the game.

sir, i am developing an application through which one can send keystrokes to the active window. My app works just fine but when i try to send key strokes to simple 2D games then it does not work. I am using sendkeys.send() method to send keystrokes.


I also tried to send key strokes to games using windows on-screen keyboard and it works.


So my question is, how to send keystrokes to the games like windows on-screen keyboard sends?


how to send key strokes to the game.

On your windows form


with the windows selected


open the properties


you should see a symbol which resembles a lightning strike


search for key down event, double click it


Then look here



http://ift.tt/1wHdr8d



how to send key strokes to the game.

Thanks for answering.


But my question was not that.



I am developing a virtual keyboard. For example, if i select a C drive and i press a right key from my application then it points to D drive. which means my virtual keyboard works perfect. But when i play a game and clicks a right from my application then character does not move.



why is it so??


Report rows are too tall

No matter how skinny I make the rows in Design, when I go to Preview there is enough room in each report row for 4 rows worth of data. How can I shrink this down so I get 4 times more rows per page?

How to respond back to end user query in real time?

See code project below with complete source code


http://ift.tt/1cnLK8g




jdweng


How to respond back to end user query in real time?

Thanks a lot Joel. Thats what I was looking for.


Cheers :)


Shared libraries not accessable from portable libraries.

Hi Rob,, thanks for the input here. I will make an attempt using interfaces to accomplish the task. I have not had a lot of tasks involving interfaces although I understand the concept. Probably in the mean time I will cave and just do a windows 8.1 (yes on the point ones) app solo. It's great the XAML classes can be shared between the platforms now. Next step for MSFT is either just combine the platforms or make the service references cross compatible to make my life easier.


Thanks,


Matt


Linq Query displayed in a literal asp control.

I need to query the database and select a string to display in an literal asp control. The table contains its Id and the String. Two fields.


Here is the Linq query I have written, but when I load I return the following.



protected void Page_Load(object sender, EventArgs e)
{
LinqQuery();
}

protected void LinqQuery()
{
NewsItemsDataContext dc = new NewsItemsDataContext();
var n =
from a in dc.GetTable<NewsItem>()
select a;

litNewsItems.Text = n.ToString();
}

SELECT [t0].[NewsItemId], [t0].[NewsItem] AS [NewsItem1], [t0].[PublishedDate] FROM [dbo].[NewsItems] AS [t0]


How do I display NewsItem1 in the literal control ??


Linq Query displayed in a literal asp control.

Cool Thank you !!!



protected void LinqQuery()
{
NewsItemsDataContext dc = new NewsItemsDataContext();
var n =
from ni in dc.GetTable<NewsItem>()
select ni.NewsItem1;
var l = n.ToList();
foreach (var ni in n)
{
string NewsItems = ni.ToString();
litNewsItems.Text = NewsItems;
}

//litNewsItems.Text = NewsItem
}


The request is executed twice in IIS

ListBox Focus Issue On ItemSource Update

Why bind to a list? ObservableCollection extends List and implements INotifyCollectionChanged. Helps with binding if the list items are added or removed. I don't think List does updates the UI when the items are changed.

Get created ID and enter it to different table with other information

Solution: Its finally working. Thank you all so much especially @BonnieB



SqlCommand MyCommand = new SqlCommand ("INSERT INTO Vis (fName, sName, vCompany, vEmail, regNo, carMake, carColour) VALUES (@fName, @sName, @vCompany, @vEmail, @regNo, @carMake, @carColour); SET @visID = SCOPE_IDENTITY()", myConnection); MyCommand.Parameters.AddWithValue("@fName", Vis1.Text); MyCommand.Parameters.AddWithValue("@sName", TextBox1.Text); MyCommand.Parameters.AddWithValue("@vCompany", TextBox2.Text); MyCommand.Parameters.AddWithValue("@vEmail", emailTB.Text); MyCommand.Parameters.AddWithValue("@regNo", mailTB.Text); MyCommand.Parameters.AddWithValue("@carMake", lsMake.SelectedItem.Value); MyCommand.Parameters.AddWithValue("@carColour", lsColour.SelectedItem.Value); MyCommand.Parameters.AddWithValue("@visId", 0); MyCommand.Parameters["@visId"].Direction = ParameterDirection.InputOutput; myConnection.Open(); status = MyCommand.ExecuteNonQuery(); int visId = (int)MyCommand.Parameters["@visId"].Value; // Create INSERT statement to insert to History SqlCommand MyCommand1 = new SqlCommand ("INSERT INTO History(Campus, ParkName, BayNo, Disabled, bkDate, VisId) VALUES (@Campus, @ParkName, @BayNo, @Disabled, @bkDate, @VisId)", myConnection); MyCommand1.Parameters.AddWithValue("@Campus", mytexthid1.Text); MyCommand1.Parameters.AddWithValue("@Disabled", rbDisabled.SelectedItem.Value); MyCommand1.Parameters.AddWithValue("@bkDate", DateBox.Text); MyCommand1.Parameters.AddWithValue("@BayNo", mytexthid.Text); MyCommand1.Parameters.AddWithValue("@ParkName", mytexthid2.Text); MyCommand1.Parameters.AddWithValue("@VisId", visId); status = MyCommand1.ExecuteNonQuery(); return status; } }





a desperate learner


Download File Via JavaScript Calls From Website

Hello,



I am currently trying to create a program in c# that will download the file "PracticeProfiles.xls" from this website:



http://ift.tt/1kck9PC


I need to somehow on navigation to this site pass the javascript calls "showExport();exportData();", which will start the download.


Any help would be greatly appreciated.


Many Thanks


Could you please suggest the T-SQL

As suggested, best to use SSRS. I am moving it to the SSRS forum.


Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Friday, May 30, 2014

C Sharp

Why always we need set start up object before program compilation ?

C Sharp

Hello,


Please consider reading Abstract and Sealed Classes and Class Members (C# Programming Guide). Then ILSpy.




Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.


C Sharp

1. Why the programmer can n't create the object of abstract class ?


2. How to find IL code for a given program ?


Send data to Infopath form in SharePoint 2013 List

Hello,


I created a windows 8 app that uses SharePoint as a repository for my data.


I have an infopath form that users would usually enter in via a browser but instead I wanted to build a form within my app and on submit the data would go to the info path form in SharePoint.


The confusion comes in because the form has three fields and it is in a SharePoint list not a library so it has to be more specific when sending the data.


Any help on how to start this would be great, haven't seen much documentation on how to accomplish this.


Thanks!


Playing to sounds at once

I am looking to have music playing and to play sounds when a button is pressed but to continue to have the music playing.



The problem is that when I send it to another computer there is a problem playing sounds because of the file path.



I've tried such things as putting in get current directory and using that when trying to play the sound, i also had the sound file in the correct folder, been the bin folder.



This hasn't work.



I've tried something else which is using System.Windows.Media.MediaPlayer but I just get reference error at media!



what is the best and easier way to get sound to play written in one method, so that method can be called to play the sound.


I want to assign the Url of a Sharepoint list page to a Constant, and I am using it into User Control navigate Url.

I want to assign the Url of a Sharepoint list page to a Constant, and I am using it into User Control navigate Url.


But it is Not working there , Could you Please Suggest me the Better way..


Regards


Nitesh


I want to assign the Url of a Sharepoint list page to a Constant, and I am using it into User Control navigate Url.

Your question isn't clear. Can you explain what you're trying to do and what you've attempted?

[C#]How can I "Compare" two picture?

Not a really comparison, but like the films fingerprints comparer. I have got two picture, with the same person, but with different position. It's possible?

[C#]How can I "Compare" two picture?

C# cannot help you on this. Yes this is possible via existing products, you can use search engine to find them (and their price).


If you want to write your own, ask in a computer graphics forum instead.






Visual C++ MVP

Help with schema to support tables where records exists for single entities over multiple years...

Do you need BusinessID and TaxYear as separate tables?


How about moving them to Business?




Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Table with adds and subtracts, trying to get the balance

Here is the full statement with your code added.



SELECT i.ItemID AS ID,
i.ItemName as Name,
(SELECT SupplyStatus
FROM SupplyStatus
WHERE SupplyStatusID = i.SupplyStatusID) AS CurrentStatus,
SUM (
CASE
WHEN VolumeOrNumber IS NULL THEN 0
WHEN AdjustmentTypeID = 1 THEN VolumeOrNumber
WHEN AdjustmentTypeID = 2 THEN VolumeOrNumber *-1
ELSE 0
END) AS InventoryTotal
FROM Item i
LEFT JOIN Inventory v ON i.ItemID = v.ItemID
LEFT JOIN DefaultContainerSizeUnit u ON i.DefaultContainerSizeUnitID = u.DefaultContainerSizeUnitID
WHERE i.CultivationFacilityID = 1
AND i.SupplyTypeID = 1
AND i.ItemTypeID = 1
AND (i.EndDate > GETDATE() OR i.EndDate IS NULL)
ORDER BY i.ItemName


Table with adds and subtracts, trying to get the balance

So I added this:


GROUP BY i. ItemID, i. ItemName, i. SupplyStatusID


and it now works! Thanks for the help


Table with adds and subtracts, trying to get the balance



VolumeOrNumber *-1
is bad SQL; we have unary operators. It is like a grammar error in English.



--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


Power View, problem with filters

Javiera, is this still an issue?


Thanks!




Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)



Answer an interesting question? Create a wiki article about it!


Can an Access file on a non-SharePoint server be synced with a SharePoint list (bidirectionally, so updating one updates the other)?

Hi,


Can an MS Access file on a non-SharePoint server be synced with a SharePoint list (bidirectionally, so updating one updates the other)?


How?


Thanks so much.


How to deal with web parts that are missing from the "add a web part" menu?

When I edit a my site page, I see web parts like content editor, image viewer, media, page viewer. When I go to my normal sharepoint farm sites, I see a lot of other web parts, but not those 4.


What feature is needed to be activated (at farm level? at site collection level?) so that the page viewer web part is available?


Using the BackgroundDownloader to retrieve private Blobs from Windows Azure Storage

Let's try to simplify your requirement. The BackgroundDownloader needs a HTTP/HTTPS URL (or FTP protocol) to perform the download operation. If you can get the URL constructed in such a way that it contains the access token (which will authenticate the request) and then start the HTTP download, then the BackgroundDownloader can download the files without performing any custom authentication.


Are you even at a point where you have the URL created that will let you do that? If you have the URL created that satisfies this, you can try downloading the file using Fiddler tool or even Internet Explorer and see how the download happens.


If the question is about how to create the URL to download the files from your Azure account, maybe you should ask this question on the Azure forums - about generating the HTTP URL that will let you download files in the background (or using IE).




Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog


Button Click From "If" Statement

Hi guys,


I'm writing a "dashboard" kind of program where it will scan the computer's registry for certain keys from another program of mine. I have it setup so that when the user clicks a button, it scans the registry for the keys i specify, and if they exist, the program will pop-up on a list along with a "launch" button. My problem is that once the scan is complete, through an if statement, i want the user to be able to click that launch button to launch a specific file path. However, i can't figure out how to have the user be able to click the button inside the if statement code block. Here is some of my code.



private void TBSettingsAppCheck_Click(object sender, EventArgs e)
{
//Checks for Aspire Binary Converter:
RegistryKey rk = Registry.CurrentUser.OpenSubKey("Eclipsed SuperNova\\Aspire Binary Converter");

if (rk != null)
{
RegistryKey abcPath = Registry.CurrentUser.OpenSubKey("Eclipsed SuperNova\\Aspire Binary Converter");
string abcReg = (string)abcPath.GetValue("ABCKey");
Software1.Text = "Aspire Binary Converter";
groupBox1.Visible = true;
}
else
{
MessageBox.Show("Aspire Core did not find any other Aspire software installed on this computer.");
}

}



If you can help, it will be greatly appreciated. Thanks, William




Whutchison


Button Click From "If" Statement

Greetings William.


If I understand your problem (which I'm not sure that I do), the usual way to handle this kind of situation is to have a launch button with a normal click event handler, but which starts out disabled. Then when the conditions are right for the user to click on launch, enable it. That is, you enable the button inside the 'if' block.


Displaying sum of result in column based on filter/grouping used

Hello All


Hopefully this is an quick & easy one and I should try to play around a bit before posting here probably but kinda on a deadline and very new with SSRS so posting the question here.


We have a table with following attributes:



  • User Name

  • User Email Address

  • Count of Emails sent by user

  • Size of emails sent by user

  • Data upload time.


For each user & day, we've row with above values. i.e. for 1 week period, we'll have 7 rows for a given user with above data.


Basically our management access this report and filter based on data upload time range like from 1st January to 1st February 2014. Now what they want is, instead of having 7 rows as explained above, they want only single row with sum of 7 rows displayed in same.


I've played some with reporting grouping in SSRS builder 3.0, but not able to get exactly what they want.


Any pointers for me please? Will be really appreciated !


Thanks in advance !




AKL


Displaying sum of result in column based on filter/grouping used

Unless you need to expose the detail, you can just group the data in the dataset query.

Parameters not passin values to the report

Sorry still getting blank report when i had All in the query.


Thanks


Shortcuts

There is shortcut in VS where I can write prop etc, double tab and have visual studio write it for me. Love it!



I'm just wondering is there one for a method/ function.



Such that I write something and it does this



public void blahblah()

{



}


Shortcuts

Hello,


Please review Creating Code Snippets.




Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.


Organisation

Hi, is there a program what I can use to pre plan everything before even starting to program.



I was hoping for something which would allow me to write what is going into what class, I don't even know my self what it is am looking for but there must be some sort of way to help you guys stay organised!

warning MSB3270 - There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "E:\Common\Assemblies\Spiricon.TreePattern.dll", "x86".

warning MSB3270 - There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "E:\Common\Assemblies\Spiricon.TreePattern.dll", "x86".

turns out someone changed the Platform target to x86 even though the Platform was set to Any CPU


sorry about the fire drill...


**Free** E-Book!

http://ift.tt/SZdltl


Free eBook from those fine gents at SQL Server Central: SQL Server Execution Plans, Second Edition

By Grant Fritchey. Who doesn't need to know more about execution plans? Well, except for Mr. Fritchey.


Go!


Help with schema to support tables where records exists for single entities over multiple years...

Do you need BusinessID and TaxYear as separate tables?


How about moving them to Business?




Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Sometime,all files under localstate are cleared. But when?

By "changing configuration" I mean selecting a different configuration and then rebuilding and running the app.


These are the steps:


1. Change the configuration from Release to Debug (or vice versa)


2. Rebuild the solution.


3. Run the app (at this moment the LocalState is wiped out).




Wiki: wbswiki.com

Website: http://ift.tt/1hOBnip


How to Connect to a Specific Windows app Client using Websockets from ashx Websocket Sever in vb.net

ok 'I THINK' I found the websocket id under 'context.Request.LogonUserIdentity.Token' but now how do I tell 'WebSocket.SendAsync' to send the message to a specific Token?

Parameters not passin values to the report

Edit your data set to include LastName = @LastName in the query.

Parameters not passin values to the report

Thanks Patrick,


This is what i did, in the query i added LASTNAME=@LASTNAME and then i created a PARAMETER and then a FILTER, my question is why do i need a filter. Secondly i want a functionality where if the user knows the last name he will enter and he will get the reocrd, but if he leaves the box without entering any value then he needs to see all the records, any idea please?


Thanks a lot!


Parameters not passin values to the report

Well, you could easily force that by using a where statement in your query like this:



Where (LastName = @LastName or @LastName = 'All')



When the user typed in 'All' they would get everything, if they typed in 'Munshi' they would just get that.


A for why your parameter is not causing the dataset to only return matching rows, if what you say is true, it should be.


Perhaps you can post the whole query, and I'll take a look to see if I can spot what's wrong?


Can an Access file on a non-SharePoint server be synced with a SharePoint list (bidirectionally, so updating one updates the other)?

Hi,


Can an MS Access file on a non-SharePoint server be synced with a SharePoint list (bidirectionally, so updating one updates the other)?


How?


Thanks so much.


Help with schema to support tables where records exists for single entities over multiple years...

Do you need BusinessID and TaxYear as separate tables?


How about moving them to Business?




Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Creating a Web Crawler Using C#(sharp)


You can contact me through my site, which is dedicated to web crawling: http://arachnode.net


Thanks,

Mike




asd




Hi Mike,


I sent you an email from your site but here is what I was curious about:


I have this site, http://ift.tt/1jyiIrN, for example where the user selects a Profession and enters the Licensee Name and clicks Search and the website displays a result. Is there any way to crawl each time the search is made? Or what is the best method in crawling to get the data for each search entry?


Creating a Web Crawler Using C#(sharp)

@SiKni8, you shouldn't reply to old posts so I'm locking this thread.


You should post about topics that are related to C# anything else will be locked or deleted.


If you have a general question about programming this isn't the correct forum to do it.




Regards, Eyal Shilony


Help with schema to support tables where records exists for single entities over multiple years...

Do you need BusinessID and TaxYear as separate tables?


How about moving them to Business?




Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







How to empty first item (selected Index) of drop down list that bind to DB?

I test this way. don't work :(


Good luck!


insert into table

but how can get min date of max id

insert into table

My query does that already. I use two columns in the order by: first ID DESC and then [Date]. So, if you have 2 same IDs, it will pick up the min. date (for the same member)


For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


ssrs 2008 export to excel and csv file

In a ssrs 2008 report, the user will export data to PDF, excel, and CSV files. When the report is exported to excel or csv file, the user wants me to hide some tablixes. Thus can you show me code on how to export the reports to csv or excel file without and be able to hide a few tablixes?

Total for the detail

HI guys, I am trying to get the total for a detail. I want sum of NonScan codes only


The code below gives me #error


Sum(IIF (Fields!Class5Code.Value="NonScan", Fields!CURRENT_WEEK_DAILY_DRAW.Value,0 ))


The code below gives the grand total of all codes irrespective of NonScan code


IIF (Fields!Class5Code.Value="NonScan",sum(Fields!CURRENT_WEEK_DAILY_DRAW.Value),0 )


PLease help me with code. Thanks in advance.




svk


Total for the detail

I think i figured it


=Sum(IIf(Fields!Class5Code.Value="NonScan", Fields!CURRENT_WEEK_DAILY_DRAW.Value, Nothing), "ScanVsNonScan")




svk


How to delete a line from a textbox?

How can I delete a line from a textbox?

How to delete a line from a textbox?

Hi,


Could you please explain what you need??


Is this is what you want to do ?



testbox1.Text = "";



I t will empty the text box content..


Shan_k.


How to delete a line from a textbox?

Hello,


One method to delete a line at a specific index



Dim DeleteIndex As Integer = 2
If txtLines.Lines.Length > DeleteIndex Then
txtLines.Lines = txtLines.Lines.Where(
Function(w)
Return w <> txtLines.Lines(DeleteIndex)
End Function).ToArray()
Else
MessageBox.Show("Not enough elements to remove element " &
DeleteIndex.ToString)
End If

Above screenshot



Perhaps I want to remove the first line only



txtLines.Lines = txtLines.Lines.ToList.Skip(1).ToArray





Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.


How to delete a line from a textbox?

I believe this works correctly but it took awhile to figure out since a TextBox line from my text file that is a blank line has a count of zero for some reason. Even though there are two items in it representing a vbCrLf or Environment.NewLine perhaps.


I don't know if all text files will have the same amount of characters representing a new line though.


I also tested this with typed in text at the top of the TextBoxs text and some enters for new lines and it worked.



Option Strict On

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CenterToScreen()
TextBox1.Text = My.Computer.FileSystem.ReadAllText("C:\Users\John\Desktop\Samsung disallow calls.Txt")
NumericUpDown1.Minimum = 0
If TextBox1.Text <> "" Then
NumericUpDown1.Maximum = TextBox1.Lines.Count - 1
Else
NumericUpDown1.Maximum = 0
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim StartIndex As Integer = 0
Me.Text = TextBox1.Lines(1).Count.ToString
For i = 0 To TextBox1.Lines.Count - 1
If i < CInt(NumericUpDown1.Value) Then
If TextBox1.Lines(i).Count > 0 Then
StartIndex += TextBox1.Lines(i).Count + 2
ElseIf TextBox1.Lines(i).Count = 0 Then
StartIndex += 2
End If
End If
Next
TextBox1.Text = TextBox1.Text.Remove(StartIndex, TextBox1.Lines(CInt(NumericUpDown1.Value)).Count + 2) ' Add 2 to remove the new line character.
End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text <> "" Then
NumericUpDown1.Minimum = 0
NumericUpDown1.Maximum = TextBox1.Lines.Count - 1
Label1.Text = "Line nr " & NumericUpDown1.Value.ToString & " is - " & ChrW(34) & TextBox1.Lines(CInt(NumericUpDown1.Value)) & ChrW(34)
End If
End Sub

Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
Label1.Text = "Line nr " & NumericUpDown1.Value.ToString & " is - " & ChrW(34) & TextBox1.Lines(CInt(NumericUpDown1.Value)) & ChrW(34)
End Sub

End Class






La vida loca


How to delete a line from a textbox?

Here's another option:



Sub RemoveLine(index As Integer, textbox As TextBox)
textbox.Lines = textbox.Lines.Take(index).Concat(textbox.Lines.Skip(index + 1)).ToArray
End Sub





Reed Kimble - "When you do things right, people won't be sure you've done anything at all"


Thursday, May 29, 2014

Hiding items in Action in Report Builder

Thanks for the reply.


I am using sharepoint 2010. How can we implement this in sharepoint 2010.


thanks




SFH


Hiding items in Action in Report Builder

Hi,


I have not tested it on SharePoint 2010 yet. But it should works for SharePoint 2010 as well. The principle is same.


Thanks.




Tracy Cai

TechNet Community Support



Hiding items in Action in Report Builder

Hi,


To hide these button, we need to modify the RSViewerPage.aspx. For SharePoint 2013, it is in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ReportServer\ folder.


Back up the RSViewerPage.aspx file before modify it.


Open in the SharePoint Designer and add the following code into it(insert it at 69 row).


<style type="text/css">


ul.ms-core-menu-list li:nth-child(1)


{


display: none !important;


}


ul.ms-core-menu-list li:nth-child(4)


{


display: none !important;


}


</style>


Save and see the result in Internet Explorer. This code works when Document Mode is 9 or above version. You can check the Document Mode by pressing F12.



Thanks.




Tracy Cai

TechNet Community Support



Hiding items in Action in Report Builder

Thanks for the reply.


I am using sharepoint 2010. How can we implement this in sharepoint 2010.


thanks




SFH


Power View on public website

Hi Edgar,


We are also working on embedding into web pages. You can see a preview at the link below. I do not have a timeline to share.


http://ift.tt/1exF2AY





Brad Syputa, Microsoft Power BI This posting is provided "AS IS" with no warranties.


Please Help to Solve this error

Can you show the using statement from your code and the line of code you need it for..


Fernando (MCSD)



If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".



NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


How to compare data in a single table by month and year

Thank you Very much, i greatful to you

The Playback Rate of MediaElement > 1.0 has noise

Can you please generate a DXDiag report for the machine that are causing the problems and upload it to you OneDrive? Using WMA or MP4 (M4A) should not produce any audible clicks and pops at higher playback rates. If your audio / video hardware does not support DXVA then we revert to software decode. If this occurs then you may hear clicks and pops (i.e. buffer underrun).


-James




Windows SDK Technologies - Microsoft Developer Services - http://ift.tt/1kyQHnB


The Playback Rate of MediaElement > 1.0 has noise

Dear Jame


Do you have any idea?




vulcan


The Playback Rate of MediaElement > 1.0 has noise

I noticed that you audio driver is really old (2008). I would recommend that you check with the OEM to see if there is an updated version.


I also noticed that according to your registry the decoder MFT for your video card is disabled. I'm not sure how this could happen.


[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Media Foundation\HardwareMFT]


EnableDecoders = 0

EnableEncoders = 1

EnableVideoProcessors = 1


If this doesn't resolve the issue the next step is to use PerfView to capture audio event and DPC logs. Typically when there are audio dropouts it is due to long running DPC due to poorly written drivers.


I hope this helps,


James




Windows SDK Technologies - Microsoft Developer Services - http://ift.tt/1kyQHnB


t-sql 2008 r2 explain select

In existing t-sql 2008 r2, there is the following sql that I am trying to understand so that I can modify it. The field that is called tMask is definitely as an integer. The values stored in this field are hexadecimal values. The values indicate what fields contain a check box in them, For example, if checkbox 1 is selected then the value in this field = 1. If the value is 3, then the first and second checkboxes have been selected.


Based upon what I have said, can you tell me how to tell what the value = '42' means? What checkboxes have been selected? If the value = 1023, what checkboxes have been selected?


Can you explain to me the sql listed above?











select
, replace(rtrim(
case when max(case when b = 0 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '1 ' else '' end
+ case when max(case when b = 1 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '2 ' else '' end
+ case when max(case when b = 2 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '3 ' else '' end
+ case when max(case when b = 3 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '4 ' else '' end
+ case when max(case when b = 4 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '5 ' else '' end
+ case when max(case when b = 5 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '6 ' else '' end
+ case when max(case when b = 6 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '7 ' else '' end
+ case when max(case when b = 7 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '8 ' else '' end
+ case when max(case when b = 8 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '9 ' else '' end
+ case when max(case when b = 9 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '10 ' else '' end + case when max(case when b = 10 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '11 ' else '' enase when max(case when b = 11 then convert(varchar(2), ((convert(smallint, convert(binary(2), tMask)) & e)) / e) else 0 end ) = 1 then '12 ' else '' end
),' ',',') as [tMask] FROM [test].[dbo].[test1]join (select 11 as b)bits on 1=1







t-sql 2008 r2 explain select

What 42 means? Isn't that the secret number from The Hitch-hiker's Guide to the Galaxy?


More seriously, I can see any code in your post, so it is a tad difficult to explain anything.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

t-sql 2008 r2 explain select

Check this very good blog post


http://ift.tt/1k5xRnm


and also


http://ift.tt/1k5xRno





For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


t-sql 2008 r2 explain select

IF ONLY THE THIRD CHECKBOX IS SELECTED THE VALUE =7.

How to tell which Indexes are not being used?

Too many indexes might slowdown the import process. Before deleting any index you need to analyze the query performance.


Refer the below links


http://ift.tt/Qawz8g


http://ift.tt/1trZSFr


--Prashanth



How to tell which Indexes are not being used?

I will have to assume that each customer has its own database or at least its own tables, because else will not be possible.


The place to looking is sys.dm_db_index_usage_stats. If you find tables with zeros in user_scans, user_seeks, user_lookups, but high values user_updates you know have a useless index which takes up resources.


Beware though, that the numbers are since the most recent restart of SQL Server, so if SQL Server was started this month, you may not see indexes used for end-of-the-month reporting.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

How to tell which Indexes are not being used?

You could also consider capturing the current indices, and then dropping them, restoring them once your load is complete.


I do this on some loads by generating a create index script using dSQL and storing it in a table, for each index on every table. Once My load is complete, I do the reserve, pull those scripts out and re-add them.


Since the script to generate the create scripts would run prior to each load, it will be self updating, and reflective of any new indicies they've added during that day.


hth


Custom MediaStreamSource and Memory Leaks During SampleRequested

Hello,


If you want to actively manage your sample memory you should create a sample pool. In other words, you should pre allocate a pool of samples that is just large enough to support your scenario. You should then cycle through the pool round robin style, reusing samples as appropriate. This will allow you to pre allocate and know exactly how much sample memory your app will be using.


I hope this helps,


James




Windows SDK Technologies - Microsoft Developer Services - http://ift.tt/1kyQHnB


Downloader Program stops half way

I have created program that will use a backgroundWorker to download a zip or rar and extract it to a direcotory, issue is - The progress bar stops near the middle - I check and only got 9,000 KB downloaded - The File on the server is over a Gig.


Here is the current code - Would love any help and improvements any one can give to me.



using SharpCompress;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Ionic.Zip;

namespace _1stCav_Updator
{
public partial class Main : Form
{
Stopwatch sw1 = new Stopwatch();

public Main()
{
InitializeComponent();

// Disable Buttons
btnFinish.Enabled = false;
btnStop.Enabled = false;
}

private void Form1_Load(object sender, EventArgs e)
{
string arma3Path = Properties.Settings.Default["ArmaPath"].ToString();
// Make sure they add arma path and saved
if (arma3Path != null)
{
// Error Message
string str = String.Format("Arma 3 Path was not detected.\n \nGo to Options and add your Arma 3 Directory.");
if (DialogResult.No != MessageBox.Show(str + "\nGo to Options Now?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
try
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else
{
// Do Nothing
}

// Debug Label
string armaPath;

// If arma3Path is not null
if (arma3Path != null)
{
armaPath = arma3Path.Substring(0, arma3Path.Length - "arma3.exe".Length);
lblArmaPath.Text = armaPath;
}
else
{
MessageBox.Show("Wait, This should be fixed.", "Error: 101", MessageBoxButtons.OK, MessageBoxIcon.Error);
armaPath = " "; // Added for 'Use of unassigned local variable'
}

}

private void btnOptions_Click(object sender, EventArgs e)
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}

//Delete File
static bool deleteFile(string f)
{
try
{
File.Delete(f);
return true;
}
catch (IOException)
{
return false;
}
}

private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
lblDownload.Text = "Download Mod Pack/Updates";
}

private void backgroundWorker1_RunWorkerComplete(object sender, RunWorkerCompletedEventArgs e)
{
btnFinish.Enabled = true;
lblDownload.Text = "Mod Pack Downloaded and Up to date";
}

private void btnFinish_Click(object sender, EventArgs e)
{
this.Close();
}

private void btnDownload_Click(object sender, EventArgs e)
{
// Call Background Worker1 to Download
//backgroundWorker1.RunWorkerAsync();

if (backgroundWorker1.IsBusy)
{
btnStop.Enabled = false;
btnDownload.Enabled = true;
}
else
{
backgroundWorker1.RunWorkerAsync();
btnDownload.Enabled = false;
btnStop.Enabled = true;
}
}

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
// Download Progress with background Worker
// backgroundWorker1.RunWorkerAsync();

// Define Server IP/url
string Server = "http://ift.tt/SsJ8m6;;
string arma3Path = Properties.Settings.Default["ArmaPath"].ToString();
string armaPath = arma3Path.Substring(0, arma3Path.Length - "arma3.exe".Length);
string lclVersion;

if (armaPath == "")
{
// Error Message
string str = String.Format("Arma 3 Path was not detected.\n \nGo to Options and add your Arma 3 Directory.");
if (DialogResult.No != MessageBox.Show(str + "\nGo to Options Now?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
try
{
AppSettings shoOptions = new AppSettings();
shoOptions.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else
{
// Do Nothing
}

BackgroundWorker worker = sender as BackgroundWorker;
while (true)
{
if ((worker.CancellationPending == true))
{
e.Cancel = true;
break;
}
else
{
FileStream fs = null;
if (!File.Exists(armaPath + "version"))
{
using (fs = File.Create(armaPath + "version"))
{
// Blank Area - Do Nothing
}

// Create version
using (StreamWriter sw = new StreamWriter("version"))
{
sw.Write("0.0");
}
}

// Read Version
using (StreamReader reader = new StreamReader("version"))
{
lclVersion = reader.ReadLine();
}

decimal localVersion = decimal.Parse(lclVersion);

// Starting the Download/Update Process - Getting List
XDocument serverXML = XDocument.Load(@Server + "Updates.xml");

// Starting the Download/Update Process - Start
foreach (XElement update in serverXML.Descendants("update"))
{
string version = update.Element("version").Value;
string file = update.Element("file").Value;
decimal serverVersion = decimal.Parse(version);
string serverUrlToReadFileFrom = Server + file;
string serverFilePathToWriteTo = armaPath + file;

if (serverVersion > localVersion)
{
Uri url = new Uri(serverUrlToReadFileFrom);
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();


//Int64 iSize = response.ContentLength;

Int64 iSize = 2000;

Int64 iRunningByteTotal = 0;

using (System.Net.WebClient client = new System.Net.WebClient())
{
using (System.IO.Stream streamRemote = client.OpenRead(new Uri(serverUrlToReadFileFrom)))
{
// using (Stream streamLocal = new FileStream(serverUrlToReadFileFrom, FileMode.Create, FileAccess.Write, FileShare.None))
using (Stream streamLocal = new FileStream(serverFilePathToWriteTo, FileMode.Create, FileAccess.Write, FileShare.None))
{
int iByteSize = 0;
byte[] byteBuffer = new byte[iSize];
while ((iByteSize = streamRemote.Read(byteBuffer, 0, byteBuffer.Length)) > 0)
{
streamLocal.Write(byteBuffer, 0, iByteSize);
iRunningByteTotal += iByteSize;

double dIndex = (double)(iRunningByteTotal);
double dTotal = (double)byteBuffer.Length;
double dProgressPercentage = (dIndex / dTotal);
int iProgressPercentage = (int)(dProgressPercentage * 100);

// progressBar1.Maximum = byteBuffer.Length;

//lblSpeed.Text = string.Format("Speed: {0} kb/s", (iRunningByteTotal / 1024d / sw1.Elapsed.TotalSeconds).ToString("0.00"));
// lblPresent.Text = dProgressPercentage.ToString() + "%";
// lblDownloadTotal.Text = string.Format("Download: {0} MB's / {1} MB's", (iRunningByteTotal / 1024d / 1024d).ToString("0.00"), (iByteSize / 1024d / 1024d).ToString("0.00"));
backgroundWorker1.ReportProgress(iProgressPercentage);

int precent = (int)(((double)progressBar1.Value / (double)progressBar1.Maximum) * 100);
// lblPresent.Text = precent.ToString() + "%";
progressBar1.CreateGraphics().DrawString(precent.ToString() + "%", new Font("Arial", (float)8.25, FontStyle.Regular), Brushes.Black, new PointF(progressBar1.Width / 2 - 10, progressBar1.Height / 2 - 7));

}

streamLocal.Close();
}

streamRemote.Close();
}
}
}

// Start Unzipping
using (ZipFile zip = ZipFile.Read(armaPath + file))
//rar
{
foreach (ZipEntry zipFiles in zip)
{
//zipFiles.ExtractAll(arma3Path + "\\@1stCav\\", true);
//zipFiles.Extract(armaPath); // File Already Exsists
zipFiles.Extract(armaPath, ExtractExistingFileAction.OverwriteSilently);
}

}


WebClient webClient = new WebClient();
webClient.DownloadFile(Server + "version.txt", @armaPath + "version");


// Delete Zip File
// deleteFile(file); // Disable due to not wanting to delete file
}
}
}
}

private void btnStop_Click(object sender, EventArgs e)
{
if (backgroundWorker1.WorkerSupportsCancellation == true)
{
backgroundWorker1.CancelAsync();
btnDownload.Enabled = true;
btnStop.Enabled = false;
}
else
{
btnStop.Enabled = false;
}
}

private void btnDownloadBMod_Click(object sender, EventArgs e)
{

}
}
}


Downloader Program stops half way

Thanks - but anything more up to date?


Downloader Program stops half way

Hi LaocheXe,


Thank you for visiting MSDN forums.


Please don't post the whole project code here. To narrow down the issue, I recommend that you debug your code firstly, then post the code snippet with problems. Or just upload the whole project in OneDrive, then post the link of the project file so that we can easily test it. It's very hard for others to test your code without information about the controls and the logic of the code.


Thanks.




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


sql help required on hyperlink

Well, what is used to develop UI? Most likely you don't want to return this text from SQL Server (as many people already told you), but create hyperlink in UI directly.


What is your development platform, MVC or plain ASP.NET?


You may get better answer if you ask your question from the client's application perspective as how to make the ID hyperlink. It is not a job for SQL Server.




For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


sql help required on hyperlink

It is .net application developed using MVC

sql help required on hyperlink

What is used in the view to display the info? I think you may want to review some MVC tutorials, you don't want to return this information as linked text in SQL Server, it's easy to set link in MVC instead.


For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


sql help required on hyperlink

Quick google search provided this link


http://ift.tt/1kOXVC4


I think you can run more searches on this question, as it may be even easier.




For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


sql help required on hyperlink

I have gone thru link and i see .net, i want todo this from sql server .net developer doesn't need todo.

help with query

Yeah, We need more information about the department and score tables.


Create a script that gives us demo data in table variables:



declare @scores table (caseID bigint, productCode bigint, score float)
insert into @scores (caseID, productCode, score)
values (45678, 205, 10),
(45678, 205, 20),
(45678, 205, 30),
(45678, 205, 40)
declare @departments table (deptID bigint, deptName varchar(30), scoreMod int)
insert into @departments (deptID, deptName, scoreMod)
values (1, 'Network', 2)
declare @case table (caseID bigint)
insert into @case (caseID)
values (45678),(12379)
declare @productCodes table (productCode bigint)
insert into @productCodes (productCode)
values (205),(206)




and we can help you.

help with query

look up tables are the one that have scores defined for the combinations .


last 2 are look up tables


first 2 are the tables for which I need decide the scores


help with query

.... I'm sorry to see you're not feeling well, but please try not to throw up on the forums.



DECLARE @Processing TABLE(CaseDataKey INT IDENTITY(1,1)PRIMARY KEY, Caselist VARCHAR(8));
DECLARE @ProcessingProduct TABLE(ProductDataKey INT IDENTITY(1,1) PRIMARY KEY, ProductCode VARCHAR(8));
INSERT INTO @Processing(Caselist)
SELECT '23456' UNION ALL
SELECT '4321'
INSERT INTO @ProcessingProduct(ProductCode)
SELECT '600' UNION ALL
SELECT '500'

SELECT * FROM @Processing
select * FROM @ProcessingProduct

DECLARE @ProcessingLookUp TABLE(Caselist VARCHAR(8), Department varchar(400), score INT);

INSERT INTO @ProcessingLookUp
SELECT '23456', 'network', 92 UNION ALL
SELECT '4321', 'network', 45

SELECT * FROM @ProcessingLookUp

DECLARE @ProcessingProductLookUp TABLE(Caselist VARCHAR(8),ProductCode VARCHAR(8) ,score INT);


INSERT INTO @ProcessingProductLookUp
SELECT '23456', '600', 60 UNION ALL
SELECT '23456', '500', 50 UNION ALL
SELECT '4321', '600', 65 UNION ALL
SELECT '4321', '500', 72

SELECT * FROM @ProcessingProductLookUp

--final score for 23456 should be 50 (It should first pick the minimum of combination caselist and product code which is 50 .And then try to comapre this with caselist and department score .so out of 50 and 92 it would be 50
--4321 score should be 45

Are we supposed to use the scores from @ProcessingLookUp, or @ProcessingProductLookUp ?

help with query

Or, could this be what you're after?



DECLARE @Processing TABLE(CaseDataKey INT IDENTITY(1,1)PRIMARY KEY, Caselist VARCHAR(8));
DECLARE @ProcessingProduct TABLE(ProductDataKey INT IDENTITY(1,1) PRIMARY KEY, ProductCode VARCHAR(8));
INSERT INTO @Processing(Caselist)
SELECT '23456' UNION ALL
SELECT '4321'
INSERT INTO @ProcessingProduct(ProductCode)
SELECT '600' UNION ALL
SELECT '500'

DECLARE @ProcessingLookUp TABLE(Caselist VARCHAR(8), Department varchar(400), score INT);

INSERT INTO @ProcessingLookUp
SELECT '23456', 'network', 92 UNION ALL
SELECT '4321', 'network', 45

DECLARE @ProcessingProductLookUp TABLE(Caselist VARCHAR(8),ProductCode VARCHAR(8) ,score INT);

INSERT INTO @ProcessingProductLookUp
SELECT '23456', '600', 60 UNION ALL
SELECT '23456', '500', 50 UNION ALL
SELECT '4321', '600', 65 UNION ALL
SELECT '4321', '500', 72

select case when ppl.score < pl.score then ppl.score else pl.score end as minComboScore, *
from @ProcessingProductLookUp ppl
inner join @ProcessingLookUp pl
on ppl.Caselist = pl.Caselist


help with query

thank you . it is very help ful


Button Click From "If" Statement

Hi guys,


I'm writing a "dashboard" kind of program where it will scan the computer's registry for certain keys from another program of mine. I have it setup so that when the user clicks a button, it scans the registry for the keys i specify, and if they exist, the program will pop-up on a list along with a "launch" button. My problem is that once the scan is complete, through an if statement, i want the user to be able to click that launch button to launch a specific file path. However, i can't figure out how to have the user be able to click the button inside the if statement code block. Here is some of my code.



private void TBSettingsAppCheck_Click(object sender, EventArgs e)
{
//Checks for Aspire Binary Converter:
RegistryKey rk = Registry.CurrentUser.OpenSubKey("Eclipsed SuperNova\\Aspire Binary Converter");

if (rk != null)
{
RegistryKey abcPath = Registry.CurrentUser.OpenSubKey("Eclipsed SuperNova\\Aspire Binary Converter");
string abcReg = (string)abcPath.GetValue("ABCKey");
Software1.Text = "Aspire Binary Converter";
groupBox1.Visible = true;
}
else
{
MessageBox.Show("Aspire Core did not find any other Aspire software installed on this computer.");
}

}



If you can help, it will be greatly appreciated. Thanks, William




Whutchison


Error while taking back up.

Before few month box of SQL has been crashed. We have almost database back with some tools and running application smoothly on it. But when i try to take backup of database at that time it gives error as below,


'The log scan number (3533468:412:0) passed to log scan in database '****' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup. (Microsoft SQL Server, Error: 9003)'


Would anyone help me to out of this?


I have even try to copy database but i am failed.


Thanks in Advance.


Error while taking back up.

Hello,


Please run below on database and post the result here, although it seems to me log file corruption but just in case.



DBCC CHECKDB(DB_NAME) WITH NO_INFOMSGS, ALL_ERRORMSGS





Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.



My TechNet Wiki Articles


Error while taking back up.

@Prashanth : Is this safest way to run these on Production environment?

Error while taking back up.

@Prashanth : Is this safest way to run these on Production environment?

With log file corruption best way is to restore from Valid backup IF you dont have valid backup follow below links


http://ift.tt/1po3LgX


http://ift.tt/1po3JWs


Did you run checkdb what was output ?




Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.



My TechNet Wiki Articles


Error while taking back up.

Also, if you are not comfortable with trying this on production database, you can contact Microsoft support, they will help you with this.


It may be included in your support or you may have to pay extra.


Backing up a database using Transact

The below query gives unique date and time.



declare @sql varchar(255)
declare @dbname sysname='dssp1'
select @sql=' BACKUP DATABASE '+ @dbname+' TO DISK = ''C:\'+@dbname+'_'+REPLACE(CAST(CONVERT(DATE,GETDATE())as VARCHAR(10)),'-','')+'_'+REPLACE(CAST(CONVERT(TIME,GETDATE()) AS VARCHAR(8)),':','')+'.BAK'''
print @SQL
exec (@sql)



--Prashanth


Backing up a database using Transact


BACKUP DATABASE ExampleDBName
TO DISK = 'D:\SQLBackups\backupfilename'+convert(varchar,getdate(),121)+.bak'
GO



You can also add a datetime string to your file name to make them unique:


How to send the output of a script to a txt or rpt file using T-sql?

Thank you!

RenderTargetBitmap for off-screen rendering?

Hi Peter,


What your looking for isn't possible in a Windows Store app. As you note (and as documented) RenderTargetBitmap relies on the tender thread and can only render elements in the foreground visual tree.


It is not possible to use it in the background or to prevent the app from suspending if the user switches away.


There are no other API to render UI elements, but some folks have emulated this by parsing the visual ye and rendering the elements themselves with Direct2d

Sharepoint visual web part with ssrs report viewer

hello,


I need to create ssrs report viewer in visual webpart.is that possible.


Thanks


How to find a ComboBox DisplayMember by using its ValueMember

I have a table that contains records with values equivalent to the ValueMembers of a ComboBox. How can I use the ValueMember to find the DisplayMember so that I can put the DisplayMember into the ComboBox.Text?


Rob E.


How to find a ComboBox DisplayMember by using its ValueMember

you can't. This is something you need to decide before writing code. If you cannot control what will be put in a data table, ask the one who populates the data.




Visual C++ MVP

Creating a sample notepad application need help

Is this a homework assignment?

Creating a sample notepad application need help

What is preventing you from doing this? Do you have a question?

Backing up a database using Transact


BACKUP DATABASE ExampleDBName
TO DISK = 'D:\SQLBackups\backupfilename'+convert(varchar,getdate(),121)+.bak'
GO



You can also add a datetime string to your file name to make them unique:


RenderTargetBitmap for off-screen rendering?

I'm making an app with a video export function that, among other things, allows you to export presentations to video. I'm rendering the content on-screen, in a canvas, and then using RenderTargetBitmap (giving it the canvas) to create the frame. It actually works great, except -


RenderTargetBitmap pauses whenever the user navigates away from the app. I assume this is because it uses the UI thread and the UI thread gets suspended when the window is not visible. Meaning, the app must stay in focus for the entire render. This is fine for quick renders, but for longer renders, it would be annoying to tie up the user's computer for an hour or longer.


Is there any way either to (a) prevent the UI thread from suspending when the user navigates away (thus ensuring RenderTargetBitmap can keep working), or (b) render UIElement's to a bitmap in a worker thread that doesn't get suspended?


If, as I assume, the answer is no, are there other ways to render text, shapes, and other multimedia content to a bitmap besides using UIElements and RenderTargetBitmap? For example in Win32 you can render text and such to a GDI device-context and then get the bits that way. Is there anything similar for WinRT?


Thanks much!