Search Results

Search found 78 results on 4 pages for 'kashif umair liaqat'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Exception during iteration on collection and remove items from that collection

    - by Muhammad Kashif Nadeem
    I remove item from ArrayList in foreach loop and get follwing exception. Collection was modified; enumeration operation may not execute. How can I remove items in foreach Following is my code: /* * Need to remove all items from 'attachementsFielPath' which does not exist in names array. */ try { string attachmentFileNames = txtAttachment.Text.Trim(); // Textbox having file names. string[] names = attachmentFileNames.Split(new char[] { ';' }); int index = 0; // attachmentsFilePath is ArrayList holding full path of fiels user selected at any time. foreach (var fullFilePath in attachmentsFilePath) { bool isNeedToRemove = true; // Extract filename from full path. string fileName = fullFilePath.ToString().Substring(fullFilePath.ToString().LastIndexOf('\\') + 1); for (int i = 0; i < names.Length; i++) { // If filename found in array then no need to check remaining items. if (fileName.Equals(names[i].Trim())) { isNeedToRemove = false; break; } } // If file not found in names array, remove it. if (isNeedToRemove) { attachmentsFilePath.RemoveAt(index); isNeedToRemove = true; } index++; } } catch (Exception ex) { throw ex; }

    Read the article

  • Creating stored procedure having different WHERE clause on different search criteria without putting

    - by Muhammad Kashif Nadeem
    Is there any alternate way to create stored procedure without putting all query in one long string if criteria of WWHERE clause can be different. Suppose I have Orders table I want to create stored procedure on this table and there are three column on which I wnat to filter records. 1- CustomerId, 2- SupplierId, 3- ProductId. If user only give CustomerId in search criteria then query should be like following SELECT * FROM Orders WHERE Orders.CustomerId = @customerId And if user only give ProductId in search criteria then query should be like following SELECT * FROM Orders WHERE Orders.ProductId = @productId And if user only all three CustomerId, ProductId, and SupplierId is given then all three Ids will be used in WHERE to filter. There is also chance that user don't want to filter record then query should be like following SELCT * FROM Orders Whenever I have to create this kind of procedure I put all this in string and use IF conditions to check if arguments (@customeId or @supplierId etc) has values. I use following method to create procedure DECLARE @query VARCHAR(MAX) DECLARE @queryWhere VARCHAR(MAX) SET @query = @query + 'SELECT * FROM Orders ' IF (@originationNumber IS NOT NULL) BEGIN BEGIN SET @queryWhere =@queryWhere + ' Orders.CustomerId = ' + CONVERT(VARCHAR(100),@customerId) END END IF(@queryWhere <> '') BEGIN SET @query = @query+' WHERE ' + @queryWhere END EXEC (@query) Thanks.

    Read the article

  • Adivce on Method overloads.

    - by Muhammad Kashif Nadeem
    Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try { if (customerId != null && customerId > 0) { Filter.Add(Customres.CustomerId == customerId); } if (supplierId != null && supplierId > 0) { Filter.Add(Suppliers.SupplierId == supplierId); } ProductsCollection products = new ProductsCollection(); products.FetchData(Filter); return products; } catch { throw; } } public static ProductsCollection GetDummyData(int? customerId) { return ProductsCollection GetDummyData(customerId, (int?)null); } public static ProductsCollection GetDummyData() { return ProductsCollection GetDummyData((int?)null); } 1- Please advice how can I make overloads for both CustomerId and SupplierId because only one overload can be created with GetDummyData(int? ). Should I add another argument to mention that first argument is CustomerId or SupplierId for example GetDummyData(int?, string). OR should I use enum as 2nd argument and mention that first argument is CustoemId or SupplierId. 2- Is this condition is correct or just checking 0 is sufficient - if (customerId != null && customerId 0) 3- Using Try/catch like this is correct? 4- Passing (int?)null is correct or any other better approach. Edit: I have found some other posts like this and because I have no knowledge of Generics that is why I am facing this problem. Am I right? Following is the post. http://stackoverflow.com/questions/422625/overloaded-method-calling-overloaded-method

    Read the article

  • How can I call a function at the very end of document.ready

    - by Umair
    I have multiple document.ready functions on a page and I want a function to be called when all my document.ready functions have been executed. I simply want the function to be called at the very end, after all other document.ready functions have executed. An example of this could be that each document.ready function increments a global variable when it has been executed, and the last function needs to check the value of that variable at the very end. Any ideas ?

    Read the article

  • I need a regex to return true for 01.mp4

    - by Umair
    I want to sort out specific files depending on their names, i want a regex that returns true for file names like : 01.mp4, 99.avi, 05.mpg. the file extensions must match exactly to the ones that i want and the filename must start with characters which can not be longer than 2 characters. the first part is done but the file extensions aren't working. need some help the regex that I have is /^[0-9]{1,2}\.[mp4|mpg|avi]*/ but it also returns true for 01.4mp4, 01.4mp4m.

    Read the article

  • AcceptButton for each group of controls in different tabs, Can't use some envents in Combobox to mak

    - by Muhammad Kashif Nadeem
    I have different tabs on my UserControl. Each tab has some controls and button. I want to change AcceptButton on the basis of group of controls I am in. I can use TextChanged event or Enter event to make a button AcceptButton for Textboxes but I have some Comboboxes too. These combos are auto complete so I can't user Enter event on these, because on Enter these combos should be completed. Following image can explain my problem more. Thanks.

    Read the article

  • After installing VS 2010 - Generic Host Process For Win32 Services problem starts.

    - by Muhammad Kashif Nadeem
    After installing VS 2010 trial I am getting this error "Generic Host Process For Win32 Services Encountered A Problem and needs to close. When this message pops my computer just stuck and I can not even restart it normally. I have found one fix on net but after that fix I can not access my LAN. This fix change these values in registry. HKLM\SYSTEM\CurrentControlSet\Services\netbt\parameters TransportBindName HKLM\Software\Microsoft\OLE EnableDCOM If I revert these registry changes then I again start getting 'Generic Host Process For Win32 Services' I have uninstall VS 2010 but this problem persist. This problem is not because of any virus. Any help to fix this or I have to re install Windows. Thanks.

    Read the article

  • Advice on Method overloads.

    - by Muhammad Kashif Nadeem
    Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try { if (customerId != null && customerId > 0) { Filter.Add(Customres.CustomerId == customerId); } if (supplierId != null && supplierId > 0) { Filter.Add(Suppliers.SupplierId == supplierId); } ProductsCollection products = new ProductsCollection(); products.FetchData(Filter); return products; } catch { throw; } } public static ProductsCollection GetDummyData(int? customerId) { return ProductsCollection GetDummyData(customerId, (int?)null); } public static ProductsCollection GetDummyData() { return ProductsCollection GetDummyData((int?)null); } 1- Please advice how can I make overloads for both CustomerId and SupplierId because only one overload can be created with GetDummyData(int? ). Should I add another argument to mention that first argument is CustomerId or SupplierId for example GetDummyData(int?, string). OR should I use enum as 2nd argument and mention that first argument is CustoemId or SupplierId. 2- Is this condition is correct or just checking 0 is sufficient - if (customerId != null && customerId 0) 3- Using Try/catch like this is correct? 4- Passing (int?)null is correct or any other better approach. Edit: I have found some other posts like this and because I have no knowledge of Generics that is why I am facing this problem. Am I right? Following is the post. http://stackoverflow.com/questions/422625/overloaded-method-calling-overloaded-method

    Read the article

  • NHibernate Tutorial Run-Time Error: HibernateException

    - by Kashif
    I'm a newbie at NHibernate so please go easy on me if I have asked a stupid question... I am following the tutorial for NHibernate posted here and am getting a run-time error of type "HibernateException" The code in question looks like this: using System; using System.Collections.Generic; using System.Linq; using System.Text; using FirstSolution; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using NUnit.Framework; namespace FirstSolution.Tests { [TestFixture] public class GenerateSchema_Fixture { [Test] public void Can_generate_schema() { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof(Product).Assembly); new SchemaExport(cfg).Execute(false, true, false); } } } The line I am getting the error at is: cfg.AddAssembly(typeof(Product).Assembly); The inner-most exception is: The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not be found And here's my stack trace: at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings) at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings) at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1 scriptAction, Boolean export, Boolean justDrop) at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop) at FirstSolution.Tests.GenerateSchema_Fixture.Can_generate_schema() in C:\Users\Kash\Documents\Visual Studio 2010\Projects\FirstSolution\FirstSolution\GenerateSchema_Fixture.cs:line 23 at HibernateUnitTest.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\Kash\Documents\Visual Studio 2010\Projects\FirstSolution\HibernateUnitTest\Form1.cs:line 23 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at HibernateUnitTest.Program.Main() in C:\Users\Kash\Documents\Visual Studio 2010\Projects\FirstSolution\HibernateUnitTest\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() I've made sure that System.Data.SqlServerCe has been referenced and that its Copy Local property is set to True. The error persists, however. Your help would be appreciated. Thanks.

    Read the article

  • insert in the head tag after wp_head

    - by Umair
    Using wordpress 2.9.2. I am loading my css files for plugins as they are being called, which ofcourse is after my header has been loaded. I want to insert the calls those css files in the HEAD tag of the page, which can be done if i get a hook which includes lines in the head after wp_head() has been called. Help !

    Read the article

  • Macintosh XCode Sharing

    - by Umair Ashraf
    I got a macbook pro and I want to share it with some of my friend located at the other side of internet. He can use Internet. Now I want him to give access to my whole Macbook (XCode for most) so he can do developments at his location using my macbook. Now I need to ask is there a way we can both utilize the samme macbook having two virtual OS (one for me and one for him) without affecting each others' privacy? Is it possible to share the macbook across more than 1 user? I don't mean Remote Desktop like of thing in Windows.

    Read the article

  • What's wrong with this JAVA code for android?

    - by Umair Ashraf
    I have written this piece of code to break an image into 9 pieces and it gives me runtime error. There is no error in LogCat and I am stuck. The error comes at line 7 line from bottom (Bitmap.createBitmap(...);). public Bitmap[] getPieces(Bitmap bmp) { Bitmap[] bmps = new Bitmap[9]; int width = bmp.getWidth(); int height = bmp.getHeight(); int rows = 3; int cols = 3; int cellHeight = height / rows; int cellWidth = width / cols; int piece = 0; for (int x = 0; x <= width; x += cellWidth) { for (int y = 0; y <= height; y += cellHeight) { Bitmap b = Bitmap.createBitmap(bmp, x, y, cellWidth, cellHeight, null, false); bmps[piece] = b; piece++; } } return bmps; }

    Read the article

  • Reverse rendering of Urdu fonts

    - by Syed Muhammad Umair
    I am working on a project that is based on Urdu language in Ubuntu platform. I'm using Python language and have almost achieved my task. The problem is that, the Urdu text is rendered in reverse order. For example, consider the word ??? (which means work) consisting of the three letters: ? , ? , and ? The output is rendered in reverse order as ??? consisting of the three letters: ?, ?, and ? When copying this text to Open Office or opening the generated XML file in Firefox, the generated result is absolutely desired. I Am using Python 2.6 IDLE, its working perfect with Windows platform, which clearly shows its not the problem of IDLE. Am working on TKINTER GUI library. How can this problem be solved?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >