Daily Archives

Articles indexed Tuesday May 11 2010

Page 31/123 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Microsoft .NET security model

    - by Thomas
    Hi all, I am looking for informations about the security model of Microsoft .NET If you could explain me how it is design, or give me links to understand it, it would be very kind of you ! Thanks.

    Read the article

  • Storing a NTFS Security Descriptor in C

    - by Doori Bar
    My goal is to store a NTFS Security Descriptor in its identical native state. The purpose is to restore it on-demand. I managed to write the code for that purpose, I was wondering if anybody mind to validate a sample of it? (The for loop represents the way I store the native descriptor) This sample only contains the flag for "OWNER", but my intention is to apply the same method for all of the security descriptor flags. I'm just a beginner, would appreciate the heads up. Thanks, Doori Bar #define _WIN32_WINNT 0x0501 #define WINVER 0x0501 #include <stdio.h> #include <windows.h> #include "accctrl.h" #include "aclapi.h" #include "sddl.h" int main (void) { DWORD lasterror; PSECURITY_DESCRIPTOR PSecurityD1, PSecurityD2; HANDLE hFile; PSID owner; LPTSTR ownerstr; BOOL ownerdefault; int ret = 0; unsigned int i; hFile = CreateFile("c:\\boot.ini", GENERIC_READ | ACCESS_SYSTEM_SECURITY, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hFile == INVALID_HANDLE_VALUE) { fprintf(stderr,"CreateFile() failed. Error: INVALID_HANDLE_VALUE\n"); return 1; } lasterror = GetSecurityInfo(hFile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION , &owner, NULL, NULL, NULL, &PSecurityD1); if (lasterror != ERROR_SUCCESS) { fprintf(stderr,"GetSecurityInfo() failed. Error: %lu;\n", lasterror); ret = 1; goto ret1; } ConvertSidToStringSid(owner,&ownerstr); printf("ownerstr of PSecurityD1: %s\n", ownerstr); /* The for loop represents the way I store the native descriptor */ PSecurityD2 = malloc( GetSecurityDescriptorLength(PSecurityD1) * sizeof(unsigned char) ); for (i=0; i < GetSecurityDescriptorLength(PSecurityD1); i++) ((unsigned char *) PSecurityD2)[i] = ((unsigned char *) PSecurityD1)[i]; if (IsValidSecurityDescriptor(PSecurityD2) == 0) { fprintf(stderr,"IsValidSecurityDescriptor(PSecurityD2) failed.\n"); ret = 2; goto ret2; } if (GetSecurityDescriptorOwner(PSecurityD2,&owner,&ownerdefault) == 0) { fprintf(stderr,"GetSecurityDescriptorOwner() failed."); ret = 2; goto ret2; } ConvertSidToStringSid(owner,&ownerstr); printf("ownerstr of PSecurityD2: %s\n", ownerstr); ret2: free(owner); free(ownerstr); free(PSecurityD1); free(PSecurityD2); ret1: CloseHandle(hFile); return ret; }

    Read the article

  • select from varchar2 column with numeric value sometimes gives invalid number error

    - by Rene
    I'm trying to understand why, on some systems, I get an invalid number error message when I'm trying to select a value from a varchar2 column while on other systems I don't get the error while doing the exact same thing. The table is something like this: ID Column_1 Column_2 1 V text 2 D 1 3 D 2 4 D 3 and a query: select ID from table where column_1='D' and column_2 = :some_number_value :some_number_value is always numeric but can be null. We've fixed the query: select ID from table where column_1='D' and column_2 = to_char(:some_number_value) This original query runs fine on most systems but on some systems gives an "invalid number" error. The question is why? Why does it work on most systems and not on some?

    Read the article

  • Right way to dispose Image/Bitmap and PictureBox

    - by kornelijepetak
    I am trying to develop a Windows Mobile 6 (in WF/C#) application. There is only one form and on the form there is only a PictureBox object. On it I draw all desired controls or whatever I want. There are two things I am doing. Drawing custom shapes and loading bitmaps from .png files. The next line locks the file when loading (which is an undesired scenario): Bitmap bmp = new Bitmap("file.png"); So I am using another way to load bitmap. public static Bitmap LoadBitmap(string path) { using (Bitmap original = new Bitmap(path)) { return new Bitmap(original); } } This is I guess much slower, but I don't know any better way to load an image, while quickly releasing the file lock. Now, when drawing an image there is method that I use: public void Draw() { Bitmap bmp = new Bitmap(240,320); Graphics g = Graphics.FromImage(bmp); // draw something with Graphics here. g.Clear(Color.Black); g.DrawImage(Images.CloseIcon, 16, 48); g.DrawImage(Images.RefreshIcon, 46, 48); g.FillRectangle(new SolidBrush(Color.Black), 0, 100, 240, 103); pictureBox.Image = bmp; } This however seems to be some kind of a memory leak. And if I keep doing it for too long, the application eventually crashes. Therefor, I have X questions: 1.) What is the better way for loading bitmaps from files without locking the file? 2.) What objects needs to be manually disposed in the Draw() function (and in which order) so there's no memory leak and no ObjectDisposedException throwing? 3.) If pictureBox.Image is set to bmp, like in the last line of the code, would pictureBox.Image.Dispose() dispose only resources related to maintaining the pictureBox.Image or the underlying Bitmap set to it?

    Read the article

  • Drawbacks of Dynamic Query in Sqlserver 2005 ?

    - by KuldipMCA
    I have using the many dynamic Query in my database for the procedures because my filter is not fix so i have taken @filter as parameter and pass in the procedure. Declare @query as varchar(8000) Declare @Filter as varchar(1000) set @query = 'Select * from Person.Address where 1=1 and ' + @Filter exec(@query) Like that my filter contain any Field from the table for comparison. It will affect my performance or not ? is there any alternate way to achieve this type of things

    Read the article

  • Easily measure elapsed time

    - by hap497
    I am trying to use time() to measure various points of my program. What I don't understand is why the values in the before and after are the same? I understand this is not the best way to profile my program, I just want to see how long something take. printf("**MyProgram::before time= %ld\n", time(NULL)); doSomthing(); doSomthingLong(); printf("**MyProgram::after time= %ld\n", time(NULL)); I have tried: struct timeval diff, startTV, endTV; gettimeofday(&startTV, NULL); doSomething(); doSomethingLong(); gettimeofday(&endTV, NULL); timersub(&endTV, &startTV, &diff); printf("**time taken = %ld %ld\n", diff.tv_sec, diff.tv_usec); How do I read a result of **time taken = 0 26339? Does that mean 26,339 nanoseconds = 26.3 msec? What about **time taken = 4 45025, does that mean 4 seconds and 25 msec?

    Read the article

  • Why does JPA require a no-arg constructor for domain objects ?

    - by Jacques René Mesrine
    Why does JPA require a no-arg constructor for domain objects ? I am using eclipselink and just got this exception during deployment. Exception [EclipseLink-63] (Eclipse Persistence Services-1.1.0.r3639-SNAPSHOT): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The instance creation method [com.me.model.UserVO.<Default Constructor>], with no parameters, does not exist, or is not accessible. Internal Exception: java.lang.NoSuchMethodException: com.me.model.UserVO.<init>() Descriptor: RelationalDescriptor(com.me.model.UserVO --> [DatabaseTable(user)])

    Read the article

  • how to put a drop down list in a flex advanced data grid

    - by Setori
    How can one put components into an advanced data grid? I wish to have a standard row with string items, in this row there is a date selector I want to put in, and in another cell of the row I want to put a drop down list box containing text "40" and "20" or you can manually edit the cell so that it displays what ever input you decide (other than 40 and 20) thanks so much

    Read the article

  • Asynchronous daemon processing / ORM interaction with Django

    - by perrierism
    I'm looking for a way to do asynchronous data processing with a daemon that uses Django ORM. However, the ORM isn't thread-safe; it's not thread-safe to try to retrieve / modify django objects from within threads. So I'm wondering what the correct way to achieve asynchrony is? Basically what I need to accomplish is taking a list of users in the db, querying a third party api and then making updates to user-profile rows for those users. As a daemon or background process. Doing this in series per user is easy, but it takes too long to be at all scalable. If the daemon is retrieving and updating the users through the ORM, how do I achieve processing 10-20 users at a time? I would use a standard threading / queue system for this but you can't thread interactions like models.User.objects.get(id=foo) ... Django itself is an asynchronous processing system which makes asynchronous ORM calls(?) for each request, so there should be a way to do it? I haven't found anything in the documentation so far. Cheers

    Read the article

  • How do you send email invites to people who have been invited by users of your website?

    - by Arpit Rai
    We've developed a web application where people can sign-up on our website to make use of our service. We have a functionality that allows users to send invites to their friends by looking up their contacts on Gmail, Yahoo Mail etc. My question is - do we have to use a 3rd party email management software like a MailChimp or SendGrid to send such emails or should we send them directly? If we send the emails directly and if the recipients start marking those emails as spam, isn't there a very high chance that we might get banned by Gmail, Yahoo etc.?

    Read the article

  • Why StrinUtils Apache class is not recognized in android?

    - by Maxood
    Why import org.apache.commons.lang.StringUtils cannot be imported in android by default. Do i have to include an external library? Then where can i find that library on the web? package com.myapps.urlencoding; import android.app.Activity; import org.apache.commons.lang.StringUtils; public class EncodeIdUtil extends Activity { /** Called when the activity is first created. */ private static Long multiplier=Long.parseLong("1zzzz",36); /** * Encodes the id. * @param id the id to encode * @return encoded string */ public static String encode(Long id) { return StringUtils.reverse(Long.toString((id*multiplier), 35)); } /** * Decodes the encoded id. * @param encodedId the encodedId to decode * @return the Id * @throws IllegalArgumentException if encodedId is not a validly encoded id. */ public static Long decode(String encodedId) throws IllegalArgumentException { long product; try { product = Long.parseLong(StringUtils.reverse(encodedId), 35); } catch (Exception e) { throw new IllegalArgumentException(); } if ( 0 != product % multiplier || product < 0) { throw new IllegalArgumentException(); } return product/multiplier; } }

    Read the article

  • NHibernate Linq queries not returning data saved in the same transaction

    - by Andrew
    Hi, I have a situation where I am using NHibernate in a WCF service and using a TransactionScope for the transaction management. NHibernate enlists in the ambient transaction fine, but, any changes I make and save inside the transaction, are not visible to any queries I make while still in that transaction. So if I add an entity and session.save() it, then further on in the code, there is a linq query against that entities table, the entity I just added is not returned. Strangely this seems to work fine if I use explicit NHibernate transactions in my tests. Anyone have any ideas as to why and what I can do about it? Many thanks Andrew

    Read the article

  • Could not determine the size of this expression.

    - by Søren
    Hi, I have resently started to use MATLAB Simulink, and my problem is that i can't implement an AMDF function, because simulink compiler cannot determine the lengths. Simulink errors: |--------------------------------------------------------------------------------------- Could not determine the size of this expression. Function 'Embedded MATLAB Function2' (#38.728.741), line 33, column 32: "1:flength-k+1" Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function2'(#38) Embedded MATLAB Interface Error: Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function2'(#38) . |--------------------------------------------------------------------------------------- MY CODE: |--------------------------------------------------------------------------------------- persistent sLength persistent fLength persistent amdf % Length of the frame flength = length(frame); % Pitch period is between 2.5 ms and 19.5 ms for LPC-10 algorithm % This because this algorithm assumes the frequencyspan is 50 and 400 Hz pH = ceil((1/min(fspan))*fs); if(pH flength) pH = flength; end; pL = ceil((1/max(fspan))*fs); if(pL <= 0 || pL = flength) pL = 0; end; sLength = pH - pL; % Normalize the frame frame = frame/max(max(abs(frame))); % Allocating memory for the calculation of the amdf %amdf = zeros(1,sLength); %%%%%%%% amdf = 0; % Calculating the AMDF with unbiased normalizing for k = (pL+1):pH amdf(k-pL) = sum(abs(frame(1:flength-k+1) - frame(k:flength)))/(flength-k+1); end; % Output of the AMDF if(min(amdf) < lvlThr) voiced = 1; else voiced = 0; end; % Output of the minimum of the amdf minAMDF = min(amdf); |---------------------------------------------------------------------------------------- HELP Kind regards Søren

    Read the article

  • Get first character of each word and its position in a sentence/paragraph

    - by Radhika
    I am trying to create a map by taking the first character of each word and it's position in a sentence/paragraph. I am using regex pattern to achieve this. Regex is a costly operation. Are there are any ways to achieve this? Regex way: public static void getFirstChar(String paragraph) { Pattern pattern = Pattern.compile("(?<=\\b)[a-zA-Z]"); Map newMap = new HashMap(); Matcher fit = pattern.matcher(paragraph); while (fit.find()) { newMap.put((fit.group().toString().charAt(0)), fit.start()); } }

    Read the article

  • Import received e-mails from Outlook to MSSQL database

    - by _simon_
    How can I automatically import some data from received e-mail from Outlook to MSSQL database? So, when I receive an e-mail (from a preset sender), Outlook should be able to run an external application with the subject and body as parameter. This application will then parse the body of the e-mail and send it to database. Is it possible to set this in 'Rules and alerts' in Outlook (I don't think so)? Or is it possible to do it with macros (an example would be nice). Or else...? I am using Microsoft Outlook 2007 (no Exchange Server), let's say, that incoming mail is from @gmail domain, the externam application would probably be a C# console application, database is SQL SERVER 2005.

    Read the article

  • Adding a textblock to a custom wpf control (piepiece control from codeplex)

    - by bomortensen
    Hi Stackoverflow! I'm currently building a Surface application where the main navigation is a circular menu. For each menu item I'm using a custom control that I found on codeproject.com: http://www.codeproject.com/KB/WPF/PieChartDataBinding.aspx (PiePiece control) The number of submenu items (which is also piepiece controls) comes from a database and thus dynamically loaded. What I can't figure out is how I add a textblock to this custom control to display the submenu item text. It needs to follow the PiePiece's RotationAngle property to line up correctly. Anyone got a hot-fix for this? I was thinking about adding another dependencyproperty to the piepiece custom control, but that way I can't set the font-family, size etc (can I?) Any input on this is greatly appreciated! Thanks!

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >