Dealing with multiple keyboard layouts (OSX vs. Windows) - windows

I have two computers; one MacBook Pro and one desktop PC running Windows. For various reasons I prefer writing code on the MacBook, while I keep the desktop PC mostly for gaming and entertainment purposes.
Since I've gotten so used to programming on an OSX keyboard layout, I often find it cumbersome to start working on something while I'm on my Windows computer. And since I'm ridiculously lazy I also find it cumbersome to get my laptop out of my bag so I can switch to using that instead. This usually results in me not bothering to do much work while I'm on my desktop (which depressingly enough is most of my evenings).
I guess I'm looking for a way to quickly enable an OSX keyboard layout in Windows. I'd also like to run Ubuntu in a VM on Windows, and use the OSX keyboard there as well.
Possible?

You can use Microsoft Keyboard Layout Creator to create a custom keyboard layout on Windows that mirrors the Mac OS one.
Ubuntu has an infinitely flexible and impossibly complicated keyboard layout system called XKB, which has limited documentation. Ubuntu probably already has all the data for the Mac keyboard layout you want stored among the hundreds of files in /usr/share/X11/xkb/, but figuring out how to load it will drive you crazy. You might have luck asking about this on Ask Ubuntu or the Unix stack exchange.

You could have a look at Synergy, using your Mac keyboard on both the PC and Mac.

Related

Raspberry Pi Pico on Windows?

Is it possible to work at Raspberry Pi Pico using Windows 10? My question specified is: do I have to install any Linux distro, for example Raspbian, to be able to work at it? Do I also need to use SD card to work with it?
Just want to receive feedback, cause I'm confused and also kinda new to embedded systems
I may share my experience so far, I'm not an expert and this list does not claim to be complete at all.
The pi pico can be programmed by using
Picomite Basic (found here: https://geoffg.net/picomite.html) which doesnt need anything installed on the PC except a terminal program (I am using Tera Term)
MicroPython (never used it myself, afaik Thonny - found here: https://thonny.org/ is the preferred IDE )
C/C++/ASM This is what I am using, the SDK is available for Windows, Linux and Raspbian (MacOS maybe too?), an excellent guide on how to install it and how to use it is found here: https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
Arduino The Pico can even be used as an arduino device too, a good point to start is here: https://github.com/earlephilhower/arduino-pico
Keep in mind, that the interpreted languages (basic and python) are easier to handle (no big SDK or framework need to be installed on the PC, copying code to the pico is a relative easy step) but at a cost of speed. If you need a lot of cpu power, compiled languages are by far the better choice
To answer your questions, yes, no, and no. You should be able to get going on Windows 10 with just the raspberry pi pico and a micro USB to USB cable.
I got started with mine this weekend - seeing the on-board LED blink finally made me so happy.
The official getting started guide pointed me at this script for getting started on Windows.
It set up docs, examples, visual studio code, and more for me. Between its README and chapter 9 of the getting started guide ("Building on MS Windows"), I was able to get my little light blinking :)
Good luck to you on your embedded journey!
As an alternative, an in addition to #Tommylee2k's helpful insights, you can develop and run Python software for a Pico with absolutely no software needing to be installed on a Windows PC.
At its most basic level, you press the BOOTSEL switch and insert the Pico's USB cable into your PC, and the few MB of space on the Pico appear in your Windows File Explorer as a USB disk drive.
You then write your microPython software using any text editor you prefer. All these general purpose modules are available. And all these Pico-specific modules are available.
You then copy (drag and drop) your Python script to the Pico disk drive and save it as main.py.
The Pico will then run that script on every subsequent power-up. Of course you can re-attach the Pico to your PC and edit the file at a later date.
That is adequate and simple enough. If you want a REPL and friendly editor and console logging and other developer-friendly features, you can install Thonny for free and code more effectively but it is not actually absolutely necessary. It's a bit like driving a car without ABS, without an automatic gearbox and without aircon - it can get you from A to B without problems but there are easier and more comfortable methods.

Real keyboard simulation

I'm trying to write a bot for a game. The huge problem I'm running into for months now is keyboard simulation
My operation system is windows 10. On that OS when trying to simulate key press via code, windows 10 adds to the request a flag. This flag indicates that this key press came from a program, and not from the hardware.
That way games can check the user input and filter all of the key simulated presses
My game does that, So I have been trying to find a way to pass that.
VirtualBox
The first solution is to run the game from a virtual box. Then running the bot program from the host. When focusing on the VirtualBox the program is being able to simulate the keyboard with no problem. (That is because VirtualBox does the hard word of "fooling" the OS that the key simulation came from the hardware)
This way works pretty well, but the main disadvantage is that running the game on VM is super slow, the game flips a lot. I have tried multiple tutorials on how to get the best gaming results on VM but nothing really worked..
Real keyboard simulation
That idea came to me lately. I wonder if I can somehow fool my PC to think the key press came from the hardware.
Maybe using male to male USB cable and connect the PC to itself, then do real keyboard simulation (sending keyboard requests from one side of the USB and get it through the other).
Or maybe some other way to achieve that?
What I don't want
There are some solutions that will probably work, but I don't want to try:
Changing my OS to windows 7: I don't want to lower my OS version
Dual boot of windows 7: I have tried before dual boots for linux, it was hideous to make it work
The question is, do you have any idea how to simulate keyboard on such way that Windows 10 won't add the "rat" flag
Option 1
Windows driver is exactly what you need. In your windows driver, create an keyboard HID device, then send your keys though this HID device.
Pros:
Total software
Cons:
Complicated
Windows driver should be signed (you must pay for it), or you must set your windows 10 to Test Mode to load driver
Option 2
Use Arduino to send your keys. ref to https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
Pros
Easy to learn
Cons
Hardware is required.
you need driver level key simulation.
because some games made by D3D game engine will blocks system level simulation like winAPI or pykeyboard.
I used use the driver level key simulation to cheat in games, like lol, cs, pubg...
so , if u use python, u can use keyboard, mouse,
ctypes, etc.
if u are win32 platform, u can use winio and pydamo.
they all are driver level simulation.
ps: If your game blocks one solution, please try another one.
keyboard
ctypes simulation
Considerations about other solutions here:
I tested most of the solutions (python libraries, mostly):
keyboard
ctypes simulation
However, only two seem to work. It is by simulating a virtual environment or using an Arduino.
Both solutions require much effort in terms of installation and programming (maybe you can get the Arduino code, but, you will have to deal with Arduino code)
Solution:
A possible workaround I tested and worked quite well is using keyboard software such as Hyperx NGENUITY to save a macro. The macro is associated with the button in the keyboard software that the keyboard hardware executes. This way, the keyboard will work as an Arduino.

Hardware essentials for workstation using Macbook Pro [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
My windows workstation is pretty well setup. I dislike laptop keyboards because everybody has their own setup of the keys, and since I am a touch typist, I use a standard QWERTY 101 keyboard.
I am just starting Mac development.
What is a good keyboard to get for my shiny new Macbook Pro?
What should I look for in a good monitor for the Macbook Pro?
Is there a KVM switch that I can use to flip between the Macbook Pro and my Windows workstation?
I would get a standard US Layout Apple Wired Keyboard, a Dell 27" ultra sharp monitor... They use the same panels as the Apple plant for a fraction of the price.
as for a KVM switch, no experience with that, you can however install windows on your mac using bootcamp (recommended).
Our setup for developing with a MacBook Pro consists of:
Griffin Elevator (http://www.griffintechnology.com/products/elevator)
Apple Keyboard with Numeric Pad (http://store.apple.com/us/product/MB110LL/A)
A Dell monitor with Display Port such as the UltraSharp U2211H (http://accessories.dell.com/sna/products/Displays/productdetail.aspx?c=us&l=en&s=dhs&cs=19&sku=320-9271)
A Mini DisplayPort to DisplayPort cable from Monoprice (http://www.monoprice.com/products/product.asp?c_id=102&cp_id=10246&cs_id=1024606&p_id=6006&seq=1&format=2)
Any mouse you feel comfortable with
Keyboard: I use the Apple keyboard with numeric pad (wired). I have tried other keyboards, but they tend not to work very well when I run Windows under BootCamp. (It sounds like you have a separate Windows machine, though, so this might not be a problem for you.) I have tried several keyboards and have found that only the Apple keyboards work really well with the Mac. The primary reason for this is the quick key shortcuts
Monitor: I use a Dell Monitor 24" my with Mac. It has multiple inputs including a DisplayPort, which will work well with your MacBook Pro. You just need the displayport adapter from MonoPrice (www.monoprice.com).
As an alternative, you mention the use of a KVM. In my experience, cheap KVMs are cheap and do not work well. I have used KVMs from several manufacturers. The one I have found to be the best is one from Avocent (www.avocent.com). They have KVMs that are called SwitchView Desktop KVMs and they work very well. They have ones that work with DVI ports. You can get a DVI adapter for your MacBook Pro.
If you are looking for a keyboard/mouse combo, I would recommend the Logitech products. I recommend the ones that are NOT Bluetooth. They can be plugged into the Avocent KVM and work perfectly.
Hope this helps!

Windows: Is it *possible* to create a (virtual) video card driver?

i want to create a virtual monitor. The way this would work is that the virtual monitor would appear in a window on my desktop. As far as Windows knows it is just another monitor.
It occurs to me that it would, as a practical matter, have to be done as video card driver (i.e. rather than the video going out a wire to an LCD panel, it would go into another window on the desktop).
Does what i'm describing sound, technically, possible? (from a DDK point of view)
Note: i can't use a virtual pc, because no virtual PC has resolutions high enough for my needs. Also because it's not what i asked for.
Note: My reasons are unimportant, but i can make some up:
i want to test my application under high-dpi settings (288dpi)
i want to create a monitor that my iPad can VNC to
the family TV runs on the main monitor
the hijacker is monitoring the bus, and he'll blow it up if he suspects we're getting the passengers off
i'm trying to expand the limits of human knowledge and understanding, for the good of all man-kind
I'd say it's definitely possible, since that's what virtualization tools do for their guest utilities, but I wouldn't be able to tell you how in details. I'd suggest looking at the VirtualBox guest driver code as a starting point:
http://www.virtualbox.org/browser/trunk/src/VBox/Additions/WINNT/Graphics
(This is released under GPL as far as I'm aware.)
It's definitely possible, see for example the UltraVNC mirror driver. But I don't know of any virtual video driver that makes source code available.
I have been searching for something similar and I found a nice solution: spacedesk. You can download it here: http://spacedesk.ph/
In windows, it installs an extra monitor, which you can open in a browser or a viewer. Enjoy!
Don't know about Windows, but for X (Linux) there is Xvfb (X Virtual Frame Buffer), which is quite a useful thing.

Doing coding in Linux through a virtual machine on Windows VS partitioning

I already have experience with setting up virtual machines, running them and other minor tasks. Im a gamer, so I wont get rid of windows (for now at least...) but I do want to be a great programmer and to be involved with the Open-Source community.
Id like to know if its a good idea to do my programming in linux through a virtual machine, vs giving it a partitioned section of the HDD. Id like to know about performance pros and cons and functionality.
All responses are appreciated, thanks in advance.
The type of programming I intend to dive into :
Android Dev, Web Dev, Desktop Dev...More Android and Web right now though.
So im looking at C#,C,C++,Java,PHP,HTML,MySQL...Off the top of the dome.
I do web designing as well, so dreamweaver is added as an "essential". But im sure I can do dreamweaver files and upload them to the server after programming in Linux...Right?
And any info on IDE's in Linux for the above mentioned are appreciated, but i would prefer going the coding route and understanding the essence of whats happening "under the covers"
Thanks to all for reading, I appreciate it.
Hope this isnt confusing :S
There is an easier solution..
I still have to use Windows for Symbian programming so I use a Wubi and Ubuntu to provide my double bout into Linux..you deploy Wubi uses a large file and thus no need to worry or mess with creating a partition..
I have used it for 18 months with no data loss and no worries..
There is also another tool called andlinux:
http://www.andlinux.org/
It uses colinux to run Linux as a program inside windows..
A couple things:
If you're using an IDE, there's no point to coding on Linux. Linux is nice for programming because the command line tools are awesome. Netbeans and Eclipse both work fine on Windows. All you'd be missing is makefiles (which IDEs don't use anyway).
Using a virtual machine would be annoying (working with the window and stuff) and slow. Try AndLinux if you want to have Linux running in Windows. It sets up X and Pulseaudio for you, so all of your programs will appear to be native. It's basically a way to run Ubuntu as a Windows service (all Ubuntu packages for your architecture are installable).
If you just want the fun of Linux command line programs without access to all of Ubuntu, cygwin is smaller and might be faster.
If by "Dreamweaver files", you mean HTML/PHP/CSS, then yes, you can just upload them to the server. As far as I know, the only ASP or ASP.net compatible server is Microsoft's, but why use that anyway?
EDIT: SO didn't give me enough space in the comments to answer your question..
AndLinux and Cygwin are basically just better ways to do your "virtual machine" idea.
Cygwin adds a posix layer to Windows (basically everything you need to compile Unix/Linux/BSD programs). This means that you can generally take a Linux program and just compile it on Windows and have it work. They also have repositories, but in my experience, the cygwin installer is slow and hard to use.
AndLinux runs the Linux kernel as a Windows service, giving you a similar experience as running it in VirtualBox/other virtualization programs. However, it also sets up X (the graphics layer for Linux) and PulseAudio (a sound system that lets you run sound over a network), so that when you run Linux programs they act and sound like native programs. I also like AndLinux better because you have access to all of Ubuntu's programs, and apt-get is easier to use than cygwin's installer. Also, if you use AndLinux and later to decide to go 100% Linux, you're basically already using it that way.
What I'm getting at is: If you want to run Linux in a virtual machine, don't. Just install AndLinux. It will be faster and it's much easier to work with (since everything is just a normal window).
Here's an example of the difference:
Screenshot of AndLinux: The program in the bottom right corner is running in AndLinux. Notice how it just looks like a badly themed Windows program? Compare that to something like this, where you have another desktop in a Window.
And still.. there's no reason to virtualize Netbeans. It's a native Windows program and you can gain nothing and lose a lot of speed.
If you're interested in Android development and you want to use Linux, then I would recommend you do your development in Eclipse. Eclipse is available for Linux and if you get Ubuntu then Eclipse is amazingly easy to install. I used VirtualBox + Ubuntu + Eclipse for several projects I worked on. If you decide that Linux is not for you and your project was in Eclipse then you will have no problem switching back to Windows since Eclipse is available for both operating systems.
The ONLY problem I had was the screen size on the virtual machine... if you have a big screen and you use a virtual machine then you might get limited to a fraction of your actual screen resolution. It's very easy to install Linux on a second partition, so I would just recommend you go with a second partition if you want to fully utilize the size of your monitor.
My setup is sort of the opposite: I run Linux as my main OS, both at work an at home, and I have Windows in a virtual machine. On a modern computer with adequate memory the performance of development tools is not a problem. I work with Visual Studio in the virtual machine, and I have seen few performance issues. (But note that this is on a fast computer, and that you may need more memory than otherwise, since you are running two OS:es at the same time. On an old computer with less memory it can become unbearable.)
Dual-boot, where you have to restart the computer to switch OS, doesn't work well for me. It takes way too much time to switch, and really need to switch back and forth. Having Windows in a window works much better for me, and you can maximize that "Windows window", so it looks like you're just running Windows.
One thing you may want to look at is to have Linux running in a VM, then configuring Samba to allow the host to network-mount pieces of the Linux filesystem so that you can operate using Windows tools, and have Linux running the server processes (e.g., httpd). Alternatively, I'm sure that there are shell extensions for using FTP, NFS, or SSH/SFTP servers from within Explorer, but I've not looked at any for a long time.
If you should happen to need to use graphical Linux tools then you can use the X server found in cygwin for that.
The downside of this plan is that Samba can be a bit tricky to configure, but you get to use the Windows tools you're already familiar with.
I had no issues running Ubuntu via VMWare. You can easily switch to full screen mode anytime. Strongly recommended. One shortcoming is that Linux will not be exposed to the full potential of your hardware. Compbiz Fusion failed to work as a result.
Given that you're a gamer, I'm thinking your machine should be fast enough to run Linux in a VM. Best to try out the VM before messing with disk partitions.
I use physically separate machines to run Linux and Windows (and MacOS X). This means that I don't have to reboot to do something different, and each system gets the full power of the hardware.
Disadvantages: more desk space used, more time and money spent maintaining hardware (though if you do a rolling upgrade, this is mitigated - Linux runs most happily on not-quite-new machines). Doesn't work so well if you like carrying laptops around.
Be aware that VMs universally don't give you full graphics acceleration. This can be a non-issue (many programs must cope with Intel GMA anyway), or it can be a showstopper. Your choice.

Resources