How to set folder write-access permissions
Heres my code
Dim FolderPath As String = "C:/folder" Dim UserAccount As String = "(DESKTOP-T34R8TH\Users)" Dim FolderInfo As IO.DirectoryInfo = New IO.DirectoryInfo(FolderPath) Dim FolderAcl As New DirectorySecurity FolderAcl.AddAccessRule(New FileSystemAccessRule(UserAccount, FileSystemRights.Modify, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow)) FolderInfo.SetAccessControl(FolderAcl)
nothing happens. i want the folder to have a write permission.
You can't add a new DirectorySecurity object to the folder. You have to retrieve the existing one and modify it.
So instead of using
Dim FolderAcl As New DirectorySecurity
You should use
Dim FolderAcl As DirectorySecurity = FolderInfo.GetAccessControl()
See the MS documentation here for a comprehensive example.
See also questions close to this topic
VB.NET Print verification
So I am designing a print manager solution and would like to first start off with detecting when a user 'presses print' and then the job is only sent if the username and password is right.
Could anyone give me some basic ideas as to weather this is actually possible in .net and how I would go about doing it
BC30516 Overload resolution failed because no accessible accepts this number of arguments
i want to do a software that send email Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim mailClient As New System.Net.Mail.SmtpClient()
'This object stores the authentication values Dim basicAuthenticationInfo As _ New System.Net.NetworkCredential("firstname.lastname@example.org", "vivagino") Dim Email As New System.Net.Mail.MailMessage("email@example.com", "firstname.lastname@example.org") Email.Subject = "asd" Email.Body = RichTextBox1.Text + TextBox2.Text 'This object stores the authentication values mailClient.Host = "smtp.gmail.com" mailClient.Port = 465 mailClient.UseDefaultCredentials = False mailClient.Credentials = basicAuthenticationInfo mailClient.Send() End Sub
The error is on mailClient.Send() and it's "Overload resolution failed because no accessible accepts this number of arguments." Thanks to all
SQLClient Command Parameter Query String Length
I am connecting to a SQL Server and am trying to limit the results by adding parameters. The first parameter I added, @sdate, worked just fine. But, now I am trying to add a second parameter which is not working. I want the field, LP_EOC_DATA.PL, to only be returned if the length of the string is greater than 6 characters long. The code below executed, and like I say, the dates returned were correct, but it also returned values from LP_EOC_DATA.PL that had string lengths less than 6. Please let me know if you know how to get this to work. Thanks in advance.
Sub doSQL() Dim myConn As SqlConnection Dim myCmd As SqlCommand Dim myReader As SqlDataReader Dim sqlString As String = "SELECT LP_EOC_DATA.PL as PLs, LP_EOC_DATA.cDate as ReadDate, LP_EOC_LOV.LOCATION as Location " & "FROM LP_EOC_DATA INNER JOIN LP_EOC_LOV ON LP_EOC_DATA.PIC = LP_EOC_LOV.PIC " & "WHERE LP_EOC_DATA.cDate > (@sdate) AND LEN(LP_EOC_DATA.PL) > @slen1 " & "UNION SELECT dbo.VT_DATA.PL as PLs, dbo.VT_DATA.cDate as ReadDate, dbo.VT_LOV.LOCATION as Location " & "FROM dbo.VT_DATA INNER JOIN dbo.VT_LOV ON dbo.VT_DATA.PIC = dbo.VT_LOV.PIC " & "WHERE dbo.VT_DATA.cDate > (@sdate) AND LEN(dbo.VT_DATA.PL) > @slen1 " & "ORDER BY ReadDate;" myConn = New SqlConnection("SERVER=ServerName;UID=uName;" & "PWD=Password;") myCmd = myConn.CreateCommand myCmd.CommandText = sqlString myCmd.Parameters.AddWithValue("@sdate", DateTimePicker1.Value) myCmd.Parameters.AddWithValue("@slen1", 6) 'myCmd.Parameters.AddWithValue("@rx1", "'%[^0-9a-z]%'") 'myCmd.Parameters.AddWithValue("@rx2", " dbo.VT_DATA.PL NOT LIKE '%[^0-9a-z]%'") myConn.Open() myReader = myCmd.ExecuteReader() Table.Load(myReader) DataGridView1.Visible = True DataGridView1.DataSource = Table lblTotal.Text = Table.Rows.Count End Sub
Also, as you can see, I am looking to add another parameter that only returns alphanumeric results from the same LP_EOC_DATA.PL field. I haven't got quite that far yet, but if you see something I'm doing wrong there too, I'd appreciate the input.
How to post data to Google calendar via API?
I am trying to POST my own data to google calendar but it returns the message insufficient permissions. I am looking for information on the permissions needed to POST data to google calendar.
WebMs Created by MediaRecorder API and Saved to Windows Server 2016 File System Can't Be Seen by Users Who Map the Folder
I am using the MediaRecorder API to allow users to record their own videos with their personal webcam in the WebM format. The WebMs are then submitted as form data and saved on the server's file system via ajax.
When remoted in to the server on the administrator account, I can see the WebMs.
When I map to the folder from my personal workstation as a user with access to the where they are saved, I cannot see the WebMs. I can see other files such as files I create and move over.
When I view the files as the administrator remoted into the server, the WebMs have no file owner, and the security tab has no information-- it just says "You must have Read permissions to view the properties of this object."
At some point, this was a nonissue and it worked as intended (I was able to see the files as a user looking at a share folder), so I think I have messed up the permissions. I have tried recreating the folder where the WebMs are saved to reset the permissions on it. This seemed to work as it reset the permissions, but it did not alleviate the problem.
I feel like I'm missing something extremely obvious, so please point it out if you see what's going on. Thanks.
How to make alias with administrator privileges applescript
My script is working as intended and is creating my alias folder perfectly except everytime it prompts me to type in my computers password because it needs administrator privileges. Applescript wont allow me to add the code to give administrator privileges so I am stumped as to what to do. The code below works but requires my password to complete
make new alias at myLocation to mySource
What I would like to do is this:
make new alias at myLocation to mySource password "myPassword" with administrator privileges
I have used code similar to this several times but for some reason it wont allow me to do so with creating an alias. Anyone know what I need to do to automate this process instead of having to type in my password every single time?
Macro for inserting pictures from folder to excel 2010
Hi guys I am new here and would appreciate any help for the following issue:
I have an excel sheet with more than 100 product codes (e.g. 00501-0165) in column C. Now I have another folder (path: C:\Users\arno01\Desktop\Onboarding\PICTURES) which contains all the pictures in jpeg. format for all these product codes. The pictures have the same name as the product codes.
Now I am looking for a macro which assigns the respective pictures from the folder next to the product codes in Column A in ecxel.
Can anybody help me with this issue?
Thank you very much in advance.
Unable to mount one of your folders. Please check your folders in Homestead.yaml
I'm reinstalling my Homestead/Laravel using Vagrant on my new machine.. but I can't get past this error:
Unable to mount one of your folders. Please check your folders in Homestead.yaml
This is my configuration:
Vagrant Version: 2.0.3
Homestead pulled from here using Git Desktop and placed on my user folder.
Homestead.yaml is unaltered
Windows 10 with all updates
Virtualbox version is 5.2.8 r121009 (Qt5.6.2)
to reproduce the error I use
vagrant provision(if already up)
Everything seems to work normally but the shared folder does not show up. I'm stuck in this for days.
Is there any other information I can provide to help the diagnostic?
Preparing the environment in Tensorflow
I am new to Tensorflow and am working on setting up the environment. I've successfully installed all requisites using
Virtualenvhave activated the container.
According to the Prepare your environment section of the documentation it states that If you installed TensorFlow source code, navigate to any directory except one containing TensorFlow source code.
The container is currently active on my terminal as shown here below.
All my Tensorflow files are within the
Tensorflowfolder listed above and contains the
localfolders and the
According to the documentation, am I to create another folder out of my currently available
Tensorflowfolder and navigate to it or can I navigate to the present folder by simply using
Any suggestions will be highly appreciated.
wordpress docker installation using Dockerfile
I had a docker-compose.yml file for wordpress setup.But I want to use Dockerfile instead of using docker-compose and running multiple containers. So I want to the equivalent of below lines that I can write in my Dockerfile.
volumes - ./db-data:/var/lib/mysql wordpress:
volumes: - ./wordpress:/var/www/html
Different HMAC for CryptoJS and VB
I have to generate a HMACSHA256 in Visual Basic. Problem is, that I didnt receive the correct HMAC and get different HMACS
InputData = Test\nTest\n\nTest
secret = c39ff802b43a01c08ea759750c41d7d4bac6b1b884b3864d640b577cf1dca21a
HMACa = 330c55857e5ff197a407a9dcd41bbf03a2e8de0b351aba9a405139919b3cae57
HMACb = f701ea7028f20df11a52bee297a336de212655a8bad01d848eeaa87d0f76ee5e
JS(CryptoJS) -> HMACa (Tested directly)
PY -> HMACa (Tested directly)
JS(jsSHA) -> HMACb (Tested under: liavaag.org/English/SHA-Generator/HMAC/)
C#/VB -> HMACb (Tested directly)
Why do i get different HMAC's and what can i do to get HMACa in VB/C#??
Here is my VB Code:
Sub Main() Dim sToHash As String = "Test\nTest\n\nTest" Dim sKey As String = "c39ff802b43a01c08ea759750c41d7d4bac6b1b884b3864d640b577cf1dca21a" Console.WriteLine(getHMAC(sToHash, sKey)) End Sub Function getHMAC(ToHash As String, SecretKey As String) As String Dim aoText() As Byte = System.Text.Encoding.UTF8.GetBytes(ToHash) Dim aoKey() As Byte = System.Text.Encoding.UTF8.GetBytes(SecretKey) Using oHmac As New System.Security.Cryptography.HMACSHA256(aoKey) Dim sHash As Byte() = oHmac.ComputeHash(aoText) Return ByteToString(sHash) End Using End Function Function ByteToString(buff As Byte()) As String Dim getbinary As String = "" For i As Integer = 0 To buff.Length - 1 getbinary += buff(i).ToString("X2") Next Return (getbinary).ToLower End Function