Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Maddie from Dartford

@Maddie from Dartford
About
Posts
123
Topics
84
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • context menu display orientation [modified]
    M Maddie from Dartford

    Hi, I have created multiview C# form application and I am displaying context menu on mouse click event. Generally the display direction of menu click is towards right and it encroaches to the other view if I click the mouse near the edge of one view. I want that if context menu is crossing the boundry it should be displayed in opposite direction in within the same view limit. How can I do it? Thanks in advance.

    modified on Monday, May 10, 2010 3:54 AM

    C# question csharp

  • Prevent access to directory
    M Maddie from Dartford

    Thanks for reply. Yes it is allowing to delete with the rule I applied and posted here as well. I might be missing something in the rules but it is allowing. It might be because I have admin rights on my PC. Thanks.

    C# question csharp help

  • Prevent access to directory
    M Maddie from Dartford

    Yeah.. That's good idea. The only concern is that folder can't be deleted but other containts of the folder can be deleted one by one. Anyway, this solution might resolve my problem. Thanks.

    C# question csharp help

  • Prevent access to directory
    M Maddie from Dartford

    Thanks for reply. I am using security like this:

            AccessRule rule = new FileSystemAccessRule("Users", 
                                                        FileSystemRights.Write | 
                                                            FileSystemRights.ReadAndExecute ,
                                                        InheritanceFlags.ContainerInherit | 
                                                            InheritanceFlags.ObjectInherit,
                                                        PropagationFlags.InheritOnly,
                                                        AccessControlType.Deny);
    

    Still I am able to delete the folder manually. Thanks.

    C# question csharp help

  • Prevent access to directory
    M Maddie from Dartford

    Hello, I am creating a directory programatically (C#) to store some application specific data. I want that this directory should't be deleted or modified while the application is running but once the application is closed, it can be modified or deleted. Also, all user on the machine should have similar rights for that folder. How do I achieve this? Any help in this direction will be greatly appreciated. Thanks.

    C# question csharp help

  • get list of weeks with week number
    M Maddie from Dartford

    Hello, I want to write a stored procedure in SQL wich returns last 12 weeks list (including current week) with start date. e.g. 01: 04 Jan 10 53: 28 Dec 09 52: 21 Dec 09 51: 14 Dec 09 : : P.S. My first day of week is Monday so first week of year 2010 will start from 4 Jan 2010 and week starting from 28 Dec will be wk 53. I am doing something like this

    ALTER PROCEDURE [dbo].[GetWeekNumberList]
    @IncludeCurrentWeek BIT = NULL

    AS
    BEGIN
    SET DATEFIRST 1;
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    CREATE TABLE #tempWeekList(weekDate DATETIME, weekLabel VARCHAR(25))
    
    DECLARE @Counter INT,
    	@StartDate DATETIME,
    	@EndDate DATETIME
    
    
    IF @IncludeCurrentWeek IS NOT NULL AND @IncludeCurrentWeek = 1
    	BEGIN
    		SET @StartDate = DATEADD(dd, (DATEPART(dw, GETDATE()) \* -1) + 1, GETDATE())
    	END
    ELSE
    	BEGIN
    		SET @StartDate = DATEADD(dd, (DATEPART(dw, DATEADD(dd, -7, GETDATE())) \* -1) + 1, DATEADD(dd, -7, GETDATE()))
    	END
    SET @EndDate = DATEADD(dd, 4, @StartDate)
    SET @Counter = 1
    
    
    WHILE @Counter <= 12
    BEGIN
    	INSERT INTO #tempWeekList
    	VALUES (@EndDate, CAST(DATEPART(wk, @EndDate) AS VARCHAR) + ': ' + CONVERT(VARCHAR, @StartDate, 6))
    	SET @StartDate = DATEADD(dd, -7, @StartDate)
    	SET @EndDate = DATEADD(dd, 4, @StartDate)
    	SET @Counter = @Counter + 1
    END
    
    SELECT \* FROM #tempWeekList
    
    DROP TABLE #tempWeekList
    

    END

    I am not able to get the 53 as last week. How to do it? Any idea or help will be very useful to me. Thanks.

    Database database help tutorial question

  • find week num of first week in year [modified]
    M Maddie from Dartford

    Thanks. Yeah.. I'll do this calulation. Thanks again.

    C# question

  • find week num of first week in year [modified]
    M Maddie from Dartford

    Thanks Rich. Actually, I wanted to display week num for starting days before monday of new year.

    C# question

  • find week num of first week in year [modified]
    M Maddie from Dartford

    Thanks D@nish, I am not trying to know about monday as first day. I am trying to extract the week num of first week where first day of week for me is Monday. So, If the year (e.g. 2010) starts on Friday then Friday, Saturday & Sunday should be considered as days of last week of previous year and that is 53 for year 2009.I want this number(53). Week number 1 should start from 4 Jan 2010 (Monday).

    C# question

  • find week num of first week in year [modified]
    M Maddie from Dartford

    Thanks d@ninsh, I think we can get that. Outlook calender displays that and that is what the help says for FirstFullWeek. If you use FirstFourDayWeek then it gives week 53 but i don't want to use because it will fail for me if new year week starts before wednesday.

    C# question

  • find week num of first week in year [modified]
    M Maddie from Dartford

    Hi, I want to know the first week num of Jan 2010 if first day of week is Monday. All day before monday should be considered under last week of previous year, i.e. As first monday comes on 4th Jan 2010, i.e. I am expecting Jan 1,2 & 3 under week 53 of last year. I am using this code

    System.Globalization.CultureInfo currentCulture = System.Globalization.CultureInfo.CurrentCulture;
    System.Globalization.Calendar calendar = currentCulture.Calendar;
    DateTime firstOfYear = new DateTime(DateTime.Now.Year, 1, 1);

    int weekNo = calendar.GetWeekOfYear(firstOfYear, System.Globalization.CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday);

    The week num is coming 52 instead of 53. What is going wrong? Is there any other way to do it? Thanks.

    modified on Thursday, January 7, 2010 10:19 AM

    C# question

  • Application common data with write permission to all user
    M Maddie from Dartford

    This is what i did and works for me.

    bool isModified = false;
    DirectoryInfo myDirectoryInfo = new DirectoryInfo("FolderPath");
    DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();

    AccessRule rule = new FileSystemAccessRule("Users",
    FileSystemRights.Write |
    FileSystemRights.ReadAndExecute |
    FileSystemRights.Modify,
    InheritanceFlags.ContainerInherit |
    InheritanceFlags.ObjectInherit,
    PropagationFlags.InheritOnly,
    AccessControlType.Allow);

    myDirectorySecurity .ModifyAccessRule(AccessControlModification.Add, rule, out isModified);
    myDirectoryInfo .SetAccessControl(myDirectorySecurity );

    Thanks to all.

    C# csharp question workspace

  • Application common data with write permission to all user
    M Maddie from Dartford

    Thanks. I think it is problem of access permission only. Whenever you create any folder, other user has read only permissions for that folders. So if any other user(from same domain) tries to modify the folder or file within it, it says Access denied. I am trying to create a folder programatically with full control to all user.... How to do it? Any kind of direction will be great help. Also, Let me know if i am wrong or need to take some different approach.

    C# csharp question workspace

  • Application common data with write permission to all user
    M Maddie from Dartford

    Thanks a lot for reply. In our application, an XML File is generated when user wants to save some application data from given menu option. These data can be read back to display the information by any logged user. Now, other user should be able to modify the data and save it back. At a time only one user is editing so I think the problem is with the access right (Exception says the same thing: access denied). Regards, Gajesh

    C# csharp question workspace

  • Application common data with write permission to all user
    M Maddie from Dartford

    Hello, I am writing C# desktop appplication and I want to store some application specific data which should be accessible to all user with write permission. I am using Environment.SpecialFolder.CommonApplicationData for setting location to write file but I found that the file created in my login is not editable by other user. Where should I create the file so that it shoul be accessible to all user with write permission? Regards, Gajesh

    C# csharp question workspace

  • main form is not activated
    M Maddie from Dartford

    Hello, I am using borderless form as main form. It has a menu bar associted with it. The problem is that main for window is not focused by default. Menus gets highlighted when i move mouse over it but they do not expand as i click on it. I need to click one more time to expand the menu. What should i do so that form is activated as soon as it comes up. Thanks in advance.

    C# help

  • directory path for test method
    M Maddie from Dartford

    Thanks Henry, It is returning the path as "file:\C:\....\\....\TestResults\user_UKNML2009-10-16 16_39_37\Out". I need debug or application executable path. (If i do some modification in code to reach up to the required path from the assembly path then it will not work for actual application output.)

    C# csharp visual-studio xml question

  • directory path for test method
    M Maddie from Dartford

    Hello, I am using

    string exePath = System.Windows.Forms.Application.ExecutablePath;
    string myFilePath = Path.GetDirectoryName(exePath) + Path.DirectorySeparatorChar + "MyFile.xml";

    to get working path of a file and it works fine when i run the application with VS2008. I have written test method "[TestMethod]" to test a fuctionality which uses the above application path but my test result is failed because if i run test case then the excecutable path refers to visual studio env exe and my file is not present over there. I don't want to hard code the file path. Please tell me how can i make my test case successfull or get the correct application path. Thanks in Advance.

    C# csharp visual-studio xml question

  • Limit size of text file (LIFO)
    M Maddie from Dartford

    Thanks a lot, I managed to toggle between two files as a logger as workaround. Still i am keen to explore the right and best way to implement this. I'll post the solution as soon as i am done.

    C# csharp question

  • Limit size of text file (LIFO)
    M Maddie from Dartford

    Thanks Navneeth, The download seems to be very big (200+ MB)for log4net. I'll give a try to similar type of logger. I'll also explore if i can create another file as suggested earlier.

    C# csharp question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups