Wikipedia:Reference desk/Archives/Computing/2015 June 9

Computing desk
< June 8 << May | June | Jul >> June 10 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 9 edit

Why do websites appear different when I log on with different internet web browsers? edit

I noticed that when I log on to a certain website (specifically, eBay) through Internet Explorer, the website page looks completely different than when I log on with Mozilla Firefox. This really confused me. Why would that be? Is that a "setting" that comes from the eBay website? Or is that a "setting" that comes from the search engines web browsers (Internet Explorer and Mozilla Firefox)? I have never noticed this with any other websites, just with eBay. Also, is there a way that I can change the appearance? In other words, I want to log on with Mozilla Firefox, but I want the eBay website to have the appearance as it would with Internet Explorer. Thanks. Joseph A. Spadaro (talk) 03:12, 9 June 2015 (UTC)[reply]

First, IE and Firefox are web browsers, not search engines (Google confuses things a bit, since Google is indeed a search engine, and Google Chrome is a web browser). As for why web sites look different, each browser implements things like HTML a bit differently, which makes web sites that use HTML, etc., all look a bit different. It is also possible to detect the web browser within the page, and intentionally display things differently, but the goal is usually to provide the same info in as close as possible to the same format on each web browser. StuRat (talk) 03:24, 9 June 2015 (UTC)[reply]
Thanks. As I was typing the words "search engines" above in my original post, I had the feeling that it was not the correct terminology. Back to my eBay issue. Maybe my original question was not clear. It is not simply the case that the website page looks different (i.e., cosmetically). But, more importantly, the substantive content is completely different. So, I don't really care about the cosmetic appearances. I care about the substantive content that does (or does not) show up, according to the various web browsers. For example, in eBay, I keep a list of items that I am interested in purchasing. So, the list that shows up in Internet Explorer will be completely different than the list that shows up in Mozilla Firefox. Joseph A. Spadaro (talk) 03:58, 9 June 2015 (UTC)[reply]
A lot of websites such as eBay use cookies to generate predictive "smart lists" of products that you are likely to be interested in. If you don't have your own personal list on Mozilla like you do on IE, then eBay is likely substituting their own generated list based on your browsing history. RegistryKey(RegEdit) 04:46, 9 June 2015 (UTC)[reply]
No, it's more of a situation like this. On eBay, I have a "favorite search". So, let's say that it is "books by Stephen King" (just as an example). So, whenever a new item in this category ("books by Stephen King") is placed on auction at eBay, it appears on my "favorite search list". So, for example, the most recent 25 auctions will appear on my list. However, my two lists are completely different (the list generated from Internet Explorer versus the list generated from Mozilla Firefox). Regardless of HTML and "computerized predictions", the most recent 25 items posted will still be the most recent 25 items posted. And my list, regardless of which web browser I am using, should reflect the same list of most recent 25 items. Joseph A. Spadaro (talk) 05:35, 9 June 2015 (UTC)[reply]
So the list is not displaying what it's supposed to if you use one browser, but if you use another browser, it displays the correct content? That sounds like a question for eBay tech support to me as that could possibly be something on the server end that your client may be inadvertently causing. RegistryKey(RegEdit) 06:11, 9 June 2015 (UTC)[reply]
Basically, yes. One browser shows one content. Another browser shows a different content. In your above post, who does the word "client" refer to? Thanks. Joseph A. Spadaro (talk) 06:54, 9 June 2015 (UTC)[reply]
See Client (computing), a client is "...a piece of computer hardware or software that accesses a service made available by a server," in this case the server being the eBay website. RegistryKey(RegEdit) 07:11, 9 June 2015 (UTC)[reply]
Sorry to interject with a minor pedantic detail, but to keep our terminology standardized: refer to the definitions sections in RFC2616 or the more recent RFC7230 (among others). If we want to use the technical terminology precisely, Firefox is not a "client": it is a user agent. eBay is not a server, it is a company; we can use a specific term to refer to the http server or its content; a different terminology applies to the actual computer hardware or network interface on which the http server is instantiated; and so on. Nimur (talk) 16:17, 9 June 2015 (UTC)[reply]


It sounds like one of the two browsers is failing to update the list. You should be able to determine which by looking at the dates each item was posted on eBay, where the one with the old dates is the one with the problem. Possibly a difference in the settings on each browser is responsible. Browsers do occasionally have problems with showing you cached (saved) versions of old data instead of updating it. Sometimes this is wanted, where the info doesn't change often and takes a long time to download (let's say a detailed map of the US), but at other times it's an annoyance. There are things to try like clearing the cookies and cache, but this can also wipe out good stuff. My suggestion is just to figure out which browser is doing what you want, and use that one for eBay. StuRat (talk) 12:24, 9 June 2015 (UTC)[reply]
I think you are correct. One browser has the good, new, updated information. The other browser has old, out-of-date information. So, the problem that I have encountered is that I have (finally) realized how much I hate Internet Explorer (due to various issues it has). So, I have switched over completely to Mozilla Firefox. I don't want to have to do all of my web browsing with Mozilla, but (in the event I want to go to eBay) then switch over to Internet Explorer (IE). I'd like to get rid of IE altogether. Joseph A. Spadaro (talk) 16:37, 9 June 2015 (UTC)[reply]
Each browser stores cookies in a different place (and possibly in a different way). So, hypothetically, if I go to eBay using Firefox and search for "framed cat photos", ebay might store "steve likes cat pictures" in a cookie in some Firefox-specific directory someplace. If I go back to the site using Firefox, it'll notice that cookie and prioritize cat photos higher in my search results. If I then go to the same site using (say) Chrome - then the cookie that Firefox wrote won't be where Chrome looks for cookies, so the web site has no way to know that I like cat pictures - and I don't see them in my search results. In reality, it'll be much more complicated than that - but whatever information is stored in cookies will be different between the various browsers out there. SteveBaker (talk) 03:26, 10 June 2015 (UTC)[reply]
OK. I "get" the idea that different web browsers work differently. But, still, isn't eBay's website something that belongs to the company called eBay? And doesn't eBay control what its page looks like? I am sure that eBay doesn't give Mozilla or IE free reign to "change" the eBay page to whatever Mozilla or IE feels like. No? In my case, the pages are significantly different. Not just minor cosmetic stuff. There is major substantive content stuff, and there is also major cosmetic stuff. It looks like two completely different pages. So, eBay just allows Mozilla and IE to take whatever license they want and change the look and content of eBay's page willy-nilly? Joseph A. Spadaro (talk) 04:05, 10 June 2015 (UTC)[reply]
No eBay is providing different content because of different information it is receiving from the browsers. Anyway I think we need to clarify something here. Your comment above you said "log on to a certain website". I think many prople assumed, or at least I did, that you meant you logged on to an account on the website. However reading some of your more recent posts, I'm not so sure if this is what you meant. Are you logging in to an account on eBay on both browsers, or not? If you aren't, the answer is potentially completely different (probably basically what SteveBaker said) to if you are logging in to an account (in this case I'm not sure what's going on here). Note that if you are logged on to an account on eBay, the top of the page will probably have something like "Hi Joseph!". If it doesn't you probably aren't logged in properly (you may be able to adjust this so it isn't a perfect guarantee but for the default case on a desktop browser it's probably good enough). Nil Einne (talk) 04:26, 10 June 2015 (UTC)[reply]
So, to clarify: I have a personal account on eBay, on which I buy and sell eBay items. Yes, it does say "Hello, Joseph" (or some such) at the top of the page. Now, of course, to log into my eBay account, I have to get onto the internet (world wide web) first. Sometimes, I get on the internet by using IE. Sometimes, I do so by using Mozilla. In either case (IE or Mozilla), I am logging into my personal eBay account. That, indeed, is the account where I list my "favorite items" and "items on my wish list that I would like to purchase", etc. Joseph A. Spadaro (talk) 05:02, 10 June 2015 (UTC)[reply]
In that case, I'm not sure SteveBaker's answer is related. RegistryKey is probably right in that something is going wrong and it's probably not the fault of the browser. There is a chance it has something to do with stuff you've changed that has been saved in cookies, but it seems unlikely it's what SB referred to.
One thing to bear in mind is AFAIK, your location is not saved as part of a favourite search. While by default, it will depend on your default shipping address, you can change what it displays in the search and this will be preserved by cookies at least sometimes. And note, I think the shipping location can influence results even if you're not sorting by shipping price.
Actually one suggestion I would have is to clear out all eBay related cookies on both browsers, and sign in afresh and see if that helps.
If this doesn't help, you could try reporting to eBay as suggested, or alternatively perhaps try in a forum better suited to this sort of question. (May be the eBay support forums.) It'll probably help if you give examples (screenshots if possible) of stuff that's wrong and stuff that's right. I presume you can still see your purchase history and stuff, and can still see your favourite searches and stuff like that too.
I also do know is at least when it comes to international stuff, eBay can sometimes do weird stuff. E.g. you may think searching for preferred locations "worldwide" would give you more stuff, but actually it also seems to lose half the stuff in some cases. In fact you can sometimes end up with fewer items. However if you don't search worldwide, you will miss all the items listed on other eBay sites (well unless there only a few results and it shows the ebay International sellers thing). I think it's at least partially influenced by things like sellers excluding shipping to certain places, even if you are asking it to show shipping to another place where the seller does ship. (Frankly it was far better before when they had the "any country/region" option.)
Mind you eBay is still IMO loads better then AliExpress in most ways. AliExpress seems to save some unknown setting which will kill a number of my search results on cookies for reasons I never worked out. And if you sort by price, it seems to lose some of the results. In fact it loses even more if it tries to hide unrelated results, which I often find excludes a bunch of usefull stuff and they give the box to stop that, but it has an X to close it which is easy to mistakenly click thinking it will make it show all results when you have to click the text which says to show all results instead.
Nil Einne (talk) 22:15, 11 June 2015 (UTC)[reply]

Thanks, all. Joseph A. Spadaro (talk) 16:50, 13 June 2015 (UTC)[reply]

Send MIDI Messages In Python 2.7.5? edit

Hello, I would like to know if it would be possible to send MIDI messages in Python 2.7.5. I can't use any external libraries though. If this is not possible in Python, I do have the option of using scratchpad in Firefox to do JavaScript. Thanks in advance. —SGA314 (talk) 15:55, 9 June 2015 (UTC)[reply]

To whom do you wish to send MIDI messages? Are you planning to write these to file, or send them to external software or hardware?
If you seek to use MIDI to control a musical instrument or a speaker, your operating system may provide a standard driver (or you may need a custom device driver). Python can communicate to the operating system through a standard interface, and the message can be relayed to the instrument.
Here are some common Python packages that wrap operating system MIDI drivers:
  • midi, a wrapper for ALSA (usually available on most Linux systems)
  • PMIDI, a wrapper for Windows MIDI drivers
Nimur (talk) 16:00, 9 June 2015 (UTC)[reply]
Thats great in all but like I said, I can't use any external libraries. So, If python can communicate to the operating system through a standard interface, then could it read the data from a USB game controller(Sorry I know its off topic but you got me thinking there)? I just want to send MIDI messages to windows and have it play back the sound from its internal GM midi system. Think GM.DLS. And yes I would like to write messages to a mid file. But first I just want to know how to send MIDI messages to windows. —SGA314 (talk) 16:07, 9 June 2015 (UTC)[reply]
Well, you can write Python code to directly call the native Windows API, or you can use an already-existing wrapper library (like PMIDI) that hides this implementation detail behind a pure Python interface. This statement is generally true for any other system service that you wish to use, including input/output and other systems that are not built in to the Python runtime. Nimur (talk) 16:12, 9 June 2015 (UTC)[reply]
Ok, this brings me to two questions. 1.How would I directly call the Windows API and 2, what would I want to call from the Window API? —SGA314 (talk) 16:17, 9 June 2015 (UTC)[reply]
Here's some sample code using ctypes, which is a standard Python library:
import time
from ctypes import byref, c_void_p, windll

device_id = 0

hmo = c_void_p()
error = windll.winmm.midiOutOpen(byref(hmo), device_id, None, None, 0)
assert not error
windll.winmm.midiOutShortMsg(hmo, 0x7F3090)  # 90 30 7F: note on, channel 0, pitch 48, vel. 127
time.sleep(1)
windll.winmm.midiOutShortMsg(hmo, 0x003090)  # note off
Other MIDI-related functions are listed here. -- BenRG (talk) 16:41, 9 June 2015 (UTC)[reply]
Is there any way to individualize the parameters of the message instead of using a hex code? Oh and what does c_void_p() do? and what does assert not error do? The assert not error statement gives me an AssertionError, so i had to comment it out. —SGA314 (talk) 17:12, 9 June 2015 (UTC)[reply]
You cannot simply ignore this assertion. That is Python's runtime informing you that there has been an error executing the previous function call. That function was the one which should have set up the MIDI device! If there was an error, you must find and fix it: if you simply ignore it, your program will continue but will have a hard time to correctly operate the MIDI device! Nimur (talk) 19:29, 9 June 2015 (UTC)[reply]
Ok, so now how would I use the keyboard(a QWERTY keyboard that is) to trigger notes? —SGA314 (talk) 17:44, 9 June 2015 (UTC)[reply]
You're performing two conceptually different, difficult tasks, so let's disentangle each of them:
  1. You're learning an unfamiliar Windows API, the Windows Multimedia API. This is a C API, and you will need to become familiar with the services it offers and the functions that wrap those services. This is one of many possible APIs, and although it is one of the simplest, it is not the most current API available. Microsoft recommends that you use the Media Foundation API.
  2. In tandem, you are learning how to use Python to call native code via a C API. You will need to become familiar with ctypes, part of the Python standard library and its standard mechanism for calling foreign functions. You should familiarize yourself with the documentation.
If, as you have previously stated, you cannot access this documentation online, you would do well to purchase a book or borrow other reference material that you can use without internet access. For example, you can buy the Developing Microsoft Media Foundation Applications (Developer Reference) (2011); and O'Reilly Learning Python (2013). In total and complete honesty, in this century it is unfathomable to think that a new programmer will try to learn how to program using a paper textbook only. APIs change so rapidly, and the selection of available technologies is so absolutely unimaginably immensely vast that unless you have an unlimited book budget, you can not realistically plan to buy a library large enough to cover all your possible needs. So here's what you should focus on doing: find some way to get realistic access to internet resources, like official developer documentation; or find some way to get access to a vast technical library (by visiting or attending a university or technical school who will hold such books).
Nimur (talk) 19:25, 9 June 2015 (UTC)[reply]
Ok I see your point. I will try to get a hold of the documentation. Thanks for all of everyone's help. —SGA314 (talk) 19:31, 9 June 2015 (UTC)[reply]
Here is what I came up based on the sample code:
import time
from ctypes import byref, c_void_p, windll
import string
device_id = 0 
hmo = c_void_p()
error = windll.winmm.midiOutOpen(byref(hmo), device_id, None, None, 0)

#I don't know why this statement dosen't work.
#assert not error

#Constant For Note On Message Type
MSGTYPE_ON = 9

#Constant For Note Off Message Type
MSGTYPE_OFF = 8

#Example Of Note Function Usage: Note(127, 60, 0, 0.25)

def Note(Vel, Note, Channel, NoteLength):
	#Vel = Velocity Of Note.
	#Note = Integer Of MIDI Note Number(Middle C is 60).
	#Channel = MIDI Channel To Use. Valid Values Are 1-16.
	#NoteLength = Float Or Integer of how many seconds the note should last(values below 1 are valid, e.g. 0.25).
        
	#Convert The Paramaters Into A Hexdecimal String As An "ON" Message Type
	StrMsgData = str(str(hex(Vel)) + string.replace(str(hex(Note)), "0x", "") + string.replace(str(hex(MSGTYPE_ON)), "0x", "") + string.replace(str(hex(Channel)), "0x", ""))
        
	#Convert The Above Hexdecimal String Into A Valid Hexdecimal MIDI Message.
	MsgData = string.atoi(StrMsgData, 16)

	#Send The MIDI Message
	windll.winmm.midiOutShortMsg(hmo, MsgData)

	#Pause The Program For However Long The NoteLength Paramater Specifies.
	time.sleep(NoteLength)

	#Convert The Paramaters Into A Hexdecimal String As An "OFF" Message Type
	StrMsgData = str(str(hex(Vel)) + string.replace(str(hex(Note)), "0x", "") + string.replace(str(hex(MSGTYPE_OFF)), "0x", "") + string.replace(str(hex(Channel)), "0x", ""))

	#Convert The Above Hexdecimal String Into A Valid Hexdecimal MIDI Message.
	MsgData = string.atoi(StrMsgData, 16)

	#Send The Note Off MIDI Message
	windll.winmm.midiOutShortMsg(hmo, MsgData)
Thanks for all of your help. —SGA314 (talk) 19:55, 9 June 2015 (UTC)[reply]
Instead of string.replace(s, x, y) use s.replace(x, y). Instead of str(hex(n)) use hex(n) since it returns a string already. Instead of hex(n).replace("0x", "") use "%x" % n. Instead of string.atoi use int. Instead of StrMsgData = str(...) use StrMsgData = ... because the right hand side is already a string. Instead of all of that stuff, use MsgData = (Vel << 16) + (Note << 8) + (MSGTYPE_ON << 4) + Channel. It wouldn't have worked anyway for pitches or velocities less than 16 because you didn't pad the hex strings with zeroes.
Also, find a more up-to-date Python tutorial. Those string functions have been deprecated for a very long time (since 2001, as far as I can tell), and were removed completely in Python 3.0 in 2008. Python itself comes with a good tutorial, which is always up to date. You can probably find it in python275.chm in the Doc subfolder of the Python installation. If not, it's available online. -- BenRG (talk) 00:36, 10 June 2015 (UTC)[reply]
Thanks for the input. I never have used the shift operator so I didn't know what it does(I looked it up using the help command). I am not using a full installation of python(I am using gimp's python installation which is very striped down) so I don't have the help file. Thanks for your input. —SGA314 (talk) 14:50, 10 June 2015 (UTC)[reply]

Face recognition software edit

What is the best 'face recognition software'? I'm planning on to 'print screen' a video, thereafter searching the person's face in the internet...whatever is available of their, e.g., videos, pictures and so on.

Space Ghost (talk) 19:03, 9 June 2015 (UTC)[reply]

OpenCV does face recognition. I haven't used it for recognizing identity, which it can do. I've only used it to recognize that there is a human face visible. Then, when it doesn't see a human face, it locks the computer (so, my computer locks when I look away - mainly because I work in a hyper-secure environment). 209.149.113.240 (talk) 19:24, 9 June 2015 (UTC)[reply]
hyper-secure environment? Well that discounts you from working for any US Government agency, nor financial institution, Face-book etc. The only people I know of to go to that much trouble to prevent the bill pay from discovering how much there are getting fleeced are veterinary surgeons and funeral directors. --Aspro (talk) 21:37, 9 June 2015 (UTC)[reply]
The 209.149. IP is Greenville Health System. I wonder if they have to go to that level of security regarding physical access to the computer, but still let people navigate the Internet. --Llaanngg (talk) 16:01, 10 June 2015 (UTC)[reply]

@Russell.mo: You just asked yet another of your endless questions here. Take a tip from Bart --Aspro (talk) 21:13, 9 June 2015 (UTC)[reply]

User:209.149.113.240:   Unexpected type of software, and happy to know it exists. Thank you; your contribution provided unexpected happiness. I was thinking/dreaming of such type/kind of software for possession, e.g., the eye checker, fingerprint checker and so on, but wasn't bothered so much in this day and age, because of the thought of money, Mb, governmental issues and so on.

The software you advised is over 206/269Mb, I won't be able to download it now, but have saved its URL for future use. Once again, thank you, and I appreciate your relative advice.   -- Space Ghost (talk) 18:27, 10 June 2015 (UTC)[reply]

Side issue edit

I was wondering how common it is for Windows PCs, or other computer types, to come with such software installed. I bought my Toshiba laptop back in 2011 and I was surprised that it came with that ability. 220 of Borg 02:38, 14 June 2015 (UTC)[reply]

And how do you activate it? -- Space Ghost (talk) 20:41, 14 June 2015 (UTC)[reply]