I have a problem in using the RichTextBox for a WPF in Powershell.
I'm loading a file.txt that have is own meta inside and i get this meta to underline / bold .... the classic text formatting.
One of this meta is Link so i want to make the values clickable in my Richtextbox
#{" Amiforce-Distribution (important!) " link "amiforce"}
The Links autodetection in RichTextBox only working double \ and "http" like texts.
Question :
Is there a way please to "AppendText" that is clickable and which is captured by the event handler $RichTextBox_LinkClicked = [System.Windows.Forms.LinkClickedEventHandler]{} ?
I checked all the urls i found on google about this subject but all are for C# and i found nothing usefull for my Powershell :)
La meilleur piste que j'ai trouvé consiste à créer un objet linklabel et d'essayer de l'appendtext dans ma richtextbox mais cela ne marche pas :
$Textlink = New-Object System.Windows.Forms.LinkLabel
$Textlink.text = "AMIGA"
$Richtextbox.AppendText("$Textlink `n")
Mais cela ne marche pas chez moi.
Pour mémoire voici les propriétées de l'objet LinkLabel
https://learn.microsoft.com/fr-fr/dotnet/api/system.windows.forms.linklabel?view=windowsdesktop-6.0
Help Please Help :)
I found a way to do it after more research, i hope it will help peoples
$Textlink = New-Object System.Windows.Forms.LinkLabel
$Textlink.text = "AMIGA"
$Textlink.Name = "AMIGALINK"
$Textlink.Location = $MainTextBoxOutput.GetPositionFromCharIndex($MainTextBoxOutput.TextLength)
$richtextbox.AppendText("$Textlink.text `n")
$richtextbox.Controls.Add($Textlink)
$richtextbox.SelectionStart = $richtextbox.TextLength
Best regards,
AMIGA Rulez
Related
I am trying to search a term in Solr index where the results contain curly brackets like below:
[
{
"courseid":10479,
"title":[{"en" = "Formation aux tests de collaboration par semaine - Stefano"},{"fr" =
"Formation aux tests de collaboration par semaine - Stefano"}],
"shortname":[{"en" = "Formation aux tests de collaboration par semaine - Stefano"},
{"fr" = "Formation aux tests de collaboration par semaine - Stefano"}]
}
]
I have tried searching using query like q=title:Formation or q=title:collabration but this does not provide any result however I can easily search with other attributes like courseid q=courseid:10479
I have tried searching the blogs but I cant find a clear answer
I am not able to understand that how exactly are you indexing the data. title field seems to be an array of json but "="(equals) operator is used instead of ":"(colon) Assuming that you have indexed it as array of json, you can try perform searching like this
title.en: Formation or title.fr: Formation
My goal is to display my elements URL property when i map on my array, i tryed to use 'require' according to other post on this website but for some reason it only works when i write directly the strings into my map.
i have the "images" folder into "src" folder. The file i display on bottom is in src/components thats why i used "../" but also tryed "./" just in case , still didnt work
this is my whole array i'd like to display properly:
const [products, setProducts]= useState([
{key:1 ,name:'Structure Deck Assaut d Albaz VF', price:'12,99', url:'../images/DSAlbaz.png'},
{key:2 ,name:'Grands Créateurs Booster Box VF', price:'84,91', url:'../images/grandscreateurs.png'},
{key:3 ,name:'Coffret Arsenal Mystérieux VF', price:'14,99', url:'../images/arsenalmyst.png'},
{key:4 ,name:'La Bataille du Chaos Booster Box VF', price:'84,99', url:'../images/battaillechaos.png'},
{key:5 ,name:'Fantômes du passé saison 2 VF', price:'24,99', url:'../images/fantome2nd.png'},
{key:6 ,name:'Frères de Légende Booster Box VF', price:'89,99', url:'../images/freresdelegende.png'},
{key:7 ,name:'Coffret Or Maximum VF', price:'24,99', url:'../images/OrMaximum.png'},
{key:8 ,name:'Coffret Or Maximum EN', price:'24,99', url:'../images/OrMaximum.png'},
])
this is my array maping that doesnt work as intended:
if(listToDisplay === 0){
displayList = products.map(e =>{
return<div className='product__card' key={e.key}>
<img className='product__picture' src={require(e.url)} alt='SD assaut d albaz'></img>
<h3>{e.name}</h3>
<p>{e.price}$</p>
<div className='buybutton'>Ajouter au panier</div>
</div>
})}
error code : Uncaught Error: Cannot find module '../images/grandscreateurs.png'
seems related to webpack from what i found
so i found another thread and tryed this, with import :
import Logo from '../images/grandscreateurs.png'
then tranform my object value like this :
{key:1 ,name:'Structure Deck Assaut d Albaz VF', price:'12,99', url:Logo},
error message : Uncaught Error: Cannot find module '/static/media/grandscreateurs.7cf37936cedc1da9b626.png'
i am kinda lost now since i don't know how to interact with webpack very well and don't understand how to fix it when i read the thread. thanx you for your understanding and a possible step by step solution.
If you already used the import, so don't use the require in img tag. Try this
import Logo from '../images/grandscreateurs.png'
...
<img className='product__picture' src={Logo} alt='SD assaut d albaz' />
I am using a Swin Transformer for a hierarchical problem of multi calss multi label classification. I would like to visualize the self attention maps on my input image trying to extract them from the model, unfortunately I am not succeeding in this task. Could you give me a hint on how to do it?
I share you the part of the code in which I am trying to do this task.
attention_maps = []
for module in model.modules():
#print(module)
if hasattr(module,'attention_patches'): #controlla se la variabile ha l' attributo
print(module.attention_patches.shape)
if module.attention_patches.numel() == 224*224:
attention_maps.append(module.attention_patches)
for attention_map in attention_maps:
attention_map = attention_map.reshape(224, 224, 1)
plt.imshow(sample['image'].permute(1, 2, 0), interpolation='nearest')
plt.imshow(attention_map, alpha=0.7, cmap=plt.cm.Greys)
plt.show()
``
In addition if you know about some explainability techniques, like Grad-CAM, which could be used with a hierarchical Swin Transformer, feel free to attach a link, it would be very helpful for me.
I am also researching the same, while I don't have anything specific to SWIN. Here are some resources related to Vision Transformers. I hope it helps:
https://jacobgil.github.io/deeplearning/vision-transformer-explainability
https://github.com/jacobgil/vit-explain
https://github.com/hila-chefer/Transformer-Explainability
https://github.com/hila-chefer/Transformer-Explainability/blob/main/Transformer_explainability.ipynb
Here is my code:
{template .someTemplate}
{#param? icon : string} /** CSS class that loads and styles the icon */
{#param? headlineHtml : any} /** Headline text with optional html for styling */
{#param? textHtml : any} /** Subtext with optional html for styling */
{#param? buttonText : string} /** The call to action text for the button */
{#param? rejectButtonText : string} /** The text for choosing to reject the call to action */
....
When I try to compile I get an error saying:
Exception in thread "main" com.google.template.soy.base.SoySyntaxException: In file ./myfile.soy:7, template com.namespace.someTemplate: Not all code is in Soy V2 syntax (found tag {#param? icon : string} not in Soy V2 syntax).`
The only info I've found online seems to suggest this is correct syntax (per Google's site here, per this cheat sheet I found), though, and Googling for "soy v2" has not given me any results that explain what is correct Soy V2 syntax.
What's the correct way to define these parameters?
It looks like this is the syntax:
{namespace test}
/**
* This is a template.
* #param name The name to say hello to
*/
{template .main}
Hello {$name}
{/template}
I also had trouble finding any documentation. I was getting the same errors saying that the {#param ...} syntax is not valid in V2. Then I found that the examples for soynode (like this one) use the comment syntax. Interestingly, it appears that this new syntax does not include a type definition at all, just a var name.
I am developing one WPF-MVVM application to support multi language(Globalization)as follows:
I have created one Resource manager as:
ResourceManager rm = new System.Resources.ResourceManager("MultiLang.string",
Assembly.GetExecutingAssembly());
I have created two resx files such as string.fr.resx, string.en.resx as follows:
In string.fr.resx, I have created one attribute as:
Name:User_PhoneNo_Label
Value:Num\u00e9ro de t\u00e9l\u00e9phone
Now for example if the user selects French language from the list, I am trying to display value for User_PhoneNo_Label as follows:
Thread.CurrentThread.CurrentUICulture = new CultureInfo(sLangCode);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sLangCode);
User_PhoneNo_Label = rm.GetString("User_PhoneNo_Label");
Here sLangCode is code such as fr or en based on user selection.
Value for User_PhoneNo_Label in French should be displayed as "Numéro de téléphone", but now it will be displayed as "Num\u00e9ro de t\u00e9l\u00e9phone".
Please let me know the solution for this problem.
Simply put the text you want to be displayed as the value of the resource string.