Jump to content

Wikipedia:Reference desk/Computing

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 169.231.8.73 (talk) at 09:16, 1 December 2012 (→‎JQuery works on Codecadamy but not on my machine: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Welcome to the computing section
of the Wikipedia reference desk.
Select a section:
Want a faster answer?

Main page: Help searching Wikipedia

   

How can I get my question answered?

  • Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
  • Post your question to only one section, providing a short header that gives the topic of your question.
  • Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
  • Don't post personal contact information – it will be removed. Any answers will be provided here.
  • Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
  • Note:
    • We don't answer (and may remove) questions that require medical diagnosis or legal advice.
    • We don't answer requests for opinions, predictions or debate.
    • We don't do your homework for you, though we'll help you past the stuck point.
    • We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.



How do I answer a question?

Main page: Wikipedia:Reference desk/Guidelines

  • The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
See also:


November 26

Disk space discrepancy

Used Space on Disk differs from Total Size of all files?

My Hard Disk Drive on my laptop says Used Space is 22GB, but when I open the Drive and read the size of all files (by Select All and view Properties), the size on Disk shows only 12GB. Why the difference? (I did try to Show all hiden and system files before viewing their total size on disk)

Thank you! — Preceding unsigned comment added by 113.161.64.74 (talk) 03:30, 26 November 2012 (UTC)[reply]

I added a title. StuRat (talk) 04:29, 26 November 2012 (UTC) [reply]
What operating system is this for? Some versions of Windows have Restore points that take up space. RudolfRed (talk) 04:47, 26 November 2012 (UTC)[reply]
Yes it's Windows. How do I get rid of those restore points to clean up my disk? It's 10GB that I don't know where it's coming from and I feel like it's a waste of space. — Preceding unsigned comment added by 113.161.64.65 (talk) 06:44, 26 November 2012 (UTC)[reply]
The Disk Cleanup Utility can clear all the System Restore points except the latest one. If you want to delete them all you need to disable system restore. WinDirStat may be useful. Trio The Punch (talk) 02:18, 28 November 2012 (UTC)[reply]
An easier way to get a sense of where your disk space is going is to use a disk space visualizing utility, like Sequoia View. On the use of Restore Points, see this FAQ, which includes instructions on how to disable them, if that's really what you want to do after you understand what the space is being used for. --Mr.98 (talk) 13:31, 26 November 2012 (UTC)[reply]

What a POS article

I'm talking about Persistent object store, of course. Surely somebody has done something using storage tiers, distributed / cloud computing, and messaging systems to push computation deep into the best little data warehouse in Texas by now?

Not to be confused with object-oriented storage system of course.

http://www.computerworld.com/s/article/9173897/Dell_announces_object_based_storage_de_duplication

Hcobb (talk) 18:26, 26 November 2012 (UTC)[reply]

Missing app on Android phone

I have a Droid 4 running Android 4.0.4 (not rooted). I had an RSS reader app on my phone called "NewsRoom". Shortly before Thanksgiving, the feeds stopped updating. I figured that maybe the authors of the few blogs to which I had subscribed were taking a vacation of something.

As of today, the feeds still hadn't updated, so I checked the site manually, and found the my app had simply failed to indicate that the feeds had updated. I looked in the list of installed apps on my phone and NewsRoom is no longer listed. It is also gone from the Google Play Store.

I found the website for Trileet, the company that made the app, but:

  • The linked-to Twitter page has not been updated since April.
  • The Blogger blog was gone ("Sorry, the blog at feedmonger.blogspot.com has been removed.")
  • The support link goes to some parked page.

I cannot find any recent mention of this app or this problem on any blog or forum, even though they claimed to have over one million downloads. What on earth happened, and why is there (almost) no trace of this app?

98.103.60.35 (talk) —Preceding undated comment added 21:58, 26 November 2012 (UTC)[reply]


November 27

thread synchronization-1

Hi! my doubt is on thread synchronization.
when a thread is accesing a method which is synchronized that method should not be available to any other thread until the first thread
completes execution.
But below code not doing so.
you please read and clear my doubts.



class Table
{

synchronized void printTable(int n)

{for(int i=1;i<=5;i++)
{
System.out.println(n*i);
try
{
Thread.sleep(500);

}
catch(Exception ie)
{
System.out.println(ie);
}
}
}
}
class MyThread1 extends Thread
{
Table t;
MyThread1(Table t)
{
this.t=t;
}
public void run()
{
t.printTable(5);
}
}
class MyThread2 extends Thread
{
Table t;
MyThread2(Table t)
{
this.t=t;
}
public void run()
{
t.printTable(100);
}
}
class synchronization2
{
public static void main(String args[])
{
MyThread1 t1=new MyThread1(new Table());
MyThread2 t2=new MyThread2(new Table());
t1.start();
t2.start();
}
}



Expected out put:
5
10
15
20
25
100
200
300
400
500
but the actual output is
5
100
200
10
300
15
400
20
500
25



my doubts:
1)why it is not giving expected output?
2)what is the mistake in the programme?
2)what can i do to get the expected out put?
— Preceding unsigned comment added by Phanihup (talkcontribs) 02:23, 27 November 2012 (UTC)[reply]

Don't you get bored asking the same question over and over again, and just ignoring the answers people gave you? It's the same as #java yield method and yield method in java. In both cases people pointed you to tutorials about java thread synchronization. Yet here you are again, a month later, and you've ignored all that advice. 87.112.97.202 (talk) 02:33, 27 November 2012 (UTC)[reply]
Monitors in java are associated with objects. To coordinate two threads with one another, they must synchronise against the same object, and thus off the same monitor. When you put synchronized in the signature of a method, that means "synchronise on this". In your example, because you've got two instances of Table, there are two objects, and so you're creating two monitors. So the two threads aren't synchronizing off the same monitor, and so they're not coordinated. You could either just alter your code to use a single table (which you pass to both MyThread constructors) or you can explicitly synchronize on a static object (or any singleton). It's a common ideom to synchronize on the class object common to the things you want to synchronize. So that would make printTable look like:
class Table {
    void printTable(int n) {
	// synchronise on a static (the class object) which is shared between all the instances of Table
	synchronized(Table.class){
	    for(int i=1; i<=5; i++) {
		System.out.println(n*i);
		try {
		    Thread.sleep(500);
		}
		catch(Exception ie) {
		    System.out.println(ie);
		}
	    }
	}
    }
}
-- Finlay McWalterTalk 13:22, 27 November 2012 (UTC)[reply]
The above is true for object methods (that is, non-static methods). When you say synchronized on a class method (that is, a static method) they get synchronised on the class instance automatically. So, if it suited your code, you could instead keep the code you have (and not have that explicitly synchronized block) but instead make printTable a class method:
  
  static synchronized void printTable(int n) {
-- Finlay McWalterTalk 13:27, 27 November 2012 (UTC)[reply]
I should note that, in practical examples, it's very seldom a wise idea to sleep while you're holding a monitor, as it unproductively blocks other threads trying to enter that monitor for the duration of the sleep, as java.lang.Thread.sleep(long) retains the monitor during the sleep. (But I do realise your example isn't supposed to be real code). -- Finlay McWalterTalk 15:42, 27 November 2012 (UTC)[reply]

i want some time — Preceding unsigned comment added by Me shankara (talkcontribs) 08:24, 28 November 2012 (UTC) your explanation is correct Finlay McWalter.My doubt is cleared.thanks you sir! — Preceding unsigned comment added by Phanihup (talkcontribs) 09:32, 29 November 2012 (UTC)[reply]

Specific Website blocking for predetermined time

Hello. It's great to be back...

Anyway, I am in need of something which will block specific sites for my own computer. Say if I wanted to not access facebook, I could be able to set the time amount which it would be blocked, and after the time has passed, I would be able to access it. It needs to be compatible with all browsers (so no browser extensions). It also needs to be free. I've looked at what seems to be a popular solutions with parents (I'm actually a teenager trying to actually do work when I need to) such as K9 Web Protection, but it allows one to enter a password to allow access. It needs to block it for a certain amount of time, regardless whether I want to go back on facebook or not. Any suggestions? — Preceding unsigned comment added by 122.108.156.85 (talk) 03:43, 27 November 2012 (UTC)[reply]

I think someone asked a similar question before. You might want to check the archives for answers. One solution would be to modify the hosts file on your computer so that the website gets a bogus addresses assigned, which will result in an error message if you try to access it. See hosts (file). You could then have a program run at certain times that would put the modified host file into place and then at a later time it would put back the host file that allows the website access. Every OS should have a way to launch the program on a timer. On Linux, you could use cron. On Windows you can use the Task Scheduler. RudolfRed (talk) 03:55, 27 November 2012 (UTC)[reply]
K9 Web Protection works on both Windows and Macintosh, which OS do you use? There is one site that specializes in geeky methods to stop you from slacking off: Lifehacker.com [1][2][3][4] Trio The Punch (talk) 06:27, 27 November 2012 (UTC) p.s. For the pro's: Focused Time and iNet Protector.[reply]

Thank's Trio, your number 5 link was just what I needed. Not cross browser and easy to change with a click of a button, but the best so far. Thank you! 122.108.156.85 (talk) 08:13, 28 November 2012 (UTC)[reply]

C recognizes sqrt except for once

I use sqrt several times, and only once do I get the error: undefined reference to 'sqrt'

int distanceBetween (struct Point p, struct Point q)
{
      return sqrt(pow((q.y - p.y ), 2.0) + pow((q.x - p.x ),2.0));
}

Why am I getting that error in just this one function? 128.111.43.35 (talk) 04:34, 27 November 2012 (UTC)[reply]

Some compilers or linkers will only report one error for each missing function. RudolfRed (talk) 06:28, 27 November 2012 (UTC)[reply]
And the solution to this problem is probably to #include <math.h> and to link and/or compile with -lm. --Stephan Schulz (talk) 07:15, 27 November 2012 (UTC)[reply]
By the way the hypot function does most of that work though not all systems support it. And if you want to square a number x^2 is more obvious and faster. Dmcq (talk) 09:33, 27 November 2012 (UTC)[reply]
I think you mean x*x - ^ is the binary XOR operator in C. AndrewWTaylor (talk) 10:08, 27 November 2012 (UTC)[reply]
Yes you're right, stupid me - I've just using another language, I also use ** sometimes. Dmcq (talk) 23:16, 27 November 2012 (UTC)[reply]

pari/gp or possibly bash problem

Hi. kubuntu linux; bash; gp version 2.5.3. If I type

echo 'vector(600,i,i)' | gp -q

it works as expected but

echo 'vector(700,i,i)' | gp -q

gives undesired output: it truncates and puts three plus signs. I want the full vector. How do I make gp produce what I want? Robinh (talk) 09:07, 27 November 2012 (UTC)[reply]

http://pari.math.u-bordeaux.fr/dochtml/gpman.html ¦ Reisio (talk) 18:04, 27 November 2012 (UTC)[reply]
(OP) thanks for this, Reisio. There doesn't seem to be a flag that solves my problem. Looks like I'll have to write to the pari team. Best wishes, Robinh (talk) 22:01, 27 November 2012 (UTC)[reply]

i Have 2 Vids which play in my Pc in Mono sounding

when i play them, i hear sound only from one amplifier. my amplifier are fine, this happens only with the vids. what can i do? — Preceding unsigned comment added by 79.182.153.70 (talk) 16:12, 27 November 2012 (UTC)[reply]

Figure out how to make your player send a single channel to both speakers, or how to re-encode the video to do the same. ¦ Reisio (talk) 18:00, 27 November 2012 (UTC)[reply]
Hi, i don;t have the tools to figure it out. — Preceding unsigned comment added by 79.182.153.70 (talk) 19:42, 27 November 2012 (UTC)[reply]
You could tray by checking the option "speakers fill"
Iskánder Vigoa Pérez (talk) 03:52, 28 November 2012 (UTC)[reply]


November 28

c puzzle

Hi ! see the below two programmes.


Programme1:

#include<stdio.h>
#include<conio.h>
void main()
{
int x=20;
float f=20.123;
clrscr();
printf("%f",x);
getch();
}

out put:

0.000000

Programme2:

#include<stdio.h>
#include<conio.h>
void main()
{
int x=20;
clrscr();
printf("%f",x);
getch();
}

out put:

printf:floating format point not linked
abnormal programme termination.

My doubts: 1)the printf statement in both the programmes is same.But out put is different.why it happens? 2)is there any effect of the statement "float f=20.123" on the output. please clear my doubt. — Preceding unsigned comment added by Phanihup (talkcontribs) 00:31, 28 November 2012 (UTC)[reply]

Looks like a bad linker, to me, which correctly sees the "float" command as requiring that it link to the floating point module, but fails to see that the "%f" format also requires inclusion of the floating point module in the link list. (It is a bit odd to try to print an integer with a floating point format.) StuRat (talk) 00:39, 28 November 2012 (UTC)[reply]
%f in the printf format string says the corresponding argument is of type double, that is a Double-precision floating-point format number. In the first case you're passing it a float, but in the second you're passing an int. The two aren't compatible, so you get an error. A good compiler can detect this kind of thing: for example, gcc says "warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’" and clang says "warning: conversion specifies type 'double' but the argument has type 'int'" -- Finlay McWalterTalk 00:41, 28 November 2012 (UTC)[reply]
He's actually trying to print an integer as floating point, in both cases. In the first case, this produces an incorrect value, and in the second case, an error. StuRat (talk) 00:43, 28 November 2012 (UTC)[reply]
Quite right. It looks like this compiler (Phanihup: what compiler is it? Turbo C??) will omit the float part of the C library when it doesn't see a use of floating point in the source (and it's not smart enough to parse the format string). -- Finlay McWalterTalk 00:53, 28 November 2012 (UTC)[reply]
The C99 standard [5] says in 7.19.6.1.9 (PDF page 292): "If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined." Anything is consistent with "the behavior is undefined" so it's allowed to print some number in one case and an error message in another (although it's not the most helpful for debugging). By the way, the string "the behavior is undefined" occurs around 150 times in the standard. PrimeHunter (talk) 02:48, 28 November 2012 (UTC)[reply]
Even if "undefined", one would expect it to behave consistently. StuRat (talk) 03:13, 28 November 2012 (UTC)[reply]
Undefined is undefined. And actually removing the floating point library can be quite useful if one wants to produce a system routine where there is no floating point context. But yes the compiler should check printf formats as this is a very common type of error. Dmcq (talk) 15:29, 28 November 2012 (UTC)[reply]
Couple points:
  • The OP is evidently using a very old compiler. But the answer to the "floating point formats not linked" questin is straightforward: see the comp.lang.c FAQ list, question 14.13.
  • Passing a float value to the %f format in printf is actually not a mismatch. See the FAQ list again, question 12.9.
Steve Summit (talk) 03:20, 30 November 2012 (UTC)[reply]
Yes, passing a float value to the %f format is not a mismatch, as float is converted to double. However, Phanihup passes an int argument, not float. --CiaPan (talk) 05:54, 30 November 2012 (UTC)[reply]
The answers are:
  1. The float variable declaration tells the compiler a floating-point library is necessary, so it generates apropriate references. Then the linker attaches the library to your programme. That allows the printf() function to interpret %f format correctly, and that's why the first programme tries to print out some results, and the latter prints the error message.
  2. There's a big difference between how integer values and floating-point values are stored in memory – see Integer (computer science), Double-precision floating-point format.
    When you pass an int value to printf() the compiler does not check if int type fits %f requirements. Also printf, when scanning its printing format string, can't check wether you passed double or not. So it interprets appropriate place in memory, where it expects the double value to be printed out, and interprets your int value with Double-precision floating-point format. The result is zero, so the output 0.0000.
CiaPan (talk) 06:11, 30 November 2012 (UTC)[reply]

math word problem

I've raked 2/3rd's of a yard full of leaves. If I rake 5200 more I'll be 8/9th's done. How many leaves were in the yard ? — Preceding unsigned comment added by 68.37.64.194 (talk) 02:33, 28 November 2012 (UTC)[reply]

Here goes.
  • 8 ninths minus two thirds=5200
  • 8 ninths minus two thirds=two ninths
  • 5200/2*9=23400
23400 leaves. Buggie111 (talk) 02:41, 28 November 2012 (UTC)[reply]
Looks good to me, although I'd encourage you to use a variable, such as X, to represent the total number of leaves:
 2x            8x
---- + 5200 = ----
 3             9
Also, once you've determined that X = 23400, you can plug it back in as a check:
2(23400)          8(23400)
-------- + 5200 = --------
    3                 9
          20800 = 20800
Both sides match, so it checks out. Always check your work. BTW, the Math Desk is the best place for Q's like this. StuRat (talk) 03:21, 28 November 2012 (UTC)[reply]

Browser fingerprint

Besides private mode, disabling javascript and using a common browser, what else can you do to browser privately? PS: I don't want to use something like Tor. Comploose (talk) 15:15, 28 November 2012 (UTC)[reply]

Disable cookies (you can enable only the ones you truly care to have on most browsers) [private mode probably takes care of this], disable Flash (or at least Flash cookies) [no idea if private mode covers this], and avoid looking special according to any criteria at http://panopticlick.eff.org/. You could use a VPN as a proxy. ¦ Reisio (talk) 15:41, 28 November 2012 (UTC)[reply]
Yes, private mode + no javascript cover these points. According to panopticlick what makes me "special" is the user agent and HTTP_ACCEPT Headers. I know that I can change the first at least in Chrome, Firefox and IExplorer. But, I suppose that the most useful way of being private is to provide fake information in all topics that are being collected. Is that possible? This information has to be saved somewhere in the browser. Comploose (talk) 15:55, 28 November 2012 (UTC)[reply]
Fake isn't the goal - generic is. If you fake a combination of things that no one else is running, then you still have a unique identifier. It looks like the paper linked on the panopticlick site gives some common data at the end. Installing a browser version listed on the site and not changing many settings (other than private mode + no javascript) is probably a good start. 209.131.76.183 (talk) 16:02, 28 November 2012 (UTC)[reply]
Also, a plugin that switches between common user agents over time could be interesting. I wouldn't be surprised if something like that exists. 209.131.76.183 (talk) 16:03, 28 November 2012 (UTC)[reply]
Yes, I mean fake constantly, changing the parameters (fonts, cookies acceptance, HTTP_ACCEPT Headers, and so on) that I am supposed to have. That generates chaos. Otherwise, your browser would be the browser that discloses almost no information on the IP range 101.34.yy.xx. Disclosing less than others also makes you unique. Comploose (talk) 16:10, 28 November 2012 (UTC)[reply]
Alternate the use of several browsers, even the exotic ones, do just log-in and log-off before navigating to other pages (which is like telling you are there). And don't get paranoid about it, unless you have a reason for it. OsmanRF34 (talk) 19:25, 28 November 2012 (UTC)[reply]
The safest method I can think of is to use an O/S and browser that boots from a DVD, on a PC with no hard drive. Thus, it would have nowhere to store anything, no matter how hard it tried. Of course, the lack of cookies and such would also make browsing annoying, in that it wouldn't remember any logon IDs, preferences, etc. An advantage is that you would also be virtually virus-proof, and therefore wouldn't need a virus-scanner slowing down everything you do. StuRat (talk) 08:32, 29 November 2012 (UTC)[reply]
That's right regarding safety, but the question was about privacy online. In your scenario, I am afraid that you would "too unique", in the sense that not many others would have exactly the same configuration as you. In both cases, privacy and security, there's no need to get paranoid, the basics (safe passwords, no downloading and running any kind of stuff, updating your system) should be more than enough for most kind of users. OsmanRF34 (talk) 12:09, 29 November 2012 (UTC)[reply]

Unexpected JDWP error: 21

Figured the problem out on my own, it was something unrelated to this one.
The following discussion has been closed. Please do not modify it.

I am trying to create a MIDlet in NetBeans 7.2. For some reason this line XYcoord temp = new XYcoord(0, 0); causes a java.lang.NullPointerException to occur. Debugging and hovering over the variable temp after trying to initialize it shows Unexpected JDWP error: 21. I have no idea how that happened.

Here's the XYcoord class, which is defined on an another file in the same package:

public class XYcoord
{
    int m_x;
    int m_y;
    public XYcoord(int x, int y)
    {
        m_x = x;
        m_y = y;
    }
    public int GiveX()
    {
        return m_x;
    }
    public int GiveY()
    {
        return m_y;
    }
}

Klilidiplomus+Talk 18:55, 28 November 2012 (UTC)[reply]

Resolved

Regulations on feature set in software comparison articles

Comparison of BitTorrent clients (edit | talk | history | protect | delete | links | watch | logs | views)
There's an edit warring in the referenced article about whether to include a certain feature into the comparison. I advised them to seek consensus but am unsure of how to seek it in this case. The feature is of course covered in RS'es. And there doesn't appear to be any policies, guidelines or even prior discussions on picking a feature set for comparison. Are there any? — Vano 19:43, 28 November 2012 (UTC)[reply]

The relevant policy is WP:NPOV, but mostly, try to use good judgement and don't go along with people arguing against common sense. You can ask for outside comment at WP:Requests for comment. The reference desk is not actually appropriate for this type of question, which is one of WP:Dispute resolution. 67.119.3.105 (talk) 21:29, 28 November 2012 (UTC)[reply]
I thought it's appropriate to survey on existing practices which is what I did. You gave the answer on this, thanks. — Vano 22:01, 28 November 2012 (UTC)[reply]

What's the easiest way to create a local server with proxypass on Windows?

I have a folder containing html content, and I'd like to serve it from http://somelocalhost. I also want to set up a ProxyPass so that I can define that somelocalhost/xyz could be pointed somewhere else.

On OS X I've always used Apache, but on Windows I'm having a lot of trouble setting it up. Is there something that's even easier that would work out-of-the-box on Windows? Or should I keep plugging away at making Apache work?

Thanks! — Mike 166.186.169.41 (talk) 21:44, 28 November 2012 (UTC)[reply]

November 29

What type of port would have a number like PPA04-07?

And how would you find this port number?

Perhaps Philippine Ports Authority. Graeme Bartlett (talk) 10:08, 30 November 2012 (UTC)[reply]

Odd domain name practice

A couple years ago, the owners of http://pineconeinn.com screwed up and didn't renew the domain name. Oh, that would be me. What I've never been able to figure out is what the hell the new owner, Whois Watchdog, does with their 11,000 or so domain names (other than perhaps punish people whose spam filter misfiled the renewal notice.) Anyone have a clue? --jpgordon::==( o ) 04:41, 29 November 2012 (UTC)[reply]

They run ads on it, hoping people trying to find your old site will see it, and probably hope you'll try to buy it back from them. --Mr.98 (talk) 04:58, 29 November 2012 (UTC)[reply]
Except (a) there never have been any ads on the page; (b) none of the links leave the page; (c) I happily would have bought the domain back from them but they appear to have a history of refusing to respond to any such requests. --jpgordon::==( o ) 05:38, 29 November 2012 (UTC)[reply]
When I click on the links on the page, they lead to "sponsored" listings. That looks like ads plus perhaps PageRank gaming to me. --Mr.98 (talk) 16:28, 29 November 2012 (UTC)[reply]
Oh! Maybe one of my ad-blocking or other hygienic add-ons is preventing those from opening for me. Makes sense. --jpgordon::==( o ) 18:19, 29 November 2012 (UTC)[reply]
I have had similar situations (of non-response to my buy proposal, not the hijacking of any site i previously owned)..... this is extremely annoying and I'm surprised that ICANN or some other governing body does not have some law against this. When someone with a legitimate business to run cant get a decent TLD because arseholes register all the good domain names and don't respond, this seems very unjust.... and against the philosophy of the internet as a place for freedom of information sharing and publicity etc.
137.81.118.126 (talk) 11:35, 29 November 2012 (UTC)[reply]
It doesn't appear to be a case of hijacking. The domain has expired and had become available to any new client. The new owner has probably monetized it at the beginning, as visitors still went there looking for the legit Pine Cone Inn. Anyway, it seems that your new domain name will have to be www.pinecone-inn.com or something like that. OsmanRF34 (talk) 12:34, 29 November 2012 (UTC)[reply]
I imagine there are several possibilities for why they appear to have no interest in selling it back. It may be that the 'history of refusing' actually means they refuse any requests of the sort you (or those you've read about) are likely to make. Perhaps they only consider offers 5k or even 6k figures or whatever, or talk to someone likely to be able to pay that amount. Since it's not always easy to predict what will one day become hot property, they may prefer to hold on to domains they consider decent prospects rather then sell them off for lower amounts. They may also wish to reduce the risk of cybersquatter action against them by only dealing with a few cases so people can't point to a history of them doing that. (The fact that they don't seem to be doing anything with their domains may point to thatcount against them in a cybersquatting case, but may be it doesn'twon't.) It may also be they have a few future possible plans to have some sort of business but haven't finalised them yet. Nil Einne (talk) 12:06, 29 November 2012 (UTC)[reply]
It might also be a one-man enterprise, it's easy to get overworked managing 10T+ domains. OsmanRF34 (talk) 12:34, 29 November 2012 (UTC)[reply]

FWIW, linking to the domain will only make them think it's worth asking more for. ¦ Reisio (talk) 18:34, 29 November 2012 (UTC)[reply]

There's also the problem that asking for money for a domain name has been taken as evidence a person is squatting on the domain name and so domains have been taken away without recompense. That means the squatter is better off ignoring such requests and making money exploiting the name Dmcq (talk) 18:30, 30 November 2012 (UTC)[reply]
Yes I imagine that could become tricky if they bought it knowing you wanted it and sought your purchase out. If they merely ask for more when you approach them, it may well be of no matter at all. The cost of hanging onto a domain in the event that someone, anyone, in the future, will pay any range of price for it, is not particularly high. ¦ Reisio (talk) 20:09, 30 November 2012 (UTC)[reply]

synchronization block vs synchronization method in java

Hi! i am trying to understand difference between synchronization block and synchronization method in java.
I searched in google.but i could not get satisfactory and detailed explanation.
can you tell me the difference between them ?
I hope you provide detailed explanation.
— Preceding unsigned comment added by Phanihup (talkcontribs) 13:11, 29 November 2012 (UTC)[reply]

I think I covered this pretty thoroughly in my earlier reply to you. Beyond that, you'd be wise to consult the java synchronization tutorials you've previously been referred to. Briefly, as I said before, a synchronized method is the same as a block where the synchronization locus is explicitly defined as this. So the following two methods are essentially the same:
public class sync {
    public synchronized void foo(){
            // stuff
    }

    public void foo2(){
	synchronized(this){
            // stuff
    	}
    }
}
-- Finlay McWalterTalk 13:20, 29 November 2012 (UTC)[reply]
Maybe Phanihup's read thread is severely starved for CPU cycles. Whatever we reply, it's just not getting through. 217.251.159.249 (talk) 16:24, 29 November 2012 (UTC)[reply]

November 30

blender modelling

Would it be possible to sculpt and rig a character in blender, move it into different positions and export those as .stl files, retaining all information on how the different parts are arranged?

86.15.83.223 (talk) 10:26, 30 November 2012 (UTC)[reply]

Yes, Blender can both export in .stl format and you can choose what to export (highlight in object mode). OsmanRF34 (talk) 11:11, 30 November 2012 (UTC)[reply]

URL of a single element on a web page

Hi all,

I was wondering if it is possible to load a single element of a webpage in a browser? For example it is easy to just load a single image like www.example.com/example.jpg , but is it possible to just load the text "main page" on wikipedia, or in my case I need to load the text "As of Nov 28 2012" just below the graph at http://funds.ft.com/uk/Tearsheet/Summary?s=GB0003197281:GBX without loading all of the pesky ads/images and so forth. Essentially I have hundreds of similar pages and have automated reading that bit in VBA but it takes ages loading all the web page every time. If so, how would you acomplish this? Many thanks for any help given. 80.254.147.164 (talk) 13:16, 30 November 2012 (UTC)[reply]

It simply can't be done. You could see if the website has an API available to let you progamatically query things without loading all the HTML. What you're doing now is called screen-scraping, which is often against the TOS of a website. If you do it somewhat often the people running the site may notice and cut you off, and no matter what you'll be vulnerable to slight changes in the layout of the page breaking your code. 209.131.76.183 (talk) 13:53, 30 November 2012 (UTC)[reply]
You can't selectively pre-load specific data unless the website makes that explicitly available to you. Otherwise you have to just do what you're already doing. Though I'm confused as to why it "takes ages" — you should be able to just load the HTML first, then grab anything you want out of that, right? Without ads or images or whatnot. Your VBA code sounds inefficient. (We can help on that, if you post it.) --Mr.98 (talk) 14:03, 30 November 2012 (UTC)[reply]
How would I do that? All examples I have seen involve loading the page first then opening the HTML file. The relevant bit of my code is:
      URL = "http://funds.ft.com/uk/Tearsheet/Summary?s=" & ISIN & ":" & Curr
      With IE
        .Navigate2 URL
        .Visible = True  
      End With
     Do Until IE.readyState = READYSTATE_COMPLETE
     DoEvents
     Loop

80.254.147.164 (talk) 15:22, 30 November 2012 (UTC)[reply]

It looks like you're using VBA to drive IE, so it's IE loading the page. Presumably it's all the ancillary stuff you don't want on that page that's slowing things down. Slaving IE like this seems like a pretty desperate way of doing things when all you want is the HTML text itself. You'll surely get on much better having your program download the html itself. This MSDN article discusses web scraping in full Visual Basic. -- Finlay McWalterTalk 15:35, 30 November 2012 (UTC)[reply]
That looks like VB.NET to me, not VBA. Among the tip-offs is that VBA doesn't really do multithreading. --Mr.98 (talk) 00:27, 1 December 2012 (UTC)[reply]
What you are really asking VBA to do, if you just want the text content, is to make a simple HTTP request and then give you the contents. Here's a bare outline of how such a thing would work (this code was originally written for MS Access; it might take some adapting to use it in Word or Excel or whatever you are using; if you have difficulties, just Google the line that's giving you guff, or ask us on here):
Public Function http_Resp(ByVal sReq As String) As String

    Dim byteData() As Byte
    Dim XMLHTTP As Object

    Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")

    XMLHTTP.Open "GET", sReq, False
    XMLHTTP.send
    byteData = XMLHTTP.responseBody

    Set XMLHTTP = Nothing

    http_Resp = StrConv(byteData, vbUnicode)

End Function
Basically you past your URL to sReq and, in theory, it'll return the HTML of the URL in question. Then you'll need to process it (e.g. parse the XML; there are VBA APIs for this as well if you Google around a bit) and extract the value you want. Much quicker than trying to get IE to do it for you. --Mr.98 (talk) 00:27, 1 December 2012 (UTC)[reply]

Handling game state in VB

I am writing a BlackJack Program in VB.NET. The game has 4 actions the player can take: Bet, Hit, Stand, and Deal. The player can only take some of these actions at certain parts during the game, for example, at the start of a new round you can only Bet, and not Hit, Stand or Deal. The actions you can take are tracked using properties: CanBet, CanHit CanStand and CanDeal. So for example, at the start of the round they are all set to false and CanBet is set to true. The UI handles a property changed event to update the state of the relevant buttons.

For example, here is the Bet routine:

    Public Sub Bet(ByVal amount As Integer)
 
        ResetPlayerActions()
        CanHit = True
        CanStay = True
 
        BetAmount = amount
        Me.Amount -= amount
        NewHand()
 
    End Sub

Is this the correct way to implement this behavior, or are there any design patterns that can do a better job.

86.40.42.232 (talk) 15:00, 30 November 2012 (UTC)[reply]

Maybe the abstraction of a Finite-state machine will help with this. For each state the game is in, only a certain subset of actions are allowed. Astronaut (talk) 18:26, 30 November 2012 (UTC)[reply]
Are there any conditions where you can hit but can't stand, or vice-versa ? If not, then a single variable will do.
Stylistically, I'd place the "CanHit = True" and "CanStay = True" lines after the "BetAmount = amount" and "Me.Amount -= amount" lines. It won't make any difference in the execution for non-objected oriented code, but it just seems more logical to enable the next actions after the bet has been placed and the hand has been dealt (did I miss where you did this ?). Under an object-oriented approach, setting those Boolean variables early might trigger play to start before the bet has been set. BTW, do splits, double-downs, insurance, and side bets have to wait for version 2.0 ? And I assume we reshuffle after every hand ? StuRat (talk) 19:21, 30 November 2012 (UTC)[reply]
You didn't say whether you wish to take an object-oriented approach or not. I assume VB.net gives you the choice. First, let me discuss the non-object oriented approach:
I seem to see a logic error. If "NewHand" is only called at the beginning of a hand, then there's no need to tell it you can hit and stay, as that's always the case at the beginning of a hand (I sure hope NewHand doesn't have a call to Bet, as that would make for an infinite loop). If you did want Boolean variables to flag when you can hit and stay, say to pass on to the next subroutine, then initializing those at the start of "NewHand" would make more sense than here. However, I suspect that what you call "NewHand" is actually intended to be called not only when the hand is new, but for each subsequent action, as well. In this case, initializing the values for "CanHit" and "CanStay" here is appropriate, but the name "NewHand" is not. It should be called something like "MakeMove", if it is indeed to be called for every move, not just the initial move.
In addition, you may be able to do away with the "CanHit" and "CanStay" variables entirely. They are only useful if the conditions you evaluate to determine whether you can hit or stay are remote from where you want to use those variables. If it's as simple as (in pseudocode) "if DealerPoints < 21 and MyPoints < 21", or (allowing for 5-card Charlies) "if DealerPoints < 21 and MyPoints < 21 and MyCards < 5", then just put that line where you would put "if CanHit".
I also don't think you need CanBet and CanDeal variables, as the dealing always happens directly after placing the bet. In Object-oriented programming they tend to do it this way, but, in a more traditional approach, you can just place the deal code after the bet code.
So, to summarize this all, let me suggest (non-object-oriented) pseudocode like this (only the subroutine names are listed):
MAIN
      .
      .
      .
 do until UserQuits: 
   MakeBet
        .
        .
        .
   DealCards
        .
        .
        .
   do while DealerPoints < 21 and MyPoints < 21 and MyCards < 5 and not UserStanding: 
     MakeMove
          .
          .
          .
   ComputeHandResults
        .
        .
        .
Of course, if you want to take advantage of the object-oriented approach, you can do that instead. That might look more like this:
 MAIN  
   CanBet = True
   CanDeal = False
   CanPlay = False
   HandOver = False
   UserHasQuit = False
   MakeBet (fires when CanBet is set to True)
        .
        .
        .
     CanBet = False
     CanDeal = True
   DealCards (fires when CanDeal is set to True)
        .
        .
        .
     CanBet = False
     CanPlay = True
   MakeMove (fires when CanPlay is set to True)
        .
        .
        .
      if DealerPoints ≥ 21 or MyPoints ≥ 21 or MyCards = 5 or UserStanding:
         CanPlay = False
         HandOver = True 
   ComputeHandResults (fires when HandOver is set to True)
        .
        .
        .
     HandOver = False
     if UserQuits:
       UserHasQuit = True
     else:
       CanBet = True
   UserQuit (fires when UserHasQuit variable is set to True) 
        .
        .
        .
StuRat (talk) 19:49, 30 November 2012 (UTC)[reply]
The game is it's own object, the window knows nothing of the game rules, it just enables/disables whatever actions the game says are available (via INotifyPropertyChanged). There are style problems which I intend to fix, I just what to mack sure I'm on the right track with this first.

BTW, do splits, double-downs, insurance, and side bets have to wait for version 2.0 ? And I assume we reshuffle after every hand ?

Yes they do. They are not on the Assessment Brief, so there's no marks for adding them. Shuffling is done only once, when the deck(s) is/are first created. This allows card counting! 86.40.42.232 (talk) 21:58, 30 November 2012 (UTC)[reply]
Also, it limits the number of hands you can play. With 52 cards in the deck and an average of maybe 6 cards per two-player hand, I'd only expect to get in maybe 8 hands. StuRat (talk) 22:24, 30 November 2012 (UTC)[reply]
You should probably start designing your code at a higher level first, where you list individual functions and what each will do, before getting into the details of where each variable is initialized. Have you done this yet ? StuRat (talk) 22:28, 30 November 2012 (UTC)[reply]

Wireless icon origin, name, etc?

Does the icon often associated with WiFi (not the Wi-Fi Alliance's logo) have an official name? Who came up with it and when? Is it copyrighted? Paganpan (talk) 19:50, 30 November 2012 (UTC)[reply]

My guess is it's rooted in the history of radio and wireless radios. I doubt whoever first came up with or popularized it bothered to take any credit. Iconography/symbology/graphic design wasn't exactly as important or career associated back then, I dare say. No doubt the history of people drawing invisible emanating "waves" from a particular point is about as old as drawing. ¦ Reisio (talk) 20:17, 30 November 2012 (UTC)[reply]

po files and plural forms

Translating a website from English to Polish I am stuck at the following phrase: "Last %s items", where %s is a number larger 1. The translation in Polish will depend on the size of %s as the language has multiple plural forms. Is it possible to add a condition (if statement) directly in the po file to take care of this or would I have to go back to the website code to add an if condition there? I read about "plural forms" in this context, but is this what I need? bamse (talk) 21:33, 30 November 2012 (UTC)[reply]

GNU's documentation for its implementation of gettext says the PO syntax supports the ternary (conditional) operator ?:, documented here. It looks like you can nest multiple ternary operators to handle the complications of Polish language plurals (Polish is explicitly called out in the programmatic section of gettext's plurals documentation here). -- Finlay McWalterTalk 21:57, 30 November 2012 (UTC)[reply]
Thanks for pointing me in the right direction. In fact it was easier than that. Just had to wrap all such strings in "ngettext" and I get the option to translate to various plural forms in poedit. bamse (talk) 23:33, 30 November 2012 (UTC)[reply]


December 1

Python syntax error

I've recently started learning Python, and I'm trying to write a simple program to calculate the day of the week. However, the following code (designed to determine if a user-entered year is a leap year, in which case 1 must be subtracted from the total) does not appear to be valid:

if month == January or February and year % 4 == 0 and year % 100 != 0:
total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code - 1
elif month == January or February and year % 400 == 0:
total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code - 1
else total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code

When I run the program, I receive the following error:

 File "Weekday.py", line 53
   else total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code
            ^
SyntaxError: invalid syntax

What is invalid about the "l" of "total"? Pokajanje|Talk 00:06, 1 December 2012 (UTC)[reply]

missing colon after else. -- Finlay McWalterTalk 00:15, 1 December 2012 (UTC)[reply]
Yes, but also Python requires proper indentations, as a syntax element. Perhaps they were lost when the OP did the cut and paste, but, just in case, here it is corrected:
if month == January or February and year % 4 == 0 and year % 100 != 0:
   total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code - 1
elif month == January or February and year % 400 == 0:
   total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code - 1
else:
   total = day + month_code + int((year_breaker[-2:]/4)) + int(year_breaker[-2:]) + century_code
StuRat (talk) 00:20, 1 December 2012 (UTC)[reply]
Note that error messages frequently point to the next thing after the error, rather than the error itself, as in this case. StuRat (talk) 00:23, 1 December 2012 (UTC)[reply]

Thanks for the quick responses and your patience. I am now receiving another, unrelated error. The formula requires that one of seven different numbers be added to the total, depending on the month (I have named this variable "month_code"). So early on in the program I have:

month = raw_input("Enter the month (the whole word). ")

And later I have an if statement beginning with:

if month == April or July:
    month_code = 0
elif month == January or October:
    month_code = 1

When the program runs, I can enter all the data, but then I receive:

NameError: name 'April' is not defined

Just as the previous error, I'm sure this is something obvious, but I don't know enough to see it. Pokajanje|Talk 00:34, 1 December 2012 (UTC)[reply]

  • (edit conflict) Note that month == January or February will yield True as long as February is not False/None/0; use
month == January or month == February

or

month in (January, February)

Use parentheses to force the operator precedence you want, for example

if (month == January or month == February) and (year % 4 == 0) and (year % 100 != 0):

which also comes with the benefit of added readability. About the April symbol error, look up your code, make sure that April is being defined before execution reaches that point — Frankie (talk) 00:41, 1 December 2012 (UTC)[reply]

I tried all three of your suggestions. None worked. I intend that if the user enters "April", thereby making "month" equal to it, "month_code" will be zero. So there's really nothing to define. Pokajanje|Talk 00:55, 1 December 2012 (UTC)[reply]
Ok, are you doing something like month = raw_input("Please enter the month: ")? If so you need to use quotes because it is a string: if month == "April". It's case sensitive, so if the user enters "april" it will yield False — Frankie (talk) 01:09, 1 December 2012 (UTC)[reply]
Yes, and I have since fixed that and several other errors. The program now runs fully, but it gives the wrong days (calling November 30, 2012 a Monday). I looked through it very carefully, and checked the math and the formula myself, but I still can't find my mistake. The full source code (thus far) can be found here. The formula I am using can be found here. Pokajanje|Talk 04:59, 1 December 2012 (UTC)[reply]
Diagnosing these problems is called debugging and it's a very major component of programming at every level, so now you get to develop some skill at it. The amount of code you wrote without testing and debugging it was already maybe larger than ideal. You should write just a little bit of code (just a few lines when you're just getting started), test it, fix any problems, write a little more, etc. But this program is still pretty small and you should be able to find the problems and fix them.

Anyway what I'd suggest is working through the formula by hand with pencil and paper for a known date like November 30, 2012; write down all the intermediate results. Do you get the right answer? In this case, the program has errors. Add a series of print statements to the program to show the intermediate results during the calculation, and compare them to the steps in your hand calculation. Where you see a discrepancy, figure out what has happened, and that is probably a bug. Of course there may be multiple bugs, so keep testing and checking til you're confident that everything is fixed. Generally, don't try too hard to figure out in your head what the program is going to do at a given point, since it's easy to make errors. Add print statements to trace the program's activity so you can know for sure whether it's going wrong at a particular place.

One note: the integer division operator in Python is // (double slash) rather than / (single slash). Single slash works in Python 2 but will throw a warning is deprecated. In Python 3, it will give a floating point result and that can lead to wrong outputs. 66.127.54.40 (talk) 07:09, 1 December 2012 (UTC)[reply]

A few minor problems I see:
1) When you give the error message "Error: this program cannot find dates before 1500 or after 2699", you don't do anything to prevent it from executing the rest of the code normally. Ideally you would loop back and ask for the year again.
2) Asking for the first two digits of the year, then the last 2, is sloppy. You should just ask for the full year and parse it yourself.
3) The prompts should end in a colon, not a period. This is how the user can easily distinguish between normal prints (ending in periods) and prompts.
4) As pointed out above, you need to change the month name to either all uppercase or all lowercase, to make comparisons work despite their case. Python provides simple methods to do those conversions.
5) "Enter the day" is ambiguous. Try "Enter the day of the month" (versus the day of the week).
6) You have part of the last line repeated at the end, causing a syntax error.
As for why you are getting wrong answers, if you can provide a text description of the logic you are attempting to implement, it would be easier to for us to help you debug. StuRat (talk) 07:41, 1 December 2012 (UTC)[reply]
Just to help the OP along: You program still has the (incorrect) if month == "April" or "July". This is not interpreted as if (month == "April") or (month == "July") as you intend. "July" on its own is the the second expression evaluated for the or. Since the truth value of a non-empty string in Python is True, this part is always true, and (anything or True) is also always true. Use the expanded version (something like that works in nearly every language), or use month in ("April", "July") - something similar works in many modern high-level languages (like Python), but not in other languages. --Stephan Schulz (talk) 07:56, 1 December 2012 (UTC)[reply]
What I would suggest (kind of a more specific debugging suggestion) is printing the values of month_code and century_code after they are computed. Are the results what you expected? If not, you have narrowed down the problem. 66.127.54.40 (talk) 08:33, 1 December 2012 (UTC)[reply]

JQuery works on Codecadamy but not on my machine

I'm working on this exercise: http://www.codecademy.com/courses/jquery-checkers-part-2/0#!/exercises/1

If you click "Result", you see a brown outline of a box and the words, "Checkers Moves: 0". Well, I get that far when saving the four files: Checkers.html, provided.js, script.js,style.css to a folder on my desktop.

However when I add the code that creates the 64 squares, it works on Codecadamy, but on my computer it doesn't register the changes (64 squares do not appear within the brown box, it looks just like it did before). I am positive I saved my work. Any ideas why it isn't showing the changes? 169.231.8.73 (talk) 09:16, 1 December 2012 (UTC)[reply]