Wikipedia:Reference desk/Archives/Computing/2023 August 11

From Wikipedia, the free encyclopedia
Computing desk
< August 10 << Jul | August | Sep >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 11[edit]

Documentation for using jQuery on an element[edit]

I've been scanning jQuery documentation to answer a question and I cannot find anything related to this problem. Assume that I have an element in Javascript stored in a variable name "me" using something like "me = documentManager.getTheItemThatTheUserJustPicked();" So, me is an HTML element or a DOM element, basically an element. I've had a LOT of trouble explaining that me is an element like when you use "me=document.getElementById('something');" gives you an element, it is an element. Hopefully I can ask the real question and not spend hours trying to explain what "element" means. The issue: The person asking the question wants to use that element with jQuery. I know you can use selectors like $("#something") to fetch an element. The issue is that the variable "me" has the element. There is no need to hunt it down. It may not have an id. It may not have a class. So, it isn't possible to use $("#"+me.id). The person tried $(me) to select the element with the goal of doing $(me):contians("some text") to see if the element contains text. Of course, that doesn't remotely work. I believe the issue is that $(me) won't work because me is a variable containing an element and jQuery doesn't allow elements inside $(...). It needs some CSS identifiers. So, is it possible to turn the element variable "me" into a jQuery object to use jQuery functions on it? 97.82.165.112 (talk) 13:07, 11 August 2023 (UTC)[reply]

Using $(me) should definitely work - are you absolutely sure me is really a DOM element, and not (say) an array whose only member is the element, or some fancy type of Object produced by your documentManager? AndrewWTaylor (talk) 16:07, 11 August 2023 (UTC)[reply]
Followup: contains wouldn't be the right function to use here - it's used to determine whether one DOM element contains another. If you're looking for text then you would use something like $(me).html().search("some text") >-1. But there's no need to used jQuery for this as you can just do it by looking at me.innerHTML. (Of course your colleague may want to use jQuery for other reasons.) AndrewWTaylor (talk) 16:19, 11 August 2023 (UTC)[reply]
Thanks. I am still looking and I simply cannot see in the jQuery documentation where it says I can use a variable name in $(...) to use the jQuery functions. But, I will tell him to try that and see if it works and ignore the stack overflow people who insist that I don't know what an element is, so my basic question is invalid and shouldn't be answered. 97.82.165.112 (talk) 18:30, 11 August 2023 (UTC)[reply]
In the documentation of the jQuery function (usually aliased to $), the second entry in the list is jQuery( element ), where element is "A DOM element to wrap in a jQuery object." Your variable is that element. AndrewWTaylor (talk) 10:48, 12 August 2023 (UTC)[reply]
This is a problem I’ve encountered before and it didn’t take much effort to resolve from a technical standpoint. It’s a very simple matter of configuring the jQuery interface to parse out fewer simultaneous algorithm parameters over wireless. Once you do this, any variable is obviously limited to a DOM element function, so it basically becomes a simple matter of the operating system you’re using (as long as you’re familiar with basic shell commands, the rest doesn’t need to be explained). Wegglim (talk) 05:05, 13 August 2023 (UTC)[reply]

Wi-Fi ► Bluetooth ?[edit]

This might be more of a "miscellaneous" question, but... Is it possible to wirelessly connect a Wi-Fi device to a Bluetooth device with some sort of adapter or something? -- 136.54.106.120 (talk) 16:26, 11 August 2023 (UTC)[reply]

I have never heard of such adapters. Theoretically you can set up such an adapter using a computer (running an appropriate software) capable of establishing both BT and Wi-Fi connections. Ruslik_Zero 20:18, 11 August 2023 (UTC)[reply]
I'm trying to imagine how this might work. Would buying a cheap used laptop with both BT & Wi-Fi, acting as sort of an intermediary work? I.e. setting up a wireless LAN. What I have is an archaic (pre-Bluetooth) computer with legacy media software that I would like to connect wirelessly to another computer. --136.54.106.120 (talk) 18:28, 12 August 2023 (UTC)[reply]
Why are you using Bluetooth at all? If you simply want to connect two computers together can't you just use WiFi? Martin of Sheffield (talk) 20:31, 12 August 2023 (UTC)[reply]
I simplified my situation somewhat; there is also an element that I'm thinking of ordering that is only Bluetooth wireless (and wired aux). -- 136.54.106.120 (talk) 00:54, 13 August 2023 (UTC)[reply]
The device you are thinking of is a network bridge, which allows you to connect eg an ethernet network to a token-ring one. For Wi-Fi to Bluetooth I found this device for a mere £337.68 including UK VAT. If you could give us the specs/model names/operating systems of the two machines you are trying to connect it might be much easier for us to suggest a workable solution. To repeat Martin's question, why Bluetooth at all? A couple of USB wifi dongles would easily suffice for around $20, assuming you have a wi-fi capable router. Even if not, you can set up a Win 7+ PC as a Wi-Fi hotspot using something like this. BT is very slow in comparison. MinorProphet (talk) 07:32, 13 August 2023 (UTC)[reply]
Thanks. I'll have to look further into this info; perhaps there is a simple dongle solution. 136.54.106.120 (talk) 17:25, 13 August 2023 (UTC)[reply]
I hope so. I'm also a great fan of wired solutions and physical cables (not always possible). If both your computers have a Cat 5 ethernet port, you should be able to connect them with nothing more than an ethernet crossover cable up to 100m (328 feet)—perhaps custom made for less than $20 at your friendly local computer store—although a certain level of network expertise might be needed (assigning local static IP addresses, etc.) NB Nothing to do with the luminiferous aether. MinorProphet (talk) 18:59, 13 August 2023 (UTC)[reply]
NB When you finally get there (ie basic connectivity): for sharing folders over a network (which you will certainly need to do), it is _essential_ that you log in to both computers using exactly the same username and password. MinorProphet (talk) 19:27, 13 August 2023 (UTC)[reply]
As mentioned in our Medium-dependent interface article, unless you are using two computers so old they only have ancient 100 mbit ethernet, or slower, LAN cards, there's no reason to use a crossover cables. (Frankly our crossover cable article should be clear on this point too.) If you are using such a computer, consider whether it's really worth it as even a Raspberry Pi will probably outperform it in nearly every way. Note if you use a more modern device with recent 100 mbit ethernet e.g. some of the older Pis and many smart TVs, it almost definitely has auto MDIX too e.g. [1]. Crossover cable will still work of course, but it's far easier to buy factory made and molded straight-through cables which are far less likely to have problems than cables crimped by your friendly local computer store, especially since nowadays even if they offer the service they probably don't do it much. Nil Einne (talk) 04:17, 18 August 2023 (UTC)[reply]
Yes. I have something set up exactly like what you’re describing. You have to access your router configurations and set them to run through a split modem. My setup uses cloud based relay, which enhances connectivity. Wegglim (talk) 20:18, 13 August 2023 (UTC)[reply]
Blimey, you are absolutely right! Why didn't I think of that before? Couldn't we also include some sort of automated Javascript AI chatbot to help the OP with his incipient personal data scrape? MinorProphet (talk) 22:38, 13 August 2023 (UTC)[reply]
How come whenever I attempt to simplify things, everything gets more complicated? Isn't technology wonderful? 136.54.106.120 (talk) 02:46, 14 August 2023 (UTC)[reply]
It’s really not complicated at all, pretty basic. Wegglim (talk) 03:30, 14 August 2023 (UTC)[reply]
@Wegglim, I don't know if you're the same user who previously edited under the User:Dinglepincter account, or just someone with the same idea that it's amusing to post vaguely plausible sounding nonsense in order to mislead people who are asking questions. It is not funny and not acceptable. Please stop. CodeTalker (talk) 04:24, 14 August 2023 (UTC)[reply]
I have a device that does this. My house lighting system is bluetooth. The year after my house was built, they changed over to wifi, but I'm stuck with bluetooth. So, they made a little puck thing that lets the old bluetooth lights, fans, etc. work over wifi. It is special made just for this system, so I doubt it would work for your needs. I only mention it to state that it exists. 12.116.29.106 (talk) 12:54, 15 August 2023 (UTC)[reply]