Sunday, September 22, 2019

Add 4K 60Hz mode to Linux

60Hz mode not displaying in your Display settings? No problem!

We need two commands, cvt and xrandr.

Step 1: Calculate a Modeline for xrandr using cvt:
user@machine:~$ cvt 3840 2160 60
# 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
Modeline "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync
Step 2: Use xrandr to see which output your display uses:
user@machine:~$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 16384 x 16384
DisplayPort-2 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 640mm x 360mm
We can see it uses "DisplayPort-2".

Step 3: Create a new Mode with xrandr and give it a descriptive name like "3840x2160@60Hz":
user@machine:~$ xrandr --newmode "3840x2160@60Hz" 712.75 3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync
Step 4: Add the new Modeline to your display with xrandr:
user@machine:~$ xrandr --addmode DisplayPort-2 3840x2160@60Hz
Step 5: Test if it works! Go to display options and choose ~60Hz. If it doesn't work or you see some artefacts we need to calculate a Mode with "reduced blanking".

Step 6: Calculate a "reduced blanking" Modeline for xrandr using cvt:
user@machine:~$ cvt 3840 2160 60 -r
# 3840x2160 59.97 Hz (CVT 8.29M9-R) hsync: 133.25 kHz; pclk: 533.00 MHz
Modeline "3840x2160R"  533.00  3840 3888 3920 4000  2160 2163 2168 2222 +hsync -vsync
Step 7: Create a new Mode with xrandr and give it a descriptive name like "4K60Hz":
user@machine:~$ xrandr --newmode "3840x2160@60Hz-R" 533.00 3840 3888 3920 4000  2160 2163 2168 2222 +hsync -vsync
Step 8: Add the new Modeline to your display with xrandr:
user@machine:~$ xrandr --addmode DisplayPort-2 3840x2160@60Hz-R
 Step 9: Profit! Now you should have a working 4K resolution with 60Hz(or more).

Friday, October 9, 2015

Computer waking up from sleep and you don't know why?

Controlling which devices will wake the computer out of sleep:

If your computer keeps waking up from standby/sleep, here is how to figure out what causes it.

1) Open a command prompt with Administrator privileges and run the command:
powercfg -devicequery wake_armed
2) You see a list of devices that have permission to wake up your computer. You can disable each of these devices one by one until you find the one that is waking up the computer by running this command with the name of the device listed in quotes:
powercfg -devicedisablewake "device name"
Once you find the one that is causing problems, you can re-enable the others:
powercfg -deviceenablewake "device name"
You can get a more detailed list of devices capable of waking up your computer with the command:
powercfg -devicequery wake_from_any

I had my LAN-card causing the problem, and got it disabled by running this:
 powercfg -devicedisablewake "Realtek PCIe GBE Family Controller"
You may have a problem with your mouse moving a little, which causes the computer to wake up. You can either turn the mouse upside down, or disable it's ability to wake up the computer for good.

Thursday, October 23, 2014

Passing all parameter arguments to irssi alias

$*        expands to all arguments passed to an alias
 
so for example, making alias /self which sends all arguments passed to it to myself using network 'Network' :
/alias self /msg -Network $N $*

Adding left navigation menu bar to Sharepoint 2010 Web Part page

Open your Web Part page in Sharepoint Designer.

Step 1 – Remove CSS
Around line 34 you will find a code block like the one below

<SharePoint:UIVersionedContent ID="WebPartPageHideQLStyles" UIVersion="4" runat="server">
<ContentTemplate>
<style type="text/css">
body #s4-leftpanel {
display:none;
}
.s4-ca {
margin-left:0px;
}
</style>
</ContentTemplate>
</SharePoint:UIVersionedContent>


Delete this code block.


Step 2 – Remove the overrides for the left column

Further down you will find three lines which prevents the left column for rendering.

<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>

Remove all three lines.

Step 3 – Save the page

Wednesday, September 24, 2014

How to format Date / DateTime fields in Sharepoint 2010 using custom xsl and ddwrt formatting

When getting Calendar items, use ddwrt:FormatDate to format Date/Time as your liking:

from <xsl:value-of select="ddwrt:FormatDate(string(@EventDate),2057,3)"/>
to <xsl:value-of select="ddwrt:FormatDate(string(@EndDate),2057,3)"/>


Also, you can use custom formatting with this:
<xsl:variable name="monthy" select="ddwrt:FormatDateTime(string(pubDate), 1033, 'MMMM')"/>


More Links to help you:
Available locales
Custom date formats
MSDN DateTime custom format
ms:format-date Function
XSLT Date format dd-MMM-yyyy using ddwrt:FormatDateTime
ddwrt FormatDate and FormatDateTime
How to format date value in SharePoint Data View Web Part – xslt

Monday, September 22, 2014

Weird flickering effect with HTML/CSS

Just found out that when using in-page popups, using this CSS breaks the page so that it starts flickering/strobing constantly sometimes :D
html {overflow: auto;}

So word of advice: don't use it :) Or use it with some other parameter than "auto".

How to configure Firefox to automatically reuse the login credentials like IE

You need to enable NTLM Configuration within FireFox. It is very simple to do and should solve your problem:

Open Firefox and type “about:config” in the address bar. (without the quotes of course)
In the ‘Filter’ field type the following “network.automatic-ntlm-auth.trusted-uris”
Double click the name of the preference that we just searched for

Enter the URLs of the sites you wish to pass NTLM auth info to in the form of:

http://intranet.company.com,http://email.company.lan

Notice that you can use a comma separated list in this field.