How to post text with picture by tumblr api? - tumblr

Im trying to post the text with picture as follows
$params['type'] = 'text';
$params['markdown'] = true;
$params['state'] = 'published';
$params['title'] = $title;
$params['body'] = '![this is image](http://xxxx.jpg)';
new HTTP_OAuth_Consumer($consumer_key, $consumer_secret_key)->sendRequest('http://api.tumblr.com/v2/blog/xxx/post', $params);
but text displayed as plain text without a convert by markdown.
If I once clicked preview button, text is displayed correctly.

Related

MS Teams for Iphone: incorrect displaying russian characters inside the thumbnail cards

I have a chatbot for MS Teams based on the BotFramework. When I return a ThumbnailCard from my chatbot to user, a russian charachter 'м' displays incorrectly like 'м'. This appears only on MS Teams for IPhone and not every time. Sometimes it displays correctly.
Screenshot:
enter image description here
I noticed, if I wrap text into a span tag, it displays correctly more often. But in general it doesn't help.
Also I asked the Microsoft Office 365 support to help me, but they redirected me to ask my question here.
// controller
public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
// getting a text and a subtitle
var response = CreateAttachments(text, subtitle);
return Request.CreateResponse<ComposeExtensionResponse>(response);
}
private ComposeExtensionResponse CreateAttachments(string text, string subtitle)
{
var card = new ThumbnailCard { Text = text, Subtitle = subtitle };
var response = new ComposeExtensionResponse(new ComposeExtensionResult("list", "result"));
response.ComposeExtension.Attachments = new List<ComposeExtensionAttachment>{card.ToAttachment().ToComposeExtensionAttachment()};
return response;
}
Expecting 'м' character should display correctly, not like 'м'

C# How can I Coppy All Things in RichTextBox?

I have a richTextBox and I add text and image. Text are not the same color and font. I want to convert to all things for doc file. I am using this codes for this.
wordeaktar.Application wordapp = new wordeaktar.Application();
wordapp.Visible = true;
wordeaktar.Document worddoc;
object wordobj = System.Reflection.Missing.Value;
worddoc = wordapp.Documents.Add(ref wordobj);
wordapp.Selection.TypeText(richTextBox1.Text);
wordapp = null;
enter image description here
This is the image of my richTextBox. How can I do that?
#Gserg's Answer is right!
"richTextBox1.SelectAll(); richTextBox1.Copy(); worddoc.Range().Paste();. However if you simply richTextBox1.SaveFile("...", RichTextBoxStreamType.RichText), Word will be perfectly happy with that. – GSerg"

Express.js: Validation of forms with text boxes and buttons

I am working with forms in Express.js and I am using express-validator for validation. The code I have shown below is a "form" with two text boxes, a choose file button and a submit button. When the user submits the form, but there are validation errors I would like to:
Show an error message, saying which of the elements in the form the user needs to fill in. I believe I know how to do this with pop-up windows, but I would like to know if there is a way to "highlight" the text box that the user is required to fill in, or put a "* Required" text next to the text box/button.
Currently, if there are errors, after the submission, the two text boxes in the form are populated with the variables that were previously submitted by the user. I would like to do the same thing for the "Choose file" button. Using the "value" field as I have done in the two text boxes, does not work for the button. Is there way to do this?
//in routes folder
exports.myPage = function(req, res) {
res.render('myPage.jade', {valName: 'Enter', valLastName: 'Enter'});
};
exports.myPage_post_handler = function(req, res) {
nameID = req.body.nameID;
lastNameID = req.body.lastNameID;
my_file = req.body.my_file;
req.session.nameID = nameID;
req.session.lastNameID = lastNameID;
req.session.my_file = my_file;
if (typeof req.session.nameID != 'undefined'){
valName = nameID;
}
if (typeof req.session.lastNameID != 'undefined'){
valLastName = lastNameID;
}
req.assert('nameID', 'Please enter a name').notEmpty();
req.assert('lastNameID', 'Please enter a last name').notEmpty();
req.assert('my_file', 'Please enter a my_file').notEmpty();
var errors = req.validationErrors();
if( !errors){
res.redirect('/other_page');
}
else {
res.render('myPage.jade');
}
};
//in my_page.jade
form(method='post')
| Name:
div
input(type='text', name='nameID', id = 'name', value = valName)
| Session ID:
div
input(type='text', name='laastNameID', id ='lastName', value = valLastName)
| Video:
div
input(type='file', name='my_file', id='fileF')
div
input(type='submit', value='submit', value='Submit')
In Html5 (which also applies to Jade) you can put a "required" parameter whenever you declare text boxes or radio buttons etc..

Setting the page title in TYPO3

I have the below code and which makes the page title more seo friendly. However I am running into the below problems.
config.noPageTitle = 1
page.headerData {
100 = TEXT
100 {
field = description
noTrimWrap = noTrimWrap = |<title>| - Example Site</title>|
}
}
If I have the field = title it displays tha page title field, however on the news single page it doesn't work as it displays the name of the page rather than the title of the aritle.
If I have the field = description the news single defaults to the article title however if I haven't put a description on one of my pages then it displays
<title> - Example Site</title>
Is there away to do if description = '' show title (if it is not a news article)?
Or is there another way I should be approaching this?
There are many samples and snippets for using tt_news title as page title.
Check for an instance this one: http://blog.chandanweb.com/typo3/display-news-title-as-page-title-in-tt_news-detail-view

Zend_Pdf and templated

I have problems creating a template for my pdf documents in Zend_Pdf. I've followed the guide provided at http://framework.zend.com/manual/en/zend.pdf.pages.html but it doesn't seem to work since no footer text or logo are visible at any page except the first.
This is a sample of my code: (Note; the MTP constant is just the recalculate from mm to points)
//Create pdf object
$pdf = new Zend_Pdf();
//Create the first page
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
/*HEADER*/
//insert logo at the top
$logo = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../document_root/images/logotype.png');
$page->drawImage($logo, 22*MTP,274*MTP, 62*MTP, 289*MTP);
/*FOOTER*/
$footerStyle->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
$page->setStyle($footerStyle);
$page->drawText('Footer text', 33*MTP, 20*MTP, 'ISO-8859-1');
//save the page to pdf->pages
$pdf->pages[0] = $page;
//save the page as a template
$template = $pdf->pages[0];
//create the next page from template
$page1 = new Zend_Pdf_Page($template);
//save the next page to pdf->pages
$pdf->pages[] = $page1;
Have I completely misunderstood how this "template function" work in Zend_Pdf? I know that Zend_Pdf lacks quite a number of features compaired to some of the external pdf-generators (like FPDF) but still, there must be some way to make a basic header/footer for all pages right?
Try to use clone instead passing page as argument to a new page.
$page1 = clone $template;
or simply
$pdf->pages[] = clone $pdf->pages[0];