How to fix ajax call to get user id returns undefined if same url works directly in browser?

I have an array with a few user email addresses in it, trying to iterate through the array and get Ids. Console log is telling me xuser is undefined.

When I manually enter the url below into the browser with an email from the array I get the desired xml result, with users id.

EmailArray.forEach(GetUserId);  function GetUserId(item) {    console.log(item);   $  .ajax({      url: xhost + "/portal/_api/web/SiteUsers?$  select=Id&$  filter=Email eq '" + item + "'",     type: "GET", headers: { "Accept": "application/json;odata=verbose", },     success: function (data) {       var xuser = data.d.Id;       console.log(xuser);     },     error: function (error) { alert(JSON.stringify(error)); }   }); } 


Mac OSX “sendmail” command works but providing localhost to python SMTP does not

I have a program that needs to send email and have been working on it locally. I’m using

smtplib.SMTP('localhost', 25) 

to try and send email but I get a ‘Connection refused’ error. However, if I do echo "test"| sendmail, the message goes through. As I understand it, sendmail is using SMTP underneath it. How can I use the same server and port settings as what sendmail is using? I’m posting this question because other answers I’ve checked out recommend the following alternatives which I’d rather not use for multiple reasons:

  • Use gmail’s smtp server
  • Use a debugging smtp server such as: python -m smtpd -n -c DebuggingServer localhost:1025
  • Use “sendmail” via os or subprocess

the css ‘width’ attribute doesnot work with ‘percentage’ but works with pixels

i want to resize my dropdown-menu width with percentage but it does not work it can be resized only with pixels

 <!--navigation-->  <nav class="navbar navbar-expand-md navbar-light bg-warning">      <a class="navbar-brand" href="#" style="color: #0c5460;font-size:             13px;">       <img src="img/newlogo.png" height="20" width="50"/>      <i style="color: darkblue; font-family: 'B Titr';">کرمانشاه گشت 

تورهای مسافرتی

             <div  class="dropdown-menu" id="mega-menu">                  <a href="#" class="dropdown-item ">تور های داخلی</a>                  <a href="#" class="dropdown-item ">تور های خارجی</a>                  <a href="#" class="dropdown-item ">تور های لحظه آخری</a>              </div>           </li>       </ul>   </div> 



font-size: 13px; margin-top: 12px; width: 80%; 


Win 10 +Ubuntu dual Boot – Live USB cannot see my SSD volumes but Win10 works fine

I am look for some advice/ help on this perplexing issue that has been hounding me for days now.

I am not sure if this is Ubuntu Issue or Lenovo issue.

I have X1 Carbon 6th Gen. It came with 512 SSD with windows 10. I split SSD into 2 parts, and installed ubuntu 18.04 into the second one. Grub is my boot manager

Everything was working fine. One day, Ubuntu crashes. On subsequent boot, it takes me to initramfs prompt, saying that I need to run fsck manually on /dev/nvme0n5. Once I run that, it says that it cannot re-mount nvme0n5 – no such file or directory exists. It happens every single time.

I googled a bit. I was told I need to run fsck on nvme0n5 outside of system using Live USB. I created Ubuntu Live USB using Rufus with Gpt and UEFI. When I boot in, I was not able to see nvme0n5 using $ fdisk -l. Moreover, I can’t see any partition except USB on Gparted

Since then I have tried:

Live USB with/ without Secure Boot option

  • Disabling Bitlocker Some people suggested changing SSD config to AHCI
  • from Raid. I cannot see any such option in my BIOS utility. In fact,
  • I hardly see any information on SSD in boot Disable UEFI only boot to
  • Legacy, Both options in BIOS
  • Run ubuntu in recovery option – it always gets stuck on purple screen with inital ramdisk … even with nomodeset options.

In all of this, Win 10 works perfectly fine. I thought about re-installing Ubuntu. However, all online guides suggest I do it via Live USB, and I can’t find my SSD volume when I try to install via Live USB option.

Any advice/ help would be a lifesaver!

Internet only works for a minute or two then won’t work anymore

After a minute or so, the wifi stops working as in, it is still connected to the wifi but there is no data being transferred. This started happening when I upgraded the kernel to 4.17 (from 4.15) and it won’t even register my usb adapter when i run 4.17 but will only work for a minute or so. If I log into windows on the same system with the same wifi adapter everything works good. I have confirmed that this is not a problem with my general wifi because it works when I boot into windows on the same machine, and it also works on my laptop which is also running Ubuntu. Before this happened, it has been working with no hiccups for 5 months since I switched over on this pc.

I followed these commands to install my driver back when:

sudo git clone sudo cp -r rtl8812au  /usr/src/rtl8812au-4.2.2 sudo dkms add -m rtl8812au -v 4.2.2 sudo dkms build -m rtl8812au -v 4.2.2 sudo dkms install -m rtl8812au -v 4.2.2 


Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 002: ID 0bda:a811 Realtek Semiconductor Corp.  Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 145f:01c1 Trust  Bus 001 Device 002: ID 0c45:5104 Microdia  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 


enp33s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500         ether 30:9c:23:03:94:d2  txqueuelen 1000  (Ethernet)         RX packets 0  bytes 0 (0.0 B)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 0  bytes 0 (0.0 B)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  enx000f004aa319: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500         inet6 2600:1700:16e0:6d90:1522:cd74:5f8a:6dc3  prefixlen 64  scopeid 0x0<global>         inet6 2600:1700:16e0:6d90:be9b:318:b16d:dfcf  prefixlen 64  scopeid 0x0<global>         inet6 fe80::ae05:cd57:188b:30dd  prefixlen 64  scopeid 0x20<link>         ether 00:0f:00:4a:a3:19  txqueuelen 1000  (Ethernet)         RX packets 10399  bytes 13031066 (13.0 MB)         RX errors 0  dropped 1816  overruns 0  frame 0         TX packets 5708  bytes 760985 (760.9 KB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536         inet  netmask         inet6 ::1  prefixlen 128  scopeid 0x10<host>         loop  txqueuelen 1000  (Local Loopback)         RX packets 1011  bytes 93331 (93.3 KB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 1011  bytes 93331 (93.3 KB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

sudo lshw -C network

  *-network                         description: Ethernet interface        product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller        vendor: Realtek Semiconductor Co., Ltd.                                   physical id: 0                                                            bus info: pci@0000:21:00.0                                                logical name: enp33s0                                                     version: 15                                                               serial: 30:9c:23:03:94:d2                                                 size: 10Mbit/s                                                            capacity: 1Gbit/s                                                         width: 64 bits                                                            clock: 33MHz                                                              capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation        configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=no multicast=yes port=MII speed=10Mbit/s                                     resources: irq:35 ioport:f000(size=256) memory:fe604000-fe604fff memory:fe600000-fe603fff   *-network                                                                      description: Wireless interface                                           physical id: 1                                                            bus info: usb@3:1                                                         logical name: enx000f004aa319                                             serial: 00:0f:00:4a:a3:19                                                 capabilities: ethernet physical wireless                                                                                                               configuration: broadcast=yes driver=rtl8812au multicast=yes wireless=IEEE 802.11bgn          

Keyboard shortcut (almost) never works for Automator service

I have bash script that creates a screenshot in a given directory saved as an Automator service. I’ve then assigned ⇪⌘2 from System Preferences > Keyboard > Shortcuts > Services. The problem is that it doesn’t work much at all. The only place I’ve found were it actually runs when using the macro is (how random) when click on the urlbar of Safari, and even then not without inconveniences, as it popups an error message saying “The “Take Screenshot” service could not be used because the “Take Reference Screenshot” workflow did not provide valid data. – Try running the “Take Reference Screenshot” workflow in Automator.“, even though the process works fine and the screenshot is indeed captured and saved as intended. What’s wrong?

fdate=`date` screencapture "/Users/username/Unorganized/Studio/$  fdate.png" 

enter image description here

How does casting really works for primitive datatypes?

I have written the following C – code which purpose it is to flip an unsigned number in binary representation and give back an unsigned number:

long flippingBits(long n) { return (unsigned)(~n); } int main(){    long a = flippingBits(someNumber);    ... } 

This Code does work fine. What about this code?

unsigned long flippingBits(long n) {    return (~n); } int main(){    unsigned long a = flippingBits(someNumber);    ... } 

This code indeed prints out negative numbers. WTF. This is beyond my intuition. So is there an (architectural) way, to explain this phenomenon? How does the casting of primitive datatypes works? Please note if this phenomenon is about software and is therefore off-topic; in this case: just comment.

code works fine any good suggestions to optimize and better code

The following code works fine. on clck ajax calls a method and return the query result. which i am displaying in view. the problem is i read many articles everyone is doing HTML code in controller when getting data with ajax and show in view as same i did. any good suggestions to avoid HTML code in controller make controller view and script separate


public function ajax(Request $  request){   // $  data = $  request->all();  $  data['products'] = Product::select('', '', 'products.banner')->get();  foreach ($  data['products'] as $  product){     echo $  product->name; }    // dd($  data); // if($  request->ajax()){ //     return "AJAX"; // } // return "HTTP";  // $  data['products'] = Product::select('', '', 'products.banner')->get(); // return $  data; 



 <script type="text/javascript">      // $  .ajaxSetup({ headers: { 'csrftoken' : '{{ csrf_token() }}' } });         $  (document).ready(function(){          // Load more data         $  ('.load-more').click(function(){             var row = Number($  ('#row').val());             var allcount = Number($  ('#all').val());             var rowperpage = 3;             // row = row + rowperpage;             row = row + 3;              if(row <= allcount){                 $  ("#row").val(row);                  $  .ajax({                 url: "{{ route('ajax') }}",                 type: 'post',                 datatype: 'JSON',                 headers: {                     'X-CSRF-Token': $  ('meta[name="csrf-token"]').attr('content')                 },                 data: {row:row},                 // error: function(XMLHttpRequest, textStatus, errorThrown) {                 //     alert('hi');                 // }                  success: function(response){                  // Setting little delay while displaying new content                 setTimeout(function() {                     // appending posts after last post with class="post"                     $  (".post:last").after(response).show().fadeIn("slow");                      var rowno = row + 3;                      // checking row value is greater than allcount or not                     if(rowno > allcount){                          // Change the text and background                         $  ('.load-more').text("show less");                         $  ('.load-more').css("background","darkorchid");                     }else{                         $  (".load-more").text("Load more");                     }                 }, 2000);                   }   });              }else{         $  ('.load-more').text("Loading...");          // Setting little delay while removing contents         setTimeout(function() {              // When row is greater than allcount then remove all class='post' element after 3 element             $  ('.post:nth-child(3)').nextAll('.post').remove().fadeIn("slow");              // Reset the value of row             $  ("#row").val(0);              // Change the text and background             $  ('.load-more').text("Load more");             $  ('.load-more').css("background","#15a9ce");          }, 2000);       }          });          }); </script> 


    @foreach($  leedManufacturers as $  leedsManufacturer)                     {{-- @foreach($  leedManufacturers as $  leedsManufacturer)  --}}                         <div class="post" id="post{{$  leedsManufacturer['id']}}">                             <label class=" my-checkbox gry2" id="manufacturer">{{str_limit($  leedsManufacturer['name'], 300)}}                                     <input type="checkbox">                                     <span class="checkmark"></span>                             </label>                         </div>                         {{-- for load more script --}}                     {{-- <input type="hidden" id="row" value="0"> --}}                      {{-- <input type="hidden" id="all" value="{{$  total_manufacturers}}"> --}}                     @endforeach 

dconf-dump works in terminal but not in Anacron

I am running the following script daily via Anacron.

#!/bin/bash  if ! mount | grep /media/steve/6363-6333 >/dev/null then     dpkg --get-selections > /home/steve/package_list     dconf dump / > dconf-settings.ini else     rsync /home/steve/ownCloud/Documents/De7.ods /media/steve/6363-6333/investDe7.ods     dpkg --get-selections > /media/steve/6363-6333/package_list     dconf dump / > /media/steve/6363-6333/dconf-settings.ini fi 

It works for the rsync and dpkg commands but not for the dconf dump. However if I run the scriopt from the commandline it works perfectly. One othe thing I noticed is that when I checked the dconf-settings.ini file its size was zero until I ran the script by hand

PCI-based VGA card works for installer but not installed OS

I have what’s almost definitely a niche problem. I purchased this PCI-based VGA Controller for a server I built. There are no drivers available and it came with no install media, but I figured I’d give it a try anyways. Without any additional work beyond plugging it in, the card gives output during post and the installer for ubuntu, however once the OS is loaded, my monitor gives the error “D-SUB OUT OF RANGE” and I no longer recieve output. I am still able to connect to the server through SSH, which I configure through the installer, but no direct access is possible, or at least doing so is completely blind.

The motherboard for this server has no onboard video and only a single PCI-E x16 slot, which is in use by a RAID controller, so as far as I can tell, this is pretty much my only option.

Any help appreciated, googling the error from my monitor yields very little.

Output of sudo lshw for the pci card in question:

*-pci:5 description: PCI bridge product: 82801 PCI Bridge vendor: Intel Corporation physical id: 1e bus info: pci@0000:00:1e.0 version: 90 width: 32 bits clock: 33MHz capabilities: pci subtractive_decode bus_master cap_list resources: ioport:b000(size=4096) memory:f9000000-faafffff *-display UNCLAIMED description: VGA compatible controller product: Rage XL PCI vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 7 bus info: pci@0000:01:07.0 version: 27 width: 32 bits clock: 33MHz capabilities: pm vga_controller bus_master cap_list configuration: latency=64 mingnt=8 resources: memory:f9000000-f9ffffff ioport:b000(size=256) memory:faadf000-faadffff memory:faae0000-faafffff