summary
stringlengths
15
147
text
stringlengths
1
19.3k
answer
stringlengths
32
22.6k
labels
float64
0.33
1
answer_summary
stringlengths
5
164
How do I join two cables outside so that they're safe and kept dry?
I have a new pond with a pump but the cable on the pump is far too short. I have some similar cable which will do the job to extend the length. My only concern is the junction outside. I need to make it dry and safe. What recommendations do people have? Can you buy a junction box that is suitable for outside use? If this helps I live in the UK.
I cannot speak to the UK. In the US the answer is yes, and the principles should be pretty much the same. I'll give you the parts I would use; in the US I would be able to find them at any home improvement store. You will want to buy a small single-gang metal junction box that is exterior-rated. You will need a green screw for the inside of this box; the box itself will need to be grounded and above grade. (It can't be buried, in other words. Most people stick them on poles if it HAS to be in the middle of the yard, or just attach them to the house.) The second thing you will want is a fitting that screws into the sockets on the exterior-rated junction box. This fitting will have three parts. The first is the part that screws into it from the inside. The second is a rubber part with a hole in the shape of Romex, which is the standard jacketed cable that we use in the US. The third part is a nut that screws over that and compresses the rubber part between the two metal parts in order to form a watertight seal. After that, you'd do the normal thing -- wire nut the hot and neutral connectors together, and wire the grounds together while also wrapping one leg of the ground around the green grounding screw.
1
a single-gang metal junction box that is exterior-rated
jQueryUI Spinner widget with knockout
How can I use a jQuery UI Spinner widget in Knockout bound input? <tbody data-bind="foreach: orders"> <tr> <td data-bind="text: Name"></td> <td><input type="number" style="width: 100px;" data-bind="value: Price" /></td> <td><input type="number" style="width: 50px;" data-bind="value: VAT" /></td> <td><input type="number" style="width: 50px;" data-bind="value: Number" /></td> <td data-bind="text: Final()"></td> <td><a href="javascript:void(0);" data-bind="click: $root.removeOrder">Remove</a></td> </tr> </tbody>
The best way is to create custom binding to bind spinner to the input: ko.bindingHandlers.spinner = { init: function(element, valueAccessor, allBindingsAccessor) { //initialize datepicker with some optional options var options = allBindingsAccessor().spinnerOptions || {}; $(element).spinner(options); //handle the field changing ko.utils.registerEventHandler(element, "spinchange", function () { var observable = valueAccessor(); observable($(element).spinner("value")); }); //handle disposal (if KO removes by the template binding) ko.utils.domNodeDisposal.addDisposeCallback(element, function() { $(element).spinner("destroy"); }); }, update: function(element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()), current = $(element).spinner("value"); if (value !== current) { $(element).spinner("value", value); } } }; And then just use it instead of value binding: <input type="number" style="width: 100px;" data-bind="spinner: Price, spinnerOptions: { min: 0 } " /> Here is working fiddle: http://jsfiddle.net/vyshniakov/SwKGb/
0.666667
Custom binding to bind spinner to input
Why does the C++ standard algorithm "count" return a ptrdiff_t instead of size_t?
Why is the return type of std::count a ptrdiff_t? Since count can never be negative, isn't size_t technically the right choice? And what if the count exceeds the range of ptrdiff_t since the theoretical possible size of an array can be size_t? EDIT: So far there is no suitable answer as to why the function returns ptrdiff_t. Some explanation gathered from the answers below is that the return type is iterator_traits<InputIterator>::difference_type which is generic and can be anything. Up until that point it makes sense. There are cases where the count may exceed size_t. However, it still does not make sense why the return type is typedef ptrdiff_t iterator_traits<InputIterator>::difference_type for the standard iterators instead of typedef size_t iterator_traits<InputIterator>::difference_type.
Originally std::count was: template <class InputIterator, class EqualityComparable, class Size> void count(InputIterator first, InputIterator last, const EqualityComparable& value, Size& n); In that function Size is a template parameter. It can be whatever you like, and it's your responsibility to make sure it's correct. It could be the longest type on your platform. My suspicion is that when the newer form: template <class InputIterator, class EqualityComparable> iterator_traits<InputIterator>::difference_type count(InputIterator first, InputIterator last, const EqualityComparable& value); was added iterator_traits was already in existence, so re-using the existing type had the advantage that it kept the changes to the standard small and localised, compared to adding another typedef in iterator_traits. Doing it this way, using iterator_traits as opposed to simply using std::size_type means that every possible iterator gets the option to specify exactly what type should be returned by std::count. This includes custom iterators which read from a network, or disk, which can use something much larger than either ptrdiff_t or size_type and friends. (It could be some kind of "BigInt" if needed). It also means that the user isn't responsible for deducing the appropriate type to use though, which can be tricky, precisely because of the custom iterator possibility.
0.777778
Template <class InputIterator, class EqualityComparable, class Size&gt void count
How did Adam and Eve win at Hide and Seek?
I began reading the KJV a couple months ago, and one question that keeps plaguing my mind is, "How did Adam and Eve successfully hide from God?" Genesis Chapter 3: 8 And they heard the voice of the LORD God walking in the garden in the cool of the day: and Adam and his wife hid themselves from the presence of the LORD God amongst the trees of the garden. 9 And the LORD God called unto Adam, and said unto him, Where [art] thou? 10 And he said, I heard thy voice in the garden, and I was afraid, because I [was] naked; and I hid myself.
I like the Pulpit Commentary on this. It says that God called Adam because God wanted to bring him to confession. Adam's absence was a clear proof that something was wrong. Hitherto he had always welcomed the Divine approach. "And said unto him, Where art thou?" Not as if ignorant of Adam's hiding-place, but to bring him to confession. You can't play a hide-and-seek game with God (Hebrews 4:13) because He is omnipresent(Psalm 139:8). God demanded confession from Adam. God also wanted to continue the fellowship even though Adam tried to avoid Him. God was seeking Adam because God still loved him despite his disobedience . God wanted to help Adam and Eve on how to cover their nakedness. Not yet skilled or aware of how to make garments, they tried to cover themselves in vain. God helped them by providing garments of animal skin. Where art thou? God is always calling us to repent and come to Him. It is our responsibility to response to His call and confess all our sins. Revelation 3:20 (NKJV) Behold, I stand at the door and knock. If anyone hears My voice and opens the door, I will come in to him and dine with him, and he with Me.
1
God called Adam because God wanted to bring him to confession
Illegal assignment from LIST to SET
I am trying to query records and collect them in a Set as below Set<abc__c> a = [select id from abc__c limit 2]; but getting the following error Illegal assignment from LIST to SET.Can't I collect the result of a query in Set ?
There is simple way: Set<Account> acc = new Set<Account>([SELECT id from Account]); You cannot type cast a List<sObjectType> to Set<sObjectType> just by query assignment, pass it to Set constructor instead.
1
Type cast a List<sObjectType> to Setlt'sObject Type&gT;
Finding out which version PHP a remote server is running
I can't imagine this is possible but maybe there's some novel way. I'm developing an app which will require a few php files to be deployed and run on the clients' webservers. I'm not particularly interested in targeting clients who are still running pre version 5 versions of PHP. So is there any way one can tell which version of PHP a remote webserver has running?
You can use a site to view http headers such as http://web-sniffer.net/ Some sites will return the PHP version in the server section of the header for example here's a response from a site I just tested: Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.12 This is more likely to work on sites hosted on a standard shared hosting platform such as cPanel.
0.444444
PHP/5.2.12 is more likely to work on sites hosted on a standard shared hosting platform
Expectation values of $(x,y,z)$ in the $|n\ell m\rangle$ state of hydrogen?
Expectation values of $(x,y,z)$ in the $| n\ell m\rangle$ state of hydrogen? Does anyone know of a quick way of finding this (if there is even one)? Can I somehow use the relation that: $$\langle r\rangle ~=~ \frac{a_0}{2}(3n^2 - \ell(\ell+1)),$$ or do I just have to brute force and use properties of Laguerre polynomials and spherical harmonics and what not?
You're confusing the expectation values of the vector $\mathbf{r}=(x,y,z)$ and its magnitude $r=\sqrt{x^2+y^2+z^2}$. Because the hydrogen hamiltonian is parity invariant, all its eigenfunctions are chosen to have a definite parity. This means that the expectation value $\langle\mathbf{r}\rangle$ will always be zero because each component is the integral of an odd function times an even probability distribution function. The second expectation value you mention, $$\langle n,l,m|r|n,l,m\rangle=\int \mathrm{d}x \mathrm{d}y \mathrm{d}z \psi_{n,l,m}^\ast(x,y,z)\sqrt{x^2+y^2+z^2}\psi_{n,l,m}(x,y,z),$$ is quite different, since you're not counting the direction of the distances you add. This is the same as comparing the averages of $x$ and $|x|$ over some 1D probability distribution function $p(x)$. The average of $x$ will be zero if $p(x)$ is even, while the average of $|x|$ will only vanish is $p$ is a delta function, concentrated at the origin. Thus $\langle|x|\rangle$ can be quite large while $\langle x\rangle$ is zero because of cancellations. This is not to say that expectation values of $\mathbf{r}$ are not interesting, but one must simply be more careful. The fact that the diagonal matrix elements vanish says that the eigenstates have no permanent dipole moment - which of course they can't as they are eigenstates of an isotropic system. What doesn't vanish, however, are the transition matrix elements, $$\langle n',l',m'|\mathbf{r}|n,l,m\rangle,$$ which play an important role in the hydrogen atom's interaction with radiation. (Specifically, they control the leading-order interaction energy, which is the dipole coupling $-q\mathbf{r}\cdot\mathbf{E}$.) Because the components of $\mathbf{r}$ are themselves spherical harmonics of degree 1 (or linear combinations of them), the matrix element above will involve the spherical integral $$\int\mathrm{d}\Omega \, Y_{l'm'}^\ast Y_{1,\mu} Y_{lm}$$ for $\mu=-1,0,1$. Because the spherical harmonics have a rich orthogonality structure, only a few of these integrals will survive. Specifically, you need $\Delta l=|l-l'|=1$ and $m'=m+\mu$, which has the physical content of the dipole selection rules: for a dipole coupling to radiation, only S-P, P-D, D-F, ... transitions are allowed. Further, only a few spatial orientations are allowed: $m$ can increase or decrease by one (which happens if $|\mu|=1$, and corresponds to circularly polarized light in either direction, with the electric field rotating in the $x,y$ plane) or stay the same (when $m=0$ and the light is linearly polarized along $z$).
1
eigenstates of hydrogen hamiltonian are definite parity invariant
Find volume of cask
I was given the following question: A wine cask has a radius at the top of $30 cm$ and a radius at the middle of $40 cm$. The height of the cask is $1m$. What is the volume of the cask in litres, assuming the shape of the side is parabolic? I have to come to parabolic function of $$y = \frac{-1}{250}(x-50)^2+40$$ The derivative of $y$ is: $$\frac{dy}{dx} = \frac{2}{5} - \frac{x}{125}$$ Then I integrate and end up with an expression the length of $\pi$. Am I on the right track?
All lengths should be in the same units, say metres. Let the radius $r$ of the cask, at height $h$ above the ground have equation $r=ah^2+bh+c$. When $h=0$ we want $r=\frac{3}{10}$. When $h=\frac{1}{2}$ we want $r=\frac{4}{10}$. When $h=1$ we want $r=\frac{3}{10}$. Putting these into $r=ah^2+bh+c$ and solving the three simultaneous equations in $a,b,c$ gives $$r = \frac{3}{10}+\frac{2}{5}h-\frac{2}{5}h^2$$ Using the formula for the volume of revolution, we get $$V = \pi \int_0^1 \left(\frac{3}{10}+\frac{2}{5}h-\frac{2}{5}h^2\right)^{\!2} \mathrm{d}h = ~???~\mathrm{m}^3$$
0.888889
Using the formula for the volume of revolution, we get $$V = pi int_01
Add an admin page, but don't show it on the admin menu
I have a custom plugin 'Charts' that has it's own menu. In that menu are links to the 3 pages for the plugin - 'Charts', 'Add Chart' and 'Edit Chart'. However, I don't want to display the link to 'Edit Chart'. Here is how I add the page in question - $this->pagehook = add_submenu_page('charts', __('Edit Chart'), __('Edit Chart'), 'edit_charts', 'edit-chart', array(&$this, 'on_show_page')); I've scoured the internet, and cannot find a way to do this (that works). It's possible to remove whole top level menus (not what I need), and you can remove individual entries from the $submenu global (but doing that also removes the registered capability), so no one can access the page - global $submenu; if(!empty($submenu['charts'])) : foreach($submenu['charts'] as $key => $page) : if($page[0] === 'Edit Chart') : /** Removes all permissions to access the page */ //unset($submenu['charts'][$key]); /** Removes the title, but the menu entry still exists, so it looks odd */ $submenu['charts'][$key][0] = ''; endif; endforeach; endif; I've looked in to hiding it via CSS, but can't see a way to do that through the HTML that Wordpress generates - <li><a href="admin.php?page=edit-chart" tabindex="1">Edit Chart</a></li> I've also considered jQuery, but that has similar limitations to the CSS route, plus I refust to believe that I am the only one that has ever wished to do this - there must be a way, I just can't find it! Any hints and tips appriciated. Thanks.
Use a submenu page as parent slug. The admin menu has just two levels, so the imaginary third level will be hidden. Sample code, tested: add_action( 'admin_menu', 'wpse_73622_register_hidden_page' ); function wpse_73622_register_hidden_page() { add_submenu_page( 'options-writing.php', 'Hidden!', 'Hidden!', 'exists', 'wpse_73622', 'wpse_73622_render_hidden_page' ); # /wp-admin/admin.php?page=wpse_73622 } function wpse_73622_render_hidden_page() { echo '<p>hello world</p>'; }
0.888889
Use submenu page as parent slug
What's the meaning of "guest spot" in "We have a guest spot on the Tonight Show"?
I think that "solo spot" has the same meaning, but I don't know the meaning either.
Assuming that your TV show has a fixed or "regular" cast or crew, anyone who is not part of this regular cast or crew is new, or a guest. Guest spot implies that the regular crew members occupy the usual spots , and a guest appearing on the show therefore occupies a guest spot .
1
Guest spot implies that regular crew members occupy the usual spots .
in hibernate4.1.9 buildsessionfactory method is deprecated so why serviceRegistry is paased to buildsessionFactory
in hibernate4.1.9 buildsessionfactory method is deprecated so why serviceRegistry is passed to buildsessionFactory
like this? public class Util { private static SessionFactory sessionFactory; private static ServiceRegistry serviceRegistry; public static SessionFactory configureSessionFactory() { Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new ServiceRegistryBuilder().applySettings( configuration.getProperties()).buildServiceRegistry(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } }
0.888889
Public class Util private static SessionFactory sessionFaktory
Good/functional but can do better
I'm looking for an aphorism communicating the thought that "this works, but we can do better". Some high-falutin language like Shakespeare or Blake would be ideal.
Normally people would just say either of Not bad. Acceptable. Impressive. Nice. OK. Great. However, let me recompose some of Yogi Berra's: Love is the most important thing, but your project/application is pretty good too. Little league projects are great, because it keeps engineers/programmers like you off the main concourse. You don't have to swing hard to hit a home run. Your application could just make it, with the right timing. a'la Edgar Allen Poe: Once upon a midnight dreary, while I pondered weak and weary. Nice app BTW. Words have no power to impress the mind without the exquisite horror of their reality after deployment. Science has not yet taught us if mediocrity is or is not the normality of intelligence. I have great faith in tools like these. My lack of confidence in them, I call it. After all most apps, my friend, are simply evolved out of fraud, fear, greed, imagination, and creativity. a'la Hemmingway: Never mistake an acceptance as excellence. You do not have to like it just because it works. Happiness in intelligent people are the rarest thing I know. You seem pretty happy with your app. No app named horrid, has ever won the Nobel peace prize. We'll deploy it but expect lots of rotten eggs thrown at it. Generic religious: The world was created in six days, so was your app. It's good enough. From the abundance of your heart, your app manifests.
1
a'la Hemmingway: Never mistake acceptance as excellence .
Do we need bleed if the Print output isn't intended to be cut (as is output)
been trying to get a handle on this bleed thing.. and i kinda get it, but for the most part it talks about making sure there are no white-outs at the edges of your printed document after it's been cut out to your size specification. Now I kinda understand this easy, but what I'm wondering is if for example i'm printing on an A4 paper from a desktop printer...and my design is A4 size as well.. I would think that there is no reason/use for bleed ,right? Thanks
In order to print right to the edge of the paper, a desktop printer has to enlarge the image slightly so it's slightly larger than the paper. The documentation and print UI usually call this "borderless" printing, and it's only on printers intended for photographic printing. Office printers, as a rule, aren't designed for it. The reason is that no desktop machine is able to handle paper with enough precision to avoid white edges. The print head actually has to overshoot the paper slightly to ensure complete edge-to-edge coverage. That is why you must use photo paper -- ordinary paper would curl, contacting the print head and causing smearing. This is only relevant if you have color or an image that must go all the way to one or more edges (which is what's meant by "bleed").
1
a desktop printer must enlarge the image so it's slightly larger than the paper .
matlab fft phase response square wave
I am new to phase analysis, recently I have been trying compare the phase between the input signal and output signal of a system. From the code below, I simulated a square wave and plotted the phase, from basic theory, I thought that since this is a simulated signal, I should get near zero values other than the values at each input frequency. So my questions are (based on the following code): 1) Why does Matlab give me pi/2 as phase response of actual input signals, I don't understand the calculation behind it (does it have to do with my signal being sine and not cosine?) 2) If I don't filter out low (near zero) values, the phase response is a sloping line that goes toward very large numbers, and seems to be proportional to the number of samples of FFT I have, is this due to how unwrap works? 3) If I am trying to compare an input signal vs output signal, both of which for the sake of argument looks similar to the square wave I simulated, how do I determine if the system is linear phased? (from theory, the phase delay should be the same therefore, after finding the phase response, should I check if the difference of phase for each input signal between output and input is constant? 4) Also, group delay is considered as the derivative of phase response, and phase delay is the normalization of phase with respect to its corresponding frequency, a perfect square wave should have constant values at each harmonic for group delay and phase delay shouldn't it?, if so can I somehow see this result in my simulation? close all; clear all; fs = 16000; end_time = 6-1/fs; x = 0:1/fs:end_time; x = x'; n=2000; freq = 32; wave = sin(2*pi* freq*x)/(4*pi); for i = 3:2:n wave = wave + sin(i*2*pi*freq*x)/(4*i*pi); end wave = awgn(wave,55,'measured'); wave (1:10000) = 0; NFFT = length(wave); fft_result = fft(wave, NFFT); for i = 1:NFFT if abs(fft_result(i)) < 10^-4 fft_result(i) = 0; end end fft_mag = db(abs(fft_result)); fft_phase = unwrap(angle(fft_result)); fstep = fs/NFFT; f_range = 0:fs/NFFT:fs-1/NFFT; figure plot(f_range, fft_phase); Thank you for being patient enough to read all of this and giving me answers. =)
Re question (1): Most FFTs, or the way atan2() is commonly used with complex FFT results to compute a phase, produce a zero phase (strictly real) output for strictly symmetric input. This means you want cosine waves, periodic in aperture, not sine waves starting at zero at the window edge, for FFT results with zero phase.
0.777778
FFTs with zero phase (strictly real) output
Dialog is partially shown when SoftKeyBoard is shown
I have a custom Dialog as shown below: When I click on the Edit Text, The dialog is shifted upwards but half of the dialog becomes invisible as shown below: I verified the issue on Android ICS and Gingerbread but it doesn't happen on Android Lollipop. I appreciate your help for figuring out why. Here is the custom dialog layout XML: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutChatInGame" android:layout_width="305dp" android:layout_height="190dp" android:background="@drawable/dialog_table_border" android:orientation="vertical" android:visibility="visible"> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/roomlist_title_background"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/progressBar" android:layout_margin="5dp"/> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:layout_margin="5dp"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical"> <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Game is on hold because the host paused the app" android:id="@+id/lblOnHoldDialogMessage" android:textColor="@color/progress_dialog_on_hold_text" android:textSize="18dp" android:singleLine="false" android:layout_gravity="center_horizontal"/> </LinearLayout> </LinearLayout> </LinearLayout> <TextView android:id="@+id/lblChatHistoryGameOnHold" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="bottom" android:maxLines="5" android:scrollbars="vertical" android:textColor="@color/edit_text_general_text" android:textColorHint="@color/edit_text_general_hint" android:paddingRight="2dp" android:paddingLeft="2dp"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/textChatGameOnHold" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="2dp" android:layout_marginStart="2dp" android:layout_weight="1" android:ems="10" android:hint="@string/edit_text_send_chat_message" android:imeOptions="flagNoExtractUi|actionDone" android:inputType="text" android:maxLength="100" android:maxLines="1" android:textColor="@color/edit_text_general_text" android:textColorHint="@color/edit_text_general_hint"/> <Button android:id="@+id/btnSendGameOnHold" style="@style/lightboxButton.Blue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="sendChatMessageInGame" android:text="@string/btn_send"/> </LinearLayout> </LinearLayout>
Try to use also android:imeOptions="flagNoFullscreen" in your .xml. Recommend you to make some tests, using it with and without flagNoExtractUi. Please give me some feedback.
0.888889
Try to use android:imeOptions="flagNoFullscreen" in .xml
Doctors working on Shabbat
What are some general guidelines regarding the halakhic permissibility for Jewish doctors to work on Shabbat? I know that saving lives generally overrides Shabbat, but I am curious about less black-and-white situations that may occur on Shabbat, such as having a shift where one must be in the hospital or be on call, receiving medical training, etc. Also, in a practical halakhic sense, are there any situations in which the appropriateness of violating Shabbat would depend on whether the patients are Jewish? I'm sure that these are not simple questions and that there are likely multiple opinions on various issues, but some insight into this topic would be welcome.
I'm sure there are several lectures on YUTorah.org about this; probably an article or two in Journal of Halacha & Contemporary Society as well. But in short: "having a shift where one must be in the hospital or be on call" -- we generally try to avoid putting ourselves into a situation in which a matter of life-or-death might occur which would necessitating violating Shabbat; this "try to avoid" can be balanced out by other considerations, though. (That's one explanation given for why the Mishna prohibits getting on a ship too close to Shabbat -- a life-or-death situation may occur -- but if taking the trip is a mitzva, it's allowed.) "receiving medical training" -- a tough issue, as usually the life-or-death situation must be fairly immediate, not "oh this may allow me to save some life out there someplace, ten years from now." Nonetheless, I'm told that Rabbi Dovid Cohen of Brooklyn has allowed people to take residencies that may require working on Shabbat. But check with your own rabbi. "are there any situations in which the appropriateness of violating Shabbat would depend on whether the patients are Jewish?". That's easy. No. The Halacha is that we violate Shabbat to save any human life; that's the Halacha, that's the practice, that's what we do.
1
YUTorah.org is a journal of Halacha & Contemporary Society . a life-or
Using Pi to stream all audio output from my pc to my stereo
My problem is quite simple but I have been unable to find a satisfying solution. Basically, I want my Raspberry Pi to be connected to my stereo and then play any audio output from my computer via wifi to the PI. Is there any way to do this easily, without having to use special players? I.e. Is there anyway for the PC to just recognise the Pi as "speakers"?' I would like to hear every sound on my PC on the stereo, ie. Gaming, music, system sounds, notifications, youtube videos etc. Thanks very much!
Wanted to do this myself from Windows7 -> RaspberryPi (OpenElec) and stumbled over your question. After quite some research I still did not find a satisfying solution for OpenElec but had enough info to come up with one that is very simple and really works with high quality and only about ~1sec delay! You need: VLC Media Player (I used v2.1.3 Rincewind on my Win7 x64) A soundcard that provides a "Stereo Mix" recording device (I was fortunate enough to have one on-board) A Raspberry Pi (I use OpenElec 4.0.5, although it should work for XBMC in general) Note: If you do not have a soundcard that supports this you could try to use VAC (http://www.virtualaudiocable.net/), although I am tellin' you it did not work properly for me, poor audio quality and buffer problems all the way...but maybe it's just me. Step 1) Create a batch file which starts a VLC http streaming service in background and captures audio from the "Stereo Mix" recording device: @echo off set vlc="C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" start "" %vlc% --qt-start-minimized dshow:// :dshow-vdev=none :dshow-adev="Stereo Mix (Realtek High Defini" :live-caching=10 :sout=#transcode{vcodec=none,acodec=vorb,ab=500,channels=2,samplerate=44100}:http{dst=:8080/audiostream.ogg} :sout-keep Notes: You might have to change the recording device if yours has a different name, I used Audacity (http://audacity.sourceforge.net/) to check the names of my capture devices since I already had it installed Yes, the audio bitrate is very high (maximum for Vorbis), but the higher the bitrate the quicker the buffer is filled and hence the shorter the delay :-) (you cannot change the buffer size explicity for music on XBMC, I use 5MB buffer on mine in general) I tried FLAC, MP3 and even WAV and apart from the fact that only MP3 and Vorbis worked at all with my Pi, I had the quickest loading time on the Pi (basically instantly) and the least delay with Vorbis Step 2) Navigate to \\rapsberrypi\Userdata\playlists\music and create a .strm file with a name of your choice there (I called mine VLC.strm) which contains the plain link to your VLC stream: (change IP to IP of your PC :p) http://192.168.0.1:8080/audiostream.ogg Step 3) You can now either set the audio device which is captured by "Stereo Mix" to default in the windows sound settings or open a player like VLC and manually use the non-default device to play music on your RaspberryPi: Open your VLC (in addition to the one minimized in your tray which is streaming your "Stereo Mix") and perform the following steps: Tools -> Preferences Audio Output module: "WaveOut audio output" Device: - your (analog) device which is captured by the "Stereo Mix" recording device- Save Restart VLC Play Music Step 4) On your RaspberryPi: In XBMC navigate to Music -> Playlists Select VLC.strm (or whatever you called it) ENJOY MUSIC! Troubleshooting If you have troubles getting your "Stereo Mix" to work or capture, play around in Windows first by e.g. recording it with Audacity and trying some forum suggestions like: this one: http://www.howtogeek.com/howto/39532/how-to-enable-stereo-mix-in-windows-7-to-record-audio/ or this one: http://www.sevenforums.com/sound-audio/104497-stereo-mix-enabled-but-no-sound.html Right, enough typing for today, hope this was helpful to someone! BR, Deads
1
How to set "Stereo Mix" to default in windows sound settings?
Capturing a light beam
For a given container made of an extremely reflective surface, is it possible to shine a beam of light in, and with no 'fiddling' (i.e. closing the hole, tilting the object) to contain the beam for an infinite amount of time (not a very long time, but such that it will never escape). Consider the following Something like this. Except I feel like the light will escape given enough time. Also, the object has to be finite in size (infinite is cheating). If there's a proof that no such container exists then that's fine too. Ignore factors such as dissipation by heat, or quantum tunneling, and just assume a perfect environment with perfect materials.
I don't think there is any problem with this as a thought experiment. The container does not have to be infinite and when you close-off the container it will contain a radiation field with a finite energy density. However in practice, even the best reflectors have a finite conductivity and a less than perfect reflectivity, so the radiation field would dissipate by heating the walls of the container. You could also think about construcing your container out of a solid dielectric block, such that the light was totally internally reflected at each interface (an optical fibre). But again, there is no perfect dielectric and no perfectly smooth surface for ideal specular reflection. Eventually there will be absorption, scattering and even losses to the exterior through evanescent wave coupling.
0.666667
Radiation field dissipates by heating the walls of the container
Why was the winner of the AES competition not a Feistel cipher?
The winner of the AES competition has a structure that does not qualify as a Feistel cipher, as explained in answers to this recent question. However, most many of the AES candidates, and all 3 out of 4 some other finalists (Twofish, MARS) are Feistel ciphers, if we define that as a cipher transforming a block of data using a number of rounds which each can be expressed as: split all the bits of the block $B_j$ into two disjoint portions $L_j$ and $R_j$ (typically of equal size); compute some (typically round-dependent) function of $R_j$ and key with output $F_j$ of same width as $L_j$; compute $L_j'=L_j\oplus F_j$ where $\oplus$ is binary addition with removal of some carry bits (e.g. exclusive-OR, where all carry bits are removed); recombine bits of $L_j'$ and the unmodified $R_j$ into a new block $B_{j+1}$. Note: Serpent and RC6 can not be put in this framework (thanks to @Reid and @J.D. for pointing that). Neither can Rijndael/AES. At the time of the AES competition, Feistel ciphers already enjoyed a well understood theory. In particular DES was among them, and essentially unbroken in practice except for its small key and block size. It would seem that proposing anything else than a Feistel cipher would be an uphill battle. Yet, Rijndael won the AES competion, and does not fall under the above definition. Did a desirable characteristic of Rijndael made it preferred to the other candidates despite the apparent drawback of using a relatively untested structure? And if that characteristic could not be matched by a Feistel cipher, why?
DES actually demonstrated that a Feistel structure was not a guarantee against attacks. In "academic" terms, DES is broken by both differential and linear cryptanalysis, because they require, respectively, $2^{47}$ chosen plaintexts and $2^{43}$ known plaintexts, whereas the DES key is (effectively) 56 bits. Of course, for practical attacks, we would brute force the key: computing the function $2^k$ times is vastly easier than obtaining $2^k$ known plaintext/ciphertext pairs (or, even worse, chosen plaintext/ciphertext pairs). But in the usual "academic" evaluation of security, both linear and differential cryptanalysis count as breaks. Luby and Rackoff have demonstrated in 1988 that given "perfect" round functions, a four-round Feistel structure is secure. However, this proof has two practical issues: It is relative to the output size of the round function, i.e. 32 bits for a 64-bit block cipher. For 128-bit security, blocks have to be 256-bit wide for the proof to actually apply; but the AES call for candidates requested 256-bit security with 128-bit blocks, not the other way round. DES has amply demonstrated that concrete round functions cannot be assumed to be perfect. So while the security provided by a Feistel structure was already quite well understood at that time (around 1997, when AES candidates were being designed), it was also quite known to be "suboptimal" in the following sense: to get the most out of the existing security proofs, you had to go to impractical block sizes or number of rounds. Indeed, many researchers were dissatisfied with the Feistel structure, and eager to explore new structures. The AES competition was at the right time to become a test bed for such novel designs, and the accumulated research has shown substitution-permutation networks (as used by Rijndael) to be valid competitors to Feistel structures.
0.333333
DES demonstrated that a Feistel structure was not a guarantee against attacks
Does the original jutsu user feel anything when a shadow clone is dispersed forcefully?
According to the wiki, While the technique can be extremely beneficial, attempting to use multiple clones for training purposes can be mentally harmful to the user, as not only is all the experience collected by the user, but so is all the mental stress from training each clone Now, when a clone is destroyed, there must be some mental stress involved. So does Naruto (or anyone else) feel anything when their shadow clones are dispersed? Nothing has been shown to indicate this (at least in the anime). I was wondering why this would not be applicable.
I think mental knowledge and experiences are transferred to the original once disperesed, but not physical pain. If that were the case, using the shadow clone jutsu would only be too risky and only used for emergencies. I was actually wondering about the opposite scenario. Do the shadow clones share injuries of the original. For example, when kabuto severed the muscle in naruto's leg out, did the shadow clone created afterwards also have a severed muscle in the leg.
1
Do the shadow clones share injuries of the original?
"Where Amazing Happens", is this poster slogan a grammatically correct expression?
China's Guangzhou Evergrande FC set up a mouthwatering FIFA Club World Cup semi-final against European champions Bayern Munich after seeing off Egypt's Al Ahly 2-0. And Guangzhou Evergrande FC challenges Bayern Munich on their newly released posters with this slogan: Where Amazing Happens. I am wondering if this slogan is a right expression. Amazing is an adjective without doubt, then how could it be used alone as a subject? I have thought this over and now I guess maybe it is acceptable using some simplified, less-grammatical expressions for news titles and slogans, isn't it?
The poster is correct. This type of reframing of an adjective as a noun used in the English-speaking world, and is beloved by advertizers: A mouthful of "awesome" in every bite! Tongue-in-cheek speech: Auditioner: Okay, can you portray the same character, but make him ... sad? Actor: Sorry, no, I don't do "sad". Unless it's "cheesy sad"; I'm a comedian! Auditioner (to others): Did you hear that? We have a clown here (which I mean literally as well as pejoratively) who says he doesn't do "sad", unless it is "cheesy sad". Another example: A: I went on a date with a really intelligent guy, but he intellectualized every topic we talked about. B: I hear you. Intelligent is good. Nerdy: not so much. We probably accept this kind of thing by imagining the word to be completely outside of the syntax, as if wrapped in quotes (which is why I wrote all the examples that way). The ability to use pieces of language as nouns is necessary, because it allows us to talk about language. We can say things like: A: Blurchmoop! B: What on Earth is "blurchmoop?" Or: "up on" is a different preposition from "upon". We cannot stop ourselves from saying sentences like these because we don't know the lexical category of blurchmoop, or because "up on" isn't a noun, and so cannot serve as the subject to the verb "is". A piece of quoted language can serve as a noun, or even a verb, to make these kinds of sentences work, and as a byproduct, it lets us say things like "awesome lives here" or "I'm with stupid". Also note that "amazing" can in fact be regarded as simply the gerund form of "to amaze". Thus, "where amazing happens" can be interpreted similarly to "where cooking happens". However, this is not the interpretation which jumps out at me; and if I wanted to convey that meaning, I would say, "where amazement happens". Because "amazing" is a common adjective, we do not use the gerund form "amazing" in contexts where it is not clear that it cannot possibly be the adjective, such as, "He goes around amazing everyone with his skill". So if "where amazing happens" is used by someone with the intent of invoking the gerund meaning, patterned after "where cooking happens", that someone must not be a native speaker of English. By dumb luck, however, that someone has created a glib phrase suitable for an advertizement. Another thing: "the amazing" is definitely a noun. Every morning, Bob the Contortionist does the amazing; he bends over backwards and bites his own left ankle. The slogan in the poster could be expressed as: Where The Amazing Happens Finally, check this out. There are some adjectives in English that serve as nouns also, such as various -ible and -able words: convertible, deductible, dirigible, ... Something can be convertible, and we can have "a convertible" and "the convertible". Now imagine if such a word were used for something uncountable. For instance, gases are like liquids, but they are compressible. What if we coined the word "compressible" as a way to say "gas"? Then we could quite perfectly say something like this, without any article "the" or "a": This pipe is where compressible escapes from the tank. Which is not so different from "where amazing happens". So maybe "where amazing happens" is not that far fetched; perhaps we do not have to resort to hypotheses about quoted material being treated as a noun.
1
"where amazing happens" can be interpreted as a noun or a verb
Tooltip pointer in ParametricPlots
ParametricPlot[{ Cos[u]^v , u}, {v, 0, 1}, {u, 0, Pi/2 }, Mesh -> {5, 5}] ParametricPlot[Tootip[{ Cos[u]^v , u}, {v, 0, 1}], {u, 0, Pi/2 }] How to introduce Tooltip pointers? ( ParametricPlot3D Tooltip may not be available yet? ). EDIT1: Updating my question. Please ignore everything above the EDIT1: ParametricPlot[ { u Cos[v], u Sin[v]}, {u, 1, 2}, {v, 0, Pi/2}, Mesh -> {3, 5}] It is a two parameter plot. So I like to see either of $ u,v $ parameter lines being pointed at with the value of the set constant only. To make clear with an example, when I mouse over circles, like to see Tooltips in the above ParametricPlot pointing with SINGLE values {$ 1,1.25,1.5,1.75,2 $} and also when mousing over radial lines SINGLE {$ 0, \pi/12, 2 \pi/12,...5 \pi/12, \pi/2 $ } for the radial lines. It is a very simple requirement that I believe could cater to a common requirement of a majority of users. I am not looking at high frequency sophisticated dynamic motion picture display. Not even looking at double parameter display at intersection/junction of parameter lines. Just like the way height is displayed for ContourPlots. Here it is required for both parameters, with or without Shading. Asked this because it is not (yet) a standard feature. EDIT2: Based on Michael E2's lines, tried to depict eccentric circles.In the space between parameter lines it may need to be somewhat changed. {umin, umax, ustep, vmin, vmax, vstep} = {0, 2 Pi, Pi/8, 0.25, 1.25, .25}; ParametricPlot[{Sqrt[2 + v^2] + v Cos[u], v Sin[u]}, {u, umin, umax}, {v, vmin, vmax}, Mesh -> {Table[{u, Tooltip[Null, u]}, {u, umin, umax, ustep}], Table[{v, Tooltip[Null, v]}, {v, vmin, vmax, vstep}]}] /. {g___, Tooltip[_, label_], l_Line} :> {g, Tooltip[l, label]}
Add a dummy graphic to each mesh line with the appropriate tooltip label and combine them via post-processing: ParametricPlot[{u Cos[v], u Sin[v]}, {u, 1, 2}, {v, 0, Pi/2}, Mesh -> { Table[{u, Tooltip[Null, u]}, {u, 1, 2, 0.25}], Table[{v, Tooltip[Null, v]}, {v, 0, Pi/2, Pi/12}]} ] /. {g___, Tooltip[_, label_], l__Line} :> {g, Tooltip[{l}, label]} Update notice: The pattern was changed from l_Line to l__Line to handle multiple instances of Line in a mesh line, as pointed out by Mr.Wizard in a comment, along with a change in the Tooltip code to handle the sequence l.
0.555556
Add a dummy graphic to each mesh line with the appropriate tooltip label
Is it possible to create a non-ecommerce site using Magento
I have a site to develop. This site is a kind of voucher code site. Means this site will provide voucher codes for other sites. User will come to my site and pick voucher codes for an another site and will then redirect to that site. In short, it does not need any add-to-cart functionality of magento. An example site is shown below in link: http://www.myvouchercodes.co.uk However, this site require a strong admin side for support and I believe magento has a strong admin. This is the reason why I am planning to choose magento for my site. So my questions are 1)Is it good to use magento for developing such non e-commerce sites 2)What are the best practices that should take care of when developing such sites using magento Please share your thoughts... Thanks in advance
You can but Magento is good at one thing, and that is selling. Using it only as a catalog would be a waste of resources and you might be better of using another system like Typo3 or Wordpress. At the end of the day the most important thing is that you it in a system you feel comfortable working with and the end user and administrator can work with. But in my honest opinion: the answer would be: NO
0.777778
Magento is good at one thing, and that is selling.
A helical cycloid?
While combing around my notes looking for other possible examples for this question, I chanced upon another one of my unsolved problems: Cycloidal curves are curves generated by a circle rolling upon a plane or space curve. It's not too hard to derive the required parametric equations if the fixed curve is a plane curve, but I've had some trouble deriving the corresponding expression for space curves. More specifically, here is the particular problem I was concerned with: consider a (cylindrical) helix: $$\begin{align*}x&=a\cos\;t\\y&=a\sin\;t\\z&=ct\end{align*}$$ and imagine a circle of radius $r$ whose plane is always perpendicular to the x-y plane rolling on the helix, starting at the point $(a,0,0)$ ($t=0$). Imagine a point in the plane of the circle at a distance $hr$ from the center. What are the parametric equations for the locus of the point? The two obvious pieces of information I have are that the center of the circle also traces a helix, whose parametric equation differs from the original by a vertical shift of $r$ (per Tony, that was an erroneous assumption), and that the expression for the arclength of the helix, $s=\sqrt{a^2+c^2}t$, should figure into the final parametric equations. Otherwise, I'm not sure how to start. How does one derive parametric equations for the "helical cycloid"? The physical model I had in mind was a screw ramp winding around a cylinder. Supposing that there was a car that needed to go to the top of the cylinder by driving on the ramp, and supposing that a spot is placed on one of the car's wheels, what are the equations for the locus of the spot?
I'm adjusting my answer, which as TonyK points out was based on an incorrect assumption. Hopefully it's correct now. The center of the circle is not directly above the point of contact with the helix as my incorrect answer had asserted. To see where it is, first picture the starting point at $(a,0,0)$, where the circle is parallel to the $y$-$z$ plane. The tangent vector to the helix is in the direction of $(0,a,c)$, so the radius is perpendicular to this in the direction of $(0,-c,a)$. So you have to add $\frac{r}{\sqrt{a^2+c^2}}(0,-c,a)$ to get to the center. As the circle rolls along, the vector you add to get to the center will rotate around the $z$ axis to $\frac{r}{\sqrt{a^2+c^2}}(c\sin(t),-c\cos(t),a)$. So the center of the circle is parametrized by $(a\cos(t),a\sin(t),ct)+\frac{r}{\sqrt{a^2+c^2}}(c\sin(t),-c\cos(t),a)$. The arclength formula allows you to write down the rotation angle of the point about the center of the circle in terms of $t$ as $\frac{\sqrt{a^2+c^2}}{r}t$. Let $b=\frac{\sqrt{a^2+c^2}}{r}$ from now on. If we pretend for a minute that the point was just going to rotate about the center of the circle at this rate while the circle remains fixed, and simplify the problem for now by assuming that the point starts above the center of the circle, then the vector we would add to the center of the circle to parametrize the point would be $(0,hr\sin(bt),hr\cos(bt))$. When looking toward the $y$-$z$ plane from the positive $x$ axis, this motion would appear clockwise, as it should because the circle will be starting off to the right from this perspective. But the vector we actually add to the center will also be rotated by $t$ about the $z$-axis, so putting it all together (with minimal simplification) we get $\begin{align*} x&=a\cos(t)+\frac{c}{b}\sin(t)-hr\sin(t)\sin(bt)\\ y&=a\sin(t)-\frac{c}{b}\cos(t)+hr\cos(t)\sin(bt)\\ z&=ct+\frac{a}{b}+hr\cos(bt). \end{align*}$ Now to adjust the starting point, you can change $bt$ to $b(t-t_0)$ for suitable $t_0$.
0.833333
The center of the circle is not directly above the point of contact with the helix
Was there confirmed opposition to Willow's relationship in Buffy season 5?
In season five of Buffy the Vampire Slayer Tara and Willow pursue a romantic relationship There's lots of hugging and smiling and talking about their feelings, but up to the sixth episode, they do not kiss. Was there studio/PR/political objection to the nature of this relationship? How much? What was the nature of it- was it deemed too controversial, inappropriate for younger viewers, were executives worried that it would perform poorly?
It might just have been because a lot of the audience were teenagers and they wanted them to know that there was a relationship but not start sending their minds off to the - erm - more physical aspects. To the best of my knowledge there was no opposition but I am in the UK and do not know what was happening in the USA.
1
I am in the UK and do not know what was happening in the USA
What does Arch Linux offer?
I use Macs, Ubuntu, FreeBSD, OpenBSD, and Fedora for different purposes. I'm fairly busy and trying out a new distro takes a lot of time, but I hear lots of good things about Arch Linux from people I admire. I do mostly scientific computing (and some web development), and use Linux as both a desktop and a server. Does Arch offer anything I'm not already getting from one of my current installs? I'm particularly interested in the differences between Arch and Debian
For experimenting, I've tried Arch. It's where a lot of people these days are ending-up after having tried LFS or Gentoo long ago. Frankly, it's a bit raw as intended and reminds me of Slack. That said, I :heart: GNU/Linux. I've found FreeBSD has numerous practical advantages: Developed as a whole. Security. Root ZFS (GPT/EFI) install guide works. (CDDL of course) += ports(Nonfree(TM) + GNU), I've been able to run everything from Scipy Hadoop Jenkins Puppet Varnish (of course) Riak Haskell platform Side-by-side ruby(187, ree, 193, jruby) with AND without rvm, python(272,322) with AND without pythonbrew The freebsd source ports are pretty current, and easy as any Ubuntu LTS/Debian or Arch. I'm probably biased as I'm a sysadmin that started in the early Slackware days. There isn't much I can find wrong with FreeBSD other than it's not quite as new and shiny as Arch. kFreeBSD and the Nexenta desktop variants would also be interesting.
1
FreeBSD has numerous practical advantages: Developed as whole. Security
Apartment in Munich
I'm a married man looking for an apartment to live with my wife from February 2014 until April 2014. How can I find an apartment for this time period?
If you are searching for an unfurnished apartment, this is the most popular site in Germany: http://www.immobilienscout24.de Otherwise, you can check Craigslist Munich for apartment listings, almost all of which are furnished. Alternately run a simple search on Google for "Furnished apartments Munich" and you will see lots of different companies providing basically the same service. Edit: I misread the original question, the OP is only staying for a very short amount of time. My advice is best suited for people staying over a year.
1
Search for unfurnished apartments in Germany
How does multitasking work
I am completely clueless about the inner workings of an operating system, but I can more or less guess the approximate behaviour of many functions. One thing that I am not able to figure out, though, is multitasking. In theory, the operating system manages time, according the CPU for small intervals to the various programs running. But it is not clear how this really works. Say the operating system wants to start my program. The machine code is loaded somewhere in RAM, starting at a certain address. I guess then a jump should be performed to that address, allowing my code to execute. But in this way, the OS cannot regain control until I jump back. Basically, I can imagine just two ways of making this work, but neither seems really suitable: The operating system could read the machine instructions I want to perform and emulate them instead of executing them directly. I am intentionally vague, since I do not know how this would work, but it seems like it would slow down the program considerably. Alternatively, the operating system could wait until I make a system call. In that moment it regains control and can check how long I have been running and do its timesharing stuff. This may work, but it seems unreliable, as I could make a long calculation which does not involve system calls and hang everything for a while. So, it seems neither mechanism would work very well. How is multitasking actually performed?
It varies from system to system. In nonpreemptive multitasking systems (such as the original Oberon, or the original Apple Macintosh), the operating system periodically "polls" all tasks, giving them an opportunity to do work. The tasks are expected to play nicely together. If they just have a little bit of work to do, they do it and return to the OS. If one task has a BIG chunk to do, it is expected to break it into little pieces, and work one little piece each time it is polled. Hardware interrupts (disk drive DMA completions, serial port interrupts, what have you) cause interrupt routines to run. These interrupt routines may in turn notify tasks of work to be done when the task next runs. In nonpreemptive multitasking systems, the occurrence or non-occurrence of an interrupt does not affect which task is running after the interrupt routine finishes. In preemptive multitasking systems, it is possible for an interrupt routine to force a scheduling change. In a traditional round-robin preemptive multitasking system, a periodic timer interrupt does exactly that. The timer interrupt fires, the timer interrupt routine does some black magic to cause the return-from-interrupt instruction to return to the operating system's preemptive schedule, rather than to the running task, taking the processor away from the current task, and (POSSIBLY) giving it to another task. If no other task is ready to run at that point, the current task will get the processor again, having only lost some time. Preemptive multitasking can cause a LOT of troubles. All of that annoying stuff about mutexes and critical sections and deadly embraces and ... show up when the processor gets taken away from you without warning. You have to use all those things to tell the operating system that you are in the middle of mixing nitroglycerin and taking the processor away from you right now is likely to result in a large smoking virtual hole in the middle of the server room floor.
0.888889
Preemptive multitasking can cause a LOT of troubles .
Is the particular skill of singing the melody correctly necessary to be able to play the trumpet?
I mean, there are people who can't sing melodies correctly but they are able to play the guitar perfectly. Will such person be able to play the trumpet? When you hit the note on the trumpet do you have to worry about the correctness of the note or trumpet does it for you? I play the guitar, I even sing sometimes but I'm worried, will my musical hearing be good enough for the trumpet? Hope I made myself clear.
Trumpet - sort of. Trombone - absolutely not. The reason is that with a trumpet you have 8 possible fingerings, and for each there is a limited number of tones from which to choose by lip pressure. As a beginner you will only need the lower tones, which are spaced so far apart that it's extremely hard to hit the wrong one without noticing. Only getting a clean intonation might be tricky for you because it involves having precisely the right amount of lip pressure to get the intended result - so you have to hear whether the intonation is right. (I don't think this is a big issue with the guitar once it has been tuned.) With the trombone, instead of fingering you'd have to find exactly the right spot on a continuous scale. That's harder than hitting the right tone when singing. Of course if you have a musical ear and there is merely something wrong with your vocal cords, then this is not an issue either. (In that case the comb, the kazoo and the didgeridoo are the only instruments I can think of right now that would be problematic.)
0.777778
How to get a clean intonation by lip pressure?
Saturated Density Plots
I am making some density and contour plots in Mathematica. These plots have very high peaks which saturate with color and prevent me from seeing differences in the peaks. Is there a way I can tone down the color scale so my peaks are not just white blobs? Trying other color schemes has not worked out, and playing with the range of color data has not been very useful. Is there some way to have the colors on a log scale??? Here is my code. ListDensityPlot[photo, PlotLegends -> Automatic, Frame -> {True}, FrameLabel -> {"Electron Bunch Energy (MeV)", "Photon Energy (keV)", "", "Yield (Photons/Sr e-KeV)" }, LabelStyle -> {15}, InterpolationOrder -> 10] Cheers, Ben
It's difficult to help without photo data, but I'm almost sure that PlotRange can solve your problem. Try to control Z coordinate in PlotRange as in this example, to find a better range to your plot. pSaturated=DensityPlot[Exp[-10(x^2+y^2)],{x,-1,1},{y,-1,1},ImageSize->400]; pOK=DensityPlot[Exp[-10(x^2+y^2)],{x,-1,1},{y,-1,1},PlotRange->{All,All,{0,1}},ImageSize->400]; Row[{pSaturated,pOK}]
1
PlotRange can solve your problem without photo data
I want to run 20A constant current and 4.2V on a load using a variable DC power supply rated same
I want to run 20A constant current and 4.2V on a load using a variable DC power supply rated as 20A, 30V. But because my power supply is a switching CC, Cv type, and it kept switching to CV at only 1.2A. I really want to run it at 20A and 4.2V (CC, CV) on the same load despite the change of resistance of the load. I will really appreciate step by step instruction on how to achieve that, if using resistors etc. In more details, the load is a 3.75V, 1000mAh battery and this battery is designed to take this much load for only 3 minutes to recharge. Currently the battery is on the nominal voltage checked using a multimeter.
I'd be charging that battery in a purpose built charging bag, and wearing Nomex overalls (you, not the battery) while doing so would probably do no harm. You also want to be sure that the supply will genuinely deliver 20A at 4.2V. Assuming that the battery CAN tolerate the rate you say, The supply is capable of safely delivering 4.2V at 20A for 3+ minutes. The supply current limit can not be set when not loaded. Disconnect any load. Set supply to say 4.25V. Set CC control to minimum. Short supply output terminals Adjust CC control until I = 20A Unshort terminals. The supply is now ready. When loaded below 4.2V it will deliver 20A. When Vload rises to 4.2V it will deliver 20A or less. Connect supply to fully discharged battery with correct polarity. After 3 minutes the battery WILL NOT be fully charged. This is because when Vbattery rises to 4.2V the supply will go into CV mode ND current will be set by the battery. It will start to taper down. CV to CC change over will probably happen in the 2 m to 2m 30s range. This is a natural consequence of LiIon / LiPo chemistry. IF you are sure that the batter will tolerate (for some values of tolerate) a constant 20A input then the charger should be set to 20A CC as above AND the supply voltage set "higher. MAYBE 4.5V. Maybe 4.7 Maybe - flaming ruin .... . This is not how the books ever say you can do it. this violates the most fundamental principles of LiIon charging. This sounds like fun :-) If it works, more power to you, but battery life will be shortened so it will be less energy to you overall long term.
0.777778
LiIon charging is a natural consequence of chemistry
How can I get a PieChart to be colored as I wish?
How to use the value of a funtion[label] to assign color to a piece of the pie? (edited after answer of kguler ) My dude is how to control the colors in ranges of a function of [labels] In this way I can show: 1.- the percentage of Data(labels), using pieces of pie and 2.- the value f of labels, with range colors (similar to TemperatureMap but customized) ------ Original Post ------ I want to use a "gradient" or "a reduce (5-6) list of colors"(similar to DarkRainbow with a little colors)? I was trying with ColorData and ColorDataFunction ( here you can see that I obtain errors with the same code as the reference doc ) but I have no succes!! percent = {12, 18, 24, 46} labels = {1, 9, 15, 22} f = {8, 7, 1, 4} PieChart[percent, ChartLabels -> labels, ImageSize -> 200, PlotLabel -> "Test-Grad", ChartStyle -> ColorData["TemperatureMap" {0, 8}]] PieChart[percent, ChartLabels -> labels, ImageSize -> 200, PlotLabel -> "Test-Comic", ChartStyle -> ColorData[9, "ColorList"]] In the image you can see any more about explanation:
Update: I think you after something like pc3b = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-3b", ImageSize -> 300, ChartStyle -> {ColorData[{"TemperatureMap", {0, 8}}] /@ f}] Similar trick with ColorFunction should work too... rule = Thread[percent -> f]; PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-4b", ImageSize -> 300, ColorFunctionScaling -> False, ColorFunction -> (ColorData[{"TemperatureMap", {0, 8}}][#1 /. rule] &)] Original post: percent = {12, 18, 24, 46}; labels = {1, 9, 15, 22}; f = {8, 7, 1, 4}; pc1 = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-1", ImageSize -> 200, ColorFunction -> "TemperatureMap"]; pc2 = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-2", ImageSize -> 200, ColorFunction -> Function[{angle}, ColorData["TemperatureMap"][angle]]]; (*the following based on guessing how you might want to use color gradients with `f` *) pc3 = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-3", ImageSize -> 200, ChartStyle -> {ColorData["TemperatureMap"][#] & /@ Rescale[f]}]; pc4 = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Grad-4", ImageSize -> 200, ColorFunction -> Function[{angle}, ColorData["TemperatureMap"][Nearest[Rescale[f], angle]]]]; pc5 = PieChart[percent, ChartLabels -> labels, PlotLabel -> "Test-Comic", ImageSize -> 200, ChartStyle -> 9]; Row[{pc1, pc2, pc3, pc4, pc5}, Spacer[5]] // Panel
1
pc3b = PieChart
How to change port number in vino?
How to change port number in vino ubuntu 11.10? Cannot find option to change from port 5900 on vino vnc 'remote desktop' window, nor can I find it via gconf-editor as was available in previous ubuntu version. Please help
There is a brainstorm idea that was closed because it was thought of as a bug report: http://brainstorm.ubuntu.com/idea/25109/ Here is another question regarding this and the second answer mentions how to do it but I recommend using iptables: Enable remote VNC from the commandline? UPDATE - As mentioned by the answer from Oli that would be the way to do it until the vino-preferences readds the option again.
1
How to disable remote VNC from the commandline?
How can I use an SVG image as a map marker in OpenLayers-3?
I am trying to create map "pin-drops" (ie. map markers) in OpenLayers-3 (OL3) using SVG images. Currently, I am using PNG images as the pindrops that reference the ol.style.Icon source (“src”) property attribute just fine. However, this fails using an SVG image. Is there some other way to use an SVG in the same manner? Maybe by using a reference besides ol.style.Icon even? There is already a lot of built-in SVG in Open Layers so this should be possible, but I haven't found a way to get this working in OL3. Is there some other way to do this in OL3 that I should consider? Please note: we already tried using an ol.Vector layer, however when the user zooms in/out, the size of the SVG image grows/shrinks which is an inadequate workaround. OL3 (fails): var createMapMarkerImage = function() { return function(feature, resolution) { var iconStyle = new ol.style.Style({ image: new ol.style.Icon( ({ src: 'img/map_pindrop.svg' // OL3 doesn’t like this, but accepts a .PNG just fine })) }); return [iconStyle]; }; }; Very similar functionality, is the below example I found online, is almost perfect if it weren’t for the fact that the example uses OpenLayers-2 (OL2) functionality which calls openlayers.js library (instead of OL3’s ol.js library). Sadly, swapping these javascript files out fails. OL2 (works -but is the old OL library): http://dev.openlayers.org/sandbox/camptocamp/tipi/examples/vector-symbols.html Searching online for a solution to this seems to produce only other confused people searching for a solution. Please help, FreeBeer
SVG icons work fine as long as the content-type of your SVG image file is image/svg+xml. Also note that no external references are supported inside the SVG. OpenLayers 3 simply uses the drawImage function of the 2d context. You can find more details on the requirements of SVG content here: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas.
1
SVG icons work fine as long as the content-type of your SVG image file is image/svg+xml
Why does Wizards of the Coast print terrible MTG cards?
I understand that there needs to be a wide variety of power levels in Magic: The Gathering. Even bad cards will see play in limited formats, some because they fill a specific niche (flying removal, fat colorless flyer, providing a counter to certain decks), and others because those decks can't afford to be too picky. However, some cards are just unforgivably terrible. I'm talking about cards that you would only run in sealed if you had absolutely no other options: Mindless Null: Black 2/2 for 3 with a big disadvantage Defensive Stance: literally does nothing in exchange for you getting card disadvantage Merfolk of the Depths: Would still be bad if it only costed 5... Archangel's Light: 8 mana just to gain some life and put cheap cards back into your deck. And it's a mythic rare.... There are many more examples, but I think these best illustrate my case. Obviously I'd rather have these cards in the game than not have them at all, but I feel like Wizards of the Coast could have made Magic a more enjoyable game just by keeping the flavor and making all of these cards a tiny bit better...yet they didn't. Why?
Tom LaPille, When Cards Go Bad, Part 2, a followup to the first When Good Cards Go Bad article thesunneversets linked, has a few more points that haven't been fully explored yet. Some cards aren't fun when they're good. Here he uses the example of Scrambleverse, which has really cumbersome and complicated mechanics, explaining that it is costed very high so that it doesn't get played often. The only people that play it are the people that really want to. Limited needs to be balanced. I think Limited play is the biggest reason there are "bad" cards in modern MtG. From the article: …there was a meeting when both blue and black were doing much better than we wanted in our playtests. Lead developer Aaron Forsythe decreed that we needed a weak blue card and a weak black card. None of us came up with a blue card that was weak enough, so Aaron created Defensive Stance to fill the hole. So while Defensive Stance does have some narrow infect-hosing mechanic, it was basically created just to keep blue drafters in New Phyrexia in check. Draft needs to be human-processable. Drafting is a complex enough task already without every card being extremely close together in power, so we include plenty of cards of widely differing power levels so that the right answer can be a little bit less ambiguous. This doesn't simplify the task of correctly identifying those power levels—a challenging task in itself!—but it does make deciding between correctly-identified power levels a little bit easier. Imagine if every card in a pack had the same power-level. I have a hard enough time deciding between two or three similar power-level cards in a draft. If all cards had a similar power level, each decision becomes stressful and agonizing. Drafts would slow to a crawl. If there are some "last pick" cards and definite common "bombs", it makes the draft a bit more smooth and manageable.
0.777778
When Good Cards Go Bad, Part 2: How to Identify Power Levels?
How does Christianity deal with biblical criticism related to the Old Testament?
As an orthodox Jew I have seen quite a stir lately regarding the topic of biblical criticism, specifically towards the Old Testament (Torah). I have perused several questions in this stack which seem to address this topic in general, and learned a lot about apologetics, but I have not seen answers that address some of the major claims of biblical criticism, especially as it pertains to the Old Testament. For example: The story of Noah and the flood seems to be contradicted by archaeological evidence as well as having been 'borrowed' from earlier flood narratives such as the Gilgamesh story Many of the portions of the Old Testament seem to be borrowed from earlier near eastern texts such as the Hammurabi code The notion that there are multiple authors (documentary hypothesis) of the Old Testament. In short, how does Christianity deal with some of the major contentions of biblical criticism towards the Old Testament? I apologize if any parts of my question offend any sensibilities to which I am unaware.
Christians are very diverse on how they handle this type of criticism. Probably the most visible school of thought in today's media are the literalists. These Christians accept that the Bible was fully authored by God and is complete and infallible. For them, Gilgamesh is either fiction or a pagan account of the Genesis story. Hammurabi's code is a set of inferior pagan laws. The most liberal Christians treat the Bible as one of many worthwhile ancient writings and as a product of the sharing of knowledge across cultures. The Genesis account was inspired by Gilgamesh. Mosaic Law and Hammurabi's Code may have been derived from the same source. Most Christians fall somewhere in between the two. The Bible wasn't written in a vacuum and it's just a matter of course that there are similarities to other writings from other cultures. It doesn't change the Bible's supremacy and it doesn't impact their faith. An explanation I heard from a conservative reform Jew fits nicely. God spoke to lots of people. The Jews were just the ones who heard and obeyed. That there were multiple authors of the Bible is just a given. Even the most conservative literalists believe that God used many people to write His word. Different groups might disagree on how many authors there were, but there was definitely more than one.
0.777778
The most visible school of thought in today's media is the literalists .
modernCV seems to forbid any hyphenation. How can I switch that off?
I'm writing a document with the help of the modernCV class, using (a modification of) the casual style. It looks like this class is penalizing hyphenation pretty severely. Why is that so? I can't find something like \hyphenpenalty= set to a very high value in moderncv.cls. How can I allow hyphenation in the cover letter?
It's easiest to just add the ragged2e package to your preamble \usepackage{ragged2e}% http://ctan.org/pkg/ragged2e and use \makelettertitle\justifying You could use any of the other justification styles as well.
1
Add the ragged2e package to your preamble usepackage.
Solving the recurrence relation $T(n)=4T\left(\frac{\sqrt{n}}{3}\right)+ \log^2n$
How we calculate the answer of following recurrence? $$T(n)=4T\left(\frac{\sqrt{n}}{3}\right)+ \log^2n.$$ Any nice solution would be highly appreciated. My solution is: $n=3^m \to T(3^m)=4T(\frac{3^{m/2}}{3})+log^2 3^m = O(Log^2 n log n log n)$
Introduce the auxiliary (sub)sequence $(S(k))$, defined for every $k\geqslant1$ by $$S(k)=4^{-k}\cdot T(3^{2^k-2}),$$ then the recursion on $(T(n))$ becomes $$S(k)=S(k-1)+4^{-k}\cdot(\log(3^{2^k-2}))^2,$$ for every $k\geqslant2$, that is, $$S(k)=S(k-1)+4^{-k}\cdot(\log3)^2\cdot(2^k-2)^2=S(k-1)+(\log3)^2\cdot(1-2^{-(k-1)})^2.$$ Since $(\log3)^2\cdot(1-2^{-(k-1)})^2\to(\log3)^2\ne0$ when $k\to\infty$, this yields $$S(k)\sim(\log3)^2\cdot k,$$ that is, $$T(3^{2^k-2})\sim(\log3)^2\cdot k\cdot4^k.$$ Let $n=3^{2^k-2}$, then $2^k=2+\log_3n$ hence $2^k\cdot\log3\sim\log n$, thus, $4^k\cdot(\log3)^2\sim(\log n)^2$, and $k\sim(\log\log n)/\log2$, hence $$T(n)\sim(\log\log n)(\log n)^2/(\log2),$$ in particular, $$T(n)=\Theta((\log\log n)(\log n)^2).$$ One sees that $T(n)$ is $O((\log\log n)(\log n)^2)$ and that $T(n)$ is not $O((\log n)^2)$.
0.777778
Introduce the auxiliary (sub)sequence $(S(k))$, defined for every $kgeqs
Is it possible to jailbreak an iPad 2 (A1395) after updating to iOS 6.0.1?
I have a jailbroken iPad 2 (A1395) running Version 5.0.1 (9A405). If I update to 6.0.1, can I jailbreak untethered? Will I have to re-install all my Cydia apps & settings, or do they get backed up and restored? Confused by too many Google results!
This is no longer true; Both answers were written before evasi0n came out. Now it's more than possible to JB 6.x devices, in fact up to 6.1.1/6.1.2. As for backing up, you don't need to back up Cydia - it gets reinstalled anyway. What I would back up are any manually installed (i.e. hackulous-type) apps you may have (cd to /var/mobile/Applications, then do a tar)
1
evasi0n backs up Cydia
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.
It's always a good idea to have a last change field (date) on your records. Keep in mind that, if you start to synchronize, you have to take care of conflicts. If both sides can insert, use a partitioning scheme for your primary keys. Example: Site A starts from 1000000000, Site B from 2000000000 (make this numbers large enough or simply divide your primary key size by the number of concurrent sites). Rough synchronize plot: Get the modified records from source A, beginning from the last sync cycle. For each record, check: Is it newly inserted in A? Then insert it in B Is it modified in A, but not in B: update B Is it modified in A and in B: resolve conflicts on a field level. Get the modified records from source B, beginning from the last sync cycle For each record, check: Is it newly inserted in B? Then insert it in A Is it modified in B, but not in A: update A Is it modified in B and in A: resolve conflicts on a field level.
1
How to insert a last change field?
What is the case for interpreting the Genesis creation account literally?
I think we can all agree that the entire Bible is not meant to be taken literally. Consider the Song of Solomon (what would his lover look like if we take it literally?) or the book of Revelation. So I would like to understand the case for believing the Genesis creation account, among all Biblical texts, is one that is intended to be interpreted literally. I'm not interested in scientific evidence for a young-earth in these answers. I'm interested in Biblical or historical reasons why this text, as a whole (as opposed to individual words), should be considered literal. I would also discourage answers that address specific words in the Genesis account (such as the Hebrew 'yom'), but if that is the strongest evidence you have, then I won't consider it an invalid answer.
The short version is that there are many places in the Bible that quote/reference the creation account in the book of Genesis literally (Exodus 16:16, Exodus 20:11, Exodus 31:17, Leviticus 23:3, Deuteronomy 5:13, Luke 13:14, etc). The most obvious is the "reasoning" given for the 4th Commandment: Six days you shall labor and do all your work, but the seventh day is a sabbath of the LORD your God .. For in six days the LORD made the heavens and the earth, the sea and all that is in them, and rested on the seventh day Furthermore, death was not introduced into creation until Adam sinned (Genesis 3:17-19, Romans 5:12, 8:20-22). Without death, you cannot have fossils. The first of the genealogies of the Bible, which starts with the first man (Adam) and goes through Noah, is given in concrete years of the age of the father when the son was born. While I suppose you could elect to say that the first 5 days of creation were figurative, certainly from day 6 on is distinctly not figurative - otherwise the reckoning of Adam's age at the birth of Seth would be irrational.
1
Genesis literally quotes/references the creation account in the book
After what period of time does a PhD position count towards the two possible attempts in Germany?
I am not sure if this holds true everywhere, but here in Germany you only get two attemps at getting your PhD. I am currently wondering at which point it counts towards those two attempts. If I were to start a position and quit during the first few weeks, would it still count?
I don't think this is quite true in Germany either - or at least not in the generality that I read into your question. Here is example 1 (Promotionsordnung (PhD bylaws) for psychology and sport, Muenster), and another randomly selected example 2 (Promotionsordnung math, Bonn). Both stipulate much more restrictive conditions that relate to your question. They somewhat overlap, but not completely - so there is also no uniform answer for Germany. Simply stepping away from a PhD early on would not be a problem in either case. The restrictions on the number of attempts to be successfully awarded a PhD are as follows: Example 1: you get one and one only attempt to resubmit a declined thesis, and to re-take the oral defense each Example 2: no restrictions are mentioned on the number of failed thesis attempts. You get one attempt to re-take a failed defense In particular given that even these two sources don't agree, you just need to pull your program's Promotionsordnung, and confirm which rules apply to you.
1
stepping away from a PhD early on would not be a problem .
Can a heavy key-chain damage your ignition?
I just bought a 2012 VW Jetta TDI. The dealer asked me to do a 2,000 mile check-up to make sure everything is within tolerances. At the check-up the service representative said my key-chain was too heavy and if I planned to keep the car for long I should reduce weight on the key-chain to keep from damaging the ignition. I only have six other keys, a hook and two small plastic electronic computer devices on the single key ring. It doesn't seem excessive at all compared to the usual key rings you see. The question is, do new car ignitions still wear out due to key-ring weight? To me this seemed like the kind of advice that might have once been true and is dispensed long after it is no longer the case.
I worked on VWs and Audis for a while, we had some mkIV's like yours with worn out ignition switches from heavy key rings. My advice is to keep the weight of the key ring to something reasonable.
1
VWs and Audis with worn out ignition switches
Copying Files in a Folder To Individual Folders
This might sound like something quite odd but for my HTPC, I need to rearrange how my files are stored such that each of the individual files in a folder needs to be moved to a subdirectory of its own (with the same name as the file). I.E. - Currently the directory is: directory/ - a.file - b.file - c.file and I want to change it to: directory/ - a/ -- a.file - b/ -- b.file - c/ -- c.file I don't think this is terribly tricky but it's just odd and I haven't found anybody doing it before: I think it can be done with find and exec but I'm a bit of a battler and can't quite get it. Thank you very much in advance (or even just for taking the time to read this).
Write a shell script which gets the files as parameters: #!/bin/bash for filepath; do parentpath="${filepath%/*}" if [ "$parentpath" != "$filepath" ]; then # $file contains a / file="${filepath#"$parentpath"/}" else file="$filepath" parentpath="" fi filename="${file%.*}" if [ -z "$parentpath" ]; then mkdir -p "$filename" && mv "$file" "$filename" else mkdir -p "${parentpath}/$filename" && mv "$filepath" "${parentpath}/$filename" fi done You can call this script as ./script *.ext1 *.ext2 *.ext3 for not too huge numbers of files or as find ... -exec ./script {} + for huge numbers.
0.777778
Shell script gets files as parameters: #!/bin/bash for filepath
"Find ten apples and oranges" Do I find 10 or 20?
If I read the sentence Find ten apples and oranges. Do I need to find ten or twenty pieces of fruit?
And can be both a distributive coordinator and a joint coordinator. So, for example, if a subject includes a distributive and, then the predicate applies equally and distinctly to both noun elements: John and Mary live in London means John lives in London and Mary lives in London. A subject including a joint and cannot be expanded in this way. So, John and Mary are a happy couple is incoherent as John is a happy couple and Mary is a happy couple. Often, however, there is no way to reliably interpret if the and is a distributive coordinator or a joint coordinator. For example: John made cheese and cucumber sandwiches. Did all the sandwiches consist of both cheese and cucumber (joint coordination) or did he make cheese sandwiches and also make cucumber sandwiches (distributive coordination)? The OP's sentence Find ten apples and oranges is ambiguous in the same way. There is a brief discussion of distributive / joint coordination in The Handbook of English Linguistics (Aarts).
0.777778
How to interpret if the and is a distributive coordinator or joint coordinator?
Saving TinyMCE Base64 images with dragonfly
I am using tinymce-rails-imageupload plugin with dragonfly. When the image is uploaded via separate form in popup window, it behaves as expected (save image in datastore). But when the user drag-drop or paste image into TinyMCE, the imageupload plugin allows it. I tried to find a way to disable this behavior, but apparently there is no straightforward way to disable allowing image upload, while disallowing the past/drag-drop behavior. So I gave up on that.. Now, I'm trying to save BASE64 image in TinyMCE's content. In controller: def store_file @image = Resource.new :res_image => params[:file] @image.save render json: { image: { url: @image.res_image.remote_url } }, content_type: "text/html" end def create @entry = Entry.new(params[:entry]) # iterate through tinyMCE field params[:entry][:message] # if image tag is found # if value of src tag starts with "data:" # then replace it with the output of # Resource.create_image_from_base64(extracted_base64_value) # end if # end if # end iteration begin @entry.save! flash[:success] = "Entry was successfully created." redirect_to entries_path rescue Mongoid::Errors::Validations => e render :action => "new" end end In Resource model, I would have something like: image_accessor :res_image field :res_image_uid, type: String field :res_image_name, type: String def create_image_from_base64(base_64_encoded_data) file = File.open('temp.png', 'wb') do|f| f.write(Base64.decode64(base_64_encoded_data)) end resource = # create Resource with temp file file.close resource.res_image.remote_url end Questions: How to create "Entry with file"? Is there a better approach for handling pasted/dragged-droped base64 images in TinyMCE with dragonfly?
Even if it is an old question: look at this: https://groups.google.com/forum/#!topic/dragonfly-users/xNWIwZf5-_Y
0.833333
https://groups.google.com/forum/#!topic/dragonfly-users/xNWIw
Setting a basic footer to a UITableView
How is a basic footer set to a UITableView programmatically? Just a centered text? EDIT: How can the bar color be set and the footer bar position fixed to the bottom of the screen or if the thumbs dont fill a screen, the footer isnt above the bottom of the screen.
viewForFooterInSection sets the section's footer. To set the table's footer, you want to set self.tableView.tableFooterView = myCustomFooterView where myCustomFooterView is something you setup elsewhere. You'd probably set that in viewDidLoad.
1
viewForFooterInSection sets the table's footer
SASS Index in nested list
I'm trying to get the index of an item in a nested SASS list — by the first property. But the only way i can get a result is to include both properties in the item. Is is doable with native SASS, or would it require a mixin/function? And any input to how i would do that? The code i got: $icons : ( 'arrow--down--full' '\e806', /* '' */ 'cog' '\e805', /* '' */ 'info' '\e807', /* '' */ 'arrow--down' '\e800', /* '' */ 'arrow--left' '\e801', /* '' */ 'arrow--right' '\e802', /* '' */ 'arrow--up' '\e803', /* '' */ 'close' '\e804', /* '' */ 'search' '\e804', /* '' */ 'spin' '\e809' /* '' */ ); And my lookup //Working index($icons, 'search' '\e804'); //Not working, but what i want to achieve index($icons, 'search');
It sounds like what you're talking about is a hash or lookup table, which Sass does not currently have. However, you can easily work around that in a variety of ways. Here are some examples. You could structure your list a little differently: $icons : ( 'arrow--down--full', '\e806', /* '' */ 'cog', '\e805', /* '' */ 'info', '\e807', /* '' */ ... ); I've added a comma after each item. Now to look it up you'd write a function like @function lookup($list, $key) { @return nth( $list, ( ( index($list, $key) ) + 1) ); } And call it like so lookup($icons, 'cog'); // => '\e805' You could push this a little further by making 2 different lists and then associating them via a similar function: $icon-keys: ('arrow--down--full', 'cog', 'info' ... ); $icon-values: ('\e806', '\e805', '\e807' ... ); I've lined up the values with whitespace only to make them more legible to me so that they appear a bit like an actual table, but there are tons of ways of writing Sass lists, and you may prefer another. Then the function that associates them: @function lookup($lookup-key, $all-keys, $all-values) { @return nth($all-values, index($all-keys, $lookup-key)); } And using it: lookup('cog', $icon-keys, $icon-values); // => '\e805' For my tastes, these are both a bit clunky so I'd make a shortcut function to make it a bit more legible: for the first variation: @function icons($lookup-key) { @return lookup($icons, $lookup-key); } for the second: @function icons($lookup-key, $types: $icon-keys, $values: $icon-values) { @return lookup($lookup-key, $types, $values); } so you could just in either case call icons('cog'); You'd probably want to put a little more logic in your lookup functions to error catch, and you could also expand it to both accept and return a list rather than a single value, but this is just a basic example.
0.777778
How to structure a hash or lookup table?
custom fields in e-mail module's contact form
I'm using EE's built in e-mail module for a contact form on my site. I'd like to add additional fields to the form that it doesn't have out of the box. I know freeform by solspace will do this, but I was hoping there is a way without spending $100 on a plugin.
EE's contact form does not support custom fields per se (i.e., it doesn't support the custom fields you'd use for your channels), but you can have multiple fields populate the message by naming each with an array syntax: <label for="message">Your Message</label> <textarea name="message[]" id="message"></textarea> <label for="how">How did you hear about us?</label> <textarea name="message[]" id="how"></textarea> <label for="age">How old are you?</label> <select name="message[]" id="age"> <option value="16-20">16-20 years</option> <option value="21-30">21-30 years</option> <option value="31-40">31-40 years</option> </select> (Docs.) I'll also point out that there is a free version of Freeform 4 which lets you add as many fields as you like to your message - just not all of the custom field types.
0.777778
EE's contact form doesn't support custom fields per se
What's the difference in meaning between "emigrate" and "immigrate"?
What's the difference between emigrate and immigrate? They seem to have the same definitions in the dictionary but they are antonyms...  
In my experience, as an Indian ex-pat living and working in the UK: If you're white-skinned and you move to another country you're said to have emigrated. If you're not white-skinned and you move to another country you're an immigrant.
1
Indian ex-pat living and working in the UK
Why does SFDC create a Lead via the LMA, but Checkout creates an Account when a payment is processed
I understand a Checkout transaction is "sold" - does SFDC just expect the ISV to convert the lead created via the LMA? It would be great to hear what other ISVs are doing here.
This behavior follows the methodology design of salesforce.com. A lead is an unqualified sale opportunity, and an account is a closed sale. The idea is that sales associates would follow up on LMA-created leads to try and close the deal, while those that subscribe would be listed as accounts (so you can track the opportunities, customer portal access to cases, and so on).
0.888889
a lead is an unqualified sale opportunity and an account is a closed sale
Formatting p value in scientific notation to conventional
Ho do I get the conventional p value (in decimal places) when every time I get these scientific notations? I tried format option but still get the same > format(1.3e-12, width=5) [1] "1.3e-12"
format(1.3e-12, scientific=FALSE) [1] "0.0000000000013"
0.777778
format(1.3e-12, scientific=FALSE)
Some way to identify the source of a notebook file?
Is there a way to tell where a Mathematica file came from, meaning some type of machine ID (yes, I know about $MachineID). I want to be able to identify students who are sharing files, i.e. one student creating the file and giving it to others. Anti-cheating is what I'm trying to accomplish.
Mathematica notebook files are plain text files. This means that you can open them up with a text editor and check their contents. Notebook files don't seem to contain any information that could be used to track their source (the computer on which they were created). What it does contain, and you might be able to use, is the creation and modification dates of all cells (CellChangeTimes cell option). You can access this information using the Front End as well. Go to Cell -> Notebook History.... It will give you a window that will show the modification times of each cell (an interval for each single edit that happened in the notebook's lifetime), to 1-second precision. You can click a line in the graph view to select that cell and see the creation and last modification time, or you can click "Copy raw data" to get all the data (use DateList to convert them to something more human readable from the AbsoluteTime format). If two homework submissions have the same modification times, up to the second, then it's likely they have a common source. With a bit of programming you can automate the process of checking all submissions against each other, and selecting those whose first few modification times coincide.
0.888889
Mathematica notebook files don't contain any information to track their source
Shape of rotating rope (lasso problem?)
Let's take a wire or a rope. I usually do this with a chain or my scarf. I fixate one end in my hand and apply rotation (by subtle movements of this endpoint like spinning a lasso). The rope gets into rotation and obtains certain bent shape: Some part is missing because cellphone cameras ain't great for high-speed photos but I hope you can imagine all the scarf. The question is: how can I calculate/predict this shape? Although this problem doesn't seem that bizarre, I have never seen any solution. Nor I have found this question asked anywhere on internet... Must be because I just don't know how to formulate it without pictures. Also by taking longer rope I get more than one bend: I apoligize for the quality again. It is even harder to rotate this while taking picture. The form is not spiral, it is more like a shape in a plane that's rotating. I'll be thankful for explanations, solutions, links or at least a correct formulation of this problem.
It's an interesting problem. I've tried to study it neglecting the air friction, which is likely to be nonnegligible. So let's parametrize the rope of length $L$ by the vector $(z(l), r(l))$, with $l$ being the curviligne coordinate along the rope and $(z,r)$ the cylindrical coordinates of the rope (I've omitted $\theta$, which can be assumed to be constant in the rotating frame [see my comment below this post for a justification of this omission]). In the rotating frame, the potential energy of the rope is $$E_p=\int_0^L \mu dl\left(gz-\frac12\Omega^2r^2\right)$$ and the definition of the curviligne integral gives the constraint $r'^2+l'^2=1$. So the problem can be translated into minimizing the following quantity : $$\begin{align} \int_0^Ldl \mathcal L(z,r;z',r';l) & & \text{with } \mathcal L(z,r;z',r';l)=\mu gz - \tfrac12\mu\Omega^2r^2 - \lambda(z'^2+r'^2). \end{align}$$ One should not forget (as I did in a first tentative answer) that the Lagrange multiplier $\lambda$ depends on $l$/ It is a standard Euler-Lagrange problem and its solution is given by $$\begin{align} \frac{\partial\mathcal L}{\partial z}-\frac{d}{dl}\frac{\partial\mathcal L}{\partial z}&=0& &\text{and}& \frac{\partial\mathcal L}{\partial r}-\frac{d}{dl}\frac{\partial\mathcal L}{\partial r}&=0& \end{align}$$ The equation in $z$ becomes $$\begin{align} \mu g&=-2\frac{d}{dl}(\lambda z')& \lambda z'&= -\tfrac12 \mu g(l-l_0), \end{align}$$ where $l_0$ is an integration constant. For the optimal solution $z'\le 0$, since replacing $z' by -|z'|$ can only decrease $\mathcal L$, ans we have $z'=-\sqrt{1-r'^2}$. One has therefore $$\lambda=\frac{\mu g(l-l_0)}{2\sqrt{1-r'^2}}$$. The equation in $r$ is then $$-\mu\Omega^2r=-2\frac{d}{dl}(\lambda r') =-\frac{d}{dl}\frac{\mu g(l-l_0)r'}{\sqrt{1-r'^2}}$$ We have then the following equation to integrate $$0=\frac{\Omega^2}{g}r(1-r'^2)^{3/2}-r'(1-r'^2)-(l-l_0)r''.$$ I don't know how to integrate it analytically, but when $l-l_0<0$, it seems that we can have oscillations. Edited to add : If one looks at the signs of $r'$ and $r''$ as function of $r$ and $r'$ for a fixed $l$, one can quickly draw some arrows in phase space (i.e.) and see that the flow goes "in circles" when $l<l_0$ and tends asymptotically to the curve $\frac{\Omega^2}{g}r=\frac{r'}{\sqrt{1-r'^2}}$ when $l>l0$. So one can expect a finite number of oscillations of the rope. But the whole question is then how $l_0$ relates to the parameters of the system. Edit: In the limit of almost vertical rope ($r'\ll1$), the equation becomes $$0=\frac{\Omega^2}{g}r-r'-(l-l_0)r''$$ which is simpler. And indeed, Wolfram Alpha has an analytical solution using modified Bessel functions.
0.888889
How do we integrate a nonnegligible air friction in a vertical rope?
combining if conditions inside a lambda
I have the following code: if (ListOfMyModel.Any(a => a.SomeID != 0 && IsAuthorizedOnID(TheUserID, a.SomeID) == false) == false) { return true; } Basically, I have a list of objects and I replaced a foreach loop with .Any() to which I'm passing in a lambda expression. This code should only return true only if a) all the objects that have SomeID not equal to 0 are authorized in the second function but don't worry about the authorization for the objects that have SomeID equal to 0. Is my expression correct or are there cases where this may fail? Thanks.
Instead of adding all of that negation, you should write in code exactly what you wrote in your description: If every user has ID zero or is authorized. return list.All(a => a.SomeId == 0 || IsAuthorizedOnID(TheUserID, a.SomeID));
1
If every user has ID zero or is authorized
Is there a quick way to delete Foldered bookmarks directly from Safari bookmark bar?
I like to group my bookmarks into Folders in the Bookmark Bar. But I cannot find an easy way to delete these bookmarks! The only way I know to do this is to go to Show All Bookmarks, then browse down to the shortcut and select it and delete it - this totally gets in the way of workflow. Is there any way to delete a Foldered bookmark from the bookmark bar?! NB - I am not talking about standalone bookmarks, deleting those is easy and intuitive.
Just delete the whole safari folder in the library directory
1
Delete safari folder in library directory
Views - Custom Field Layout?
I'm looking for direction on how to format the field layout of a view. Here's the layout I'm looking for: -------------------------------------------------- | Field1 | Field2 | Field3 | | Field4 | Field5 | | -------------------------------------------------- | Body | | | | | -------------------------------------------------- Using the "column" selection in the table settings, I'm able to "combine" fields into a single column (i.e. Field1 and Field4), but I'm stuck on how to display the Body under all the other fields in a cell that spans the whole table. Suggestions? I realize there are many ways to achieve my goal, in fact I've found this video that seems to be exactly what I'm looking for, but is this an overkill?
For precise control over views markup I usually take a departure from typical Drupal methods. I set the view to be a table format, then create my own view template. The reason I use the table format is that it's really easy to work with and has a simple loop through each row of the results returned from the view. From there, you can create your own markup using just the field values from each row. Check this link: https://api.drupal.org/api/views/theme!theme.inc/group/views_templates/7 Here's some shortcuts to get you started quickly. In your theme's directory, create a file called: views-view-table--NAME-OF-YOUR-VIEW.tpl.php Inside that file, start by pasting the source from this (click View source on the page): https://api.drupal.org/api/views/theme!views-view-table.tpl.php/7 Then, clear your site's cache. Your view will now be using that new template and you can edit as required.
0.888889
Create a view template using a table format
Why isn't "Column ordering" available in my list settings?
I want to change the column order visible when viewing or editing a list item. I have accessed the "Column ordering" interface via the list settings page on other lists in the past, but it isn't visible in this list's settings. Cheers!
Change the order of the columns in the list's settings (or the content type)
1
Change the order of the columns in the list's settings
Can the socket in my recessed light be replaced without replacing the entire framing kit?
I have recessed lighting in my living room. One of the bulbs went out. I tried replacing it with a fresh one, but no luck. There is electricity flowing to the socket, but the socket appears to have gone bad. I bought a replacement socket at Home Depot, but upon disassembling the light, I realized that I might not be able to replace the socket alone. I have a Lightolier Lytecaster 1102 Frame-In-Kit. Details here: http://www.lightolier.com/MKACatpdfs/1102D1.PDF http://www.lightolier.com/MKACatinstr/IS_1102.PDF It doesn't look like the socket can be removed from the porcelain socket housing. Does this mean I have to replace the entire framing kit? I tried calling Lightolier support, but so far I've only gotten an answering machine. Here are photos of the enclosure: And how the socket is fastened: SOLVED: See Dan's answer below. I don't know how I missed it, but inside the socket there are screws. The socket is not riveted to the enclosure. Alas, I did have to buy the whole Frame-in-Kit to get the correct socket, but at least I didn't have to remove the entire frame from the ceiling. I just unscrewed the socket and screwed in the new one.
Bad news, the socket is riveted in, so unless you're prepared to drill the rivets out and a socket that hasn't already been riveted, you're hosed. The A/C looks attached to the housing, which is weird - but I can't be sure. However I cannot imagine a safe and legal way to disconnect the housing from the armored cable and connect the new one that wouldn't create a hidden junction. Looking at the PDFs, you MIGHT be able to detach the ... I guess it's the transformer? and socket housing from the frame mounting and replace it.
1
How do I disconnect the housing from the armored cable?
Index "server_name" not exist
I try to execute a bat, and in this file i try to acceed to this variable : $_SERVER['SERVER_NAME'] But it doesn't exist this index. In fact, when i try to print_r($_SERVER), there is no SERVER_NAME index. There is a reason ? Is it because i launch this function in a bat ? Have I an other solution for get this variable ? Thank you !
Try echo %COMPUTERNAME% instead if you are launching through a bat-file.
0.777778
echo %COMPUTERNAME% instead if you are launching through a bat-file
Why is the potential function defined differently in physics and calculus?
I am very familiar with the concept of a potential function, and potential energy, from calculus-based physics. For instance, if we have the familiar force field $\mathbf{F} = -mg \,\mathbf{j}$, then a potential function is given by $U = mgy + C$. (Since potential energy is relative, we have an infinite number of potential functions.) Notice that the gradient of the potential function is the negative of the force field: $$\nabla U = \nabla(mgy + C) = mg \,\mathbf{j} = -\mathbf{F}.$$ That was perfectly fine with me. But now in vector calculus, I am reading that the potential function $f$ of a vector function $\mathbf{F}$ is such that $\nabla f = \mathbf{F}$. A negative sign appears to have been lost when migrating from physics to calculus. It seems confusing to call $f$ a "potential function", since it cannot be interpreted as potential energy in the real world. So why is the calculus nomenclature as it is (i.e., why not call this something else and then say the potential function is the negative of it)?
After reading further on in my calculus textbook, I found that they later defined the potential energy as the negative of the potential function. So it appears that the reasoning presented in my question was correct, but that some sources simply use a slightly different definition for "potential function" – not because it corresponds to potential energy, but because a convenient name is needed for it. Wikipedia says that the gradient of the potential is the negative of the vector field, but that "In some cases, mathematicians may use a positive sign in front of the gradient to define the potential."
0.888889
Wikipedia defines potential energy as the negative of the potential function
Protractor test vs long-polling
I have an Angular web app that continuously listens for notifications from the backend via long-poll: scope.notification = $resource('/notification').get(); This request never completes in the test environment. This is a problem for Protractor, because it wants to wait for all outstanding HTTP requests to finish. I see a number of potential solutions, but have some issues with all of them. I do not see a way to tell Protractor to ignore this request. Issuing it from $interval (which itself is ignored) is not a solution. Protractor will not wait for the request to be sent, but once it's sent, it will still wait for it to complete. So I'm trying not to send this request when running the tests. But how do I know I'm in a test? I could add a flag to the URL (?protractor=true). But my web app modifies the URL all the time, so it would get cleared quickly. I tried setting a variable: browser.executeScript('window.runningProtractorTests = true;'); But it seems Protractor will wait for the page to sync first before running executeScript. And I'm sending the request right away when the page loads. I could set a cookie. But it's fairly cumbersome, e.g. I'd have to load the page twice. (See issue 341 for more difficulties.) I could set a user agent. It's not easy either. I would need to set browser flags for each browser in the config file. I do not want to completely override the user agent (to Protractor, for example) out of fear that my libraries may rely on interpreting the user agent string, so I'd have to figure out the right string. I could check if the server is running on a specific port. But then a year from now someone will try to run the production server on the same port and not understand why the notifications don't work. Making the test backend complete the request immediately does not help, because it's immediately sent again whenever it completes. But I guess I could introduce a special "you are in a test" notification and stop the polling when this is received. This would mean a (small) change to our protocol, so I'd rather avoid it if possible. Is there no straightforward way to do this?
Can you put the calls to $resource into a service which you mock out using Protractor's browser.addMockModule()? That way, Protractor will always override your original service before it has a chance to run. This could look something like // in your application myModule.service('myNotificationService', function($resource) { this.notification = $resource('/notification').get(); }); // In your Protractor test browser.addMockModule('notificatonOverride', function() { angular.module('notificationOverride').service('myNotificationService', function() { this.notification = {}; // or whatever you need here. }); });
0.777778
Can you put $resource calls into a service that you mock out using Protractor's browser.addMockModule
False positive Apache version in scanner results on Centos
Recently I need to care a lot of false positive vulnerabilities in scanner results on Apache version. Example of false positive vulnerability: Apache 2.2 < 2.2.16 Multiple Vulnerabilities Our customers run scanners and they check Apache version related to the official Apache version numbering. We use Centos, and the Apache version numbering is different from the official Apache version numbering. For example now we install httpd-2.2.15-26.el6.centos.x86_64 and it includes all security patches released by Apache in recent versions. The Centos Apache version numbering relies on the RedHat Apache version numbering and they do not change the base number (httpd-2.2.15) each update. But scanners do not “understand” this and check that 2.2.15 < 2.2.16. Can you point me to the good document that explains the RedHat Apache version numbering? Do you know if exist scanner that “understand” the RedHat Apache version numbering?
What you're experiencing is a common problem. Vulnerability scanners that rely upon service banners do not deal with vendors like Red Hat which backport security updates. They are also prone to making assumptions about configuration that lead to false positives. You may be able to improve the accuracy of the scan by running an credentialed scan. If your scanner supports it, you can specify account credentials that it will use to log in and look at "internal" information. For example, it can use 'rpm' to determine which actual Apache package is installed, and base its verdict upon that rather than the banner that the service prints to external scanners. Such a scanner should have access to an up-to-date database that will tell it what the real issues are. If your scanner won't do it, then the usual solution is to do it yourself. You would need to look up whether you're running the newest version. For example, @Rook points out that there are Apache vulnerabilities newer than the package you reference. Looking at those vulnerabilities, you can pull the CVE ID and look it up in Red Hat's CVE Database. For example, their entry for CVE-2013-1862 points you to the errata RHSA-2013:0815 which says that httpd-2.2.15-28 contains fixes for that CVE. It also points out that there's a newer RHBA release, so there's a newer package with bug (but not security) fixes. Repeat that process for any other CVEs that you're concerned with and you can make an educated decision about whether you're patched despite what the banner says. If the CentOS package is a direct correlation to the RHEL package, you should be fine - but the RHEL package was announced on 5/13, so I don't know how @Rook's cited 3/2 release date jibes with that. (The shortest version, BTW, is "yeah, this stuff is a known PITA.")
0.888889
Vulnerability scanners that rely on service banners do not deal with Red Hat which backport security updates
Errors when importing a MySQL database
Trying to make a local copy of a live ExpressionEngine site, my process stop when importing the live database. I'm using EE 2.5.5 and several key add-ons like Publisher, Playa, Matrix and CE Cache. I made the import using Sequel Pro and I just click "Ignore errors". I can see the control panel and everything seems to be OK in the backend. I noticed though that I have to install all the add-ons. But then, these are the MySQL errors I got when importing: [ERROR in query 52] Duplicate entry '5' for key 'PRIMARY' [ERROR in query 72] Unknown column 'field_id_2' in 'field list' [ERROR in query 73] Unknown column 'field_id_2' in 'field list' [ERROR in query 74] Unknown column 'field_id_2' in 'field list' [ERROR in query 75] Unknown column 'field_id_2' in 'field list' [ERROR in query 76] Unknown column 'field_id_2' in 'field list' [ERROR in query 77] Unknown column 'field_id_2' in 'field list' [ERROR in query 78] Unknown column 'field_id_2' in 'field list' [ERROR in query 79] Unknown column 'field_id_2' in 'field list' [ERROR in query 80] Unknown column 'field_id_2' in 'field list' [ERROR in query 81] Unknown column 'field_id_2' in 'field list' [ERROR in query 82] Unknown column 'field_id_2' in 'field list' [ERROR in query 83] Unknown column 'field_id_2' in 'field list' [ERROR in query 84] Unknown column 'field_id_2' in 'field list' [ERROR in query 85] Unknown column 'field_id_2' in 'field list' [ERROR in query 86] Unknown column 'field_id_2' in 'field list' [ERROR in query 87] Unknown column 'field_id_2' in 'field list' [ERROR in query 88] Unknown column 'field_id_2' in 'field list' [ERROR in query 89] Unknown column 'field_id_2' in 'field list' [ERROR in query 90] Unknown column 'field_id_2' in 'field list' [ERROR in query 91] Unknown column 'field_id_2' in 'field list' [ERROR in query 92] Unknown column 'field_id_2' in 'field list' [ERROR in query 93] Unknown column 'field_id_2' in 'field list' [ERROR in query 94] Unknown column 'field_id_2' in 'field list' [ERROR in query 95] Unknown column 'field_id_2' in 'field list' [ERROR in query 96] Unknown column 'field_id_2' in 'field list' [ERROR in query 97] Unknown column 'field_id_2' in 'field list' [ERROR in query 98] Unknown column 'field_id_2' in 'field list' [ERROR in query 99] Unknown column 'field_id_2' in 'field list' [ERROR in query 100] Unknown column 'field_id_2' in 'field list' [ERROR in query 101] Unknown column 'field_id_2' in 'field list' [ERROR in query 102] Unknown column 'field_id_2' in 'field list' [ERROR in query 103] Unknown column 'field_id_2' in 'field list' [ERROR in query 104] Unknown column 'field_id_2' in 'field list' [ERROR in query 105] Unknown column 'field_id_2' in 'field list' [ERROR in query 106] Unknown column 'field_id_2' in 'field list' [ERROR in query 107] Unknown column 'field_id_2' in 'field list' [ERROR in query 108] Unknown column 'field_id_2' in 'field list' [ERROR in query 109] Unknown column 'field_id_2' in 'field list' [ERROR in query 110] Unknown column 'field_id_2' in 'field list' [ERROR in query 111] Unknown column 'field_id_2' in 'field list' [ERROR in query 112] Unknown column 'field_id_2' in 'field list' [ERROR in query 113] Unknown column 'field_id_2' in 'field list' [ERROR in query 114] Unknown column 'field_id_2' in 'field list' [ERROR in query 115] Unknown column 'field_id_2' in 'field list' [ERROR in query 130] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 141] Duplicate entry '2' for key 'PRIMARY' [ERROR in query 143] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 183] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 362] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 365] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 368] Duplicate entry '1-1' for key 'PRIMARY' [ERROR in query 370] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 379] Duplicate entry '3' for key 'PRIMARY' [ERROR in query 724] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 726] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 737] Unknown column 'sess_start' in 'field list' [ERROR in query 739] Unknown column 'site_pages' in 'field list' [ERROR in query 743] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 748] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 750] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 752] Duplicate entry '1' for key 'PRIMARY' [ERROR in query 786] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 My concern is that this is going to create problems in my local site, which I need to be in pretty good shape as next step is going into Git workflow and deploy changes to remote, etc. Any idea? Sergio
You should never have to reinstall addons locally if you are pulling files/DB from production properly. If you are having this problem, the issue is most likely related to how you are doing the migration. I'd suggest your errors are caused by your exported SQL not including DROP TABLE and you aren't manually dropping the tables in the DB before your import. To test my theory, delete all tables in your local DB and then do the import... Same errors? If no errors, then you'll need to manually drop tables before importing or get your import to include the DROP TABLE syntax.
1
How to reinstall addons locally?
Results with and without interaction
I'm working on an analysis with another person. First we did a logistic regression with study group and variable X. They were both significant. Then we added the interaction between study group and X only the study group and the interaction were significant. Actually, there are 3 groups and only one of the groups and one of the group*X interactions is significant. I am having a hard time to convince this person that we should not present the odds ratios for X from the first analysis that do not account for this interaction. This person thinks that we can show the results of the first analysis AND then the second analysis. I think this is misleading and will confuse people. I am not the best at explaining things (as you can tell), so any help with how to argue my point would be appreciated.
The interaction means the effect to X in the response Y is different in the categories defined by the Group variable. Sometime it is useful to do a stratified analysis, by Groups, where you analysis the effect of X in Y in each group. You should see the effects are different. You could present these stratified analysis and show the P-value of the interaction for justify the stratification.
0.888889
The interaction means the effect to X in the response Y is different in the categories defined by the Group variable
Board Game Mechanics
I find myself always purchasing games that have similar game mechanics. I prefer worker-placement games, and railroad tycoon type games. All of these games borrow from each other in terms of how the game plays. I find this type of game suits my strategic style of play. I now want to introduce something new to my gaming group, and want to know what type of game mechanics I am really missing out on, and why they add to the overall experience of the game. What I want to know is what other type of game mechanics make a game more interesting to play, increase the strategic element and really make the game what it is. The type of thing I am after is similar comments to a conversation at my last gaming meeting, which was I much prefer Age of Steam to Railroad Tycoon, because of the way the resources are replenished. Where as Railroad Tycoon can dry up a city's resource quite quickly.
I would suggest you try something with auctions or haggling. They provide immediate player interaction, but they also have strategic depth. (How much is this worth to me? How much is it worth to you?) One of the most popular games that I've played using auctions is Medici. A paper and pencil game that distills auctions and stock markets to their essence is Eric Solomon's Middleman. One of my personal favourites is Basari, and it's unusual in that I think it's best for three players.
1
How much is auctions worth to me?
can i make an outlined path thicker in illustrator?
i have downloaded some svg icons form the web which are all outlined paths. In illustrator i would like to make those paths thicker. Is there a way to do this? I know when a line is still in stroke-mode you can just adjust the size of the stroke, but once this has been converted to outlines i don't know if this is still possible? thx
Yes, you can make the outlined path thicker. Simplest way is to just apply a stroke on the outlines. This will then be added to your stroke (so remember it needs to be 1/2 the additional weight you need). Closed outlines may need this done to both sides. A bit more cleaner way would be to offset the outline. I suggest using Effect → Path → Offset Path... as its nondestructive so you can change your mind later (as opposed to Object → Path → Offset Path...). You can then later expand this if you need to bake the effect in. Image 1: Offset the path to create thicker (for thinner use negative values) outlines. It is also possible to reduce the outlined stroke back to a stroke. To do this measure the distance between the outlines and then delete the other side and offset by half the distance. This is slightly less work for closed paths as you dont need to clean up after yourself. Image 2: Reversing the expanded path back to a stroke.
0.777778
How to make the outlined path thicker?
Effective game mechanics for handling conflicts with spirits
A very effective set piece can be conflict with the spirit world. A nice example of the kind of thing I am thinking of is from the 1982 Conan film, where the wizard opens a gateway to the spirit world to get demons to revive Conan, and where Valeria fights incorporeal demons to save Conan (YouTube, from 6:45 into the clip to the end & onto next clip). RQ3 had nice mechanics for dealing with these situations, with shamans who can take characters to the other side through their fetch, spirit combat to handle attacks by hostile spirits, using magic points as an orthogonal measure of strength to hit points. AD&D was pretty lousy for this kind of thing back in the day: its distinction between combat involving the incorporeal attribute or in the ethereal and astral realms didn't really work for setting up situations. But newer D&Ds seem to have better resources, though I've not seen this in action. What good game mechanics are there for handling conflicts with spirits? Postscript The kind of thing game mechanics need, I think, to sustain interest in spirits and spirit combat are: Spirits are immaterial and that means you have to do different sorts of things to influence them. E.g., if the best way to deal with an ancient ghost is to chop it up with an axe, that'll spil that atmosphere a bit; Likewise, spirits are potentially powerful adversaries. Not very high-powered spells that can get rid of most spirits with a 65% chance of success detract from interest; Characters can be experts in spirits, and it is good if the nature of those experts draws on resonant real-world and fictional atmospheric devices such as shamans, ancestor worship, fetches, and the like. It's also good if characters regularly need the services of these figures.
White Wolf's nWoD (particularly Werewolf: The Forsaken and Mage: The Awakening, afaik) has real extensive support for stories involving the spirit world(s) and spirits, well built rules that could easily be tweaked further to allow for homegrown settings independent of nWoD as well. (The old versions of these games would work great too, though the new one's general system - Storytelling - is more streamlined, so I'd go for that one instead of the old Storyteller system.) Edit: Here's a link to a summary of nWoD's spirits. Without having read the abovementioned books (and the core), parts of it will naturally be hard to understand, yet even by skimming it you may get a general picture of how Storytelling views and handles spirits by default.
1
White Wolf's nWoD (particularly Werewolf: The Forsaken and Mage: The Awakening
Should I always hibernate instead of shutting down?
I'm using Windows XP and I hate the long start up time when I shut down and then turn on my laptop. However if I hibernate instead of shutting down it starts up much faster. Are there any harmful effects / disadvantages if I always hibernate whenever I'm done for the day instead of shutting down?
In theory hibernation dumps the memory to the drive and allows "almost instant" powerup. I personally don't care for it. It is aimed primarily at laptops and will create a file that is the size of your physical memory that you cant delete. I say if you arent having any problems with it and like what it does keep using it.
1
Hibernation dumps the memory to the drive and allows powerup .
how to combine two objects using path finder in illustrator?
i want it to be like this but when i click the minus front, both objects got cut out like this; so how? how do you combine it like in the first picture? here the 2 original objects before i click minus front;
The Pathfinder Toolset is very good for some tasks, but it's not the only boolean operator in Illustrator. The Shape Builder Tool (Shift+M by default) is what I would recommend in this case. If you hold down Shift, you can delete the sections of lines that are between intersections of selected Items.
0.666667
Pathfinder Toolset (Shift+M by default)
should have done vs should had done (sequence of tenses)
imagine you want to use "should have done" in a subordinate clause when there's some past tense in the main clause. e.g.: "He said I should have(had?) done it." which one is correct? or should i use some other modal verb for this purpose? thanks
*should had done is totally off (* means incorrect). In how many great writers' work have you found it? In how many grammars? Well?
1
How many great writers have you found it?
When 'business' means a 'company', how do I use the word?
Business can sometimes mean company or firm. However, can it be used in the way company or firm are used? For example, can I say:- "He is the CEO of the business." "It's a TV business." "A business dealing with drugs."
Short answer: Yes. All those examples make sense.
1
Answer: Yes.
possible different ways to get the kanto starters and ways to get fossils in x and y
hi there I was wondering if you guys would happen to know the most effective ways to get the kanto starter pokemon because using friend safari seems kind of ineffective and slow. also how would one obtain fossils aside from the original glittering cave ones thanks
'Most effective' ways might be subjective. I do prefer the Friend Safari because of the guaranteed 31 IVs in at least 2 stats; which can't be easily obatined otherwise unless you search thoroughly. Usually you can trade; friend, GTS, acquaintance and people sometimes put pokemon with 31 IVs in particular stats in GTS (you can identify them with their description, for example 31 HS usually means 31 IVs in HP and Speed). You could say that this one's a lot faster, but it really depends on when you check GTS out. For instance, starters would be easily obtained early after the release, and I haven't been there lately but I think that the GTS activity might have died down a bit when compared to before. For the fossils, again you can use the GTS if you don't have someone willing or able to trade you one. Another option though is to check out the Glittering Cave and Rock Smash boulders again and again (just exit the main cave and come back in to have the boulders appear again) though you might consider this as taking a long time. Took me a few days to be able to get at least one of each fossil (of course I didn't just look for fossils)
1
'Most effective' ways might be subjective
Changing PhD topic and effect on career
I'm a PhD student in my third year (4-6 is common in my country) and seriously consider abandoning my current topic. The new topic is in the same general field (CS related), yet in a vastly different domain and would need a quite different methods. My advisor suggested this switch, he could keep me funded in both cases, yet probably better with the new topic. Arguments for switching are both personal interest in the new topic (it's recently trending, I was interested from the beginning, yet few positions were available) and lack of progress in the current area: I could produce some publications, yet not up to my advisors expectations (should be easier with the new topic, given the impact factors of the journals my advisor suggested) For the last 6-8 month I made barely any progress (lots of failed experiments) I would probably have to abandon my current methods anyway due to 1./2., so half a year or so will be lost learning new methods no matter how I decide Yet I shy away from switching, mainly due to already being quite old (combination of personal problems and a switch of my major as an undergraduate) and fearing how my C.V. would look if I did take about a year longer and had this second switch... Thanks for any input.
For the last 6-8 month I made barely any progress (lots of failed experiments) This sounds like you have not treated your prelims as a contract negotiation. The best advice I've received is that when you pitch your thesis topic to the committee, make sure that everyone agrees on the structure and methodologies involved. That way, if your work falters or your experiments fail, but you followed the guidance outlined by your committee, then you have still earned a pass. Another piece of great advice is this: nobody is going to read your thesis. Do not switch your program and do not start over, just complete the tasks you were given and move on. If you decide to switch fields later on, fine... that's normal, reasonable, and expected. And just because you're studying one thing in school doesn't mean that's what you have to do for the rest of your life. There have been plenty of PhDs that completely jumped fields of study, out of CS and into sociology for example... or vice versa. Besides, the latest rage these days is adding "multi-disciplinary" to your grant proposals.
1
Do not switch your program and do not start over, just complete your tasks and move on .
Facing Problems While Installing Java
First When I downloaded java from official website I got confused how to install it. Then I searched it on software center and I found it. But when I install it, it starts but instantly stops and the line highlighting the installation status in progress tab doesn't move forward. Then I searched on the internet and tried installing it by terminal, but the terminal said that I first have to configure something that I dont know. It tells me to run this sudo dpkg-configure -a and when I run this command the terminal process stops in the middle and even after leaving it for about an hour it doesn't proceed. After that when I want to close the terminal, it says that the terminal is in hte middle of a process, and closing it would interrupt it. So I am greatly confused because even other software, like gimp image editor, are not getting installed. Can anyone help me? Thanks in advance.
Try this. This worked like a dream. http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux
0.777778
How to Install Oracle-Java-on-Ubuntu-Linux
Which Windows 7 to install?
I have 2GB of RAM on my laptop, which is the max. Should I install 32 bit version or 64 bit version?
64 bit handles ram more effectively than 32 bit (i.e. u need to have more than 4gb) Word of caution though before you install make sure that you can locate 64bit drivers (for your laptop) and 64 bit compatible software (depends on what software you use) especially if you are going to be running 3D applications. If all the above parameters are certain then I'd say go with the 64 bit version Edit: Atleast in terms of 64bit Windows Vista i have seen a marked difference in performance of 3D applications (3D Max and Maya) when compared to the 32 bit version (the configuration of the computers the OS was installed on being the same)
1
64 bit drivers (for your laptop) and 64 bit compatible software
any FAST tex to html program?
(im using debian squeeze) i tried catdvi (but its unacceptable - just a lot of '?'s) now i am using tex4ht but its awfully sloow.. for example generating html for this : takes ~2 seconds (thats 4+ times slower than generating the image !!!) is there something wrong with my config or is tex4ht really that slow? (i doubt theres something wrong with my config) are there any other(FAST) reliable tex2html converters?
As already suggested, if you want equations in a web page, MathJax will process TeX math code into proper math display.
0.888889
MathJax will process TeX math code into proper math display
Converting Qt compliant C++ to ui XML(QtDesigner) format:
I have C++ widget code that was generated by QtDesigner (Qt open source v 4.7.3, using the Form->View Code menu in QtDesigner). I have modified that code in a manner that is entirely Qt compliant - just hand coded a few more signals, slots and wigdets based on the patterns of the generated code - code runs perfectly when built with Code::Blocks. Now I'd like to convert my modified C++ source back into the ui XML format that QtDesigner uses. I'm looking for a quick way of doing that (Win7-32 platform). Any suggestions? TIA
The c++ is a really complex language to parse, so it would be really hard / long / expensive to develop such a tool I guess. The general rule is to never modify generated code ( in your case the code is generated by Qt designer) You can Subclass the generated class and put your modifications in the sub class Code all your interfaces by yourself from scratch. If you think Qt designer lack features you can request them or submit patches to Qt. But I don't think Qt intend to extend that, since QML has become the new way to go with interfaces. The best option for you is probably the first.
0.888889
c++ is a really complex language to parse, so it would be really hard / long / expensive to develop such
Direction of Tefillin Winding
Why do some people have the custom to wind the Tefillin-Shel-Yad towards themselves, while others wind it away from themselves? What is the reason behind these two customs, and which sects of Judaism generally follow which method?
In my (predominantly Ashkenazi) school where we learned about Tefillin, we were taught that the reason for wrapping inwards is that it is towards your heart, thereby making a statement (over the top...) of the love that you (... towards your heart) has for the mitzvah of Tefillin.
0.888889
Tefillin is towards your heart, making a statement (over the top...) of the love that you have for the mitzvah
How to install jekyll?
According to the jekyll site, this is how you make a new website with jekyll: ~ $ gem install jekyll ~ $ jekyll new myblog ~ $ cd myblog ~/myblog $ jekyll serve gem install jekyll didn't work, nor did sudo gem install jekyll: └─>gem install jekyll ERROR: While executing gem ... (Errno::EACCES) Permission denied - /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2/LICENSE ┌─[Sat Jun 08][jon@jon-MacMini:~/Web] └─>sudo !! sudo gem install jekyll Building native extensions. This could take a while... ERROR: Error installing jekyll: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:1:in `<main>' Gem files will remain installed in /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection. Results logged to /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2/ext/gem_make.out I also tried following the answer here, but that doesn't help. sudo apt-get install jekyll works. Even then, though, running jekyll new myblog returns this error: └─>jekyll new myblog /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead. WARNING: Could not read configuration. Using defaults (and options). No such file or directory - new/_config.yml Building site: new -> myblog /usr/lib/ruby/vendor_ruby/jekyll/site.rb:126:in `chdir': No such file or directory - /home/jon/Web/new/ (Errno::ENOENT) from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:126:in `read_directories' from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:98:in `read' from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:38:in `process' from /usr/bin/jekyll:250:in `<main>' Anyone know what's causing this?
On my 13.04 and 14.04 systems, things worked for me after installing the ruby-dev package, then running the gem install: sudo apt-get install ruby1.9.1-dev gem install jekyll # if this fails then sudo gem install jekyll After that, jekyll was installed correctly. Note that for the gem install instruction, it is better not to use sudo.* It's better to use something like RVM, so that sudo isn't required. On some systems it may be necessary to use sudo, if for instance permissions were set by previous sudo commands or root-level configuration. See this stackoverflow question -- how to install gems without sudo for more information and for help on getting permissions set to user instead of root. * Credit to @iguarav for this best practices advice as well as the link to rvm.io.
0.777778
sudo gem install jekyll
Do electric fields generated by plane charges lose intensity over distance? If not, why?
Sparknotes' studyguide for the SAT II: Physics test says that for a point charge (1-dimensional, e.g. an electron), the formula for intensity of the generated electric field is given by $E=\frac{kq}{r^2}$. It also says that for a line charge (2-dimensional, e.g. a wire in a DC circuit), it's given by $E=\frac{kq}{r}$, and that for a plane charge (3-dimensional) it's given by $E=kq$. I have no example for a plane charge because I don't know what that would be, hence my question: How can a plane charge's electric field intensity NOT diminish over time? Shouldn't this violate Conservation of Energy?
A plane charge would be an infinite 2-dimensional sheet with constant charge density. Already in a line charge you have neglected edge effects, because the $1/r$ dependence holds true only near the line provided you are far away from the end-points. Similarly, for a plane, the constant electric field holds true provided that you are much closer to the plane than you are to it's edges. You make this approximation when you derive the electric field inside a parallel plate capacitor, for example. If you truly could assemble an infinite sheet of charge, conservation of energy would be the least of your worries. Good luck with the SAT.
1
infinite 2-dimensional sheet of charge with constant charge density
Seperation of drawing and logic in games
I'm a developer that's just now starting to mess around with game development. I'm a .Net guy, so I've messed with XNA and am now playing around with Cocos2d for the iPhone. My question really is more general though. Let's say I'm building a simple Pong game. I'd have a Ball class and a Paddle class. Coming from the business world development, my first instinct is to not have any drawing or input handling code in either of these classes. //pseudo code class Ball { Vector2D position; Vector2D velocity; Color color; void Move(){} } Nothing in the ball class handles input, or deals with drawing. I'd then have another class, my Game class, or my Scene.m (in Cocos2D) which would new up the Ball, and during the game loop, it would manipulate the ball as needed. The thing is though, in many tutorials for both XNA and Cocos2D, I see a pattern like this: //pseudo code class Ball : SomeUpdatableComponent { Vector2D position; Vector2D velocity; Color color; void Update(){} void Draw(){} void HandleInput(){} } My question is, is this right? Is this the pattern that people use in game development? It somehow goes against everything I'm used to, to have my Ball class do everything. Furthermore, in this second example, where my Ball knows how to move around, how would I handle collision detection with the Paddle? Would the Ball need to have knowledge of the Paddle? In my first example, the Game class would have references to both the Ball and the Paddle, and then ship both of those off to some CollisionDetection manager or something, but how do I deal with the complexity of various components, if each individual component does everything themselves? (I hope I'm making sense.....)
I recently made a simple Space Invadors game using an 'entity system'. It's a pattern that separates attributes and behaviours extremely well. It took me a few iterations to fully understand it, but once you get a few components designed it becomes extremely simples to compose new objects using your existing components. You should read this: http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/ It's updated frequently by an extremely knowledgable guy. It's also the only entity system discussion with concrete code examples. My iterations went as follows: The first iteration had an "EntitySystem" object which was as Adam describes; however my components still had methods- my 'renderable' component had a paint() method, and my position component had a move() method and etc. When I began to flesh out the entities I realized that I needed to start passing message between components and ordering the execution of components updates....way too messy. So, I went back and re-read T-machines blog. There is a lot of information in the comment threads- and in them he really emphasizes that components do not have behaviours- behaviours are provided by the entity systems. In this way you do not need to pass messages between components and order component updates because the ordering is determined by the global order of system execution. Ok. Maybe that's too abstract. Anyway for iteration #2 this is what I gleaned from the blog: EntityManager - acts as the component "database", which can be queried for entities which contain certain types of components. This can even be backed by an in-memory database for speedy access...see t-machine part 5 for more info. EntitySystem - Each system is essentially just a method which operates on a set of entites. Each system will use component x,y and z of an entity to get it's work done. So you would query the manager for entities with components x,y and z then pass that result to the system. Entity - just an id, like a long. The entity is what groups a set of components instances together into an 'entity'. Component - a set of fields....no behaviours! when you start adding behaviours it starts to get messy...even in a simple Space Invadors game. Edit: by the way, 'dt' is the delta time since the last main loop invocation So my main Invadors loop is this: Collection<Entity> entitiesWithGuns = manager.getEntitiesWith(Gun.class); Collection<Entity> entitiesWithDamagable = manager.getEntitiesWith(BulletDamagable.class); Collection<Entity> entitiesWithInvadorDamagable = manager.getEntitiesWith(InvadorDamagable.class); keyboardShipControllerSystem.update(entitiesWithGuns, dt); touchInputSystem.update(entitiesWithGuns, dt); Collection<Entity> entitiesWithInvadorMovement = manager.getEntitiesWith(InvadorMovement.class); invadorMovementSystem.update(entitiesWithInvadorMovement); Collection<Entity> entitiesWithVelocity = manager.getEntitiesWith(Velocity.class); movementSystem.move(entitiesWithVelocity, dt); gunSystem.update(entitiesWithGuns, System.currentTimeMillis()); Collection<Entity> entitiesWithPositionAndForm = manager.getEntitiesWith(Position.class, Form.class); collisionSystem.checkCollisions(entitiesWithPositionAndForm); It looks a little weird at first, but it's incredibly flexible. It's also very easy to optimize; for different component types you can have different backing datastores to make retrieval faster. For the 'form' class you can have it backed with a quadtree to speed access for collision detection. I'm like you; I'm a seasoned developer but had no experience writing games. I spent a some time researching gave dev patterns, and this one caught my eye. It is in no way the only way to do things, but I've found it very intuitive and robust. I believe the pattern was officially discussed in book 6 of the series "Game Programming Gems" - http://www.amazon.com/Game-Programming-Gems/dp/1584500492. I haven't read any of the books myself but I hear they are the de-facto reference for game programming.
0.888889
'EntitySystem' is a pattern that separates attributes and behaviours extremely well .
When should I use archaic and obsolete words?
I'm learning the English language, and while reading Merriam-Webster I often see common words with additional "obsolete" and "archaic" descriptions added to their definitions. When should I use them, should I use them at all, and what's the difference between these descriptions? Also, should I spend time to remember these archaic and obsolete meanings?
You should use obsolete or archaic words when: No other word will serve (as in a scholarly piece about history or linguistics, for example). You want to confuse your audience or make them laugh. You want to sound pretentious or pedantic.
0.888889
Use obsolete or archaic words when: No other word will serve
New to circuits, confused about where reset happens with SR flip-flop
In one of my classes we are learning about circuits. For homework, we have to create a finite state machine for a vending machine using an SR flip-flop. The machine can either take a nickel, dime, or nothing until it gets to at least 15 cents, so it has 4 states (0, 5, 10, and 15 cents). Once the machine receives 15 cents, it dispenses its product. Once in this state, if nothing is deposited it goes to the 0 state; if a nickel is deposited it goes to the 5 cent state; if a dime is deposited, it does to the 10 cent state. The truth table that I came up with is: Present|Inputs| Next | | SR Flip Flop | | | Output | Q1 Q0 |D N |P1 P0| | S1 R1 S0 R0 _______|______|_______|________|_____________ 0 0 | 0 0 | 0 0 | 0 | 0 X 0 X 0 0 | 0 1 | 0 1 | 0 | 0 X 1 0 0 0 | 1 0 | 1 0 | 0 | 1 0 0 X 0 0 | 1 1 | X X | X | X X X X _______|______|_______|________|_____________ 0 1 | 0 0 | 0 1 | 0 | 0 X X 0 0 1 | 0 1 | 1 0 | 0 | 1 0 0 1 0 1 | 1 0 | 1 1 | 0 | 1 0 X 0 0 1 | 1 1 | X X | X | X X X X _______|______|_______|________|_____________ 1 0 | 0 0 | 1 0 | 0 | X 0 0 X 1 0 | 0 1 | 1 1 | 0 | X 0 1 0 1 0 | 1 0 | 1 1 | 0 | X 0 1 0 1 0 | 1 1 | X X | X | X X X X _______|______|_______|________|_____________ 1 1 | 0 0 | 0 0 | 1 | 0 1 0 1 1 1 | 0 1 | 0 1 | 1 | 0 1 X 0 1 1 | 1 0 | 1 0 | 1 | X 0 0 1 1 1 | 1 1 | X X | X | X X X X Based on this truth table [and the k-maps I made from it], I created the following logic gates: My question is, where exactly does the "reset" happen? For example, if I am in the 15 cent state and deposit a nickel, how does it go to the 5 cent stage? Do I have to make the output from "open" loop around? Sorry for such a novice question, I hope that made sense! Edit: The first two columns are for the present state of the machine, i.e., how much you have deposited so far. So Q0 Q1 = 00 represents the first state (0 cents), Q0 Q1 = 01 represents the second state (5 cents), etc. The next two columns represent adding a nickel or dime. If you are in the state 00 and and 01, you should move to state 01. Since you cannot deposit a nickel and dime simultaneously, we don't care about the the input 11. If you are in state 10 and add 10, you go to state 11 (and don't get any change back!).
The reset, given the truth table you provided, happens just because the state 11 of the state machine is mapped in the state 00; in fact, if you look at the outputs, both states have the same next state, so if the inputs are 00 (buffer), from the state 11 it will go to 00. An optimization of the machine would use the Mealy topology, where you map the state 11 in 00 just changing the output if coming from an activating sequence. Update You can udnerstand it better using the diagrams: Moore: Small error: the arrow that goes from (10) to (11) is for both the inputs 01 and 10 Mealy:
1
The reset happens just because the state 11 of the state machine is mapped in 00
How do I get a baby dragon pet?
I have seen players with a baby dragon as pet in Stendhal. How do I get one?
There is a spider quest in the magic city school see morgrin, you have to kill spiders. Do it alone at about lvl 40 with good atk and def, take a home scroll and antidotes, potions, perhaps some pizzas. If someone already killed the spiders which are in a square hole to the top of the hallway, they respawn very slowly, could take 30 minutes for them to come back (there are 3). After you get the egg, go back to the cave to the right and just above bears and black bears one screen to the right of the wheat field in semos plains. You have to go straight up in the cave passing the green dragon and to the right go down a short passage to the woman who hatches dragon eggs. It takes several days to hatch. The baby dragon will fight but it is easy for it to get killed, you could put it on another character you keep logged out until you have time to let it kill low level monsters that don't turn on lower level players or summons. They are a lot of fun and eat meat.
1
Spider quest in magic city school kills low level monsters .
Netbook screen display is garbled (has black/white & horizontal line patterns, screen freezes, and/or wrong display position)
Upon powering my netbook on, its screen turns into a garbled display (has black/white patterns, horizontal line patterns, screen freezes and/or wrong display position). This distortion happens even at BIOS startup, continuing to Windows startup. Occasionally, the issue starts around 3 minutes after the Windows desktop appears. Pictures of the monitor (click on image to enlarge): More pictures at: http://imgur.com/a/ArME1 Details: This happens even in safe mode (the last picture above is of the netbook screen in safe mode). I connected the netbook to an external monitor (through VGA) and the display in the external monitor shows up just fine. I have been able to use the netbook without any issues with an external monitor. Aside from the monitor, the netbook still works (I can shut it down with keyboard shortcuts) and the files that it has shared through LAN can be accessed fine. The torrent client's web interface on the netbook can also still be accessed on another computer. The issue sometimes happens even at BIOS startup. The variations of the distortion will sometimes change randomly. Occasionally, the non-distorted screen display will simply freeze. The netbook didn't fall in the ground or get hit by an object. The netbook is mostly used as a torrent seeder and downloader. Its lid is opened and closed around 2 times a day only, but the netbook is powered on almost 24/7 (its lid is closed most of the time). It is mostly accessed through another computer through LAN and is not often used directly. The netbook was bought around 2 years ago. What are the possible causes of this? Any possible fixes or methods of repair I can look into? The netbook is now out of warranty. Netbook details: Model: Samsung NP-N150 OS: Windows 7 Starter Graphics Chip: Intel GMA3150 Monitor: Screen Size 10.1", LED Backlit Other specs here: http://www.samsung.com/us/computer/laptops/NP-N150-JA01US-specs
Possible causes: Overheating as @Dan Neely says Physical issue with cable connecting LCD to motherboard BIOS not initializing GPU correctly, try BIOS update (this is a long shot) Motherboard needs to be replaced (bad chipset, or bad something else that would cost more than replacing the motherboard to fix)
1
Problem with motherboard BIOS not initializing GPU
Does a terminator have a form of self-preservation or prohibition against suicide?
This weekend I was watching Terminator 2 (editor cut). In the end, after T-1000 is destroyed, Arnold asks Sarah and John to destroy him by melting and says "I cannot destroy myself". So, what does this mean? The terminator cannot destroy himself unless it is absolutely necessary in order to succeed in his mission (like protect John?)? In that case, what was the Terminator in part 1 going to do after the success of his mission (i.e. destroy Sarah)? Just live a long happy life and wait for Skynet arise? Update: I understand that this is not the exact Third law of Asimov, since the terminators definitely don't follow the First or Second law. Let's call it the law of self-preservation. Does terminator have a form of self-preservation to some point and the prohibition of suicide?
Disclaimer: For the sake of building a rational explanation, I am going to assume that skynet does not have any knowledge of the three laws. That assumption is based on the obvious fact that they do harm humans, and allow humans to come to harm by any means necessary. I do believe that a T800 as designed by SkyNet is fully capable of self termination. For example, if one were facing capture by the resistance, it would be beneficial to SkyNet for the terminator to destroy itself, thus rendering the technology useless to the enemy. Plasma weapons would be effective in rendering any computational hardware unrecoverable, while the endoskeleton is less of a concern in 2018-2027. So why would a Terminator capable of self termination be unable to self-terminate when sent back in time? Ignoring the fact that plasma rifles are in short supply in the 1990's, prior to being sent back, John Connor instructed the Terminator with its mission parameters one of which could have been to have John or Sarah destroy the Terminator in a way that would not leave any recoverable technology behind. A Terminator can only self terminate itself to the point it stops functioning, but technology can still be recovered. Recovering this technology in the present is what allows SkyNet to be developed. Self-termination would not completely satisfy the requirements set forth by the parameter, and thus the Terminator cannot comply. The only other alternative would be for someone to continue to reduce the machine into harmless metal. It's convenient, however, that the movie ends in a metal foundry. I know someone is going to ask "Why not jump into the molten metal, then?" I like to believe that John would have wanted his younger self to learn a lesson of loss, and having to face a tough decision. Old John knows his mother is going to die soon, and losing the Terminator will help him do a practice run through the grieving process. He might also want to have himself develop an animosity toward the machines as he gets older...hating them for forcing him to destroy the machine he grew to love. We can see some of this resentment in T3, when he has an attitude with the Terminator. This could be some of the fuel for the fire inside John Connor of the future...
1
Why would a Terminator unable to self-terminate when sent back in time?
Google Static Map Authorisation with Key not working
I have the following Google Developer Console APIs with ON status: Google Maps Embed API Google Maps Javascript API v3 Static Maps API BigQuery AP Google Cloud SQL Google Cloud Storage Google Cloud Storage JSON API I have the following link in an HTML email: <img src='http://maps.google.com/staticmap?center=-15,-47&zoom=11&size=600x200&key=myKey'/> But I never get an image. The key works OK for an embedded map using an iframe. What am I doing wrong?
It won't work because you're trying to put it in an email, browsers work differently to email clients. Email clients block iframes for security purposes, see: Is there no way to embed a Google Map into an HTML email? You can check if your api key is working using the Google Maps API console https://code.google.com/apis/console/?pli=1 Update also you might want to update the bit of the string 'myKey' with your api key :)
0.888889
Is there no way to embed a Google Map into an HTML email?
Derivation of relationship between Gibbs free energy and electrochemical cell potential
Why is $\Delta G=-nFE?$ I don't understand what the motivation is behind this definition. Was it derived or just given? The textbook provides no justification for this equation. In fact, much of the book associated with the Gibbs free energy provides no justification and just says, 'This is how it is. Now go and solve some problems.'
I'm surprised your textbook did not derive this equation from the reaction isotherm relationship between $\Delta G$ and the reaction quotient $Q$ and the Nernst equation. The derivation is not hard. Reaction isotherm equation: $$\Delta_r G =\Delta_r G^\circ +RT\ln Q$$ Nernst Equation: $$E_{cell}=E^\circ_{cell} -\frac{RT}{nF}\ln Q$$ If we solve both equations for $RT\ln Q$, we get your equation (almost). $$RT\ln Q = \Delta_r G -\Delta_r G^\circ$$ $$RT\ln Q = nFE^\circ_{cell} - nFE_{cell}$$ $$\Delta_r G -\Delta_r G^\circ = nFE^\circ_{cell} - nFE_{cell}$$ Why is my equation not as simple as the one you started with? Your equation is at equilibrium, and I assumed that we might not be at equilibrium. At equilibrium, the following are true, which simplify the relationship. $$Q=K$$ $$\Delta_r G = 0$$ $$E_{cell} = 0$$ At equilibrium, $\Delta_r G = 0$ because the reaction has achieved a minimum energy state - the chemical potential $\mu_i=(\dfrac{\partial G}{\partial N_i})_{T,P}$ is also $0$ because there is no net change of state at equilibrium. Similarly $E_{cell} = 0$ at equilibrium. There is no change of state, and thus the redox reaction has ground to a halt. At equilibrium, the final relationship is $$\Delta_RG^\circ = nFE^\circ_{cell}$$
0.5
Reaction isotherm relationship with reaction quotient
What platform can I use to establish a users support forum?
I was asked to develop a users support community forum for a small and young hi-tech company. This kind of forums is very popular with companies these days and is a great alternative to the official product support lines. An example of what we look for is the Analog Devices' Engineer Zone forums. I am totally noob to this area so any advice will be appreciated - how to start developing such a site, what platforms are available (preferably open-source/free) and what are the advantages and disadvantages of these platforms. Is a stackexchange style forum appropriate for such site? * If you think there is a better SE site to post this question, please let me know.
A stackexchange style forum would be appropriate for this site (although there are many many other support forums out there). For a list of clones see this meta.stackexchange.com answer. The stackexchange model is designed around users helping users, but if your staff can take part then that's even better. If I were you I'd tweak the code so that users that are staff are clearly identified as such.
0.888889
A stackexchange style forum would be appropriate for this site
Log In / Sign Up on Splash screen?
Is it common to include Login / Sign Up actions on an app's splash screen? Or is it more efficient to first have a Splash screen, and then follow with a dedicated Log In / Sign Up page?
Avoid a splash screen, they are more for show than they are useful. The login/sign up page should be the first thing the user see's (if they need to log in to access content, i.e Facebook), if the user can access the site without logging in, then do not force them - have the option else where. So have a dedicated login page. Do we really need splash screens? EDIT IOS how not to use splash screens - A 2014 article
1
How to use splash screens?
Can I use Ubuntu to diagnose hard drive or RAM problems in Windows?
This may be a crazy question, but here goes... My brother suggested that I could somehow use either a Ubuntu Live Boot CD or Flash drive or Kubuntu as a way to diagnose issues I'm currently having with my laptop. I'm running Windows 7 and for some reason my laptop has suddenly started freezing during Windows start up. This started immediately after I began seeing the hard drive light remaining on and my computer running very, very slowly - even though when I checked Task Manager it said that no applications or unusual processes were running at the time and CPU usage was 0%. Strange, I know. I've used the Restore disks 3 times already, thinking maybe it was a virus, even though I run Norton 360 and it found nothing upon a full system scan. But every time I end up with Windows failing to start up at all, or it getting stuck on the "Windows Starting" screen for at least 15-20 minutes before it starts. I'm at a total loss here. I'm thinking it is either a Hard drive issue or perhaps a RAM issue, but I am a total moron when it comes to the operational aspect of computers. I don't know where to begin. My brother said that if I used a flash drive of Ubuntu or Kubuntu and tried to boot from there that I would know immediately if it was my Hard drive because it wouldn't operate. I don't understand that since it wouldn't be operating off my hard drive, it would be running from the CD/flash drive. Does anyone have any clues on what I can do to check this out? I'm tempted to buy a new hard drive and RAM, but would hate to buy something I can't return if they aren't the issue. I'm stuck...any help would be very appreciated. Thanks so much and have a wonderful weekend.
Yes, you can use a Live image of Ubuntu to diagnose several problems in you HDD (no matter what OS you have installed there). The only thing that matters is the Operating System that is installed has been shutdown properly (no hibernation) For HDD problems you can use gsmartcontrol. Boot from Live CD/DVD/USB of Ubuntu and select "Try Ubuntu". Then open a terminal (CTRL+ALT+T) and issue the following commands sudo apt-get install gsmartcontrol Then run in terminal gksudo gsmartcontrol Select your HDD and check the attributes. If you see any red marked text you will understand the failure of HDD. For RAM problems you can use a Live image and memtest86+ See here how : Memtest with Ubuntu 12.04 live CD
0.888889
Live image of Ubuntu to diagnose several HDD problems .
Difficulties with re-using a variable
here is a part of my code : class projet(object): def nameCouche(self): valLissage = float(ui.valLissage.displayText()) return (valLissage) valCouche = nameCouche() # asks for a positional argument but 'self' doesnt work def choixTraitement(self): ui.okLissage.clicked.connect(p.goLissage) def goLissage(self, valCouche): if ui.chkboxLissage.isChecked(): print(valCouche) # result is False os.system(r'"C:\Program Files\FME\fme.exe" D:\Stelios\..... --MAX_NUM_POINTS {0}'.format(valCouche)) So I would like to use valCouche in goLissage method but it doesnt work. I thought that valCouche would have the argument of valLissage but instead it gives False as a value. I've tried different alternatives but still doesnt work.
You have to declare variabile in the __init__ method (constructor) and then use it in your code ex: class projet(object): def __init__(self): self.valCouche = '' def nameCouche(self): valLissage = float(ui.valLissage.displayText()) return (valLissage) def choixTraitement(self): ui.okLissage.clicked.connect(p.goLissage) def goLissage(self, valCouche): if ui.chkboxLissage.isChecked(): self.valCouche = self.nameCouche() print(self.valCouche) # result is False os.system(r'"C:\Program Files\FME\fme.exe" D:\Stelios\..... --MAX_NUM_POINTS {0}'.format(self.valCouche))
0.888889
Variabile in the __init__ method
Does SQL Server 2008 R2 Express have Intellisense?
I don't have any Intellisense in SQL Server 2008 R2 Express Management Studio - is this supposed to work? I am connecting to a SQL Server 2008 R2 Express database on the same machine (no other databases here at home) and I have no Intellisense. Just wondering if it's supposed to work or is Express crippled?
try this to fix the problem, has to do with SP1 for vs2010 if you have that setup FIX: The IntelliSense feature in SSMS 2008 R2 may stop working after you install Visual Studio 2010 SP1
1
Visual Studio 2010 SP1 for vs2010
What are good situations to use Multi-Flash / Repeating Flash feature?
What can be done with the MULTI-Flash feature of a 580ex II flash? What are good situations to use this feature?
Stroboscopic flash (Multi mode on Canon, Repeating Flash on Nikon) fires several flashes within short time, by using shutter time long enough you can capture them all. You can calculate needed shutter time (in seconds) by dividing number of flashes by frequency in Herz. For example, 10 flashes at 5 Hz takes 2 seconds to fire. Typical application is single-frame chronophotography - capturing several phases of movement on same photo. So a suitable situation is where some interesting movement occurs. If the subject stays in one place during its movement (e.g. a dancer spinning), you can slowly pan your camera instead to have different phases recorded on different locations in your frame. A variation of this is capturing the same subject from several angles on single frame by moving your camera around it while the flash is strobing. The subject is still, but the camera is moving. So a suitable situation is when there are several views of the same subject you want to show simultaneously. For these techniques, dark background and light-colored subject tend to give better results. Another case would be when you want to imitate multiple flashes with one flash and you need constant frequency to form a pattern - when your flash is moving at constant speed this will give you flashes at equal distances: If you don't need constant frequency, manually triggering the flash (e.g. with "Test" button) will give you more control over the outcome.
1
Stroboscopic flash (Multi mode on Canon, Repeating Flash on Nikon)
diffrent theme for admin without use theme appearance config
by default Drupal(7) use "page.tpl.php" for all(front and admin) pages.but I want use another file for example "page-admin.tpl.php" for admin layout.i don't want change admin theme in config/appearance.
Copy page.tpl.php to page--admin.tpl.php (note two hyphens) clear theme registry / all caches and should be good to go.
0.666667
Copy page.tpl.php to page-admin / all caches
How to confirm if motherboard is broken
This is in reference to my other question. My phone was not working so I showed it to service center guy and he said the motherboard is broken and needs to be replaced. I can flash custom ROMs to the phone but they are not also booting up. So I just want to confirm does that really mean my motherboard is broken and needs to be replaced?
If it starts to boot (goes to the boot logo/animation) or Recovery/Download mode at least tries to load, then the motherboard is NOT damaged. Your device is soft-bricked, and just needs to have a compatible ROM flashed, and your userdata erased for your device to be fully functional again. The person is the service centre doesn't know what hey is talking about (I wouldn't trust those people - they just want your money).
1
If it starts to boot (goes to the boot logo/animation) or Recovery/Download mode at least tries to load, then
Can flexible plastics have reflective coating (vacuum metalized)?
Is it possible to achieve an optical mirror coating to a flexible plastic part? If vacuum metalization is possible, would the reflective coating layer be durable enough to withstand the bending of a flexible plastic such as polyurethane or a thermoplastic elastomer, without cracking over time?
It might be possible to deposit a metallic film on a sheet of plastic. It is however, a problem with respect to the bonding of that layer. Depending on the plastic used, it might not have a strong bond with the metal, which would then over time develop defects. On the other hand, it might be possible, when carefully manufacturing this, that the plastic has 'functional groups' (parts of the molecule with a specific function) that would bind a metal. Note however, that in this case, the functional groups might also react with other chemicals. Almost no functional group will only under go one reaction, especially not when metals are involved. Therefore, this would not be the most durable of options. Furthermore, because of the interface between, most likely, an amorphous solid (wikipedia, amorphous solids) and a metal structure is bound to create some defects. A last option I can think of, is the use of conductive polymers. These polymers, because in many ways they mimic metals, also have a similar 'shininess' to them. However, I'm not sure about their really being a mirror. Hope this helped.
1
conductive polymers have similar 'shininess' to metals
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"); }
If the NSLog doesn't print to the terminal (explain what is terminal). I assume terminal is the Xcode debugger console. Then, you need to check the Console.app, whether it's printed there. The new version of Xcode doesn't have this problem.
0.888889
NSLog doesn't print to the terminal
Creating Excel document is very slow
Attached is a generic code I wrote to create an Excel file with x number of worksheets. The problem I am having is that it's pretty slow, like 5 seconds a sheet. It was my understanding that using a for loop when creating the tables was ideal, but the issue seems to be with tables containing over a thousand or so records... still wouldn't think it should take this long. Any pointers would be appreciated, also, if I am completely left field with this code let me know, up-to-date Excel code resources seem to be hard to find. public static string Export(string excelFileName, string[] excelWorksheetName, string tableStyle, params System.Data.DataTable[] dt) { Application xls = new Application(); xls.SheetsInNewWorkbook = dt.Length; // Create our new excel application and add our workbooks/worksheets Workbooks workbooks = xls.Workbooks; Workbook workbook = workbooks.Add(); // Hide our excel object if it's visible. xls.Visible = false; // Turn off calculations if set to automatic; this can help prevent memory leaks. xls.Calculation = xls.Calculation == XlCalculation.xlCalculationAutomatic ? XlCalculation.xlCalculationManual : XlCalculation.xlCalculationManual; // Turn off screen updating so our export will process more quickly. xls.ScreenUpdating = false; // Create an excel table and fill it will our query table. int iterator = dt.Length - 1; for (int i = 0; i <= iterator; i++) { // Turn off calculations if set to automatic; this can help prevent memory leaks. Worksheet worksheet = (Worksheet)xls.Worksheets[i + 1]; worksheet.Name = excelWorksheetName[i]; worksheet.Select(); if (dt[i].Rows.Count > 0) { // Format this information as a table. Range tblRange = worksheet.get_Range("$A$1");//string.Format("$A$1", dt[i].Rows.Count + 1)); tblRange.Worksheet.ListObjects.Add(XlListObjectSourceType.xlSrcRange, tblRange, System.Type.Missing, XlYesNoGuess.xlYes, System.Type.Missing).Name = excelWorksheetName[i]; tblRange.Select(); tblRange.Worksheet.ListObjects[excelWorksheetName[i]].TableStyle = tableStyle; // Create a row with our column headers. for (int column = 0; column < dt[i].Columns.Count; column++) { worksheet.Cells[1, column + 1] = dt[i].Columns[column].ColumnName; } // Export our data table information to excel. for (int row = 0; row < dt[i].Rows.Count; row++) { for (int column = 0; column < dt[i].Columns.Count; column++) { worksheet.Cells[row + 2, column + 1] = (dt[i].Rows[row][column].ToString()); } } } // Freeze our column headers. xls.Application.Range["2:2"].Select(); xls.ActiveWindow.FreezePanes = true; xls.ActiveWindow.DisplayGridlines = false; // Auto fit our rows and columns. xls.Application.Cells.EntireColumn.AutoFit(); xls.Application.Cells.EntireRow.AutoFit(); // Select the first cell in the worksheet. xls.Application.Range["$A$2"].Select(); // Turn off alerts to prevent asking for 'overwrite existing' and 'save changes' messages. xls.DisplayAlerts = false; } string SaveFilePath = string.Format(@"{0}.xls", excelFileName); workbook.SaveAs(SaveFilePath, XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); workbook.Close(); // Release our resources. Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(workbooks); Marshal.ReleaseComObject(xls); Marshal.FinalReleaseComObject(xls); return SaveFilePath; }
Completed the new code, runs much faster than before without switching to XML options. This is almost instantaneous creation even with large files. public static string Export(string excelFileName, string[] excelWorksheetName, string tableStyle, params System.Data.DataTable[] dt) { Application excel = new Application(); excel.DisplayAlerts = false; excel.Visible = false; excel.ScreenUpdating = false; Workbooks workbooks = excel.Workbooks; Workbook workbook = workbooks.Add(Type.Missing); // Count of data tables provided. int iterator = dt.Length; for (int i = 0; i < iterator; i++) { Sheets worksheets = workbook.Sheets; Worksheet worksheet = (Worksheet)worksheets[i + 1]; worksheet.Name = excelWorksheetName[i]; int rows = dt[i].Rows.Count; int columns = dt[i].Columns.Count; // Add the +1 to allow room for column headers. var data = new object[rows + 1, columns]; // Insert column headers. for (var column = 0; column < columns; column++) { data[0, column] = dt[i].Columns[column].ColumnName; } // Insert the provided records. for (var row = 0; row < rows; row++) { for (var column = 0; column < columns; column++) { data[row + 1, column] = dt[i].Rows[row][column]; } } // Write this data to the excel worksheet. Range beginWrite = (Range)worksheet.Cells[1, 1]; Range endWrite = (Range)worksheet.Cells[rows + 1, columns]; Range sheetData = worksheet.Range[beginWrite, endWrite]; sheetData.Value2 = data; // Additional row, column and table formatting. worksheet.Select(); sheetData.Worksheet.ListObjects.Add(XlListObjectSourceType.xlSrcRange, sheetData, System.Type.Missing, XlYesNoGuess.xlYes, System.Type.Missing).Name = excelWorksheetName[i]; sheetData.Select(); sheetData.Worksheet.ListObjects[excelWorksheetName[i]].TableStyle = tableStyle; excel.Application.Range["2:2"].Select(); excel.ActiveWindow.FreezePanes = true; excel.ActiveWindow.DisplayGridlines = false; excel.Application.Cells.EntireColumn.AutoFit(); excel.Application.Cells.EntireRow.AutoFit(); // Select the first cell in the worksheet. excel.Application.Range["$A$2"].Select(); } // Turn off alerts to prevent asking for 'overwrite existing' and 'save changes' messages. excel.DisplayAlerts = false; // Save our workbook and close excel. string SaveFilePath = string.Format(@"{0}.xls", excelFileName); workbook.SaveAs(SaveFilePath, XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); workbook.Close(false, Type.Missing, Type.Missing); excel.Quit(); // Release our resources. Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(workbooks); Marshal.ReleaseComObject(excel); Marshal.FinalReleaseComObject(excel); return SaveFilePath; }
0.888889
XML options for creating a new file