Touchpad not working while pressing 'typing' keys after 16.10 upgrade

Question: I recently upgraded to 16.10 from 16.04 and now the touchpad stops responding while a keyboard key is pressed. These keys exclude the functional keys such as alt, super, ctrl, shift, Fn keys, etc.
On running xinput list, I get
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ DLLC6B2:00 06CB:75BF Touchpad             id=11   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Integrated_Webcam_HD                      id=10   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                          id=14   [slave  keyboard (3)]
    ↳ DELL Wireless hotkeys                     id=15   [slave  keyboard (3)]

I have tried disabling SynPS/2 Synaptics TouchPad in a desperate attempt but to no avail.
Output of gsettings list-recursively | grep touch:
org.gnome.settings-daemon.plugins.media-keys.custom-keybindings.touchpad-indicator binding ''
org.gnome.settings-daemon.plugins.media-keys.custom-keybindings.touchpad-indicator command '/usr/bin/python3 /opt/extras.ubuntu.com/touchpad-indicator/share/touchpad-indicator/change_touchpad_state.py'
org.gnome.settings-daemon.plugins.media-keys.custom-keybindings.touchpad-indicator name 'Touchpad indicator'
org.gnome.shell.keyboard keyboard-type 'touch'
org.gnome.settings-daemon.peripherals.touchscreen orientation-lock false
org.gnome.desktop.peripherals.touchpad send-events 'enabled'
org.gnome.desktop.peripherals.touchpad natural-scroll true
org.gnome.desktop.peripherals.touchpad tap-to-click true
org.gnome.desktop.peripherals.touchpad left-handed 'mouse'
org.gnome.desktop.peripherals.touchpad click-method 'fingers'
org.gnome.desktop.peripherals.touchpad speed 0.38938053097345127
org.gnome.desktop.peripherals.touchpad scroll-method 'two-finger-scrolling'
org.gnome.desktop.peripherals.touchpad edge-scrolling-enabled true
org.gnome.desktop.peripherals.touchscreen display ['', '', '']
org.gnome.desktop.peripherals.touchpad send-events 'enabled'
org.gnome.desktop.peripherals.touchpad natural-scroll true
org.gnome.desktop.peripherals.touchpad tap-to-click true
org.gnome.desktop.peripherals.touchpad left-handed 'mouse'
org.gnome.desktop.peripherals.touchpad click-method 'fingers'
org.gnome.desktop.peripherals.touchpad speed 0.38938053097345127
org.gnome.desktop.peripherals.touchpad scroll-method 'two-finger-scrolling'
org.gnome.desktop.peripherals.touchpad edge-scrolling-enabled true
com.ubuntu.touch.sound incoming-call-sound '/usr/share/sounds/ubuntu/ringtones/Ubuntu.ogg'
com.ubuntu.touch.sound incoming-message-sound '/usr/share/sounds/ubuntu/notifications/Xylo.ogg'
com.ubuntu.touch.sound silent-mode false
org.gnome.shell.keyboard keyboard-type 'touch'
com.ubuntu.touch.network flight-mode false
com.ubuntu.touch.network gps true
com.ubuntu.touch.system auto-brightness false
com.ubuntu.touch.system brightness 80
com.ubuntu.touch.system orientation-lock 'none'
com.ubuntu.touch.system rotation-lock false
com.ubuntu.touch.system brightness-needs-hardware-default true
com.ubuntu.touch.system activity-timeout uint32 60
com.ubuntu.touch.system fingerprint-names @a{ss} {}
com.ubuntu.touch.system dim-timeout uint32 45
org.gnome.settings-daemon.peripherals.touchscreen orientation-lock false

I googled for hours. There looks to have been a setting for disabling the touchpad while typing in earlier versions but I never had those enabled in the past. This problem started as soon as I upgraded to 16.10. The problem is it's getting in the way of what litle gaming I did on Linux. Please help.
EDIT
xinput list-props 13

Device 'SynPS/2 Synaptics TouchPad':
    Device Enabled (139):   0
    Coordinate Transformation Matrix (141): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Tapping Enabled (277): 1
    libinput Tapping Enabled Default (278): 0
    libinput Tapping Drag Enabled (279):    1
    libinput Tapping Drag Enabled Default (280):    1
    libinput Tapping Drag Lock Enabled (281):   0
    libinput Tapping Drag Lock Enabled Default (282):   0
    libinput Accel Speed (283): 0.389381
    libinput Accel Speed Default (284): 0.000000
    libinput Natural Scrolling Enabled (285):   1
    libinput Natural Scrolling Enabled Default (286):   0
    libinput Send Events Modes Available (261): 1, 1
    libinput Send Events Mode Enabled (262):    0, 0
    libinput Send Events Mode Enabled Default (263):    0, 0
    libinput Left Handed Enabled (287): 0
    libinput Left Handed Enabled Default (288): 0
    libinput Scroll Methods Available (289):    1, 1, 0
    libinput Scroll Method Enabled (290):   1, 0, 0
    libinput Scroll Method Enabled Default (291):   1, 0, 0
    libinput Click Methods Available (292): 1, 1
    libinput Click Method Enabled (293):    0, 1
    libinput Click Method Enabled Default (294):    1, 0
    libinput Middle Emulation Enabled (295):    0
    libinput Middle Emulation Enabled Default (296):    0
    libinput Disable While Typing Enabled (297):    1
    libinput Disable While Typing Enabled Default (298):    1
    Device Node (264):  "/dev/input/event5"
    Device Product ID (265):    2, 7
    libinput Drag Lock Buttons (299):   <no items>
    libinput Horizonal Scroll Enabled (266):    1

xinput list-props 11

Device 'DLLC6B2:00 06CB:75BF Touchpad':
    Device Enabled (139):   1
    Coordinate Transformation Matrix (141): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Tapping Enabled (277): 1
    libinput Tapping Enabled Default (278): 0
    libinput Tapping Drag Enabled (279):    1
    libinput Tapping Drag Enabled Default (280):    1
    libinput Tapping Drag Lock Enabled (281):   0
    libinput Tapping Drag Lock Enabled Default (282):   0
    libinput Accel Speed (283): 0.389381
    libinput Accel Speed Default (284): 0.000000
    libinput Natural Scrolling Enabled (285):   1
    libinput Natural Scrolling Enabled Default (286):   0
    libinput Send Events Modes Available (261): 1, 1
    libinput Send Events Mode Enabled (262):    0, 0
    libinput Send Events Mode Enabled Default (263):    0, 0
    libinput Left Handed Enabled (287): 0
    libinput Left Handed Enabled Default (288): 0
    libinput Scroll Methods Available (289):    1, 1, 0
    libinput Scroll Method Enabled (290):   1, 0, 0
    libinput Scroll Method Enabled Default (291):   1, 0, 0
    libinput Click Methods Available (292): 1, 1
    libinput Click Method Enabled (293):    0, 1
    libinput Click Method Enabled Default (294):    1, 0
    libinput Middle Emulation Enabled (295):    0
    libinput Middle Emulation Enabled Default (296):    0
    libinput Disable While Typing Enabled (297):    1
    libinput Disable While Typing Enabled Default (298):    1
    Device Node (264):  "/dev/input/event14"
    Device Product ID (265):    1739, 30143
    libinput Drag Lock Buttons (299):   <no items>
    libinput Horizonal Scroll Enabled (266):    1

I see the problem is the libinput Disable While Typing Enabled (297) property. So, I just set that with set-prop?
Comment: Please [edit] your question and add output of `xinput list-props 13`  and `xinput list-props 11` terminal commands.
Comment: Added the outputs
Answer: While @Pilot6's answer works well for Xorg, it won't do anything to a system running Wayland.

If anyone else is having this problem on Ubuntu 17.10+, or when running Wayland on any version, here's a way to solve it.
Specifically, running:
gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing false

will instruct Gnome to tell libinput to disable disable-while-typing.
I found this from /u/Eingaica's post on reddit.

If using Ubuntu 16.04 or earlier, or if using Xorg, I would recommend following Pilot6's answer to this question.
Answer: After the upgrade libinput is installed. You can disable this feature this way. Run in a terminal
sudo -H gedit /usr/share/X11/xorg.conf.d/60-libinput.conf

and add to the touchpad section after Driver "libinput"
 Option "DisableWhileTyping" "false"

Save the file and restart the session or reboot.
Another way to solve this is to uninstall xserver-xorg-input-libinput. That will revert everything as it was in 16.04 using xorg-synaptics.
Comment: `Option` is after `Driver`, but I am not sure it really matters. Something else may be wrong. You can always remove the line.
Comment: I restarted and can't login now :/
Comment: Messed up some xorg file. Started on Wayland
Comment: So check if the file is OK.
Comment: `Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Option "DisableWhileTyping" "False"
        Driver "libinput"
EndSection`
Problem still on wayland and normal Gnome doesn't go through login
Comment: DO NOT POST THIS TO COMMENTS.
Comment: That was exactly what was wrong. Replaced it after driver and Gnome now starts. Furthermore, the original problem is resolved. Thanks.
Comment: You can enable tapping there too if you want.
Comment: I don't have any idea what you are referring to. However, I'd like to recover the ability to have different left and right clicks on my touchpad. Another feature lost in the transition.
Comment: I mean "tap to click".
Comment: That's still there
Comment: Maybe in the new version it is finally default. See the edit to the answer.
Comment: For anyone in the future: File seems to be "40-libinput.conf" in latest ubuntu, and doesn't affect Wayland. Works well on Xorg still though.


How can I update a record of two specific column with a particular value

Question: Change the total fee to 5000 whose STNO=1003, 1006, 1007
plz send me the exact query statement for this question......
Thanks,
Churchill...
Answer: <code>update [table] set [total fee]=5000 where STNO in (1003,1006,1007)
</code>
Answer: <code> update mytable set totalfee = 5000
 where stno in ('1003','1006','1007')
</code>


I am trying to convert a SQL Query to Linq to Entities using "Not IN"

Question: I have a SQL query (stored procedure) that I am having a hard time trying to write in Linq using "NOT IN".
This is the SQL query:
ALTER PROCEDURE [dbo].[spGetAvailableRoles2User]
    @Id nvarchar(128)
AS
BEGIN
    SET NOCOUNT ON;

    SELECT name
    FROM Role
    WHERE name NOT IN (SELECT t3.Name
                       FROM [User] t1
                       JOIN [UserRole] t2 ON t1.Id = t2.UserId
                       JOIN [Role] t3 ON t2.RoleId = t3.RoleId
                       WHERE t1.Id = @Id)
END

And here is what I am trying to do in in my MVC action Method
var result = (from x in db.Users
              join y in db.IdentityUserRoles on x.Id equals y.UserId
              join z in db.Roles on y.RoleId equals z.Id
              where x.Id == id
              select z.Name);

Could some explain what I am doing wrong?
Comment: Possible duplicate of [Linq to Sql query using "not in"](http://stackoverflow.com/questions/344478/linq-to-sql-query-using-not-in)
Comment: I looked at that but I have two where clauses and can't figure out how to write it with the two
Comment: @PsyChotic, the count of `Where` conditions is not important!
Answer: Assuming you've got your relationships and such set up right in Entity Framework (and assuming a Role's Name is unique), it should be as simple as:
from role in db.Roles
where !role.Users.Any()
select role.Name

If you don't have the relationships set up so that your Role entities have a Users property like this, then it'll be a bit more complicated. However, if you've got good enough data integrity in place that there are no IdentityUserRole entries without a corresponding User, then there's no need to involve the Users table at all:
from role in db.Roles
where !db.IdentityUserRoles.Any(iur => iur.Name == role.Name)
select role.Name


Should I use zfs or ext4 filesysttem on old laptop with SSD?

Question: While installing Ubuntu 21.10 on a rather old laptop, I've noticed that I can Also choose ZFS as a filesystem which is apparently has become default on Ubuntu server. As far as I could read it is one of the prides of FreeBSD community as a robust and mature filesystem and is a rather newcomer to Linux ecosystem. So I'm curious about it.
I'd like to encrypt my laptop's entire SSD and I'd like have a performant system. So I'm wondering what will be the effects of using ZFS instead of good old ext4, in terms of performance, stability and battery usage?
Comment: Unless you have very good reason to, just choose the file system suggested by the installer.  This will give you a configuration that is very well tested and therefore with the least surprises.  Also if you encrypt your hard drive, you better have very well tested backups as well or you should be prepared to lose data.  Testing is both backup and restore.
Comment: If you've got loads of RAM, loads of cpu resources, and a need for ZFS - it's a good production file-system.  It's resource heavy though; so I'd skip using it unless you benefit from what it provides.
Comment: As a side note, if it's not soldered on, I recommend replacing the SSD. They have a consumable lifetime, and they're not especially expensive.
Answer: ZFS is great on servers with lots of ram, lots of cpu, and lots of disks.
It does very well on large disks and joining multiple disks, and has nice features like software implementation of hybrid spinning rust + SSD cache raid volumes for extra performance.
If you have a single small disk with limited ram, zfs might still work well, but most of its advantages are gone, and ext4 might work as well, but with lower ram use.
For single disks over 4T, I would consider xfs over zfs or ext4.  For more than 3 disks, or a spinning disk with ssd, zfs starts to look very interesting.  Between 2T and 4T on a single disk, any of these would probably have similar performance.
But, as always, your specific use case affects this greatly, and there are corner cases where any of these would work better than the others.   For example, zfs and xfs perform much better than ext4 when you have thousands of files in a single directory, no matter what the disk size.  But this is a corner case, and not common, especially with disks smaller than 2T.
For small disks typically found in laptops, ext4 should be sufficient, and if you want encryption, the defaults you get when you enable it in the ubuntu installer probably work best with ext4 anyway.
Comment: xfs was specifically designed for large files and large numbers of files.  Many of its internal data structures are b-trees instead of the linear lists that ext4 generally uses.  Above 2T, xfs starts becoming advantageous, and above 4T ext4's linear data structures start becoming a serious problem.  (b-trees are like binary trees, except not binary, and designed to be efficient on block based devices.)
Comment: In my experience, XFS has better read performance than ext4 with lots of small files, but write performance is significantly worse. It's popular on web servers, where reads greatly outnumber writes, but on a personal laptop where I sometimes compile things, I still prefer ext4.
Comment: My disk is only 256GB. So what do you reckon about possible difference that it makes?
Comment: I don't see a lot of point in using anything except ext4 for something that small.  The defaults with LUKS and ext4 in the ubuntu installer should work well.
Comment: Why is XFS better than ext4 for large spinning disks?
Comment: I prefer ext4 on smaller disks.  Interesting xfs has slower write performance; it was originally designed specifically for a read mostly situation (video on demand servers), so it's not too surprising.
Comment: we had a case of ext4 failing to work with 5+M files in a single folder (that were created by some 3rdparty software product that was not designed well). In ext4 this folder took multiple days to copy, or even failed mid-process - it just did not scale well, and xfs handled the same operation in hours with no problems.
On the other side, from the words of our DevOps engineers, ext4 is more reliable than xfs in cases of unexpected power loss - the disk may become corrupted and difficult to recover, while ext4 simpler structure makes it easy to recover from power failures.
Comment: I think when xfs was originally added to linux, it was very fragile and badly hurt by power outages.  However, I don't think that's been true for years.  It recovers with the journal quite well these days.


How do I trigger ask for permission to access HTML5 canvas data without "via user interaction" on Firefox? (no canvas in Permissions API?)

Question: This is a fairly firefox specific issue it seems... not sure ofc! (but I tested in chrome, and it works, whereas i get garbled canvas data in firefox)
In short, I wanted to dynamically insert an emoji to the favicon, leading me on a small journey through rendering an emoji to a canvas (dynamically), reading that canvas thru .toDataURL(), and finally setting the favicon href to point to that "url". Problems arose when reading the canvas data!
I read stuff here https://bugzilla.mozilla.org/show_bug.cgi?id=1376865 about this feature being implemented, but they also seem to mention "canvas permissions"... they're not referring to the Permissions API right? (i looked here https://w3c.github.io/permissions/#permission-registry), and there's no such thing :(
I've encountered various internet hearsay about canvas being added to the Permissions API, but I haven't found anything concrete... do I give up on this? is this coming in the future?
I have no "user input" on my page, so adding this in retrospect just to trigger the pop-up asking for permission seems... hacky!
If you go to a page like http://www.faviconer.com/ where you can draw your favicon, you'll see what I mean. Firefox shows a pop-up on "user input triggered canvas data access", but chromium seems to just allow it outright.
code:
const createIconElement = () => {
    var link = document.createElement('link');
    link.rel = 'icon';
    link.type = 'image/png';
    return link;
};

// original: https://github.com/EvanHahn/canvas-to-favicon/blob/master/canvas-to-favicon.js
const canvasToFavicon = (canvas) => {
    let head = document.head;

    var existingIcons = document.querySelectorAll('link[rel="icon"]');
    for (var i = 0, len = existingIcons.length; i < len; i++) {
        head.removeChild(existingIcons[i]);
    }

    iconElement = createIconElement();
    head.appendChild(iconElement);

    iconElement.href = canvas.toDataURL('image/png');
}

document.addEventListener("DOMContentLoaded", () => {
    console.log('running setFavicon.js');

    // get an emoji from the DOM somewhere
    // const emojicontainingstring = document.querySelectorAll('*');
    // const emojis = emojicontainingstring.map(extractEmoji).filter(e => !!e);
    // const emoji = emojis[0];

    const emoji = '';

    // render emoji to canvas
    const canvas = document.createElement('canvas');
    canvas.width = 32;
    canvas.height = 32;

    const ctx = canvas.getContext("2d");
    ctx.font = '26px serif'
    ctx.textAlign = "center";
    ctx.textBaseline = "middle";
    ctx.fillText(emoji, canvas.width / 2, canvas.height / 2)

    canvasToFavicon(canvas);
});

Comment: Please show how you are drawi g thos icon, it really sounds like you are not waiting for a resource to be loaded before using it. There is to my knowlege no feature related to the canvas that does require an user gesture.
Comment: Sure, should be up now! :), there's no "loading of a resource" as far as I know, I generate it synchronously (create canvas -> draw emoji -> .toDataURL() -> set favicon), all happens in the DOMContentLoaded for good measure.
Comment: Works for me... FF86 on macOS.
Answer: ok, turns out it's my CanvasBlocker plugin (even though I specifically whitelisted my own domain?... tested on vanilla FF and it works!)


NET Core 6 Trouble updating a DB record using a DTO

Question: This is my first time using DTO's to transfer data to the DB. I have this Create method that uses a DTO (I wont show that DTO because this is just an example) and works fine:
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Create(CreateDTO dto)
    {
        DropDowns();
        dto.Date_Added = DateTime.Now;
        try
        {
            _context.Add(dto.ToWC_Inbox());
            await _context.SaveChangesAsync();
            return RedirectToAction(nameof(Index));
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine("It didn't work.");
            System.Diagnostics.Debug.WriteLine(ex);
        }

        return View(dto.ToWC_Inbox());
    }

The create DTO lacks a few of the fields that need to be entered after the initial creation so I have a separate DTO for Editing that looks like this:
public class ReviewDTO
{
    public int ID { get; set; }
    [MaxLength(50)]
    public string First_Name { get; set; } = null!;
    [MaxLength(50)]
    public string Last_Name { get; set; } = null!;
    [MaxLength(10)]
    public string? Gender { get; set; }
    [MaxLength(30)]
    public string? Marital_Status { get; set; }
    [MaxLength(4)]
    public string? SSN { get; set; }
    public DateTime? DOB { get; set; }
    [MaxLength(100)]
    public string? Address { get; set; }
    [MaxLength(12)]
    public string? Phone_Number { get; set; }
    [MaxLength(4)]
    public string Org_Number { get; set; } = null!;
    public DateTime Hire_Date { get; set; }
    [MaxLength(20)]
    public string Job_Title { get; set; } = null!;
    [MaxLength(50)]
    public string Work_Schedule { get; set; } = null!;
    public DateTime Injury_Date { get; set; }
    [MaxLength(10)]
    public string Injury_Time { get; set; } = null!;
    [MaxLength(15)]
    public string DOT_12 { get; set; } = null!;
    [MaxLength(10)]
    public string Start_Time { get; set; } = null!;
    [MaxLength(30)]
    public string Injured_Body_Part { get; set; } = null!;
    [MaxLength(10)]
    public string? Side { get; set; }
    public bool Missing_Work { get; set; }
    public DateTime? Missing_Work_Date { get; set; }
    public DateTime? Begin_Missing_Date { get; set; }
    [MaxLength(10)]
    public string? Begin_Missing_Time { get; set; }
    public DateTime? Return_To_Work_Date { get; set; }
    public bool Doctors_Release { get; set; }
    public bool? Treatment { get; set; }
    [RequiredIf("Treatment == true", ErrorMessage = "Treatment Date is required.")]
    public DateTime? Treatment_Date { get; set; }
    [MaxLength(100)]
    [RequiredIf("Treatment == true", ErrorMessage = "Treatment Provider is required.")]
    public string? Treatment_Provider { get; set; }
    [MaxLength(15)]
    [RequiredIf("Treatment == true", ErrorMessage = "Treatment Provider Phone is required.")]
    public string? Treatment_Provider_Phone { get; set; }
    [MaxLength(50)]
    [RequiredIf("Treatment == true", ErrorMessage = "Where first treated is required.")]
    public string? Transport_First_Treatment { get; set; }
    [MaxLength(50)]
    [RequiredIf("Treatment == true", ErrorMessage = "The city of treatment is required.")]
    public string? Transport_City { get; set; }
    [MaxLength(250)]
    public string Injury_Description { get; set; } = null!;
    [MaxLength(250)]
    public string? Equipment { get; set; }
    [MaxLength(50)]
    public string? Witness { get; set; }
    [MaxLength(50)]
    public string? Supervisor_Name { get; set; }
    [MaxLength(15)]
    public string? Supervisor_Phone { get; set; }
    [MaxLength(250)]
    public string? Questioned { get; set; }
    [MaxLength(250)]
    public string? Medical_History { get; set; }
    public bool Inbox_Submitted { get; set; }
    [RequiredIf("Inbox_Submitted == false", ErrorMessage = "The reason is required.")]
    public string? Inbox_Reason { get; set; }
    [MaxLength(250)]
    public string? Comments { get; set; }
    [MaxLength(254)]
    public string User_Email { get; set; } = null!;
    [MaxLength(254)]
    public string Supervisor_Email { get; set; } = null!;
    [MaxLength(254)]
    public string Safety_Specialist_Email { get; set; } = null!;
    [MaxLength(254)]
    public string? Optional_Email { get; set; }
    [MaxLength(254)]
    public string? Optional_Email2 { get; set; }
    [MaxLength(254)]
    public string? Optional_Email3 { get; set; }
    [MaxLength(254)]
    public string? HDHR_Manager_Email { get; set; }
    public int TX_EROI_Lag { get; set; }
    public string? Claim_Ruling { get; set; }
    public string? Injury_Type { get; set; }
    public DateTime? TTD_Onset_Date { get; set; }
    public DateTime? Restricted_RTW_Date { get; set; }
    public DateTime? Full_Duty_RTW_Date { get; set; }
    public bool Receiving_TTD { get; set; }
    public DateTime? Date_TTD_Award_Notice { get; set; }
    public DateTime? Claim_Ruling_Date { get; set; }
    public DateTime? Med_Excuse_To { get; set; }
    public string? Doctor { get; set; }
    public DateTime? RTW_Email_Encova { get; set; }
    public DateTime? Lost_Time_Start1 { get; set; }
    public DateTime? Lost_Time_End1 { get; set; }
    public DateTime? Lost_Time_Start2 { get; set; }
    public DateTime? Lost_Time_End2 { get; set; }
    public DateTime? Lost_Time_Start3 { get; set; }
    public DateTime? Lost_Time_End3 { get; set; }
    public string? Status { get; set; }
    public string? HR_Comments { get; set; }
    public string Add_User { get; set; } = null!;
    public DateTime Date_Added { get; set; }
    public string? HR_User { get; set; }
    public DateTime? Date_Modified { get; set; }

    public WC_Inbox ToCompletedWC_Inbox()
    {
        return new WC_Inbox
        {
            First_Name = this.First_Name,
            Last_Name = this.Last_Name,
            Gender = this.Gender,
            Marital_Status = this.Marital_Status,
            SSN = this.SSN,
            DOB = this.DOB,
            Address = this.Address,
            Phone_Number = this.Phone_Number,
            Org_Number = this.Org_Number,
            Hire_Date = this.Hire_Date,
            Job_Title = this.Job_Title,
            Work_Schedule = this.Work_Schedule,
            Injury_Date = this.Injury_Date,
            Injury_Time = this.Injury_Time,
            DOT_12 = this.DOT_12,
            Start_Time = this.Start_Time,
            Injured_Body_Part = this.Injured_Body_Part,
            Side = this.Side,
            Missing_Work = this.Missing_Work,
            Missing_Work_Date = this.Missing_Work_Date,
            Begin_Missing_Date = this.Begin_Missing_Date,
            Begin_Missing_Time = this.Begin_Missing_Time,
            Return_To_Work_Date = this.Return_To_Work_Date,
            Doctors_Release = this.Doctors_Release,
            Treatment = this.Treatment,
            Treatment_Date = this.Treatment_Date,
            Treatment_Provider = this.Treatment_Provider,
            Treatment_Provider_Phone = this.Treatment_Provider_Phone,
            Transport_First_Treatment = this.Transport_First_Treatment,
            Transport_City = this.Transport_City,
            Injury_Description = this.Injury_Description,
            Equipment = this.Equipment,
            Witness = this.Witness,
            Supervisor_Name = this.Supervisor_Name,
            Supervisor_Phone = this.Supervisor_Phone,
            Questioned = this.Questioned,
            Medical_History = this.Medical_History,
            Inbox_Submitted = this.Inbox_Submitted,
            Inbox_Reason = this.Inbox_Reason,
            Comments = this.Comments,
            User_Email = this.User_Email,
            Supervisor_Email = this.Supervisor_Email,
            Safety_Specialist_Email = this.Safety_Specialist_Email,
            Optional_Email = this.Optional_Email,
            Optional_Email2 = this.Optional_Email2,
            Optional_Email3 = this.Optional_Email3,
            HDHR_Manager_Email = this.HDHR_Manager_Email,
            TX_EROI_Lag = this.TX_EROI_Lag,
            Claim_Ruling = this.Claim_Ruling,
            Injury_Type = this.Injury_Type,
            TTD_Onset_Date = this.TTD_Onset_Date,
            Restricted_RTW_Date = this.Restricted_RTW_Date,
            Full_Duty_RTW_Date = this.Full_Duty_RTW_Date,
            Receiving_TTD = this.Receiving_TTD,
            Date_TTD_Award_Notice = this.Date_TTD_Award_Notice,
            Claim_Ruling_Date = this.Claim_Ruling_Date,
            Med_Excuse_To = this.Med_Excuse_To,
            Doctor = this.Doctor,
            RTW_Email_Encova = this.RTW_Email_Encova,
            Lost_Time_Start1 = this.Lost_Time_Start1,
            Lost_Time_End1 = this.Lost_Time_End1,
            Lost_Time_Start2 = this.Lost_Time_Start2,
            Lost_Time_End2 = this.Lost_Time_End2,
            Lost_Time_Start3 = this.Lost_Time_Start3,
            Lost_Time_End3 = this.Lost_Time_End3,
            Add_User = this.Add_User,
            Date_Added = this.Date_Added,
            HR_User = this.HR_User,
            Date_Modified = this.Date_Modified,
        };
    }
}

And the controller method:
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Edit(int id, ReviewDTO dto)
    {
        System.Diagnostics.Debug.WriteLine("ID: " + id);
        System.Diagnostics.Debug.WriteLine("DTO ID: " + dto.ID);
        DropDowns();
        if (id != dto.ID)
        {
            return NotFound();
        }

        try
        {
            System.Diagnostics.Debug.WriteLine("Updating DB");
            System.Diagnostics.Debug.WriteLine("ID again: " + id);
            System.Diagnostics.Debug.WriteLine("DTO ID again: " + dto.ID);
            _context.Update(dto.ToCompletedWC_Inbox());
            await _context.SaveChangesAsync();
        }
        catch (DbUpdateConcurrencyException)
        {
            if (!WC_InboxExists(id))
            {
                return NotFound();
            }
            else
            {
                throw;
            }
        }
        return RedirectToAction(nameof(Index));
    }

The problem is that instead of updating the existing record, the Edit method creates an entirely new record with the updated info and leaves the old record unedited.
Those print statesments are there to confirm that the dto.ID and the id that was gathered from the previous page match, and they do.
After doing some research I believe this is because I need to get the current version of the record out of the database, change it with the posted values, and save it back to the database, but I'm not entirely sure how to do this.
Could someone help me figure that part out? Thank you in advance.
Comment: Did you ever find a solution, op?
Answer: Should not ToCompletedWC_Inbox also map an Id. Something like:
public WC_Inbox ToCompletedWC_Inbox()
{
    return new WC_Inbox
    {
        ID = this.ID, // assuming WC_Inbox has ID property
        First_Name = this.First_Name,
        ....


How to remove this bathroom faucet

Question: I am trying to replace a bathroom faucet on a pedestal sink, but can't figure out how to remove the faucet handles.  I'm pretty sure the handles must come off from the top, b/c the retainer rings below can't be removed since the fitting underneath is too large.  There is no set screw on the handles and I've tried suggestions seen in other threads and nothing seems to work.
Anyone have any suggestions on how to get these out?  I really don't want to have to take the sink out.  But if I can't figure it out, I'll probably pull it out and use a cut-off wheel.
The reason for replacing is that the cold faucet is completely frozen up.  We have very hard water.  I'm thinking this could make the handles harder to remove as well.  Anyway, here are some pics.  If anyone knows anything that might help, please let me know.
Thanks!
Comment: The tee has to unscrew from the handle, it must be two piece.  I've not seen this personally, but it had to be put together after the nut was installed.
Answer: You may be able to remove the handle and expose a set screw that when loosened would allow the top of the mechanism to be removed.
Comment: That's my guess too. The horizontal part of the faucet probably unscrews from the the vertical part.

How to remove this bathroom faucet


CSS being ignored in Print view

Question: I have been trying to create an exact view of my HTML form when i strike ctrl+p but my CSS is being ignored in a print view and all the styling i did for textfields, radio buttons etc they are not being displayed and by default styling is being displayed in the print view.
Following is my page where I want to apply the same print view the way the form really is
Kindly let me know how can I do that.
My Page
Note: I tried to media="all" on my attached stylesheet and also created another css file for print view (The css file is same i used for the styling of my form) print.css and include that file by
<link rel="stylesheet" href="css/print.css" type="text/css" media="print"  charset="utf-8" />

`
But it also did not worked and after doing this in print view my customized form elements does not appear.
Comment: Try removing the `media` attribute.
Comment: Did you refresh your cache after you changed the `media` attribute to `all`?
Comment: @AndresIlich yes, i did that and nothing happened
Answer: You are using background images to style the form inputs, but non current browser does print any background images. This is not a bug but a feature to save toner ink.
See also How can I print background images in FF or IE? ans similar questions.
Comment: @Mr. Alien I used the code inspector in Chromium. No need to know the source URL for the CSS file.
Comment: He has not even linked the stylesheet on the page he's pointing to hehe.. View source and check yourself..
Comment: @Mr.Alien i have uploaded that stylesheet now kindly see if you can help all i want that images i used for form elements should be displayed in print view. KIndly visit this url http://caremerge.us/rai_form/form1.html
Comment: @softgenic Did you read feeela's answer? Or else if you want to see the layout correctly use `media="screen"` and link another as `media="print"` or click on page setup and click on `print background(colors and images)`
Comment: @Mr. Alien `print background(colors and images)` Which browser does have such an option? I don't see it in Opera, Firefox or Chromium. Also teh stylesheet was correctly linked – otherwise the forms weren't styled…
Comment: @feeela Go to File -> Page Setup and see there will be such option
Comment: @feeela Am using w7 I guess your menu bar is off, press alt, click on file and select page setup btw am using firefox 10.2
Answer: Use html5.js it will help for web print. As print will not proper as for design expertise. http://paulirish.com/2011/the-history-of-the-html5-shiv/ or https://github.com/aFarkas/html5shiv

CSS being ignored in Print view


Why do some players build their buildings in a line (towards the entrance of their base)?

Question: While watching a live-stream of a game (TvP, master league) I noticed that both players built their production facilities towards the entrance of their base, starting at their command-center/nexus. This was fairly early in the game, around the 5 minute mark.

I also noticed this building-placement in some other games (except vs. Zerg where a wall-in is prefered) and wondered if there's an advantage in doing so?
Answer: So, I saw iNcontroL do this on his stream last night and I wish I had captured it for you because it really illustrates why this is such an important move: It controls the point of attack.
History
Back in Broodwars it was very common for your buildings to form a nice arc in front of your mineral line.  The reason being that back in those days, every race had powerful melee and ranged units very early on.  As a result, the arc allowed a player with ranged units to control where the opponent's melee units would attack in an artificial choke.
Starcraft 2 differs from Broodwars in a number of important ways: Smaller ramps at all naturals, mean you have a natural choke at every main base.  Additionally, smaller bases mean that its easier to use buildings to create a wall to your natural choke, or from that choke to your natural expansion.  This creates the line phenomena you observed, which has replaced the traditional arc
XvZ
The reason you see players do this largely against Zerg (and less so against other races) is because the balance of Ranged/Melee is now distinct amongst the races.  Terran have a fairly ubiquitous ranged early army, where as Zerg's army tends to be almost always Melee (or short ranged) early on.  Though some players would rather opt for a Wall-In, that has disadvantages, and often is not practical for expansions.  As a result, it is often a better idea to build your buildings in a line (especially warp gates, where it doesn't matter where you put them).
Control
Finally, let's get to the reason that building these great walls is a good idea.  If you have a range advantage on your opponent (or even if you both have a lot of short range), then if he attempts to bust your wall, you can harass him without taking damage to your army (your wall absorbs it instead).  Most enemies will almost immediately realize why this is disadvantageous and withdraw.  For them to attack you, they're forced to run around the wall (sometimes taking damage in the process), and engage at an artificial choke point.  The Choke has long been known to give an advantage to the force with superior range, and since many natural expansions lack a choke, this artificial choke gives you a new advantage.
Summary
Whether or not you choose to wall-in, its important to know why you opponent might, and understand what its trying to accomplish.  Usually the advantage provided by these walls starts to disappear in the mid-game, as players gain access to more ranged units and people start putting their army in front of their wall.

P.S.
Its worth noting that recently a number of Zerg players have shifted to what is called a high economy baneling bust.  This is a move specifically targeted at these kinds of walls (and more general wall-ins).  This utilizes an unusually high number of Banelings to break the wall, followed up by rushing Speedlings into the natural Mineral line.  As a result, its important you keep your army at the part of the wall closest to the enemy, so you can catch this bust in action, and only move towards the choke when your enemy does.
Comment: Thanks for the detailed answer. Creating an artificial choke at your natural seems like a great idea, but why do you think it's good for your main? You already have a choke formed by the ramp and usually you're on the high-ground as well. The reasoning by Wipqozn about protecting workers seems much more plausible? Also this was a TvP matchup, so the advantage of ranged units doesn't affect it as much?
Comment: @Bummzack, the natural choke is nice, but now imagine those Zealots running through the natural choke, along the wall, and around the artificial choke, while Marines are taking pot shots the whole time.  Saying "it protects workers" isn't wrong, it just isn't descriptive. The method by which it protects workers is by controlling the point of attack.  As for PvT, it is very common to send Zealot raids on mineral lines...
Answer: I can think of two reasons for this:

An attempt to split up your opponents forces (some on both sides) so that you can easily overpower them.
To make it easier to defend your workers. If your opponent storms your base, you can just put your workers on the side opposite they enter, giving your workers both more time to escape - as well as dodge the enemy.

A combination of the two is probably the main reason. It's defensive since it can protect your workers, but, if your opponent splits up their forces so you can't do that, you can simply overwhelm one half of the opponents army.
Comment: +1 for #2: Looks very much like an attempt to block a rush on the mineral line.
Comment: I was also thinking along the lines of your first point but not about the second! You're right, it probably helps a lot when trying to protect workers.
Comment: I really agree with #2. It seems like a very logical tactic.


Recommendations for search terms - insulate wall between duplex units

Question: I have one half of a duplex, which is separated by a brick wall (looks like a triple brick?). While refinishing my basement,  I'm trying to determine the insulation requirements in my local building code (Ontario, Canada), but no matter what I punch into google I cant find the right reference.
Can anyone suggest the search term I should be using to find the correct part of my local code?
Thanks!
Comment: Whatever language there may be will be about the fire-rating of said **party wall**, not thermal insulation. If the neighbor is not prone to leaving the house unheated in winter, there should be little temperature variation across the wall, on average.  When that differential shoots up to 900 degrees, it's good if you can leave the house before a fire breaks through...
Comment: Will the space behind the wall be about the same temperature as your space? If so, what do you expect insulation to do?
Answer: There actually aren't any (at least in the Model Codes)
The reason you're coming up empty handed is because the Code makers, by and large, have not addressed this when writing energy conservation codes.  Party (common) walls are generally not considered part of the building thermal envelope, which is actually rather OK, as insulating them poses special challenges.
From the Building America Solutions Center page on the topic (italics in original):

The model energy codes do not address minimum insulation requirements for common walls because the common wall is not defined as part of the building thermal envelope.

If you want to insulate and/or air seal them, you must respect the wall's fire rating and listing when insulating in order to be Code compliant.  You may wish to speak with your AHJ on this, especially considering that you are dealing with an older style of party wall which behaves differently from modern residential party walls.
Answer: The article and discussion found in the article referenced by @ThreePhaseEel indicates no code reference specifically to party walls. However, all major codes reference energy compliance for "Dwelling Unit's Walls". I think the article is misleading when it implies there is no energy code requirements for "party walls."
Yes, the code is very specific for fire separation for "party walls" in multi-family structures. (By the way, as of 2014 Code, fire sprinklers are also required for 3 units and more.)
However, all party walls have "sound wall" requirements.  I'm not sure what your party wall's sound transmissions class (STC) is, but I'm sure the brick wall does not meet the required "R value" for walls in a "dwelling unit"...as required by all codes.
We try to "kill two (or three) birds with one stone" and use thermal insulation in a party wall design to meet sound wall requirements and fire wall separation requirements.
So, I'd suggest use the same thermal value in your party wall as your exterior walls to meet the energy requirements for dwelling units.
Comment: The prime concern I'd have with insulating a party wall is that combustible insulation materials (foam, celluosic) could void the fire wall listing/rating depending on the existing construction and means of installation.  Air sealing could also have an impact on this as well...
Comment: @ThreePhaseEel  I don't think you can get a "fire rating" using combustible insulation. I've never heard of it. Can you?
Comment: Well, ICF walls are often considered to have some degree of fire rating performance AIUI even though the forms will burn off the exposed side after the finish is no longer able to hold...
Comment: @ThreePhaseEel  Hmmm...my UL Fire Rated Listing Manual doesn't have ICF listed. Are they?
Comment: Interesting -- my understanding could be wrong, at least for first gen (foam sandwich) ICFs.  (There are what I call "second gen" ICF technologies (such as Apex Blocks) that use a foam-aggregate PCC -- these *do* have an official fire rating, at least if the specification sheets are any guide.)
Comment: I did find this, but it doesn't seem to have a UL listing, so I don't think building codes would accept it as "Fire Rated".   https://www.google.com/url?sa=t&source=web&cd=1&ved=0ahUKEwjohZ_R0eTUAhUH34MKHajRBDcQFggKMAA&url=http%3A%2F%2Fwww.forms.org%2Findex.cfm%2Ffireresistance&usg=AFQjCNFfyzsRArCm68BcEuKPIVo3tpi5sA
Comment: that's because it's through ICC-ES, not UL -- here's the [eval report](http://apexblock.com/wp-content/uploads/2017/04/icc-apex.pdf) btw.
Comment: @ThreePhaseEel I think it is approved, but with a footing, it could be pretty expensive compared to a wood frame wall with one layer of 5/8" Fire Code Type-X gypsum board on each side. It looks like the ICF can give you up to a 3-hour fire wall (which is pretty high) but for non-load bearing walls. Most party walls require just a one-hour fire rated wall, which the wood frame wall with 5/8" Type-X gypsum board meets. For the duplex he's asking about, I think the wood frame wall might work best.
Comment: he's not replacing the wall anyway (he has an existing triple wythe brick party wall and wants to insulate his side of it)
Comment: @ThreePhaseEel Oh I'm not suggesting to "replace" the wall...but, in order to meet fire separation requirements, which I suspect are none, AND to insulate the wall , I'd use wood framing rather than ICF.


Gamification: Scalability and affordance of visual rewards?

Question:
By the end of 2014, Gartner Research Report predicts that over 70
  percent of Global 2000 organizations will have at least one "gamified"
  application, and that "gamification is positioned to become a
  significant trend in the next five years.

Visual rewards are one of the tools that allow for gamification to be successful. I would like to better understand how specific designs and affordances are applied to visual reward structures. For example, User profile completion is represented with a variety of charts while badges represent specific achievements as in StackExchange sites.
In StackExchange sites badges are used because they follow an "addition model"; the more you do and participate the more score and badges you acquire).
Below is an example of how profile completion is handled in Linkedin and how percived affordance could impact on scalability.

Clarifications : affordance and scalability of Linkedin profile

Your profile strength is a circle which is filled like a cup each time you enter your page, according to how complete your profile is. The highest rank (All-Star) would prioritize your profile in the network's search engines. It is interesting to point that even as you reach "All-Star" level, the circle (cup) is not never entirely full, insinuating that there is always room for updates and changes.

Linkedin moved away from a progress bar to the circle shape to scale up, Here is an analysis of why this was done. This example portrays very well the challenge I am facing. hope this helps to clarify my questions below:
What considerations should be taken into account when designing a visual reward structure that will scale up comfortably both at IA and visual design levels without users being overwhelmed or missguided ?
Meaningful Play Framework :
Found the below presentation by Sebastian Deterding quite interesting, goes in-depth in explaining how to structure a reward system:

Meaningful Play: Getting Gamification Right : Video & Slides

Below is the situation I am designing for:
Level 1- Profile completion (basic information about the user)
Level 2- Completing certain activities on the site. (Reading documents, answering survey questions)
Level 3 and up to level 6 more complex and hierarchically dependant tasks or activities.
Is there any specific literature that deals with scalability and gamification? (Of course no need for a full literature review about gamification but anything specific to the issue of scalability :)
Any opinion or experience directly related to game mechanics and scalability?
Comment: The term 'affordance' is completely misused here. Please see this [paper](http://www.e-ope.ee/_download/euni_repository/file/3232/Content.zip/Content/Articles/norman-1999.pdf) for what it means.
Comment: Well, I think the concept of gamification, itself, is usually scalable. In other words, I think gamifcation is scalable by default in most cases.
Comment: @ Izhaki,Thanks for the refrence,I mainly used affordance to deal with or discribe circular patterns used in charts, some circular charts could have multiple levels and users would anticipate based on their visual features that they could reach higher scores. does that make sense? i should perhaps include an example!
Comment: An example would always help. But I would still argue that this type of anticipation does not fall into an 'actionable property', which is the basis of 'affordance'.
Comment: @Izhaki Actionable property refers to real world affordances like so many examples referenced by Norman. he also contrasts physical affordances to perceived affordances which are mostly what we are dealing with here. So I  think you are partially right in that the term used should be "perceived affordance" rather that "affordance". The concept is however not misused particularly if we re speaking about fine-tuning the mechanics of visual rewards and allowing for growth and scalability.
Comment: @Izhaki I have added some examples for clarity!
Comment: This question is too broad. Yes, there is a lot of specific literature out there on gamification (there are books on the topic). My only advice is that just because Gartner calls it a trend doesn't mean it's a good thing. :)
Comment: @DA01 agreed on your last point :) Having the question too broad is not really what i want, I am very much focused on scalability, please feel free to edit the question or if you have any suggestions let me know so i can narrow things down.
Comment: I guess it boils down to a balance between "completion patterns" like profile completion, "addition patterns" like accumulating badges (though not sure these patterns are called this way) and most probably a combination of both.The whole thing should kind of align with clear progress logic and accommodate future growth such as adding levels and challenges while remaining consistent.
Answer: I highly recommend the Gamification course at Coursera, it's really exhaustive and gives as many insights as a Product/UX Owner could hope for.
So, as prof. Kevin Werbach, who runs the course, put it, the Pyramid of Game Elements goes as:
Dynamics (high-level element, those mechanisms of human psyche that are making us enjoy games and engage)
Mechanics (mid-level, operational means of machine/engine triggering the dynamics)
Components (low-level, very core visual means of expressing rewards)
Dynamics: there are plethora of psychologic, philosophic and even math books on matter of Dynamics, to me the most important and compelling one is "Homo Ludens" by Johan Huizinga.
Mechanics: (a screenshot from prof. Werbach videolecture)
Components being a PBL triad: points, badges and leaderboards. (NB: Stack Exchange is using the whole triad and more, such as hat bashes).
Now, gamification, expressed in PBL is a very simple and endlessly scalable structure, when you think of horizontal scalability: there are no limits of points one user can gain, and the "All-star" circle is never full.
However, if you are thinking complexity scalability, it's a whole different problem. People get bored, people grow tired, the game that is too complex can demotivate a gamer by it's own complexity, and so forth. This is how our mind is wired. So, no, there is not much space for complexity scalability in gamification. People might engage in a very complex game when stakes are high, or when they are utterly interested, but in case of the SaaS it's not too probable.
As for your specific case: if I were to design this, I would assign points for basic mono-tasks such as profile completion (however, since the service itself is interested in more data from users, profile completion per se deserves a bigger reward — a badge, just like SE did it), and give badges for more complex tasks.
For hierarchical/sequential tasks you can break them down and give your users quest arks, and design some reward to mark those who completed the quest, for example, hats like at SE.
However, I can't stress enough how important it is not to bore your users with tasks that are too complex and too long. A game should be entertaining, that's the essence of it.
MDA: A Formal Approach to Game Design and Game Research
http://www.cs.northwestern.edu/~hunicke/MDA.pdf
100 Things Every Designer Should Know About People
http://www.amazon.com/Things-Designer-People-Voices-Matter/dp/0321767535
(book on basic neuroscience tech like "people can only hold three entities in their attention focus at once" — this is a very basic guideline book on how not to bore your users and not make them think too much).
Comment: really like the rational behind the PBL triad though leaderboard are not directly linked to what i am trying to achieve. Also, you are absolutely right in pointing that"since the service itself is interested in more data from users, profile completion per se deserves a bigger reward".@Izhaki based on this response i think my previous comment about mechanics should most probably refer to Components or "core visual means of expressing rewards" Thanks Zoe
Comment: NP, good luck with your system!
Answer: There is a decent gamification course at coursera.(https://class.coursera.org/gamification-003/lecture)
And as far as experience you probably have tons of it here at stackexchange and linkedIn and slashdot and other places.
What is gamefication except for providing incentives for participating. Stores do this by giving cards in which each time you purchase a coffee (as for example) you get a star. Get 10 stars and you, my friend, get a free cup of coffee.
I'll see if I can find some of the interesting articles on gamefication I've read and post them.
EDIT: Here are a few interesting links.
Kevin Werbach and Dan Hunter
From a business perspective: For the Win
http://wdp.wharton.upenn.edu/book/for-the-win/?utm_source=Coursera4&utm_medium=website&utm_campaign=forthewin
Gabe Zichermann on Gamification
Gabe at Ted Talks: https://www.youtube.com/watch?v=O2N-5maKZ9Q
eBook: Gamification by Design: http://it-ebooks.info/book/570/
Seth Priebatsh
http://www.ted.com/talks/seth_priebatsch_the_game_layer_on_top_of_the_world?language=en
Comment: Thanks for the link. I think the answer you provided is more of a comment :) I guess you could edit your answer and incorporate your findings.
Comment: Yes. My bookmarks are on my personal computer. And no - I don't regularly upload my bookmarks to gmail.  :-)  In fact I only do it after I've been inconvenienced by not having done so.
Answer: 1.
First of all, gamification is a great way of engaging users and making them WANT to contribute to whatever it is they are using. It is obvious that people like games, so adding game-like features (e.g. stackexchange's reputation system) to something, it will naturally increase the user's engagement.
2.
two tutorials/guides on the topic of gamification, for reference:
2.1
For a free tutorial, try:
http://www.gamified.co.uk/2013/06/02/gamification-tutorial-series-episode-1-and-2/
2.2
or, if you don't mind spending some money, try:
http://www.lynda.com/Education-Higher-Education-tutorials/Gamification-Learning/173211-2.html
3.
Some good mechanics that are simple to implements are:
3.1: Badges:
Badges are a great way to engage the user, as long as there are enough to be awarded over a long period of time. This gives the user a  feeling of achievement for doing something.
3.2: Decoration:
Users want a feeling of accomplishment for doing something good, so give that to them by giving them various items that they can use to customize their profile, as awards, so they can stand out from other people.
3.3: A levelling system:
A great way of engaging users is by giving them levels. This is simply a number that takes various tasks to increase, giving a competitive touch to your system.

Conclusion:
I hope this helps, and as always, good luck.


Calling a variable that is nowhere else

Question: In the following code, from Beginning PHP and mySQL 5e, if acronym function is called without mentioning $matches, how ,in the definition of acronym, $matches is never linked to anything, but rather used in the isset($acronym[$matches[1]])) ?, How isset knows what is $matches in the first place?
The following is the code and I have tested that it is working.
I just cannot follow up with the use of an arbitrary term; $matches, and its use.
    // This function will add the acronym's long form
// directly after any acronyms found in $matches
function acronym($matches) {
    $acronyms = array(
        'WWW' => 'World Wide Web',
        'IRS' => 'Internal Revenue Service',
        'PDF' => 'Portable Document Format');
    if (isset($acronyms[$matches[1]]))
        return $acronyms[$matches[1]] . " (" . $matches[1] . ")";
    else
        return $matches[1];
}
// The target text
$text = "The <acronym>IRS</acronym> offers tax forms in
         <acronym>PDF</acronym> format on the <acronym>WWW</acronym>.";
// Add the acronyms' long forms to the target text
$newtext = preg_replace_callback("/<acronym>(.*)<\/acronym>/U", 'acronym',
                                  $text);
print_r($newtext);

The output is:
The Internal Revenue Service (IRS) offers tax forms inPortable Document Format (PDF) format on the World Wide Web (WWW).
Reminder: The input, for the function preg_replace_callback is:
The <acronym>IRS</acronym> offers tax forms in <acronym>PDF</acronym> format on the <acronym>WWW</acronym>.
Comment: `$matches` is a _required_ parameter for the function. Have you tried calling `acronym()` without any parameter? Or did I misunderstand your question?
Comment: In prog_replace_callback acronym was called in the form 'acronym'. nothing was used here to replace $matches either. That bugs me the most.
Comment: https://www.php.net/manual/en/function.preg-replace-callback.php, Example #2
Comment: In the code you posted, the function `acronym()` is never called explicitly. It is called by [`preg_replace_callback()`](https://www.php.net/manual/en/function.preg-replace-callback.php) as it is described in the documentation, once for every match of the `regex` in the input string.
Answer: The preg_replace_callback() function is written in that way, that it calls the function with a well defined argument. See the manual of this function:

A callback that will be called and passed an array of matched elements in the subject string. The callback should return the replacement string. This is the callback signature:
handler ( array $matches ) : string

So your function acronym() will get an array with the matches from the regex. Keep in mind that you are not calling the acronym() function by yourself, the function preg_replace_callback() does that for you (with the argument defined in the documentation).

Calling a variable that is nowhere else


I want to use laser_filters but can't build it

Question: I am using ubuntu 20.04 (noetic).
I am trying to use laser filters(
http://wiki.ros.org/laser_filters),
but I cannot build it.
When I use catkin_make I get the following error
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:100 (message):
  This workspace contains non-catkin packages in it, and catkin cannot build
  a non-homogeneous workspace without isolation.  Try the
  'catkin_make_isolated' command instead.
Call Stack (most recent call first):
  CMakeLists.txt:69 (catkin_workspace)

-- Configuring incomplete, errors occurred!
See also "/home/limlab/filter_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/limlab/filter_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

When I use catkin_make_isolated I get the following error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~  traversing 1 packages in topological order:
~~  - laser_filters (unknown)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: Packages with unknown build types exist
Can not build workspace with packages of unknown build_type

Comment: It depends on the packages of your workspace. Please add more and detailed information about it.
Answer: I don't have enough reputation to comment so I'll write an answer
My first guess would be that you downloaded laser_filters package for the wrong version of ROS. If you get package from source: https://github.com/ros-perception/laser_filters. After downloading you need to checkout to noetic-devel branch (default branch is ros2 and that would make sense because it doesn't use catkin build system).
Cloning correct branch:
# cd to your workspace src folder
git clone https://github.com/ros-perception/laser_filters.git
cd laser_filters
git checkout noetic-devel

Alternatively you could delete laser_filters package from your workspace and try getting it from apt
sudo apt install ros-noetic-laser-filters


Ranking up with the Grand Company

Question: I am wondering, how do you rank up in the Grand Company? I maxed out my seals after a good week of fate parties, and I already got my Chocobo. I am just wondering: how do I rank up from Private Third Class and what do I need?
Answer: In general, you can increase your Grand Company rank by spending Grand Company seals to purchase a promotion. If you talk to the Personnel Officer behind the desk at your Grand Company's headquarters, one of the options available should be "Apply for a promotion." The seal cost for a single rank increase starts off low, but gradually increases as you gain rank.

When you attempt to apply for a promotion, the NPC will tell you how many seals are required, and if necessary, what additional tasks must be completed first. At low levels, simply spending seals is all that is required, but as you get into the higher ranks, you'll sometimes be asked to complete certain quests (given by another NPC in your Grand Company headquarters) or complete other tasks before you can earn your next promotion.
Comment: No, you need to spend seals specifically on promotions. Buying other items with your seals doesn't count. (But ranking up by buying promotions will allow you to buy better items!)
Comment: You mean I could of applied and been promoted a few levels already by just buying the chocobo insurance paper?

Ranking up with the Grand Company


Unable to load DLL 'Microsoft.WITDataStore32.dll':The specified module could not be found.(Exception from HRESULT:0x8007007E)

Question: I am getting error while debugging the Unit test cased in Visual Studio 2017 Professional edition.

Unable to load DLL 'Microsoft.WITDataStore32.dll':The specified module could not be found.(Exception from HRESULT:0x8007007E)

The below Nuget reference is missing in the existing code:

package id="nuget-bot.Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader" version="15.0.31101" targetFramework="net452" />

As a workaround, I have followed the below step:
Commented the above nuget-bot reference from package.config file and managing the Nuget package from the VS solution. I am using the Microsoft.TeamFoundationServer.ExtendedClient.15.112.1 in the solution.
But the issue is still occurring
Comment: Related post - [Unable to load DLL 'Microsoft.WITDataStore32.dll' (TeamFoundation.WorkItemTracking)](https://stackoverflow.com/q/31031817/465053)
Answer: The error is telling you to use version 15.0.31101 and you're using 15.112.1. Try using the exact version.
Comment: Thanks for your reply. I am not getting version 15.0.31101 of the file. Could you please provide the link to download the same version of the file.


How can I attach a ledger board to my house?

Question: Spring is here so I finally started to take measurements for materials I will need to build a new deck on my recently constructed home. I just realized that this isn't going to be quite so simple as I originally planned.
My house was constructed with engineered I beams and what I believe is an engineered OSB rim joist perpendicular to those (looking from the back of the house). Knowing this I knew that lag screws or even carriage bolts to hold a ledger board would not be sufficient.  Upon my own research it seemed the accepted way to handle this is to take a piece of 2 by into the inside of the I of the joist, and run a carriage bolt, through the ledger board, sheathing, rim joist and finally the added block, and to do this twice, staggered and 16" OC for each joist after that.
My father-in-law who has built several decks and is critical to this DIY project refuses to do this and he has his reasons which I respect and won't get into.
A better plan in his opinion would be something similar to what is described in this article
In the old days when he built decks with his dad, they used to lag and anchor ledger boards to the concrete foundation and then toenail the joists on top. They apparently make special ties now for this purpose that is an improvement on the old toe-nail method. It seems like a much better idea and if I use 2x10 or 2x12 joists then the deck will be pretty much at the bottom of the kitchen door where it needs to be.
Question 1: I assume that if these clips are still being produced that it must be code assuming proper lag screws and spacing have secured the ledger board?
My second complication... assuming I go this route, only 1 deck ledger board will be attached to a poured concrete wall (the garage).  The very back of the house is actually not a poured foundation wall but a 2x6 framed exterior wall with sheathing, and a decorative stone masonry product.
Question 2: If I were to cut away the masonry and lag into the 2x6 studs for the ledger support, would this be a sturdy code compliant ledger board?
And finally, if applicable, if I were to cut away the masonry to mount a ledger board, I would be worried about water possibly penetrating and getting behind the decorative masonry.
Question 3: What is the most appropriate way to prevent water from getting behind my ledger board or the masonry?
Here is a link to my previous question for a quick diagram of the current plan:
What is a good strategy to support this deck?
I am feeling a bit overwhelmed and my father in law thinks I am insane for even considering calling the local code guy (he has had some bad experiences with this guy in the past over a septic system and he is convinced the guy is a sadistic monster who likes for people to spend absurd amounts of money on frivolous things).  If I can't find a clear cut answer then I will probably just hire somebody to do this because the aggravation this is causing me is not worth it.
EDIT
On request here is what the back of the house looks like, to the right not in view is the garage.  This is not in a seismically active area.
Comment: As Shirlock has already suggested I would add a row of posts close to the house to carry the support beam for the deck. This solves many many problems with cutting into the house structure and dealing with environmental sealing issues. If you do this make sure to add triangulation members make the deck assembly strong and eliminate scissoring and sway. With such construction you can probably limit your connection to the house to just the short area under the patio door in the area that already setup for that purpose (I note the differing material there in the picture).
Comment: AS you asked earlier, joists resting on top of a ledger beam are perfectly fine. The real question here is where to attach the beam. Doesn't make any difference where the joists sit, there is hardware that works for either method.
Comment: @decker I didn't set up the scaffolding in this picture, this was the work of the masonry subcontractor while the house was still being built. They were all Mexican, probably here illegally, and probably didn't have any kind of insurance if they would have gotten hurt to make matters even worse.
Comment: You have a few options here, all IRC compliant. I am a bit confused by the different faces you want to secure to. The house rim joist, the knee wall and/or garage.  Can you attach a couple of pics of the surfaces and a sketch of the relationship of the deck to the existing structures? I am also questioning the rim joist of the house. In most cases, the rim joist is solid, even if you have I-beam floor joists setting on the sill plates. Check them carefully from the inside. Once we solve the initial rim joist attachment, the rest will be easy for you with readily available hardware.
Comment: @shirlockhomes My father in law will refuse to help me if I try to go through the rim joist. Are one of the IRC compliant options setting the deck ledger board below the rim joist and setting joists on top the ledger with special ties? One second on the picture...
Comment: vinyl or cedar siding?
Comment: Since there are no rules that say the weight MUST be bourn on the rim joist against the structure, I'm toying with some ideas of adding an extra post and beam close to the house. Are you absolutely sure the house rim joist is an engineered I-beam, not solid, especially under the door?
Comment: @shirlockhomes sorry for the confusion but it is not an I joist just the same engineered osb that the I joist is made out of.  Perhaps if I doubled or tripled the ledger?
Comment: OK, I'm trying to nail this question down.  The house rim joist is a solid LAM or a mult-thickness laminated OSB? If it is at least 1.5 inches thick, like dimensional lumber, then you can treat it like such.
Comment: @shirlockhomes I am not sure... but I guess I will have to call the builder and find out the specs and manufacturer. The manufacturer would definitely know best. I am still not sure if you think joists on top of a ledger is a fundamentally bad idea or not, I imagine you think it is a bad idea or you wouldn't be exploring every other conceivable option.
Comment: What ever you decide to do make sure that you draw a nice set of plans and submit them with your building permit application for local agency approval.
Comment: @MichaelKaras That seems far more expensive and time consuming, especially since this new construction and the ground is disturbed near the house.  I would have to dig down VERY FAR.  It seems that everybody is bound and determined to make this more complicated and expensive than it needs to be, so I am just going to pay somebody else to do this. Thank for the load of disappointment.
Comment: Your choice of course. I just gave my idea. When you consider the total cost of decent materials for a deck the addition of an extra row of posts would be a small addition. The support beam that you would attach to them is already what you are talking about trying to mount to the house structure. It also appears that you live in a winter freeze zone so you already need to consider deep footings to support the deck posts. These could probably just be round holes with the thick cardboard tube forms filled up with concrete. Just dig down to the level that the house footings were placed.
Comment: @ Maple:  Maybe we could meet on chat.  Then we can have a much quicker exchange.  I really don't think it is gonna be as complicated as it may sound. I have build over a hundred decks and yet to see one that couldn't be attached or supported. I look or a pic of the joist box ends from inside could settle the question. As I said earlier, I have never seen anything but some sort of solid rims setting on a sill or top plates of knee walls.
Comment: Honestly, it appears the easiest and most affordable solution is reinforcing the engineered rim and remove siding as necessary and attaching the ledger just below the finish deck level, allowing for decking thickness. Hang the deck joists from the ledger with joist hangers. You father in law objects to spending money on frivolous requirements, yet this is exactly what he is asking you to do. Anything other than this approach is going to cost you more money, solely because he has an irrational objection to this legitimate approach.
Comment: you need some adjustable scaffold feet!
Answer: First off let me quote the American Wood Council PRESCRIPTIVE RESIDENTIAL WOOD DECK CONSTRUCTION GUIDE (which I recommend looking through).

MANUFACTURED WOOD I-JOIST: Many new homes constructed with wood I-joists include 1" or thicker engineered wood products (EWP) – such
  as oriented strand board (OSB) or structural composite lumber (SCL)
  including laminated veneer lumber (LVL) – as band joists (or rim
  boards) that can support the attachment of a deck.
  However, some older homes might be constructed with band boards that
  are too thin (less than 1") to support a deck. In such cases, a
  free-standing deck or a full plan submission is required.

You asked:

Question 1: I assume that if these clips are still being produced that it must be code assuming proper lag screws and spacing have secured the ledger board?

Yes.
It doesn't matter how the joists have bearing, whether it is a hanger, ledger, or beam. Just use the appropriate hardware/fasteners for the application.

Question 2: If I were to cut away the masonry and lag into the 2x6
  studs for the ledger support, would this be a sturdy code compliant
  ledger board?

Back in the "good old days" when homes were balloon-framed they would use let-in ledgers or ribbon boards to support the floor framing (which was also nailed to the studs, though). So, it is doable, but you may need special permission or even engineer's drawings/specs for approval (might also include blocking and extra hardware). Either way, I would say it is not exactly ideal, but at least you could use structural screws like Ledgerloks or GRKs, since they are smaller diameter and self-drilling and not nearly as likely to split the studs.

(balloon-framed, ribbon-board (ledger) and fire-blocking)

And finally, if applicable, if I were to cut away the masonry to mount
  a ledger board, I would be worried about water possibly penetrating
  and getting behind the decorative masonry.

You would have the same worries doing the same thing when cutting out siding for a ledger. Flashing to the rescue :)

Question 3: What is the most appropriate way to prevent water from
  getting behind my ledger board or the masonry?

Again, flashing is the most important part (aside from proper fastening). You have to lap the flashing properly with the building paper. Just remember the direction water flows so the surfaces have to lap the same way a shingle would. See image below for a good illustration of proper flashing. You can also read this short article describing some of the flashing material choices.

After all that, I would say your best bet is to verify your rim board thickness and do a normal ledger. The second best option is a free-standing deck.
Just be careful there is a lot of bad advice and information on the internet!
Comment: Thank you this is a great answer! I worried about splitting studs as well but this laglok product seems good for this.
Comment: Sorry, I posted this late last night and looking at it again with fresh eyes, the balloon frame image is using a ribbon-board and not a let-in ledger as I had it originally labeled. So don't go around calling that a let-in ledger when it is really a ribbon-board! Also I added an image of joist-bearing options.
Comment: So I guess then it is still considered acceptable to toenail joists in?  I personally would feel more comfortable with hurricane clips or other strong ties.  Delays in the landscaping mean that I won't be able to start this project until probably summer, but I should get a chance to talk with my old project manager about the type of rim board used (manufacturer, thickness, etc...) to determine my options.  It will be a month or two but I will be sure to report back and let you know what I find out.
Comment: Just thought I would update with new information after talking with the PM.  He said it is 1 1/4" engineered rim and acceptable for mounting a ledger board to. If his crew were building the deck they would stagger in a W formation with every top fastener being a carriage bolt and every bottom fastener being a lag screw going into the sill and they would space them apart every 16".  He said that all the local code enforcers in this region find this more than acceptable.
Comment: Great news! Although you can't carriage bolt unless you have access to the back of the rim from the inside, i.e. cut open the drywall if it is finished interior space. You could ask the inspector to "okay" lags or ledgerlok-type screws.
Comment: toenailing is acceptable when the deck is attached to the house (and probably with traditional ledger). I assume this is so all the joists don't roll over in the same direction. You can prevent that with toenailing + solid blocking, but really it is better and easier to just use the hurricane ties like you figured.
Comment: Also, if you consider the free-standing route and are worried about footing depth due to this being a new construction, you might want to check these bad boys out: http://www.pinfoundations.com due to it being a new construction you might know what is in the ground and not as worried about hitting large rocks or boulders.


20A home circuit breaker stuck in "TRIPPED" state

Question: If I understand correctly, then the proper circuit breaker reset procedure is TRIPPED->OFF->ON (ie you can't reset the circuit breaker by going directly from TRIPPED->ON state). However, the circuit breaker immediately springs backs into TRIPPED state if I try to move it into OFF state (or just as well ON state).

So my questions are:

Does the fact that I can't even get it to stay in OFF state proves that problem is in circuit breaker (opposed to unresolved short that trips circuit breaker again)?
If so, then are there any tricks to reset it?
Or, is this a sign that it is time to replace the circuit breaker?
Comment: How much physical space is present around the breaker box here?
Comment: > can't reset breaker > posts picture of Zinsco panel
Comment: Is this panel of yours a standalone breaker panel with the meter somewhere else, or a *meter main* device with the meter socket in the same box as the panel, by the way?
Comment: @ThreePhaseEel 1) the box is approximately 15" diagonal. 2)The meter is ~3 feet away from this box and attached to the same wall (meter is not in the box). Will post a picture.
Comment: @HansSolo -- no need for a picture of the meter.  I take it there is enough space around the box that installing a taller breaker box there wouldn't be an issue?
Answer: Uh oh, you have a Zinsco.  Replace the whole breaker box!
The configuration of the breakers in the box, with 2 half-width sections taking up the full height of the box, and "Type V38" markings visible on the breaker labeling, says that this breaker box is one of the dreaded Zinsco firestarters, and cannot be relied upon to turn power off for work or protect your house from overloads, as evidenced by the fact you found a breaker stuck in the tripped position.  It needs to be replaced wholesale with a currently supported breaker box -- a 100A, 30 space main breaker panel would not be out of place here, and this size is readily available from multiple manufacturers.
For those that don't know...
The Zinsco breaker and loadcenter line, while considered innovative for its time, turned out to be nearly as hazardous as the infamous FPE (Federal Pacific Electric aka Fire Protection Eliminated) breakers and panels.
Like FPE, the Zinsco breaker-to-busbar contact design is burnup-prone compared to competitors (while not as bad as Stab-Lok, it's still awful in that it's prone to failure under sustained low overloads).  Furthermore, Zinsco breakers have shown significant miscalibration and jam rates in independent testing, and also have displayed a propensity for internal arc "blowout" failures during trips that can damage the breaker internally, or even hole the breaker casing.  Finally, it is possible for Zinsco breakers to simply fail to shut the power off when switched off -- this "disconnect failure" mode is shared with FPE, and makes service on circuits "protected" by a Zinsco breaker unwise at best.
All of this adds up to one verdict: Zinsco (aka Kearny or GTE-Sylvania-Zinsco, not to be confused with GTE-Sylvania-Challenger panels that are essentially BR lookalikes) breakers and panels belong in a smelter, not in a building.
Comment: Thanks for raising attention about Zinsco. Now I am considering to replace the whole circuit breaker box. Trying to figure out whether such DIY project is legal in my area and whether it would be beyond my skill set.
Answer: If you cannot move the circuit breaker actuator from the "tripped" position to the "off" position and have it stay there then there is certainly something wrong with that breaker.
You should definitely plan to replace that breaker with a new one as breakers do fail from time to time. But first you should evaluate what it was that caused the breaker to trip in the first place. If that is comprehended and corrected then install the new breaker.
Comment: It's a Zinsco, the *whole box* is bad and needs replacing.
Comment: One of house occupants now admitted to have turned on 12A electric heater. We have sink disposal on the same branch. Maybe both were turned on at the same time.
Comment: @HansSolo -- that could explain the breaker tripping, at least.  It sounds like it was damaged internally during the trip (contra UL 489, and what people expect from their circuit breakers, although unsurprising for a Zinsco), which is why it's misbehaving at this point in time.
Answer: While that indeed is obsolete/dangerous Zinsco panel, that particular circuit breaker stuck in "tripped" state does not even have outgoing wire. So it has been already out of service for a while and does not explain why electricity disappeared on few power outlets. Especially. since rest of circuit breakers in this panel are still in ON state.
Comment: If it's been that way for a while, it probably failed back then and the wire moved to a spare, but that still doesn't change the fact this you are staring at a pyromaniac, not a piece of electrical safety equipment...
Comment: @ThreePhaseEel You are right, there is at least one more circuit breaker that is stuck in ON state in this panel, but not delivering power. And possibly there is a splice in the house that connects two branches from two different circuit breakers. Will post that in another question.


How to auto reload or refresh a Web Page at a Specific given time?

Question: I am working with a API. The problem is this API gives results once EVERY 60 Seconds. Its programmed to deliver results 06 Seconds past every minute.
So that would be 00:06 (MM:SS), 01:06, 02:06 so on....
I would like to have 2 seconds margin so I want to Refresh my page at 08 Seconds paste every minute.
I am not a programmer but learning, the solution below works perfectly for my use, but I guess its not the correct way to do?
Is it any other shorter way to achieve the results from this code:
<?php

$nowis = date('s');

if ( $nowis == "00" ) {$reload = "08" ;}
if ( $nowis == "01" ) {$reload = "07" ;}
if ( $nowis == "02" ) {$reload = "06" ;}
if ( $nowis == "03" ) {$reload = "05" ;}
if ( $nowis == "04" ) {$reload = "04" ;}
if ( $nowis == "05" ) {$reload = "03" ;}
if ( $nowis == "06" ) {$reload = "62" ;}
if ( $nowis == "07" ) {$reload = "61" ;}
if ( $nowis == "08" ) {$reload = "60" ;}
if ( $nowis == "09" ) {$reload = "59" ;}
if ( $nowis == "10" ) {$reload = "58" ;}
if ( $nowis == "11" ) {$reload = "57" ;}
if ( $nowis == "12" ) {$reload = "56" ;}
if ( $nowis == "13" ) {$reload = "55" ;}
if ( $nowis == "14" ) {$reload = "54" ;}
if ( $nowis == "15" ) {$reload = "53" ;}
if ( $nowis == "16" ) {$reload = "52" ;}
if ( $nowis == "17" ) {$reload = "51" ;}
if ( $nowis == "18" ) {$reload = "50" ;}
if ( $nowis == "19" ) {$reload = "49" ;}
if ( $nowis == "20" ) {$reload = "48" ;}
if ( $nowis == "21" ) {$reload = "47" ;}
if ( $nowis == "22" ) {$reload = "46" ;}
if ( $nowis == "23" ) {$reload = "45" ;}
if ( $nowis == "24" ) {$reload = "44" ;}
if ( $nowis == "25" ) {$reload = "43" ;}
if ( $nowis == "26" ) {$reload = "42" ;}
if ( $nowis == "27" ) {$reload = "41" ;}
if ( $nowis == "28" ) {$reload = "40" ;}
if ( $nowis == "29" ) {$reload = "39" ;}
if ( $nowis == "30" ) {$reload = "38" ;}
if ( $nowis == "31" ) {$reload = "37" ;}
if ( $nowis == "32" ) {$reload = "36" ;}
if ( $nowis == "33" ) {$reload = "35" ;}
if ( $nowis == "34" ) {$reload = "34" ;}
if ( $nowis == "35" ) {$reload = "33" ;}
if ( $nowis == "36" ) {$reload = "32" ;}
if ( $nowis == "37" ) {$reload = "31" ;}
if ( $nowis == "38" ) {$reload = "30" ;}
if ( $nowis == "39" ) {$reload = "29" ;}
if ( $nowis == "40" ) {$reload = "28" ;}
if ( $nowis == "41" ) {$reload = "27" ;}
if ( $nowis == "42" ) {$reload = "26" ;}
if ( $nowis == "43" ) {$reload = "25" ;}
if ( $nowis == "44" ) {$reload = "24" ;}
if ( $nowis == "45" ) {$reload = "23" ;}
if ( $nowis == "46" ) {$reload = "22" ;}
if ( $nowis == "47" ) {$reload = "21" ;}
if ( $nowis == "48" ) {$reload = "20" ;}
if ( $nowis == "49" ) {$reload = "19" ;}
if ( $nowis == "50" ) {$reload = "18" ;}
if ( $nowis == "51" ) {$reload = "17" ;}
if ( $nowis == "52" ) {$reload = "16" ;}
if ( $nowis == "53" ) {$reload = "15" ;}
if ( $nowis == "54" ) {$reload = "14" ;}
if ( $nowis == "55" ) {$reload = "13" ;}
if ( $nowis == "56" ) {$reload = "12" ;}
if ( $nowis == "57" ) {$reload = "11" ;}
if ( $nowis == "58" ) {$reload = "10" ;}
if ( $nowis == "59" ) {$reload = "09" ;}

echo $nowis;
echo " - ";
echo $reload;

?>

<meta http-equiv="refresh" content="<?php echo $reload; ?>" >

I dont want to use any Java or other.. Please advice me a better way with PHP?
Thank you
Comment: I would suggest using JavaScript and even AJAX depending on how much you want to refresh.
Answer: How about this?
Just some math instead of if.
<?php
$nowis = date('s');
$reload = (8 - $nowis + 60) % 60;
echo $nowis;
echo " - ";
echo $reload;
?>
<meta http-equiv="refresh" content="<?php echo $reload; ?>" >

This looks like what your big long if statement was doing.  And it appears to give the same results.
Answer: This code should help you:
$now = date('s');
$reload = (8 - $now) %  60;
header("refresh: $reload; url=page.php");

Comment: I also recomend you to check jQuery out.
Answer: use Timers of javascript:
// refresh 60 seconds later, only once,
var timeoutId = setTimeout(new function(){location.reload() }, 60 * 1000);

// clear the setTimeout, so that it won't refresh if not yet,
clearTimeout(timeoutId);

// refresh every 20 seconds, repeatly,
var intervalId = setInterval(new function(){location.reload() }, 20 * 1000)

// clear the setInterval, so that it will stop refresh frequently,
window.clearInterval(intervalId)

Comment: he said no other language :D
Comment: @OzanKurt in that case, you can config the interval in .properties file, and load it via php, send to client-side via json, so that javascript can read it too, then javascript could control according to the params, and php has ability to modify the property. By the way, I think the asker can be more flexible, only use one way or one language don't really benifit.
Comment: I think you're right. But what if he/she doesnt know that much js?
Comment: @OzanKurt if he/she is doing web programming ... javascript is quite necessary,  would be helpful,^^
Comment: Yes, js makes things much easier.


how to level out basement cement crack

Question: I plan on laying some vinyl planks onto cement but there are some cracks from leveling in the cement and with the new flooring you can "feel" where the cement barely sticks up at the crack.
Wasn't a problem with carpet but is now.  These are hairline cracks but you can feel them underfoot.
This seems to be a slightly different question than some out there because it's how to both "level and fill" at the crack location.
Answer: What we ended up doing is grinding down the "lip" of the highest edge with an angle grinder cement grinding wheel
.
Then we filled the hole with "self leveling" concrete sealant.  Sikaflex for instance.  Over fill a bit, then after it dries, came back and scraped off any sealant that was poking up with a 4" big blade scraper.
Comment: I use masionary grinding wheels for cracks that are offset as I have knocked the inserts out of single row surfacing grinders but never had trouble a double row like you show.

how to level out basement cement crack


Teestfor a player riding minecart named "car"

Question: How can I testfor a player riding a Minecart named "car" with scoreboards in version 1.10?
Comment: Found something, doesn't work: `/testfor @a {RootVehicle:[{Entity:{id:"MinecartRideable",CustomName:"car"}}]}`
Comment: I'd just like to point out that you probably don't want to be using `/testfor` to do this.  It's useful in some very specific circumstances, but since you're asking how to do a relatively straight forward test, you're probably going to want to use scoreboard tags instead.
Answer: When riding an entity, players will have that entity inside a RootVehicle compound tag as such:

(source)
This means that you can test players on a named minecart like this:
/testfor @a {RootVehicle:{Entity:{id:"MinecartRideable",CustomName:"car"}}}

Or, with a scoreboard tag so you can target them later:
/scoreboard players tag @a add InCar {RootVehicle:{Entity:{id:"MinecartRideable",CustomName:"car"}}}

Comment: Hey, that's what I had and it didn't work, the command I wrote in the comments didn't work either.
Comment: @RudolfL.Jelínek The command in my answer works as expected from what I've seen. The problem with the command you commented seems to be that you have an unnamed compound tag in a list rather than a named compound tag.


`git difftool -d` get 'file does not exist' error on mac

Question: I am trying to use command git difftool -d for a folder diff.
The command get diff list successfully (show in FileMerge.app). But when I try to open each diff file. I get file does not exist error.
Output log:
$ git difftool -d
merge tool candidates: opendiff kdiff3 tkdiff xxdiff meld kompare gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare emerge vimdiff

Image:

I am using git version 126.96.36.199 on mac OS X 10.9.
Thanks.
Answer: The problem is the opendiff command returns which causes difftool to delete the temp directory and all the files you are comparing.  After a ton of searching I found this, basically you have to keep that opendiff running until FileMerge exits.
change your git config to:
[diff]
    tool = opendiff
[difftool]
    prompt = false
[difftool "opendiff"]
    cmd = /usr/bin/opendiff \"$LOCAL\" \"$REMOTE\" -merge \"$MERGED\" | cat

found the answer here:
https://gist.github.com/bkeating/329690
Comment: The proposed configuration does not solve the problem in my environment (as *opendiff* still returns almost immediately). I opened [a question](http://stackoverflow.com/q/33955712/1027706) where I tried to detail the steps taken and the results.
Answer: Prevent opendiff from exiting by outputting to less or using sleep
E.g put following line to .gitconfig
[difftool "opendiff"]
        cmd = /usr/bin/opendiff \"$LOCAL\" \"$REMOTE\" -merge \"$MERGED\" | less


Creating a shared object from C code for R

Question: I have a C code and I want to call the functions in it from R by creating a shared object and dynamically loading that object in R. The code to create a shared object in R is:
R CMD SHLIB myfile.c

And the general way is:
gcc -c -Wall -Werror -fpic myfile.c
gcc -shared -o myfile.so myfile.o

I am wondering whether there is any difference between the two myfile.so files created by those different pieces of code in terms of usage in R. The sizes of the two files are quite different (17KB and 32 KB), which confused me.
Answer: When you do
gcc -c -Wall -Werror -fpic myfile.c
gcc -shared -o myfile.so myfile.o

you miss several flags that R CMD SHLIB takes, like optimization flag -O2, debugging flag -g, etc. Why not have a look at what is printed to the screen when you do:
R CMD SHLIB myfile.c

Flags I have mentioned have influence on code size, as well as efficiency of your compiled code. The resulting object code is different. You can use disassembler:
objdump -d myfile.so

to check (binary) assembly code as well as code size. You can also use
gcc -S -Wall -Werror -fpic myfile.c

to check (readable) assembly code. You will see huge difference whether you use -O2 or not.

Godbolt compiler explore is a GUI interactive assembler. You type in C code on the left-side window, then choose compiler, compilation flags, output display configuration, etc, then the assembly code will be produced on the right-side window. This is super convenient for HPC code writers to evaluate and optimize their code. For you, this is a handy approach to compare the difference in object code.


Open Compute Server needs 220v to run. Can I use voltage convertor to run it?

Question: So I bought an open compute kind of server  and it runs on 220 volts and 700 watts power supply. So I decided to purchase a voltage converter(Transformer)  My question is is this stable and will I have problems in the future? Please excuse me I am kinda new to this thing.
I also forgot to mention that I hooked up a UPS which gives 865 watts between the power source and the converter which is connected to my server.
Until now, I am afraid to turn it on, I am afraid of fire. So please I need your help Thank you
This is the transformer I bought
this is the server
Comment: Have you checked to see if the power supply is 120/240 switchable?  If not, can't you just replace the server power supply with a 120v unit? I can't imagine that would be more expensive than buying a transformer.
Comment: Where do you live? What is the model number of the transformer?
Comment: I live in Pittsburgh Pennsylvania which the voltage is 110
Comment: i already bought a transformer, and I don't know where to find a power supply for that, I mean can I buy a power supply that is 700 watts the same as the server's power supply and add to the server? Will it function as intended?
Comment: @longneck I edited the question with links
Comment: Looks like a standard server power supply to me.  Those run around $20 for a solid used one and should be really straight-forward to replace.
Comment: Okay I will look into it and return the transformer
Comment: You might want to look at the labeling on the power supply. It might be dual voltage. Must mainstream power supplies are.
Answer: In the US, you have easy access to 240 volts. Look up a tutorial on how to add a circuit for a dryer or an electric stove.
Comment: I don't know man but it sounds interesting but I will just go for the power supply one since it is easier for me to grasp on.
Answer: You have already purchased the transformer and it is rated 300W above your load you should have no problem running off the transformer in step up mode 110 to 220.
I would look at your computer closely as many supplies these days are rated for universal voltage ~100 to 230 volt range. Some have switches 110/220 if you have a switched supply on 110 and connect to 220 it will let the magic smoke out.
I did this on a system at work built it in my office with 110 then hooked it up in the system (it was 220 fed) and forgot to move the switch oops.
Comment: some UPS's output are not true sine wave so it would depend on the model. The best way to find out would be to plug it in and unplug the ups. A good one should be fine but a less expensive may not like the inductive load and shut down
Comment: lol so you forgot to switch the input selector accordingly at the transformer side. I will keep an eye on that. The thing is that I read a lot of reviews about these transformers which let me to believe that someday while I am not home something will go wrong with the transformer and burn the house down
Comment: I used them at Hewlett Packard here in the US when working on systems that were only 220v going overseas. I never had one fail but did blow a fuse a few times when I overloaded them.
Comment: Yeah man they are very unreliable and dangerous if not careful. I will just go for the power supply and save myself a headache.
Comment: First off, transformers aren't dangerous if you know how to work with them. Second, and as mentioned in the answer above by longneck, in a US system the voltage comes off of the powerlines into a transformer. This utility transformer converts the high voltage down to 240V. We simply split the circuit with a neutral to get 120V. It's so counterproductive to transform this back up to 240V when you already have it in your panel. It might require an electrician to install the outlet, but it's the best answer. - a second transformer like you have will rocket up your power bill as well.
Comment: I agree transformers are not dangerous.Transforming from 110 to 220 will not change your power bill. Power in the primary is approximately equal to the power in the secondary.
There are only very minor losses in transforming up or down. Having an electrician put in a 220 line would cost over 500 plus permits and that is if it is an easy location to get to.
Comment: So it is better for me to get a power supply right?
Comment: I have used step up transformers for years and never had a problem. My 1 problem was with a 110-220 power supply that I set to 110 to format and configure then forgot to turn the power supply back to 220 plugged it in to a 220 feed and all the magic smoke came out.
Comment: okay what about the ups will it function as intended if used with the transformer?
Comment: I exaggerated a bit to stress the point that I don't think it's worth it to buy the transformer and run the inefficient route. Sure power is roughly equal on both sides, though I was referring to how the transformer itself will draw power. Running a voltage that you already have seems easiest, but it all comes down to where that line is going.