我已经读过这个很棒的问题已经是透明的空心或切出圆圈, 但我想绘制更多的圆圈(让我们说三个).
所以我尝试为圆圈使用额外的元素而不是伪元素(所以我可以添加更多),它适用于一个圆圈,但不是更多.问题是它们不透明,因为最后一个涵盖了一切.这是我的尝试:
body{
background-color:violet;
}
.shape{
height: 150px;
width: 150px;
position:relative;
overflow:hidden;
}
.hole{
position:absolute;
border-radius:100%;
width:30px; height:30px;
color:red;
box-shadow: 0px 0px 0px 2000px black;
}
.hole:nth-child(1) {
left:25px; top:25px;
}
.hole:nth-child(2) {
left:65px; top:25px;
}
.hole:nth-child(3) {
left:55px; top:65px;
}Run Code Online (Sandbox Code Playgroud)
<div class="shape">
<div class="hole">1</div>
<div class="hole">2</div>
<div class="hole">3</div>
</div>Run Code Online (Sandbox Code Playgroud)
我得到一个这样的multipart/mixed(带有JSON对象和文件)作为响应,当我调用Web服务时:
"--Boundary_9_15033478_1405613164044\r\n
Content-Type: application/json
\r\n\r\n{\"docId\":9007492,\"protId\":200,\"protNum\":\"0002084B14\",\"protDate\":\"Wed Jul 16 00:00:00 EEST 2014\",\"categoryId\":1000,\"desc\":\"?? ??????",\"linkNum\":\"?1\\/00005545\",\"flag1\":\"\",\"flag2\":\"\",\"flag3\":\"\",\"flag4\":\"\",\"stsId\":1,\"stsDesc\":\"WS04: Check Layer I - OK\",\"wsDataList\":[],\"fileName\":\"WsTestToolkitMain.jpg\"}\r\n--Boundary_9_15033478_1405613164044\r\n
Content-Type: application/octet-stream
\r\n\r\n????\0JFIF\0\0`\0`\0\0??\0C\0\a\a\a\a\a\a\b\t\v\t\b\b\n\b\a\a\n\r\n\n\v\f\f\f
...
...
...
??\n?$??\0???????\r\n--Boundary_9_15033478_1405613164044--\r\n"
Run Code Online (Sandbox Code Playgroud)
我得到它的方法是获取响应的流(HttpWebRequest),然后用UTF-8解码它.这给了我上面的字符串.问题是我如何获得JSON和(更重要的是)保存文件?
我尝试更改(因为它们用于multipart/form-data而不是multipart/mixed)这和这个但是我无法获取文件,可能是因为它的Content-Type是application/octet-stream .这是什么不起作用,文件出现,因为它在Windows中被损坏/损坏:
// Read the stream into a byte array
byte[] data = ToByteArray(stream);//Source
string content = encoding.GetString(data);
int contentLength = content.Length;//Length
byte[] fileData = new byte[contentLength];//Destination
Buffer.BlockCopy(data, startIndex, fileData, 0, contentLength);
this.FileContents = fileData;
File.WriteAllBytes("G:\\" + parser.Filename, parser.FileContents);
Run Code Online (Sandbox Code Playgroud)
更新: 跟随Anton Tykhyy的回答(谢谢!)但是我收到错误的时候
var multipart = await content.ReadAsMultipartAsync …Run Code Online (Sandbox Code Playgroud) 我有这个简单的功能
function createGrid(limit){
$("#list").trigger("reloadGrid");
$("#list").jqGrid({
url:indexObj.gridUrl,
postData:{
"limit":limit
},
datatype: "json",
colNames:['ID','type','folder','Description'],
colModel:[
{name:'id',index:'id', width:50},
{name:'type',index:'type', width:100},
{name:'folder_id',index:'folder_id', width:100},
{name:'description',index:'description', width:200}
]
});
}
Run Code Online (Sandbox Code Playgroud)
我首先使用limit = 1调用它,然后调用服务器并返回正确的数据.然后我用limit = 2调用它,它只是重新运行前一个ajax调用(limit = 1)并返回相同的数据.
为什么postData实际上没有改变?我在fireBug中看到"限制"确实具有正确的值.
我有一个.jsp页面,其中许多元素都有以特定字符串结尾的id.例如:
<div id="topActions-1083"></div>
<div id="collapse-1083">
<input id="collapse1Input-1083" type="hidden" value="expanded"></input>
</div>
Run Code Online (Sandbox Code Playgroud)
哪个是获取id为'1083'的所有元素并将其更改为'1084'的最快方法?
我有这个简单的代码片段,带有四个带有CSS缩放变换的按钮:
.social-buttons {
height: 90px;
margin: auto;
font-size: 0;
text-align: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.social-button {
display: inline-block;
background-color: #fff;
width: 90px;
height: 90px;
line-height: 90px;
margin: 0 10px;
text-align: center;
position: relative;
overflow: hidden;
opacity: .99;
border-radius: 28%;
box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.05);
-webkit-transition: all 0.35s cubic-bezier(0.31, -0.105, 0.43, 1.59);
transition: all 0.35s cubic-bezier(0.31, -0.105, 0.43, 1.59);
}
.social-button:before {
content: '';
background-color: #000;
width: 120%;
height: …Run Code Online (Sandbox Code Playgroud)我正在研究一个'arrow'-div.它目前看起来像这样:
div包含另外两个div(两行).我希望背景几乎缠绕在线条上.但黄色背景的高度比线条的高度小很多.我已经尝试过'height:auto'了.我希望有人可以帮助我.
#lineAll {
background-color: yellow;
height: auto;
}
#line1 {
height: 2px;
background-color: black;
transform: rotate(35deg);
width: 40px;
}
#line2 {
height: 2px;
background-color: black;
transform: rotate(-35deg);
width: 40px;
margin-top: 20px;
}Run Code Online (Sandbox Code Playgroud)
<div id="lineAll">
<div id="line1"></div>
<div id="line2"></div>
</div>Run Code Online (Sandbox Code Playgroud)
编辑:
宽度也不是我想要的方式.它目前是屏幕的100%宽度.
正如标题所说,如果它有任何帮助,我有这个java代码(多部分由json object和file 组成):
// Construct a MultiPart
MultiPart multiPart = new MultiPart();
multiPart.bodyPart(new BodyPart(inParams, MediaType.APPLICATION_JSON_TYPE));
multiPart.bodyPart(new BodyPart(fileToUpload, MediaType.APPLICATION_OCTET_STREAM_TYPE));
// POST the request
final ClientResponse clientResp = resource.type("multipart/mixed").post(ClientResponse.class, multiPart);
Run Code Online (Sandbox Code Playgroud)
(使用 com.sun.jersey.multipart ),我想在 .NET (C#) 中创建相同的
到目前为止,我设法像这样发布 json 对象:
Uri myUri = new Uri("http://srezWebServices/rest/ws0/test");
var httpWebRequest = (HttpWebRequest)WebRequest.Create(myUri);
httpWebRequest.Proxy = null;
httpWebRequest.Accept = "application/json";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
Console.Write("START!");
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())){
string json = new JavaScriptSerializer().Serialize(new
{
wsId = "0",
accessId = …Run Code Online (Sandbox Code Playgroud) 我在枚举中有一些变量,出于某种原因必须以'@'开头,例如:
public enum PR304MainDb {
@MODE,
@USERID,
@ROLES,
@MAX_DOC_COUNT
}
Run Code Online (Sandbox Code Playgroud)
我使用这些变量的方法是将它们放在HashMap中 ......:
Map<String, Object> in = new HashMap<String, Object>();
in.put(PR304MainDb.@MODE.toString(), 5);
Run Code Online (Sandbox Code Playgroud)
...然后在调用存储过程时使用HashMap作为参数(我无法更改哪些代码).
在通话结束后,我阅读了结果并进行了一些比较,例如:
if (out.getKey().equals(PR304MainDb.@MAX_DOC_COUNT.toString())) {
//DO SOMETHING
}
Run Code Online (Sandbox Code Playgroud)
我知道这些名称无效,但有没有其他方法可以实现这一目标?