adobe and other apps with scaling on high dpi displays fix

Fixing Photoshop Scaling Issues on HighDPI systemI found a great blog that talked about manifest files.. but this one is WAY easier.

Right click the exe file you are trying to run that is giving you weird scaling issues.

Select “Compatibility”
Look for a setting “Override high DPI scaling behavior. Scaling Performed by.. And if the box is checked. uncheck it or if it is unchecked, check it. In photoshop where menus etc were tiny, I needed to check it. WIth another app where the fonts where HUGE I had to uncheck it.

 

Finding the directory that python is installed in.. (CENTOS) and using it for virutalenv’s path

assuming the following command returns a version of Python 3 you can find where it is installed using the sys object..

(see if python3 has been installed.)
python3 –version

In my case it returns

Python 3.5.0
If python 3.x has not been installed.. http://ask.xmodulo.com/install-python3-centos.html

to find the location of the install for use with Virtualenv..

at the $ type python3 (this should launch python3)

import sys
sys.executable

The import line gives you sys lib functionality and sys.executable will tell you where it is.. now you can create a virtual environment that uses python3

e.g. $ virtualenv -p /usr/local/bin/python3 py3envtest

will generate a virutal env for python3 in the directory of py3envtest.
to activate the virutalenv you will need to change into the directory of py3envtest and execute the following command

. bin/activate

Done! not typing python should automatically run the version that virtualenv had specified.

 

How to make a Webapi based project return gzipped json.

If you do have access to change applicationHost.config, you can enable GZip compression for JSON responses by adding the appropriate mime type to httpCompression -> dynamicTypes

The ApplicationHost.config file exists in the following directory  C:\Windows\System32\inetsrv\config

 

<httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">

<scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />

<dynamicTypes> ...

<!-- compress JSON responses from Web API -->

<add mimeType="application/json" enabled="true" /> ...

</dynamicTypes>

<staticTypes> ... </staticTypes>

</httpCompression>

How to get the value from a WinForms.Listbox not databound.

I was faced with a bit of a challenge this morning. In WebForms getting the value of the selected item in a ListBox is pretty straight forward. However what i found in WebForms as a different story.

To complicate the process I was adding items to the listbox using the items collections add method.

If you look at the Intellisence for LIstBox.Items.Add expects a single argument of Object. Typically this is just the Text that is going to be displayed. However adding an item where the Text shows one thing, but the value is a different thing requires a slightly different approach

Step1. Add a new Class to your project that has a Text and Value property.
e.g.
private class ListItem
{
public string Text { get; set; }
public string Value { get; set; }
}
Step 2. When initializing the form, set the ListBox’s DisplayMember and ValueMember properties to your classes properties
e.g.
listBox1.ValueMember = “Value”;
listBox1.DisplayMember = “Text”;
Step 3. Add your items e.g.
listBox1.Items.Add(new ListItem(){ Text = “some text”, Value = “some value”});
Step 4. Read the value on the item being selected.
in the Listbox’s SelectedIndexChanged event read the value by casting the Listbox’s selected item as your custom class and then reading the property you need.
e.g. ((ListItem)listBox1.Items[listBox1.SelectedIndex]).Value

 

Hopefully that helps..
 

Does IE Suck or is it every other browser..

Having been in IT for over 20 years I have definitely heard my fare share of Microsoft Bashing. Usually by people who have NO CLUE what they are talking about. Of course web designers – who know php and MySQL because it was free when they were in college – are probably the worst of the bunch.

What I have found is that no only do I see less issues with IE than other browsers, but it is actually faster. Every time apple updates their phones and browsers I cringe. This has caused hours of extra work due to their inability to follow standards. ON android browsers in tablets and phones, drop down menu’s don’t work (at the time of this writing) Even when the menu exposes a standard <a tag>

Anyway.. today I was looking at statistics gathered by google on our public website and was amazed at what the two fastest browsers were.

1. Edge (Microsoft 10) and
2. IE (stop the cheering or leering .. check out your site if you don’t believe a random test of 38,000 page views.)

What really blew me away was that Edge was nearly 50% faster than chrome (the next fastest non-Microsoft product) – I even prefer the debugging tools in IE10 (yeah 11 and edge suck – they are more like chrome – a giant step back)

 

“Fng Virus” removal tricks

So last night a buddy came over with a laptop that had developed a nasty cold that day (lunchtime)

The well designed little beast was quite liberal with his system – it had turned off emergency restore and would also grab hold of IE and cause it to do something that ate up CPU cycles and consumed HUGE amounts of RAM. This last bit of course was making it very difficult to do things like run anti virus software.

What I ended up dong was booting to safemode, and removing traces to the virus there.

I did find out that there is another cool options built into Windows today.
“System Configuration”

from the run command type “msConfig”
on the selective startup – deselect Load System Services and Load startup items, then in boot Choose Safeboot – with minimal selected.

Having the network adapter disabled would also be a good idea.

Go to the Services tab and check  “hide all Microsoft services” and press disable all (stopping services that should not be running from starting up) now reboot and remove the nasty bug – if you find a virus writer – tell some Muslim extremist group they insulted their prophet to ensure they have a slow and painful death!

 

As a note a friend I work with suggested the following utility

http://www.bleepingcomputer.com/download/combofix/

It is called combofix and is supposed to be good at fixing stuff that nothing else can get rid of, but it comes with a warning. It should be a last resort. It can render the OS useless and force you to do a reinstall of everything including the OS. However, it will also remove stuff that the others leave behind and give you back a system that would otherwise force you to reinstall anyway.

 

How to calculate religious holidays in SQL

I found this a few years ago, but like most things forgot where i found it. The whole thing is written to exist in a SQL database.

Holiday Calendar Calculator

It adds a table that references the holidays you want to generate and also a table valued function that takes a date range as it’s arguments. The output is all the holidays listed in the table by date and title.
For more usefull SQL (and other) scripts and help, visit http://tek-tips.com

Validation of viewstate MAC failed. FIXED!

Have you ever experienced the good old “Validation of viewstate MAC failed.” Machine Key etc…

I had read a lot of different posts on various sites relating to this but just recently found a soulution. Most posts tend to hint at the Machine.config file (which you cant touch in a hosted environment) and or altering the Pages key of the web.config – which is most likely not going to work.

The trick is to actually add and encryption key to your web.config, it should be added to the system.web section.

The following link will create a machine key “Key” for you.

http://aspnetresources.com/tools/machineKey

it should look something like..

<machineKey    validationKey="A7981C75ECB13C5626FBCD54CBC22786DD54480D5D37B3C9B19CE15CAE400F46E66F59BEF98BB82D3FBB4E4C500F697A1BFFBF43D184E240B589435DC66D3732"   decryptionKey="27186006621354C85C4154DB9F38410C8AA935322816E4C0E574EF0063DA3006"   validation="SHA1"   decryption="AES" />

Paste that into your web.config and say good bye to that annoying error!!

Rob

Android codes

Android is going to be very popular now these days.Android market provides wide range of applications for fulfill all your needs.As a Android user all you need to know about Android OS. So here i m sharing with you some secret code. This code helps you to access some hidden option which are generally not given as default.Plz use this code carefully because if you are unaware of these advanced settings then it may be harmful for your phone.

*#*#7780#*#*   – This code is used for factory restore setting.This will remove google account setting and System and application data and settings.
*2767*3855#   -  This code is used for factory format, and will remove all files and settings including the internal memory storage. It will also reinstall the firmware.
*#*#4636#*#*   – This code show information about your phone and battery.
*#*#273283*255*663282*#*#*    – This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo.
*#*#197328640#*#*    -  This code can be used to enter into Service mode. You can run various tests and change settings in the service mode.
*#*#7594#*#*   -  This code enable your “End call / Power” button into direct poweroff button without asking for selecting any option(silent mode, aeroplane and poweroff).
*#*#8255#*#*  -  This code can be used to launch GTalk Service Monitor.
*#*#34971539#*#*    -  This code is used to get camera information.Plz avoid update camera firmware option.
WLAN, GPS and Bluetooth Test Codes:
*#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#*   -  WLAN test (Use “Menu” button to start various tests).
*#*#232338#*#*    -  Shows WiFi MAC address.
*#*#1472365#*#*    -  GPS test.
*#*#1575#*#*    -  Another GPS test.
*#*#232331#*#*   -  Bluetooth test.
*#*#232337#*#    -  Shows Bluetooth device address.
Codes to launch various Factory Tests:
*#*#0842#*#*   – Device test (Vibration test and BackLight test)
*#*#0588#*#*    – Proximity sensor test
*#*#0*#*#*    -  LCD test
*#*#2664#*#*   -  Touch screen test
*#*#2663#*#*    -  Touch screen version
*#*#0283#*#*   -  Packet Loopback
*#*#0673#*#* OR *#*#0289#*#*    -  Melody test
*#*#3264#*#*    -  RAM version
Code for firmware version information.
 *#*#1111#*#*   -  FTA SW Version
*#*#2222#*#*   – FTA HW Version
*#*#44336#*#* – PDA, Phone, CSC, Build Time, Changelist number
*#*#4986*2650468#*#*   – PDA, Phone, H/W, RFCallDate
*#*#1234#*#*  – PDA and Phone

Great tips on searching google!

http://www.hackcollege.com/blog/2011/11/23/infographic-get-more-out-of-google.html