Search Results

Search found 3479 results on 140 pages for 'chris cyvas'.

Page 111/140 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • How do you calculate the offset to the client area in WPF?

    - by chris
    I want to position a modal dialog (progress window) at the top right corner of the parent window client area. This code will put it in the corner of the non-client area, but how do I calculate the offset to the client area? this.Owner=owner; this.Left=owner.Left+owner.ActualWidth-Width; this.Top=owner.Top; Edit: I found this 'solution' that works for normal windows: this.Left=owner.Left+owner.ActualWidth-Width-SystemParameters.ResizeFrameVerticalBorderWidth; this.Top=owner.Top+SystemParameters.ResizeFrameHorizontalBorderHeight+SystemParameters.WindowCaptionHeight; This would however fail for windows that have customized borders. EDIT: The code should work regardless of the systems DPI setting (e.g. 120 instead of 96).

    Read the article

  • Need MYSQL query for finding lowest score per game player

    - by Chris Barnhill
    I have a game on Facebook called Rails Across Europe. I have a Best Scores page where I show the players with the best 20 scores, which in game terms refers to the lowest winning turn. The problem is that there are a small number of players who play frequently, and their scores dominate the page. I'd like to make the scores page open to more players. So I thought that I could display the single lowest winning turn for each player instead of displaying all of the lowest winning turns for all players. The problem is that the query for this eludes me. So I hope that one of you brilliant StackOverflow folks can help me with this. I have included the relevant MYSQL table schemas below. Here are the the table relationships: player_stats contains statistics for either a game in progress or a completed game. If a game is in progress, winning_turn is zero (which means that games with a winning_turn of zero should not be included in the query). player_stats has a game_player table id reference. game_player contains data describing games currently in progress. game_player has a player table id reference. player contains data describing a person who plays the game. Here's the query I'm currently using: 'SELECT p.fb_user_id, ps.winning_turn, gp.difficulty_level, c.name as city_name, g.name as goods_name, d.cost FROM game_player as gp, player as p, player_stats as ps, demand as d, city as c, goods as g WHERE p.status = "ACTIVE" AND gp.player_id = p.id AND ps.game_player_id = gp.id AND d.id = ps.highest_demand_id AND c.id = d.city_id AND g.id = d.goods_id AND ps.winning_turn > 0 ORDER BY ps.winning_turn ASC, d.cost DESC LIMIT '.$limit.';'; Here are the relevant table schemas: -- -- Table structure for table `player_stats` -- CREATE TABLE IF NOT EXISTS `player_stats` ( `id` int(11) NOT NULL auto_increment, `game_player_id` int(11) NOT NULL, `winning_turn` int(11) NOT NULL, `highest_demand_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `game_player_id` (`game_player_id`,`highest_demand_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3814 ; -- -- Table structure for table `game_player` -- CREATE TABLE IF NOT EXISTS `game_player` ( `id` int(10) unsigned NOT NULL auto_increment, `game_id` int(10) unsigned NOT NULL, `player_id` int(10) unsigned NOT NULL, `player_number` int(11) NOT NULL, `funds` int(10) unsigned NOT NULL, `turn` int(10) unsigned NOT NULL, `difficulty_level` enum('STANDARD','ADVANCED','MASTER','ULTIMATE') NOT NULL, `date_last_used` datetime NOT NULL, PRIMARY KEY (`id`), KEY `game_id` (`game_id`,`player_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3814 ; -- -- Table structure for table `player` -- CREATE TABLE IF NOT EXISTS `player` ( `id` int(11) NOT NULL auto_increment, `fb_user_id` char(255) NOT NULL, `fb_proxied_email` text NOT NULL, `first_name` char(255) NOT NULL, `last_name` char(255) NOT NULL, `birthdate` date NOT NULL, `date_registered` datetime NOT NULL, `date_last_logged_in` datetime NOT NULL, `status` enum('ACTIVE','SUSPENDED','CLOSED') NOT NULL, PRIMARY KEY (`id`), KEY `fb_user_id` (`fb_user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1646 ;

    Read the article

  • Regular expression for a string containing one word but not another

    - by Chris Stahl
    I'm setting up some goals in Google Analytics and could use a little regex help. Lets say I have 4 URLs http://www.anydotcom.com/test/search.cfm?metric=blah&selector=size&value=1 http://www.anydotcom.com/test/search.cfm?metric=blah2&selector=style&value=1 http://www.anydotcom.com/test/search.cfm?metric=blah3&selector=size&value=1 http://www.anydotcom.com/test/details.cfm?metric=blah&selector=size&value=1 I want to create an expression that will identify any URL that contains the string selector=size but does NOT contain details.cfm I know that to find a string that does NOT contain another string I can use this expression: (^((?!details.cfm).)*$) But, I'm not sure how to add in the selector=size portion. Any help would be greatly appreciated!

    Read the article

  • Passing around a SqlConnection

    - by Chris
    I have created a TransactionScope and within the scope various items are created and updated in the database. During this process I make a lot of calls to the database. Originally I opened a SqlConnection in the beginning of the TransactionScope and passed it around to any function that made a DB call then I closed the connection after all the calls are made and before the transaction commits. Is it better to do this or to open and close a connection for each call?

    Read the article

  • A window that behaves both modally and non-modally

    - by Chris
    I want to create a WPF window that behaves as a modal dialogue box while at the same time facilitating selected operations on certain other windows of the same application. An example of this behaviour can be seen in Adobe Photoshop, which offers several dialogues that allow the user to use an eyedropper tool to make selections from an image while disabling virtually all other application features. I'm guessing that the way forward is to create a non-modal, always-on-top dialogue and programmatically disable those application features that are not applicable to the dialogue. Is there an easy way to achieve this in WPF? Or perhaps there's a design pattern I could adopt.

    Read the article

  • sql server bulk copy out/postgres copy from infile

    - by Chris Curvey
    I'm starting a conversion of a system from MS SQL Server to Postgres. I have the table structures converted, and I use "bcp" to get the data out of SQL Server. ERROR: invalid byte sequence for encoding "UTF8": 0x80 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". CONTEXT: COPY cm_outgoing, line 200: "200 c:\temp\200.xml 2009-10-10 01:50:44.000 1900-01-01 00:00:00.000" I've already used "sed" to get rid of the NUL (0x00) entries in the file, and I can't find any instances of 0x80 in the file that I'm trying to import. Any thoughts? Is there an easier way?

    Read the article

  • What's wrong with output parameters?

    - by Chris McCall
    Both in SQL and C#, I've never really liked output parameters. I never passed parameters ByRef in VB6, either. Something about counting on side effects to get something done just bothers me. I know they're a way around not being able to return multiple results from a function, but a rowset in SQL or a complex datatype in C# and VB work just as well, and seem more self-documenting to me. Is there something wrong with my thinking, or are there resources from authoritative sources that back me up? What's your personal take on this and why? What can I say to colleagues that want to design with output parameters that might convince them to use different structures? EDIT: interesting turn- the output parameter I was asking this question about was used in place of a return value. When the return value is "ERROR", the caller is supposed to handle it as an exception. I was doing that but not pleased with the idea. A coworker wasn't informed of the need to handle this condition and as a result, a great deal of money was lost as the procedure failed silently!

    Read the article

  • 404 on custom post types after updating Wordpress to 3.7

    - by Chris
    Since I updated Wordpress from 3.6 to 3.7, I'm not able to visit the single-pages on my custom post types, then I get a 404 error. I thought this would be a rewrite_rules issue, so I've tried the following: -Go to the Permalink settings, click save (flush rewrites) -Manually deleted the rewrite_rules from the option table in the DB (I was desparate, and it seriously worked for me one time) -Re-check my .htaccess, but this is the exactly same as instructed on the permalink page -switched off the plugins I also tried switching the permalink to the "ugly" url (eg. ?page=35) and check if the articles worked, and they did! So I'm pretty sure it's a permalink issue. Now I rolled back to 3.6 again, but I of course want to upgrade in the near future (security etc.). A remarkable thing was that during the rollback I checked out a single page (notice that I didn't rolled back the database yet, only the files) and surprisingly they worked again. Any suggestions on how to solve this?

    Read the article

  • Finding open contiguous blocks of time for every day of a month, fast

    - by Chris
    I am working on a booking availability system for a group of several venues, and am having a hard time generating the availability of time blocks for days in a given month. This is happening server-side in PHP, but the concept itself is language agnostic -- I could be doing this in JS or anything else. Given a venue_id, month, and year (6/2012 for example), I have a list of all events occurring in that range at that venue, represented as unix timestamps start and end. This data comes from the database. I need to establish what, if any, contiguous block of time of a minimum length (different per venue) exist on each day. For example, on 6/1 I have an event between 2:00pm and 7:00pm. The minimum time is 5 hours, so there's a block open there from 9am - 2pm and another between 7pm and 12pm. This would continue for the 2nd, 3rd, etc... every day of June. Some (most) of the days have nothing happening at all, some have 1 - 3 events. The solution I came up with works, but it also takes waaaay too long to generate the data. Basically, I loop every day of the month and create an array of timestamps for each 15 minutes of that day. Then, I loop the time spans of events from that day by 15 minutes, marking any "taken" timeslot as false. Remaining, I have an array that contains timestamp of free time vs. taken time: //one day's array after processing through loops (not real timestamps) array( 12345678=>12345678, // <--- avail 12345878=>12345878, 12346078=>12346078, 12346278=>false, // <--- not avail 12346478=>false, 12346678=>false, 12346878=>false, 12347078=>12347078, // <--- avail 12347278=>12347278 ) Now I would need to loop THIS array to find continuous time blocks, then check to see if they are long enough (each venue has a minimum), and if so then establish the descriptive text for their start and end (i.e. 9am - 2pm). WHEW! By the time all this looping is done, the user has grown bored and wandered off to Youtube to watch videos of puppies; it takes ages to so examine 30 or so days. Is there a faster way to solve this issue? To summarize the problem, given time ranges t1 and t2 on day d, how can I determine the remaining time left in d that is longer than the minimum time block m. This data is assembled on demand via AJAX as the user moves between calendar months. Results are cached per-page-load, so if the user goes to July a second time, the data that was generated the first time would be reused. Any other details that would help, let me know. Edit Per request, the database structure (or the part that is relevant here) *events* id (bigint) title (varchar) *event_times* id (bigint) event_id (bigint) venue_id (bigint) start (bigint) end (bigint) *venues* id (bigint) name (varchar) min_block (int) min_start (varchar) max_start (varchar)

    Read the article

  • lua metatable __lt __le __eq forced boolean conversion of return value

    - by chris g.
    Overloading __eq, __lt, and __le in a metatable always converts the returning value to a boolean. Is there a way to access the actual return value? This would be used in the following little lua script to create an expression tree for an argument usage: print(_.a + _.b - _.c * _.d + _.a) -> prints "(((a+b)-(c*d))+a)" which is perfectly what I would like to have but it doesn't work for print(_.a == _.b) since the return value gets converted to a boolean ps: print should be replaced later with a function processing the expression tree -- snip from lua script -- function binop(op1,op2, event) if op1[event] then return op1[event](op1, op2) end if op2[event] then return op2[event](op1, op2) end return nil end function eq(op1, op2)return binop(op1,op2, "eq") end ... function div(op1, op2)return binop(op1,op2, "div") end function exprObj(tostr) expr = { eq = binExpr("=="), lt = binExpr("<"), le = binExpr("<="), add = binExpr("+"), sub=binExpr("-"), mul = binExpr("*"), div= binExpr("/") } setmetatable(expr, { __eq = eq, __lt = lt, __le = le, __add = add, __sub = sub, __mul = mul, __div = div, __tostring = tostr }) return expr end function binExpr(exprType) function binExprBind(lhs, rhs) return exprObj(function(op) return "(" .. tostring(lhs) .. exprType .. tostring(rhs) .. ")" end) end return binExprBind end function varExpr(obj, name) return exprObj(function() return name end) end _ = {} setmetatable(_, { __index = varExpr }) -- snap -- Modifing the lua vm IS an option, however it would be nice if I could use an official release

    Read the article

  • sendmail.php needs some php work

    - by Chris
    I am having the hardest time to get a simple sendmail.php to work. My form html is <form action=sendmail.php id=contact-form method=post> <p> <label for=cf_name>Name *</label> <input id=cf_name name=cf_name placeholder='Enter your name...' required=required title=Name type=text /> </p> <p> <label for=cf_email>Email *</label> <input id=cf_email name=cf_email placeholder='Email address...' required=required title='Email address' type=email /> </p> <p> <label for=cf_subject>Subject *</label> <input id=cf_subject name=cf_subject placeholder='Specify subject...' required=required title=Subject type=text /> </p> <p> <label for=cf_message>Message *</label> <textarea id=cf_message name=cf_message placeholder='Message text...' required=required rows=10 title='Message text'></textarea> </p> <p> <input type=submit value='Send message'/> </p> </form> And my mailer script is: <? $cf_email = $_POST['cf_email'] ; $cf_message = $_POST['cf_message'] ; $cf_subject = $_POST['cf_subject'] ; $cf_name = $_POST['cf_name'] ; mail( "[email protected]", $cf_subject, $cf_message, $cf_name, $cf_email ); print "Congratulations your email has been sent"; ?> Just want an email to to go to my email. When it appears in the inbox, the subject they typed is the one that I will see as the subject in my inbox. The from will be their name. The email it came from will be their email And the message inside will be the message they wrote in the form. Please help.

    Read the article

  • Extjs 3.4 - Button Icon does not show or does not center

    - by Chris
    I want to fill a button with an icon I created but whatever I have tried just seems to put the icon either half cut off and way left, or it doesn't show at all. I've been trying different combinations of CSS and the icon, iconcls, cls button options. I was following the Ext 3 buttons example page but that doesn't seem to display anything for me... This code is an item inside my form panel (I try to replicate this with different buttons in the panel) { xtype: 'container', layout: { type: 'table', columns: 2, tableAttrs: { cellspacing: 5 } }, // padding: 5, pack: 'center', align: 'middle', items: [{ xtype: 'button', width: 40, // scale: 'medium', ref: '../drawToolsBtn', tooltip: 'Drawing Tools', icon: 'img/draw.png', iconAlign: 'top', baseCls: 'x-plain', // iconCls: 'drawBtn', enableToggle: true, // padding: 3, toggleHandler: function(btn, state) { this.showDrawToolsWin(state); }, scope: this },{ xtype: 'label', // columnWidth: 1, // remainder of container padding: 3, text: 'Click button to open Drawing Tools Menu' }] } CSS -------------------- .drawBtn{ background: url(../img/draw.png) !important; } Thank you for any help!

    Read the article

  • Variable not accessible within and if statment

    - by Chris
    I have a variable which holds a score for a game. My variable is accessible and correct outside of an if statement but not inside as shown below cout << score << endl; //works if(!justFinished){ cout << score << endl; // doesn't work prints a large negative number endTime = time(NULL); ifstream highscoreFile; highscoreFile.open("highscores.txt"); if(highscoreFile.good()){ highscoreFile.close(); }else{ std::ofstream outfile ("highscores.txt"); cout << score << endl; outfile << score << std::endl; outfile.close(); } justFinished = true; } cout << score << endl;//works

    Read the article

  • Fluent NHibernate CheckProperty and Dates

    - by Chris C
    I setup a NUnit test as such: new PersistenceSpecification<MyTable>(_session) .CheckProperty(c => c.ActionDate, DateTime.Now); When I run the test via NUnit I get the following error: SomeNamespace.MapTest: System.ApplicationException : Expected '2/23/2010 11:08:38 AM' but got '2/23/2010 11:08:38 AM' for Property 'ActionDate' The ActionDate field is a datetime field in a SQL 2008 database. I use Auto Mapping and declare the ActionDate as a DateTime property in C#. If I change the test to use DateTime.Today the tests pass. My question is why is the test failing with DateTime.Now? Is NHibernate losing some precision when saving the date to the database and if so how do prevent the lose? Thank you.

    Read the article

  • Why does SQL Server 2000 treat SELECT test.* and SELECT t.est.* the same?

    - by Chris Pebble
    I butter-fingered a query in SQL Server 2000 and added a period in the middle of the table name: SELECT t.est.* FROM test Instead of: SELECT test.* FROM test And the query still executed perfectly. Even SELECT t.e.st.* FROM test executes without issue. I've tried the same query in SQL Server 2008 where the query fails (error: the column prefix does not match with a table name or alias used in the query). For reasons of pure curiosity I have been trying to figure out how SQL Server 2000 handles the table names in a way that would allow the butter-fingered query to run, but I haven't had much luck so far. Any sql gurus know why SQL Server 2000 ran the query without issue? Update: The query appears to work regardless of the interface used (e.g. Enterprise Manager, SSMS, OSQL) and as Jhonny pointed out below it bizarrely even works when you try: SELECT TOP 1000 dbota.ble.* FROM dbo.table

    Read the article

  • asp.net mvc 2 multithread

    - by Chris Cap
    I'm getting some weird behavior in asp.net MVC2 (at least it's not what I'm expecting). I have a controller httppost action that processes credit cards. I'm setting a session variable on the server to let me know if a user has attempted to process a card. I clear that session variable when I'm done. I am doing some very quick posts to test the process and the session variable is coming back null everytime because I clear the session variable at the end of the process. I have some debug prints that show me that the all requests are processed synchronously. That is...the first attempt occurs, it fails, session variable is cleared, second attempt tries and fails and the variable is cleared, etc... My first thought was that this was a side effect of debugging and that it just lined requests up for debugging purposes using the local webserver. So I put it on a development server and the same thing is occurring. Multiple submits/posts are processed synchronously. I even put a System.Threading.Sleep in there to make sure it would stop right after I set the session variable and it still won't even START the second request until the first is done. Has anyone else seen this behavior? My understanding was that a worker process was spawned for each request and that these actions could happen asychronously. Here's some psuedo code if (Session["CardCharged"] != null) return RedirectToAction("Index", "Problem"); Session["CardCharged"] = false; //starting the process System.Threading.Thread.Sleep(10000); //charge card here if (!providerResponse.IsApproved) { System.Diagnostics.Debug.WriteLine("failed"); Session["CardCharged"] = null; //have to allow them to charge again since this failed return View(myModel); } Session["CardCharged"] = true; return RedirectToAction("Index", "OrderComplete"); I should mention that my code ALWAYS fails the credit card check for testing purposes. I'm trying to test the situation where processing is STILL occurring and redirect the user elsewhere. I have set a dummy session variable elsewhere to assure that the session id "sticks". So I know the session id is the same for each request. Thanks

    Read the article

  • Sync data between a windows desktop app and windows mobile client app

    - by Chris W
    I need to knock up a very quick prototype/proof of concept application to demo to someone within the next couple of days so I've minimal time to research this as fully as I normally would. The set-up is a very simple database application running on a laptop - will only ever be a single user updating a couple of tables so I was thinking of knocking up a basic Win Forms app against SQL Compact. Visual Studio's auto generated data grid edit screens will be fine with a little customisation. The second aspect is to then add a windows mobile client application that can pull data from both tables stored on the laptop, edit some data and insert some extra rows before sending the changes back to the laptop copy of the database. I've not done any WinMo development so what's the best approach for me to look at. Is it easy enough to sync data between the two databases when the WinMo device is connected to the laptop with USB? Most of the samples I've looked at so far seem to be syncing SQL Compact with SQL Standard using IIS which seems a bit overkill. The volumes of data to be synced are so small that I can easily write some manual sync code if it's easy for me to query/update the Compact DB from the laptop application when the device is connected.

    Read the article

  • jQuery: Listen to changes within a DIV and act accordingly

    - by Chris
    I have a function that grabs an XML document and transforms it according to an XSL document. It then places the result into a div with the id laneconfigdisplay. What I want to do is, separate to the transformation logic, setup a jQuery change event for that div so I can tell when it has changed, and run some jQuery code. I have tried the following, but it does not work! $(document).ready(function() { $('#laneconfigdisplay').change(function() { alert('woo'); }); //Do XML / XSL transformation here }); <!-- HTML code here --> <div id="laneconfigdisplay"></div> What am I doing wrong?

    Read the article

  • SQL Profiler and Tuning Advisor for Reporting Services - what events should be selected?

    - by chris
    I've used the SQL Profiler to generate a trace file, and tuning advisor to take that trace file and provide some recommendations on db updates. However, the SQL Profiler doesn't seem to track the queries when running against a Reporting Server, the profiler doesn't seem to be capturing any of the queries. I'm logging the defaults (SQL:BatchCompleted and Starting, RPC:completed, and Sessions - Existing Connections) What events should I be capturing in SQL Profiler in order to run the tuning advisor?

    Read the article

  • Can I set NHibernate's default "OrderBy" to be "CreatedDate" not "Id"?

    - by Chris F
    This is an oddball question I figure. Can I get NHibernate to ask SQL to sort data by CreatedDate by default unless I set an OrderBy in my HQL or Criteria? I'm interested in knowing whether this sort can be accomplished at the DB level to avoid bringing in LINQ. The reason is that I use GUIDs for Ids and when I do something like this: Sheet sheet = sheetRepository.Get(_someGUID); IList<SheetLineItems> lineItems = sheet.LineItems; to fetch all of the lineItems, they come back in whatever arbitrary way that SQL sorts that fetch, which I figure is GUID. At some point I'll add ordinals to my line items, but for now, I just want to use CreatedDate as the sort criteria. I don't want to be forced to do: IList<SheetLineItem> lineItems = sheetLineItemRepository.GetAll(_sheetGUID); and then writing that method to sort by CreatedDate. I figure if everything is just sorted on CreatedDate by default, that would be fine, unless specifically requested otherwise.

    Read the article

  • NSTextField enter to trigger action

    - by Chris
    I've been looking all over for a simple example of how to have an action (or button) be triggered when the enter key is hit in the text field. Should I subclass the text field? Would I need to set a delegate to call the action I need? Is there a way to catch the event in my main window controller class? If you could even just point me to the right direction that would be great. Thanks.

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >