Jump to content

Wikipedia:Reference desk/Archives/Computing/2013 March 7

From Wikipedia, the free encyclopedia
Computing desk
< March 6 << Feb | March | Apr >> March 8 >
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.


March 7

[edit]

? on string functions in Wikitable

[edit]

I'm trying to see if a parameter {{{sil}}} starts with "17-". Can anyone see what am I doing wrong here?

{{#ifeq: {{padleft:|3|{{{sil}}}|}}|"17-"| [if true] | [if false] }}

(I'd also like to see if it ends with -16 in case the above is false, and AFAICT there is no equivalent "padright".)

Thanks, — kwami (talk) 04:43, 7 March 2013 (UTC)[reply]

Padleft isn't what you need for this; you need http://www.mediawiki.org/wiki/Extension:StringFunctions. You can simply use #sub (with positive and negative parameters). Or, if you have no other hyphens in the string, you can split it up with #explode. — Sebastian 06:39, 7 March 2013 (UTC)[reply]
Actually, padleft should work there: it produces the proper output. But #sub doesn't work either. When the parameter begins with 17-, they both return that value, yet #ifeq does not identify it as being 17-.
Also, I don't see how I could use #explode, as all the examples show returns after the delimiter, not before it.
Anyway, the problem seems to not be #sub or whatever, but #ifeq. — kwami (talk) 08:40, 7 March 2013 (UTC)[reply]
Take out the quotation marks around "17-":
{{#ifeq: {{padleft:|3|17-year|}}|17-| [is true] | [is false] }}→[is true]
{{#ifeq: {{padleft:|3|18-year|}}|17-| [is true] | [is false] }}→[is false]
Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); March 7, 2013; 16:17 (UTC)
Thank you, that works!
I'd tried that before, and it didn't work. I added the quotes in afterwards in a random attempt to fix it. Maybe there was a caching problem? — kwami (talk) 19:42, 7 March 2013 (UTC)[reply]
Caching problem is the most likely explanation; I know I've been hoist with that very petard more than once :) Also, with regards to using string functions, while they sure are nice, on the English Wikipedia the extension is not, unfortunately, turned on (and I'm only saying this in case someone else reading this is wondering why the string functions don't do what they are supposed to).—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); March 7, 2013; 20:02 (UTC)
  • {{str left|17-ABCDEF-16|3}} = 17-
  • {{str rightmost|17-ABCDEF-16|3}} = -16

Dragons flight (talk) 19:53, 7 March 2013 (UTC)[reply]

PS. Category:String manipulation templates Dragons flight (talk) 20:02, 7 March 2013 (UTC)[reply]

AVI file interrupted while recording

[edit]

I have a Vivitar DVR 480 Helmet Cam I use on my bicycle, with an external power supply. The connections aren't perfect, however, as when I hit a pothole or other severe bump, the camera stops dead. It's easy to start it again, but the recording that was in progress seems to be lost.

When I check the files on the SD card, the file in question is not visible to the computer. However, the space on the card is being used up by the aborted file, which leads me to believe that the data is there, just not available to the file system since the file wasn't closed in the usual manner while recording.

Is there a way to retrieve the information by someone who isn't a programmer? Thanks. Bunthorne (talk) 17:09, 7 March 2013 (UTC)[reply]

Probably not. The file could be messed up in all sorts of ways, and would take a computer professional to recover it, if even possible. I suggest you get either a tougher camera or use some type of special camera mount to reduce impact and vibration. StuRat (talk) 17:30, 7 March 2013 (UTC)[reply]


I would try PhotoRec and see if that can recover a usable file for you. --LarryMac | Talk 20:01, 7 March 2013 (UTC)[reply]
PhotoRec looks like it might work, but this is an urgent warning. I didn't check carefully enough while trying to download it, and got some software package name 7zip, or something like that, which trashed my computer. I'll spend the next few hours blissfully rebuilding the XP installation. Not your fault, but mine. Just be careful. Once I get my computer working, I'll report if PhotoRec did the job. Bunthorne (talk) 21:05, 7 March 2013 (UTC)[reply]
Authentic 7-Zip should cause nothing like that. What’s the URI of the file you downloaded, exactly? You might have already had something nasty on your box (which wouldn’t be surprising if you’re running a version of Windows that loses extended [read: already barely useful] support next year [or really any version of Windows :p]). ¦ Reisio (talk) 01:46, 8 March 2013 (UTC)[reply]
What happens if you try opening the file in VLC? There are a number of formats that leave almost entirely ordinary data if they’re interrupted, you might look into getting a camera that uses one of them. ¦ Reisio (talk) 01:47, 8 March 2013 (UTC)[reply]
Thanks, everyone, for the help. So far, no luck with the original question. PhotoRec looks like I need more knowledge to use it. The 7-zip problem was offered add-ons and the like, which I refused, but still it trashed the system. I had back-ups, so didn't loose anything except a few days. Thanks again for attempt to help. Bunthorne (talk) 13:16, 11 March 2013 (UTC)[reply]

why declaration of checked exception in method header?

[edit]

-->Hi my doubt is on checked and unchecked exceptions in java.

1) You know that if there is any possibility for checked exception to be thrown from a method and we do not have intention to handle the thrown exception then we have to declare that exception in method header. That means we have to write “throws EXCEPTION NAME” in method header.

2) But in case of unchecked exception, if there is any possibility for unchecked exception to be thrown from a method then we do not declare that exception in method header. That means we do not write “throws EXCEPTION NAME” in method header.

3) Why should we declare the exception in method header in case of checked exceptions ? what benefits are we getting by declaring exception in method header?

4) Why do not we declare the exception in method header in case of unchecked exceptions? — Preceding unsigned comment added by Phanihup (talkcontribs)

I reformatted your question to use wiki-markup and avoid the use of HTML. Astronaut (talk) 17:27, 7 March 2013 (UTC)[reply]
Checked exceptions are basically additional types the function can return. For example a function might be designed to return an InputStream or "return" (by throwing it) a FileNotFoundException, depending on whether a file exists or not. It's useful to mention the exceptional return types for the same reason it's useful to mention the standard return type. Unchecked exceptions are supposed to be for things that shouldn't happen (so it wouldn't make sense to list them as possible "return" types) but sometimes happen anyway (so you would have to list them, if they were checked). -- BenRG (talk) 07:01, 8 March 2013 (UTC)[reply]

Closing programs in Windows 8

[edit]

The other day I had the chance to play around with a Windows 8 for the first time ever (it was a Sony laptop in a store). In only a few minutes I found I quite liked the touch interface, apart from it leaving mucky fingerprints all over the screen. But the most annoying feature by far in those few minutes, was the lack of an obvious way to close a program - no window frame or menu like in Win 7. I ended up pressing ctrl-alt-del, picking the task manager, and forcing application to close because I couldn't find any other way to close a program. Was I missing something really obvious, or are you not supposed to close programs? Astronaut (talk) 17:41, 7 March 2013 (UTC)[reply]

This doesn't answer your question, but I couldn't find it either. Windows 8 is pretty useless on a traditional laptop or desktop. However, Classic Shell will make it function pretty much the way it should. Bubba73 You talkin' to me? 18:10, 7 March 2013 (UTC)[reply]
Swipe in from left to open the bar for switching apps, then long-press on one to bring up the right-click menu, and close from there. I haven't actually used it with touch, but from how it behaves with a mouse I think that will work. 38.111.64.107 (talk) 18:12, 7 March 2013 (UTC)[reply]
Also, the idea is that you don't really need to worry about apps running in the background. If the system feels that it is starting to run low on resources it will start killing apps on it's own. They're supposed to save state so they can recover to exactly where you left off when they are loaded back in. I have seen that cause issues - for example a browser waking up reloads the pages, which may have side effects. 38.111.64.107 (talk) 18:14, 7 March 2013 (UTC)[reply]
But I had these things up full-screen and couldn't get rid of them, so I couldn't do anything else (until after I rebooted). Bubba73 You talkin' to me? 19:36, 7 March 2013 (UTC)[reply]
Tap the lower left corner to open the start screen. Pressing the windows key or moving the mouse to the corner will work too. 38.111.64.107 (talk) 13:41, 8 March 2013 (UTC)[reply]
Also, the first startup gives you a few hints on how to get these hidden things to show up. It shows you how to bring in the settings bar from the right and how to open the start page. I can see how confusing it could be to sit down in front of a windows 8 touch system if you're not aware of the sidebars and hot corners. 38.111.64.107 (talk) 13:43, 8 March 2013 (UTC)[reply]
I bought the retail box upgrade to Windows 8 and it didn't tell me anything about these secret ways of how to use it. Every other time Windows changed, if you were used to the old version, you could use the new version. Anyhow, after a day or two I installed Classic Shell, so tapping or whatever in the lower left doesn't work for me. Bubba73 You talkin' to me? 16:56, 8 March 2013 (UTC)[reply]
To close apps in tablet mode (as opposed to applications in the normal Desktop mode), tap and hold at the very top middle of the screen and drag the app down towards the bottom of the screen. It will shrink and when it gets below about 2/3rds of the way down - let go and it will disappear/close. Nanonic (talk) 19:30, 7 March 2013 (UTC)[reply]
Does the default alt+F4 shortcut not work for you? From the hours I used Windows 8, it seemed to work fine. --Wirbelwind(ヴィルヴェルヴィント) 00:01, 8 March 2013 (UTC)[reply]

Here's how to close the app you're using:

  • With touch or a mouse, drag the app from the top of the screen to the bottom.
  • With a keyboard, press Alt+F4.

Here's how to close an app you were using recently:

  • With touch, swipe in from the left edge without lifting your finger, and then push the app back toward the left edge. You'll see the apps you've used recently, plus Start. Drag the app you want to close from the list to the bottom of the screen.
  • With a mouse, move your pointer into the upper-left corner and then move it down the left edge. You'll see the apps you've used recently, plus Start. Right-click the app you want to close, and then click Close.

Here's a video demonstrating how to close a Windows 8 Metro app: Windows 8 - How To Close Apps And yes, Task Manager works as well. A Quest For Knowledge (talk) 17:04, 8 March 2013 (UTC)[reply]

Google analytics - what's my home page?

[edit]

So I have google analytics set up, and I've followed the instructions, but it says "not installed". I'm worried it may be because I've set the homepage incorrectly. My homepage is www.myisp.com.au/~myname/home.html. But then the other pages aren't called /home/something, they are just called /something.html. What do I do to set it up properly?? As the home page, I've tried both ~myname/home.html and just ~myname, and both times, I'm getting "not installed". What should my home page be, and will it find all subpages, even if they are not below the home page in the directory structure? I need it to find /~myname/home.html, and more importantly, /~myname/somethingelse.html, and of course, the second one does not branch off from the first. Any suggestions? IBE (talk) 19:22, 7 March 2013 (UTC)[reply]

Update, now it says tracking installed, but I have used the /~myname/home.html version. Still curious whether it will find other webpages that are not in a direct line from the home page. IBE (talk) 19:40, 7 March 2013 (UTC)[reply]
Further update: I've shown some initiative, and found I can just add the extra webpage as if it were another site. I'd still be curious to know if there's a simpler way, and if I can just add the parent domain, because it wasn't working before. At any rate, the two crucial pages are now being tracked, or so google tells me. IBE (talk) 22:18, 7 March 2013 (UTC)[reply]
Just set it to "www.myisp.com.au/~myname/" and make sure the tracking script is on every page of it, and it should be able to sort it out. I don't think it matters as much as one might think what you specify your home page — I've had my scripts log things I was doing from my local machine just because I kept the tracking code active. Note that sometimes it takes awhile to determined that it is installed and receiving data — give it a few days, and then you should be able to check it pretty easily if it is getting data. You should be able to go onto Real-Time mode and see when you are accessing any given page on the site. --Mr.98 (talk) 02:59, 8 March 2013 (UTC)[reply]
Thankyou - I'll give that a go, and report back in a few days if it doesn't work, rather than a few minutes, like this time ;) IBE (talk) 17:01, 8 March 2013 (UTC)[reply]