lundi 26 novembre 2018

Center div inside table call but align text left

I have a wrapper/list ul and inside it list items li. The ul element has display: table-row; and the li element has display: table-cell;. The problem I have now is that I want to center the li element inside the list but align the text inside the li element on the left.

The code looks like this

.list {
    display: table-row;
    width: 100%;
}

.list-item {
    display: table-cell;
    text-align: center;
}

.item-link {
    text-align: left;
}
<ul class="list">
  <li class="list-item">
    <a class="item-link">
      Here is some text. Align me left.
    </a>
  </li>
  <li class="list-item">
    <a class="item-link">
      Here is some text. Align me left.
    </a>
  </li>
  <li class="list-item">
    <a class="item-link">
      Here is some text. Align me left.
    </a>
  </li>
  <li class="list-item">
    <a class="item-link">
      Here is some text. Align me left.
    </a>
  </li>
</ul>

Does anyone have an idea how I can solve this problem?




How to remove or hide this when resize the browser?

This is an shopping-cart icon with a "cart" paragraph. When browser is resized, I want to hide or remove the "cart" paragraph and only show the shopping-cart icon. I've tried a lot of different ways but still cannot do it. I've came out three ways: 1. Use the css selector. And use the media query to hide the p element.

@media only screen and (max-width: 600px) {
 body {
    background-color: lightblue;
 }
}

2.Use JS to remove the p element when resize the browser.

3.Also use JS to add a new icon element to take place of the origin ones.

But I don't know how exactly they can work, help me please, Thanks a lot~

Here's what I'm working on :)

 <p style="black:white;font-size:14px;font-family:Roboto; onclick="myFunction()"><i class
  ="fa fa-shopping-cart" style="color:black;"></i> Cart</p>




firebase data retrieval returns complex object

i want to retrieval data from firebase and display on website i tried most of the method but dosen't work for me.

Here is my firebase

"transactions" : {
"8527z732x5e5RZnaWlYnvXLQv1Z2" : {
  "102" : {
    "trans_amount" : "20",
    "trans_date" : "23/11/2018"
  },
  "103" : {
    "trans_amount" : 240,
    "trans_date" : "23/12/2018"
  }
},
"WfEQmVDBXeXFqrmzNslIPhD0UqQ2" : {
  "102" : {
    "trans_amount" : "20",
    "trans_date" : "23/11/2018"
  }
}

}

here is my code for retrieval

ref.on("child_added", function(snapshot) {
PrintData.innerText = ""; // We got a new value, so clear the existing 
HTML
snapshot.forEach(function(childSnapshot)  {
var childData = childSnapshot.val();                                 
//showing single object value
console.log(childData);
PrintData.innerText += "trans_amount: " + childData.trans_amount + " 
trans_date: " + childData.trans_date + "  ";
});
});

here is my output 1




How can I make example.com/example/ show an html file, and stay the same link

I want to make it so a user can go to example.com/example/, and it will show a select html file, while keeping the link as example.com/example/.

Is this possible to do with Apache?

Thanks




custom search web server/stack in Python

I'm implementing a specialized, private web search application in Python that uses homomorphic methods to process encrypted queries. For this, I need a combination client/server where

  • the client sends rich data structures to the server expressing the query (dict, lists, large integers)
  • the server evaluates every document in its stores against the query, largely by performing a cryptographic operation using said data structures
  • the server returns multiple return buffers every so-many records back to the client for further processing

Ideally, the server could grow to support application multi-threading, in the sense of being able to distribute the query to a pool of workers for mapping, and then aggregating the maps together in a reduce operation to provide one answer back to the client; however, performance is not a factor initially. This is a demonstration, so should be as simple as possible to code up. Also, the server should work with plaintext documents, or rather, the framework shouldn't impose how the documents are stored (each document will have metadata associated with it). Also, I don't need authentication or https. User data caching would be nice, but if the server gives me client information, I can probably manage my own cache data structure to handle client data.

The code I have is written in Python, both for the server and the client, but in a pinch, I could adapt. So far, I am leaning toward CherryPy for the server, because it has a tremendous set of documentation and I think I can get something running quickly in it, but then I can't seem to find reference to anyone using Brython or Skulpt with it.

Has anyone implemented a custom web server using some Python framework? Thanks for your help.




Imagenes en Web Api con C# como url

estoy aprendiendo con .net(Web Api) y c#, la pregunta es como creo una carpeta en .net(Web Api) para subir imagenes en esa carpeta, y poderla ver con la url por ejemplo "localhost:3546/api/img/castle.jpg"




How do you rewrite a URL with a query in a subdirectory using .htaccess

I'm building a website (no frameworks) and I have a .htaccess file in my root with working rewrite engine. I've been searching far and wide for a solution for my problem but nothing seems to work.

I'd like my site url to be displayed as: mysite.com/profile/profilename and for it to be rewritten to: mysite.com/profile.php?name=profilename so to give the illusion of there being another subdirectory when there isn't.

I've done a tonne of research and this seems to be the most logical to me but it doesn't seem to work:

DirectoryIndex index.php
RewriteEngine On
RewriteRule ^profile/(.*)$ profile.php?name=$1 [L]

(index.php is the home page to the site). When I try this, it doesn't come up with a 404, it comes up with the profile page, but without styling, it can't access the javascript I have in the root directory folder and the query didn't execute properly.

I have some simpler rewrites already active on the site so the rewrite engine is definitely on, but this more complicated style doesn't seem to work. Is it even possible to do this? And if so, what am I doing wrong?