I have a model window that contains expander.
I want when expander is collapsed or expanded the window will resize its height accordingly at run time.
Pleas help!!
I have many (600) EPS files(300 KB - 1 MB) in database. In my ASP.NET application (using ASP.NET 4.0) I need to retrieve them one by one and call a web service which would convert the content to the JPEG file and update the database (JPEGContent column with the JPEG
content). However, retrieving the content for 600 of them itself takes too long from the SQL management studio itself (takes 5 minutes for 10 EPS contents).
So I have two issues:-
1) How to get the EPS content ( unfortunately, selecting certain number of content is not an option :-( ):-
Approach 1:-
foreach(var DataRow in DataTable.Rows)
{
// get the Id and byte[] of EPS
// Call the web method to convert EPS content to JPEG which would also update the database.
}
or
foreach(var DataRow in DataTable.Rows)
{
// get only the Id of EPS
// Hit database to get the content of EPS
// Call the web method to convert EPS content to JPEG which would also update the database.
}
or
Any other approach?
2) Converting EPS to JPEG using a web method for 600 contents.
Ofcourse, each call would be a long running operation. Would task parellel library (TPL) be a better way to achieve this?
Also, is doing the entire thing in a SQL CLR function a good idea?
hey guys,
please help me in finding the solution to some of these Amazon questions:
given a file containing approx 10 million words, design a data structure for finding the anagrams
Write a program to display the ten most frequent words in a file such that your program be efficient in all complexity measures.
you have a file with millions of lines of data. Only two lines are identical; the rest are all unique. Each line is so long that it may not even fit in the memory. What is the most efficient solution for finding the identical lines?
Is it possible to read cookie expiration time with php ?
When I print_r($_COOKIE) it outputs:
Array
(
[PHPSESSID] => 0afef6bac83a7db8abd9f87b76838d7f
[userId] => 1232
[userEmail] => [email protected]
[firstName] => user
[lastName] => user
)
So I think $_COOKIE don't have the expiration time, is it possible with some other function?
I have an XML document which contains nodes like following:-
<a class="custom">test</a>
<a class="xyz"></a>
I was tryng to get the nodes for which class is NOT "Custom" and I wrote an expression like following:-
XmlNodeList nodeList = document.SelectNodes("//*[self::A[@class!='custom'] or self::a[@class!='custom']]");
Now, I want to get IMG tags as well and I want to add the following experession as well to the above expression:-
//*[self::IMG or self::img]
...so that I get all the IMG nodes as well and any tag other than having "custom" as value in the class attribute.
Any help will be appreciated.
EDIT :-
I tried the following and this is an invalid syntax as this returns a boolean and not any nodelist:-
XmlNodeList nodeList = document.SelectNodes("//*[self::A[@class!='custom'] or self::a[@class!='custom']] && [self::IMG or self::img]");
I have following two tables:-
Table1
-------------
ID Name
1 A
2 B
3 C
Table2
--------
ID Name
1 Z
I need to insert data from Table1 to Table2 and I can use following sytax for the same:-
INSERT INTO Table2(Id, Name) SELECT Id, Name FROM Table1
However, In my case duplicate Ids might exist in Table2 (In my case Its Just "1") and I dont want to copy that again as that would throw an error.
I can write something like this:-
IF NOT EXISTS(SELECT 1 FROM Table2 WHERE Id=1)
INSERT INTO Table2 (Id, name) SELECT Id, name FROM Table1
ELSE
INSERT INTO Table2 (Id, name) SELECT Id, name FROM Table1 WHERE Table1.Id<>1
Is there a better way to do this without using IF - ELSE? I want to avoid two INSERT INTO-SELECT statements based on some condition.
Any help is appreciated.
Hi,
I was trying to find a user friendly mime parser for java that could just get rid of all that message part parsing a user have to do. see this for more info about my requirement.
Until now i have not been able to find one, so i think i need to write one for myself, that should be robust enough to handle all kind of emails. (I know this is not going to be easy.)
Since there are a ton of email RFC's , can somebody guide me in the right direction from where should i start.
I want to suppress Cut, Copy and Paste operations in Text Box.
I don't want user to do any of these operations through keyboard or from default context menu in the text box .
Please let me know how can I restrict these operations?
I have a collection that is binded to my Listview.
I have provided options to user to "move up" "move down" the selected item in the list view. I have binded the selected item of the listview to my viewmodel, hence I get the item in the collection on which user want to do the operation.
I have attached "move up" "move down" commands in my viewmodel.
I want what is the best way to move up and down in the collection in the collection which is reflected in the list view.
Please suggest.
Hi, I am writing a chrome extension and from the content script I want to calculate the absolute position of a DOM element. But from within content script, if i try to access offsetHeight, offsetWidth, offsetTop, offsetParent, etc, I get null. I guess content scripts don't have access to those DOM properties.
Is there a way/workaround, i can find those properties?
Hi all,
I need your suggestion for this.
I need to add data to mysql database through the admin interface, at initial i need to add data in bulk, so i thought of using csv upload but how to add images with csv i.e. when doing single add i insert name , description and a image via a form, but how to do the same for bulk.
Thanks in advance.
I was wondering if it is possible to set background-color with help of mouse coordinates.
What is have is:
I have a DIV-A which is draggable and some other divs which are droppable.
What is need is :
I need to highlight other divs on my page which are droppable, whenever my DIV-A passes over them. What i have is mouse coordinates, is it possible to apply css on the bases of mouse coordinates using jquery.
I have create a Button style under Resource folder of the main application. I have added the reference of this button syle in the App.xml of the main application.
Now this style is applicable to all the buttons in the main application or any other assembly.
I want if I want to override my custom style of button to the normal button style , what should I do ??
Please help !!
I have a enum let's say
Enum MyEnum
{
FirstImage,
SecondImage,
ThirdImage,
FourthImage
};
I have binded this Enum to my combobox in XAML.
While defining an combobox I have defined an ItemTemplate of combox to take Two UI element:
TextBlock that show the enum value (Description)
Image
I have done this much in XAML. I am wondering where I can specify the Image corrosponding to each item of Enum. Is that possible through data trigger ?
I really appreciate if anyone have the XAML for this scenario.
Many Thanks in advance
Hi All,
I have horizontal wpf listview and i want to scroll all items on left/right button click.
So that when i clicked on Prev/Left button listview items moves to left and on Right/Next button click listview items moves to right.
Like jQuery Carousel
In a ASP.NET application I have a paging RadGrid which shows up textbox in each row. Outside the grid, there is an OK button to save the content of all the textbox. If user changes text in any one or more of the textbox and without clicking on the "OK" button, tries to move to a different page number (of the grid by clicking on the page number), he should be prompted for confirmation of save or cancel the changes.
I am guessing that one can write a Javascript function which would look for any form input control (textbox in my case) and detect changes and If there are changes, would prompt the user. However, I am not sure where I can call this function from? Any suggestion on this or a better way to achieve this would be appreciated.
I am using RadGrid but I guess this should be applicable to GridView as well.
The weird thing is If there is a javascript onClick() on a button, postback works otherwise, there is no postback. This was working very recently. I am not sure what recent changes made to the application made this happening throughout the site. The solution suggested by this link does not work as well (that link is applicable to .NET 1.1 though). Any idea whats going on?
I need to check If a column value (string) in SQL server table starts with a small letter and can only contain '_', '-', numbers and alphabets. I know I can use a SQL server CLR function for that. However, I am trying to implement that validation using a scalar UDF and could make very little here...I can use 'NOT LIKE', but I am not sure how to make sure I validate the string irrespective of the order of characters or in other words write a pattern in SQL for this. Am I better off using a SQL CLR function?
Any help will be appreciated..
Thanks in advance
How to catch exception in the main thread if the exception occurs in the secondary thread?
The code snippet for the scenario is given below:
private void button1_Click(object sender, EventArgs e)
{
try
{
Thread th1 = new Thread(new ThreadStart(Test));
th1.Start();
}
catch (Exception)
{
}
}
void Test()
{
for (int i = 0; i < 100; i++)
{
Thread.Sleep(100);
if (i == 2)
throw new MyException();
}
}
}
I have a simple test written like this
public class Test
{
[ThreadStatic]
private static ServiceClient client;
[TestMethod]
public void TestCase1()
{
If( client == null)
{
.... //instantiate client
}
client.CallMyServiceMethod()
}
[TestMethod]
public void TestCase2()
{
using(var newClient = new ServiceClient())
{
newClient.CallMyServiceMethod()
}
}
The percentage of new users is set to 100 % for the test, and the user load is constant load of 1.
But the response time for TestCase1 is about 3 times better than TestCase2.
Can someone see what i am missing here ?
many thanks