How to programmatically upload files to Maniphest ticket using Conduit? - phabricator

i can't find the documentation anywhere for how to actually use the Conduit API. I'm able to create a task using some really weird methods, but once i create the ticket, i can't find any documentation about how to actually upload a file anywhere.
i tried looking at:
https://secure.phabricator.com/conduit/method/maniphest.createtask/
and i get so confused on how this actually works. what actually is this?

I think you need to upload the File separately through the file.upload conduit method, then use an {Fnnn} reference in the Task or Comment text to link to it. I presume when file.upload says it returns a GUID, it means a PHID, so you'll also need to use file.info to get the id to use in place of the nnn in the reference text.

Related

Wanted API codes to download files of particular extension from Windchill

Can any one help me with the code to download all files of particular extension (say *.prt or *.asm) from windchill to local. Please suggest suitable API
It's not really the way Windchill works... Windchill is a PDM software, so you should first search for the correct metadata (certainly EPMDocument in your case), and then get the attach files. You'll have to specify the type of attachment you want to have (primary, secondary content, etc.)
=> you need to understand the datamodel and specify what you really want to do.
You can do a query using queryspec and sort. The download part Im not sure about, but it is possible.

Is it possible to read Evernote content without having to authenticate?

What is the easiest, lowest-friction method to read a note programmatically in Evernote? Given that you can share notes by simply generating a unique URL to them, I find it curious that you can't do this programatically as well.
Put another way, I can read notes from my browser without having to authenticate to Evernote. Can I do this programmatically as well? If I have a URL with GUID, can I use this to request the note via code and read it that way?
I attempted to do this -- to use the "Share" URL to read the note. It didn't work, for some reason. When requested programmtically, I was getting 404s for some reason, which makes me think Evernote has some safeguards against using it in this method.
Is there a way to do this -- to read note content via some service without having to authenticate?
Well actually you can. You just need to use the getNote method with an empty string as the first argument (auth token).

t() function does't add the string to the translation interface

i use customfiel php code inside one of my views to translate a string since 2.x of views is bad at localization. i use the following php code:
echo t('Watch Video');
but the string does not appear in the "translate interface" section.
thanks for your help.
lukas
The accepted answer is wrong, as the localization script is not scanning anything. The string is registered in the translate interface as soon as it gets passed through the t() function for the first time in the non-standard language.
Therefore, for translation it doesn't matter if the code you are writing is eval'd (interpreted from the database) or exists in the source. Obviously good practice would be to keep code in files where it belongs.
This blog post describes what needs to be done to get your strings into the translate interface.
The localisation database is built by scanning the source code, looking for instances of the t() function (and Drupal.t() in Javascript).
If the code in question has been entered into a text box in the Drupal admin area, then it isn't in the source code, so it won't be picked up by the localisation process.
For this reason (and others), you should put as little code as possible into the admin text boxes. There is usually an alternative way to achieve the same thing, but even if there isn't, you should reduce the code to a minimum -- best practice would be to have nothing there except a single line function call: have it call a function, and write the function code in your module or theme. That way it will be parsed when you run the localisation.

Drupal - change name of uploaded images to random alphanumeric long string

I've noticed that it is a common functionality within public sites to change the name of uploaded pictures to a long, 'random', alphanumeric string. This is good for privacy etc.
I can't find a module within Drupal that achieves this, and was wondering if it was possible. This would need to operate before modules like ImageCache.
???
I think there're no modules that does exactly what you're looking for, but i can suggest a way to achieve this using code. There's a module called filefield_paths which makes you able to change the name of imagefield files with a token, provided by the token module.
Looking into the code of this module you can see how it works and make your own small module to achieve the same result with an alphanumeric string.
In detail, the function you're looking for is here, at line 457.
I can't provide a directly working solution as I need time to write and test the code, however this is a very good starting point.

Looking for a simple explanation on using trace logging

I have seen several projects that use the Trace functionality to capture events and stream them out to a log file. I have been unsuccessful in finding a simple to follow guide that will show me how to configure Trace to capture and write said logfile. Does anyone have a link recommendations, or provide some simple steps to follow?
The Trace object writes the statements to any attached TraceListeners. You can build your own, but there are a number already defined in the System.Diagnostics namespace, including:
ConsoleTraceListener (Console)
DefaultTraceListener (Visual Studio / Debugger)
DelimitedListTraceListener (TextWriter, special formatting)
EventLogTraceListener (EventLog - anything that inherits from System.Diagnostics.EventLog)
TextWriterTraceListener (TextWriter - think file)
You can, of course, inherit your own from the TraceListener class that writes to where ever you want. For example, you could log to a database, have it send e-mails or pages in certain situations, or write the statements back to a logging platform like log4net.
The big thing is that you need to create an instance of whatever listeners you want and then add them to the Trace' class Listeners collection. You can add as many as you need and Trace will write to all of them. This way, you can write your logging code once using a well-supported and understood object that's part of the framework, and you can attach anything you need to it.
I stumbled into a MSDN article that really helps. Sorry I didn't find it before posting the question but perhaps others may have the same question and haven't found this link.
Take a look at logging frameworks. We rolled out own, but are now migrating over to log4net available free at http://logging.apache.org/log4net/
Im looking for a way to set the Category of the EventLog, the FormattedEventLogTraceListener writes into (not the category of the message).
But I can't find an appropriate property of this class.
Is it possible to set this?

Resources