Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 161/788 | < Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >

  • Working effectively with unit tests / Anyone tried the in-assembly approach?

    - by CodingCrapper
    I'm trying to re-introduce unit testing into my team as our current coverage is very poor. Our system is quite large 40+ projects/assemblies. We current use a project named [SystemName].Test.csproj were all the test code is dumped and organised to represent the namespaces using folders. This approach is not very scalable and makes it difficult to find tests. I've been thinking about added a Tests folder to each project, this would put the unit tests "in the developers face" and make them easy to find. The downside is the Production release code would contain references to nunit, nmocks as well as the test code and test data.... Has anyone tried this approach? How is everyone else working with unit tests on large projects? Having a Tests project per "real" project/assembly would introduce too many new projs. Thanks in advance

    Read the article

  • Javascript content rotator?

    - by different
    I’ve got the basics of a content rotator done, the only problem is it doesn’t loop itself back to the beginning and I cannot figure out why! It is a very simple javascript script: window.onload = function() { setInterval("transition()", 5000); } function transition() { var y = document.getElementById("featured").getElementsByTagName("li"); for (var i=0;i<y.length;i++) { if (y[i].className == "current") { y[(i+1)].className = "current"; y[i].className = ""; break; } } } It keeps stopping at the end of the list, basically I just want it to loop. Any help?

    Read the article

  • Is a PHP-only "cache engine" ever worth it?

    - by adsads
    I wrote a rather small skeleton for my web apps and thought that I would also add a small cache for it. It is rather simple: If the current page exists as a file in the cache and the file isn't too old, read it out and exit instead of rebuilding the page If the current page isn't cached/outdated recalc the page and save it However, the bad thing about it is: My performance tests with a page that receives 40 relatively long posts via a MySQL query said that with using the cache, it took even longer to handle a single request (1000 tests each) How can that happen? Should I just remove the complete raw-PHP cache and relieve on the availability of some PHP cache like memcached or so?

    Read the article

  • how so select similarities in MySQL?

    - by mysqllearner
    Currently, I am doing a search function. Lets say in my database, I have this data: Keyword1 Keyword2 Keyword3 Keysomething Key and the user entered: "Key" as the keyword to search. This is my current query: Q1: SELECT * FROM data WHERE (data_string LIKE '$key%' OR data_string LIKE '%$key%' OR data_string LIKE '%$key') Basically, I have 2 questions: How do I sort by (order by) similarity. From above example, I should have "Key" as my first result. My current result is: Keyword1, Keyword2, Keyword3, Keysomething and Key My SQL query only search by the "data_string" column, what if I want to seach others column? Do I need to do something like this: Q2: SELECT * FROM data WHERE (data_string LIKE '$key%' OR data_string LIKE '%$key%' OR data_string LIKE '%$key') OR (data_other LIKE '$key%' OR data_other LIKE '%$key%' OR data_other LIKE '%$key') ... Is there any better/faster query than Q2?

    Read the article

  • Do superfluous calls to addEventListenter("event", thisSpecificFunction) waste resources?

    - by Richard Haven
    I have ItemRenderers that need to listen for events. When they hear an event (and when data changes), they dispatch an event with their current data value. As item renderers are reused, each of them is going to add its callback in set data(value...)and pass the callback function in the event as well as the current data value. So, the listener of the item renderer's bubbling event will set someEventDispatcher.addEventListener("someEvent", itemRendererEvent.callbackListener). This will happen more than once. Does setting the same event listener on the same event for the same dispatcher waste resources? Does the displatcher see that it already has the listener?

    Read the article

  • Gridview adding row dynamically on RowDataBound with the same RowState (Alternate or Normal)

    - by rob waminal
    I am adding rows dynamically on code behind depending on the Row currently bounded on RowDataBound event. I want that added row to be the same state (Alternate or Normal) of the currently bounded row is this possible? I'm doing something like this but it doesn't follow what I want. I'm expecting the added row dynamically would be the same as the current row. But it is not. protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { GVData data = e.Row.DataItem as GVData; // not original object just for brevity if(data.AddHiddenRow) { // the row state here should be the same as the current GridViewRow tr = new GridViewRow(e.Row.RowIndex +1, e.Row.RowIndex + 1, DataControlRowType.DataRow, e.Row.RowState); TableCell newTableCell = new TableCell(); newTableCell.Style.Add("display", "none"); tr.Cells.Add(newTableCell); ((Table)e.Row.Parent).Rows.Add(tr); } } }

    Read the article

  • Accordion table cell - How to dynamically expand/contract uitableviewcell?

    - by s.newave
    Hi, I am trying create an accordion type of uitableviewcell that, when the user selects the cell, it expands to display a detailed info view inline similar to how the digg app works. I initially tried replacing the current tablecell with a customcell in cellForRowAtIndex however the animation looks a bit choppy as you can see the cell being replaced and overall the effect doesnt work to well. If you look at the digg app and others who have done this it seems that they arent replacing the current cell but instead perhaps adding a subview to the cell? The original cell however doesnt seem to animate at all and only the new view accordions into the table. Does anyone have any ideas how to accomplish a similar effect?

    Read the article

  • Which workaround to use for the following SQL deadlock?

    - by Marko
    I found a SQL deadlock scenario in my application during concurrency. I belive that the two statements that cause the deadlock are (note - I'm using LINQ2SQL and DataContext.ExecuteCommand(), that's where this.studioId.ToString() comes into play): exec sp_executesql N'INSERT INTO HQ.dbo.SynchronizingRows ([StudioId], [UpdatedRowId]) SELECT @p0, [t0].[Id] FROM [dbo].[UpdatedRows] AS [t0] WHERE NOT (EXISTS( SELECT NULL AS [EMPTY] FROM [dbo].[ReceivedUpdatedRows] AS [t1] WHERE ([t1].[StudioId] = @p0) AND ([t1].[UpdatedRowId] = [t0].[Id]) ))',N'@p0 uniqueidentifier',@p0='" + this.studioId.ToString() + "'; and exec sp_executesql N'INSERT INTO HQ.dbo.ReceivedUpdatedRows ([UpdatedRowId], [StudioId], [ReceiveDateTime]) SELECT [t0].[UpdatedRowId], @p0, GETDATE() FROM [dbo].[SynchronizingRows] AS [t0] WHERE ([t0].[StudioId] = @p0)',N'@p0 uniqueidentifier',@p0='" + this.studioId.ToString() + "'; The basic logic of my (client-server) application is this: Every time someone inserts or updates a row on the server side, I also insert a row into the table UpdatedRows, specifying the RowId of the modified row. When a client tries to synchronize data, it first copies all of the rows in the UpdatedRows table, that don't contain a reference row for the specific client in the table ReceivedUpdatedRows, to the table SynchronizingRows (the first statement taking part in the deadlock). Afterwards, during the synchronization I look for modified rows via lookup of the SynchronizingRows table. This step is required, otherwise if someone inserts new rows or modifies rows on the server side during synchronization I will miss them and won't get them during the next synchronization (explanation scenario to long to write here...). Once synchronization is complete, I insert rows to the ReceivedUpdatedRows table specifying that this client has received the UpdatedRows contained in the SynchronizingRows table (the second statement taking part in the deadlock). Finally I delete all rows from the SynchronizingRows table that belong to the current client. The way I see it, the deadlock is occuring on tables SynchronizingRows (abbreviation SR) and ReceivedUpdatedRows (abbreviation RUR) during steps 2 and 3 (one client is in step 2 and is inserting into SR and selecting from RUR; while another client is in step 3 inserting into RUR and selecting from SR). I googled a bit about SQL deadlocks and came to a conclusion that I have three options. Inorder to make a decision I need more input about each option/workaround: Workaround 1: The first advice given on the web about SQL deadlocks - restructure tables/queries so that deadlocks don't happen in the first place. Only problem with this is that with my IQ I don't see a way to do the synchronization logic any differently. If someone wishes to dwelve deeper into my current synchronization logic, how and why it is set up the way it is, I'll post a link for the explanation. Perhaps, with the help of someone smarter than me, it's possible to create a logic that is deadlock free. Workaround 2: The second most common advice seems to be the use of WITH(NOLOCK) hint. The problem with this is that NOLOCK might miss or duplicate some rows. Duplication is not a problem, but missing rows is catastrophic! Another option is the WITH(READPAST) hint. On the face of it, this seems to be a perfect solution. I really don't care about rows that other clients are inserting/modifying, because each row belongs only to a specific client, so I may very well skip locked rows. But the MSDN documentaion makes me a bit worried - "When READPAST is specified, both row-level and page-level locks are skipped". As I said, row-level locks would not be a problem, but page-level locks may very well be, since a page might contain rows that belong to multiple clients (including the current one). While there are lots of blog posts specifically mentioning that NOLOCK might miss rows, there seems to be none about READPAST (never) missing rows. This makes me skeptical and nervous to implement it, since there is no easy way to test it (implementing would be a piece of cake, just pop WITH(READPAST) into both statements SELECT clause and job done). Can someone confirm whether the READPAST hint can miss rows? Workaround 3: The final option is to use ALLOW_SNAPSHOT_ISOLATION and READ_COMMITED_SNAPSHOT. This would seem to be the only option to work 100% - at least I can't find any information that would contradict with it. But it is a little bit trickier to setup (I don't care much about the performance hit), because I'm using LINQ. Off the top of my head I probably need to manually open a SQL connection and pass it to the LINQ2SQL DataContext, etc... I haven't looked into the specifics very deeply. Mostly I would prefer option 2 if somone could only reassure me that READPAST will never miss rows concerning the current client (as I said before, each client has and only ever deals with it's own set of rows). Otherwise I'll likely have to implement option 3, since option 1 is probably impossible... I'll post the table definitions for the three tables as well, just in case: CREATE TABLE [dbo].[UpdatedRows]( [Id] [uniqueidentifier] NOT NULL ROWGUIDCOL DEFAULT NEWSEQUENTIALID() PRIMARY KEY CLUSTERED, [RowId] [uniqueidentifier] NOT NULL, [UpdateDateTime] [datetime] NOT NULL, ) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX IX_RowId ON dbo.UpdatedRows ([RowId] ASC) WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE TABLE [dbo].[ReceivedUpdatedRows]( [Id] [uniqueidentifier] NOT NULL ROWGUIDCOL DEFAULT NEWSEQUENTIALID() PRIMARY KEY NONCLUSTERED, [UpdatedRowId] [uniqueidentifier] NOT NULL REFERENCES [dbo].[UpdatedRows] ([Id]), [StudioId] [uniqueidentifier] NOT NULL REFERENCES, [ReceiveDateTime] [datetime] NOT NULL, ) ON [PRIMARY] GO CREATE CLUSTERED INDEX IX_Studios ON dbo.ReceivedUpdatedRows ([StudioId] ASC) WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE TABLE [dbo].[SynchronizingRows]( [StudioId] [uniqueidentifier] NOT NULL [UpdatedRowId] [uniqueidentifier] NOT NULL REFERENCES [dbo].[UpdatedRows] ([Id]) PRIMARY KEY CLUSTERED ([StudioId], [UpdatedRowId]) ) ON [PRIMARY] GO PS! Studio = Client. PS2! I just noticed that the index definitions have ALLOW_PAGE_LOCK=ON. If I would turn it off, would that make any difference to READPAST? Are there any negative downsides for turning it off?

    Read the article

  • How to rate a connect four game situation in java

    - by MrPink
    Hey, I am trying to write a simple AI for a "Get four" game. The basic game principles are done, so I can throw in coins of different color, and they stack on each other and fill a 2D Array and so on and so forth. until now this is what the method looks like: public int insert(int x, int color) //0 = empty, 1=player1 2=player2" X is the horizontal coordinate, as the y coordinate is determined by how many stones are in the array already, I think the idea is obvious. Now the problem is I have to rate specific game situations, so find how many new pairs, triplets and possible 4 in a row I can get in a specific situation to then give each situation a specific value. With these values I can setup a "Game tree" to then decide which move would be best next (later on implementing Alpha-Beta-Pruning). My current problem is that I can't think of an efficient way to implement a rating of the current game situation in a java method. Any ideas would be greatly appreciated! greetings from Germany Mr. Pink

    Read the article

  • Getting huge lags when downloading files via Service

    - by Copa
    I have a Service which receives URLs to download. The Service than downloads these URLs and save them to a file on the SD Card. When I put more than 2 items in the download queue my device is unusable. It nearly freezes. Huge lags and so on. Any idea? Sourcecode: private static boolean downloading = false; private static ArrayList<DownloadItem> downloads = new ArrayList<DownloadItem>(); /** * called once when the service started */ public static void start() { Thread thread = new Thread(new Runnable() { @Override public void run() { while (true) { if (downloads.size() > 0 && !downloading) { downloading = true; DownloadItem item = downloads.get(0); downloadSingleFile(item.getUrl(), item.getFile()); } } } }); thread.start(); } public static void addDownload(DownloadItem item) { downloads.add(item); } private static void downloadSuccessfullFinished() { if (downloads.size() > 0) downloads.get(0).setDownloaded(true); downloadFinished(); } private static void downloadFinished() { // remove the first entry; it has been downloaded if (downloads.size() > 0) downloads.remove(0); downloading = false; } private static void downloadSingleFile(String url, File output) { final int maxBufferSize = 4096; HttpResponse response = null; try { response = new DefaultHttpClient().execute(new HttpGet(url)); if (response != null && response.getStatusLine().getStatusCode() == 200) { // request is ok InputStream is = response.getEntity().getContent(); BufferedInputStream bis = new BufferedInputStream(is); RandomAccessFile raf = new RandomAccessFile(output, "rw"); ByteArrayBuffer baf = new ByteArrayBuffer(maxBufferSize); long current = 0; long i = 0; // read and write 4096 bytes each time while ((current = bis.read()) != -1) { baf.append((byte) current); if (++i == maxBufferSize) { raf.write(baf.toByteArray()); baf = new ByteArrayBuffer(maxBufferSize); i = 0; } } if (i > 0) // write the last bytes to the file raf.write(baf.toByteArray()); baf.clear(); raf.close(); bis.close(); is.close(); // download finished get start next download downloadSuccessfullFinished(); return; } } catch (Exception e) { // not successfully downloaded downloadFinished(); return; } // not successfully downloaded downloadFinished(); return; }

    Read the article

  • Write a dll that is accessable from VS 2003 VC++ code

    - by John
    I need to be able to write a DLL in either C# or VC++ that is accessible from code that is written in Visual Studio 2003 VC++. It looks like the code is unmanaged (uses * for pointers) VC++ and this DLL needs to be able to drop right in and be accessed by the current code. The DLL is an RS232 driver that needs to be able to return an int for an error code and pass back, by reference, some measured values, to the calling program. Will I even be able to write this in C#? If not, I only have access to Visual Studio 2005 or 2008. Will I be able to write my code in either, and will that DLL be able to be called from the current code base? Or do I have to go looking on ebay for a copy of VS 2003?

    Read the article

  • Oracle SQL: Query results from previous X isoweeks () (where X might be > 52)

    - by tommy-o-dell
    How could I adapt this query to show the previous 61 weeks? (still exlcluding the current week). My query currently shows me the total weekly sales for 2010 grouped by ISO Week and ISO Year (exlcuding the current week). select to_char(order_date,'IYYY') as iso_year, to_char(order_date,'IW') as iso_week, sum(sale_amount) from orders where to_char(order_date,'IW') <> to_char(SYSDATE) and to_char(order_date,'IYYY') = 2010 group by to_char(order_date,'IYYY') to_char(order_date,'IW') I realize I could probably just omit the "2010" requirement, order by desc and limit results to a certain bnumber of rows. But that just doesn't seem right! Much appreciate any help pointing me in the right direction!

    Read the article

  • Emulate back button in multi-view TabActivity

    - by ZelluX
    Hi, all I have a TabActivity with several tabs. Each tab corresponds to a specific view, and those views may further switch to other views. For example, one of my tabs displays RSS feed list, after user clicks one of the RSS feed, it will switch to a view displaying a list of articles, and after user clicks one of the titles, a full article view will be displayed. I'm going to add support for "back" button in my application. For instance, in a full article view, after user presses the "back" button, it should switch back to the article list view. And if user presses it the "back" button again, my application should switch back to the feed list view. My idea is to maintain a Stack<View> during navigation, and every time user presses the "back" button, the program will pop a View out of the stack, and set it as the current view. But I would like to know how to set current view in TabHost. Many thanks.

    Read the article

  • Creating a Skill Calculator for Runescape

    - by USDblades
    I am beginning C++. I have a long way to go and I am one to never stop learning. I want to create a project for myself that will allow me to learn as I go. It will also give me the motivation and possibly add to my portfolio when I graduate. The runescape skill calculator will ask for your current experience in the current skill of your choosing and your desired level. For Example: my woodcutting experience is 60 and I want to get to lvl 5 which is 120 exp. That means im 60 experience away. by cutting oak logs I get 5 experience per log. The calculator would tell me I need to cut 12 Oak logs. All these numbers are made up. So to my question. Where would I even begin? Hoping it would have buttons to press.

    Read the article

  • How to save/export a DOM element to an image?

    - by Don Don
    Hi, I have a web page which has a form element (with its ID known) and inside the form there are multiple DIVs, and the position of each div may be changed. What I'd like to do is: a) Save the current state of this form // var currentForm=document.forms['myFrm'].innerHTML; would probably suffice... b) Save or export the entire form with the most current position of each DIV to an image file. // how to save/export the javascript var of currentForm to an image file is the key question. Any help/pointer would be appreciated.

    Read the article

  • Does preloading content from a page skew my google analytics stats?

    - by user278457
    I'd like to write myself a simple script that uses AJAX to load the content from each page on my main navbar into a hidden div on the current page. This is just so that I can preload as much of my important content as possible and get it cached on the user's computer (hopefully) before they've finished with the current page and want to move on. I'm concerned that doing a request for every page on the site, every time someone visits, will really ruin the validity of my google analytics stats. How does AJAX interact with google analytics? Does it count as a "page visit"?

    Read the article

  • How do i open Google Maps for directions using coordinates on the iphone

    - by Aran Mulholland
    I am using UIMapView to display locations on the iPhone. I want to do a directions from current location to the location of interest, I don't think its possible using MapKit (but if it is please inform) So I will open either the Google Maps application or safari to display it. Can i do this by specifying co-ordinates from (current location) to co-ordinates (the location of interest) I have these longitudes and latitudes. Or do i have to use street addresses? If I do have to use street addresses, can i get them from the latitude and longitude.

    Read the article

  • Refactoring multiple if statements for user authentication with subdomains

    - by go minimal
    I'm building a typical web app where once a user signs up they access the app through their own subdomain (company.myapp.com). The "checking what kind of user if any is logged in" piece is starting to get very hairy and it obviously needs to be well-written because its run so often so I was wondering how you guys would re-factor this stuff. Here are the different states: A user must be logged in, the user must not have a company name, and the sub-domain must be blank A user must be logged in, the user must have a company name, that company name must match the current sub-domain A user must be logged in, the user must have a company name, that company name must match the current sub-domain, and the user's is_admin boolean is true if !session[:user_id].nil? @user = User.find(session[:user_id]) if @user.company.nil? && request.subdomains.first.nil? return "state1" elsif [email protected]? if @user.company.downcase == request.subdomains.first.downcase && [email protected]_admin return "state2" elsif @user.company.downcase == request.subdomains.first.downcase && @user.is_admin return "state3" end end end

    Read the article

  • Python ctypes: loading DLL from from a relative path

    - by Frederick
    I have a Python module, wrapper.py, that wraps a C DLL. The DLL lies in the same folder as the module. Therefore, I use the following code to load it: myDll = ctypes.CDLL("MyCDLL.dll") This works if I execute wrapper.py from its own folder. If, however, I run it from elsewhere, ctypes goes looking for DLL in the current working directory and naturally fails. My question is, is there a way by which I can specify the DLL's path relative to the wrapper instead of the current working directory? This will enable me to ship the two together and allow the user to run/import the wrapper from anywhere.

    Read the article

  • AJAX form sections - how to pass url of next stage of form

    - by dan727
    Hi, I've got a multi-part form (in a PHP MVC setup) which I have working correctly without javascript enhancement. I'm starting to add the AJAX form handling code which will handle each stage of a form submission, validating/saving data etc, before using AJAX to load the next stage of the form. I'm wondering how best to pass the URL of the next stage to the current form being processed, so that my jQuery form handling code can process the current form, then load the next part via AJAX. The form "action" is different from what the url of the next stage of the form is - what do you think would be good practice here? I was thinking about either appending the url of the next stage to the form action url, via a query string - then just use javascript to extract this url when the form is successfully processed. The other option is via a hidden form element. Not sure what other client side options I have here Any thoughts?

    Read the article

  • help with yes/no radio button for multiple questions pull from database

    - by Darlene
    hey guys i need a little help with this questionaire form. The tables currently using are: user userid| username answers aswerid|quesid|ans|userid|date ques quesid|ques The form below is what im using however i'm gettin errors for radio button.... could anyone offer advice? $query = mysql_query("SELECT * FROM ques", $con) or die("Cannot Access tblprequeations From Server"); echo"<div id='quesform' class='quesform'>"; echo"<form name='QForm' method='post' action='answers.php' onsubmit='return validateQForm(this);'>"; echo"<p>"; while($row = mysql_fetch_array($query)) { echo"<p>"; echo"<label>".$row['quesid']."</label>&nbsp; &nbsp;"; echo"<label>".$row['ques']."</label>&nbsp; &nbsp;"; echo"<input type='radio' name='ans' value='yes' if (isset($_POST['ans']) && $_POST['ans'] == 'yes') echo'checked'/>"; echo"<input type='radio' name='ans' value='no' if (isset($_POST['ans']) && $_POST['ans'] == 'no') echo'checked'/>"; echo"</p>"; } echo"</p>";

    Read the article

  • Getting a senior job without the yrs of experience asked for

    - by dotnetdev
    Hi, My manager in my current company feels that I am selling myself short by getting another job - but as a senior. He feels I have sold myself short and missing out on a good salary by getting another junior job, given how he (my manager) has a lot of faith in my development skills. However, I have not worked long enough for a proper senior job (5 years +) but then the senior developer we do have in my current company isn't given senior tasks (judged by difficulty). How would I get a senior job if I lack the commercial experience? My manager still feels without that, I have the ability/knowledge (I help my manager with C# too). Thanks

    Read the article

  • How can I tell if an ADODB::_RecordsetPtr has already been created?

    - by scottm
    I am trying to write a class that uses ADO to retrieve SQL records. The intent is for the class to maintain one private recordset an other methods move forward, retrieve fields, etc. This is a basic example of my class: class SqlADO { private: ADODB::_RecordsetPtr m_recordset; public: void Open(); //open the connection void Execute(const char* sql); // creates or replaces current recordset void Next(); //moves recordset cursor forward void Field(const char* fieldName); //retrieves field name from current record of the recordset }; My Questions: In the Execute method, how can I check to see that the recordset instance has been created (or do I need to) so that I can close it first? Do you know of any good ADO COM Interop references?

    Read the article

< Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >