Tuesday, 31 July 2018

vba - Worksheet_Change to Worksheet_Calculate

I need help re-writing my original code question to a worksheet_calculate. I am new and trying hard to learn but am stuck on this one.


When I use Calculate in place of the change, the code throws numerous errors. I read some comments about adding a sub routine but I can't get it right.


Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140722
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("AD:AD,AB:AB"), Target)
xOffsetColumn = -1
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub

linux - IPv6 tunnel from behind an ISP-level NAT


Previously, at a different location, I set up a Hurricane Electric IPv6 tunnel, which worked fine, allowed me to access IPv6 only sites and test the native IPv6 connections on my remote servers.


However, I'm now in a new location where the only practical internet access is via a 3G mobile phone network. This network gives me NAT'd addresses like 10.104.NNN.NNN. The dynamic IPv4 address that it reaches the internet with is shared between hundreds/thousands of users of the mobile network. As that IPv4 address doesn't route to (just) me and is unpingable, I can't use a Hurricane Electric tunnel with it.


Sixxs's AYIYA tunnel looks like it could be a work-around, but they refused my application for a tunnel without giving a reason (which is fair enough, for a free service).


So, from behind a large-scale NAT network (that I have no control over and can't open ports for), is there any other tunnel technology, and tunnel provider, that is usable? I'm running Ubuntu Linux 12.04.


I do have a remote VPS that has native Ipv6, so I'd consider tunnelling to that, if there's a technology I could install at both ends, if I'm not able to use a tunnel provider. The server is also Ubuntu 12.04.


A workaround for short tests of the IPv6 connection of sites would be the sixxs gateway, but long-term a tunnel would be better. The ISP here isn't likely to change their NAT anytime soon, nor is there any viable alternative, so something that works through that is what I'm looking for.



Answer



Have you tried the tunnels provided by gogoNET? If you register an account, you'll have a address block allocated to you per tunnel server.


You may have to compile the client yourself if you distribution don't have it as a package.


windows - I accidentally made my new hard drive (the non system drive) my primary partition

When installing a new hard drive, I accidentally formatted it using 'Disk Management' and set it up as my primary active partition, even though it isn't the system drive. Then, when I restarted my machine, Windows wouldn't boot, citing a missing or corrupt SYSTEM folder.


How do I re-enable the system hard drive as my primary active partition? Any help would be greatly appreciated.

internet - Is it possible for many domain names to share one IP address?


Is it possible for many domain names to share one IP address? For example, www.xjtl.com, www.fmie.com, sdmfl.com, etc.


Hundreds of domain names share just one IP – when you do a DNS query for each of them, the same IP is returned.


Are there any laws or Internet rules that disallow this?



Answer



Yes, this is an extremely common practice. It is called a Shared Web Hosting:



In name-based virtual hosting, also called shared IP hosting, the virtual hosts serve multiple hostnames on a single machine with a single IP address. This is possible because when a web browser requests a resource from a web server using HTTP/1.1 it includes the requested hostname as part of the request. The server uses this information to determine which web site to show the user. When you register/purchase your domain name on a particular "registrars name server", your DNS settings are kept on their server, and in most cases point your domain to the Name Server of your hosting provider. This Name Server is where the IP number (currently associated with your domain name) resides.



Any time you have a website that you look up its IP and when you type the IP directly into the browser and you got a different website, you just encountered Shared Hosting.




In fact, this website here uses it. Ping superuser.com or stackoverflow.com and you will get 198.252.206.16 for both. If you type that IP address into your browser, it will not work and you will get an error saying the site does not exist because it did not have a hostname to check and see which site it should serve you.


How do I configure Home Sharing in iTunes 9?


How do I configure the new "Home Sharing" feature in iTunes 9? I've enabled turned on Home Sharing in iTunes 9 on two computers (both running Mac OS X) on my home network, but I don't see how to tell it to share specific playlists or media types.


Update: To answer tronpxs's question, iTunes is authorized to the same account on both machines.


Let me elaborate on my question. I'm not having a problem with Home Sharing. I just don't see how to configure it. I couldn't find anything applicable in the iTunes online help. And it doesn't look like Apple has added anything on Home Sharing to http://www.apple.com/itunes/how-to/ yet.


Update #2: It looks like Jon Connell is right. I can manually copy individual files from the shared computer (which is new to iTunes 9), and after selecting the shared computer I can press the "Settings..." button on the bottom right to bring up this dialog box:


enter image description here


However there doesn't appear to be any way to sync just the media in specific playlists.



Answer



iTunes 9 appears to allow you to share the libraries between two computers provided that the purchased items in the libraries are authorized for the same apple id.


Assuming that all of the machines have itunes 9 and have the same apple id authorized to access the purchased items:


First machine - start Home Sharing. iTunes will ask you to enter the account password and then turn on Home Sharing.


Second machine - start Home Sharing. iTunes will ask you to enter the account password and then turn on Home Sharing. You should see the first machine's library with a Home Icon.


It may take a while to share the contents of the library but eventually you can expand the first machine library and see all of the files.


The Home Sharing feature makes use of BonJour so if you haven't been using BonJour for anything else, make sure that your firewall allows mDNS traffic (multicast, UDP - port 5353 or 5354) and make sure that it allows the iTunes data on port 3698 as well.


You can check boxes to enable automatic sharing of purchased content and iTunes will offer to sync purchased content at that point. This didn't work for me, but as an alternative you can also view just the items from the first library that are missing from the second library and manually copy them.


Its not clear that the playlists can be automatically synced.


For versions of iTunes before 9, myTuneSync provides functionality that will periodically sync all of the items in iTunes except applications but including playlists. It will also sync bits of metadata like the skip count, play count, last play time, etc.


hard drive - Asus FX504 BIOS boot issue

I recently bought an Asus FX504 laptop which I wanted to upgrade the HDD + Intel Optane with my SSD.


After removing both the hardware above and installing my SSD, I am entering the BIOS each time I turn on the laptop.


The SSD has an OS already from a previous laptop, and I also have a bootable USB pen with Windows 10 files so I can reinstall a fresh copy of Windows.


I have read people having the same struggle but I don't seem to find a solution.


Things I have tried/to be considered:




  • Disabled Secure Boot and Fast Boot however I am still unable to either boot from my HD or USB pen. (Unable to locate an option for CSM in "Boot" menu which I read should be enabled.)




  • The Boot menu is empty so I am seemingly unable to change the boot order.




  • Removed CMOS battery for a minute.




  • USB pen is fine as its being detected and bootable by another laptop.




  • Both SSD and USB is being detected in the BIOS main screen.




This is driving me mad! Any help is much appreciated. (Pictures to follow I hope


Goal: Boot from USB drive to re-install Windows.


Setup: Laptop: Asus FX504GD-E4673T BIOS: American Megatrends 312 EXISTING Hard Drive: HHD + Intel Optane NEW Hard Drive: Samsung 850 EVO


BIOS images: https://imgur.com/a/GuO7niq

Why is file transfer speed decreased when copying multiple smaller files?

Let's say I'm copying a portable apps directory from PC to an external HDD. An application.exe file is around 4 megabytes in size, but most other files are only tens of kilobytes in size, and most of those files take longer to copy/move than that bigger file having 4 megabytes.


Why is this?

cpu - What are "hyperthreading" and "virtual cores"?


I'm new in this computer terms. So anyone can explain to me what "virtual cores" and "hyperthreading" are at greatest detail a layman can understand?


People told me that virtual cores are imaginary cores acting like a physical core. If that is so, then can I make my AMD v105 processor single core a dual core processor?


Is it also possible to hyperthread my CPU? Are these functions built in?



Answer



Hyperthreading is a hardware feature and is not portable to other CPUs. Hyperthreading is essentially a duplication of the architectural and state hardware that surrounds the actual central processing units on a processor core.


It makes a single core processor look like a dual-core processor so that the data processing parts of the processor can be used slightly more efficiently. It is not as good as having another full processor performance-wise, but it does make slightly better use of the processor when under heavy use.


See this picture for a vague example, and if you want to read more then there's a good article on PCStats:


enter image description here


powershell - Using Advanced Parameter Sets in a Function with Multiple Unique Switches


I am using Powershell 4.0.


I am attempting to write a cmdlet and in this cmdlet I would like to use Advanced Parameter sets to have certain options available based on what parameter(s) is/are chosen. This particular function will essentially and eventually be Get-ADComputer but with the -SearchBase preprogrammed for certain options.


I have 6 parameters total. 2 are strings ($ComputerName or $IpAddress), 1 is an integer ($OULevel) and 3 switches ($ComputerOU, $AllCompany, $List).


I have a parameter set each for ComputerName and IPAddress, I would like the user to be able to input one or the other - I think I have this figured out its pretty simple. However, I would like $OULevel, $ComputerOU and $AllCompany to be exclusive meaning if one is used the other should not be able to be used. $List should remain available in each scenario.


I have tried different variations of the parameter sets to no avail. This is what my script looks like now, with some trimmed back:


    function Get-CompanyADComputer{
[CmdletBinding(DefaultParametersetName="ComputerName")]

Param(
[Parameter(Mandatory=$true,
ParameterSetName="ComputerName",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter a computer name to search in ActiveDirectory.')]
[Alias('Computer','CN')]
[string]$ComputerName,

[Parameter(Mandatory=$true,
ParameterSetName="IPAddress",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter an IP address to search in ActiveDirectory.')]
[Alias('IPv4Address','IPv6Address')]
[string]$IPAddress,

[Parameter(Mandatory=$false,
HelpMessage='Enter a number between 0 and 8. 0 is your current OU Container.')]
[ValidateRange(0,8)]
[int]$OULevel = 0,

[Parameter()]
[Switch]$ComputerOU,

[Parameter()]
[Switch]$AllCompany,

[Parameter()]
[Switch]$List
)

If you are curious our AD is organized by Location, then category (computer, user, groups, contacts, etc) and then it gets more granular in each OU below. This script detects your computer's OU and starts the search there. The purpose of $OULevel is if the user specifies a different number the search will start in a different OU and then search recursively. The purpose of $ComputerOU is to have your search go to the default Computers OU instead of the entire domain or your location. The purpose of $AllCompany is to have the search default to the entire domain instead of any other choice or OU.


Any guidance is appreciated. I can't seem to get the hang of this one without my script getting all convoluted.



Answer



I asked Don Jones the powershell guru on another forum and he gave me the info I needed. He explained it to me by saying this:



If I'm understanding the question, then you basically have to factor out all the possible combinations. Remember that a param can belong to 1+ param sets. So, you might have a set with Computername and OULevel, Computername and ComputerOU, and Computername and AllCompany. That's three. Then those three again for IPAddress. I know it's not elegant, but look at the help for Where-Object – not elegant, either, by far. List would then not belong to a set, which means it would belong to all.



That put me on the right track. So I actually ended up changing the way my cmdlet worked so my answer was reworked but now that I understand what to do I will update my existing example so I can be consistent and hopefully help.


    function Get-CompanyADComputer{
[CmdletBinding(DefaultParametersetName="ComputerName")]

Param(
[Parameter(Mandatory=$true,
ParameterSetName="ComputerName",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter a computer name to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="ComputerNameOULevel",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter a computer name to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="ComputerNameComputerOU",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter a computer name to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="ComputerNameAllCompany",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter a computer name to search in ActiveDirectory.')]
[Alias('Computer','CN')]
[string]$ComputerName,

[Parameter(Mandatory=$true,
ParameterSetName="IPAddress",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter an IP address to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="IPAddressOULevel",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter an IP address to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="IPAddressComputerOU",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter an IP address to search in ActiveDirectory.')]
[Parameter(Mandatory=$true,
ParameterSetName="IPAddressAllCompany",
Position=0,
ValueFromPipeline=$false,
HelpMessage='Enter an IP address to search in ActiveDirectory.')]
[Alias('IPv4Address','IPv6Address')]
[string]$IPAddress,

[Parameter(Mandatory=$false,
ParameterSetName="ComputerNameOULevel",
HelpMessage='Enter a number between 0 and 8. 0 is your current OU Container.')]
[Parameter(Mandatory=$false,
ParameterSetName="IPAddressOULevel",
HelpMessage='Enter a number between 0 and 8. 0 is your current OU Container.')]
[ValidateRange(0,8)]
[int]$OULevel = 0,

[Parameter(ParameterSetName="ComputerNameComputerOU")]
[Parameter(ParameterSetName="IPAddressComputerOU")]
[Switch]$ComputerOU,

[Parameter(ParameterSetName="ComputerNameAllCompany")]
[Parameter(ParameterSetName="IPAddressAllCompany")]
[Switch]$AllCompany,

[Parameter()]
[Switch]$List
)

Since I did not want those 3 parameters to be used with each other they had to belong to their own Parameter Sets so when you try to use one parameter, the others will not appear as an option. This greatly helps and simplifies the scripting process itself. Instead of allowing for the script it self to account for user input, the Powershell parameter sets eliminate those options.


The $List parameter does not have a Parameter Set Name because I want that parameter to be available in every scenario.


Windows command prompt - Get relocated user's Documents folder


I'm trying to write a simple batch script that copies some files from the %userprofile%\Documents directory. I'm testing the script on my machine, but after some failures I realized that I moved my user's data to a separate partition. Therefore, %userprofile%\Documents is empty, and (obviously) nothing is copied.


I already tried other environment variables such as %homedrive% and %homepath%, but they still point at the standard C:\...


Is there a way to find out the actual drive used for the user's data?


I'm using Windows 10.


Thanks!


EDIT


As pointed out by Ƭᴇcʜιᴇ007, I didn't move the user's data to another partition, but I just relocated the "main" folders (Documents, Videos, ...) to some corresponding folders on another partition: right-click on (e.g.) Documents, Properties, Path.


How can I find out the path of a Document folder which has been relocated in this way?



Answer



Unfortunately, there's not a simple environment variable you can check from a batch script if you've redirected this from the default path relative to your profile. You can see the full list of environment variables (including some undocumented) here:



http://ss64.com/nt/syntax-variables.html



Another thing to keep in mind is that folder redirection even allows you to move these to a network share. There doesn't have to be a "drive" you can use all; it might just be a UNC path.


The good news is the information you want is available in the registry at the following location:



HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal



There's a whole set of folders you can move around in that User Shell Folders key, but to read the My Documents folder here using Windows Batch looks like this:


reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal

On my machine this produces the following output, which may be more or less useful to you depending on what you need and how good you are with Windows Batch scripts:



HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Personal REG_EXPAND_SZ C:\Users\joel\Documents

You can also try vbscript:


Set wshshell = CreateObject("WScript.Shell")
Documents = wshShell.SpecialFolders("MyDocuments")

or Powershell:


[Environment]::GetFolderPath('MyDocuments')

This may eventually be available via bash on Windows, too (really!), but I haven't seen how to do it yet in a way that will be consistently accurate.


peripherals - How much does it wear an SD card to be frequently removed/reinserted?


My digital camera (a Sony α55) stores photos on an SD card. When I want to transfer these to my computer (a mid-2010 MacBook Pro), I have two options: use the USB cable to connect the camera to the computer, or use the computer's built-in SD card reader.


The camera's SD card slot is the standard click-in, click-out (spring-loaded) mechanism. My laptop has a simple slot into which the card slides with a little more resistance than the former (the card slides only about halfway in so it can be easily removed).


I notice that the card's contacts now have some shiny marks from one or both of these card slots:



Does this type of wear threaten to significantly damage the card? Should I avoid switching the card between slots frequently, to extend its lifetime?



Answer



Here is example of SD card specification: http://www.transcend-info.com/products/spec.asp?Stype=Spec&ModNo=376&flag=showdetail


Durability 10,000 insertion/removal cycles 7 years while you'll use it every day ( remove from camera, plug in to computer, remove from computer and plug in to camera ).


And remember, you can buy another card, but you can't buy(and easily change) USB plug in camera. USB plug is not very durable too.


carriage return - Convert CRLF's to line feeds on Linux


What's the best way to convert CRLF's to line feeds in files on Linux?


I've seen sed commands, but is there anything simpler?



Answer



Use this command:


fromdos yourtextfile

The other way around:


todos yourtextfile

These commands are found in the tofrodos package (on most recent distributions), which also provides the two wrappers unix2dos and dos2unix that mimic the old unix tools of the same name.


openoffice - Linked code, syntax highlighting, frames, and captions


I would like to do the following:



  • Link to external source code file (for example a SQL script in ASCII format)

  • Automatically apply syntax highlighting to the imported text

  • Place the highlighted text inside a frame

  • Add a caption to the frame

  • Frame contents must always contain the contents of the external source


Is this possible? If so, how? I could not find any examples.


Thank you!



Answer



A work-around is to embed an image of the source code:


Convert HTML to image


From the OpenOffice users mailing list:



I expect that you will not find a fully automated working solution for your specific problem.


...


In a perfect world I suppose that you will setup a repository which you can then poll. Your document must then be set to update itself based on the files. Come to think of it, perhaps you can wet something so that the document can generate itself in some specified format. Seems doable if you have the skills.



Finding the process that is using a certain port in Linux


I'd like to be able to find out which process is currently using a certain port in Linux. Is there any way to do this?



Answer



You have a couple of options:


lsof -i tcp:80

will give you the list of processes using tcp port 80.


Alternatively,


sudo netstat -nlp

will give you all open network connections.


linux - Different time specification formats with crontab


Say you want to run a job every 30 minutes on linux (or osx) using crontab. Sometimes I see the the sytax written like this:


30 * * * * /path/to/job


and sometimes I see it written like


*/30 * * * * /path/to/job


Are those two lines equivalent? (They seem to be based on my tests). Are there any differences?



Answer



They shouldn't behave identically. The first line tells crontab to execute the job 30 minutes past every hour (i.e. 5:30, 6:30, 7:30 ...), while the second line tells crontab to execute the job every 30 minutes (i.e. 5:00, 5:30, 6:00, 6:30 ...)


You can check the crontab man page for detailed instructions.


command line - OSX 10.10 select perl 5.16 instead of 5.18

I find that my OSX 10.10 comes with perl 5.16 and 5.18. By default, when I run perl, I am using perl 5.18. Is there way for me to run perl 5.16 when I run perl command?


admins-Mac-mini:~ bufferoverflow76$ ls -l /usr/bin/perl*
-rwxr-xr-x 1 root wheel 58416 Sep 10 10:06 /usr/bin/perl
-rwxr-xr-x 1 root wheel 35600 Sep 10 10:06 /usr/bin/perl5.16
-rwxr-xr-x 1 root wheel 35600 Sep 10 10:06 /usr/bin/perl5.18


admins-Mac-mini:~ bufferoverflow76$ perl -version

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for mor

Windows 7 search does not return results from indexed folders


I am experiencing this issue over and over again and I just cannot seem to find the answer. It doesn't make sense, but search simply does not return results from folders that certainly have these files inside. It's weird that this technology exists for more than 5 years now (it could be added to Windows XP as an addon), and they still haven't got it right.


My folder contains 10 image files with .png extensions. Two scenarios:




  1. Scenario 1: I exclude the folder using Indexing options. Search works.




  2. Scenario 2: I turn on indexing for this folder. Search does not work.




Of course, Agent Ransack returns results every time. When I check Advanced options for the Indexing options inside control panel, .png files are checked in the File Types tab, using the "File Properties filter".


What's the deal with this?


[Edit]


To clarify, this doesn't happen with all folders, but does with more than one. For the "problematic" folders, even *.* doesn't return a single result. I found some advice to clear the archive and readonly attributes for all files (doesn't make sense, but hey), but it didn't work.


Indexing status in Control panel is: Indexing complete. 100,000 items indexed. Folder is included in the list. File types list contains the .png extension (although it doesn't work with any filter, not even *.*).



Answer



Are you giving the indexing service time to index the files? This can take time. If you enable indexing and it doesn't work immediately, that seems like a sign to me that files are not yet put into the index. Search is searching the index, not finding the files, then thinking they don't exist.


When you turn off indexing, search is iterating through the folder and thus finding the files.


After you enable indexing, give your computer some time to index all your files. You can see progress in the "Indexing Options" dialog (search in Start for it).


If you still have problems:



  1. Open "Indexing Options"

  2. Ensure folder, or parent folder is listed there (and not excluded)

  3. Click Advanced.

  4. Approve UAC

  5. Under File Types tab, make sure the file extensions you want are selected.

  6. Back under Index Settings tab, look under troubleshooting, select "rebuild" and approve.

  7. Give the computer time to index. If you use the computer, Windows automatically slows down indexing so let it run overnight. The more files you have, the longer it will take.

  8. Try again and let me know if you're still having problems.


keyboard - Din5 plug adapter to USB


I have an old keyboard I'd like to use on recent devices (no PS2 port). But it's still on a 5 pin din plug. I tried to plug that in a Din-2-PS2 adapter and that in PS2-2-USB, but the keyboard was not recognized at all. Is there anything I have to consider here? Should it work, or is there a reason why it cannot work?



Answer



There is a simple reason why it does not work. The keyboard does not talk the USB protocol.


With most mice and keyboards you have the following options:



  • PS/2 mouse, using the PS/2 protocol. Works only in PS/2 plug.
    Does not work with a PS/2 to USB plug.

  • USB mouse, using the USB protocol. Works only via and USB plug.

  • A mouse understanding both PS2 and USB, auto-detecting which wiring is in use. This one will work both when plugged into a PS/2 port and when (with a convertor) plugged into an USB port.


The same is true for keyboards, though there are many more mice that support both PS/2 and USB than keyboards.


Now your keyboard has a old din plug. That means it is probably very old. Thus it is unlikely that it groks both the pre-PS2 din way and the modern USB method. This is why it fails.


If you want to get it to work you will need to add an active device which speaks both the old protocol and the new one. A mere plug which connects a few cables will no do.



Some nice picture to help me gain rep let the younger readers understand just what AT Din5, PS/2 etc is:


enter image description here


And some convertors with active electronics inside them. These will work, even for old PS/2 keyboards. I never tested them with an additional AT keyboard plug.


enter image description here


filesystems - Creating a FAT file system and save it into a file in GNU/linux?


I tell you my problem: I want to create a FAT file system and save it into a file so I can mount it in linux using something like:


sudo mount -t msdos  

Maybe I'm wrong and this cannot be done.


Anyway, the problem is this: I'm trying to create the file containing a FAT file system, and I'm running this command:


sudo mkfs.vfat  -F 32 -r 112 -S 512 -v -C "test.fat" 100

That, accordingly to the mkfs man page, will create a FAT32 file system with 112 rootdir entries, logical sector size of 512 bytes, 100 blocks in total, and save it into "test.fat".


But it fails, and the bash tells me:


mkfs.vfat: unable to create test.fat

What is going on? I think I am misunderstanding how mkfs works and how to use it. It is possible to write a filesystem into a file?



Answer



You have a file of 0 bytes in size. You can only create a filesystem on a file that has a specified size.


Here is how to do it properly:



  1. dd if=/dev/zero of=fat.fs bs=1024 count=SIZE how big do you want the filesystem; specify it as SIZE * 1024.

  2. mkfs.vfat fat.fs formats the file as the filesystem FAT.

  3. mount -o loop fat.fs /mnt mounts fat.fs to /mnt.


How do I access my modem's GUI when it's in bridged mode?


I wanted to try setting up my ActionTec P5001a DSL modem/router in bridged mode with a Linksys E2500 router for improved NAT performance. Switching the modem to bridged mode and the router to PPPoE worked perfectly, but now I seem to have no way to access the modem GUI if I want to do things like turn off its wireless antenna. (I was also thinking about disabling its NAT and DHCP functions, although are those are even relevant when it's in bridged mode?)


I've tried accessing it through the original IP address it used (192.168.0.1) both through the router and directly plugged into one of the modems Ethernet ports, but it seems to be no longer accessible through an IP address.


Is there a workaround for restoring the modem's default settings or another method to access the GUI besides through a browser using an IP address?


Thanks for any suggestions!



Answer




How do I access my modem's GUI when it's in bridged mode?



The few i've used, when in bridge mode, have no web interface or IP. (maybe yours does)


With those, you have to reset it(holding the reset pin) to get to the web interface and that takes it out of bridge mode. With yours, there may be other ways, but You can reset it too like that and get out of bridge mode and to a web interface.



no way to access the modem GUI if I want to do things like turn off its wireless antenna. (I was also thinking about disabling its NAT and DHCP functions, although are those are even relevant when it's in bridged mode?



With ones i've used, NAT and DHCP definitely aren't done when it's in bridge mode, I can't comment on others. I'd be surprised if it did wireless but you can check just to make 100% sure.. If you know the SSID (which you'd need to know to know how to connect to your own router when it's in regular mode), then look for that SSID to see if it's broadcasting. I'm sure you'll find that's off too, in any of these devices when in bridge mode. I suppose you could also prove that it's not doing NAT, with the tracert command tracert www.google.com and look for private IP addresses like 192.168 or 10.0 and you should only see one of them, if double NAT I suppose you'd see two.


Note


I have edited my answer, my previous answer said "When it's in bridge mode it has no web interface, no IP." I removed that since it's false for DDWRT and possibly false for some makes/models. The other answer says no , however that's not true either. I know this to be the case(the web interface turning off when in bridging mode), with some router/modem/switches, specifically with at least some, belkin ones e.g. http://forums.whirlpool.net.au/archive/869904 as mentioned here "if the belkin is correctly set to bridge mode you can not enter its gui web interface , as it is just a modem". It is true of DDWRT that you can still access the web interface.. Though quite likely that his particular make/model can, as the other answer claims to have used similar models to the OP, and says you can, i.e. you can with his. Though the other answer then talks about DDWRT which the OP may not be running. And the other answer doesn't specify what is going on with the OP's device if he has no access to his web interface.


FFMPEG image overlaying video: crash

I have a simple script that overlays a set of images on top of a video:


ffmpeg -y -i "basevideo.mov" -loop 1 -i "animation/middle_%2d.png" -filter_complex \
"[1:v]setpts=1.0*PTS[midAnimation]; \
[0:v][midAnimation]overlay=shortest=1[outvideo]" \
-map [outvideo] "out.mov"

When the script gets to a certain point, I get an "Error while filtering" message (in bright red), and then it hangs on the last frame (I need to "ctrl-c" a few times to exit).


This doesn't happen on all videos, but enough of them to be annoying.


My environment:


ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100

login - Is there a default password of Kali Linux OS after first installation?

I installed Kali Linux OS on my hard disk and set nothing as username and password. Now at the time of login it ask for localhost username and password. I tried root and toor as default but didn’t worked for me.

Monday, 30 July 2018

How can I have different text in the footer on every page of a Word document?


Is there an easy way to add different text in footer on every page of a word document?



Answer



I bumped into the same issue myself. Here's the Yahoo Answers post on the subject. The selected answer from that post recommends maintaining a separate section for each page:



Each header and footer is "linked" for each section. So if you make each page a separate "section" (i.e., section break instead of a page break), then you can unlink the footers and place a different footer for each section.


This is the only way I know that will allow the different footer for each page.



That's a terrible hassle in my opinion, so I decided to waive having different footers on each page. Sadly I'm not aware of any alternative neat solution in Microsoft Word. This is definitely a feature request: Microsoft - please add a checkbox for "Different Footer on Every Page".


linux - How to ping when behind a proxy?


I am using an HTTP proxy server to connect to the internet.


Because of that my pings are not working


ping www.google.com

says Unreachable Host


How can I configure ping to use the HTTP proxy?



Answer



In general you can't. ping needs a direct network connection on the IP level to do its work. A proxy works on a higher layer of the TCP/IP network model, where there is no direct access to the IP protocol.


You would need to somehow circumvent the proxy (change firewall settings, use a VPN, ...). Whether this is possible (and allowed) depends on your network configuration, but it's probably not possible.


As a workaround, there are many web-based ping services available (search for "web-based ping"). These will work.


Can I remove a RAR file's (known) password without recompressing the archive?


I know the password to the RAR file as I locked it myself. Is there a way to do this in WinRAR or an equivalent program? The only thing I knew to do was to extract it, then create a new RAR without the password.



Answer



Out of the box, no, you can not. Version 3 of the RAR file format (implemented first in WinRAR 2.9) encrypts the actual data itself, as well as the file headers (if requested) using AES-128 encryption. With just WinRAR, it is impossible to simply "remove" the password from an archive, since the data itself is encrypted with the password.


You could make a quick batchfile implementing a "remove password" feature, which could simply unrar the archive, and then re-compress the files without a password.




Technically, the data is compressed before being encrypted. This indicates that, given enough knowledge of the RAR file format itself, one could create a tool to AES-decrypt the datastream of the compressed files, and then save it into a new RAR archive. It should be noted, however, that this requires extensive knowledge of the file format itself.


Given the number of open-source tools that support password-protected RAR files (e.g. unar), one could learn how to do this by reading existing source code, and then using the decrypted, but still compressed, bitstream to generate a new RAR archive. However, this is far from a trivial task, as you would then have to rebuild the RAR header manually as well (or at least ensure the file format's compatibility).


Why are there no Micro USB to Micro USB cables?


Well, it's not like there are not. I found only 1 website selling micro usb to micro usb cables. But it seems they solder them themselves.


So why it is so difficult to get them?



Answer



It is likely for the same reason that USB A-to-A cables aren't common: host devices should always use different connectors than slave devices. The reason is that serious damage to the USB controller is possible if you plug two ends of a USB A-to-A cable to two USB ports on a host device (like into your computer). It is against the spec for a reason.


A-to-A cables (or cables as you describe) should not exist according to the spec, simply put.


Wildcards in Word

I know little of wildcard usage in word.


wildcards - case sensitive


TO FIND



enter mark ^13
tab ^t
any lowercase letter [a-z]
any uppercase letter [A-Z]
any letter [A-z]
any digit [0-9]
any no. between 6–9 [6-9]
any letter between d–k [d-k]
any word contains only letters ([A-z]@>)
any word contains only digits ([0-9]@>)
for grouping (for replace) ( )
any character(s) between ... (*)
any para ^13(*)^13

TO REPLACE



To replace first group \1
To replace second group \2
enter mark ^p
tab ^t

I want to know more about this. Can anyone help me?

How do I open a new Firefox window without toolbars, tabs, addins etc.? (shortcut rather than JavaScript)

I'm currently awaiting the arrival of a new pc and in the meantime am having to work on a small laptop screen.


I need to have two browser windows open at the same time, tiled horizontally. Is there a shortcut to open a new window without all the usual fluff that you get?

copy protection - How to create an image of DVD which is protected?

In a days I rented two multimedia DVDs from our local DVD Rental Shop. I wanted to copy them so that I could watch that film later, but to my big surprise I could not create an image of those DVDs nor copy files from them.


Is there any way to make a copy of protected DVDs?


Thank you!

motherboard - How to enable Onboard Graphics for a GIGABYTE B450 PRO

Today I ran into a problem with setting up my 2nd screeen. After searching I figured out that the onboard graphics has to be enabled in the BIOS (it is not showing up in device manager).


Using control + F1 in the BIOS won't show any new options and there is nothing saying PCIe or VGA ord Display settings.


Does anyone knows what it is called and where exactly it is located? I'm using a GIGABYTE AORUS B450 PRO updated with the latest drivers.

Are Windows file timestamps timezone aware?


I have a file that was modified either before or after it was sent to me.
However, it was created in a different time zone, so if the modification date is in the timezone of the sender, he was the last to modify it. If it is in my timezone, I modified it.


So, do you know if Windows file modification dates are timezone aware?



Answer



The time zone is an artefact of conversion from "instants" to a human-readable date-and-time in some calendar.


Computers do not like human-readable formats (not as much as humans, at least), so they usually store instants in a zone-neutral format. For instance, in the NTFS file system, time stamps are stored in UTC.


Hence, the file time modification is stored properly as long as whoever modifies it knows the current time. If your Windows system displays "13:19" and believes to be in the GMT-5 time zone, then it infers that the current instant is "18:19" in UTC, and writes as much in the NTFS entrails. However, if the OS displays "13:19" but believes to be in the GMT+3 time zone, then the OS is off by eight hours, even if, for the human looking at the screen, things seem fine.


Another point is that the file modification time is a property of the storage system in which the file is stored, e.g. a file system. When a file is "sent", then that time does not necessarily travels with it. Some archive formats (e.g. Zip) embed the file modification time along with the file. This does not apply to a file sent "as is", attached to an email, will not come with a file modification time.


power supply - where can I get cables for the Canon Mx310 (printer)



A friend of mine gave me a printer/scanner because he could not print with it anymore. the point is this thing has been lying in the cellar for quite some time now and the cables are missing. that is the power cable for my power plug (there are foreign ones included) and more importantly the connection to the computer. I have googled around for a bit and tried to get to a hotline,but my problem is: Where can I get those cables from?


Can anyone help me get a clue where to find those, where to ask for something like this?



Answer



That device uses a standard USB A-B cable which are available everywhere (perhaps even your corner pharmacy).


USB Connectors
"A" connector second from right
"B" connector last on the right


I can't tell from the photographs whether it uses an IEC C13/14 connector, but if it does (or another IEC connector) they are very common and any store (computer store or even some hardware stores) that carries replacement power cables should have them.


IEC C13


You may also need drivers.


charts - Excel trendline accuracy


This is a problem I have every once in a while, and it annoys me tremendously, beacuse I have always to recheck every trendline I get.


An example:


r       L
(mm)
30,00 97,0
60,00 103,2
90,00 106,0
110,00 101,0
125,00 88,0
140,00 62,0
148,00 36,7
152,50 17,0

Upon drawing a trendline (using 3rd order polynomial regression type) with r on the x axis, and L on the y one, Excel will give the formula


y = -0,0002x³ + 0,0341x² - 1,8979x + 128,73


with R² = 0,994. If I interpolate values using that formula for the same values of r as the ones the formula was derived from, I get


r   y  
(mm)
30,00 97,083
60,00 94,416
90,00 88,329
110,00 66,371
125,00 33,68
140,00 -17,416
148,00 -53,5912
152,50 -76,97725

which are quite different?


Why does this happen? What is the reason for it?



Answer



It looks like the formula that Excel gave has rounded coefficients. Using an OpenOffice calc routine for regression, I get this formula, which has a much better fit of the data:


y=-0.00017257x³+0.034107417x²-1.89794239x+128.7325785

Since the x³ term is so large, a small difference in the coefficient has a large influence on the predicted result.


macos - How to recover deleted text inside Mac OS X sticky notes


I use sticky notes to record some information. I deleted this info by accident. Is it recoverable?



Answer



As far as I know, the content for your stickies notes is stored in $HOME/Library/StickiesDatabase. If you are using Time Machine, or some other mechanism to do back-ups for your data that include this database, then you can try restoring an older version of this database to recover your data. Because of the way the Stickies app maintains its data (in a database), without access to some previous version of the database file, there's really no way to reliably recover Stickies notes.


boot - Bootable USB drive, but with files in sub folder?


I created a bootable USB drive which works as expected, but it creates a bunch of obscure files cluttering up the main storage space of the flash drive. Will it still work if I put these boot-files in a sub folder?


Also, is there a way to put multiple bootable images on 1 flash drive but be able to select which one when in the BIOS? For example, if I wanted to create a flash drive bootable version of Ubuntu and Acronis Rescue Media, 1 one physical flash drive, would this be possible?



Answer



You cannot move the obscure files to another location as the bootloader and subsequent programs that execute will look for it in the location they currently are in.


As for multi-boot take a look at YUMI – Multiboot USB Creator (Windows)


internet explorer 11 - IE open different tabs depending on day of the week


When I open IE on different days of the week, I want different tabs to be opened automatically.


I have to run different reports for work each day of the week and it takes a lot of time to open the 5-10 tabs to run the reports. It would be a lot faster if, when I open IE, the tabs I needed would automatically be loaded and ready for me to use.


Is there a way to open 5-10 different tabs, in IE, depending on the day of the week?


Example:
Monday - 6 Accounting pages
Tuesday - 7 Billing pages
Wednesday - 5 HR pages
Thursday - 10 Schedule pages
Friday - 8 Work Summary/Order pages



Answer



Rather than trying the brute force method, how about a work around?


Open up each set of tabs either in different windows or one set at a time and save all tabs to bookmark folders. Put the folders on the bookmark toolbar for ease of access.


On each day, right-click on the folder and open all tabs with one click.


You could put all the day folders into a top-level folder to save space if you want at the expense of an extra click to get to them.


If you really must go further, you need to write a program or script to drive IE. The easiest way is probably to write a PowerShell script.


macos - Mac OS X .bashrc not working


I have a one-line .bashrc file in my home directory:


alias countlines='find . -type f -print0 | xargs -0 cat | wc -l'

But it is not creating the alias. Why might that be?



Answer



In OSX, .bash_profile is used instead of .bashrc.


And yes, the .bash_profile file should be located in /Users/YourName/
(In other words, ~/.bash_profile)


For example, /Users/Aaron/.bash_profile


FFmpeg only merges 1 video when using -filter_complex


I am having problems concating multiple videos and using a thumbnail.


I have tried the following:


ffmpeg -i "concat:GX014185.MP4|GX024185.MP4" -i ./scaled.png -filter_complex "overlay=main_w-overlay_w-5:main_h-overlay_h-5" output.MP4

This will put the thumbnail in the correct place, but will only concat the first video GX014185.MP4


Using


ffmpeg -i GX014185.MP4 -i GX024185.MP4 -i GX034185.MP4 -i GX044185.MP4 -i GX054185.MP4 -c copy ../$(date +%Y%m%d_%H%M%S)_merged.mp4

Does not support a thumbnail, though I wish it did as it is so fast.


How can I concat videos with thumbnails?



Answer




The concat protocol should not be used with MP4. This is a common mistake. You can use the concat filter instead:


ffmpeg -i GX014185.MP4 -i GX024185.MP4 -i GX034185.MP4 -i GX044185.MP4 -i GX054185.MP4 -i scaled.png -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a][3:v][3:a][4:v][4:a]concat=n=5:v=1:a=1[vv][a];[vv]overlay=main_w-overlay_w-5:main_h-overlay_h-5[v]" -map "[v]" -map "[a]" output.mp4

The concat filter is most useful with filtering since it requires the video to be re-encoded (all filters require re-encoding).


Because you have to re-encode, due to the overlay, this can take some time.



Alternatively you could use the concat demuxer. First make a text file named input.txt:


file "GX014185.MP4"
file "GX024185.MP4"
file "GX034185.MP4"
file "GX044185.MP4"
file "GX054185.MP4"

Then run ffmpeg:


ffmpeg -f concat -i input.txt -i scaled.png -filter_complex "overlay=main_w-overlay_w-5:main_h-overlay_h-5" output.mp4

The concat demuxer is useful to concatenate videos without needing to re-encode (when used with -c copy), but it is also just as good when you need to re-encode (such as due to any filtering).


Because you have to re-encode, due to the overlay, this can take some time.


windows xp - How do you usually backup/restore a fresh OS installation (instead of reformat)?

I usually reformat my home PCs regularly after sometime but since it's time consuming I thought I could just restore an entire OS from a backup.


How do you usually take a "snapshot" of a fresh OS installation, save it to a DVD, then restore it later as if you've just reformatted?

Sunday, 29 July 2018

windows - Remote desktop - With other user still logged on?


Is it possible to use Windows remote desktop connection to connect to a Windows XP machine with a user already logged in and just view that users screen without logging them off?



Answer



If you log in as the same user as the already logged-in user, then you will take over their session. However, the user sitting in front of the PC will be disconnected from the session and see the login screen. If the user logs in again, then you will be disconnected and the user continued from where you left off. At no point is the user's session terminated - the programs continue running.


You can use Windows Remote Assistance, which is based on the same technology as remote desktop. It allows you to view and optionally control the current user's session without them logging off.


Another alternative is Remote Administrator, which I used heavily before remote desktop became widely available.


windows - What are my best options to recover data from a faulty SD micro card (used in an Android cell phone)?

My wife is having troubles while syncronizing the data from the SD micro card of her LG android phone to her portable pc. It keeps remaining stuck forever at a given photo (#21).


I tried to access it on our pc (windows 7 box) and... yes, there are some issues. Namely after showing the various autoplay options which kick in (will try to disable them to gain some time..), windows detects "some problem" and offers to try to fix it. I tried this (assuming it was some sort of fsck), and it didn't change the apparent behaviour of the card.


Then I went straight ahead to the only important folder (the pictures) and tried to copy it on my drive. After copying some, a not better specified input read error happens and all the remaining jpgs are corrupted.


I have tried with Piriform's Recuva or Zero Assumption Recovery: they don't go past the first read error and silently the drive gets unmounted.


Then I went with good old dd. Didn't recall the syntax for naming the devices under windows and don't have linux installed on this box: I burned a live dvd of ubuntu (oneiric ocelot) and booted into it.


The sd card appears under /dev/sdf1. dd conv=noerror if=/dev/sdf1 of=./android.img blocks after the (by now usual) 192M. I hoped that ubuntu came with ddrescue but it is not so.


Since (time for another question on a different SE) the PPPoE with this live dvd of ubuntu appears not to be working I have downloaded the .deb package via windows, and installed it. I mention this since - if needed - I don't have the full power of apt-get available, having to d/load the packages by hand.


Anyway, now ddrescue was installed. ddrescue if=/dev/sdf1 of=./android.img gave me some hope (at least a nicely formatted output) but in the end signalled errors after 192M.


The strange thing (which gives me some hope) is that by manually copying the files windows and ubuntu give me different valid files (besides a plethora of invalid jpgs). To be clear, suppose that I have three pictures pic1.jpg, pic2.jpg, pic3.jpg. Windows copies pic1.jpg and gives me corrupted version of pic2 and pic3. ubuntu copies pic2.jpg and gives me corrupted versions of pic1 and pic3.


Finally, even if dangerous, we put the card back in the phone. The Gallery application is unusably slow and gives errors at every step, but is able to actually show some of the pictures that are not accessible via windows or ubuntu. These are pictures and not the thumbnails.


A common characteristic is that everytime windows or ubuntu detect some error, they silently unmount the drive.


To recap:



  • I have manually recovered a subset of the pictures.

  • I have an img result from ddrescue, which doesn't seem particularly well functioning (I am unable to mount it under windows).

  • The cell phone appears to be able to access at least a part of the remaining pictures.

  • As you can imagine, I have a lot of fond memories to save from that stupid micro card (as in: pictures of our newborn).

  • So, can you suggest me something to try?


I would also like to know if I did mess with the filesystem by trying to mount it ? I assumed that it was some sort of vfat, which actually appears to be. The card was already not working (stuck forever while backupping) when I tried for the first time, but maybe I could have worsened the problem.

How can I keep multiple live/bootable ISO images on a single USB drive?


I am looking to create a USB flash drive that I can put multiple live CD ISO images on and select which boots from startup. The ideal candidate supports Linux and Windows-based ISO images, and is relatively simple. It also must have some reasonable process for adding and removing an ISO image from the drive/list.


Things that I'm not looking for in this specific question:



  • UBCD4Win or other swiss-army knife live CDs. The point is to boot any one of multiple CDs, not to boot a (certainly useful) utility CD.

  • Installing a single live CD to a USB drive. I'd like to have multiple ISO images, selectable at startup.


I don't have a specific purpose in mind, possibilties include a single drive with a Knoppix variant, Ubuntu desktop, UBCD4Win for DOS, the Offline NT Password Cracker, etc.


Flexible and easy to use are the name of the game!



Answer



This is an interesting question. I can see it being very useful to have a single USB "master" LiveCD, instead of having so many different DVDs and pen-drives scattered around.


There seem to be a number of different approaches to this, all of them doable:



Can I install unsigned Windows drivers to work without test mode or disabling driver signing and without buying a code signing certificate?

Can I sign drivers with a "self-signed" certificate, to work just with this PC, of course, and not have to use DDISABLE_INTEGRITY_CHECKS, TESTSIGNING or Test Mode?


Many modded drivers for legacy devices (e.g., ppjoy) are unsigned don't work in x64 Windows Vista, Windows 7 or Windows 8.


If this is possible, how?

windows - Print a series of PDF files


Is there a way to print several PDF files at once? I have a bunch of individual files that I want to print (about 42). Printing each one is tedious. Does anyone know a way to print a whole series at once? Maybe something like a PDF reader with a "Print All" function?


I ask because this isn't the first time I've run into this problem and have never been able to find a good solution...



Answer



Highlight them all (click on the first, hold shift while clicking on the last, or click on the first and then hold down CTRL while clicking on each file) in Windows explorer (may be not all unless you really trust your printer), right click and them click on print.


Windows may ask if you are sure, either be brave or try printing just a few at a time.


linux - Windows 7 Keeps Changing the MBR on boot


I am having an issue with Windows 7 changing the boot order everytime I start up.


I have 4 partitions:



  • boot

  • linux

  • windows.


Grub is installed on the boot, and boots up both operating systems fine, however when I boot to Windows the bootable partition is changed to Windows and the MBR is rewritten.


How do I stop this? Its rather annoying to have to boot, chroot and fix this problem everytime.


I also don't want to use the Windows boot select.



Answer



I had the "makeactive" option in grub and apparently when Win7 sees that it is the active partition it latches on.


windows - How to change hosts file in Vista?


How to change hosts file in Vista?



Answer



Type


notepad %windir%\system32\drivers\etc\hosts

into the search box in the start menu and press Ctrl+Shift+Enter.


Admin privileges, the right file from the start and it even gets created if it doesn't exist (after a prompt by Notepad).


The keystroke saved for not needing Win+R gets lost for Ctrl+Shift+Enter, though. So yes, it's way more cumbersome to do in Vista than in XP.


I think I may have wasted ... let me check ... 0 seconds on that this year. Nice :-)


troubleshooting - Emacs doesn't load gui


whenever I run emacs or emacs23 on terminal I just get the following output:


** (emacs:2620): CRITICAL **: menu_proxy_module_load: assertion `dbusproxy != NULL' failed

And the gui doesn't load, and emacs' window never opens. The emacs process doesn't actually crash (the terminal stays busy, and I can see the emacs23 process running with ps -e).


I've tried running it with the -D --debug-init arguments, but the same thing happens and the output is exactly the same. However, if I run emacs -nw it successfully runs emacs in terminal mode as if nothing were wrong.


Strangely, this problem only started happening the second time I ran emacs today. The first time it worked perfectly fine. Since then, I've tried rebooting and I've tried purging the emacs installation, to no success.


I haven't installed any new packages today, but I might have upgraded some, could that be the reason? Is there a way to find out which packages were installed/upgraded today?


EDIT: Additionally, if I run sudo emacs it loads normally and everything runs great.


Thanks


I'm running Ubuntu Lucid



Answer



Looks like you hit a known Ubuntu bug where the appmenu-gtk package seems to be broken. The solution seems to be to remove this package until this gets fixed in the repositories.


If this doesn't work don't run your emacs sudo like suggested by some people over there, rather use emacs on the command line with


$ emacs -nw

or use another editor for the time being.


My crystal ball tells me that this might get fixed not too far in the future.


windows 7 - Bank card-reader causing Outlook to prompt for card


Possible Duplicate:
Outlook is looking for a smart card



I have seen one such occurance of this problem but with no answer: Outlook is looking for a smart card


I am working on a machine that has a Barclays Business Banking card reader connected. Periodically (once very few minutes) asks for a smart card. If you cancel the request, it disconnects from exchange until you click Send/Receive > Type Exchange password & connect, however this doesn't fix it for long.


If the card reader (GemPC Pinpad USB Smart Card Reader) is connected the error reads


No valid certificates found. Check that the card is inserted correctly


If I have it disconnected, the error is


Insert a smart card


I have tried disabling encryption between Outlook and Exchange, and set authentication to NTLM to no avail. I have tried Setting up a new profile both with the card reader connected and disconnected.


My next step will be to uninstall the card reader and see if that stops the error, however if it does it's still no fix as the card reader is required.


How do I stop Outlook looking for certificates or credentials from a smartcard?

linux - Multiple directories: Powershell equivalent of "mkdir dir{1..9}"?


What is the syntax to create multiple directories with PowerShells md (or mkdir, New-Item...) equivalent to the 'nix command mkdir ch{1..9} i.e.


~/parent_dir/  
ch1/
ch2/
ch3/
ch4/
ch5/
ch6/
ch7/
ch8/
ch9/

I've looked in the man pages and get-help for examples, but I do not know the syntax for PowerShell to do such a simple thing. Thank you.



Answer



What is the syntax to create multiple directories with PowerShell


Use the following command:


0..9 | foreach $_{ New-Item -ItemType directory -Name $("ch" + $_) }

How it works:



  • 0..9 the range operator .. generates the sequence of numbers 0, 1, ... 9

  • the numbers are pipelined | to the next command

  • foreach loops (through each number in turn)

  • { ... } is a script block

  • New-Item -ItemType directory -Name $("ch" + $_) creates the directories

  • $_ is an automatic variable that represents the current object in the pipeline (the number)


Example:


> 0..9 | foreach $_{ New-Item -ItemType directory -Name $("ch" + $_) }


Directory: F:\test


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 25/09/2016 14:57 ch0
d----- 25/09/2016 14:57 ch1
d----- 25/09/2016 14:57 ch2
d----- 25/09/2016 14:57 ch3
d----- 25/09/2016 14:57 ch4
d----- 25/09/2016 14:57 ch5
d----- 25/09/2016 14:57 ch6
d----- 25/09/2016 14:57 ch7
d----- 25/09/2016 14:57 ch8
d----- 25/09/2016 14:57 ch9

Open a URL file in a new tab of existing IE window from command line


When IE10 is set as my default browser, double-clicking an internet shortcut (*.url file) opens it in a new tab of the existing IE window. However, when it is not the default, every way of opening a *.url that I've tried brings up a new IE window per file. Is it possible to keep opening files in new tabs of the same IE window when it's not set as the default browser, and how?


What I've tried and it didn't work:




  • "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "C:\Dir1\file.url" (opens a new window every time)




  • C:\Windows\System32\rundll32.exe "C:\Windows\System32\ieframe.dll",OpenURL C:\Dir1\file.url (opens the default browser)




  • classexec "C:\Dir1\file.url" --class htmlFile (using ClassExec utility, opens a new window every time)




I use Windows 7 x64.



Answer



PowerShell, adapted from the Shay Levi's answer in Google Groups.


# Set BrowserNavConstants to open URL in new tab
# Full list of BrowserNavConstants: https://msdn.microsoft.com/en-us/library/aa768360.aspx

$navOpenInNewTab = 0x800

# Get running Internet Explorer instances
$App = New-Object -ComObject shell.application

# Grab the last opened tab
$IE = $App.Windows() | Select-Object -Last 1

# Open link in the new tab nearby
$IE.navigate('http://bing.com', $navOpenInNewTab)

# Cleanup
'App', 'IE' | ForEach-Object {Remove-Variable $_ -Force}

Saturday, 28 July 2018

imap - How can I get Thunderbird to automatically move messages?

I have Thunderbird 15. I'd like to automatically move messages from one folder to another.


My mail account is an IMAP account. My Blackberry is also connected to the account and when it sends mail, it places a copy on the IMAP server in a folder named Sent Items. I'd like those messages to be moved to my Inbox automatically.


By default message filters are only applied automatically to the Inbox. There is an extension to do this, Filter Subfolders, but it's only for TB3.


What I have tried so far is:



But I can't get these filters to run automatically. I have a suspicion that filters only run automatically for incoming mail. And these are sent items. Perhaps that's it. I just don't know. On the other hand, if I run the filters manually on that folder, it does indeed move the mail.


Or perhaps the issue is that these messages are saved into the Sent Items folder marked as read. Is it possible that filters are only automatically applied to unread items?


If I could install an add-in that automatically ran the message filter on my folder, that would do it.


Anyway, I'm at a loss now. Any suggestions are welcome. I'm not at all wedded to using filters. I just want to find a way to get these messages moved without human interaction!

windows 7 - External hard drive doesn't appear in Computer


I cannot work out why this is happening. I have an external hard drive (which is an old laptop hard drive with an IDE to USB adapter). Plugging it into my computer powers it up. It spins correctly and the lights on the adapter flash normally.


Uninstalling from hardware manager and plugging it back in causes Windows to "install new software", and it says it has installed properly.


In Disk Management it comes up in the bottom part as Disk 2 with the right size (~60 GB), but not in the top half. There are three empty drives in the top half. They don't have titles or drive letters. Right clicking them bring up slightly varying context menus, but all with the options disabled. Here is a picture of my Disk Management screen:


Screen shot of Disk Management


How do I make this drive show up in My Computer? I need to format it and use it as an external hard drive.



Answer



Do you want to be able to access the data that is currently on the disk? If not, simply format it to NTFS and it will be happy.


If you do want to keep the data, you have a little more work ahead of you. Was the laptop that the disk came out of a Mac by any chance? Windows doesn't like the Mac file system. If it's something else that has become corrupted, you will need to use some form of disk recovery software to recover the data first.


forensics - How to get complete memory dump in Windows 10?

It is possible to get information like process ID, process type, physical & virtual address from a memory dump in Windows 10?

Internet connection behaving strangely across different networks on a Windows PC but flatmates's devices are fine

I have this problem for 1-2 weeks now, and only on my desktop computer.


The Problem:


I can play online games, I can listen to Spotify, the same wlan on my phone works perfectly. The only thing not working is all my browsers. Neither Chrome nor Mozilla or Edge work. And the speed is also terrible! I get maybe 2Mbit and should get 50-100Mbit when I load something via Steam.


But it isn't like the connection is completely unusable. I have the strange behavior that I can browse the internet like normal and normally fast (have a good internet connection, 125mbit/s) but suddenly everything stops working. No pages are loading and this persists sometimes for 10-15 minutes, sometimes for an hour. It's like 50/50 I can surf the internet or not.


What I tried:


Last month I was away from home on a different WLAN with my PC and it started in the last few days, and now I am back in my home network for almost a week and the problem continues.


Because the problem persists on several networks, I doubt the network is at fault here. Furthermore, I thought of any malware or virus, so I completely wiped my PC and installed a clean copy of Windows 10 so I doubt viruses or any software to be the culprit either.


I use a Netgear A6210 Wi-Fi adapter is not really old (half a year) and never was damaged or something like that, so I doubt that this makes the problems. I also updated my driver for it so that shouldn't be an issue.


Yesterday I called the support of my ISP and they could confirm that from the outside the connection is excellent, so they suspected it's a DNS problem. We tried to manually set the DNS, flush settings, and so on but nothing helped, and in the end he suspected that it might be a problem with the OS software aka Window 10. (Maybe something slipped through the new installation of the OS because I didn’t delete my data drives in the process?)


Furthermore I switched my network adapter (from USB to PCIe) and it is still bad. Plus I asked my other roommates if they had any problems and they did not have any so the router is also not at fault. I have absolutely no clue what this could be.


This is the speedtest on my phone (same wlan): enter image description here


This is the speedtest on my pc: enter image description here


This is the error i get when a site in chrome does not load: enter image description here enter image description here

Friday, 27 July 2018

bash - Can I tell if I'm in an scp session in my .bashrc?


Inside my .bashrc, I'm doing a bunch of magic that causes problems when I'm trying to do an scp. The solution I've been going with is to manually ssh to the target machine, disable my .bashrc, do the copy, and then re-enable my .bashrc. Is there a way to get around this?



Answer



My standard bashrc on debian had this as the first lines:


if [ -z "$PS1" ]; then
return
fi

This checks if the variable $PS1 is set (which only is set if you're on an interactive shell), and prevents the execution of the rest if it isn't.


Exit value with piped commands in bash


Whenever the output of a command is piped to another in bash, which command will the exit value (the $? variable) be returned from? The command that the output was piped from, or the command that the output was piped to?


Say, for example, in the command:


git diff | vim -

Would the $? variable come from the git diff command, or the vim - command?



Answer



The last command in the pipe.


$ false | echo -n
$ echo $?
0

$ true | echo -n
$ echo $?
0

$ true | echo -n | false
$ echo $?
1

linux - Redirect a url to another url


I need to redirect a url to another url. THe PC where this should be done has Linux but no server program such as Apache. When the user type www.mycomerp.com, it should redirect it to http://localhost:8069/. The http://localhost:8069/ runs on a remote server and between the user pc and the remote server there is a tunnel. I though this can be done in /etc/host.conf, can you help??



Answer



No. /etc/hosts can only be used to map hostnames to IP addresses; you will need to set up a web server that performs the redirect to the port.


CPU and motherboard compatibility

I used CPU-Z to identify my socket and it said 479 mPGA. Also got chipset information and used intel site to check out compatible processors. Turns out a lot of processors were compatible with the chipset. Some a lot faster, but that doesn't mean the socket compatible does it?


I ordered a processor off the list anyway (was very cheap), but now I'm not sure if it's compatible with my socket. So I looked at my current processor and the compatible sockets and 479 mPGA wasn't there. Has CPU-Z messed up? The processor I ordered is intel core duo T8100 by the way.

Router login page open up automatically when I connected to the network

I'm using Router Tenda W309R http://www.tendacn.com/in/product/W309R.html


Every time I restarted the router, as soon as I connected back to the network a web browser on my computer opened up automatically to 192.168.80.1/index.asp


This is a router login page that came up when I connected to the network:


enter image description here


I have Mcafee Antivirus + Firewall installed on my PC. I have run full scan and no malware came up. I ran MalwareBytes Anti-Malware found only OpenCandy Ad-Ware which has nothing to do with the router



Malwarebytes Anti-Malware www.malwarebytes.org


Scan Date: 7/02/2016 Scan Time: 6:42 PM Logfile: Administrator: Yes


Version: 2.2.0.1024 Malware Database: v2016.02.07.01 Rootkit Database: v2016.01.20.01 License: Free Malware Protection: Disabled Malicious Website Protection: Disabled Self-protection: Disabled


OS: Windows 8.1 CPU: x64 File System: NTFS User: E5


Scan Type: Threat Scan Result: Completed Objects Scanned: 395511 Time Elapsed: 5 min, 3 sec


Memory: Enabled Startup: Enabled Filesystem: Enabled Archives: Enabled Rootkits: Disabled Heuristics: Enabled PUP: Enabled PUM: Enabled


Processes: 0 (No malicious items detected)


Modules: 0 (No malicious items detected)


Registry Keys: 0 (No malicious items detected)


Registry Values: 0 (No malicious items detected)


Registry Data: 0 (No malicious items detected)


Folders: 0 (No malicious items detected)


Files: 2 PUP.Optional.OpenCandy, C:\Users\E5\AppData\Local\Temp\is-QKG4I.tmp\OCSetupHlp.dll, , [697470ed0693ef47cc404aa5f1135aa6], PUP.Optional.OpenCandy, C:\Users\Public\Downloads\AxCrypt-1.7.3156.0-Setup.exe, , [49947edf188137fffb11a7487b8917e9],


Physical Sectors: 0 (No malicious items detected)


(end)



How does this work? How can a router issued command to my computer to open a web browser and open a web page? Could anyone explain this to me?

windows 10 - Where can I find logs on recent USB insertion in the Event Viewer?


I am using Windows 10 and would like to find logs of recent USB insertions on my desktop. Using the built in Event Viewer, where can I find these logs?



Answer



I'm not a aware of a full list, so run a tool called EventGhost. When a device is attached or removed you see an event on the left side.


enter image description here


It includes a string with the hardware id. Look for the ID of your mouse


windows vista - How do I tell if my computer supports hibernation?


In Windows Vista, there is regular Hibernation as well as a Hybrid Sleep mode. These features can be found and enabled in the Power Options dialog (advanced settings). For some reason, I don't have these options available on my desktop computer.


This is what my dialog box looks like:


power options dialog1


Note that the options Allow hybrid sleep as well as Hibernate after are missing under the Sleep section.


How do I tell if this is related to my hardware and the device drivers? What can I do about it?


Update:


After running powercfg /hibernation on I now have the Hybrid Sleep and Hibernation options.


power options dialog2



Answer



As the comments suggested, hibernation is not hardware specific but rather software specific.


Click your START button and type CMD, Right click on the CMD icon and select Run as administrator. Type POWERCFG /HIBERNATE ON in the command prompt window and press enter.


The nature of hibernation will tell the OS to dump all physical memory onto the hard disk and the OS will check the hibernation file upon power on. During the hibernation, the system is fully powered down and no power draw is occurred.


Windows page file on multiple hard drives


I cant find any documentation or articles online online for this...


how does Windows handle page files on multiple hard drives? Does windows treat them as a concatenation, writing to one till its full then moving to the next? Or does it treat them like a stripe, writing to each one incrementally? Does it write to the first one free? Or perhaps some other method?



Answer



The most relevant information I could find was an article on optimal configuration of the page file under Windows XP.


The article states that Windows will use the page file located on the volume with the least activity. This means that there is no pattern defined.


So, it is arguable that the most likely way that Windows handles multiple page files is by maintaining a table of where each memory page is located. Where a page winds up depends largely on which volume was least active when it got paged out.


email - Set Thunderbird "from" address by incoming "to" address

I have configured my email server to send all email to my mailbox. So x@example.com and y@example.com go to one mailbox.


Every forum, registration, and guy get their own address for sending me emails so I can deliver their messages to /dev/null if anyone starts spamming. That’s the working setup.


Now the problem: If I reply to a message, then Thunderbird always sets my default Identity as the sender. I know I can add additional identities, but I don't want to add every address.


How can I configure Thunderbird so that when an email is sent to x@example.com, replies will come from x@example.com?

windows - Which browser is the most secure? (research and practically based)



I was wondering which browser is the most secure today, Firefox, Internet Explorer, Chrome, or Safari on a Windows machine with the user running as a Power User/Administrator account.


This is not a question about which browser is the best because its the most usable, but more of a question if asked for security, which browser is the most secure given an everyday user's experience (JavaScript, Flash, Ads, etc).


Also, would the choice for most secure change if the user was running as a restricted user?


To clarify, I'm looking for an answer that's based in research on potential and common exploits and how long it takes for critical problems to be patched.


Edit: My approach for this question is basically, what would you recommend to your boss, co-worker, or relative, who probably an average user.



Answer



I think it really depends on who you ask. I've never seen an end-all-be-all answer to this question, and I doubt I ever will. Each company takes their own approach to securing the browser, and even though the end result is almost always the same, their methods can be entirely different.


To answer your question about limited user? Absolutely, yes. Running as a limited user is the absolute best thing you can do to protect yourself (in my opinion, anyways). I am a well-learned computer user running Windows 7, and there has been a time or two where the UAC prompt pops up unexpectedly and I stop to see what it is that is asking for access1.


Having my users at work run as a limited user prevented AntiVirus 20102 from being installed (it still caused some issues I had to fix, but it didn't manage to install itself - that's the important part).


According to this article at Ars Technica, it's Google Chrome, when judged by hackers/exploiters:



A recent contest at CanSecWest, an event that brings together some of the most skilled experts in the security community, has demonstrated that the three most popular browser are susceptible to security bugs despite the vigilance and engineering prowess of their creators. Firefox, Safari, and Internet Explorer were all exploited during the Pwn2Own competition that took place at the conference. Google's Chrome browser, however, was the only one left standing—a victory that security researchers attribute to its innovative sandbox feature.



But then again, this article, also at Ars Technica, shows that Internet Explorer 8 is the most secure (it even has charts!):



During July 2009, a company called NSS Labs performed two separate browser security tests, which Amy Barzdukas, General Manager of Internet Explorer, told Ars that Microsoft had sponsored. Right off the bat, your suspicions have probably been raised, and rightly so. Internet Explorer 8 performed very well in all the tests and, while Microsoft insists that it had no impact on the results, we must still be cautious when examining the reports.


Before we go to the results, it's worth noting that NSS Labs chose to test what it thinks are the most important types of security threats:


The most common and impactful 'security threats' facing users today are socially engineered malware and phishing attacks. As such, they have been the primary focus of our initial research. While drive-by downloads and click-jacking are also effective attacks and have achieved notable publicity, they represent a smaller percentage of today's threats. According to Microsoft, the malware report is more important than the phishing report, so we've put it first. "We block 20 times more malware per day than phishing sites in IE8," Barzdukas told Ars. IE8 block malware for approximately 1 out of 40 users every week, and approximately 1 of every 200 downloads is blocked as malicious.


enter image description here





1 I'm looking at you, Java Updater!


2 Check out Microsoft's Malware Protection Portal page on AntiVirus 2010 - it's impressive!


Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...