I don't have LibraryPaths on my computer too? - revit-api

RegistryKey hklm = Registry.LocalMachine;
RegistryKey libraryPath =hklm.OpenSubKey("SOFTWARE\\Wow6432Node\\Autodesk\\ADSKTextureLibrary\\1\\2022");
_textureFolder = libraryPath.GetValue("LibraryPaths").ToString();
hklm.Close();
I want to reach "LibraryPaths" with this code, but I get a "null" error. Is there a link to the file path?

I see that you raised the same question in the Revit API discussion forum as well: I don't have LibraryPaths on my computer too?
So, here is the same suggestion I made there:
Does the GetLibraryPaths method provide the information you require?

Related

Calling WriteRegMultiStr in NSIS properly

With version 3.02 of NSIS came the addition of the WriteRegMultiStr function. When the function is called in my script the script throws an error:
Usage: WriteRegMultiStr /REGEDIT5 rootkey subkey entry_name hex_string_like_660000000000
root_key=(HKCR[32|64]|HKLM[32|64]|HKCU[32|64]|HKU|HKCC|HKDD|HKPD|SHCTX)
The call itself looks like this:
WriteRegMultiStr /REGEDIT5 HKLM "System\CurrentControlSet\Services\SomeService" "DependsOnService" "service1 service2"
Since there is no documentation on this specific function which was added later on, long after WriteRegStr and WriteRegDWORD were available, I have to wonder - how does one use it?
So far with respect to entering REG_MULTI_SZ values I only found the directive to use a registry-NSIS -plugin. Yet the function exists, so how can it be used?
Addendum:
Encoding the string to hex and passing it with ot without quotation marks yields no desirable result either.
I was actually able to find an answer after digging through the depths of the internet. Since I don't think this has been answered on StackOverflow I will leave a response here, in case anyone wants to use this function.
The structure of the command as described in the opening post is basically correct, but the value must be encoded precisely. My command looks like this:
WriteRegMultiStr /REGEDIT5 HKLM "System\CurrentControlSet\Services\SomeService" "DependsOnService" 54,00,63,00,70,00,69,00,70,00,00,00,41,00,66,00,64
For anyone intending to test this string, this is
Tcpip
Afd
encoded in hexadecimal regedit format. Precisely this is Regedit Version 5.0 format, as opposed to REGEDIT4 format. A conversion editor can be used to achieve this, I used OTConvertIt.
The script should then compile, assuming you run NSIS version 3.02 or higher.
As you found out, the value data must be in the exact same format as .reg files from Windows 2000+.
The reason this instruction works this way is because it is actually the same as WriteRegBin under the hood and very little code was added to support this new functionality.
In the future you might be able to drop the /REGEDIT5 switch and give it plain strings but support for that has not been added yet.
The Registry plug-in does allow you to write these strings in a sane manner.

Configuration file in Azure Functions

I need to read from a JSON configuration file in Azure Function. Is there a way to refer to the file without hard-coding any paths(assuming it's in same directory as the code).
The solution in another answer was something like:
string configuration = string.IsNullOrEmpty(configurationFile) ? "" : File.ReadAllText(Environment.GetEnvironmentVariable("HOME") + #"\site\wwwroot\functionname\filename);
Is there a better way to get this path, or read JSON configuration in general for Azure Function?
Currently, the solution you found is the recommended approach, but with the next release, which is starting to roll out today (5/30/2017), we've introduced a feature to enhance this.
You can learn more about it here:
https://github.com/Azure/azure-webjobs-sdk-script/wiki/Retrieving-information-about-the-currently-running-function
you're able to find out some explanations about this same topic on this another thread, here.
I hope that this information help you.

Powershell CSOM Sharepoint online list permission

I've been writing a script to connect to SharePoint online, create a document library and add some AD accounts to the permission. I've written all the code using snippets I have found through many searches but am having an issue with the permissions part.
I keep getting an error when adding the user and permission type to roledefinitionbinding.
The error is:
Collection has not been initialized at line 0 char 0.
Here is my code
$collRdb = new-object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx)
$collRdb.Add($role)
$collRoleAssign = $web.RoleAssignments;
$ctx.Load($principal)
$collRoleAssign.Add($principal, $collRdb)
$ctx.ExecuteQuery()
The issue is when it runs $collRoleAssign.Add($principal, $collRdb) part and stop with the error above.
I would really appreciate a hand with this before my PC get launched out of the window.
Thanks
Mark
EDIT
All of the code is taken from this page:
http://jeffreypaarhuis.com/2012/06/07/scripting-sharepoint-online-with-powershell-using-client-object-model/
The only change is i'm using the get principal fun instead of the get group, but not sure if that's what has done it. I'm very new to powershell.
Thanks
I don't think you can add something into $collRoleAssign if it's not loaded before.
You get an error because it has null value.
I would have wrote it like this:
$collRoleAssign = $web.RoleAssignments
$ctx.Load($collRoleAssign)
Comment: I suppose you already set $principal before
$ctx.Load($principal)
Comment: here I suppose $collRdb is set and loaded
$collRoleAssign.Add($principal, $collRdb)
$ctx.ExecuteQuery()
By the way there is a ";" in your code which should not be there
I didn't try it but that should help!
Sylvain

Core Data - NSURL command and momd

I'm working on a project that uses Core Data and I can't seem to find an adequate explanation of why the following line of code in my program always returns NIL for modelURL.
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:#"CoreDataBooks" withExtension:#"momd"];
This example is straight out of Apple's sample code and it actually works in their program, but I can't get it to work in mine.
Questions:
1) Does something have to be in place before I try to implement. I notice the Apple solution has a "CoreDataBooks.DCBStore" file that I do not have. I've tried a number of things to create this...No luck.
2) momd: I've read a lot about this and it seems it's quite a bit different than "mom." I understand the "d" gives the dataset additional capabilities and in some answers posted here, the author indicated to use "mom" and not "momd" without a great explanation of why. All the same, this doesn't work either.
As always, I appreciate your help!
Glenn
So -[NSBundle URLForResource:…] is returning nil. That's supposed to mean the requested resource doesn't exist.
Fire up the Finder and have a look inside the bundle. Confirm that file really doesn't exist. Is there actually a momd file (or similar) there, but by a different name? Probably want to adjust your code to match.
If no such files exist, you probably need to add your Core Data model to your build target.

Getting echofunc.vim to work

I came across echofunc.vim today (from a link in SO). Since I'm rubbish at remembering the order of function parameters, it looked like a very useful tool for me.
But the documentation is a bit lean on installation! And I've not been able to find any supplementary resources on the internet.
I'm trying to get it running on a RHEL box. I've copied the script into ~/.vim/plugin/echofunc.vim however no prompt when I type in a function name followed by '('. I've tried adding
let g:EchoFuncLangsUsed = ["php","java","cpp"]
to my .vimrc - still no prompting.
I'm guessing it needs to read from a dictionary somewhere - although there is a file in /usr/share/vim/vim70/ftplugin/php.vim, this is the RH default and does not include an explicit function list.
I'm not too bothered about getting hints on the functions/methods I've defined - just trying to get hints for the built-in functions. I can see there is a dictionary file available here which appears to provide the resources required for echofunc.vim, I can't see how I set this up.
TIA,
It expects a tags file, the last line of the description describes exactly how to generate it:
ctags -R --fields=+lS .
It works here with PHP but not with JS. Your mileage may vary.
I didn't know about this plugin, thanks for the info.
You should try phpcomplete.vim, it shows a prototype of the current function in a scratchpad. It is PHP only, though.

Resources