summary
stringlengths
15
147
text
stringlengths
1
19.3k
answer
stringlengths
32
22.6k
labels
float64
0.33
1
answer_summary
stringlengths
5
164
Internal Frame Listeners doesn't work with singleton enum function
I have the following code where I made singleton/enum manager so it keeps track of the number of internal frames that have been opened and I can get information from anyone of the frames when the user clicks on it (which activates the frame). But I don't know how to make this work because I want when a user clicks suppose on the 1st frame (out of 5 frames that have been opened), I want a save button to be enabled. When none of the windows are activated I want the button to be disabled. I put an internal frame listener and a component listener but none of them work. I was hoping if anyone could tell me where I am going wrong. Here is the code: public class Manager implements ActionListener, InternalFrameListener, ComponentListener{ private static int openFrameCount =0; ImagePlus image; private String tile; final String SHOW ="show"; static ImageWindow m; JMenuItem showInfo; static JMenuItem save; static JDesktopPane desktop; InfoGui in; public Manager(ImagePlus img, String title, JDesktopPane desktop, JMenuItem save){ image = img; this.desktop = desktop; this.tile = title; this.save = save; } public enum WindowManager { INSTANCE; public MyInternalFrame frame; private Map<ImagePlus, List<MyInternalFrame>> mapWindows; private WindowManager(){ mapWindows = new HashMap<>(25); } public class MyInternalFrame extends JInternalFrame { static final int xPosition = 30, yPosition = 30; public MyInternalFrame(String title, ImagePlus img, JMenuItem save) { super(title, true,true, true, true); setSize(img.getWidth(),img.getHeight()); // Set the window's location. setLocation(xPosition * openFrameCount, yPosition * openFrameCount); save.setEnabled(true); } } public JInternalFrame createWindowFor(ImagePlus image) { List<MyInternalFrame> frames = mapWindows.get(image); if (frames == null) { frames = new ArrayList<>(25); mapWindows.put(image, frames); } JPanel panel = new JPanel(); ImageCanvas c = new ImageCanvas(image); c.getImage(); //panel2.add(new JLabel(new ImageIcon(c.getImage()))); m = new ImageWindow(image); Image n = new Image(); //frame = new MyInternalFrame(title, img, save,m); //ImageCanvas c = m.getCanvas(); ImagePlus im = new ImagePlus(); im.setImage(image); frame = new MyInternalFrame(image.getTitle(), image, save); m.centerNextImage(); image.getCanvas().setScaleToFit(true); panel.add(m.getCanvas()); panel.setBackground(Color.white); frame.add(panel); frames.add(frame); frame.setVisible(true); frame.setAutoscrolls(true); frame.setAutoscrolls(true); frame.setOpaque(true); desktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) { } return frame; } public List<MyInternalFrame> getFromFor(ImagePlus image) { JInternalFrame frame = null; return mapWindows.get(image.getTitle()); } } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub SADAPP.Manager.WindowManager.MyInternalFrame m = (SADAPP.Manager.WindowManager.MyInternalFrame) WindowManager.INSTANCE.createWindowFor(image); } @Override public void internalFrameActivated(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(true); } @Override public void internalFrameClosed(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameClosing(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameDeactivated(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameDeiconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(true); } @Override public void internalFrameIconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameOpened(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(true); } @Override public void componentHidden(ComponentEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void componentMoved(ComponentEvent arg0) { // TODO Auto-generated method stub } @Override public void componentResized(ComponentEvent arg0) { // TODO Auto-generated method stub Rectangle r = WindowManager.INSTANCE.frame.getBounds(); m.getCanvas().fitToWindow(r); System.out.println("resized- the real one"); } @Override public void componentShown(ComponentEvent arg0) { // TODO Auto-generated method stub } }
The methods of the InternalFrameListener and ComponentListener interfaces won't be called merely by existing. You need to call addInternalFrameListener or addComponentListener on the frame to tell it about your listener. For example, in the constructor of MyInternalFrame, you want something like: this.addInternalFrameListener(someInstanceOfTheManagerObject);
0.888889
InternalFrameListener and ComponentListeners Interfaces
What is the variance of a Polya Gamma distribution?
I have a simple application that needs the variance of a Polya Gamma distribution (I know the mean since I found it here- http://arxiv.org/abs/1205.0310). This paper says that there is a closed form solution for the variance, but I am not really a mathematician and cannot calculate it. In short, does anyone know the closed form solution for the variance of the Polya Gamma distribution. I would be very grateful.
In equation (6), the paper obtains the Laplace transform of these distributions as $$\phi(t) = \prod_{k=1}^\infty \left(1 + \frac{t}{d_k} \right)^{-b};\ d_k = 2\left(k-\frac{1}{2}\right)^2 \pi^2 + c^2/2$$ where $b\gt 0$ and $c\in \mathbb R$ are the parameters. Taking logarithms yields $$\psi(t) = \frac{d}{dt}\phi(t) = \sum_{k=1}^\infty -b \log\left(1 + \frac{t}{d_k}\right).$$ This is a cumulant generating function (for imaginary values of $t$, at any rate) whose Taylor series around $t=0$ begins $$\psi(t) = -\mu_1^\prime t + \frac{1}{2!} \left( \mu_2^\prime - \mu_1^{\prime \,2} \right)t^2 + \cdots$$ with $\mu_j^\prime$ representing the raw moment of order $j$: thus, the negative of the coefficient of $t$ is the mean and twice ($=2!$) the coefficient of $t^2$ is the variance. The summation formula for $\psi$ can be expanded term-by-term and collected in common powers of $t$ to produce $$\psi(t) = \sum_{k=1}^\infty -b \left(\frac{t}{d_k} + \frac{t^2}{2 d_k^2} + \cdots\right) = -b\sum_{k=1}^\infty \frac{1}{d_k} t - b\sum_{k=1}^\infty \frac{1}{2d_k^2} t^2 + \cdots.$$ Such sums, whose terms are the reciprocals of quadratic (and higher) functions of the integral index $k$, are straightforward to evaluate using the Weierstrass Factorization Theorem and yield $$\mu_1^\prime = \frac{b }{2 c}\tanh \left(c/2\right);\ \mu_2^\prime - \mu_1^{\prime\,2} = \frac{b }{4 c^3}(\sinh (c) - c) \text{sech}^2\left(c/2\right).$$ The former agrees with the mean reported in the paper (adding some confidence to the overall correctness of this approach) while the latter answers the question: it is a closed form expression for the variance. (These series can be continued in higher powers of $t$ to develop closed formulas for any cumulants, from which higher moments can be extracted.) Partial contour plots show that the signs of the results (at least) are correct. Nothing is shown along the $b$ axis (where $c=0$) because these formulas are not defined for $c=0$. However, the plots make it clear that the formulas can be extended to continuous functions along that axis by taking the limits as $c\to 0$. They give $b/4$ for the mean and $b/24$ for the variance.
0.888889
In equation (6), the paper obtains the Laplace transform of these distributions as $$phi(t) = pro
Programming on Raspberry Pi device?
I am new with raspberry pi. Actually I am coming from Java background. Which programming should I use for raspberry pi tasks? The choices are given below:- Java Python Kindly suggest me which one of them should I choose?
I have been programming for more than 40 years, and while c(and its successors) is my preferred language, since getting a Pi I have been using Python. If you know java this should not be too different, but I can recommend "Learning Python" 5th Edition. You also asked about editors. The Pi has IDLE, which is a Python IDE. I strongly recommend Geany, which is easy to use. Both of these are GUI, so if you are developing remotely you should use VNC (install tightvncserver on the Pi). You don't mention what laptop you are using, but Mac, Windows and Linux all have support, but details differ.
1
Python is my preferred language since getting a Pi
Visual Studio Schema Compare repeats table on update
When comparing our production database to our database project, one table always shows up as "Add" action, even though the file is already part of the project. Updating the schema then produces the same file again with an underscore and increment (dbo.Data.sql => dbo.Data_1.sql) I noticed that when I open the individual table creation scripts, all scripts open in [Design] mode while the offending table opens as plain T-SQL. How do I add topsheet.Data to my project without it showing up on my next schema compare? The offending table: topsheet.Data A normal table: topsheet.Property
Does it do this if you rename the table Data to something else? I saw here that Data is a future reserved keyword, maybe this is making it act all weird?
0.888889
Does it do this if you rename Data to something else?
Populate column with number of substrings in another column
I have two tables "A" and "B". Table "A" has two columns "Body" and "Number." The column "Number" is empty, the purpose is to populate it. Table A: Body / Number ABABCDEF / IJKLMNOP / QRSTUVWKYZ / Table "B" only has one column: Table B: Values AB CD QR Here is what I am looking for as a result: ABABCDEF / 3 IJKLMNOP / 0 QRSTUVWKYZ / 1 In other words, I want to create a query that looks up, for each string in the "Body" column, how many times the substrings in the "Values" column appear. How would you advise me to do that?
You want an update query: update A set cnt = (select sum((length(a.body) - length(replace(a.body, b.value, '')) / length(b.value)) from b ) This uses a little trick for counting the number of occurrence of b.value in a given string. It replaces each occurrence with an empty string and counts the difference in length of the strings. This is divided by the length of the string being replaced. If you just wanted the number of matches (so the first value would be "2" instead of "3"): update A set cnt = (select count(*) from b where a.body like concat('%', b.value, '%') )
0.888889
Set cnt = (select count) from b
Looking for advanced GeoServer tutorials
What are sources where I can learn how to use GeoServer? I know of these two sites: http://geoserver.org/ - which in fact is not working (at least at the moment) http://workshops.opengeo.org/geoserver-intro/ - not only (tutorials) for GeoServer But I am interested in more complex information, and not to read only documentation.
Although it is a 'quickstart' and may not qualify as more complex information, I found this quite thorough and useful, it uses the geoserver installation on the osgeolive image/bootable disk. I use the virtual machine with the free VMware Player: http://live.osgeo.org/en/quickstart/geoserver_quickstart.html
1
Geoserver installation on osgeolive image
Migrate to new server 2008 file server but keep old server name (under domain AD)
i am moving to a new file server under Server 2008 Standard 32bit edition. I will refer to the older server as just "server", the new one i named as server2. i have updated server2 and patched it. I have also joined the domain as member server and set up the raid structure. I have also moved the data over to the right spot. BUT here is what i am not 100% sure on. The company wants to keep the old name of "server", i did not want to do that and was thinking of just making a cname alias in AD DNS forward lookup zone to point to the new ip address of server2 but you can reference it as server. In order to do the alias i would naturally remove or rename the old server or just unjoin it from the domain altogether. I have read that you can just rename a computer to a previous name in AD as long as you have unjoined and removed it from the appropirate list under Active Directory? Can i just rename a server that is a member server in a domain? Do i have to change the sid or run newsid? Just looking for some best practices. thanks in advance. gd
Server 2008 may be different, but in general I try to avoid renaming Windows servers whenever possible. Most especially if there is non-Microsoft software (such as backup agents) installed on it. Microsoft themselves was bad enough at putting "servername" in the registry and random files instead of "%computername%" back in the NT and 2000 days, that it scared me off of it in 2003. That said, I've been impressed at how different 2008 is from 2003r1, so they may finally have the kinks worked out of renaming a long-standing server. Which is to say, you CAN do it just like you found out. It works. All the deep in the bowels stuff uses SID, and the user-readable stuff as a variable. Newsid is a nice tool for catching all the leftovers if you're paranoid, but I believe you need to run that while undomained.
0.888889
renaming Windows servers whenever possible
Are comments considered a form of documentation?
When I am writing small scripts for myself, I stack my code high with comments (sometimes I comment more than I code). A lot of people I talk to say that I should be documenting these scripts, even though they are personal, so that if I ever do sell them, I would be ready. But aren't comments a form of documentation? Wouldn't this: $foo = "bar"; # this is a comment print $foo; # this prints "bar" be considered documentation, especially if a developer is using my code? Or is documentation considered to be outside of the code itself?
Comments are definitely documentation. For most projects, comments are (unfortunately) the primary (if not only) form of project documentation. For this reason, it's very important to get it right. You need to make sure that this documentation stays accurate despite code changes. This is a common problem with comments. Developers often "tune" them out when they're working in familiar code, so they forget to update comments to reflect code. This can create out-of-date, and misleading comments. A lot of people suggest making the code self-documenting. This means that instead of comments, you restructure your code to remove the need for them. This can get rid of most of the "what" and "how" comments, but doesn't really help with the "why" comments. While this might work effectively to get rid of most comments, there are still plenty of times where writing a comment is the simplest and most efficient way to document a piece of code.
0.666667
How to get rid of comments?
How to export PNG to be compatible with all browsers
I recently found our that some PNG files render a slightly different shade of color in Safari. (I think this is because Safari can't render PNG Gamma channel properly or what). How do I export the PNG images so that they work perfectly fine throughout all the browsers. (preferable using Adobe Photoshop)
Your best bet would be to use the Save for Web & Devices... option. It's Photoshop's preferred method for exporting for web. That being said, the appearance of color on a website is always at the mercy of the user's screen calibration.
1
Save for Web & Devices...
Can I use a package manager of one distribution on another?
I want to use Gentoo's packages on Fedora. Is this possible? EDIT: I meant that I want to use Gentoo's portage tree. UPDATE: How about Ubuntu's packages on Fedora? Or Fedora's on Gentoo? Or any other distribution's packages/package manager on another?
It is possible, although it will take quite a bit of work to get operational, and it won't be supported by either distro's teams generally. I only know it's possible because I've watched as a co-worker of mine did it one time merely to say he could/had. As for the logistics of it, I think the init system differences is going to be one of the biggest hangup. The init system in gentoo is going to be completely different from the init system in fedora. As such, you'll have to either hack portage so that it will work with fedora's init system, or hack fedora to work with gentoo's. The other hangup you'll run into is that portage doesn't like dealing with software and packages that haven't been installed by portage to begin with.
1
Init system differences in gentoo is going to be one of the biggest hangup .
Extending Internal Link and External Link to allow selection of Images
I need to extend selection of external and Internal Link and provide a image selection. Please see the snapshot in the below : Here the above snapshot allows you to add properties for External Link.In the same popup can we add a field Called Image(as shown in screenshot) which will allow user to select images from the media library?? Thanks, Suhas
You can actually extend any dialog by editing the xml files in /shell/Applications/Dialogs In another thread I have shown how to add a maxlength to the title field, that should help you get on your way: Sitecore 7:Limit number of Characters entered for Link Title Field in General Link
1
How to extend any dialog by editing the xml files
How do I remove a Facebook app request?
Unfortunately, because of some fat fingering when browsing the Klout website from my iPad I accidentally sent app requests to 50 friends. I am really annoyed by these sort of requests and certainly did not intend to send them to my friends. Can I view the app requests I've sent on Facebook? Can I undo the requests that I've sent? Can I add a privacy setting to prevent any Facebook app (Klout or otherwise) from ever sending these requests in the future?
There isn't a native way with Klout's UI that I am aware of. Your best bet is finding a Chrome Extension that handles Facebook JS SDK API calls, then you can do something like this FB.api('/me/apprequests', function(response) { var ids = []; for (var i=0, l=response.data.length; i<l; i++) { FB.api('/' + response.data[i].id, 'DELETE', function(response){ console.log('cleared request:' + response) } ); console.log('For: ' + response.data[i].to.name); } }); Quick and dirty would be to just paste this into your Developer console on Klout's page.
1
Klout's UI handles Facebook JS SDK API calls
How to troubleshoot Canon Speedlites that are not firing at the same time?
I'm working on some studio lighting and want to have my two Canon Speedlite 580EX IIs fire simultaneously using Canon's built-in wireless communications (i.e., I want the master to trigger the slave, but also provide some fill flash). I am pretty sure I had this working at some point, but now I have noticed that the master flash fires when the shutter is pressed, but the slave flash fires a good 1 or 2 seconds after the master has fired (and after the shutter has closed and photo has already been taken). I have been poring over documentation and videos wondering what I could have missed. Surely it is a setting somewhere that I have accidentally set? MASTER 580EXII Set to ETTL Channel 1 On Ratio A:B is 1:1 SLAVE 580EXII Channel 1 On Group B Notes: I have tried a couple of things: Connecting the master and slave with the mini phone jack. Making sure the master is directly in front of the slave's panel so there could be no interference with the signal. I have tried it with the Master ON and the Master OFF. I have tried it with the Master both on the camera's hotshoe and on a jotshoe adapter. Even tried replacing all the batteries in both flashes. Have tried both flashes in Group A. I will try to attach pics of the LCD panels. I must be missing something obvious... please forgive me if I did. Thank you in advance! P.S. I have the Master set for a -1 FEC but I have tried removing that as well.
Are you testing it with ETTL and the lens cap on perchance? In this the cameras exposure is waiting for enough background light.
1
How to test it with ETTL and lens cap on perchance?
Is there a way to put a copy rotation constraint with an influence higher than 1?
I'm making a little animation with some gears. I want that if I rotate the first gear, all the gears rotate with the gain given by the gears. For doing that I've choose the copy rotation constraint. But in my case, sometime a gear turn one time and the second turn tiwce. With the copy roation I can only put an influence between 0 and 1. So my question is : Is there a way to put a copy rotation constraint with an influence higher than 1? Or is there an other solution to do what I want?
Use F-Curve Drivers. https://www.youtube.com/watch?v=jMoBFzXFAUM Use a scripted expression on the OWNER object's driver with the Target object set. By animating the TARGET object, the OWNER responds accordingly to the driver. Eg: Two Cubes, CubeA and CubeB: Add SINGLE DRIVER to CubeB's x rotation transform box. Go to Graph window. Change from F-Curveto Drivers. Select it's X Rotation in the list on left side. Scroll down in the right side panel to find Drivers. Set Ob to CubeA Change Type to X Rotation (since we added single drive to x rotation). In the field under Script Expression: Delete 0.00 and write var * 2 (var is the name of variable box we changed the ob/type in). Now rotate on CubeA's x axis. CubeB rotates on the x axis at twice the speed. Using this method, you will never have that 179-180 problem.
0.888889
Use F-Curve Drivers
Spokes keep breaking - bad hub or bad build?
Background information A bit of background information (I'll try keep it brief): Last year I bought an old but unused bike, 5 speeds with internal gearing. Apparently the shop bought a lot of bikes somewhere in the 90's (not sure), but never got around to selling them. When I bought it, it was wrapped in plastic, had been stored in the shop's stock house for about 20 years and free of corrosion. I'm about 95 kilos, thread quite hard but rides exclusive to paved bike paths. The original, 20(?) year-old wheel lasted me a year with no problems. The front wheel is still fine and true. Spokes breaking - and getting replaced After a little under a year, I suddenly noticed that a few spokes had broken. On closer inspection, quite a few were too loose. Should have noticed sooner but didn't. I took it to a shop, where they advised me to have the wheel rebuilt which I paid them to do. The gearing being internal, the new rims and spokes were built on the existing hub. After just two weeks, the back wheel suddenly began to feel wobbly on my way to work. As careful as I could, I drove the bike back to the shop. Almost all spokes were terribly loose. They retensioned the wheel free of charge (of course) and sent me on my way. The following weeks, I periodically checked that all spokes were still tensioned. 2,5 months later, I noticed three of the spokes were broken close to the hub. Went back to the shop and had the spokes replaced (free or charge). 1 month later I noticed 2 broken spokes and had those replaced as well. They seemed less eager to keep fixing the wheel free of charge, and when I asked why the spokes kept breaking, the guy muttered something about the hub holes maybe had burrs due to wear. Now, a few weeks later, I find another spoke broken. My gut tells me this all stems from a bad build, that quickly lost tension and thus damaged the spokes. I find the explanation about a worn hub a bit far fetched, but I don't have the knowledge to dismiss the theory. Questions Is there any way this is not the shop's fault? - A bad build? Cheap spokes? Improperly tensioned? Given the wheel's history, is there any point in keep replacing spokes, a couple at a time, or should I get the wheel rebuilt (preferably at the shop's expense)? Could the hub in any way be to blame for this? Thank you! Update Oct 24th I've been trying to get in touch with the manager of the shop throughout the week. Failed again to reach him this morning, so I figured I'd have a chat about my problem with one of the guys on the floor. Tried to get him to provide at least a theory of why my spokes keep breaking, but not much came out of it really. He mentioned that he've seen, on rare occasaions, that a worn hub could cut the spokes (could be the same guy as I spoke to last time). I'll check the hubs as soon as possible, as @Daniel R Hicks suggested. Due to plumbing work in our appartment, I haven't been home or able to check my bike all week. If I don't see any indicatations that the spokes were put in the wrong way, I'm going to follow the advice most of you have, and take my bike to another shop for advice and repair. Thanks so far! - I'll update you after I've payed the other shop a visit. Update Nov 3rd Took the bike to the other shop, told them the story. Let them decide to replace the broken spoke or them all. They decided to replace just the broken spoke with a DT spoke (what ever that means). They also trued the wheel, which had gotten a slight "eggy" shape. My fingers are crossed that this wheel will last now. Once again, thank you all for your input! Anecdotal Update In case anyone follows... Since the last repair at the other shop, the wheel kept being in good shape. Finally, my spokes stayed tensioned, wheels stiff and true - the long struggle was finally over. Alas, the joy didn't even last a month... Going home from a company party, I returned to my bike I parked at the train station, only to find out that some punk kids had apparently tossed it to the ground, and jumped both wheels badly out of shape. Front wheel had to be replaced and back wheel was in desperate need for a trueing. sigh Sorry for the melodrama, just thought I'd update you the faith of my bike ;-).
"Burrs on the hub" sounds bogus to me. Could be the case with a new hub, but burrs would be worn away with use. It seems most likely that the hub was reassembled by "unskilled labor" (the new/careless guy in the shop) and he didn't notice that the hub holes are directional -- there is a countersink on one side of the hole and not the other -- or didn't understand how you put spokes in such a hub. When the holes are directional, you put the head of the spoke on the non-countersunk side, so that the curve of the spoke mates with the smooth countersink. Placing spokes the opposite way will result in the curve of the spoke being against the sharp corner of the hole (and a broken spoke). To check this, look at any hole where a spoke is broken. If the two sides the hole are different, the side with the smooth rounded countersunk shape should be matched with the bend in the spoke, and the head should be on the other side. Another possibility is that machine spokes were used. These spokes have a longer distance between the head and the bend, to simplify things for lacing machines. But these are bad for hand lacing, as there is too much "lever arm" unsupported by the spoke hole, and the heads will tend to pop off. If such spokes are used one must use small spacer washers on the head side to pull the bend tightly to the curve of the spoke hole. Or, of course, they could be lousy spokes. (If they were breaking at the rim end this would be due to the way the rim is drilled and possible missassembly placing left-facing drilled holes with a right-facing spoke, or simply spokes that aren't strong enough to stand up to the stress of being slightly bent at the nipple.)
0.777778
"Burrs on the hub" would be worn away with use .
problem with bcm43xx / b43 / b43legacy blacklisted /var/log/jockey.log
I have installed ubuntu 12.04 64bit version and I was new to drivers issues and my wireless lan won't activate from Additional drivers and I was reported that I have to check /var/log/jockey.log I got these lines 2013-10-23 15:21:11,733 DEBUG: BroadcomWLHandler enabled(): kmod disabled, bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted 2013-10-23 15:21:11,802 DEBUG: BroadcomWLHandler enabled(): kmod disabled, bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted 2013-10-23 15:21:11,822 DEBUG: BroadcomWLHandler enabled(): kmod disabled, bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted 2013-10-23 15:21:16,969 DEBUG: BroadcomWLHandler enabled(): kmod disabled, bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted 2013-10-23 15:21:19,748 WARNING: modinfo for module wl failed: ERROR: modinfo: could not find module wl 2013-10-23 15:21:19,749 WARNING: /sys/module/wl/drivers does not exist, cannot rebind wl driver 2013-10-23 15:21:19,806 DEBUG: BroadcomWLHandler enabled(): kmod disabled, bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted So - how do I fix this issue?
moved the OP's answer from their question to this section 1- Run this command to edit the blacklist file sudo pico /etc/modprobe.d/blacklist.conf add '#' in the beginning of the line containing bcm/bcm43/b43 etc save and exit 2- Run these commands wget http://archive.ubuntu.com/ubuntu/pool/restricted/b/bcmwl/bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu1_amd64.deb sudo dpkg -i bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu1_amd64.deb 3- Now enable wireless from the top right of the screen, and you are done I hope these info will help anyone
1
Connect wireless from the top right of the screen
Setfattr always returns operation not supported
I'm trying to get a script working however I'm having issues with a particular line trying to set file attributes with setfattr. The line in question is ret=os.system('setfattr -n "user.dummy" -v "dummy" /apachelogs/data/file') The fstab output of this location is as follows. /dev/sdb1 /apachelogs reiserfs user,noauto,rw,exec,suid,user_xattr 0 2 Returns the error message: setfattr: /apachelogs/data/file: Operation not supported Can anyone give me any advice on what I might be doing wrong? My google-fu is only telling me that the problem usually occurs when someone doesn't prefix user on the first variable. Cheers.
Things to try. 1. Does the path exist? I know it sounds silly but make sure that the directory /apachelogs/data exists. Also make sure that the file exists, /apachelogs/data/file and that you have permissions to manipulate it. 2. Try the commands from a shell I would confirm that the above commands can work in a shell directly before attempting to do them from Python. Example Try the following: $ cd /apachelogs/data $ touch foobar Now add the extended attribute: $ setfattr -n user.foo -v bar foobar $ getfattr -d foobar # file: foobar user.foo="bar" References setfattr always returns "Operation Not Supported"
0.777778
Does the path exist?
Zero point fluctuation of an harmonic oscillator
In a paper, I ran into the following definition of the zero point fluctuation of our favorite toy, the harmonic oscillator: $$x_{ZPF} = \sqrt{\frac{\hbar}{2m\Omega}} $$ where m is its mass and $\Omega$ its natural frequency. However, when I try to derive it with simple arguments, I think of the equality: $$E = \frac12 \hbar\Omega=\frac12 m \Omega^2 x_{ZPF}^²$$ (using the energy eigenvalue of the $n=0$ state) giving me: $$x_{ZPF} = \sqrt{\frac{\hbar}{m\Omega}} $$ differing from the previous one by a factor $\sqrt2$. I am just puzzled, is it a matter of conventions or is there a fundamental misconception in my (too?) naive derivation?
You can find the value of zero point fluctuations just by calculating the variance $\langle(\Delta\hat{x})^2\rangle = \langle\hat{x}^2\rangle$ in the vacuum state. You can do this either using the $x$-representation or expressing the $\hat{x}$ operator using creation and annihilation operators. These are usually introduced by $$ \hat{a} = \sqrt{\frac{m\Omega}{2\hbar}}\left(\hat{x}+i\frac{\hat{p}}{m\Omega}\right), $$ so that you get $$ \hat{x} = \sqrt{\frac{\hbar}{2m\Omega}}(\hat{a}+\hat{a}^\dagger). $$ Using this to calculate $\langle\hat{x}^2\rangle = \langle 0|\hat{x}^2|0\rangle$ indeed gives you $$x_{ZPF} = \sqrt{\langle\hat{x}^2\rangle} = \sqrt{\frac{\hbar}{2m\Omega}}.$$
0.555556
Calculation of the value of zero point fluctuations in vacuum state
Nexus 7 is stuck in reboot loop after full discharge
I have a few day old Nexus 7 tablet, unrooted, bootloader still locked, and otherwise in factory condition. This morning, it ran its charge out. When I plugged in it, this happens: Google Logo appears. Nexus Logo appears. Lock screen which shows charging: 0%. White screen, device powers off. Repeat. What is happening? Thanks!
If you've just plugged it in to the charger, leave it a while before you try to turn it on. The boot sequence uses power faster than USB can provide it, so you will need a little juice in the battery in order for it to boot up all the way.
0.888889
Plug it in to charger
Invariance of dynamical system under a transformation
I have come across an interesting property of a dynamical system, being transformed by a map, but i haven't been able to figure out why this is happening (for quite some time now actually). Any help is greatly appreciated. Here goes then: Let M be a n-D manifold and $\dot x=F(x)u_1, F\in \mathbb{R}^{n\times m}, x \in \mathbb{R}^{n}, u_1 \in \mathbb{R}^{m}$ be a control system evolving on M (F is the system matrix i.e. state transition function, and $u_1$ is the input of the system. For all practical purposes $u_1$ is an m-vector from an input space $\mathbb{R}^{m}$). Now let $x=\Psi (y)$ be a coordinate change on M and $u_2=M(y)u_1$ a transformation of the input $u_1$ of the first system. By applying these maps on the system, you get the new equations $\dot y=F(y)u_2$. As you may notice, F is the same in both systems. The problem is why is this happening i.e. for what systems and transformations does this property hold? A little more elaboration It is useful to investigate the maps more closely. In the general case one has $\dot x=D\Psi \dot y$ $\dot x= F(x)u_1$ thus $\dot y=D\Psi ^{-1} F(x)u_1$, (1) where $D\Psi$ is the Jacobian matrix of $\Psi$. In our case it actually turns out that: $\dot y=F(y)M(y)u_1$. (2) You can then consider that $u_2=M(y)u_1$ and get the final system, $\dot y=F(y)u_2$, that is, the same system. By (1),(2) you get, $D\Psi ^{-1} F(x)u_1=F(y)M(y)u_1 \Rightarrow (D\Psi ^{-1} F(x)-F(y)M(y))u_1=0$. Since this holds for every $u_1$, you have the condition, $F(\Psi (y))=D\Psi F(y)M(y)$ So, what does this condition imply? What systems F and maps $\Psi$ hold this property (of system invariance)? I should note that F is nonlinear and a case study where this actually happens is the kinematic model of a unicycle robot i.e. this. Any ideas?
This is not a surprising fact for driftless systems to have symmetries. In our previous work we considered only nonlinear systems with drift and classified the symmetries accordingly. In case of a driftless system \dot x=F(x)u you can interpret $F$ (that's what it is) as a distribution of vector fields $f_1, \dots, f_m$ (column vectors of the matrix) and whenever such distribution is involutive ($[f_i, f_j]=\lambda_1(x)f_1+\cdots+\lambda_m(x)f_m$ then necessarily the system admits nontrivial symmetries (this is due to the Frobenius Theorem). That's the case you have here with the unicycle with $f_1=(\cos \theta, \sin \theta, 0), f_2=(0,0, 1)$. I can write in more extensive way but I hope you would get the idea from there. Issa
0.777778
symmetries for nonlinear systems
NSLog not printing to terminal
Ok, so I've been using NSLog in objective-C for awhile now to debug and I know it's supposed to print to the terminal whatever I put in the parentheses. For some reason, it just stopped printing to the terminal and I'm not sure how to fix this error. I was wondering what other people would suggest doing to fix this problem. I've only included part of my code because I don't want to scare away someone from answering this simple (or at least I hope it's simple to fix) problem. When I run the code, the only two statements that print are "serverButton - Stage 1" and "serverButton - Stage 2 - Complete" but nothing else in between. FYI -(void)startServer is in another class called "Server" and I have made "server" a pointer to that said class. -(IBAction)serverButton { NSLog(@"serverButton - Stage 1"); [server startServer]; NSLog(@"serverButton - Stage 2 - Complete"); } -(void)startServer { NSLog(@"serverButton - Stage 1"); memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; // set to AF_INET to force IPv4 hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE; // use my IP if ((rv = getaddrinfo(NULL, MYPORT, &hints, &servinfo)) != 0) { NSLog(@"ERROR: serverButton - Stage 1"); fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); serverError = 1; NSLog(@"Error"); }
It looks like the problem isn't NSLog, but rather that startServer isn't actually getting sent to the receiver like you think it is.
1
StartServer isn't getting sent to the receiver like you think it's NSLog
Fill: SelectCommand.Connection property has not been initialized. what to do?
When I try to use the method GetCities(), it says: Fill: SelectCommand.Connection property has not been initialized. Can anyone please advise on what to do? public class CitiesService { public DataSet DS; public OleDbConnection myConnection; public OleDbDataAdapter adapter; public OleDbDataAdapter adapter2; public CitiesService() { } public DataSet GetCities() { OleDbCommand myCmd = new OleDbCommand("SPtblCities", myConnection); myCmd.CommandType = CommandType.StoredProcedure; OleDbDataAdapter Adapter = new OleDbDataAdapter(); Adapter.SelectCommand = myCmd; DataSet dataSet = new DataSet(); try { Adapter.Fill(dataSet, "tblCities"); dataSet.Tables["tblCities"].PrimaryKey = new DataColumn[] { dataSet.Tables["tblCities"].Columns["CityID"] }; } catch (OleDbException ex) { throw ex; } return dataSet; } }
Yes, the connection was not initialized, it is null. Replace public OleDbConnection myConnection; with public OleDbConnection myConnection = new OleDbConnection(ConnectionString); or in the method: myConnection = new OleDbConnection(ConnectionString); OleDbCommand myCmd = new OleDbCommand("SPtblCities", myConnection);
1
Replace public OleDb Connection myConnection
Culinary uses for juniper extract?
I bought some juniper extract for making bath stuff, and it doesn't seem to be very effective for this purpose. I have used juniper berries before, so I thought I might be able to use the extract for cooking or baking. I have not been able to find any recipes online. Is juniper extract ok to eat? What types of applications would it be good for, I assume whole berries is much better choice for marinades. Would it have the same uses as orange or peppermint extract?
You could make gin! Add the juniper to vodka and you have instant gin. BTW, I don't drink alcohol.
1
Add juniper to vodka and instant gin!
What happens if I destroy a minipet placed in the Devotion monument in Guild Wars?
Will I lose my statue? Will I lose my Hall of Monuments point progression? Or is it safe? What happens if I destroy a minipet dedicated at the Hall of Monuments?
Nothing, once you have dedicated the minipet to your monument, you can trade, give away, or destroy the minipet with no consequences. Your monument statue will always be there and count towards your account. It just can't be rededicated by anyone else. Typically dedicated minipets are worth only 10-20% of the undedicated value because of this reason.
1
Usually dedicated minipets are worth only 10-20% of the undedicated value
How to allow users to choose different theme?
Some of my site users prefer a light theme, others prefer dark one. In drupal 6, is there a way to allow users to choose their favorite theme? How? Thanks
I am also convinced with Switch Theme module. It provides a dropdown created in a block that provides option to choose any of the theme enabled from the backend. So you just need to enable themes from backend that you want to show users to switch. Hope it will help!
1
Switch Theme module
How did the Female Titan cut Eren's titan form?
After she killed the Levi squad, Eren transformed to fight the Female Titan. In Chapter 29, Hammer, it looked like Eren was having the upper hand, but then the Female Titan turned around, and with one horizontal motion, cut Eren's titan form's head in half. How did that happen? That part wasn't clear in the anime nor the manga. Did she take a tree and smacked him? Did she harden her hand and hit him?
Warning This might contain spoilers. The move she used to finish Eren was a direct reference to a earlier scene in the anime (this has not been done in th manga as far as I know). At this point in time the viewer does not know Annie is the titan. The fight move used there resembles her fighting moves used during the training. this is one of the clue's beside the face resemblance of the titan to Annie. Some deeper information on this, the move she used is a karate move from the original Kata's. As stated in the video linked she has been trained in martial arts by her father.
0.888889
The move she used to finish Eren was a direct reference to a earlier scene in the anime
Ideas for synchronizing records programmatically
I need to synchronize records, say a list of clients, between a local and distant database. The database on both sides has the same structure. I've thought of using some kind of marker (date field, hash/checksum on field values...) but what would you advise ? Edit: Distant database is on web hosting so PHP will be needed for transferring data.
If you want to sync two databases by code, you're looking for trouble. First of all, you need to handle your own primary key generation, because when inserting records on different sites, primary keys can/will be the same. Unique primary key generation is not easy to accomplish. Furthermore, you need some conflict resolution. Updates or Deletes made on either side have to be reflected to the other site. Often, you cannot solve conflicts without user intervention. My advise: look at built-in (two-way) replication, native to the database. It will save you a lot of headache.
1
How to sync databases by code?
Meaning of 'on' in "We feasted that evening as 'on' nectar and ambrosia"
“I meant to give each of you some of this to take with you,” said she, “but as there is so little toast, you must have it now,” and she proceeded to cut slices with a generous hand. We feasted that evening as on nectar and ambrosia; and not the least delight of the entertainment was the smile of gratification with which our hostess regarded us, as we satisfied our famished appetites on the delicate fare she liberally supplied. (Jane Eyre) What’s the meaning of ‘on’?
I think the key word here is as, actually. The word as lets you know that it's a simile; the word on is just the preposition in the phrase "feast on [something]". It means the same thing as if these words were inserted: We feasted [on the food we had] that evening as [we would] on nectar and ambrosia [...]
1
"feast on [something]" is the preposition in the phrase .
When is a mail relay needed?
Let me expand... I have a client who is unhappy with their current hosting situation. They want me to move their website and domain across to my hosting platform. I can do this. However I have realised that the company has: 1) A number of existing IMAP accounts I understand that I can use a tool like imapsync in order to transfer the mailboxes and hopefully incur only a small amount of downtime with the emails during this process. Can anyone offer any advice regarding the transfer of IMAP mailboxes from one server to another.? 2) An SMTP Relay Another company supplies my client with an SMTP relay. I've only really just found out what this is. I understand that emails are sometimes undelivered to the client and a mail relay routes incoming mails through another (more reliable?) server in order to keep trying to resend emails so none are missed. Is this neccessary in this day and age? Does my Plesk 10 Panel Linux Server come with any internal mail relay? Maybe I could use another service like mailjet or elasticemail instead? Am in in for a lot of hassle moving email accounts or is this a fairly transparent process? What should I look out for and how can I make this hosting transfer seamless (or nearly seamless)? When I move the domain to my server (and the IP changes) this will interrupt the current mail relay. Will my client's emails continue to be delivered?
Disclaimer : I work for Mailjet. Hello. It's better to use a SMTP service with a dedicated support that will help you. Plus, the prices are quite low and you will get some very useful features to track your emails and check that they actually were delivered.Stats may be really useful for your cust'.
1
SMTP service with dedicated support.
What to do after a scp failure?
During a massive 10 hour scp over the internet, I ran out of disk space at the destination after 7 hours. Can I use rsync or something else to run this to completion or am I **ed and have to start all over again? If I have to start over, I think I will use rsync in case the ISP craps out this time...
rsync --partial --progress --rsh=ssh $file_source $user@$host:$destination_file or rsync --partial --progress --rsh=ssh $user@$host:$remote_file $destination_file
0.888889
rsync --partial --progress --rsh=ssh $file_source $user@$host
Custom theorem numbering
This one should be easy for the gurus… Suppose I want to define a theorem environment which has a custom numbering scheme. That is, instead of being numbered according to some counter, it is numbered according to a passed parameter. So writing something like \begin{customtheorem}{8} Text. \end{custom theorem} would produce Theorem 8. Text. I realize I could define a new environment on my own, but then the header will be bold, or small caps, or whatever I defined it to be, and so may differ from the rest of the document if I switch documentclass. So I would like something that also matches the regular theorem headers. Thanks in advance for any ideas.
An easy way is \documentclass{article} %\usepackage{amsthm} %% uncomment to see the difference \newtheorem{innercustomthm}{Theorem} \newenvironment{customthm}[1] {\renewcommand\theinnercustomthm{#1}\innercustomthm} {\endinnercustomthm} \begin{document} \begin{customthm}{8}\label{eight} Every theorem must be numbered by hand. \end{customthm} Here is a reference to theorem~\ref{eight}. \end{document} You can also use the optional argument for attribution: \begin{customthm}{99}[Somebody]\label{ninetynine} Statement. \end{customthm}
0.666667
Theoremrefeight endcustomthm
C# save/retrieve an array of structures from settings file
I have a simple question (I think) that I'm not making much progress finding an answer to with Google. I have a structure as follows: /// <summary> /// A class to represent the sync settings for a single camera. /// </summary> public class CameraSyncSettings { public string ID { get; set; } public string SyncPath { get; set; } public bool OverwriteExisting { get; set; } }; And then an array of these in the program, one for each camera: List<CameraSyncSettings> MyCameraSettings = new List<CameraSyncSettings>(); Now, what I want to do is have a property in my settings such that I can read/write this array into it to persist the information between sessions. How can I do this and what is the best/most efficient way?
As we've cleared in the comments you want to use app.config: this project should pretty much cover all your needs.
0.888889
App.config should cover all your needs
Are prime lenses sharp across the whole frame while zoom lenses are soft in the corners?
Somebody told me that there is a difference in sharpness between a zoom lens vs. prime lens. A 58-200mm will give sharp focus in the center of the frame but blurry performance at the corners, while in the meantime a prime 200mm will give a sharp definition to the whole frame of the photograph. Is this true?
Performance in terms of acutance of any lens varies in a lot of ways, but throwing in the variable focal lengths a zoom lens is capable of adds to the complexity of things. Even a prime lens with a fixed focal length can vary in terms of center sharpness from one aperture setting to the next. How much that sharpness is degraded from the center to the edges can also change at different apertures. Adding the extra variables of a zoom lens creates an even more complex comparison. In general the gist of what you have been told is basically true, especially when comparing prime and zoom lenses that are both in the same or similar price ranges. If you compare cheaper prime lenses with high end zoom lenses, though, all bets are off in terms of this generalization. And there are some very high end prime lenses that are specifically designed to soften up on the edges and in the corners. The unique look of the Canon EF 85mm f/1.2 L is due to uncorrected spherical aberration that makes the edges of a flat target soft when the center is correctly in focus. With consumer grade telephoto zoom lenses, the longest focal lengths typically tend to be the least sharp, even at the center of the frame. As the lens is zoomed to the maximum focal length all of the aberrations of the lens are magnified. So if the center sharpness decreases a little as the focal length is lengthened, then the edges will usually soften up even more.
1
How much sharpness is degraded from center to edges can also change at different apertures
Angularjs show selected option from ng-repeat value
I have drop down inside ng-repeat as follows. <div ng-model="list in lists"> <div> <select ng-model="pType" ng-options="c.name in projType"></select> <option value="{{list.value}"></option> </div> My Controller is App.controller('pOverCtrl', function ($scope, pOverRepository, $location) { $scope.lists = projOverRepository.query(); $scope.projType = [ { value: '0', name: 'None Selected' }, { value: '1', name: 'Construction' }, { value: '2', name: 'Maintenance' }, ]; }) The dropdown gets populated fine. But my goal is that when ng-repeat is executed it automatically shows the value that is coming from lists scope as selected. Please let me know how to fix this issue.
use the diretive ng-selected <div ng-model="list in lists"> <select ng-model="pType" ng-options="c.name in projType"> <option ng-selected="list.value == list.selected" value="{{list.value}"></option> </select> </div> assuming that list.selected variable contains the value of the option selects
0.777778
Use the diretive ng-selected <div ng model="list in lists"
How to split a string between two character into sub groups in R
I have a list of codes in the second column of a table and I want to extract some elements of each code then store them in new columns associated with each of the codes. Each code consists of letters followed by some numbers. The letters are P, F, I , R, C repeated with the same order in all codes but the number of digits are varying in each code. For example: consider the codes as below: P1F2I235R15C145 P1 F2 I23 R15 C145 P24F1I12R124C96 P24 F1 I12 R124 C96 so in this way I can split each code into its constitutes sub-codes, and store these components into new columns in the same table. thanks
Try this: #simulate your data frame df<-data.frame(code=c("P1F2I235R15C145","P24F1I12R124C96"),stringsAsFactors=FALSE) #split the columns cbind(df,do.call(rbind,regmatches(df$code,gregexpr("[PFIRC][0-9]+",df$code)))) # code 1 2 3 4 5 #1 P1F2I235R15C145 P1 F2 I235 R15 C145 #2 P24F1I12R124C96 P24 F1 I12 R124 C96 What @AnandaMatho suggested in the comment was to let the letter in front of the code go away and name the columns accordingly. Something like that: res<-cbind(df,do.call(rbind,regmatches(df$code,gregexpr("(?<=[PFIRC])[0-9]+",df$code,perl=TRUE)))) names(res)<-c("Code","P","F","I","R","C") # Code P F I R C #1 P1F2I235R15C145 1 2 235 15 145 #2 P24F1I12R124C96 24 1 12 124 96
0.777778
#simulate your data frame df<-data.frame(code=c("P1F2I
CTE Running in Infinite Loop
My CTE runs in an infinite loop for a specific customer and I am not able to find out why. Here is the query: ;WITH ClassTree AS (SELECT ID, NAME, Parent_ID FROM TableName WHERE ID = 1 UNION ALL SELECT T.ID, T.NAME, T.Parent_ID FROM TableName T WITH (NOLOCK) JOIN ClassTree ON Parent_ID = ClassTree.ID ) SELECT * FROM ClassTree
Here is a little something that you can use to find your cycles. declare @T table ( ID int, Parent_ID int ) insert into @T values (1, 3),(2, 1),(3, 2), -- This is a cycle (4, 4), -- This is a cycle (5, null),(6, 5),(7, 6) -- This is not a cycle ;with C as ( select T.ID, T.Parent_ID, cast(',' + cast(ID as varchar(10)) + ',' as varchar(max)) as Path, 0 Cycle from @T as T union all select T.ID, T.Parent_ID, C.Path + cast(T.ID as varchar(10)) + ',', case when C.Path like '%,'+cast(T.ID as varchar(10))+',%' then 1 else 0 end from @T as T inner join C on T.Parent_ID = C.ID where C.Cycle = 0 ) select * from C where Cycle = 1 Result: ID Parent_ID Path Cycle ----------- ----------- ---------- ----------- 4 4 ,4,4, 1 3 2 ,3,1,2,3, 1 2 1 ,2,3,1,2, 1 1 3 ,1,2,3,1, 1
0.777778
@T table ( ID int, Parent_ID int )
Is there a way to read the columns in a shapefile / layer without converting it first to an MDB file?
My shapefile has a number of fields, like roadname, and street number. Is there a way to get at these without converting the shapefile first into a featureclass (mdb)? Sometimes the conversion is a time consuming operation. I'm using ArcEngine 10 C# with VS2010
To just see that other fields without caring about the geometry data, you can just open the dbf-file in any Excel, open office or something else reading dbf-files. Just be careful not to add or remove any rows, since that will corrupt the shapefile. /Nicklas
1
Open the dbf-file in any Excel, office or something else reading the geometry data
IMovie06' Not working anymore because of Yosemite
I upgraded to Yosemite and now my Imovie 06' will not work. I need to open and finish projects that are due in three weeks. What are my options?
Why not reinstall Mavericks and restore your backup from before the upgrade so you can finish your urgent work? You might even just get an external USB drive and just install Mavericks (or the original OS that came with your Mac) and boot from that OS to finish your projects. You could then choose which OS to boot by holding the option key down at startup and just move the project files and media you need to the older OS. Long term, an upgrade to a newer iMovie might be best, but not at the expense of learning new tools for projects that you know don't need the new features or learning curve.
0.777778
Why not reinstall Mavericks and restore backup from before the upgrade?
What is the best way to remove pet odor from concrete?
The concrete floor in my garage had been home to a large dog for several years. There is a visible stain and strong smell in one area of the garage floor. The concrete does not appear to be sealed or painted. What is the best way to remove the odor?
Let me save you some time. Forget the pet store products, just go to Home Depot or Lowe's and get yourself a can of primer/sealer, I think Kilz brand is the best. I had a really bad cat urine odor problem in my townhome many years ago (from previous owners). Like you, I went to the Internet and I tried a lot of suggestions I found there. NONE of those specialty pet odor removal products worked. They just temporarily covered up the smell and during hot weather it came back. Big waste of money and time. Finally someone suggested the Kilz brand primer/sealer and it worked. The smell never ever came back, and there was a clean "new home" smell. I used it on drywall but I'm sure they have stuff for concrete as well.
1
Kilz brand is the best pet odor removal products .
can I use a disk larger than 320 GB with RPi?
I have a 500GB Toshiba 2.5' HD, which I formated using Debian Wheezy 64bit. I created 2 partitions (180GB and 320GB). RPi would only recognize the first partition. So, I tried creating the partitions using the raspberrypi. Here are my surprising findings: root@raspberrypi:/home/ozn# fdisk -l Disk /dev/mmcblk0: 4025 MB, 4025483264 bytes 4 heads, 16 sectors/track, 122848 cylinders, total 7862272 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000dbfc6 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 7862271 3869696 83 Linux Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x950e3b8d Device Boot Start End Blocks Id System /dev/sda1 2048 625142447 312570200 83 Linux /dev/sda2 625142448 976773167 175815360 83 Linux First, /dev/sda is NOT recognized correctly! This disk is 500GB. Second, mounting /dev/sda2 is not possible: root@raspberrypi:/home/ozn# mount -t ext4 /dev/sda2 /media/usbhdd1/ mount: special device /dev/sda2 does not exist # although fdisk -l showed this device ! Third, trying to format the disk, it really sees only the sectors until 320GB: When I start fdisk I am warned: Building a new DOS disklabel with disk identifier 0x6784fc4b. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. I have other USB hard drives with 320GB and they really mount fine. Is this a limitation of RPi? Or a problem with this specific Hard Drive? How can I use this large disk with my RPi? update: solved the issue with help of the commentators here... here is what I did ... I thought I have some weired issue with Debian Wheezy & gparted. So, I reformatted the hard drive to NTFS. Before that I ERASED the partition table. And created a new single NTFS partition. Bingo! RPi, identified the partition. However, it claimed my Drive is now 2TB big, and recommended I will use GPT: root@raspberrypi:/home/ozn# fdisk -l /dev/sda Disk /dev/sda: 2199.0 GB, 2199023255552 bytes 255 heads, 63 sectors/track, 267349 cylinders, total 4294967296 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xf720f720 Disk /dev/sda doesn't contain a valid partition table root@raspberrypi:/home/ozn# fdisk /dev/sda Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xb7032c3f. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: The size of this disk is 2.2 TB (2199023255552 bytes). DOS partition table format can not be used on drives for volumes larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT). whoops! That is WRONG! So, I disconnected the hard drive again. re-connented it to my laptop. I erased the partition table again, and re-created the partition table using fdisk on RPi! not on my laptop! This time, I took a short cut, and created the disk partition with ext4 directly. I plugged the hard-drive to RPi and BINGO! root@raspberrypi:/home/ozn# fdisk -l Disk /dev/sda: 500.1 GB, 500107862016 bytes 81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000505b8 Device Boot Start End Blocks Id System /dev/sda1 2048 976773167 488385560 83 Linux Disk /dev/mmcblk0: 4025 MB, 4025483264 bytes 4 heads, 16 sectors/track, 122848 cylinders, total 7862272 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000dbfc6 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 7862271 3869696 83 Linux Disk /dev/sda: 500.1 GB, 500107862016 bytes 81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000505b8 Device Boot Start End Blocks Id System /dev/sda1 2048 976773167 488385560 83 Linux The disk is now identified correctly on my laptop with Debian. ozdeb@yenitiny:~$ sudo fdisk -l /dev/sdb Disk /dev/sdb: 500.1 GB, 500107862016 bytes 81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000505b8 Device Boot Start End Blocks Id System /dev/sdb1 2048 976773167 488385560 83 Linux conclusion (?) My guess is that gparted in Debian Wheezy includes some nasty bug which is sometimes showing it's ugly face. I would report a bug if I had more solid evidence. But ... since I have only one 500GB hard drive, and I don't want to risk the health of this hard drive reformatting it so many time, I will settle this with it. If you happen to bump into this post, and you have had similar problems with large SATA drives and partitioning on wheezy, I would be happy to know.
The comments on the original post are getting too long, so here is my answer. I suspect that it's the drive itself. Maybe try update your Raspberry Pi and then try again. To update sudo apt-get update && sudo apt-get upgrade Then try to access the drive. If this does still not work. I'd recommend trying to find someone with a HDD at least the same size or bigger and test that.
1
How to update sudo apt-get
Pair variables on Custom Field Type
In the Custom Field Type, I've made separate table to store other information. So it means single field value contain many values in array. I want to use this array as pair tags on expressionengine. like:- {playlist} {playlist:videos} {playlist:titles} {/playlist} As playlist has multiple videos and titles. http://postimg.org/image/60spnlykt/ http://postimg.org/image/c63h56cb9/
I'm really not sure what you're looking for, since your question isn't very clear, but I'm taking a shot in the dark. I think you're looking for a way to output your custom field type as EE template tags, as you say: {playlist} {videos} {titles} {/playlist} To do something like this, you probably need to parse those variables using the template class. Use these references to refresh your knowledge of EE custom add-ons: https://ellislab.com/expressionengine/user-guide/development/fieldtypes.html#development-reference https://ellislab.com/expressionengine/user-guide/development/usage/template.html#parsing-variables
0.5
How to output custom field type as EE template tags?
Weird jquery 302 error in Firebug
I am posting data to servlet using jquery .post() method. The data is being posted and servlet is able to catch the data. But in my firebug I see 302 once the post request is done. Also I am redirecting the user to success page in my servlet. But the redirect is not happening!! Should'nt I be getting 200 on the post request? And why is a simple response.sendRedirect("success.jsp") not happening? When I click on the response tab I can see the success.jsp html tags. Please throw light on what is happening? How do I correct it?
Your servlet is sending the redirect message, which gives you the 302 response header. It'd be better to send back an url, and redirect the user to it on success itself. Like so: $.post("scripturl", { data: data }, function(result) { if (result.success) { window.location.href = result.url; } })
0.888889
Servlet sends redirect message to servlet .
Counterexample: Convergence in probability does not imply convergence in sample mean
Consider the random variable $X_n$ defined by $X_n = 2^n$ with probability $\frac{1}{n}$ and $0$ else, for each $n >0 $. It's easy to show that $X_n$ converges to $0$ in probability. How do we show that $S_n / n $, the sample mean, fail to converge to $0$?
I presume (but it definitely must be stated!) that the $X_n$ are supposed to be independent. Hint: use one of the Borel-Cantelli lemmas.
1
The $X_n$ are supposed to be independent
What do percentages mean on a BF3 server description?
I am a bit behind the curve, and just started playing BF3. I played BFBC2, and liked it, and enjoy what I see so far in BF3. The new server setup confuses me though. Since it appears that there are no more 'standard' servers (think BC2 or even most other games on the xbox like Halo or CoD), you can see a list of all of these 'public' shared servers, with odd descriptions. One thing I noticed a lot through them was people saying '500% on [map name]'. I was very unsure of what this meant. I was in an awesome match last night, and after dying once, I was kicked. I had no clue what for. Because I had just selected 'quick match' I was unsure of any server rules. I would like to understand what hosts are meaning by their description.
The typical reason for such server settings is to provide an environment where players can gain XP as fast as possible. This is why you'll see a lot of Metro 64 player servers with high ticket counts - Metro being full of intense activity choke points where you can drop medkits or ammo packs and rack up points, or even just fire into the maw blindly and score kills. If you actually want to improve your play, avoid these servers (unless you want to test unfamiliar loudouts quicky).
0.888889
Metro 64 player servers with high ticket counts
How well does Python's whitespace dependency interact with source control with regards to merging?
I'm wondering if the need to alter the indentation of code to adjust the nesting has any adverse effects on merging changes in a system like SVN. This is a really open ended question. I'm sort of fishing for information/anecdotes here. Edit: Thanks all! I'd accept an answer but which one? I up moded them all.
I've used python with SVN and Mercurial, and have no hassles merging. It all depends on how the diffing is done - and I suspect that it is character-by-character, which would notice the difference between one level of indent and another.
0.666667
python is character-by-character, which would notice the difference between level of indent and level of character.
Equitably distributed curve on a sphere
Let $\gamma=\gamma(L)$ be a simple (non-self-intersecting) closed curve of length $L$ on the unit-radius sphere $S$. So if $L=2\pi$, $\gamma$ could be a great circle. I am seeking the most equitably distributed $\gamma(L)$, distributed in the sense that the length of $\gamma$ within any disk is minimized. This is something like placing repelling electrons on a sphere, but here the curve self-repels. So there should be no "clots" of $\gamma$ anywhere on $S$. I am especially interested in large $L$. A possible $\gamma$ is shown below, surely not optimal for its length:             Here is an attempt to capture more formally "equitably distributed." I find this an awkward definition, and perhaps there is a more natural definition. Around a point $c \in S$, measure the $r$-density of $\gamma$ as the total length within an $r$-disk: $$d_\gamma(c,r) = | \gamma \cap D(c,r)|$$ where $D(c,r)$ is the disk of geodesic radius $r$ centered on $c$. Then define $d_\gamma(r)$ as the maximum of $d_\gamma(c,r)$ over all $c \in S$. Finally, we can say that, for two curves $\gamma_1$ and $\gamma_2$ of the same length $L$, that $\gamma_1 \le \gamma_2$ if $d_{\gamma_1}(r) \le d_{\gamma_2}(r)$ for all $r \in (0,\pi)$, i.e., $\gamma_1$ is less concentrated than $\gamma_2$ for all $r$ up to a hemisphere. This definition provides a partial order on curves of a given length $L$. One version of my question is: Q. What do the minimal elements of this poset look like, especially as $L$ gets large? These minimal curves are in some sense nowhere densely clotted. Update. Acknowledging Gerhard Paseman's remark, I thought I would include this attractive image of a space-filling curve on a sphere:     (Image from this website). But notice it is certainly not equidistributed in any sense, crowding near the northpole.
to me the best possible solution seems to be the sequence of closed Hilbert curves on the Cubed Sphere; that curve consists of six ordinary Hilbert Curves, one for each face of a cube, which, when appropriately connected, yield a space-filling Jordan Curve for the cube's surface. Then centrally projecting those curves onto a cocentric sphere yields a solution without crowding, albeit a slightly higher density around the projections of the cube's corners. A further improvement may result from rounding away the corners in a similar fashion as is used for tennis balls, which is the rounding applied to your example. Yet another, maybe even better, bet would be Hamilton Cycles of Hamiltonian Fullerene Graphs (cf e.g. http://arxiv.org/pdf/0801.3854.pdf for a discussion); that bet is based on the honeycomb conjecture (cf e.g. http://en.wikipedia.org/wiki/Honeycomb_conjecture) and on the fact, that Fullerene graphs are the closest one can get to a hexagonal tiling of the sphere (there are twelve inevitable pentagons). Examples of Hamiltonian Fullerene graphs are depicted here: http://www.academia.edu/4269519/On_the_Hamiltonicity_of_Fullerenes.
0.5
Hamilton Cycles of Hamiltonian Fullerene Graphs
php escape sequence not working
I just want to echo out some text on the webpage display with a tab space before a word. I have the following codes in php: <?php echo "\t\t hello!<br>"; echo "\t\t", "hello!<br>"; echo "\t\t"."hello!<br>"; ?> I tried all sorts of combinations, but it just won't show the tab spacing before the word. OUTPUT: hello! hello! hello! I visited some links like: Newline escape sequence not working on php but I am not echoing it from a function. I just simply want to echo it out from a .php file.
When you add a tab to html, it is only visible on the source code and then treated as whitespace when rendered in a browser.... just like \n is only visible in page source code and treated as whitespace when rendered... \t and \n are meaningless to html
0.888889
When adding tab to html, it is only visible on the source code and then treated as whitespace when rendered in a browser
When are we first informed about Gerry Lane's profession?
In World War Z, Brad Pitt plays the role of a former UN investigator named Gerry Lane. When are we first informed of this fact? When I watched the film, I spent half the movie wondering who he was that he could get a helicopter to specially ferry him and his family out of the city. It was only when he spoke to the naval honcho that I found out that he was a former UN man. Is this the first instance of this information being revealed to the audience? I can remember a conversation about his job when the Lanes are having breakfast. But I don't recall the UN being mentioned.
While the opening chatter does mention the UN and the WHO, and Gerry explains martial law to his daughter, we do not find out exactly what his profession is/was until he and his family are extracted and arrive on the warship (and, as in my question, speak to the naval man). This is also the first time that the UN is mentioned after the aforementioned opening chatter. The Under-Secretary here says you were his best investigator when you were at the U.N. You were on the ground during the Liberian Civil War. Investigated Chechen war crimes. Sri Lanka in '07. Places you and I both know Dr. Fassbach wouldn't last a night in. This conversation occurs at around the 32 minute mark. Until then, we have no idea who he really is.
1
First time that the UN is mentioned after the opening chatter .
How do I increase sudo password remember timeout?
I already know that I need to tune /etc/sudoers file but I would like to see full information and also a solution that would not require me to use vi editor. Update: never, ever try to edit the file with something else than visudo.
Disable sudo timeout with this command: sudo sh -c 'echo "\nDefaults timestamp_timeout=-1">>/etc/sudoers' To re-enable sudo timeout with this method: sudo sed -i "/Defaults timestamp_timeout=-1/d" /etc/sudoers
1
Disable sudo timeout with this command
Adjoint Functors as Initial Objects of Some Category
Just as universal arrows can be characterized as initial objects of some appropriate comma category, and (co)limits can be characterized as (initial) terminal objects of the appropriate (co)cone category, is there some (and if so, what is the) appropriate category for which, given a functor with a left/right adjoint, we can characterize said adjoint as its initial/terminal object? My goal in this is to characterize [initial objects, universals, limits, adjunctions] all as examples of each other.
Well, yes: the left adjoint of a functor $G: C \to D$ is the initial object in the category whose objects are pairs $(H: D \to C, \eta: 1_D \to G H)$ where $\eta$ is a natural transformation, and whose morphisms $(H, \eta) \to (H', \eta')$ are natural transformations $\theta: H \to H'$ such that $$\begin{array}{ccc} & 1_D & \\\\ {}^{ \eta} \swarrow & & \searrow {}^{\eta'} \\\\ GH & \xrightarrow{G\theta} & GH'\end{array}$$ commutes. Similarly, a right adjoint can be expressed as a terminal object in a suitable category (exercise in applying the concept of duality). See the discussion on comma categories in Categories for the Working Mathematician,
0.777778
the left adjoint of a functor $G: C to D$ is the initial object in a category
Probability exercise with apples
We have a tree with 100 apples. There are 10 red apples and the rest are green. Lisa is picking apples at random. When she pick the 3rd red apple she stop. What is the probability that Lisa has exactly 7 green apples (in addition to the 3 red apples she picked)?
Hint: she has to pick 2 red and 7 green, then pick a red. How many ways are there to do that? How many ways to pick 10 apples? Added: to pick an unordered 2 red and 7 green, you need to choose 2 out of 10 red and choose 7 of 90 green. Divide this by an unordered choice of 9 of 100
0.888889
How many ways are there to pick apples?
Why was a resistor and capacitor used in this IR receiver circuit
The circuit shows an IR receiver whose output pin is interfaced with a PIC. Can you explain why a resistor and capacitor were used and why those values were picked.
As the datasheet clearly says, the TSOP output is open collector. This means it needs a passive pullup to go high. However, the circuit you show is messed up in several ways. Assuming whatever you find on the internet to be good coupled with not reading the datasheet leads to trouble. Specifically, problems with this circuit are: 100 Ω is a really low value for the pullup. The TSOP would have to sink 50 mA to bring that low. That's so much that I would not assume the TSOP can do that unless the datasheet explicitly says so. In any case, that much current is totally unnecessary. 10 kΩ would be a much better pullup value. 100µF on the output line is excessive, and totally unnecessary. The circuitry inside the TSOP already produces a clear digital output that does not bounce. There is no point in filtering that output further. Perhaps that cap was intended to be between power and ground, but that's not what the schematic shows. There is no decoupling cap. Again, read the TSOP datahseet. If I remember right, this even specifies a minimum decoupling capacitance. C1 may have been intended to be between power and ground, which would make a lot more sense than where it is shown. Even if so, a 1 to 10 µF ceramic would be more approriate than a 100 µF electrolytic. All in all, this circuit is a mess. Delete it, don't trust anything else you find on that website, and move on.
1
The TSOP output is open collector
Can a portion of human skin cells be modified in some way to generate light?
I have come across some species of living organisms who are able to emit light at whim. Can that ability be incorporated into a portion of human skin (a specialized tissue)?
Yes, the fibroblasts of skin cells can quite easily be Transfected with a fluorescent gene such as GFP. Fluorescence doesn't actually produce light, the fluorescent molecule just changes the wavelength of light shining on it. Fibroblasts can also be made luminescent (light producing) by acquiring genes for firefly luciferase or aquoren from jellyfish. This is a little more tricky since luminescent molecules typically require cofactors such as ATP, Calcium or other proteins. Both methodologies are readily performed in vitro.
1
Fluorescence does not produce light, the fluorescent molecule changes the wavelength of light shining on it
jQuery cascading dropdowns and Word
If a user clicks on New from a document library then a word template opens with metadata in the header section, will the SPServices jQuery cascading dropdowns work in the word's header? I doubt it. If not, can I force user to fill out the metadata first when they click on new then open the word template in the word and it should be filled as user already filled the metadata?
No, because the SPServices Cascading dropdowns functions on list forms. To my knowledge, you can't specify metadata before creating a document. You could require check in/out on the document library to force an item be checked in before being available and this would let you use the SPServices cascading dropdowns since that's effectively an editform. I'm wondering if there's a way to extend the document information panel in Word to account for something like that.
1
Can't specify metadata before creating a document?
What was the meaning of the tunnel scene?
In Vanishing on 7th Street, people disappear if they become engulfed in darkness. At one point Paul is lying on the pool table and the kid went to the bathroom. The lights flicker and Paul gets up. He ends up finding his way into this tunnel. When he reaches the end he looks back and all of the lights go out. The kid goes back in and finds Paul missing. What is the meanign of the tunnel scene? It seems that it didn't actually happen, but I'm confused as to why it's included.
I saw this, too. My opinion was it's a flash dream like Occurance at Owl Creek Bridge. Something that feels long or extended, but only happens in a moment. And he was the one taken, not the kid
0.888889
Occurance at Owl Creek Bridge
Do Cron_schedule table collects log cleaning status too?
Hi If magento fails to run the log cleaning process as per the configuration then where it does saves the error_log (or) failure status? Magento doesn't clean the log tables periodically. Note: I can't set Cron from cpanel(WHM) to do this automatically, as I don't have option. Any help will be appreciated Thanks
If you cannot set up a cron job to run Magento's cron trigger (either cron.sh or cron.php) regularly, then Magento's internal cron jobs don't run. If your hosting provider won't let you run cron jobs, then you will have to call cron.php periodically by calling it remotely with curl or wget. Two things to finish out the setup: you must run cron.php at least every 15 minutes minimum so you don't get "too late for the schedule" because the job got set but didn't run within the expiry time period. Magento cron jobs are a two step process, the job gets set on the first trigger (scheduled), then then on next trigger, it gets run (at about the scheduled time after the nearest trigger runtime) you must go to System->Config->Advanced->System to complete the Log Cleaning setup. Generate schedule information (System->Config->Advanced->System) under the Cron windowshade for a system that's running cron.sh/cron.php every 15 minutes. Note: AOE_Scheduler is being run on this system and the extra fields are there for it. If you're running AOE_Scheduler and you're running a cron trigger (cron.php) every 15 minutes, you need to set the AOE_Scheduler Heartbeat Task Schedule appropriately to be every 15 minutes.
0.888889
Magento's internal cron jobs don't run regularly .
Using nofollow when crosslinking my own sites
I have 20 sites in the same domain, different niches and I want to interlink them for USER EXPERIENCE. I want to know from someone who tested this: Will using a nofollow attribute for the links keep the sites safe from google link scheme penalties?
I wouldn't bother and you don't need to look any further then this page to see why. Look at the links to the other StackExchange sites in the footer of this page. It's on every page of every site in the network. If something like this was a problem you can be sure StackExchange, who has direct contact with Google about SEO issues, wouldn't do it.
1
Look at links to other StackExchange sites in the footer of this page
dynamic call of functions and generator function (python)
The following code only prints "good". Why the generator function is not executed? I noticed with pdb that after executing 'handlers1' the script reaches the line with f1's definition but then does not get inside the function. Conversely, it's returned 'GeneratorExit: None'. class foo: def f0(self, s): print s def f1(self, s): print "not " + s yield 1 def run(self): handlers={0 : self.f0, 1 : self.f1} handlers[0]('good') handlers[1]('good') bar = foo() bar.run() Why this happens? Is it possible to call generator functions in a similar dynamic way?
When you cann a generator function, it only returns an iterator. You should try to call the generator's next method to execute the body of generator function. Try this: class foo: def f0(self, s): print s def f1(self, s): print "not " + s yield 1 def run(self): handlers={0 : self.f0, 1 : self.f1} for _, func in handlers.iteritems(): res = func('good') if hasattr(res, 'next'): next(res) bar = foo() bar.run()
0.777778
When you cann a generator function, only returns an iterator
Robots.txt disallowing URLs
I need to disallow some URLs on my site but I am not sure how to do that. I have a site that has products and reviews. When someone makes a review, the site generates a URL automatically like this: mysite.com/addreview_1.htm mysite.com/addreview_2.htm .... mysite.com/addreview_9999.htm I need some way to disallow all the URLs which will appear in the future.
You can add a wildcard entry to the robots.txt like: Disallow: /addreview* Google and other big players will honor the wildcards, but as this is a more recent addition to the robots.txt specification, there are probably still crawlers that ignore it. This will also only work if the URLs you want to disallow have a common element that is not found in URLs you want crawled.
0.888889
You can add a wildcard entry to the robots.txt
Law of Multiple Proportions: What is the significance of small whole numbers?
I'm new to Chemistry and in my textbook, it describes the Law of Definite Proportions and then goes on to describe the Law of Multiple Proportions. The example they give is carbon monoxide and carbon dioxide, where the mass ratio of oxygen to carbon in carbon dioxide is 2.67:1 and the mass ratio of oxygen to carbon in carbon monoxide is 1.33:1. I understand the above example, and I understand that when you compare them in the following way: 2.67g (proportion of oxygen to 1g carbon in carbon dioxide)/ 1.33g (proportion of oxygen to 1g carbon in carbon monoxide) = 2.00, a small whole number. $\frac{Mass~oxygen~to~1g~carbon~in~carbon~dioxide}{Mass~oxygen~to~1g~carbon~in~carbon~monoxide}$ = $\frac{2.67g}{1.33g}$ = 2.00 My textbook doesn't describe what a small whole number is, or what it means... just that, in this example, 2.00 is a small whole number. What is the significance of the 2.00? I understand that carbon dioxide has double the oxygen. Is this where the 2.00 plays a role?
There's no universally accepted hard cut-off, as far as I'm aware, which determines the range of numbers that would constitute "small" mass ratios. Generally, all textbook examples select compounds that yield single-digit mass ratios. The significance of the ratios being small (as well as their constancy and the limited number of different mass ratios for binary compounds actually found in nature) is that they allow for reliable conclusions to made about the stoichiometric proportions in which elements combine based on crude empirical data alone, as well as leading to conjectures about the number of possible configurations, bond arrangements, and oxidation states yielding said combinations. The law is valid for a large variety of binary compounds simply by virtue of the fact that there is typically a limited number of permutations in which two given elements can be combined to yield a stable compound. For example, C and O have only two, N and O have only four, metals have a limited number of oxidation states, therefore giving rise to relatively few possibly formulas for binary ionic compounds, etc. The law breaks down for cases in which two elements can combine to form long chains or complex molecules (e.g., large hydrocarbons and [mostly hypothetical] silicon analogues), when the mass ratios can sometimes become quite large.
0.777778
The law is valid for a large variety of binary compounds
Why a Transistor is considered to be an active device?
How it a Transistor an active device? Because it it not producing energy. We just feed it with energy and it amplifies it and that too not on his own but using a bias battery. So how it is considered to be an active device? Please can anyone provide full explanation?
Basically, An active device is any type of circuit component with the ability to electrically control electron flow (electricity controlling electricity). Thus, transistor is an active device. Note that active device doesn't mean it just produces energy. All active devices control the flow of electrons through them. Some active devices allow a voltage to control this current while other active devices allow another current to do the job. Devices utilizing a static voltage as the controlling signal are called voltage-controlled devices. Devices working on the principle of one current controlling another current are known as current-controlled devices. BJT is current controlled, while FET is voltage controlled active device.
1
Basically, an active device is any type of circuit component with the ability to electrically control electron flow
How can I do some free design work?
I am a designer that wants to do some free design work for people, but the problem is, how do I find people to do free work for? Is there any place online? The reason behind this is that I am good at this, but I don't have any clients, or any previous experience and I am a freelancer, so this would look good on my portfolio. My skills are very vast and include : 3D, 2D animation, 3D modeling, motion design, stop motion animation,video editing, game design, level design, FluidSIM, illustration, unreal engine 4, graphics design, editorial design, web design and I also know HTML5, CSS, JavaScript and jQuery. By free work, I mean that the clients don't have to pay a single penny for the work that I do.
Forgive if I'm rude here. Design is one of the profesions that has prostituted the most. Why do anyone has to pay a penny if there are always new insecure people who has no previus clients? "so this would look good on my portfolio" Your portafolio will look good if it has good work. So why don't you concentrate in making good work to show? You say you are a designer. But I don't know if you have an idea what design is for. Do you belive in design? Do you belive that a good motion design video will help your client sell more? An impresive web page? A great business card will make a good impression? "I don't have any clients" But you don't belive it becouse you are not making any video to sell the idea of making videos. You are not making a web page to sell web page design. One method to sell is "Look this are my clients". But the best selling argument is "Imagine what I can make for you". There are a lot of people willing to pay talented work. Period. "By free work, I mean that the clients don't have to pay a single penny for the work that I do." We know what that means. But new designers have no idea what overall perception that makes! Design is worthless. I have a question. Does your work worth one penny or less? Or it is good enough to recive real money. Make a series of wallpapers with an idea of a clasical author, Ilustrate a poem, animate a folkloric tale, make a political statement, make logos out of plain words, make your corporative image and webpage and fool everyone to think is the greatest design firm. That will get you clients.
0.888889
Why do people have to pay a penny if there are always new insecure people with no previus clients?
"All right, Johhny, it's time you ..........to bed."
Could you possibly help me on this question please? "All right, Johhny, it's time you ..........to bed." went would go will be going going to go I would have gone for the word "go" but it is not in options. Another similar question is that " Your hair is too long.It is time .............a haircut" Thanks
Not sure what the grammatical name for this is, but the correct answer is the simple past tense of the verb: It's time you went to bed. It's time you got a haircut. This might be considered a slightly pedantic construct. Most native speakers of English would probably be more inclined to say: It's time for you to go to bed. It's time for you to get a haircut.
0.888889
It's time for you to go to bed.
Is Start & Stop technology good or bad for my car? (Alfa MiTO)
I was recently in the lucky position to obtain an (almost brand new) Alfa Romeo MiTo, Progression. Like many new cars coming out these days, it has "Start & Stop" technology that turns the engine off when the car is stationary and is put in neutral and the clutch is released. When putting down the clutch again the engine fires back up. My question then is this: a) Is start-stop technology bad for my engine in any way? b) What impact might start-stop have on my battery? I.e. won't it deteriorate battery life with the constant turning on and off? (The radio, fans and lights remain on whilst in "stop"-mode, but not things like the aircon.) c) Will this technology really benefit me that much with regards to fuel-consumption? I can imagine it will be more economic when stops in heavy traffic become really long or traffic lights are red for long periods, but for the most part when driving the car doesn't turn off for longer than a minute at most before I have to "start" it up again. As many new cars lately have this technology I imagine that it can't be that bad, but I'm curious as to it's actual real benefits. I can turn this feature off, but I have to do so every time I start my car up for the first time and then I'm stuck with this glaring orange light in my dash, letting me know it's turned off.
I would imagine that this sort of technology would lead to increased wear on your starter motor, as it is being used far more than it would normally be, however I would hope that they would have anticipated this and designed the starter to be more robust than a traditional one. The battery should be able to cope with it fine all the time it is in good condition. Batteries do, however, deteriorate over time, with a usual life of around 8-10 years at most. I suspect that as your battery starts to deteriorate, it won't be able to cope as well with the increased drain, leading to the car failing to re-start with traditional flat-battery symptoms. How well the electronics cope with this remains to be seen! As to your third question, I doubt it will help much at all. Getting an engine started needs quite a lot of energy (hence the big chunky battery), and the only way to get that energy is to burn fuel, through your alternator sapping power as it recharges the battery. I don't know the exact figures, but I suspect you'd have to have the engine off for a fair while to save enough fuel to offset the cost of starting it again.
0.888889
How well the electronics cope with this remains to be seen!
nm: how to show object file of a symbol in a shared library?
I have 25 object files which are combined to form one shared library. I have generated the shared library with gcc and while I was looking for exposed symbols with nm -D libmylib.so, I found two undesirable exposed symbols with the name of i and y which are in .bss section. I have tried to find them in my source files but i cant find them so if anyone can tell me whether there is some way to find that which .o file exactly has these undesired exposed symbols? Can I do it with nm or do I need another tool? Any help would be appreciated.
In the directory with your object files you can run: find . -name '*.o' -exec nm -D {} \; -print This should print symbols and then file name
0.888889
-name '*.o' -exec nm -D
How can you identify duplicate CSS rules?
I'm not talking about used/unused here. I have two stylesheets and some rules differ (either in selectors, rules or both) and some are exactly the same. So I'm looking for a way to extract and move those rules, which are the same in both files, into a third stylesheet. In other words: an intersection of two stylesheets. Strangely, I couldn't find a software for this. Would have expected this to be a more common problem. Background, for those who care: I'm converting a desktop website into a mobile one and I've started by duplicating the desktop stylesheet and changing it (throwing stuff out, adding to it).
Here is one possible solution: Copy both files into a CSS code formatting tool e.g. http://www.codebeautifier.com/ Format it so each CSS ruleset is on one line, e.g. p { font-size: 13px } Put the result into a sorting program, e.g. the sort command on Linux/Mac terminal. There are online tools that can do this too. Now all the duplicated selectors should be next to each other. You should be able to combine them by hand pretty easily. Also, don't forget that different ordering of CSS rules can have different results.
0.888889
Using a CSS code formatting tool e.g.
inserting period after every 3 chars in a string
I have this: from __future__ import print_function def f_comma(p_string): v_string = p_string if (type(v_string) == type(int()) or type(v_string) == type(long()) or type(v_string) == type(float())): v_string = str(v_string) else: l_string = list(v_string) for v_index in range(3, len(l_string), 4): l_string.insert(v_index, ',') v_result = ''.join(l_string) return (v_result) print (f_comma('qwertyuiopaq')) It seems that i can't figure it out why if i use a string longer than 11 chars the period stops inserting, but with only 11 chars it works fine. What i'm doing wrong in this piece?
Here's why it doesn't work. (Rather than solving your method which is a pretty inefficient one, as others have shown.) When you .insert() something into your list, every element gets shifted forward a position to make room. The indexes you calculated earlier with range(3, len(l_string), 4) are then no longer what you want them to be.
1
When .insert() something into your list, every element gets shifted forward to make room.
Why do Football players prefer to use their family name?
I read that in Western countries, people prefer their first name over their family name, that is why they put their first name first, in form first name + family name For example Wayne Rooney, Steven Gerrard, ... This is contradicts with Eastern countries, where people full name is of form family name + first name But in Football (or Soccer in America), you can see in the uniform that they use their family name only. For example Rooney, Gerrard, ... Why is that?
Because when one name is used to identify someone you do not personally know, the convention has long been to use their surname. Hence we say: Shakespeare wrote The Tempest. Churchill was prime minister of the UK when it was at war with Hitler. Washington was the first president of the US. Einstein developed the theory of relativity. Shelley wrote Frankenstein. Not: William wrote The Tempest. Winston was prime minister of the UK when it was at war with Adolf. George was the the first president of the US. Albert developed the theory of relativity. Mary wrote Frankenstein. Among other things, the most common first names are probably more common than the most common surnames: John was the last US president to get fatally shot. John wrote "Imagine" after leaving the Beatles. John was the second US president. John was the sixth US president. John wrote Paradise Lost. John founded Calvinism. John wrote the Grapes of Wrath. Surnames identify one in a global context more than first names do. The use by athletes is just another example of the same thing.
1
When one name is used to identify someone you do not know, the convention has long been to use their surname
Mobile 3D engine renders alpha as full-object transparency
I am running a iOS project using the isgl3d framework for showing pod files. I have a stylish car with 0.5 alpha windows, that I wish to render on a camera background, seeking some augmented reality goodness. The alpha on the windows looks okay, but when I add the object, I notice that it renders the entire object transparently, where the windows are. Including interior of the car. Like so (in example, keyboard can be seen through the dashboard, seats and so on. should be solid) The car interior is a seperate object with alpha 1.0. I would rather not show a "ghost car" in my project, but I haven't found a way around this. Have anyone encountered the same issue, and eventually reached a solution ?
SOLVED: Thanks to Demi. Here is the final code: // Render opaque objects [_scene render:renderer opaque:true]; // First planar shadow pass (if needed) [self renderPlanarShadows:renderer]; // Render transparent objects glColorMask(1, 1, 1, 0); if (_zSortingEnabled) { [_scene renderZSortedAlphaObjects:renderer viewMatrix:&viewMatrix]; } else { [_scene render:renderer opaque:true]; } glColorMask(1, 1, 1, 1);
1
Render opaque objects [_scene render:renderer opaque:true]
How can I keep a macbook running when the display is closed?
I bought a macbook pro retina 13" few days ago. I have never had a mac before and I don't know where can I set the computer to keep running when I close the display. The laptop came with os x 10.8.4. Any help?
When not connected to charger it doesn't work when Display is connected, so make sure to have it plugged in while using external Display and working with closed macbook.
0.888889
When not connected to charger
Practical use and applications of improper integrals
What are the most important applications of improper integrals, in particular to computer science and related fields, and to technology and engineering in general? I know that improper integrals are very common in probability and statistics; also, the Laplace transform, the Fourier transform and many special functions like Beta and Gamma are defined using improper integrals, which appear in a lot of problems and computations. But what about their direct, practical applications in real life situations? Any insight is much appreciated!
One easy example on the field of physics are those problems related to finding the electrical / graviational /etc. potential of a given field. For example, the electric potential created by a charged sphere of radius $R$ for $r \geq R$ is given by: $$ V(r) = - \int_{\infty}^r E(r) \, \mathrm{d}r$$ where $E$ is the electric field (modulus) generated by the sphere and $r$ is the distance from the center of the sphere. This also has a very simple physical meaning since the integral (when the minus sign is considered) represents the work to be done by somebody (or something) to bring the considered amount of electrical charge (responsible for creating the electric field $E$) from $\infty$ to $r$. The same expression and physical meaning can be applied to the case of gravitational potential. Cheers!
0.888889
Physical meaning of electric potential of a given field
Have I Been Misplaying France in Diplomacy?
France is considered one of the "better" countries to play in Diplomacy. That's true insofar as it a "corner" and not a "center" country like Germany, Austria-Hungary, and Italy. In descending order, my favorite strategies are 1) Go for the Mediterranean, 2) Ally with England vs. Germany 3) Ally with Germany Vs. England. But I've found France a tough, frustrating country to play when one can't use a Mediterranean strategy (because of what's going on elsewhere). A couple examples: In one game, England "allied" with me against Germany, than stabbed me, leading to a Franco-German alliance (my least favorite). Meanwhile, Italy stabbed Austria, A Venice-Trieste, and got two builds in 1901, three in 1902, and had her choice of allies: with Russia vs. Turkey and Germany, with England vs. France. In another game, I had to ward off an Anglo-German invasion. But the English army that went to Belgium marched into the Ruhr, again leading to a Franco-German alliance. But by the time we reshuffled the alliance, Austria-Hungary had stabbed Italy, overextended in a Lepanto opening, captured Venice and Rome, and dominated the Med. With Turkey, Italy, and the Balkans, Austria and Russia had the 18 centers to declare themselves co-winners. Have I been misplaying France? Or has my inability to control the Med been due to my northern troubles, and the Austro-Italian imbalances? Can I hope for a more "fortunate" result playing France in future games, against, say, random opponents?
It sounds to me like both games you've failed to negotiate an alliance with England. That isn't necessarily your fault, but in order to concentrate on the Med you would need to at least be able to negotiate a neutral England, if not an entirely friendly one. Some ideas you might want to try It sounds like in both games you stumbled into an FG alliance that was not in a strong position. You might do better if you attempted to negotiate the FG alliance from the start. That way you can be directing the flow of the conflict, rather than reacting to it. England is likely worried that in an EF alliance, F usually grows faster and is in a more solid position after taking down Germany, while E ends up overextended. So you'll likely need to give him the better side of the split, and make it clear that you are committing to the South so that E knows he isn't the next target. You can also make things easier by making sure that England has a good path to grow after the initial attack on Germany, which generally means you want a weak Russia. At the same time, don't make yourself too inviting of a target for E. Many alliances are broken due to people who are too trusting and make it too easy for their partner to stab. The more you play Diplomacy, the more you realize that none of the countries are really better than the others, so don't get frustrated that you didn't get a good result while playing a "strong" country. Focus on where your negotiations failed to bring the results you wanted, and try to improve on that in your next game.
0.666667
In both games you've failed to negotiate an FG alliance with England
Does a laptop computer charge faster when off?
A laptop power supply can supply a limited amount of power. Conceivably, then, when the computer is running, some of the power must be diverted to the processor and other components, leaving less to charge the battery. (Power usage is roughly 10 to 30 watts, or maybe more if you have a graphics card. In my case, my charger is rated for 65 watts.) Why doesn't my laptop battery charge while the laptop is in use? is an example of an extreme case. So it's plausible that this would affect charging speed. So do laptops in fact charge significantly faster when turned off or asleep (while plugged into a sufficient power supply)?
No one answer fits all, it really depends on the laptop! Some have built in features (vendor specific) that speed up the battery charging, others (including most of mine) charge a lot slower when in use. Again, no one answer fits all.
1
No one answer fits all, it really depends on the laptop
No sound in Ubuntu except at log in
I installed Ubuntu 12.04 a month ago and am using it till now. I failed to notice that all this time there was no sound at all while running Ubuntu, even while playing a game in Wine. The weird thing is that only the startup sound comes when I log in (Indian/African drum tone), then comes the utter silence. I tested both Digital Output (S/PDIF) and the speakers in the sound settings but can hear nothing. Any help?
Just in case nothing of the above works - check that the issue is not with the amplifier. I eventually plugged in another computer, and still silence. Moving the cable to a different HDMI input of the amplifier did the trick. Who knows what is wrong with "HDMI3", but I can live with that. :-)
1
What is wrong with "HDMI3"
Looking for a compound
TL;DR; I need a compound that is harmeless to the human body, odorless, tasteless, causes some kind of visible reaction (urine coloration perhaps) AND can be bought without medical recomendation. LONG VERSION; Food stealing in my company fridge has become a serious problem. It's not only a recurring issue but a targeted one... our thief has been targeting "high" value, particularly coconut water. HR seems to ignore our complains... so I decided to take matters in my own hands... since I have access to timesheets, I thought that if I can scare out thief to leave work or skip it, I can narrow-it-down/point-him-out because we have about 30 people in our office...
Urine typically is yellow, but in combination with blue dyes, a green colour can be obtained. Noteworthy compounds are methylene blue, thymol, Cimetidine (antacid), or Mitoxanthrone (used in cancer therapy). I've mentioned these just for the sake of completeness - I think it is irresponsible and stupid to spike food with anything that doesn't belong there. Hiding a webcam in a shelf and running zoneminder probably isn't legal either and will get you in trouble with the privacy officer, but at least that doesn't mess around with the health of anybody else.
0.777778
Is it irresponsible and stupid to spike food with anything that doesn't belong there?
Good travel games for two players, especially for playing on trains?
I would be interested to hear if anyone had recommendations for 2-player games that are particularly suitable for playing while travelling on trains. (I ask this as someone who mostly enjoys games like Carcassonne, Power Grid, Agricola, Pandemic, etc. around the table at home.) To be specific, the things that I think are important properties for these games are: Needing minimal table space. Most trains have a small table you could use, but not much more. Being quiet to play, so that other passengers won't be disturbed. For example, I imagine that games that involve repeatedly rolling dice wouldn't be appreciated. Packing down small, so that they don't take up much luggage space. Not requiring batteries or a power socket. (I appreciate that an iPhone or a Nintendo DS for each player might be a good solution more generally, but it's not what I'm after in this case.) Not being so delicate to arrange that motion from the train will unduly disrupt the play. I think it would be best to recommend one game (or class of games) per answer, if that's appropriate, and explain why you think it's particularly suitable. (Incidentally, I've read the guidance on good questions about game recommendations and hope this question meets the criteria.) Update: Thanks for so many excellent suggestions - we certainly won't be short of games for our next long train journey :) Update 2: Unfortunately, I can't really playtest this many great games in any reasonable time period, so I'm going to accept the top-voted answer (Cribbage) and try out the others as soon as I can. Thanks again...
I would suggest Cribbage. Not much space is required, it is quick to set up and put away, involves no more noise than any game between two players, and is a very good game. It is also best enjoyed with a glass of something in the other hand, increasing its suitability for a train journey. If you don't know how to play (and it isn't terribly complicated, although rather different from other card games), have a look here... http://en.wikipedia.org/wiki/Cribbage
1
Cribbage is a very good card game, especially with a glass of something .
What is the most secure way to do OCSP signing without creating validation loops?
I'd like to enable the most secure OCSP validation that Windows 2008 SP1 and newer support. Based on the following information, am I required to implement id-pkix-ocsp-nocheck on my OCSP certificate? If so, does that mean an OCSP response can be forged, allowing an revoked certificate to go unnoticed by the victim? The signature on OCSP responses must follow the following rules to be considered valid by a Windows Vista or Windows Server 2008 client: For Windows Vista, either the OCSP signing certificate must be issued by the same CA as the certificate being verified or the OCSP response must be signed by the issuing CA. For Windows Vista with Service Pack 1 and Windows Server 2008, the OCSP signing certificate may chain up to any trusted root CA as long as the certificate chain includes the OCSP Signing EKU extension. CryptoAPI will not support independent OCSP signer during revocation checking on this OCSP signing certificate chain to avoid circular dependency. CryptoAPI will support CRL and delegated OCSP signer only. We recommend that you enable the id-pkix-ocsp-nocheck (1.3.6.1.5.5.7.48.1.5) extension in the OCSP signing certificate so that no revocation checking is performed on the OCSP signing certificate. This ensures that a CRL is not downloaded to validate the OCSP signing certificate. (source)
During normal chain validation, you are supposed to check the revocation status of each certificate in the chain. To check the revocation status, you must obtain a CRL or an OCSP response; both types of objects are signed, and, before usage, must be validated. Validation of a CRL or an OCSP response entails verifying a signature, relatively to the public key of the object's issuer, public key which is obtained from... validating another certificate chain. The whole process is recursive and you can end up with validating many certificates in the process. Of course, recursion has potential for loops, and loops are bad. Consider a simple path: Root -> SubCA -> EE. You are validating the path, verified all signatures, and reached a point where you also checked that SubCA is not revoked. Now you are considering the EE certificate. The EE certificate contains an AIA extension which points to an OCSP responder; you talk to that responder, and get an OCSP response. Great ! The OCSP response appears to have been signed directly by SubCA, using its private key (the same private key as the one used to sign the EE certificate). This is good: you have already validated that key, including revocation status, so it suffices to check the signature on the OCSP response, and then you can use it ("using" an OCSP response means looking at its contents and trusting them). This model above is "situation 2" from section 4.2.2.2 of RFC 2560: the certificate used to validate the OCSP response is the same as the certificate of the CA which issued the target certificate ("SubCA" in our example). Another model is supposed to be supported, described as "situation 3" from section 4.2.2.2: the OCSP response is signed by a dedicated responder, which has a certificate (let's call it "Resp") which is issued by SubCA. The Resp certificate is embedded in the OCSP response. How do you validate that ? It is easy enough to check the signatures, and also to check that Resp features the specific EKU which marks delegated OCSP responders. But how do you make sure that the Resp certificate itself was not revoked ? The three possible ways are: You use a CRL or another OCSP responder which will give you the information. This, of course, makes the process recursive. Resp is made to include the specific id-pkix-ocsp-nocheck extension, which makes the Resp certificate "unrevokable" (thus you do not need to get its revocation status, since it is unrevoked by definition). The CA does not care, and includes in Resp an AIA which points to itself as an OCSP responder. Thus, to validate Resp, you must first validate Resp. Face to this chicken-and-egg problem, you weep, then join the CA in its apathy and simply consider that Resp is "probably fine". Unfortunately, I have encountered the third way in big PKI sponsored by huge corporations or sovereign states who really should know better. Section 4.2.2.2 of RFC 2560 also hints at a "situation 1" where the OCSP responder is "something else" which the validation engine somehow knows to be safe through some "local configuration" (the expression "local configuration" is RFC-speak to mean "by the magic of the Fairies"). The text you quote means that Windows, up to Vista, knows how to handle situations 2 and 3. From Vista SP1 onwards, it also handles situation 1, with the following twist: the OCSP responder certificate can be "any certificate" but CryptoAPI will require CRL to validate that one. This is a drastic way to avoid validation loops. Summary: if you are building your PKI, the method which will cause the least trouble is to use the CA key for signing OCSP responses. If you really need to use a distinct key (e.g. the CA is supposed to be offline, but the OCSP responder, by nature, is online), then make the CA issue a dedicated certificate for the OCSP responder. This dedicated responder certificate shall contain the id-kp-OCSPSigning EKU and the id-pkix-ocsp-nocheck extension. Since an unrevokable certificate can be viewed as a gross breach of policy, the recommended way is to make it very short-lived: set the responder certificate to be valid for a fortnight or so, and issue a new one very week. As others have noted, many implementations do not check revocation status for "extra" certificates (certificates not in the main chain, but which are used to verify revocation objects like CRL or OCSP responses), which is sloppy but often made necessary (in a commercial way) to cope with big PKI who do not do things properly. It is your moral duty to do better than that (as I expose above) so as to bring us closer to the point where PKI will actually, you know, work and provide security.
0.833333
Validation of a CRL or an OCSP response
lxc-create hangs and finally fails
I was trying to place some juju charms on linux containers and the containers failed to start. To debug the issue I sshed into the node where this happened and tried creating an LXC container manually like ubuntu@slot13:~$ sudo lxc-create -t ubuntu -n pavan Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ... Installing packages in template: ssh,vim,language-pack-en Downloading ubuntu trusty minimal ... I: Retrieving Release It isn't making any progress at all. Its stuck here for a long long time. After a really long time it says, ERROR: Unable to fetch GPG key from keyserver and continues to hang. Finally after 20-30 mins, it gives up like E: Failed getting release file http://archive.ubuntu.com/ubuntu/dists/trusty/Release Where are the log files corresponding to lxc-create command? How can I debug this issue? EDIT: I figured out how to see the debug logs and hence ran the below command a few times sudo lxc-create -t ubuntu -n pavan --logfile=test.txt --logpriority=DEBUG test.txt contains only this lxc-create 1414897265.204 ERROR lxc_container - Error: pavan creation was not completed lxc-create 1414897407.757 ERROR lxc_container - Error: pavan creation was not completed lxc-create 1414897407.759 WARN lxc_log - lxc_log_init called with log already initialized But still it hangs and the debug logs aren't offering much help.
Thanks Felipe for the workaround - for a complete fix, required also doing: mkdir /var/lib/lxc/juju-trusty-lxc-template/rootfs/var/log/juju Details: ran lxc-create as per above Felipe's updateList item deploying any service was consistently failing, juju status showing: agent-state-info: 'container failed to start and was destroyed: jjo-local-machine-1' found at /var/lib/juju/containers/jjo-local-machine-5/container.log : lxc-start 1427066682.951 ERROR lxc_conf - conf.c:mount_entry:1711 - No such file or directory - failed to mount '/var/log/juju-jjo-local' on '/usr/lib/x86_64-linux-gnu/lxc/var/log/juju' Creating the directory fixed it, further deploys ok: mkdir /var/lib/lxc/juju-trusty-lxc-template/rootfs/var/log/juju
1
mkdir /var/lib/lxc/juju-trusty-lXc-template/rootf
Private IP getting routed over Internet
We are setting up an internal program, on an internal server that uses the private 172.30.x.x subnet... when we ping the address 172.30.138.2, it routes across the internet: C:\>tracert 172.30.138.2 Tracing route to 172.30.138.2 over a maximum of 30 hops 1 6 ms 1 ms 1 ms xxxx.xxxxxxxxxxxxxxx.org [192.168.28.1] 2 * * * Request timed out. 3 12 ms 13 ms 9 ms xxxxxxxxxxx.xxxxxx.xx.xxx.xxxxxxx.net [68.85.xx.xx] 4 15 ms 11 ms 55 ms te-7-3-ar01.salisbury.md.bad.comcast.net [68.87.xx.xx] 5 13 ms 14 ms 18 ms xe-11-0-3-0-ar04.capitolhghts.md.bad.comcast.net [68.85.xx.xx] 6 19 ms 18 ms 14 ms te-1-0-0-4-cr01.denver.co.ibone.comcast.net [68.86.xx.xx] 7 28 ms 30 ms 30 ms pos-4-12-0-0-cr01.atlanta.ga.ibone.comcast.net [68.86.xx.xx] 8 30 ms 43 ms 30 ms 68.86.xx.xx 9 30 ms 29 ms 31 ms 172.30.138.2 Trace complete. This has a number of us confused. If we had a VPN setup, it wouldn't show up as being routed across the internet. If it hit an internet server, Private IP's (such as 192.168) shouldn't get routed. What would let a private IP address get routed across servers? would the fact that it's all comcast mean that they have their routers setup wrong?
What would let a private IP address get routed across servers? Let's define what a private IP address is first: It's an address that, by convention, is agreed to not be routed on the Internet. That means that we agree as a community to never advertise those routes over BGP. It also means that that an ISP will probably kill those routes at the borders to their network to prevent them from possibly propagating. That doesn't mean, however, that a private IP can't cross routers. It is very possible and even highly likely that Comcast uses private IP address ranges for networking equipment that isn't ever supposed to communicate with the Internet as a whole. Those routes may be forwarded by interior routing protocols throughout the entire Comcast network. All in all, I'm going to guess that it's the case that your router performs NAT translation and then default-routes all traffic that isn't local to the next hop router, including private IP space. It's not very likely, though, that there are many Comcast routers sporting default routes that accidentally go all the way to a responding host with a private IP. It's my strong assumption that this is something purposeful. It might be a temperature sensor with remote monitoring or some other equally innocuous device that never needs to be talked to by anybody outside of Comcast. Would the fact that it's all Comcast mean that they have their routers setup wrong? Since your traceroute shows that all the packets remain within the Comcast network, it's actually not a very surprising circumstance that you've run into. It's staying within a single autonomous system and not violating any standards.
0.444444
What would let a private IP address be routed on the Internet?
What do you call a group of people that move a lot?
I can't think of the word to describe it. Something similar to "wanderer" or "roamer". It's often used to describe people that don't stay in one place... not "migratory"...
Nomadic should work. But I would not go with words like pastoral. It seems to convey a more idyllic and peaceful stance. Also, pastoral might refer to continuous movement in search of rural grasslands to base your livelihood upon. Also, gypsies, fugitives and migrants or bedouins would be discriminatory to use in a extended sense as they are particular to certain segments of people. The same is the case with a vagabond or a tramp. The word which I would prefer over Nomadic is the word 'drifting'. It seems to convey more of the aimless movement that the question seemed to have in mind.
1
Nomadic is 'drifting'
EditText blocked by keyboard when it is clicked
The question title may be misleading, but I have what I think is a common issue for Android newbies: I have an activity with a LinearLayout, and I have an EditText at the bottom of the screen. When I click on it, the keyboard appears over the EditText, hiding it while typing. Is there a way to achieve what most user expect, that is the activity gets scrolled down until the EditText becomes visible again?
you can try this if adjustResize still fails to fully show the view you desire. Whatever view your concerned about make a onTouchListener and then do this: setOnTouchListener(new OnTouchListener() { Runnable shifter=new Runnable(){ public void run(){ try { int[] loc = new int[2]; //get the location of someview which gets stored in loc array findViewById(R.id.someview).getLocationInWindow(loc); //shift so user can see someview myscrollView.scrollTo(loc[0], loc[1]); } catch (Exception e) { e.printStackTrace(); } }} }; Rect scrollBounds = new Rect(); View divider=findViewById(R.id.someview); myscollView.getHitRect(scrollBounds); if (!divider.getLocalVisibleRect(scrollBounds)) { // the divider view is NOT within the visible scroll window thus we need to scroll a bit. myscollView.postDelayed(shifter, 500); } }); //essentially we make a runnable that scrolls to a new location of some view that you WANT visible on the screen. you execute that runnable only if its not within the scrollviews bounds (its not on the screen). This way it shifts the scrollview to the referenced view (in my case 'someview' which was a line divider).
1
adjustResize still fails to fully show the view you want .
The Rademacher functions for counting binary digits
In the probability space $((0,1),{\cal B}(0,1), \lambda)$, we define the Rademacher functions as: $R_n(\omega)=\displaystyle\sum_{k=0}^{2^n-1}(-1)^{k+1}I_{\Delta_{k,n}}(\omega)$, where $(0,1)=\displaystyle\bigcup_{k=0}^{2^n-1}\Delta_{k,n}$ $\Delta_{k,n}=\left(\dfrac{k}{2^n},\dfrac{k+1}{2^n}\right]$, for $k=0,1,\dots2^n-2$ and $\Delta_{2^n-1,n}=\left(1-\dfrac{1}{2^n},1\right)$ I know that if $\omega\in(0,1)$ and $\omega=\displaystyle\sum_{n=1}^{\infty}\dfrac{x_n}{2^n}$ is the binary representation of $\omega$, then: $R_n(\omega)=-1\ \Longleftrightarrow\ $the $n^{th}$ binary digit of $\omega$ is 0 (i.e. $x_n=0$) $(I)$ and $R_n(\omega)=1\ \Longleftrightarrow\ $the $n^{th}$ binary digit of $\omega$ is 1 (i.e. $x_n=1$) $(II)$. Some prefer this as the definition of the Rademacher functions. I would like to know why these two definitions are equivalent, that is why the equivalences $(I)$ and $(II)$ hold. Intuitively I understand it, but I can't seem to write it down as a rigorous mathematical proof. Thanks in advance! EDIT: I corrected the $\Delta_{k,n}$ sets. As it was, it wasn't a proper partition of $(0,1)$ (some elements were not included - the right endpoints of the $\Delta_{k,n}$'s).
The fact that $R_n(\omega)=1$ means that $\omega$ belongs to $\Delta_{k,n}$ for some odd integer $k$. That is, $k\leqslant2^n\omega\lt k+1$ and $k=2\ell+\color{red}{1}$ for some integer $\ell$. Hence $2^n\omega=2\ell+\color{red}{1}+s$ with $0\leqslant s\lt 1$. Since $0\leqslant k\lt2^n$, $0\leqslant\ell\lt2^{n-1}$ and $\ell$ is a binary integer $\ell=\sum\limits_{i=0}^{n-2}\ell_i2^i$ with $\ell_i=0$ or $\ell_i=1$. Thus, $$ \omega=\frac2{2^n}\sum\limits_{i=0}^{n-2}\ell_i2^i+\frac{\color{red}{1}}{2^n}+\frac{s}{2^n}=\sum\limits_{i=1}^{n-1}\frac{\ell_{n-i-1}}{2^i}+\frac{\color{red}{1}}{2^n}+\frac{s}{2^n}. $$ This is the binary expansion of $\omega$, up to and including its $n$th bit, and this $n$th bit is $\color{red}{1}$. To solve the case $R_n(\omega)=-1$, rewrite the whole paragraph replacing each $\color{red}{1}$ by $\color{blue}{0}$.
0.777778
The fact that $R_n(omega)=1$ belongs to $Delta_k,n
Oracle.DataAccess.Client.BulkCopy - trying to cast varchar2 as number when it shouldn't
I have a table (A) that includes a column named confirmation_number. It is defined as a varchar2(30) and contains something like SMITERI-2012-02-31-4567. I have another table (B) that also includes a column named confirmation_number, and it is also a varchar2(30). I have a stored procedure that extracts the data from A, performing some transformation on it, and it includes the confirmation number column. I use C# and ODP.Net to run the stored procedure and load a DataTable with it. I then perform some additional transformations. However, I never touch the confirmation number column. Finally, I create an OracleBulkCopy object, set the column mappings, tell it to update Table B, and call loader.WriteToServer(dataTable). I am getting the following error: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) at Oracle.DataAccess.Client.OracleBulkCopy.PerformBulkCopy() I have confirmed that the error occurs on the confirmation_number column, because if I don't load that column, the dataload succeeds. Any ideas why the BulkCopy would be trying to turn a varchar(2) into a Number? EDIT: I have confirmed the following relevant issues: This is happening on more than just the confirmation number. This appears to only be a problem on string columns - whether from a string to a string or a string to an integer. This doesn't happen on every varchar2 column - last name and first name have no trouble. This happens both on columns that have no null values (confirmation number) and on columns that may have null values (street type). Investigating the contents of the datatable at the moment before the loader begins shows no difference in column definition between those that successfully go in and those that do not. I'm beginning to wonder if there's a bug in the BulkCopy itself and if I need to do this load using another utility. EDIT: Below is the trimmed down code. Table A CREATE TABLE "APPS_UNPROCESSED" ( "LAST_NAME" VARCHAR2(30 BYTE), "FIRST_NAME" VARCHAR2(30 BYTE), "MIDDLE_NAME" VARCHAR2(30 BYTE), "NAME_SUFFIX" VARCHAR2(30 BYTE), "GENDER" VARCHAR2(1 BYTE), "DATE_OF_BIRTH" VARCHAR2(10 BYTE), "ID" NUMBER, : : "CONFIRMATION_NUMBER" VARCHAR2(30 BYTE) NOT NULL ENABLE, "IS_FBO" NUMBER(1,0), : : CONSTRAINT "VR_APPS_UNPROCESSED_PK" PRIMARY KEY ("CONFIRMATION_NUMBER") Table B CREATE TABLE "APPS_PROCESSED" ( "LAST_NAME" VARCHAR2(30 BYTE), "FIRST_NAME" VARCHAR2(30 BYTE), "MIDDLE_NAME" VARCHAR2(30 BYTE), "NAME_SUFFIX" VARCHAR2(30 BYTE), "GENDER" NUMBER(1,0), "DATE_OF_BIRTH" DATE, : : "CONFIRMATION_NUMBER" VARCHAR2(30 BYTE), "ID" NUMBER, "IS_FBO" NUMBER(1,0), : : "ID" NUMBER NOT NULL ENABLE, : : CONSTRAINT "VR_APPLICATION_PK" PRIMARY KEY ("ID") Procedure procedure getUnprocessedApps(results OUT sys_refcursor) as BEGIN open results for select a.last_name ,a.first_name ,a.middle_name ,a.name_suffix ,decode(a.gender, 'M', 1, 0) as gender_id ,a.gender as gender_code ,to_char(to_date(a.date_of_birth, 'MM-DD-YYYY'), 'DD-mon-YYYY') as date_of_birth ,cast(a.confirmation_number as varchar2(30)) as confirmation_number ,a.id ,0 as is_fbo : : from vr_apps_unprocessed a fetching the data DataSet data = new DataSet(); OracleConnection conn = null; OracleCommand cmd = null; OracleDataAdapter data_adapter = new OracleDataAdapter(); //fetch the data and load using (conn = new OracleConnection(connString)) { using (cmd = new OracleCommand()) { cmd.Connection = conn; cmd.CommandText = "APPS.getUnprocessedApps"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("results", OracleDbType.RefCursor, ParameterDirection.Output); conn.Open(); data_adapter.SelectCommand = cmd; data_adapter.Fill(data, "results"); } } return data.Tables["results"]; setup the column mapping private static Dictionary<string, string> ColumnMappings() { Dictionary<string, string> mapping = new Dictionary<string, string>(); mapping.Add("last_name", "last_name"); mapping.Add("first_name", "first_name"); mapping.Add("middle_name", "middle_name"); mapping.Add("name_suffix", "name_suffix"); mapping.Add("gender_id", "gender"); mapping.Add("date_of_birth", "date_of_birth"); mapping.Add("is_fbo", "is_fbo"); mapping.Add("confirmation_number", "confirmation_number"); mapping.Add("id", "id"); : : return mapping; } Load files private static void loadFiles(DataTable dt, string connString) { OracleConnection orclconn = null; OracleBulkCopy loader = null; //now insert the data into Oracle using (orclconn = new OracleConnection(connString)) { orclconn.Open(); using (loader = new OracleBulkCopy(orclconn)) { loader.DestinationTableName = "APPS_Processed" foreach (KeyValuePair<string, string> k in ColumnMappings()) { loader.ColumnMappings.Add(k.Key, k.Value); } loader.WriteToServer(dt); } //end using oracle bulk loader } //end using oracle connection } EDIT: I have been unable to get the bulkcopy to work, but I have gotten the traditional method of using arrays to work: http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59odpnet-085168.html It is definitely slower than a successful bulk load, but at least I can get the data in. I'd still love if anyone has any ideas on why the bulkcopy itself keeps failing, though.
It seems that BulkCopy does some sort of type conversion based on the declared types of the columns in the DataTable that it is given. If you print the Column.DataType.ToString() for the columns that are causing issues, there is a good chance that you will see a type other than the one which the database is expecting. You can create a new data table from the using old one but explicitly change Column.DataType of the troubling columns to be of the type that the database expects. public DataTable potentialFix(DataTable dt) { DataTable newTable = new DataTable(dt.TableName); //define columns for the new table with type string (or whatever type you want) foreach (DataColumn dc in dt.Columns) { newTable.Columns.Add(new DataColumn(dc.ColumnName, typeof(String))); } newTable.BeginLoadData(); DataTableReader dtReader = new DataTableReader(dt); newTable.Load(dtReader); newTable.EndLoadData(); return newTable; }
0.666667
BulkCopy does type conversion based on the declared types of the columns in the DataTable that it is given
Is pretending to want to trade before playing a monopoly card objectionable?
In Settlers of Catan, I sometimes try to ask people if they want to trade a certain resource, tricking them into revealing the approximate amount of that resource in everyone's hand. After this I play the monopoly card. This has on some occasions not been received very well. Is this fair play?
If you are simply trying to determine which resource is the most abundant, can't you just count the remaining resource cards? Isn't that public knowledge? If so, that would make this tactic unnecessary.
0.888889
Can't you just count the remaining resource cards?
Why choose an 80-200mm over an 18-200mm lens?
Being a beginner, I can't see why I must choose an 80-200 over an 18-200. Are there scenarios where an 80-200 would be preferable over an 18-200? I will be buying a D7000 soon and am looking at these: AF Zoom-NIKKOR 80-200mm f/2.8D ED AF-S DX NIKKOR 18-200mm f/3.5-5.6G ED VR II but similar considerations would apply to other brands as well.
As a really, really broad generalization, it's easier to make a high-quality zoom lens with a smaller zoom range, rather than a larger one. Although it's really tempting to look for one zoom that'll cover your entire range of shooting (Tamron's 18-270 comes to mind), these lenses tend to be fairly ill-behaved over portions of their range (at least), and suffer from softness and complex distortions that aren't easily fixed in post-processing. The two lenses you indicate are really fairly different; the 80-200 is a fast lens (f/2.8), while the 18-200 is quite a bit slower. You'd be giving up a lot of optical performance to get that extra range, which is why most people end up covering this range with two lenses, more or less.
1
High-quality zoom lens with a smaller zoom range, rather than a larger one
What's a better method, using Large Array vs SQL Joins?
I can't decide on w/c technique to go w/... although I am tempted to go the Array way as it is much more straight forward and easier/cleaner to code... lemme explain in a simple way.. For my messaging app, I have 2 tables Contacts - contains name, and phone number (currently 5,000+ records) Messages - messages and the phone number, but not the name of the member I need to list 1000 Messages, w/ the corresponding phone number and name if possible... eg. "Hi dude" - from 565-1111 (John) "Bring Cheese" - from 565-2222 (Bieber) "Hehehe " - from 565-2332 "iron man is cool!" - from 565-7748 (Arnie) etc... I would normally join contacts to messages via the phone number... pretty standard stuff... (but in reality my queries are a bit more complex than a simple left join) Now, i've been playing around w/ the idea of fetching all contacts and putting it into an array where my app/system could use it in a much easier , more straight forward and cleaner code... where: query SELECT * contacts and store them into an array: contacts['555-7748'] = "John"; contacts['555-1111'] = "Joe"; contacts['555-2233'] = "Borat"; contacts['555-4234'] = "Arnie"; etc this way i can easily lookup the NAME of the Contact via accessing the array, many times in my page/script, just by simply doing: $name = contacts[$phoneNumber]; I have actually implemented this and it's really cool .. no more join headaches and re-querying contacts table etc.. now the question is.. is this OK? Practical? or could i be hitting some memory cap or something here? it's basically running JOIN query on EACH message my script outputs or store ALL THE CONTACTS/RECORDS into array (memory) and refer to that instead, making queries are more simple.. my only worry is, querying thousands of records into an array, may be a bit too much? or is this really OK/practical? specially since there are times when my script needs to fetch specific contacts more than once... To add, I was also thinking of storing that array into a Session variable! lolz.. so my scripts can simply share this data.. lol looking forward to some good inputs Thanks guys. ---- UPDATE as of 03-31-2013 (Sunday) ---- Ok... I'm thinking about a totally different approach now.. 1) SINCE all this is really me needing to show the "CONTACT NAME" for each message for neat/presentation purposes (better to see the name of the contact on a message rather than phone number yeh?) .... 2) and since each message will need to show 2 contact names (receiver and sender) based on their phone numbers on the MESSAGES table..... 3) I now am thinking of ADDING 2 fields into the MESSAGES table instead... "sender_name" and "receiver_name" .. I have seen Bulletin board / Forum software use this technique a lot .. 4) when system receives a message , it checks for existing Contacts entry of the numbers associated w/ the message...and if it exists, get the respective names and include it into storage/insert 5) ..problem is if during the message was received, contact info isnt available, so no NAMES are saved.. and later CONTACT info is then created... the OLD messages wont show the contact names as intended... 6) 3 way solution... 1st, evertime a new contact is added/changed my php will make updates to all messages w/ the matching numbers... 2nd, from time to time perhaps once / month, run a "synchronize routine" to make sure things are in sync.. or, when a user Actually OPENS a message, mandatory routine will run to check if contact name of that particular message is still in sync w/ the contacts table information... and make updates as necessary.. hmmm... better approach you thing? this way, i just need to issue straight forward SELECT queries , simple, fast.. but am able to display the names.. then again, i still kinda find that QUICK array reference thing so cool though.. lolz indecisive
Do you have access to the DB? If so, I'd suggest creating a view so that your queries from PHP are more simple. Maybe that will simplify things for you. I'd still suggest using queries instead of simply large arrays. That being said, if you know the load you are going to place on these and the array works fine there shouldn't be any reason to avoid it. Best practices are good, but there is something to be said for ease of coding which breeds better maintenance.
1
Do you have access to the DB?
How to restore function attributes to default
Adding an attribute to a function is easy and clearing attribute is easy also. But I don't know really how to restore the attributes of a function to its defaults. All I do is quit the kernel or close Mathematica and open again. any idea? Update For example : Log // Attributes (* {Listable, NumericFunction, Protected} *) ClearAttributes[Log, Listable] Log // Attributes (* {NumericFunction, Protected} *) Now is there any way to restore the attributes of Log to its defaults other than SetAttributes or quitting Mathematica? Thanks.
Save defaults before any changes attrLog = Log // Attributes; ClearAttributes[Log, Listable] Log // Attributes {NumericFunction, Protected} Restore defaults Attributes[Log] = attrLog {Listable, NumericFunction, Protected}
1
Save defaults before any changes attrLog = Log // Attributes
Can you use Python to search a csv for a value?
My objective is to search a small csv file (one column, a few hundred rows) for a value. The rows in the csv are all numbers. Here is my attempt: import csv #read csv file csv_reader = csv.reader(open('test.csv', 'rU')) length_list = len(list(csv_reader)) value = [] for line in csv_reader: value.append(line) #transfer contents of csv to list def find_voucher(input_voucher, counter): while counter < length_list: check_voucher = input_voucher in value[counter] if check_voucher == True: print "TRUE" else: print "FALSE" counter = counter + 1 find_voucher(1000,1) When I run the script I get this error: check_voucher = input_voucher in value[counter] IndexError: list index out of range
csv.reader is an iterator -- after you go through it once, it's empty, unlike a list. You use it up when you do length_list = len(list(csv_reader)) There are a number of ways you could simplify your program, but if you just do length_list = len(value) after the for loop instead of trying to find the length first, it should work. An example of how you could simplify your program: def find_voucher(input_voucher, filename): with open(filename, 'rU') as f: return ("%s\n" % input_voucher) in f print find_voucher(1000, 'test.csv')
0.888889
How to simplify csv.reader?
Driving 3 LEDs at 1000mA. Is this circuit / driver ok?
I want to drive 3 LEDs in Series at constant current of approx 900mA - 1000mA. Will this circuit work? The LEDs are Vf 3.55V @ 1000mA. LED Diagram R1 = 0.25W 100k Ohm Resistor R2 = 2W 0.47 Ohm Resistor Z1 = 4.7V 1.3W 5% Zener Diode Q1 = Fairchild KSP13 Darlington NPN 30V 500mA 625mW transistor - Datasheet: https://www.fairchildsemi.com/ds/KS/KSP13.pdf Q2 = Vishay IRF830PBF Power Mosfet 500V 4.5A 75W - Datasheet: http://www.vishay.com/docs/91063/91063.pdf
You don't need the zener diode because Q1 will limit the gate drive if too much current is about to be drawn. I think this circuit is intended for a 12V dc supply This looks like it should run from a 12V dc supply just fine. With 1A flowing through the 0.47 ohm source resistor this should just about start to turn on the BJT transistor which will hold the gate voltage at the right amount to maintain the 1A thru the LEDs. Overall volt drop across the MOSFET will be about 0.9V (from a 12V dc supply) so it'll dissipate about 1W in heat - maybe consider a small heatsink. If the dc supply is more like 15V dc then the MOSFET will get considerably warmer and maybe you should consider using a buck type constant current regulator. EDIT - check also the maximum current that the LEDs can take - you might be running them too close if the max current is only a bit above 1 A. If this is the case, increase the 0.47 ohm resistor to maybe 0.68 ohm. A little bit of careful testing might be needed.
0.666667
Q1 will limit the gate drive if too much current is about to be drawn
Carving elements from XML (xmlstarlet,awk,perl..)
I'm trying to carve out sections from hundreds of XML files. The structure of the XML docs is similar to: <document> <nodes> <node id=123>pages of txt</node> <node id-=124>more example pages of txt and sub elements</node> </nodes></document> I'm just trying to extract all <node> elements. I have been trying to use xmlstarlet: xmlstarlet sel -t -c “/document/nodes” The problem is that it only returns </nodes>. I just need to extract the following examples: <node id=123>pages of txt</node> <node id-=124>more example pages of txt and sub elements</node> Can anyone recommend a better option, tool or approach? Many thanks.
You just have your xpath wrong: xmlstarlet sel -t -c '//node' Also, valid XML required all attribute values to be quoted <document> <nodes> <node id="123">pages of txt</node> <node id="124">more example pages of txt and sub elements</node> </nodes></document> I've found this page gives lots of useful xpath examples: http://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx
0.888889
Valid XML required all attribute values to be quoted <document>
Adding existing user to existing group and providing permissions
can someone shed some light on this issue I've set up and installed vsftpd. Created a user ftp-user and created a home directory, so they can log in, and just have access to drop their files here. >> sudo useradd -d /home/ftp/ftp-user -m ftp-user This works fine, user successfully logs in over ftp, uploads a file. I now need to be able to access this ftp-user directory as another user say for example ubuntu. There is a script that runs as ubuntu, and I need to be able to access the directory to be able to grab the files and copy them across to other locations. I tried to add ubuntu to the ftp-user group: sudo usermod -a -G ftp-user ubuntu Although, when trying: >> whoami ubuntu >> cd ftp-user/ >> -bash: cd ftp-user/: Permission denied Hope someone has an idea - Cheers in advance!
New groups are only picked up when the user logs in. Log the ubuntu user out then in again.
0.888889
Log the ubuntu user out then in again
How to change all the blue colors of RWD theme to another color?
How to change all the blue colors of RWD theme to another color?Actually this question may be duplicate but please help me none of the methods worked for me in Google or in MSE.
To do it properly, you should have compass & sass installed, navigate to the sass folder with your terminal (skin/frontend/rwd/default/scss), run compass watch . and then edit _var.scss and change the value for the $c-blue variable. Upon save, compass will regenerate the complete css files.
1
compass & sass will regenerate complete css files .
US Tax exemption for Independent student contractor working from India
I am an undergraduate computer science student, resident and citizen of India, I'll be working as an Independent student contractor for a US based software company from my home country (India), during this program I will never go to US and all my payments are a student stipend. I am in no way a company employee and won't enjoy any benefits of a regular employee, moreover my income is project based there is no fixed based salary. The company asks me to fill W-8BEN form for tax withholding, but I am not sure if I should pay tax to Indian Govt or to the US state. My questions are mainly: Who should I pay tax to India/US state ? Am I eligible for tax exemption from US because of US India tax treaty ? ref: http://www.irs.gov/pub/irs-trty/india.pdf Article 15 (Independent Personal Services) Do I need to fill any formal tax forms ? If yes which one W-8BEN or 8233(asking for tax exemption) ? What reason should I specify for tax exemption , being an Independent contractor not living in US, or being a student ? I'll be really thankful if someone can please help me regarding this. Thanks in advance !
Who should I pay tax to India/US state ? India. Am I eligible for tax exemption from US because of US India tax treaty ? No, because there's nothing to exempt. Do I need to fill any formal tax forms ? If yes which one W-8BEN or 8233(asking for tax exemption) ? You need to fill W8-BEN showing that you're not a US person for tax purposes. What reason should I specify for tax exemption , being an Independent contractor not living in US, or being a student ? Moot since you're not liable for any taxes in the US based on the information you've provided.
1
Who should I pay tax to India/US state ?
Maximal ideal in $\mathbb{Q}[x,y]$
I am trying to prove that $(x,y)$ is a maximal ideal of $\mathbb{Q}[x,y]$. Since an ideal $I \subseteq R$ is maximal if and only if $R/I$ is a field, it suffices to prove that $\mathbb{Q}[x,y]/(x,y)$ is a field. Let $\phi : \mathbb{Q}[x,y] \rightarrow \mathbb{Q}$ be the evaluation homomorphism that sends $p(x,y)$ to $p(0,0)$. $\phi$ is clearly surjective and if I prove that the kernel of $\phi$ is the ideal $(x,y)$, the result will follow by the First Isomorphism Theorem. $(x,y) \subseteq Ker(\phi)$ is obvious, but to prove the reverse inclusion, my idea is to take a polynomial $p(x,y) \in Ker(\phi)$ and to perform Euclidean division of $p(x,y)$ with $y$ and $x$ in $(\mathbb{Q}[x])[y]$ and $(\mathbb{Q}[y])[x]$ respectively. The problem is that neither of them is a polynomial ring over field. There is a theorem saying that if R is commutative and if $R[x]$ is a PID, then $R$ is a field. Since neither $\mathbb{Q}[x]$, nor $\mathbb{Q}[y]$ are fields, it follows that neither $(\mathbb{Q}[x])[y]$, nor $(\mathbb{Q}[y])[x]$ are PIDs, hence are not Euclidean domains. Obviously, Euclidean division does not solve the problem. If we consider $p(x,y)$ as an element in $(\mathbb{Q}[x])[y]$ and if we divide by $y$, then we get a quotient $q(x,y)$ and a remainder which is $0$ or of degree $0$ over $(\mathbb{Q}[x])[y]$, hence a polynomial $r(x)$ in $x$ only. Then, $p(x,y) = yq(x,y) + r(x)$ and the hypothesis $p(0,0)=0$ does not guarantee that $r(x)=0$. So, we cannot conclude that $y$ divides $p(x,y)$. Is there a way to remedy this proof, or is there another approach to this problem?
$\varphi(p)=0\iff p(0,0)=0\iff a_{0,0}=0$, where $a_{0,0}$ is the contant coefficient of $p$. So both inclusions should be easy.
0.777778
varphi(p)=0iff a_0,0=0$
Relationship between user story, feature, and epic?
As someone whose still new to agile, I'm not sure I completely understand the relationship or difference between a user story, feature, and epic. According to this question, a feature is a collection of stories. One of the answers suggest that a feature is actually an epic. So are features and epics considered the same thing, which is basically a collection of related user stories? Our project manager insists that there's a hierarchical structure: Epic -> Features -> User stories ... basically all user stories must fall within this structure. Therefore all user stories must fall under an umbrella feature and all features must fall under an epic. To me, that sounds awkward. Can someone please clarify how user stories, features, and epics are related? Or is there an article that clearly outlines the differences?
Epic: A very large user story that is eventually broken down into smaller stories. User story: A very high-level definition of a requirement, containing just enough information so that the developers can produce a reasonable estimate of the effort to implement it. http://www.telerik.com/agile-project-management-tools/agile-resources/vocabulary.aspx Feature: A distinguishing characteristic or capability of a software application or library (e.g., performance, portability, or functionality). http://en.wikipedia.org/wiki/Software_feature
1
Feature: A distinguishing characteristic of a software application or library
custom email unable to send magento
I get the following error: "exception 'exception' with message 'this letter cannot be sent.' magento" , in magento php. below is the code i have used. Observer.php <?php class Metro_Purchaseorder_Model_Observer extends Mage_Core_Model_Abstract { public function shipmentEmail($observer) { $event = $observer->getEvent(); if(!$order = $event->getOrder()) { $order_Id = Mage::getSingleton('checkout/type_onepage')->getCheckout() ->getLastOrderId(); $order = Mage::getModel('sales/order')->load($order_Id); $customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); } $payment = $order->getPayment()->getMethod(); $storeId = $order->getStoreId(); $emailTemplate = Mage::getModel('core/email_template')->loadDefault('custom_email_po_template'); $emailTemplateVariables = array(); $emailTemplateVariables['myvar1'] = 'Branko'; $emailTemplateVariables['myvar2'] = 'Ajzele'; $emailTemplateVariables['myvar3'] = 'ActiveCodeline'; $emailTemplateVariables['storeid'] = $storeId; $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables); /* $emailTemplate->setSenderName('MetroCC'); $emailTemplate->setSenderEmail('[email protected]'); $emailTemplate->setTemplateSubject($this->__('PO Test mail')); */ //send mail $emailTemplate->send('[email protected]', 'sachin', $emailTemplateVariables); return true; } } in Config.xml ------------------------------ <?xml version="1.0"?> <config> <modules> <Metro_Purchaseorder> <version>0.1.0</version> </Metro_Purchaseorder> </modules> <frontend> <events> <checkout_onepage_controller_success_action> <observers> <purchaseorder_observer> <type>singleton</type> <class>Metro_Purchaseorder_Model_Observer</class> <method>shipmentEmail</method> </purchaseorder_observer> </observers> </checkout_onepage_controller_success_action> </events> </frontend> <global> <template> <email> <purchaseorder_custom_email1 translate="label" module="purchaseorder"> <label>Purchaseorder module</label> <file>sales/purchaseorder_custom_email1.html</file> <type>html</type> </purchaseorder_custom_email1> </email> </template> </global> </config> Please help me in correcting the above error for sending custom email template
Sachin,You issue with event parameter.checkout_onepage_controller_success_action give last order ids in a array . You can easy check at class Mage_Checkout_OnepageController at function successAction. Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId))); your observer code is <?php class Metro_Purchaseorder_Model_Observer { public function shipmentEmail(Varien_Event_Observer $observer) { $orderIds = $observer->getEvent()->getOrderIds(); if (empty($orderIds) || !is_array($orderIds)) { return; } foreach($orderIds as $eachOrderId){ $order = Mage::getModel('sales/order')->load($eachOrderId); try { $order = Mage::getModel('sales/order')->load($eachOrderId); $customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); $payment = $order->getPayment()->getMethodInstance()->getCode(); $storeId = $order->getStoreId(); $emailTemplate = Mage::getModel('core/email_template')->loadDefault('custom_email_po_template'); $emailTemplateVariables = array(); $emailTemplateVariables['myvar1'] = 'Branko'; $emailTemplateVariables['myvar2'] = 'Ajzele'; $emailTemplateVariables['myvar3'] = 'ActiveCodeline'; $emailTemplateVariables['storeid'] = $storeId; $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables); /* $emailTemplate->setSenderName('MetroCC'); $emailTemplate->setSenderEmail('[email protected]'); $emailTemplate->setTemplateSubject($this->__('PO Test mail')); */ //send mail $emailTemplate->send('[email protected]', 'sachin', $emailTemplateVariables); return true; }catch (Mage_Core_Exception $e) { } break; } return $this; } }
1
Checkout_onepage_controller_success_action
When should a supervisor be a co-author?
What are people's views on this? To be specific: suppose a PhD student has produced a piece of original mathematical research. Suppose that student's supervisor suggested the problem, and gave a few helpful comments, but otherwise did not contribute to the work. Should that supervisor still be named as a co-author, or would an acknowledgment suffice? I am interested in two aspects of this. Firstly the moral/etiquette aspect: do you consider it bad form for a student not to name their supervisor? Or does it depend on that supervisor's input? And secondly, the practical, career-advancing aspect: which is better, for a student to have a well-known name on his or her paper (and hence more chance of it being noticed/published), or to have a sole-authored piece of work under their belt to hopefully increase their chances of being offered a good post-doc position? [To clarify: original question asked by MrB ]
well, that depends :) For my own students I usually do not insist on being a coauthor. However, in most cases it just happens that one works together on a project which, by accident, is the thesis of one of the persons. In my experience, I had students who worked very much on their own and then they published their stuff alone. Perfectly fair to me. On the other hand, I had students which did not just ask some questions but we really worked together as I would do it with a collegue. So in this case, there was no question that we all are on the paper, sometimes even with a third person. In these cases, the student gets already some flavour of (partially international) collaborations which I believe to be worthy. For a diploma student (that is a sort of master thing in Germany...) I'm happy if there is a good enough outcome leading to a little paper. Usually, these students are quite happy if they don't have to do it all by themselves. For PhD students, I have the "rule" that there is a big global project for the thesis which is worked on, essentially in a collaboration. But I strongly encourage the students to tell me that there is some aspect, where s/he wants to work more alone and publish also alone. In fact, for a student aiming at a very good mark in the thesis, I almost expect that s/he has a paper published alone before the thesis is finished. So, as I said, it depends very much on the situation. I think both ways have advantages and disadvantages. Important to me is that all involved persons feel good about the policy and that things are said in the beginning. Supervising students is always a matter of trust, and this aspect is certainly one of the most delicate ones...
1
Is there a big global project for the thesis of one person?
How does postgrey handle changing FQDNs?
Let's say I receive emails from the following clients: mail2.dx300.mail.net mail4.dx121.mail.net mail5.dx121.mail.net Even though these are all from the same service (e.g. LinkedIn or MailChimp), postgrey sees them as entirely different clients. How can I configure postgrey to just look at the domain (mail.net), not the FQDN?
The reason Postgrey sees them as different clients is simply because they are. Each is a Different server with a unique ip-address and hostname. Unless you add them to a whitelist first they each have to prove they behave like a proper smtp daemon. But if they all are trusted clients you do not have to individually add them to the whitelist, you have the following options: # Whitelist the whole domain example.com mail.net # Use Regular Expressions /^mail[0-9].dx[0-9]{3}.mail.net$/ # Use CIDR IP Addresses: 10.9.8.0/24
0.888889
Postgrey sees different clients as different .
glsl demo suggestions?
In a lot of places I interviewed recently, I have been asked many a times if I have worked with shaders. Even though, I have read and understand the pipeline, the answer to that question has been no. Recently, one of the places asked me if I can send them a sample of 'something' that is "visually polished". So, I decided to take the plunge and wrote some simple shader in GLSL(with opengl).I now have a basic setup where I can use vbos with glsl shaders. I have a very short window left to send something to them and I was wondering if someone with experience, could suggest an idea that is interesting enough to grab someone's attention. Thanks
Everybody saw phong implemented. So how about: water - there are tons of tutorials and it looks always great shadow mapping - absolute basic in game dev. Multipass rendering is good thing to show. You can improve it with some kind of soft shadows (i highly recommend PCSS - easy effective or Variance Shadow Maps) bumpmapping parallax mapping - looks cool, and pretty easy if you got bump mapping done. geometry shaders (if you do hairs/fur over the polygon - could be based on lines or billboards - they will love you :)) - whitepaper from nvidia mirrors post process - cartoon shader, old camera shader
0.888889
Multipass rendering is good thing to show.
Thunderbird 2.0: Inbox size is 4GB on disk: how do I reduce it?
Mozilla Thunderbird 2.0: I have set Thunderbird never to delete a message that is on disk...Thus, after four short years, I have a 4GB Inbox file. Thunderbird needs about 10 minutes to read it, and even then I can't compact it. Anyone have some suggestions?
When you say you can't compact the file, what are you actually doing? By this, I mean that "compacting" in Thunderbird is not like running your inbox through a compression algorithm like you would to create a .zip file. The "compact" option in Thunderbird is there because deleting a message does not remove the message from your disk, it is just hidden - therefore, you use "compact" to remove these "deleted" messages from the data file. You will need to clean out your mailbox by saving and deleting messages that are no longer needed and then running the "compact" option.
0.888889
"compacting" in Thunderbird is not like running inbox through compression algorithm .