我想将C的outb函数移植到D.
static __inline void outb (unsigned char value, unsigned short int port)
{
__asm__ __volatile__ ("outb %b0,%w1"
:
:
"a" (value),
"Nd" (port));
}
Run Code Online (Sandbox Code Playgroud)
这是D版.
extern(C)
{
void outb (ubyte value, ushort port)
{
// I couldn't figure out this part
}
}
Run Code Online (Sandbox Code Playgroud)
这些是关于该主题的一些链接.
D内联汇编程序
GCC-内联汇编-HOWTO
http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
但我不懂汇编语言,所以我需要一些帮助.任何帮助,将不胜感激.谢谢.
我将此变量添加到.env文件中
STRIPE_SECRET = A12345
我想使用routes/web.php转储变量
<?php
dd(env('STRIPE_SECRET'));
Run Code Online (Sandbox Code Playgroud)
但看起来它总是返回null.
更新:更新.env文件.我只删除了DB_PASSWORD.
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:08txDXXatyYsP5WQ4ECz35Q7OyBEe8Vgb/zK5fZsHik=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
APP_LOCALE=tr
APP_LC_ALL=tr_TR.utf8
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=gunluk
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=03ac580c85842d
MAIL_PASSWORD=1d6d902d296942
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
STRIPE=a123
STRIPE_SECRET=a12345
Run Code Online (Sandbox Code Playgroud) 我有一个像这样的简单html文件.事实上,我从维基页面中删除了它,删除了一些html属性并转换为这个简单的html页面.
<html>
<body>
<h1>draw electronics schematics</h1>
<h2>first header</h2>
<p>
<!-- ..some text images -->
</p>
<h3>some header</h3>
<p>
<!-- ..some image -->
</p>
<p>
<!-- ..some text -->
</p>
<h2>second header</h2>
<p>
<!-- ..again some text and images -->
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我用这样的python和漂亮的汤读了这个html文件.
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("test.html"))
pages = []
Run Code Online (Sandbox Code Playgroud)
我想做的是将这个html页面分成两部分.第一部分将在第一个标题和第二个标题之间.第二部分将位于第二个标题<h2>和</ body>标记之间.然后我想将它们存储在列表中,例如.页面.所以我可以根据<h2>标签从html页面创建多个页面.
关于我该怎么做的任何想法?谢谢..
考虑这段代码,它计算数组的最大元素.
#include <stdio.h>
int maximum(int arr[], int n)
{
if (n == 1) {
return arr[0];
} else {
int max = maximum(arr, n-1);
printf("Largest element : %d\n", max);
return 5; // return arr[n-1] > max ? arr[n-1] : max;
}
}
int main()
{
int array[5] = {5, 23, 28, 7, 1};
printf("Maximum element of the array is: %d", maximum(array, 5));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么这个else块叫四(4)次?
import std.stdio;
struct Vector2
{
float x, y;
this (float x, float y)
{
this.x = x;
this.y = y;
}
// vector2 * number
Vector2 opBinary(string op)(const float rhs)
if (op == "*")
{
auto result = this;
this *= rhs;
return this;
}
// number * vector2
Vector2 opBinaryRight(string op)(const float lhs)
if (op == "*")
{
return this.opBinary!(op)(lhs);
}
/*
assignment operators
*/
// vector2 = vector2
ref Vector2 opAssign(const ref Vector2 rhs)
{
x = rhs.x; …Run Code Online (Sandbox Code Playgroud) 我尝试在 ajax 发布后重定向到一个新页面,但我还没有成功。
我的模板如下所示:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var selectedForm = 0;
function doWork() {
var response = $('#reply1').val();
console.log(response);
$.post({url: "receiver", data: JSON.stringify({selectedForm: selectedForm, response : response}),
contentType: "application/json", success: function(){}});
}
$('.respondButton').click(function(e) {
e.preventDefault();
var selectedButton = $(this).attr('id');
selectedForm = selectedButton.replace('response', '');
console.log(selectedForm);
});
$('#submitButton1').click(function(e) {
e.preventDefault();
doWork();
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
html部分:
<a id="response1" href="" class="respondButton">
<span>response1</span>
</a>
<a id="response2" href="" class="respondButton">
<span>response2</span>
</a>
<form action="/receiver" method="post" id="form1" name="form1">
<textarea type="text" rows ="3" name="reply1" id="reply1"></textarea>
<button …Run Code Online (Sandbox Code Playgroud) 我想将一个字符串转换为小写但如果这个字符串包含一个特殊的单词,它应该保留原样.
specialwords = ['Special1', 'Special']
Run Code Online (Sandbox Code Playgroud)
假设我们的输入字符串是这样的:
Ali is really Special.
Run Code Online (Sandbox Code Playgroud)
输出应该是这样的:
ali is really Special
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止使用的代码.
def makeUrl(inputString):
list = {"?": "i",
"I": "?",
"?": "?",
"î": "i",
"Ç": "c",
"ç": "c",
" ": "-",
"?": "s",
"?": "s",
"?": "g",
"?": "g",
"Ü": "u",
"ü": "u",
"Ö": "o",
"ö": "o",
"!": "",
"?": "",
"'": "",
"“": "",
"”": "",
"â": "a"}
inputString = inputString.encode('utf8', 'replace')
for letter in list:
inputString = inputString.replace(letter, liste[letter])
if "Ali" in inputString:
return …Run Code Online (Sandbox Code Playgroud)