Search Results

Search found 4784 results on 192 pages for 'john maxim'.

Page 26/192 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Handling auto-incrementing IDENTITY SQL Server fields with LINQ to SQL in C#

    - by Maxim Z.
    I'm building an ASP.NET MVC site that uses LINQ to SQL to connect to SQL Server, where I have a table that has an IDENTITY bigint primary key column that represents an ID. In one of my code methods, I need to create an object of that table to get its ID, which I will place into another object based on another table (FK-to-PK relationship). At what point is the IDENTITY column value generated and how can I obtain it from my code? Is the right approach to: Create the object that has the IDENTITY column Do an InsertOnSubmit() and SubmitChanges() to submit the object to the database table Get the value of the ID property of the object

    Read the article

  • Extracting multiple values from a string with RegEx

    - by Toni Frankola
    I have an input string that's generated as in following example: string.Format("Document {0}, was saved by {1} on {2}. The process was completed {3} milliseconds and data was received.", "Document.docx", "John", "1/1/2011", 45); Generate string looks like this then: Document Document.docx, was saved by John on 1/1/2011. The process was completed 45 milliseconds and data was received. Once such a string is received from a different application, what would be the easiest way to parse with regex and extract values Document.docx, John, 1/1/2011, 45 from it. I am looking for the easiest way to do this as we will have to parse a number of different input strings.

    Read the article

  • How to determine the timezone that an email was sent from in C#

    - by John Sibly
    Can anyone recommend a way to determine the timezone that an email was sent from in C#? Looking at the header information of an email includes information like: Received: from mail-ew0-f211.google.com (123.85.219.211) by UKExchange (10.1.10.99) with Microsoft SMTP Server id 1.2.345.6; Tue, 13 Apr 2010 14:26:24 +0100 Received: by ewy3 with SMTP id 3so288857ewy.6 for <[email protected]>; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.213.2 with HTTP; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) X-Originating-IP: [83.244.243.210] Date: Tue, 13 Apr 2010 14:26:23 +0100 Received: by 10.103.3.17 with SMTP id f17mr3087878mui.123.1271165183473; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) There are a number of "Received: from" and "Received: by" keys with a date, time and timezone indicated on the end. Which one of these should I attempt to parse? Is this a reliable way to figure out the sender's timezone, or anyone recommend a better way?

    Read the article

  • Does Microsoft hate firefox? ASP.Net gridview performance in firefox bug?

    - by Maxim Gershkovich
    Could someone please explain the significant difference in speed between a firefox updatepanel async postback and one performed in IE? Average Firefox Postback Time For 500 objects: 1.183 Second Average IE Postback Time For 500 objects: 0.295 Seconds Using firebug I can see that the majority of this time in FireFox is spent on the server side. A total of 1.04 seconds. Given this fact the only thing I can assume is causing this problem is the way that ASP.Net renders its controls between the two browsers. Has anyone run into this problem before? VB.Net Code Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click GridView1.DataBind() End Sub Public Function GetStockList() As StockList Dim res As New StockList For l = 0 To 500 Dim x As New Stock With {.Description = "test", .ID = Guid.NewGuid} res.Add(x) Next Return res End Function Public Class Stock Private m_ID As Guid Private m_Description As String Public Sub New() End Sub Public Property ID() As Guid Get Return Me.m_ID End Get Set(ByVal value As Guid) Me.m_ID = value End Set End Property Public Property Description() As String Get Return Me.m_Description End Get Set(ByVal value As String) Me.m_Description = value End Set End Property End Class Public Class StockList Inherits List(Of Stock) End Class Markup <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript" language="Javascript"> function timestamp_class(this_current_time, this_start_time, this_end_time, this_time_difference) { this.this_current_time = this_current_time; this.this_start_time = this_start_time; this.this_end_time = this_end_time; this.this_time_difference = this_time_difference; this.GetCurrentTime = GetCurrentTime; this.StartTiming = StartTiming; this.EndTiming = EndTiming; } //Get current time from date timestamp function GetCurrentTime() { var my_current_timestamp; my_current_timestamp = new Date(); //stamp current date & time return my_current_timestamp.getTime(); } //Stamp current time as start time and reset display textbox function StartTiming() { this.this_start_time = GetCurrentTime(); //stamp current time } //Stamp current time as stop time, compute elapsed time difference and display in textbox function EndTiming() { this.this_end_time = GetCurrentTime(); //stamp current time this.this_time_difference = (this.this_end_time - this.this_start_time) / 1000; //compute elapsed time return this.this_time_difference; } //--> </script> <script type="text/javascript" language="javascript"> var time_object = new timestamp_class(0, 0, 0, 0); //create new time object and initialize it Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function BeginRequestHandler(sender, args) { var elem = args.get_postBackElement(); ActivateAlertDiv('visible', 'divAsyncRequestTimer', elem.value + ''); time_object.StartTiming(); } function EndRequestHandler(sender, args) { ActivateAlertDiv('visible', 'divAsyncRequestTimer', '(' + time_object.EndTiming() + ' Seconds)'); } function ActivateAlertDiv(visstring, elem, msg) { var adiv = $get(elem); adiv.style.visibility = visstring; adiv.innerHTML = msg; } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="click" /> </Triggers> <ContentTemplate> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"> </asp:UpdateProgress> <asp:Button ID="Button1" runat="server" Text="Button" /> <div id="divAsyncRequestTimer" style="font-size:small;"> </div> <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" /> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /> </Columns> </asp:GridView> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetStockList" TypeName="WebApplication1._Default"> </asp:ObjectDataSource> </ContentTemplate> </asp:UpdatePanel> </form>

    Read the article

  • Linq generic Expression in query on "element" or on IQueryable (multiple use)

    - by Bogdan Maxim
    Hi, I have the following expression public static Expression<Func<T, bool>> JoinByDateCheck<T>(T entity, DateTime dateToCheck) where T : IDateInterval { return (entityToJoin) => entityToJoin.FromDate.Date <= dateToCheck.Date && (entityToJoin.ToDate == null || entityToJoin.ToDate.Value.Date >= dateToCheck.Date); } IDateInterval interface is defined like this: interface IDateInterval { DateTime FromDate {get;} DateTime? ToDate {get;} } and i need to apply it in a few ways: (1) Query on Linq2Sql Table: var q1 = from e in intervalTable where FunctionThatCallsJoinByDateCheck(e, constantDateTime) select e; or something like this: intervalTable.Where(FunctionThatCallsJoinByDateCheck(e, constantDateTime)) (2) I need to use it in some table joins (as linq2sql doesn't provide comparative join): var q2 = from e1 in t1 join e2 in t2 on e1.FK == e2.PK where OtherFunctionThatCallsJoinByDateCheck(e2, e1.FromDate) or var q2 = from e1 in t1 from e2 in t2 where e1.FK == e2.PK && OtherFunctionThatCallsJoinByDateCheck(e2, e1.FromDate) (3) I need to use it in some queries like this: var q3 = from e in intervalTable.FilterFunctionThatCallsJoinByDateCheck(constantDate); Dynamic linq is not something that I can use, so I have to stick to plain linq. Thank you Clarification: Initially I had just the last method (FilterFunctionThatCallsJoinByDateCheck(this IQueryable<IDateInterval> entities, DateTime dateConstant) ) that contained the code from the expression. The problem is that I get a SQL Translate exception if I write the code in a method and call it like that. All I want is to extend the use of this function to the where clause (see the second query in point 2)

    Read the article

  • @media queries - one rule overrides another?

    - by John
    I have multiple @media queries all working fine but as soon as i put in a higher max screen-width than 1024px the rules for the higher width gets applied to everything. @media screen and (max-width: 1400px) { #wrap { width: 72%; } } @media screen and (max-width: 1024px) { #slider h2 { width: 100%; } #slider img { margin: 60px 0.83333333333333% 0 2.08333333333333%; } .recent { width: 45.82%; margin: 10px 2.08333333333334% 0 1.875%; } } as you can see 1024px (and also the 800px max-width query) do not change the #wrap width and work fine. As soon as i add the 1400px max-width query it changes them to 72% for ALL sizes and does the same for any element - for instance if i set #slider img to have a margin of 40px it will show at ALL sizes even though it is only in the max-width of 1400px. Am i missing something really obvious? Been trying to work this out for the past 2 days! Thanks, John

    Read the article

  • How to extract data from a text file

    - by šljaker
    I need to parse some large text file and extract Display name and area code only if it matches the following pattern: Line starts with display name (any number of words) Followed by 6 digits (can contain spaces) Followed by #text tag e.g. John doe 123 456 #text some text Display name: John doe Area code: 123 456 Test 123456 #text Display name: Test Area code: 123456 Test 123 #test Invalid, area code contains only 3 digits Test 123456 #test1 Invalid, contains invalid tag Test 123g45 #test Invalid, area code contains letters etc. I know how to open the text file and read it line by line, but having trouble with writing the regular expression. Any help would be greatly appreciated! edit: I have tried this: private static void Main(string[] args) { string text = "John Doe 123 45 #text Lorem ipsum dolor :)"; string pattern = @"(\w+)*([0-9]{2,5}).([0-9]{2,5}).#text"; Match match = Regex.Match(text, pattern, RegexOptions.IgnoreCase); if (match.Success) { string key = match.Groups[0].Value; Console.WriteLine(key); } }

    Read the article

  • MSMQ - Message Queue Abstraction and Pattern

    - by Maxim Gershkovich
    Hi All, Let me define the problem first and why a messagequeue has been chosen. I have a datalayer that will be transactional and EXTREMELY insert heavy and rather then attempt to deal with these issues when they occur I am hoping to implement my application from the ground up with this in mind. I have decided to tackle this problem by using the Microsoft Message Queue and perform inserts as time permits asynchronously. However I quickly ran into a problem. Certain inserts that I perform may need to be recalled (ie: retrieved) immediately (imagine this is for POS system and what happens if you need to recall the last transaction - one that still hasn’t been inserted). The way I decided to tackle this problem is by abstracting the MessageQueue and combining it in my data access layer thereby creating the illusion of a single set of data being returned to the user of the datalayer (I have considered the other issues that occur in such a scenario (ie: essentially dirty reads and such) and have concluded for my purposes I can control these issues). However this is where things get a little nasty... I’ve worked out how to get the messages back and such (trivial enough problem) but where I am stuck is; how do I create a generic (or at least somewhat generic) way of querying my message queue? One where I can minimize the duplication between the SQL queries and MessageQueue queries. I have considered using LINQ (but have very limited understanding of the technology) and have also attempted an implementation with Predicates which so far is pretty smelly. Are there any patterns for such a problem that I can utilize? Am I going about this the wrong way? Does anyone have an of their own ideas about how I can tackle this problem? Does anyone even understand what I am talking about? :-) Any and ALL input would be highly appreciated and seriously considered… Thanks again.

    Read the article

  • Creating a Variable of Present Date Minus a Past Timestamp

    - by John
    Hello, In the code below, "created" is a field in a MySQL table. This field is of the type "timestamp" and the default is set to "CURRENT_TIMESTAMP" of whenever a given row is created. In the query below, I would like to create a new variable that equals the present date minus the timestamp of "created", rounded off to units of days. I would like the present date to be whenever the query is run. How could I do this? Thanks in advance, John $sqlStr = "SELECT l.loginid, l.username, l.created, ...

    Read the article

  • Could I use Revert after abrupting Merge?

    - by John
    Hallo all, Just now I tried to upload a modified working copy to its branch in the following steps: 1. Update 2. Commit Then I attempted to Merge the changes in the trunk to this branch. However during editing of the conflicts I realized there were so many conflicting codes that I could not address completely today, then I gived up the Merge, and the working copy got an exclamation mark immediately. Thru Check for modifications I found that many many files had been modified or had conflicts. It seems that the Merge has been somehow wrongly carried out. My question: could I return to the state before the Merge simply using Revert? Thanks a lot in advance, John

    Read the article

  • MySQL IDE recommendation?

    - by Maxim Veksler
    Hello, I've been wondering what you guys are using to write,debug,test your SQL queries there days? The requirements are quite simple: Auto-complete Syntax Highlighting SQL Hisotry Good UI There are some tools which are common for this task, each with his own problems. To name a few Mysql Query Browser MySQL Workbench (GA?, Beta?) Eclipse Database development perspective Oracle SQL Developer with Connector/J I won't go into why none of them is perfect, trust me they all have their problems. So, what are you guys using?

    Read the article

  • How to wait for thread to finish with .NET?

    - by Maxim Z.
    I've never really used threading before in C# where I need to have two threads, as well as the main UI thread. Basically, I have the following. public void StartTheActions() { //Starting thread 1.... Thread t1 = new Thread(new ThreadStart(action1)); t1.Start(); //Now, I want for the main thread (which is calling StartTheActions() ) to wait for t1 to finish (I have created an event in action1() for this) and then start t2... //HOW DO I DO THIS? Thread t2 = new Thread(new ThreadStart(action2)); t2.Start(); } So, essentially, my question is how to have a thread wait for another one to finish. What is the best way to do this? Thanks!

    Read the article

  • What's the fastest way to approximate the period of data using Octave?

    - by John
    I have a set of data that is periodic (but not sinusoidal). I have a set of time values in one vector and a set of amplitudes in a second vector. I'd like to quickly approximate the period of the function. Any suggestions? Specifically, here's my current code. I'd like to approximate the period of the vector x(:,2) against the vector t. Ultimately, I'd like to do this for lots of initial conditions and calculate the period of each and plot the result. function xdot = f (x,t) xdot(1) =x(2); xdot(2) =-sin(x(1)); endfunction x0=[1;1.75]; #eventually, I'd like to try lots of values for x0(2) t = linspace (0, 50, 200); x = lsode ("f", x0, t) plot(x(:,1),x(:,2)); Thank you! John

    Read the article

  • ASP.Net Architecture Specific to Shared/Static functions

    - by Maxim Gershkovich
    Hello All, Could someone please advise in the context of a ASP.Net application is a shared/static function common to all users? If for example you have a function Public shared function GetStockByID(StockID as Guid) as Stock Is that function common to all current users of your application? Or is the shared function only specific to the current user and shared in the context of ONLY that current user? So more specifically my question is this, besides database concurrency issues such as table locking do I need to concern myself with threading issues in shared functions in an ASP.Net application? In my head; let’s say my application namespace is MyTestApplicationNamespace. Everytime a new user connects to my site a new instance of the MyTestApplicationNamespace is created and therefore all shared functions are common to that instance and user but NOT common across multiple users. Is this correct?

    Read the article

  • Appending a Query String to the End of a Function Action URL

    - by John
    Hello, For the code below, I would like to append echo $_SERVER['QUERY_STRING']; to the end of index.php. But when I try to do it, it makes the code return a blank page. So I think I might be doing it wrong. How can I correctly make this appendage? Thanks in advance, John <?php function show_loginform($disabled = false) { echo '<form name="login-form" id="login-form" method="post" action="./index.php"> ... ?>

    Read the article

  • Printing All Entries in A PHP Table

    - by mgunawan
    I'm trying to insert a php excerpt with SQL (I understand this is outdated, but am trying to grasp the syntax first) into my HTML page, and I've got the following table: ID Name Element1 Element2 0 John John's 1st John's 2nd 1 Bill Bill's 1st Bill's 2nd 2 Steve Steven's 1st Steve's 2nd I'm trying to get the for loop that will essentially print out the following in my html page Name: Name where ID=0 Element1: Element1 where ID=0 Element2: Element2 where ID=0 Name: Name where ID=1 Element1: Element1 where ID=1 Element2: Element2 where ID=1 and so forth. Basically, I am trying to make this process automated so that whenever a new record is added into the table, the HTML page will automatically update with a new "profile". Thank you for your help!

    Read the article

  • If don't own proprietary database engine, what is best way to convert database to mysql?

    - by John Robertson
    I work for a very small company. I was recently faced with the question of whether there is a good way to convert a proprietary database to a MySQL database without owning the proprietary database engine e.g. if one is given a large oracle database file (or choose your favorite proprietary database engine format), but doesn't have a license for the oracle database engine, is there a good, perfectly reliable way to convert it to a MySQL database format that can be read with the MySQL database engine? My question is very vague as to which proprietary format is the source just because there would be multiple sources and it looks like they would be "various and sundry". My suspicion is that there is no perfectly reliable way, especially for a wide variety of proprietary databases. If there are a few proprietary formats for which this is possible, I would still be interested in knowing, though "various and sundry" is probably the real issue. Minimizing cost, effort and correct conversion are key so I think this is probably is the not possible list. -John

    Read the article

  • Adding a Third Table to a Two-Table Join Query

    - by John
    Hello, The query below works just fine. It pulls fields from two MySQL tables, "comment" and "login". It does this for rows where "username" in the table "login" equals the variable "$profile." It also pulls fields for rows where "loginid" in the table "comment" equals the "loginid" that is also being pulled from "login." I would like to pull data from a third table called "submission," which has the following fields: submissionid loginid title url displayurl datesubmitted I would like to pull fields from rows in "submission" where "loginid" equals the "loginid" that is already being pulled from the other two tables, "login" and "comment." How can I do this? Thanks in advance, John Query: $sqlStrc = "SELECT l.username, l.loginid, c.loginid, c.commentid, c.submissionid, c.comment, c.datecommented FROM comment AS c INNER JOIN login AS l ON c.loginid = l.loginid WHERE l.username = '$profile' ORDER BY c.datecommented DESC LIMIT 10";

    Read the article

  • Anonymous functions in C#

    - by Maxim Gershkovich
    The following syntax is valid VB.NET code Dim myCollection As New List(Of Stock) myCollection.Add(New Stock(Guid.NewGuid, "Item1")) myCollection.Add(New Stock(Guid.NewGuid, "Item2")) Dim res As List(Of Stock) = myCollection.FindAll(Function(stock As Stock) As Boolean If stock.Description = "Item2" Then Return True End If Return False End Function) How can I accomplish the same thing in C#? I have tried... myCollection.FindAll(bool delegate(Stock stock) { if (blah blah) { } }); But it appears I have somehow structured it incorrectly as I get the following error. "Error 1 Invalid expression term 'bool'"

    Read the article

  • reading a file that doesn't exist

    - by John
    Hi, I have got a small program that prints the contents of files using the system call - read. unsigned char buffer[8]; size_t offset=0; size_t bytes_read; int i; int fd = open(argv[1], O_RDONLY); do{ bytes_read = read(fd, buffer, sizeof(buffer)); printf("0x%06x : ", offset); for(i=0; i<bytes_read; ++i) { printf("%c ", buffer[i]); } printf("\n"); offset = offset + bytes_read; }while(bytes_read == sizeof(buffer)); Now while running I give a file name that doesn't exist. It prints some kind of data mixed with environment variables and a segmentation fault at the end. How is this possible? What is the program printing? Thanks, John

    Read the article

  • Text rotation in IE 9

    - by John Bowden
    Hi there I'm attempting to rotate a piece of text on its end within a div using the following different methods. writing-mode: tb-rl; filter: FlipH FlipV; and: -ms-transform: rotate(-90deg); filter: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=1, M21=-1, M22=6.123233995736766e-17, sizingMethod='auto expand'); Although the text rotates properly in all browsers using either method and even IE all the way up to and including 8. IE 9 produces a horrid pixelated text which is nigh unreadable. Alongside this, IE9 also subtly breaks the layout of various pieces in the application which could be part of the same underlying problem perhaps. If anyone knows a way around this I would be most appreciative. John

    Read the article

  • scrolling a readonly cell in NSTableview?

    - by John Velman
    I have a table that the user should not be able to edit directly (although user actions may cause changes). One column may contain a string too long for any reasonable size cell, so to see everything there, the user needs to scroll the cell (using arrow keys, for example). If I make either the column or cell not editible, I loose the ability to scroll the cell. If I make it editable, of course, I loose the ability to keep the user from changeing it. (I'm using NSArray controller and a couple of NSObject controllers to get from the model to the table view using bindings. Binding compliance via @property(copy) and @synthesize. Updating the model with setXXXX:xxx). Thanks, John Velman

    Read the article

  • Post serialized to xml object to mvc action

    - by Maxim
    Hello! i have 2 projects. First project send to 2-nd via http-post requests, as serialized to XML class instances. Ex: <?xml version="1.0" encoding="utf-16"?> <MyObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <UserId>test user</UserId> ... How can i recieve it in action of 2-nd project? [HttpPost] public ActionResult Index(MyObject id) { ... or like string, and deserialize after? Thanx.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >