|
- What does optimize mean? What will you be doing with the tables?
- We got a database-forum
- Your question for help on C# is too broad; you make a C# app like all the others, and you can get help with specific questions. You'll have to do the writing yourself.
- Can you show us an example of a table before and after "optimization"?
Looking forward to your answers.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
In our data base have more than 150 tables available. In every day some table have delete and update operation is going. While after the delete memory is stored in temp. When I tried to open schema, it’ll take some time. I need to make faster in my schema. What can I do? That’s only I selected optimize all table in mysql.
Thanks,
P.Alagiri
|
|
|
|
|
I suggest you start in the database-forum; to check whether your indexes are correct, whether you could benefit from partitioning the data, whether your table-structure is correct.. The usual things a DB-admin does when the db is too slow.
C# has little to do with it.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi
I’ve a question regarding linq,
I’ve a DB contains main items (Product) and internal item(properties)
Class Product
{
String name
List<properties> propList { get; set; }
}
Class properties
{
String name
String value
}
I would like to know if it possible to create a query that apply on two or more categories on the same internal item at one time
Such as, if the product is "car" and if the car year is 2012 and color is "Red" I would like to get this record
List< Product > DB;
I know the syntax below is wrong, but this is the idea I wish to do
Enumerable< Product > itemQuery = from item in DB where item.name=="car"
where
(
from prop in item.propList
where (prop.name.Equals("Color") && prop.value == "Red") && (prop.name.Equals("Year") && prop.value == "2012")
select field
).Any()
select item;
|
|
|
|
|
First off, this should have been posted in the LinQ forum LinQ Forum[^], but as you posted here, I will answer here.
You can use the Contains keyword to find if the item's property list contains the required property, something like this:-
var itemQuery = DB.Where((i) => i.name == "car" &&
i.propList.Contains((from prop in i.propList where prop.name == "Colour " && prop.value == "Red" select prop).FirstOrDefault()) &&
i.propList.Contains((from prop in i.propList where prop.name == "Year" && prop.value == "2012" select prop).FirstOrDefault()));
although this looks ugly and seems to be a bit of a hack it will return the correct item.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Message Removed
modified 21-Aug-12 9:49am.
|
|
|
|
|
thank u all,
it is a good start to begin with
|
|
|
|
|
hi
I’ve implement your idea and it work great, thank u!
I have another question and hope you can assist
The use will choose from UI several filter criteria, so the running filter should be dynamic and not hard coded
Such as sometimes it could be collection.Filter(name1, value1)
Or
collection.Filter(name1, value1).Filter(name2, value2)
collection.Filter(name1, value1).Filter(name2, value2). Filter(name3, value3)
and so on
how can I define by code the dynamic filter?
Should I use recursive ?
int interaction = #UserFilter.count;
DoFilter(string name, string value)
{
While (interaction--)
{
collection.Filter(UserFilter[interaction].name, UserFilter[interaction].value)
DoFilter(UserFilter[interaction].name, UserFilter[interaction].value);
}
}
thanks
ronen
|
|
|
|
|
|
|
I was just going through the C#4.0, I came across with keyword Dynamic. And this is used mainly if we dont know the type at the compile time so that CLR will match that type at the runtime. Then by using this we are giving an extra load to the Compiler, then why to use Dynamic if we know at the runtime what will be the data type??
Any suggestions
Gopesh Sharma
|
|
|
|
|
Keith Barrow gives an excellent description here[^] about the use of dynamic.
|
|
|
|
|
Ive followed this guide: http://studentguru.gr/b/dt008/archive/2010/12/02/querying-a-database-on-windows-phone-7-using-wcf.aspx[^]
I have tree different entries in my SQL and then i launch my application I get tree entries but they are all a copy of the first one.
CODE:
NSSService which is on my ISS.
using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
namespace NSSWebServiceApplication
{
[ServiceContract(Namespace = "")]
[SilverlightFaultBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class NSSService
{
[OperationContract]
public List<Server_Log> GetAllServer_Logs()
{
using (NSSEntities entities = new NSSEntities())
{
var allServer_Logs = from x in entities.Server_Log
select x;
return allServer_Logs.ToList();
}
}
}
}
MainPage on the app
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using NSSPhoneApp.NSSServiceReference;
using System.ServiceModel;
namespace NSSPhoneApp
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
NSSServiceClient client = new NSSServiceClient();
client.GetAllServer_LogsCompleted +=
new EventHandler<GetAllServer_LogsCompletedEventArgs>(client_GetAllServer_LogsCompleted);
client.GetAllServer_LogsAsync();
}
void client_GetAllServer_LogsCompleted(object sender, GetAllServer_LogsCompletedEventArgs e)
{
if (e.Error == null)
{
lst.ItemsSource = e.Result;
}
}
}
}
Thanks.
|
|
|
|
|
It was because there was no primary key in the SQL so it used my status as the primary key.
|
|
|
|
|
May I know how can I convert a decimal (eg: 0.3333) to percent format.
I have tried with this code:
ws.Cells[1,1].Value = 0.3333;
ws.Cells[1.1].Style.Numberformat.Format = "0%";
But this give me 33% instead of 33.33%
|
|
|
|
|
Did you try "0.00%"?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
It's work! Thank you so much.
|
|
|
|
|
double t = 0.3333;
Console.WriteLine(t.ToString("##.##%"));
|
|
|
|
|
I have a program which allows user to input a sequence of numbers. The length of the number is not fixed. It could be 10, 12, or whatever length.
After the user has finished inputting the number, I want the program to automatically scan the database and return information about that number.
Question is how? If I use TextChanged() event, it is called whenever every character is typed. I only want to know when the last character is typed.
Please help. I have spent many days on this already.
|
|
|
|
|
Hi,
Can't you use LostFocus event, when user finish with typing and press TAB key it will search for the result.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
I second Amit's suggestion of using the Leave event. If for some reason your requirements are not going to allow you to ( I don't see why ), you could always just have the TextChanged event do nothing until the length of the entered text is greater than or equal to 10.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Store the current time in a class level field in the TextChanged event. Run a timer every 1 second (or 2 seconds if you prefer) and inside the Timer's Elapsed event handler (or Tick event handler depending on which Timer you use) check when the last character was typed, if it is more than 1 second, it's time to do your stuff.
|
|
|
|
|
biop.codeproject wrote: I want the program to automatically scan the database and return
information about that number.
Really bad idea.
How exactly are you going to deal with ALL of the following scenarios if you attempt to guess when they are done?
1. User types 120 words a minute which is 2 characters a second. So it takes them at most 6 seconds to type the number.
2. Same EXACT user as above. But they are reading the number from a piece of paper and when they get to the 6th digit they can't read it. So they go down the hallway to ask another person what it is. And they don't return for 15 minutes.
3. The user is physically disabled and it takes them 3 minutes to type those 12 digits with different periods of delay between each character.
The only solution is that the user must take some action AFTER they are finished typing. Like pushing an ok button, hitting return, or tabbing to another field.
|
|
|
|
|
Let's break your problem down here. You have a sequence of some length that you don't know. The user enters numbers into a TextBox, again you don't know how long this sequence is. How do you know when the last character is entered?
Your user experience is going to have to be one of:
User enters sequence and leaves the field - at which point you retrieve the matching entry and display it if found.
User enters sequence and as each character is pressed, possible matches are retrieved from the database and displayed (a standard autocomplete). The user can select one of these elements and the text sequence is updated.
User enters sequence and clicks some form of button to trigger the retrieval.
Without knowing how long this sequence is going to be, you cannot do anything other.
|
|
|
|
|
Thanks for all your input. Actually yes that is true, without knowing the number of characters to be entered in advance, it could be an impossible task.
Actually the input is from two devices. One is from scanning RFID (a 24 character string) and another is from barcode (this is harder as I don't know the predefined limit).
Lucky I can capture the event that the RFID scanner button is pressed and the barcode scanner button is pressed.
Now I am integrating the two sample programs together. Hope it works. And I consider this question is closed. Thanks.
|
|
|
|