This code will let you add drag and drop logic to Umbraco v7 using the new AngularJS interface. It doesn't require and backend code updates but can't be created as a package because there is no way to update the umbTree directive as needed. There are only two files that need to be changed on the client. Note that updates to umbraco will overwrite these changes. Also note that due to lack of support in the underlying jQuery-sortable plugin for touch events this will not work on tablet devices.
First a set of changes for the umbTree and umbTreeItem directives in umbraco/Js/umbraco.directives.js.
This patch was generated on 7.2.8 so may not work on other versions automatically. You can manually apply all the listed changes on any 7.* version and they should work as expected with no changes needed.
Secondly, to allow for dragging items to collapsed nodes or nodes they don't already have children, the following needs to be added to the end of the line in umbraco/assets/css/umbraco.css.
This is my personal blog and mainly contains technical solutions, open source code, and other projects I have worked on. Much of the technical solutions are very niche so your milage may vary.
Friday, July 31, 2015
Friday, May 29, 2015
For Each to loop over HttpFileCollection Files
Recently I was working with file uploads in .NET and found that theres no clean way to loop over each uploaded file. Here is a extension method for easily looping through the list and it allows filtering by field name and applying Regex to the file name.
Samples:
Source Code
Friday, May 22, 2015
Convert .htaccess deny rules to web.config
Recently I was looking for a easy way to convert a large list of spammer and hacker IP Addresses from Apache .htaccess allow/deny rules into a format I could use on our IIS Server. I found that there is really no good way to do this but after some work and a bit of coding here is a solution.
This solution will allow you to take a large list of access rules and apply them to an IIS website. Additionally this is done in a file so there is no need to manually add records.
This solution will allow you to take a large list of access rules and apply them to an IIS website. Additionally this is done in a file so there is no need to manually add records.
Collect your List of Rules
I used the following as a general blacklist of malicious and spammer client's to block. There are other sources or you may have your own list. Compile all the lists into one file and don't worry about duplicates, the script later on will resolve those.
Convert the Rules to Web.config Equivalents
I have created a simple javascript tool to convert the above lists into web.config rules. To do this go here and enter all your rules into the first text box. Make sure you supply all rules at once so that they can be de-duped. If the list does end up having duplicates then IIS will not start up properly.
Ensure you have the Features Installed
Next log onto your server and make sure that you have the Web Server > Security > IP and Domain Restrictions role installed. You may need to add it as it's not selected by default.
Apply your new Rules
Finally open up the web.config files for each of your main sites and add the generated text to the system.webServer/security/ipSecurity section. Save and reload the website to ensure it's working.
Example Web.config File
Tuesday, May 5, 2015
Manually replace a SSL Certificates in IIS 7
Recently I was trying to update SSL Certificated on our Windows Server on IIS7 and when trying to complete the Certificate Request I was getting a cryptic error.
In short I wasn't able to find much help on this but after much fiddling I found an alternate procedure to import SSL Certificates in PKCS#7 or X.509 formats.
Instead of trying to import the certificate directly in IIS add it to the certificate story manual by doing the following. Then refresh and it will show up in IIS as expected.
CertEnroll::Cx509Enrollment::p_InstallResponse: ASN1 bad tag value met.
In short I wasn't able to find much help on this but after much fiddling I found an alternate procedure to import SSL Certificates in PKCS#7 or X.509 formats.
Instead of trying to import the certificate directly in IIS add it to the certificate story manual by doing the following. Then refresh and it will show up in IIS as expected.
- Save the certificate and make sure it is accessible on the server.
- On the server open up MMC.
Start > Run > MMC- Add Certificates Snap-in
File > Add/Remove Snap-in- Select
Certificates > Add > My User Account > Add - Select
Certificates > Add > Computer Account > Next > Finish - Click
Ok - Check in both
Current UserandLocal Computerfor old certificates to remove - Look under
Personal > Certificates - Remove the old certificate you are trying to replace by selecting it and pressing
delete. - Import the new certificate by either method
- Double Click it in the file browser and choose
Install Certificate - Under
Local Computer > Personal >Right Click and selectAll Task > Import. - Move the new certificate to the proper store
- Expand either
Current User > Personal > CertificatesorCurrent User > Other People > Certificatesto find the new certificate. - Verify the expression date so ensure you have found the new certificate.
- Drag the certificate into the
Local Computer > Personal > Certificatesstore. - Look up the Certificate Thumbprint
- Now that there certificate is in the proper location Double Click on it to view the details.
- Click on
Details > Edit Propertiesand set theCommon Nameto the proper domain name. Okto go back and then scroll down to find theThumbprintand copy this to your clipboard.- Import the Private Key
- Open an elevated Command Prompt
Start > Type command > Right Click > Run As Administrator- Enter the following command replacing sample Thumbprint with the value you looked up above. Make sure to keep the quotations.
certutil –repairstore my “00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f”- Now go back to the Certificate loaded into the Personal store and refresh and you will see a little key icon next to it. Without this it won't be able to sign pages in IIS.
- Now if you go back to IIS you will see your certificate
- If you don't see the new certificate then it either wasn't moved the the proper location or doesn't have the private key required to function.
Monday, March 23, 2015
Prevent Google Chromes on OS X from navigating when scrolling
I have been having this very irritating issue when using the Apple Magic Mouse and Google Chrome. No matter what I tried when I would use the vertical finer scrolling gesture to scroll up and down the page Chrome would go back and forward in the page history when scrolling to the top or bottom of the page. This was vary frustrating and is apparently a but in the Chrome touch implementation as it happened in no other browser. After much headaches, I could just turn off two finger navigation but I use it in other browsers where it works correctly, I finally found a solution.
Tada!
The Solution:
Open up Terminal and Enter the following.defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
<enter>
Subscribe to:
Posts (Atom)
Project Licenses
These works by Jeremy Pyne are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License