Jump to content

Wikipedia:Reference desk/Archives/Computing/2011 June 11

From Wikipedia, the free encyclopedia
Computing desk
< June 10 << May | June | Jul >> June 12 >
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 11

[edit]

Using unmanaged .dll with managed code

[edit]

I'm currently trying to use functions from an unmanaged .dll that I created from in a Windows Forms application. I spent hours on Google without luck, currently following [1]

[System::Runtime::InteropServicesDllImportAttribute("Harvester.dll")]
   extern "C" int testFunction(int num);
int Form1::test()  { num = testFunction(10);  }

but I get a "'System.EntryPointNotFoundException' Additional information: Unable to find an entry point named 'testFunction' in DLL 'Data_HarvesterDLL.dll'."

Any ideas, or am I barking up the wrong tree so to speak? What should I do at the .dll end to declare/export the functions so that .NET can find them?

I'm not new to C++ but haven't done any programming in some time and haven't done anything of this nature before. Benjamint 09:01, 11 June 2011 (UTC)[reply]


I haven't done this specific thing, but in general calling between C and C++ and other languages runs into issues of name mangling. It's particularly the case on Windows, which introduces calling convention into the mangling scheme. If you can call Windows API calls successfully, but not your own, you probably want to declare Form1::test to be _stdcall -- Finlay McWalterTalk 12:22, 11 June 2011 (UTC)[reply]
Oh, I didn't read your code properly. Your function isn't called test, it's called Form1::test, and the C++ compiler will have mangled it (as specified in the name mangling article). I can't immediately find a reference about how the Microsoft C# compiler references external C++ mangled names, but I'd first try using the syntax that C# would if Form1::test was a C# method, which I think is just Form1.test -- Finlay McWalterTalk 13:20, 11 June 2011 (UTC)[reply]
I can't seem to follow your link, so I'm not sure what you're trying to do here. You're trying to call native code from C#, or the other way around? You don't look to be trying to call a function named "test" in "Data_HarvesterDLL.dll," which makes that exception inexplicable. 24.177.120.138 (talk) 17:09, 11 June 2011 (UTC)[reply]
Not sure why the link wasn't working, I re-pasted it anyway. I'm trying to use native C++ functions in a managed C++ application, yeah. Spent all last night on it and still haven't got any further. It can't find the entry point 'testFunction' Benjamint 01:31, 12 June 2011 (UTC)[reply]
You've got a calling-convention issue, I think. Try specifying the __cdecl calling convention in the DllImport attribute. See also MSDN. 24.177.120.138 (talk) 03:17, 12 June 2011 (UTC)[reply]
cdecl didn't work.. and I've implemented __declspec( dllexport ) in the class which along with using "extern "C"" should, according to this solve any name mangling. would it be a problem that I'm implementing a class in the dll: i'm importing "testFunction()" should I be importing "ClassName::testFunction()"? I'm completely at sea on this one, must be missing something obvious. Benjamint 07:14, 12 June 2011 (UTC)[reply]

TV rebroadcast

[edit]

My house has multiple floors and TVs/PCs with tuner cards, but over-the-air reception is poor on the lower floors. The traditional cure is to install a good roof or attic antenna and snake the antenna wires throughout the house to distribute the signal to each device. Aside from all the antenna wires, another problem with this setup is that a directional antenna needs to be rotated for each station, requiring a remote control to control this for each TV, and causing the the problem of different viewers on different TVs wanting different stations at the same time. So, my idea was to have a device near the antenna to boost and rebroadcast the signal right there, so no wires are needed. Some questions:

1) Does such a device exist ?

2) Would such a device be legal under US law, if the rebroadcast signal is low enough ?

3) Rebroadcasting on the same frequency might cause interference with the original signal, such as ghosting, due to a time delay. This might be addressed by rebroadcasting at a TV frequency not used in that area. Is that legal ?

4) It sounds like a separate tuner would be needed for each frequency to be rebroadcast in this way. Or, alternately, perhaps the same remote control device used to turn the antenna could also select the channel to rebroadcast. Does this sound practical ?

5) We'd still have the problem of only one channel being viewable in the household at a time, so I guess the only solution to this would be 2 or more antenna/rebroadcasting units. Does anyone see an alternative to this ?

6) If rebroadcasting in the TV band is illegal, how about at other frequencies ? (Of course, this would require a device at each TV to convert the signal back to the TV band, so not an ideal solution.)

StuRat (talk) 17:01, 11 June 2011 (UTC)[reply]

1) Video sender
3) They use a different frequency
-- Finlay McWalterTalk 17:18, 11 June 2011 (UTC)[reply]


  1. AFAIK, in the US,not commercially, no.
  2. It wouldn't be legal under Part 15, since it effectively would be causing intentional interference, and you'd need a license to use any device sold under a different section.
  3. Yes and no. There are conceivably areas of the spectrum where unlicensed devices can broadcast with considerable power, but your TV wouldn't be able to tune them. You could also rebroadcast anywhere in the TV spectrum where you don't cause interference, but, since the DTV switch, most of the TV spectrum is used.
  4. Sort-of a moot point.
  5. Nope.
  6. There are a number of unlicensed bands at the top of UHF into microwave. There are also MURS frequencies in VHF, but there's not enough bandwidth there to effectively rebroadcast. You could get an amateur radio license, which opens up a great deal more of the spectrum to play with.
Taking a different approach, can I suggest that you use something like a HDHomeRun, and then redistribute the signal over standard WiFi as MPEG streams? 24.177.120.138 (talk) 17:19, 11 June 2011 (UTC)[reply]
That sounds like something an old TV couldn't handle without lots of hardware for each TV to convert it back into a TV signal. StuRat (talk) 18:51, 11 June 2011 (UTC)[reply]
That's true, you effectively need a computer. But that's the case already with broadcast DTV and older TVs. 24.177.120.138 (talk) 23:45, 11 June 2011 (UTC)[reply]
Ah, but I already have those converter boxes, so don't want to have to go buy a new bunch (and this time without the $40 US government subsidy coupons). StuRat (talk) 00:29, 14 June 2011 (UTC)[reply]

Subtitling

[edit]

I spent part of this morning downloading various subtitle editors until I settled on one (which was actually freeware - I had a few trial versions of others, and this one blew them away!). Anyway, I tested it out, and it seems to be fairly straightforward - I open the vid, do the subtitles for it, then save the subtitle file (in .srt format) in the same directory as the vid - they then play together nicely. However, what happens if I want to send the vid to someone? Must I include the .srt file with the video in order that my friend can view the subtitles? Then - and this is the more important part of my question - what happens with YouTube? How do I upload those subtitles? Or, must I 'burn' them to the vid somehow before uploading? If so, how? Cheers. --KägeTorä - (影虎) (TALK) 18:48, 11 June 2011 (UTC)[reply]

I suggest you burn them in, and send that version, along with the non-subtitled version, to provide a choice, regardless of the software they have at their end. (Netflix doesn't do this, so foreign language films viewed on streaming always have subtitles, which can be quite annoying, if you happen to speak that language.) StuRat (talk) 18:54, 11 June 2011 (UTC)[reply]
Actually, StuRat, many videos on Netflix now have optional subtitles. I just started noticing this last week. --Mr.98 (talk) 19:05, 11 June 2011 (UTC)[reply]
Cool, can you give an example ? StuRat (talk) 00:26, 14 June 2011 (UTC)[reply]
I believe Anvil! The Story of Anvil had the option of English subtitles. --Mr.98 (talk) 00:58, 16 June 2011 (UTC)[reply]
Thanks. That worked on my computer, but not on the Netflix streaming device I use to play movies on my TV. Also, that was English audio with optional English subtitles, presumably for the hearing impaired (although subtitles are sometimes needed to understand Ozzy Osborne and such). I'd like to have all the options that are available on the DVD also available on streaming, which typically is about 3 spoken languages (and maybe a commentary or two) and 3 subtitle languages. Of course, if they burn the subtitles in, this would make it most flexible for my Netflix streaming device, but then you'd need to multiply the number of audio tracks by the number of subtitle options to get a fairly large number of movie files (so 5×3 = 15, in this example). Another option is to upgrade the software on the Netflix streaming devices so they can handle subtitles, but I doubt if that will happen any time soon. StuRat (talk) 08:23, 16 June 2011 (UTC)[reply]
I believe you can upload subtitles for YouTube as SRT files. I've never done it, though, but if you Google "youtube SRT subtitle" you'll find a bunch of people who discuss doing it.
As for distribution, most people aren't accustomed to using subtitle files, and will be confused if you send them along separately. I would burn them in if you want to distribute to people, unless you are willing to do a lot of explaining (and possibly have them download different video viewers). --Mr.98 (talk) 19:07, 11 June 2011 (UTC)[reply]
Right - cheers for the very swift replies. How do I burn subtitles into a video, then? Let's say I have a .wmv and an .srt to go with it (I actually do - two test files from earlier). What I want to make is a new .wmv with the subtitles on it, and still have the original .wmv (and of course the .srt for a total of three files). How do I go about doing this? --KägeTorä - (影虎) (TALK) 19:12, 11 June 2011 (UTC)[reply]
EDIT - Following your advice, Mr 98, I googled 'youtube srt' and found a video of how to burn an .srt to .avi - thanks a lot. For reference, the video is here. --KägeTorä - (影虎) (TALK) 19:52, 11 June 2011 (UTC)[reply]

Referrer spam

[edit]

My web logs show that I've been getting an increasing amount of referrer spam over the past few months. My logs aren't publicly accessible, and have NOFOLLOW/NOINDEX on them anyway. I've tried Googling for them (and other search engines) and haven't found them indexed anywhere. Yet the referrer spam has kept increasing.

Is there any likely explanation of this other than, "I'm on some referrer spam list and thus they do it all the time anyway, since it doesn't take any of their resources"? The only reason it even bugs me is that it makes shifting through my logs more irritating, since there is all of this obvious junk in them. --Mr.98 (talk) 22:14, 11 June 2011 (UTC)[reply]

how much faster would it be if instead of normal SSD, the hard-drive was a little computer behaving like a hard-drive but going off of RAM?

[edit]

If instead of a normal solid-state hard-drive (flash memory), instead it was a little computer with its own flash memory, but many, many 2 GB ram sticks (like 32 of them) to create 64 gigabytes of ram, and then using it all to behave like an even faster hard-drive, then how much faster would that be than a 64 gb ssd (flash-based) by itself? In other words, does a flash-based media already saturate the hard-drive interfaces, and stuff like that, or would having a 100% ram sticks based buffer inside the hard drive enclosure actually speed it up even further? THanks. 188.28.157.156 (talk) 23:09, 11 June 2011 (UTC)[reply]

p.s. the reason I say "little computer" is because I imagine it would have to have its own secondary storage (the flash media), as well as a battery so that it has time to write out to the flash if it loses power suddenly, as well as a processor to direct all that, all attached to a motherboard, etc... basically, "logically" it should be just another hard-drive, whereas in fact, it's a little computer pretending to be a hard-drive while having it all in its ram, and just enough battery to write it all out to ssd when it loses power... Question is: would this, in fact, even be any faster than a flash-based ssd drive by itself? 188.28.157.156 (talk) 23:11, 11 June 2011 (UTC)[reply]
That basically sounds like a RAM disk, which the article says is "orders of magnitude faster than other forms of storage media". When it writes the data to the SSD it would obviously only be as fast as the SSD is, and if the entire thing was connected to the computer via Serial ATA then that would also limit the speed AvrillirvA (talk) 23:19, 11 June 2011 (UTC)[reply]
Right. If the RAM device is connected to a hard disk interface, though, there might not be much gain. According to our Serial ATA article, the fastest hard disk interface in widespread current use will handle a throughput of about 600 MBytes/sec, which is only moderately faster than the fastest currently available SSD devices. Looie496 (talk) 23:40, 11 June 2011 (UTC)[reply]
Note that there's transfer speed (or bandwidth) then there's random access times and latency. While these are generally related, particularly with a RAM (of any type) device, performance generally depends on both and the requirements of the app. SSDs using SATA often have 2-4x the transfer speed of magnetic HDs their biggest advantage tends to come from their very low random access times and latency compared to magnetic hard drives because they don't have to seek. A DRAM based SSD will potentially have better random access and latency although I doubt it will make any difference over a SATA interface for modern high performance SSDs (and you also have to consider the limits of the interface).
Even at the extreme high end (way beyond SATA) from what I've seen most (okay I only ever saw 2 or 3) companies who used to make DRAM based SSDs e.g. RamSan are moving to Flash which suggests we've reached the tipping point. Edit: Came across [2] who still seem to be concentrating on DRAM based SSDs. Edit2: [3] says demand for DRAM based SSDs is growing.
Note if you haven't realised yet, DRAM based SSDs are still usually called SSDs. Our article on SSDs mentions them and some of the devices at IOPS appear DRAM based. RAM disk as per our article usually refers to a software based disk using the system RAM (which is different since it's connected directly to the CPU).
Nil Einne (talk) 02:29, 12 June 2011 (UTC)[reply]